aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-12 23:57:54 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-20 18:58:38 +0200
commit8b4f7c066373a4c373292c54b469a172d63fed35 (patch)
tree2b98456b5ef6c9ebf59c145771ef566e55c054b1
parent10e7633cd7d4b727c6cc0c907f1150e0359d7087 (diff)
downloadffmpeg-8b4f7c066373a4c373292c54b469a172d63fed35.tar.gz
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>
-rw-r--r--libavcodec/dvenc.c1
-rw-r--r--libavcodec/me_cmp.c2
-rw-r--r--libavcodec/tests/motion.c2
-rw-r--r--tests/checkasm/motion.c3
4 files changed, 2 insertions, 6 deletions
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 505f253e6d..19137e8b50 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -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)
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c
index 8368b0c1cb..b94d512660 100644
--- a/libavcodec/me_cmp.c
+++ b/libavcodec/me_cmp.c
@@ -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 */
diff --git a/libavcodec/tests/motion.c b/libavcodec/tests/motion.c
index caa8ecb8be..c37fc551c3 100644
--- a/libavcodec/tests/motion.c
+++ b/libavcodec/tests/motion.c
@@ -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++) {
diff --git a/tests/checkasm/motion.c b/tests/checkasm/motion.c
index bfd1a3c17b..7e322da0d5 100644
--- a/tests/checkasm/motion.c
+++ b/tests/checkasm/motion.c
@@ -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++) {