changeset 10713:6193f96a04d5

100l fix for paletted 8bpp files, I committed an old version
author rtognimp
date Thu, 28 Aug 2003 22:01:44 +0000
parents 03b410c39759
children 240e212130d3
files libmpcodecs/vd_qt8bps.c
diffstat 1 files changed, 4 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_qt8bps.c	Thu Aug 28 21:23:40 2003 +0000
+++ b/libmpcodecs/vd_qt8bps.c	Thu Aug 28 22:01:44 2003 +0000
@@ -84,8 +84,6 @@
   int vo_ret; // Video output init ret value
   qt8bps_context_t *hc; // Decoder context
   BITMAPINFOHEADER *bih = sh->bih;
-  int i;
-  unsigned char *psrc, *pdest;
 
   if ((hc = malloc(sizeof(qt8bps_context_t))) == NULL) {
     mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Can't allocate memory for 8BPS decoder context.\n");
@@ -99,16 +97,10 @@
     case 8:
       hc->planes = 1;
       hc->planemap[0] = 0; // 1st plane is palette indexes
-	    if (bih->biSize > sizeof(BITMAPINFOHEADER)) {
-        psrc = (unsigned char*)bih + sizeof(BITMAPINFOHEADER);
-        pdest = hc->palette = (unsigned char *)malloc(256*3);
-        for (i = 0; i < 256; i++) {
-          *pdest++ = *psrc++;
-          *pdest++ = *psrc++;
-          *pdest++ = *psrc++;
-          psrc++;
-        }
-	    }
+      if (bih->biSize > sizeof(BITMAPINFOHEADER)) {
+        hc->palette = (unsigned char *)malloc(256*4);
+        memcpy(hc->palette, (unsigned char*)bih + sizeof(BITMAPINFOHEADER), 256*4);
+      }
       break;
     case 24:
       hc->planes = 3;