diff options
author | Anne-Laure de Smit <annelaure.desmit@gmail.com> | 2009-09-30 21:23:47 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2009-09-30 21:23:47 +0000 |
commit | 2aa6e87a9714c2275203b531dc51c74addecc66c (patch) | |
tree | ca0c5959126c61ae235bc81df9d57c7e4223ea47 /libavcodec/sgienc.c | |
parent | 5200b901476fa939f8792204d90b053f134e97a1 (diff) | |
download | ffmpeg-2aa6e87a9714c2275203b531dc51c74addecc66c.tar.gz |
Add support for SGI images without RLE compression.
patch by Anne-Laure de Smit, annelaure.desmit gmail com
Originally committed as revision 20104 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/sgienc.c')
-rw-r--r-- | libavcodec/sgienc.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c index a206ae562b..37bba972e0 100644 --- a/libavcodec/sgienc.c +++ b/libavcodec/sgienc.c @@ -83,7 +83,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, /* Encode header. */ bytestream_put_be16(&buf, SGI_MAGIC); - bytestream_put_byte(&buf, 1); /* RLE */ + bytestream_put_byte(&buf, avctx->coder_type != FF_CODER_TYPE_RAW); /* RLE 1 - VERBATIM 0*/ bytestream_put_byte(&buf, 1); /* bytes_per_channel */ bytestream_put_be16(&buf, dimension); bytestream_put_be16(&buf, width); @@ -106,6 +106,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, buf += 404; offsettab = buf; + if (avctx->coder_type != FF_CODER_TYPE_RAW) { /* Skip RLE offset table. */ buf += tablesize; lengthtab = buf; @@ -139,6 +140,19 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, } av_free(encode_buf); + } else { + for (z = 0; z < depth; z++) { + in_buf = p->data[0] + p->linesize[0] * (height - 1) + z; + + for (y = 0; y < height; y++) { + for (x = 0; x < width * depth; x += depth) + bytestream_put_byte(&buf, in_buf[x]); + + in_buf -= p->linesize[0]; + } + } + } + /* total length */ return buf - orig_buf; } |