diff options
author | Roman Shaposhnik <roman@shaposhnik.org> | 2003-05-12 02:53:43 +0000 |
---|---|---|
committer | Roman Shaposhnik <roman@shaposhnik.org> | 2003-05-12 02:53:43 +0000 |
commit | affd55a1329cafa929108811f48f22a5e916aeb2 (patch) | |
tree | 49aaa92c241ed0f27e0dd33d34e3d3d8205da08b /libavcodec/imgconvert.c | |
parent | 5f6b58def20b820b0765858738552ea55a88c2e0 (diff) | |
download | ffmpeg-affd55a1329cafa929108811f48f22a5e916aeb2.tar.gz |
* 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
Originally committed as revision 1855 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 7b5645fd01..a19f1d3ed0 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -324,12 +324,15 @@ int avpicture_layout(AVPicture* src, int pix_fmt, int width, int height, 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 @@ int avpicture_layout(AVPicture* src, int pix_fmt, int width, int height, 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; } |