1
0

avcodec/me_cmp: Zero MECmpContext in ff_me_cmp_init()

Not every function will be set, so zero the context
to initialize everything.

This also allows to remove an initialization in dvenc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-05-12 23:57:54 +02:00
parent 10e7633cd7
commit 8b4f7c0663
4 changed files with 2 additions and 6 deletions

View File

@ -98,7 +98,6 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
MECmpContext mecc;
me_cmp_func ildct_cmp[6];
memset(&mecc,0, sizeof(mecc));
ff_me_cmp_init(&mecc, avctx);
ret = ff_set_cmp(&mecc, ildct_cmp, avctx->ildct_cmp, 0);
if (ret < 0)

View File

@ -995,6 +995,8 @@ WRAPPER8_16_SQ(bit8x8_c, bit16_c)
av_cold void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx)
{
memset(c, 0, sizeof(*c));
c->sum_abs_dctelem = sum_abs_dctelem_c;
/* TODO [0] 16 [1] 8 */

View File

@ -131,12 +131,10 @@ int main(int argc, char **argv)
ctx = avcodec_alloc_context3(NULL);
ctx->flags |= AV_CODEC_FLAG_BITEXACT;
av_force_cpu_flags(0);
memset(&cctx, 0, sizeof(cctx));
ff_me_cmp_init(&cctx, ctx);
for (c = 0; c < flags_size; c++) {
int x;
av_force_cpu_flags(flags[c]);
memset(&mmxctx, 0, sizeof(mmxctx));
ff_me_cmp_init(&mmxctx, ctx);
for (x = 0; x < 2; x++) {

View File

@ -116,9 +116,6 @@ static void check_motion(void)
AVCodecContext av_ctx = { .codec_id = AV_CODEC_ID_NONE, .flags = AV_CODEC_FLAG_BITEXACT };
MECmpContext me_ctx;
memset(&me_ctx, 0, sizeof(me_ctx));
ff_me_cmp_init(&me_ctx, &av_ctx);
for (int i = 0; i < FF_ARRAY_ELEMS(me_ctx.pix_abs); i++) {