[Libav-user] Unexpected memory allocation

Justas P justasp.groups at gmail.com
Mon Jul 23 14:14:31 EEST 2018

Hello all,

I'm dealing with an unexpected memory allocation by av_image_alloc(). The
code in question is:

AVFrame* picture_yuv_filtered = av_frame_alloc();

picture_yuv_filtered->format = codec_ctx->pix_fmt; // AV_PIX_FMT_YUV420P
picture_yuv_filtered->width = codec_ctx->width; // 720
picture_yuv_filtered->height = codec_ctx->height; // 576

ret = av_image_alloc(picture_yuv_filtered->data,
codec_ctx->width, codec_ctx->height, codec_ctx->pix_fmt, 32);

This returns linesizes of {736, 384, 384}, which is expected.
However, the pointers in the picture_yuv_filtered->data point to addresses:

[0] 22F40h
[1] 8A740h
[2] A5740h

The Y plane memory area ([1]-[0]) is just right, but the U plane ([2]-[1])
is half the required size.

Am I overlooking something here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180723/aea79110/attachment.html>

More information about the Libav-user mailing list