diff options
Diffstat (limited to 'libavcodec/yop.c')
-rw-r--r-- | libavcodec/yop.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libavcodec/yop.c b/libavcodec/yop.c index 3a760c5345..092e84caa8 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -5,20 +5,20 @@ * derived from the code by * Copyright (C) 2009 Thomas P. Higdon <thomas.p.higdon@gmail.com> * - * 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 */ @@ -103,7 +103,7 @@ static av_cold int yop_decode_init(AVCodecContext *avctx) if (s->num_pal_colors + s->first_color[0] > 256 || s->num_pal_colors + s->first_color[1] > 256) { av_log(avctx, AV_LOG_ERROR, - "YOP: palette parameters invalid, header probably corrupt\n"); + "Palette parameters invalid, header probably corrupt\n"); return AVERROR_INVALIDDATA; } @@ -144,8 +144,7 @@ static int yop_copy_previous_block(YopDecContext *s, int linesize, int copy_tag) bufptr = s->dstptr + motion_vector[copy_tag][0] + linesize * motion_vector[copy_tag][1]; if (bufptr < s->dstbuf) { - av_log(s->avctx, AV_LOG_ERROR, - "YOP: cannot decode, file probably corrupt\n"); + av_log(s->avctx, AV_LOG_ERROR, "File probably corrupt\n"); return AVERROR_INVALIDDATA; } @@ -205,13 +204,20 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, s->low_nibble = NULL; is_odd_frame = avpkt->data[0]; + if(is_odd_frame>1){ + av_log(avctx, AV_LOG_ERROR, "frame is too odd %d\n", is_odd_frame); + return AVERROR_INVALIDDATA; + } firstcolor = s->first_color[is_odd_frame]; palette = (uint32_t *)frame->data[1]; - for (i = 0; i < s->num_pal_colors; i++, s->srcptr += 3) + for (i = 0; i < s->num_pal_colors; i++, s->srcptr += 3) { palette[i + firstcolor] = (s->srcptr[0] << 18) | (s->srcptr[1] << 10) | (s->srcptr[2] << 2); + palette[i + firstcolor] |= 0xFFU << 24 | + (palette[i + firstcolor] >> 6) & 0x30303; + } frame->palette_has_changed = 1; @@ -251,5 +257,4 @@ AVCodec ff_yop_decoder = { .init = yop_decode_init, .decode = yop_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"), - .capabilities = CODEC_CAP_DR1, }; |