aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/targaenc.c
diff options
context:
space:
mode:
authorBobby Bingham <uhmmmm@gmail.com>2007-03-17 12:56:34 +0000
committerDiego Biurrun <diego@biurrun.de>2007-03-17 12:56:34 +0000
commit552cf71281bbd1065c8c47e7f3811f5a0ec6d79a (patch)
tree0ddf3e77a03c44a098664de95afef9e4c8b31a99 /libavcodec/targaenc.c
parenta7f7965a27632d89259a392bea70a8dff8f15972 (diff)
downloadffmpeg-552cf71281bbd1065c8c47e7f3811f5a0ec6d79a.tar.gz
Add 15 bit support, patch by Bobby Bingham, uhmmmm gmail com.
Originally committed as revision 8429 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/targaenc.c')
-rw-r--r--libavcodec/targaenc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c
index 27c28d2a58..e29e3b411d 100644
--- a/libavcodec/targaenc.c
+++ b/libavcodec/targaenc.c
@@ -46,13 +46,18 @@ static int targa_encode_frame(AVCodecContext *avctx,
AV_WL16(outbuf+14, avctx->height);
outbuf[17] = 0x20; /* origin is top-left. no alpha */
- /* TODO: support alpha channel and other bit-depths. and RLE? */
+ /* TODO: support alpha channel and RLE */
switch(avctx->pix_fmt) {
case PIX_FMT_GRAY8:
outbuf[2] = 3; /* uncompressed grayscale image */
outbuf[16] = 8; /* bpp */
n = avctx->width;
break;
+ case PIX_FMT_RGB555:
+ outbuf[2] = 2; /* uncompresses true-color image */
+ outbuf[16] = 16; /* bpp */
+ n = 2 * avctx->width;
+ break;
case PIX_FMT_BGR24:
outbuf[2] = 2; /* uncompressed true-color image */
outbuf[16] = 24; /* bpp */
@@ -92,5 +97,5 @@ AVCodec targa_encoder = {
.priv_data_size = 0,
.init = targa_encode_init,
.encode = targa_encode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_GRAY8, -1},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, -1},
};