summaryrefslogtreecommitdiff
path: root/libavcodec/nuv.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2007-09-09 08:22:07 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2007-09-09 08:22:07 +0000
commitc612b00d7eb68102fb48ce9b36030b92fb3fa0e8 (patch)
tree97d28030532cbe8e1136cf98fbad8b1582fd23d7 /libavcodec/nuv.c
parentdd6ca72186951afadcfc4cd638aab0d72b23059e (diff)
Simplify nuv: factor out LZO decompression
Originally committed as revision 10440 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r--libavcodec/nuv.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 93637112a0..176fc252f3 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -114,11 +114,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
// skip rest of the frameheader.
buf = &buf[12];
buf_size -= 12;
+ if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
+ int outlen = c->decomp_size, inlen = buf_size;
+ if (lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
+ av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
+ buf = c->decomp_buf;
+ buf_size = c->decomp_size;
+ }
c->pic.pict_type = FF_I_TYPE;
c->pic.key_frame = 1;
// decompress/copy/whatever data
switch (comptype) {
+ case NUV_LZO:
case NUV_UNCOMPRESSED: {
int height = c->height;
if (buf_size < c->width * height * 3 / 2) {
@@ -128,24 +136,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
copy_frame(&c->pic, buf, c->width, height);
break;
}
+ case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG: {
rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
break;
}
- case NUV_RTJPEG_IN_LZO: {
- int outlen = c->decomp_size, inlen = buf_size;
- if (lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
- av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
- rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, c->decomp_buf, c->decomp_size);
- break;
- }
- case NUV_LZO: {
- int outlen = c->decomp_size, inlen = buf_size;
- if (lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
- av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
- copy_frame(&c->pic, c->decomp_buf, c->width, c->height);
- break;
- }
case NUV_BLACK: {
memset(c->pic.data[0], 0, c->width * c->height);
memset(c->pic.data[1], 128, c->width * c->height / 4);