mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-11 08:13:06 +00:00
avcodec/huffyuvencdsp: Add width parameter to init
This allows to only use certain functions using wide registers if there is enough work to do and if one can even read a whole register wide without overreading. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -278,7 +278,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
s->mask = (1 << s->bps) - 1;
|
||||
s->vlc_n = FFMIN(1 << s->bps, MAX_VLC_N);
|
||||
|
||||
ff_huffyuvencdsp_init(&s->hencdsp, s->bps);
|
||||
ff_huffyuvencdsp_init(&s->hencdsp, s->bps, avctx->width >> s->chroma_h_shift);
|
||||
|
||||
switch (avctx->pix_fmt) {
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
|
||||
@@ -84,12 +84,12 @@ static void sub_hfyu_median_pred_int16_c(uint16_t *dst, const uint16_t *src1, co
|
||||
*left_top = lt;
|
||||
}
|
||||
|
||||
av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, int bpp)
|
||||
av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, int bpp, int width)
|
||||
{
|
||||
c->diff_int16 = diff_int16_c;
|
||||
c->sub_hfyu_median_pred_int16 = sub_hfyu_median_pred_int16_c;
|
||||
|
||||
#if ARCH_X86 && HAVE_X86ASM
|
||||
ff_huffyuvencdsp_init_x86(c, bpp);
|
||||
ff_huffyuvencdsp_init_x86(c, bpp, width);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct HuffYUVEncDSPContext {
|
||||
int w, int *left, int *left_top);
|
||||
} HuffYUVEncDSPContext;
|
||||
|
||||
void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, int bpp);
|
||||
void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int bpp);
|
||||
void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, int bpp, int width);
|
||||
void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int bpp, int width);
|
||||
|
||||
#endif /* AVCODEC_HUFFYUVENCDSP_H */
|
||||
|
||||
@@ -34,7 +34,7 @@ void ff_diff_int16_avx2(uint16_t *dst, const uint16_t *src1, const uint16_t *src
|
||||
void ff_sub_hfyu_median_pred_int16_mmxext(uint16_t *dst, const uint16_t *src1, const uint16_t *src2,
|
||||
unsigned mask, int w, int *left, int *left_top);
|
||||
|
||||
av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int bpp)
|
||||
av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int bpp, int width)
|
||||
{
|
||||
av_unused int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ static void check_sub_hfyu_median_pred_int16(const char *aligned, unsigned width
|
||||
for (size_t i = 0; i < FF_ARRAY_ELEMS(bpps); ++i) {
|
||||
const int bpp = bpps[i];
|
||||
|
||||
ff_huffyuvencdsp_init(&c, bpp);
|
||||
ff_huffyuvencdsp_init(&c, bpp, width);
|
||||
|
||||
if (check_func(c.sub_hfyu_median_pred_int16, "sub_hfyu_median_pred_int16_%dbpp%s", bpp, aligned)) {
|
||||
DECLARE_ALIGNED(32, uint16_t, dst0)[MAX_WIDTH];
|
||||
|
||||
Reference in New Issue
Block a user