*/
/**
- * @file vp3.c
+ * @file libavcodec/vp3.c
* On2 VP3 Video Decoder
*
* VP3 Video Decoder by Mike Melanson (mike at multimedia.cx)
#include "avcodec.h"
#include "dsputil.h"
-#include "bitstream.h"
+#include "get_bits.h"
#include "vp3data.h"
#include "xiph.h"
int right_edge = 0;
int bottom_edge = 0;
int superblock_row_inc = 0;
- int *hilbert = NULL;
int mapping_index = 0;
int current_macroblock;
current_height = 0;
superblock_row_inc = s->macroblock_width -
(s->y_superblock_width * 2 - s->macroblock_width);
- hilbert = hilbert_walk_mb;
mapping_index = 0;
current_macroblock = -1;
for (i = 0; i < s->u_superblock_start; i++) {
/* is it a custom coding scheme? */
if (scheme == 0) {
+ for (i = 0; i < 8; i++)
+ custom_mode_alphabet[i] = MODE_INTER_NO_MV;
for (i = 0; i < 8; i++)
custom_mode_alphabet[get_bits(gb, 3)] = i;
}
s->width = (avctx->width + 15) & 0xFFFFFFF0;
s->height = (avctx->height + 15) & 0xFFFFFFF0;
avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
if(avctx->idct_algo==FF_IDCT_AUTO)
avctx->idct_algo=FF_IDCT_VP3;
dsputil_init(&s->dsp, avctx);
*/
static int vp3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ AVPacket *avpkt)
{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
static int counter = 0;
}
s->huff_code_size++;
s->hbits <<= 1;
- read_huffman_tree(avctx, gb);
+ if (read_huffman_tree(avctx, gb))
+ return -1;
s->hbits |= 1;
- read_huffman_tree(avctx, gb);
+ if (read_huffman_tree(avctx, gb))
+ return -1;
s->hbits >>= 1;
s->huff_code_size--;
}
s->huff_code_size = 1;
if (!get_bits1(gb)) {
s->hbits = 0;
- read_huffman_tree(avctx, gb);
+ if(read_huffman_tree(avctx, gb))
+ return -1;
s->hbits = 1;
- read_huffman_tree(avctx, gb);
+ if(read_huffman_tree(avctx, gb))
+ return -1;
}
}
return 0;
}
-static int theora_decode_init(AVCodecContext *avctx)
+static av_cold int theora_decode_init(AVCodecContext *avctx)
{
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
}
// FIXME: Check for this as well.
- skip_bits(&gb, 6*8); /* "theora" */
+ skip_bits_long(&gb, 6*8); /* "theora" */
switch(ptype)
{
// theora_decode_comments(avctx, gb);
break;
case 0x82:
- theora_decode_tables(avctx, &gb);
+ if (theora_decode_tables(avctx, &gb))
+ return -1;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype&~0x80);