diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-01-10 16:06:02 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-01-10 09:29:22 -0800 |
commit | 84e5159e25d2fd35bdceef4678c199e27d1b88ce (patch) | |
tree | 85da595d8b6b58874d3348230bebdca49584ad2b /libavcodec/bmpenc.c | |
parent | b14fa5572c2a3bb1d8cd6327c4687a2eee363bbb (diff) | |
download | ffmpeg-84e5159e25d2fd35bdceef4678c199e27d1b88ce.tar.gz |
bmpenc: support for PIX_FMT_RGB444
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/bmpenc.c')
-rw-r--r-- | libavcodec/bmpenc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index 9cd7adb390..ca2951ab37 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -27,6 +27,7 @@ static const uint32_t monoblack_pal[] = { 0x000000, 0xFFFFFF }; static const uint32_t rgb565_masks[] = { 0xF800, 0x07E0, 0x001F }; +static const uint32_t rgb444_masks[] = { 0x0F00, 0x00F0, 0x000F }; static av_cold int bmp_encode_init(AVCodecContext *avctx){ BMPContext *s = avctx->priv_data; @@ -39,9 +40,8 @@ static av_cold int bmp_encode_init(AVCodecContext *avctx){ avctx->bits_per_coded_sample = 24; break; case PIX_FMT_RGB555: - avctx->bits_per_coded_sample = 16; - break; case PIX_FMT_RGB565: + case PIX_FMT_RGB444: avctx->bits_per_coded_sample = 16; break; case PIX_FMT_RGB8: @@ -77,6 +77,11 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s p->pict_type= AV_PICTURE_TYPE_I; p->key_frame= 1; switch (avctx->pix_fmt) { + case PIX_FMT_RGB444: + compression = BMP_BITFIELDS; + pal = rgb444_masks; // abuse pal to hold color masks + pal_entries = 3; + break; case PIX_FMT_RGB565: compression = BMP_BITFIELDS; pal = rgb565_masks; // abuse pal to hold color masks @@ -158,7 +163,7 @@ AVCodec ff_bmp_encoder = { .encode = bmp_encode_frame, .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_BGR24, - PIX_FMT_RGB555, PIX_FMT_RGB565, + PIX_FMT_RGB555, PIX_FMT_RGB444, PIX_FMT_RGB565, PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8, PIX_FMT_MONOBLACK, PIX_FMT_NONE}, |