checkasm/motion: Don't allocate AVCodecContext

Instead use one on the stack to avoid pulling in all
of libavcodec.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-09-25 17:55:40 +02:00
parent 97cd698ee4
commit 0228e27ded
1 changed files with 3 additions and 7 deletions

View File

@ -118,16 +118,14 @@ static void test_motion(const char *name, me_cmp_func test_func)
static void check_motion(void)
{
char buf[64];
AVCodecContext *av_ctx;
/* Setup AVCodecContext in a way that does not pull in all of libavcodec */
AVCodecContext av_ctx = { .codec_id = AV_CODEC_ID_NONE, .flags = AV_CODEC_FLAG_BITEXACT };
MECmpContext me_ctx;
memset(&me_ctx, 0, sizeof(me_ctx));
/* allocate AVCodecContext */
av_ctx = avcodec_alloc_context3(NULL);
av_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
ff_me_cmp_init(&me_ctx, av_ctx);
ff_me_cmp_init(&me_ctx, &av_ctx);
for (int i = 0; i < FF_ARRAY_ELEMS(me_ctx.pix_abs); i++) {
for (int j = 0; j < FF_ARRAY_ELEMS(me_ctx.pix_abs[0]); j++) {
@ -143,8 +141,6 @@ static void check_motion(void)
}
ME_CMP_1D_ARRAYS(XX)
#undef XX
avcodec_free_context(&av_ctx);
}
void checkasm_check_motion(void)