diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-10 23:12:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-10 23:12:24 +0100 |
commit | a9bd29e15e8d4ab4afaba7c31ebc0063c1df2db9 (patch) | |
tree | 6d7838b72e6ae2b4e390e278988b9a20d8aa2247 /libavcodec/bmp.c | |
parent | f4a01d7788449b08a3bd0569951860602bcd9eb5 (diff) | |
parent | 296a338261ebcfaf7b961a6d1e6a3adb4da69a61 (diff) | |
download | ffmpeg-a9bd29e15e8d4ab4afaba7c31ebc0063c1df2db9.tar.gz |
Merge remote-tracking branch 'richardpl/sws'
* richardpl/sws:
rgb2rgb: remove unused bgr8torgb8()
rgb2rgb: rgb12tobgr12()
rgb2rgb: allow conversion for <15 bpp
bmpenc: support for PIX_FMT_RGB444
bmpdec: support for rgb444 with bitfields compression
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bmp.c')
-rw-r--r-- | libavcodec/bmp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index 9a5c244644..bfa70bceb1 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -163,8 +163,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) |