[PATCH] Move colorspace setting details and range detection from sws_getContext() to sws_init_context().
Stefano Sabatini
stefano.sabatini-lala
Thu Sep 30 00:42:54 CEST 2010
---
utils.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/utils.c b/utils.c
index 83883b7..79eb0e8 100644
--- a/utils.c
+++ b/utils.c
@@ -763,8 +763,13 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
int dstW= c->dstW;
int dstH= c->dstH;
int flags;
- enum PixelFormat srcFormat= c->srcFormat;
- enum PixelFormat dstFormat= c->dstFormat;
+ enum PixelFormat srcFormat, dstFormat;
+ c->srcRange = handle_jpeg(&c->srcFormat);
+ c->dstRange = handle_jpeg(&c->dstFormat);
+ srcFormat = c->srcFormat;
+ dstFormat = c->dstFormat;
+
+ 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);
flags= c->flags = update_flags_cpu(c->flags);
#if ARCH_X86
@@ -1148,8 +1153,6 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat 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;
@@ -1157,7 +1160,6 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat 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);
--
1.7.1
--tThc/1wpZn/ma/RB--
More information about the ffmpeg-devel
mailing list