aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-03-18 12:31:53 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-03-18 12:31:53 +0000
commitedf97a75f98896965f78a13010f318b234bed9fa (patch)
tree28ca0728158760b152ae2b4a73ae22ffa10684b7
parentd2bfaf8aaed754062c6867bfb53b16234e9543ec (diff)
downloadffmpeg-edf97a75f98896965f78a13010f318b234bed9fa.tar.gz
fix full range (jpeg yuv) chroma
Originally committed as revision 22713 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r--libswscale/swscale.c7
-rw-r--r--libswscale/yuv2rgb.c5
-rw-r--r--libswscale/yuv2rgb_init.c5
3 files changed, 16 insertions, 1 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index f034c54071..f6a23425bf 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1876,7 +1876,12 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange
if(!srcRange){
cy= (cy*255) / 219;
oy= 16<<16;
- }
+ }else{
+ crv= (crv*224) / 255;
+ cbu= (cbu*224) / 255;
+ cgu= (cgu*224) / 255;
+ cgv= (cgv*224) / 255;
+ }
cy = (cy *contrast )>>16;
crv= (crv*contrast * saturation)>>32;
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 3e81866498..af7f86f401 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -670,6 +670,11 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
if(!fullRange){
cy= (cy*255) / 219;
oy= 16<<16;
+ }else{
+ crv= (crv*224) / 255;
+ cbu= (cbu*224) / 255;
+ cgu= (cgu*224) / 255;
+ cgv= (cgv*224) / 255;
}
cy = (cy *contrast )>>16;
diff --git a/libswscale/yuv2rgb_init.c b/libswscale/yuv2rgb_init.c
index 14c46b0e40..371dce5da2 100644
--- a/libswscale/yuv2rgb_init.c
+++ b/libswscale/yuv2rgb_init.c
@@ -263,6 +263,11 @@ int yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange,
if (fullRange) {
cy = 1 << 16;
oy = 0;
+ crv= (crv*224) / 255;
+ cbu= (cbu*224) / 255;
+ cgu= (cgu*224) / 255;
+ cgv= (cgv*224) / 255;
+ //FIXME maybe its cleaner if the tables where based on full range (*244/255)
} else {
cy = ((1 << 16) * 255) / 219;
oy= 16 << 16;