/**
- * @file vp56.h
+ * @file libavcodec/vp56.h
* VP5 and VP6 compatible video decoder (common features)
*
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
#include "vp56data.h"
#include "dsputil.h"
-#include "bitstream.h"
+#include "get_bits.h"
#include "bytestream.h"
int high;
int bits;
const uint8_t *buffer;
+ const uint8_t *end;
unsigned long code_word;
} VP56RangeCoder;
uint8_t coeff_runv[2][14]; /* run value (vp6 only) */
uint8_t mb_type[3][10][10]; /* model for decoding MB type */
uint8_t mb_types_stats[3][10][2];/* contextual, next MB type stats */
-} Vp56Model;
+} VP56Model;
struct vp56_context {
AVCodecContext *avctx;
int quantizer;
uint16_t dequant_dc;
uint16_t dequant_ac;
+ int8_t *qscale_table;
/* DC predictors management */
VP56RefDc *above_blocks;
/* blocks / macroblock */
VP56mb mb_type;
VP56Macroblock *macroblocks;
- DECLARE_ALIGNED_16(DCTELEM, block_coeff[6][64]);
+ DECLARE_ALIGNED_16(DCTELEM, block_coeff)[6][64];
/* motion vectors */
VP56mv mv[6]; /* vectors for each block in MB */
VP56ParseCoeffModels parse_coeff_models;
VP56ParseHeader parse_header;
- Vp56Model *modelp;
- Vp56Model models[2];
+ VP56Model *modelp;
+ VP56Model models[2];
/* huffman decoding */
int use_huffman;
int vp56_free(AVCodecContext *avctx);
void vp56_init_dequant(VP56Context *s, int quantizer);
int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
- const uint8_t *buf, int buf_size);
+ AVPacket *avpkt);
/**
c->high = 255;
c->bits = 8;
c->buffer = buf;
+ c->end = buf + buf_size;
c->code_word = bytestream_get_be16(&c->buffer);
}
while (c->high < 128) {
c->high <<= 1;
c->code_word <<= 1;
- if (--c->bits == 0) {
+ if (--c->bits == 0 && c->buffer < c->end) {
c->bits = 8;
c->code_word |= *c->buffer++;
}
/* normalize */
c->code_word <<= 1;
- if (--c->bits == 0) {
+ if (--c->bits == 0 && c->buffer < c->end) {
c->bits = 8;
c->code_word |= *c->buffer++;
}