changeset 1243:5d2376294fbf libavcodec

* fixing a bug in avpicture_layout (PAL8 wasn't handled properly) * adding regression tests for all pix_fmt conversions * making libavtest part of the default testsuite
author romansh
date Mon, 12 May 2003 02:53:43 +0000
parents db903b6fd197
children a02df1ba6c7f
files imgconvert.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/imgconvert.c	Sun May 11 11:26:35 2003 +0000
+++ b/imgconvert.c	Mon May 12 02:53:43 2003 +0000
@@ -324,12 +324,15 @@
     if (size > dest_size)
         return -1;
 
-    if (pf->pixel_type == FF_PIXEL_PACKED) {
+    if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) {
         if (pix_fmt == PIX_FMT_YUV422 || pix_fmt == PIX_FMT_RGB565 ||
 	    pix_fmt == PIX_FMT_RGB555)
 	  w = width * 2;
+	else if (pix_fmt == PIX_FMT_PAL8)
+	  w = width;
 	else
 	  w = width * (pf->depth * pf->nb_channels / 8);
+	  
 	data_planes = 1;
 	h = height;
     } else {
@@ -350,7 +353,10 @@
 	     s += src->linesize[i];
 	 }
     }
-
+    
+    if (pf->pixel_type == FF_PIXEL_PALETTE)
+	memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4);
+    
     return size;
 }