[Ffmpeg-devel] Re: Re: [BUG] TSCC wrong colors on PPC

Kostya kostya.forjunk
Sat Feb 4 15:13:53 CET 2006


Fri, 3 Feb 2006 13:50:48 +0100 Diego Biurrun wrote:
> 
> On Sun, Jan 29, 2006 at 01:11:54PM -0800, Mike Melanson wrote:
> > Diego Biurrun wrote:
> > >Mike, do you have your development machines in sufficient order to
> > >tackle this now?
> > 
> > 	Nope. I'm still a video driver and 2 SATA cables away from full 
> > operating capacity (ideally).
> 
> I've been hearing on the grapevine that your machine is now fully
> functional ;)  It would be nice to have this in the release...
> 
> Diego
> 
I've managed to get access (for an hour) to monitor for my MacMini, so here is the patch. Tested with pal8, rgb555 and rgba32 samples. Hope it will work for you too ;). 
-------------- next part --------------
--- tscc.c.orig	2006-01-20 07:50:08.000000000 +0200
+++ tscc.c	2006-02-04 16:03:17.000000000 +0200
@@ -107,8 +107,20 @@
                 src += p2 * (c->bpp / 8);
                 continue;
             }
-            for(i = 0; i < p2 * (c->bpp / 8); i++) {
-                *output++ = *src++;
+            if(c->bpp != 16 && c->bpp != 32) {
+                for(i = 0; i < p2 * (c->bpp / 8); i++) {
+                    *output++ = *src++;
+                }
+            } else if(c->bpp == 16) {
+                for(i = 0; i < p2; i++) {
+                    *((uint16_t*)output) = le2me_16(*((uint16_t*)src));
+                    output += 2; src += 2;
+                }
+            } else { // if(c->bpp == 32) {
+                for(i = 0; i < p2; i++) {
+                    *((uint32_t*)output) = le2me_32(*((uint32_t*)src));
+                    output += 4; src += 4;
+                }
             }
             // RLE8 copy is actually padded - and runs are not!
             if(c->bpp == 8 && (p2 & 1)) {
@@ -120,17 +132,15 @@
             switch(c->bpp){
             case  8: pix[0] = *src++;
                      break;
-            case 16: pix[0] = *src++;
-                     pix[1] = *src++;
+            case 16: *((uint16_t*)pix) = le2me_16(*((uint16_t*)src));
+                     src += 2;
                      break;
             case 24: pix[0] = *src++;
                      pix[1] = *src++;
                      pix[2] = *src++;
                      break;
-            case 32: pix[0] = *src++;
-                     pix[1] = *src++;
-                     pix[2] = *src++;
-                     pix[3] = *src++;
+            case 32: *((uint32_t*)pix) = le2me_32(*((uint32_t*)src));
+                     src += 4;
                      break;
             }
             if (output + p1 * (c->bpp / 8) > output_end)
@@ -139,17 +149,15 @@
                 switch(c->bpp){
                 case  8: *output++ = pix[0];
                          break;
-                case 16: *output++ = pix[0];
-                         *output++ = pix[1];
+                case 16: *((uint16_t*)output) = *((uint16_t*)pix);
+                         output += 2;
                          break;
                 case 24: *output++ = pix[0];
                          *output++ = pix[1];
                          *output++ = pix[2];
                          break;
-                case 32: *output++ = pix[0];
-                         *output++ = pix[1];
-                         *output++ = pix[2];
-                         *output++ = pix[3];
+                case 32: *((uint32_t*)output) = *((uint32_t*)pix);
+                         output += 4;
                          break;
                 }
             }



More information about the ffmpeg-devel mailing list