changeset 22976:d581a6ba2d9c

improve horizontal chroma resolution with pal
author michael
date Sun, 15 Apr 2007 01:27:34 +0000
parents c91bb8f1cd85
children f758291ff4fb
files libswscale/swscale.c libswscale/swscale_template.c
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Sun Apr 15 00:53:32 2007 +0000
+++ b/libswscale/swscale.c	Sun Apr 15 01:27:34 2007 +0000
@@ -2036,7 +2036,10 @@
 	c->chrSrcVSubSample+= c->vChrDrop;
 
 	// drop every 2. pixel for chroma calculation unless user wants full chroma
-	if((isBGR(srcFormat) || isRGB(srcFormat)) && !(flags&SWS_FULL_CHR_H_INP)) 
+	if((isBGR(srcFormat) || isRGB(srcFormat)) && !(flags&SWS_FULL_CHR_H_INP)
+           && srcFormat!=PIX_FMT_RGB8      && srcFormat!=PIX_FMT_BGR8
+           && srcFormat!=PIX_FMT_RGB4      && srcFormat!=PIX_FMT_BGR4
+           && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE)
 		c->chrSrcHSubSample=1;
 
 	if(param){
--- a/libswscale/swscale_template.c	Sun Apr 15 00:53:32 2007 +0000
+++ b/libswscale/swscale_template.c	Sun Apr 15 01:27:34 2007 +0000
@@ -2296,12 +2296,10 @@
         assert(src1 == src2);
 	for(i=0; i<width; i++)
 	{
-		int d0= src1[2*i  ];
-		int d1= src1[2*i+1];
-                int p = (pal[d0]&0xFF00FF) + (pal[d1]&0xFF00FF);
+		int p= pal[src1[i]];
 
-		dstU[i]= (pal[d0]+pal[d1]-p)>>9;
-		dstV[i]= p>>17;
+		dstU[i]= p>>8;
+		dstV[i]= p>>16;
 	}
 }