diff options
Diffstat (limited to 'libavcodec/8bps.c')
-rw-r--r-- | libavcodec/8bps.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index e1c03f9b96..7951bd8db0 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -2,20 +2,20 @@ * Quicktime Planar RGB (8BPS) Video Decoder * Copyright (C) 2003 Roberto Togni * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -27,7 +27,7 @@ * * Supports: PAL8 (RGB 8bpp, paletted) * : BGR24 (RGB 24bpp) (can also output it as RGB32) - * : RGB32 (RGB 32bpp, 4th plane is probably alpha and it's ignored) + * : RGB32 (RGB 32bpp, 4th plane is alpha) * */ @@ -72,7 +72,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, unsigned int dlen, p, row; const unsigned char *lp, *dp; unsigned char count; - unsigned int px_inc; unsigned int planes = c->planes; unsigned char *planemap = c->planemap; @@ -89,12 +88,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, /* Set data pointer after line lengths */ dp = encoded + planes * (height << 1); - /* Ignore alpha plane, don't know what to do with it */ - if (planes == 4) - planes--; - - px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32); - for (p = 0; p < planes; p++) { /* Lines length pointer for this plane */ lp = encoded + p * (height << 1); @@ -111,21 +104,21 @@ static int decode_frame(AVCodecContext *avctx, void *data, if ((count = *dp++) <= 127) { count++; dlen -= count + 1; - if (pixptr + count * px_inc > pixptr_end) + if (pixptr + count * planes > pixptr_end) break; if (dp + count > buf + buf_size) return -1; while (count--) { *pixptr = *dp++; - pixptr += px_inc; + pixptr += planes; } } else { count = 257 - count; - if (pixptr + count * px_inc > pixptr_end) + if (pixptr + count * planes > pixptr_end) break; while (count--) { *pixptr = *dp; - pixptr += px_inc; + pixptr += planes; } dp++; dlen -= 2; @@ -166,6 +159,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; c->pic.data[0] = NULL; + avcodec_get_frame_defaults(&c->pic); switch (avctx->bits_per_coded_sample) { case 8: avctx->pix_fmt = PIX_FMT_PAL8; @@ -186,12 +180,12 @@ static av_cold int decode_init(AVCodecContext *avctx) c->planemap[0] = 1; // 1st plane is red c->planemap[1] = 2; // 2nd plane is green c->planemap[2] = 3; // 3rd plane is blue - c->planemap[3] = 0; // 4th plane is alpha??? + c->planemap[3] = 0; // 4th plane is alpha #else c->planemap[0] = 2; // 1st plane is red c->planemap[1] = 1; // 2nd plane is green c->planemap[2] = 0; // 3rd plane is blue - c->planemap[3] = 3; // 4th plane is alpha??? + c->planemap[3] = 3; // 4th plane is alpha #endif break; default: |