unsigned int width, height;
enum AVPixelFormat pix_fmt;
unsigned int mb_width, mb_height;
- uint32_t *mb_scan_index;
+ uint32_t mb_scan_index[256];
int data_offset; // End of mb_scan_index, where macroblocks start
int cur_field; ///< current interlaced field
VLC ac_vlc, dc_vlc, run_vlc;
static const uint8_t header_prefixhr2[] = { 0x00, 0x00, 0x03, 0x8C, 0x03 };
int i, cid, ret;
int old_bit_depth = ctx->bit_depth, bitdepth;
- int old_mb_height = ctx->mb_height;
if (buf_size < 0x280) {
av_log(ctx->avctx, AV_LOG_ERROR,
return AVERROR_INVALIDDATA;
}
- if (ctx->mb_height != old_mb_height) {
- av_freep(&ctx->mb_scan_index);
-
- ctx->mb_scan_index = av_mallocz_array(ctx->mb_height, sizeof(uint32_t));
- if (!ctx->mb_scan_index)
- return AVERROR(ENOMEM);
- }
+ av_assert0((unsigned)ctx->mb_height <= FF_ARRAY_ELEMS(ctx->mb_scan_index));
for (i = 0; i < ctx->mb_height; i++) {
ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));
int level, component, sign;
const int *scale;
const uint8_t *weight_matrix;
- const uint8_t *ac_level = ctx->cid_table->ac_level;
- const uint8_t *ac_flags = ctx->cid_table->ac_flags;
+ const uint8_t *ac_info = ctx->cid_table->ac_info;
int16_t *block = row->blocks[n];
const int eob_index = ctx->cid_table->eob_index;
int ret = 0;
DNXHD_VLC_BITS, 2);
while (index1 != eob_index) {
- level = ac_level[index1];
- flags = ac_flags[index1];
+ level = ac_info[2*index1+0];
+ flags = ac_info[2*index1+1];
sign = SHOW_SBITS(bs, &row->gb, 1);
SKIP_BITS(bs, &row->gb, 1);
ff_free_vlc(&ctx->dc_vlc);
ff_free_vlc(&ctx->run_vlc);
- av_freep(&ctx->mb_scan_index);
av_freep(&ctx->rows);
return 0;