<div dir="ltr">Hello all,<div><br></div><div>I'm dealing with an unexpected memory allocation by <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">av_image_alloc(). The code in question is:</span></div><div><br></div><div><div>AVFrame* picture_yuv_filtered = av_frame_alloc();</div><div><br></div><div>picture_yuv_filtered->format = codec_ctx->pix_fmt; // AV_PIX_FMT_YUV420P</div><div>picture_yuv_filtered->width = codec_ctx->width; // 720</div><div>picture_yuv_filtered->height = codec_ctx->height; // 576</div><div><br></div><div>ret = av_image_alloc(picture_yuv_filtered->data, picture_yuv_filtered->linesize,</div><div><span style="white-space:pre">               </span>codec_ctx->width, codec_ctx->height, codec_ctx->pix_fmt, 32);</div></div><div><br></div><div>This returns linesizes of {736, 384, 384}, which is expected.</div><div>However, the pointers in the <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">picture_yuv_filtered->data point to addresses:</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">[0] 22F40h</span></div><div>[1] 8A740h</div><div>[2] A5740h</div><div><br></div><div>The Y plane memory area ([1]-[0]) is just right, but the U plane ([2]-[1]) is half the required size. </div><div><br></div><div>Am I overlooking something here?</div><div><br></div><div>BR,</div><div>~Justas</div></div>