diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-14 05:19:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-16 02:44:25 +0200 |
commit | 37f4aa133d0a0daa04661f65a016451525df7d0f (patch) | |
tree | 745e43fa8531f9b4806332b04ce215e719e50d0d /libswscale | |
parent | 4f1d3e02122e1896c2d946ae8c32b8b3f767aa19 (diff) | |
download | ffmpeg-37f4aa133d0a0daa04661f65a016451525df7d0f.tar.gz |
swscale: move default colorspace setup to sws_init_filter()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/utils.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 3fd603870a..0aa540b8e7 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1091,8 +1091,14 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, unscaled = (srcW == dstW && srcH == dstH); - handle_jpeg(&c->srcFormat); - handle_jpeg(&c->dstFormat); + c->srcRange |= handle_jpeg(&c->srcFormat); + c->dstRange |= handle_jpeg(&c->dstFormat); + + if (!c->contrast && !c->saturation && !c->dstFormatBpp) + sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, + ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], + c->dstRange, 0, 1 << 16, 1 << 16); + if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat) av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); handle_formats(c); @@ -1586,8 +1592,6 @@ SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, c->srcH = srcH; c->dstW = dstW; c->dstH = dstH; - c->srcRange = handle_jpeg(&srcFormat); - c->dstRange = handle_jpeg(&dstFormat); c->srcFormat = srcFormat; c->dstFormat = dstFormat; @@ -1595,9 +1599,6 @@ SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, c->param[0] = param[0]; c->param[1] = param[1]; } - sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, - ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, - c->dstRange, 0, 1 << 16, 1 << 16); if (sws_init_context(c, srcFilter, dstFilter) < 0) { sws_freeContext(c); @@ -2027,19 +2028,13 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, return NULL; context->srcW = srcW; context->srcH = srcH; - context->srcRange = handle_jpeg(&srcFormat); context->srcFormat = srcFormat; context->dstW = dstW; context->dstH = dstH; - context->dstRange = handle_jpeg(&dstFormat); context->dstFormat = dstFormat; context->flags = flags; context->param[0] = param[0]; context->param[1] = param[1]; - sws_setColorspaceDetails(context, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], - context->srcRange, - ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, - context->dstRange, 0, 1 << 16, 1 << 16); if (sws_init_context(context, srcFilter, dstFilter) < 0) { sws_freeContext(context); return NULL; |