summaryrefslogtreecommitdiff
path: root/libavcodec/targa.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2006-11-03 13:13:08 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2006-11-03 13:13:08 +0000
commit57aff8858194a931c8936d3f0cb092045c279734 (patch)
treea64c0b9a0849b7a4ea522d7821f723df9add1646 /libavcodec/targa.c
parent25225c37731bfb3129139eea7fa61cdb2b1e0321 (diff)
RGB32 support in Targa
Originally committed as revision 6883 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/targa.c')
-rw-r--r--libavcodec/targa.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index c3d6010d24..4eb18f87e8 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -68,6 +68,9 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, uint8_t *sr
dst[1] = src[1];
dst[2] = src[2];
break;
+ case 4:
+ *((uint32_t*)dst) = LE_32(src);
+ break;
}
dst += depth;
if(!type)
@@ -128,6 +131,9 @@ static int decode_frame(AVCodecContext *avctx,
case 24:
avctx->pix_fmt = PIX_FMT_BGR24;
break;
+ case 32:
+ avctx->pix_fmt = PIX_FMT_RGBA32;
+ break;
default:
av_log(avctx, AV_LOG_ERROR, "Bit depth %i is not supported\n", s->bpp);
return -1;
@@ -195,6 +201,10 @@ static int decode_frame(AVCodecContext *avctx,
uint16_t *dst16 = (uint16_t*)dst;
for(x = 0; x < s->width; x++)
dst16[x] = LE_16(buf + x * 2);
+ }else if((s->bpp + 1) >> 3 == 4){
+ uint32_t *dst32 = (uint32_t*)dst;
+ for(x = 0; x < s->width; x++)
+ dst32[x] = LE_32(buf + x * 4);
}else
#endif
memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3));