Fix #127654: Video Deinterlace option does not work in some cases

Looks like ffmpeg AVFrame width/height/format for the deinterlaced frame
was never initialized. That was not a problem until starting with 4.1
the colorspace conversion and upside down flip was started to be
multi-threaded, which accessed the frame width/height.

Also, the memory storage for the deinterlaced frame was never freed
either; fix that too.

Pull Request: https://projects.blender.org/blender/blender/pulls/127689
This commit is contained in:
Aras Pranckevicius
2024-09-17 06:05:55 +02:00
committed by Aras Pranckevicius
parent fffec9a12a
commit bab4f7a0cd

View File

@@ -399,6 +399,9 @@ static int startffmpeg(ImBufAnim *anim)
}
if (anim->ib_flags & IB_animdeinterlace) {
anim->pFrameDeinterlaced->format = anim->pCodecCtx->pix_fmt;
anim->pFrameDeinterlaced->width = anim->pCodecCtx->width;
anim->pFrameDeinterlaced->height = anim->pCodecCtx->height;
av_image_fill_arrays(
anim->pFrameDeinterlaced->data,
anim->pFrameDeinterlaced->linesize,
@@ -1175,6 +1178,9 @@ static void free_anim_ffmpeg(ImBufAnim *anim)
av_frame_free(&anim->pFrame);
av_frame_free(&anim->pFrame_backup);
av_frame_free(&anim->pFrameRGB);
if (anim->pFrameDeinterlaced->data[0] != nullptr) {
MEM_freeN(anim->pFrameDeinterlaced->data[0]);
}
av_frame_free(&anim->pFrameDeinterlaced);
BKE_ffmpeg_sws_release_context(anim->img_convert_ctx);
}