diff --git a/libswscale/utils.c b/libswscale/utils.c index ab8a68e241..186dc16e13 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -2510,16 +2510,30 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, int64_t src_h_chr_pos = -513, dst_h_chr_pos = -513, src_v_chr_pos = -513, dst_v_chr_pos = -513; + enum AVPixelFormat srcFormatHandled = srcFormat, dstFormatHandled = dstFormat; + int src_range = handle_jpeg(&srcFormatHandled); + int src_xyz = handle_xyz(&srcFormatHandled); + int src_0alpha = handle_0alpha(&srcFormatHandled); + int dst_range = handle_jpeg(&dstFormatHandled); + int dst_xyz = handle_xyz(&dstFormatHandled); + int dst_0alpha = handle_0alpha(&dstFormatHandled); + if (!param) param = default_param; if (context && (context->srcW != srcW || context->srcH != srcH || - context->srcFormat != srcFormat || + context->srcFormat != srcFormatHandled || + context->srcRange != src_range || + context->srcXYZ != src_xyz || + context->src0Alpha != src_0alpha || context->dstW != dstW || context->dstH != dstH || - context->dstFormat != dstFormat || + context->dstFormat != dstFormatHandled || + context->dstRange != dst_range || + context->dstXYZ != dst_xyz || + context->dst0Alpha != dst_0alpha || context->flags != flags || context->param[0] != param[0] || context->param[1] != param[1])) {