OLD | NEW |
1 /* | 1 /* |
2 * Electronic Arts TGV Video Decoder | 2 * Electronic Arts TGV Video Decoder |
3 * Copyright (c) 2007-2008 Peter Ross | 3 * Copyright (c) 2007-2008 Peter Ross |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 /* read compressed blocks */ | 185 /* read compressed blocks */ |
186 init_get_bits(&gb, buf, (buf_end-buf)<<3); | 186 init_get_bits(&gb, buf, (buf_end-buf)<<3); |
187 for (i=0; i<num_blocks_packed; i++) { | 187 for (i=0; i<num_blocks_packed; i++) { |
188 int tmp[4]; | 188 int tmp[4]; |
189 for(j=0; j<4; j++) | 189 for(j=0; j<4; j++) |
190 tmp[j] = get_bits(&gb, 8); | 190 tmp[j] = get_bits(&gb, 8); |
191 for(j=0; j<16; j++) | 191 for(j=0; j<16; j++) |
192 s->block_codebook[i][15-j] = tmp[get_bits(&gb, 2)]; | 192 s->block_codebook[i][15-j] = tmp[get_bits(&gb, 2)]; |
193 } | 193 } |
194 | 194 |
| 195 if (get_bits_left(&gb) < vector_bits * |
| 196 (s->avctx->height/4) * (s->avctx->width/4)) |
| 197 return -1; |
| 198 |
195 /* read vectors and build frame */ | 199 /* read vectors and build frame */ |
196 for(y=0; y<s->avctx->height/4; y++) | 200 for(y=0; y<s->avctx->height/4; y++) |
197 for(x=0; x<s->avctx->width/4; x++) { | 201 for(x=0; x<s->avctx->width/4; x++) { |
198 unsigned int vector = get_bits(&gb, vector_bits); | 202 unsigned int vector = get_bits(&gb, vector_bits); |
199 const unsigned char *src; | 203 const unsigned char *src; |
200 int src_stride; | 204 int src_stride; |
201 | 205 |
202 if (vector < num_mvs) { | 206 if (vector < num_mvs) { |
203 src = s->last_frame.data[0] + | 207 src = s->last_frame.data[0] + |
204 (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] + | 208 (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] + |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 "eatgv", | 337 "eatgv", |
334 CODEC_TYPE_VIDEO, | 338 CODEC_TYPE_VIDEO, |
335 CODEC_ID_TGV, | 339 CODEC_ID_TGV, |
336 sizeof(TgvContext), | 340 sizeof(TgvContext), |
337 tgv_decode_init, | 341 tgv_decode_init, |
338 NULL, | 342 NULL, |
339 tgv_decode_end, | 343 tgv_decode_end, |
340 tgv_decode_frame, | 344 tgv_decode_frame, |
341 .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"), | 345 .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"), |
342 }; | 346 }; |
OLD | NEW |