Commit 5c6e3a01 authored by Christophe Gisquet's avatar Christophe Gisquet Committed by Michael Niedermayer

dnxhddec: simplify block parsing calls

Fewer arguments, less duplicated code.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 8e8ed57e
...@@ -62,22 +62,18 @@ typedef struct DNXHDContext { ...@@ -62,22 +62,18 @@ typedef struct DNXHDContext {
int mbaff; int mbaff;
int act; int act;
void (*decode_dct_block)(const struct DNXHDContext *ctx, void (*decode_dct_block)(const struct DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n);
int n);
} DNXHDContext; } DNXHDContext;
#define DNXHD_VLC_BITS 9 #define DNXHD_VLC_BITS 9
#define DNXHD_DC_VLC_BITS 7 #define DNXHD_DC_VLC_BITS 7
static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx, static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n);
int n);
static void dnxhd_decode_dct_block_10(const DNXHDContext *ctx, static void dnxhd_decode_dct_block_10(const DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n);
int n);
static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx, static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n);
int n);
static av_cold int dnxhd_decode_init(AVCodecContext *avctx) static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
{ {
...@@ -271,7 +267,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, ...@@ -271,7 +267,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx, static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx,
RowContext *row, RowContext *row,
int16_t *block, int n, int n,
int index_bits, int index_bits,
int level_bias, int level_bias,
int level_shift) int level_shift)
...@@ -282,9 +278,12 @@ static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx, ...@@ -282,9 +278,12 @@ static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx,
const uint8_t *weight_matrix; const uint8_t *weight_matrix;
const uint8_t *ac_level = ctx->cid_table->ac_level; const uint8_t *ac_level = ctx->cid_table->ac_level;
const uint8_t *ac_flags = ctx->cid_table->ac_flags; const uint8_t *ac_flags = ctx->cid_table->ac_flags;
int16_t *block = row->blocks[n];
const int eob_index = ctx->cid_table->eob_index; const int eob_index = ctx->cid_table->eob_index;
OPEN_READER(bs, &row->gb); OPEN_READER(bs, &row->gb);
ctx->bdsp.clear_block(block);
if (!ctx->is_444) { if (!ctx->is_444) {
if (n & 2) { if (n & 2) {
component = 1 + (n & 1); component = 1 + (n & 1);
...@@ -364,24 +363,21 @@ static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx, ...@@ -364,24 +363,21 @@ static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx,
} }
static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx, static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n)
int n)
{ {
dnxhd_decode_dct_block(ctx, row, block, n, 4, 32, 6); dnxhd_decode_dct_block(ctx, row, n, 4, 32, 6);
} }
static void dnxhd_decode_dct_block_10(const DNXHDContext *ctx, static void dnxhd_decode_dct_block_10(const DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n)
int n)
{ {
dnxhd_decode_dct_block(ctx, row, block, n, 6, 8, 4); dnxhd_decode_dct_block(ctx, row, n, 6, 8, 4);
} }
static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx, static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,
RowContext *row, int16_t *block, RowContext *row, int n)
int n)
{ {
dnxhd_decode_dct_block(ctx, row, block, n, 6, 32, 6); dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6);
} }
static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
...@@ -418,15 +414,8 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, ...@@ -418,15 +414,8 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
row->last_qscale = qscale; row->last_qscale = qscale;
} }
for (i = 0; i < 8; i++) { for (i = 0; i < 8 + 4 * ctx->is_444; i++) {
ctx->bdsp.clear_block(row->blocks[i]); ctx->decode_dct_block(ctx, row, i);
ctx->decode_dct_block(ctx, row, row->blocks[i], i);
}
if (ctx->is_444) {
for (; i < 12; i++) {
ctx->bdsp.clear_block(row->blocks[i]);
ctx->decode_dct_block(ctx, row, row->blocks[i], i);
}
} }
if (frame->interlaced_frame) { if (frame->interlaced_frame) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment