Index: source/blender/imbuf/intern/anim.c =================================================================== --- source/blender/imbuf/intern/anim.c (revision 28084) +++ source/blender/imbuf/intern/anim.c (working copy) @@ -612,6 +612,25 @@ } if (anim->ib_flags & IB_animdeinterlace) { + +#if (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29) + /* The following for color space determination */ + int srcRange, dstRange, brightness, contrast, saturation; + int *inv_table, *table; + + if (anim == 0) return (0); + + /* The magic to assert we get full range for YUV to RGB, instead of + mapping into 16-235 (only supported by newer ffmpeg versions) */ + if (!sws_getColorspaceDetails(anim->img_convert_ctx, &inv_table, &srcRange, + &table, &dstRange, &brightness, &contrast, &saturation)) { + srcRange = srcRange || anim->pCodecCtx->color_range == AVCOL_RANGE_JPEG; + inv_table = sws_getCoefficients(anim->pCodecCtx->colorspace); + sws_setColorspaceDetails(anim->img_convert_ctx, inv_table, srcRange, + table, dstRange, brightness, contrast, saturation); + } +#endif + avpicture_fill((AVPicture*) anim->pFrameDeinterlaced, MEM_callocN(avpicture_get_size( anim->pCodecCtx->pix_fmt,