comparison targaenc.c @ 4676:046456cf7d31 libavcodec

Add 15 bit support, patch by Bobby Bingham, uhmmmm gmail com.
author diego
date Sat, 17 Mar 2007 12:56:34 +0000
parents e7bc1cf41f9f
children 47237f2638b2
comparison
equal deleted inserted replaced
4675:c23a5c8263bc 4676:046456cf7d31
44 memset(outbuf, 0, 11); 44 memset(outbuf, 0, 11);
45 AV_WL16(outbuf+12, avctx->width); 45 AV_WL16(outbuf+12, avctx->width);
46 AV_WL16(outbuf+14, avctx->height); 46 AV_WL16(outbuf+14, avctx->height);
47 outbuf[17] = 0x20; /* origin is top-left. no alpha */ 47 outbuf[17] = 0x20; /* origin is top-left. no alpha */
48 48
49 /* TODO: support alpha channel and other bit-depths. and RLE? */ 49 /* TODO: support alpha channel and RLE */
50 switch(avctx->pix_fmt) { 50 switch(avctx->pix_fmt) {
51 case PIX_FMT_GRAY8: 51 case PIX_FMT_GRAY8:
52 outbuf[2] = 3; /* uncompressed grayscale image */ 52 outbuf[2] = 3; /* uncompressed grayscale image */
53 outbuf[16] = 8; /* bpp */ 53 outbuf[16] = 8; /* bpp */
54 n = avctx->width; 54 n = avctx->width;
55 break;
56 case PIX_FMT_RGB555:
57 outbuf[2] = 2; /* uncompresses true-color image */
58 outbuf[16] = 16; /* bpp */
59 n = 2 * avctx->width;
55 break; 60 break;
56 case PIX_FMT_BGR24: 61 case PIX_FMT_BGR24:
57 outbuf[2] = 2; /* uncompressed true-color image */ 62 outbuf[2] = 2; /* uncompressed true-color image */
58 outbuf[16] = 24; /* bpp */ 63 outbuf[16] = 24; /* bpp */
59 n = 3 * avctx->width; 64 n = 3 * avctx->width;
90 .type = CODEC_TYPE_VIDEO, 95 .type = CODEC_TYPE_VIDEO,
91 .id = CODEC_ID_TARGA, 96 .id = CODEC_ID_TARGA,
92 .priv_data_size = 0, 97 .priv_data_size = 0,
93 .init = targa_encode_init, 98 .init = targa_encode_init,
94 .encode = targa_encode_frame, 99 .encode = targa_encode_frame,
95 .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_GRAY8, -1}, 100 .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, -1},
96 }; 101 };