[FFmpeg-cvslog] bmpdec: support for rgb444 with bitfields compression
Paul B Mahol
git at videolan.org
Wed Jan 11 02:57:11 CET 2012
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Jan 9 23:37:24 2012 +0000| [353a2d2164c09740e42f33014c4773b93e96a0d2] | committer: Ronald S. Bultje
bmpdec: support for rgb444 with bitfields compression
Do not display garbage for invalid/unsupported bitfields values.
Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=353a2d2164c09740e42f33014c4773b93e96a0d2
---
libavcodec/bmp.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index f438d106..1f725f5 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -162,8 +162,18 @@ static int bmp_decode_frame(AVCodecContext *avctx,
case 16:
if(comp == BMP_RGB)
avctx->pix_fmt = PIX_FMT_RGB555;
- if(comp == BMP_BITFIELDS)
- avctx->pix_fmt = rgb[1] == 0x07E0 ? PIX_FMT_RGB565 : PIX_FMT_RGB555;
+ else if (comp == BMP_BITFIELDS) {
+ if (rgb[0] == 0xF800 && rgb[1] == 0x07E0 && rgb[2] == 0x001F)
+ avctx->pix_fmt = PIX_FMT_RGB565;
+ else if (rgb[0] == 0x7C00 && rgb[1] == 0x03E0 && rgb[2] == 0x001F)
+ avctx->pix_fmt = PIX_FMT_RGB555;
+ else if (rgb[0] == 0x0F00 && rgb[1] == 0x00F0 && rgb[2] == 0x000F)
+ avctx->pix_fmt = PIX_FMT_RGB444;
+ else {
+ av_log(avctx, AV_LOG_ERROR, "Unknown bitfields %0X %0X %0X\n", rgb[0], rgb[1], rgb[2]);
+ return AVERROR(EINVAL);
+ }
+ }
break;
case 8:
if(hsize - ihsize - 14 > 0)
More information about the ffmpeg-cvslog
mailing list