changeset 22695:f37a3ef2685e

fix full range (jpeg yuv) chroma
author michael
date Sun, 18 Mar 2007 12:31:53 +0000
parents 595f9fb80827
children 3eba30a92c20
files libswscale/swscale.c libswscale/yuv2rgb.c libswscale/yuv2rgb_init.c
diffstat 3 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Sun Mar 18 11:04:47 2007 +0000
+++ b/libswscale/swscale.c	Sun Mar 18 12:31:53 2007 +0000
@@ -1876,7 +1876,12 @@
 	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;
--- a/libswscale/yuv2rgb.c	Sun Mar 18 11:04:47 2007 +0000
+++ b/libswscale/yuv2rgb.c	Sun Mar 18 12:31:53 2007 +0000
@@ -670,6 +670,11 @@
     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;
--- a/libswscale/yuv2rgb_init.c	Sun Mar 18 11:04:47 2007 +0000
+++ b/libswscale/yuv2rgb_init.c	Sun Mar 18 12:31:53 2007 +0000
@@ -263,6 +263,11 @@
     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;