aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/dnxhddec.c
diff options
context:
space:
mode:
authorChristophe Gisquet2015-09-27 10:09:03 +0200
committerMichael Niedermayer2015-09-27 12:03:00 +0200
commit5c6e3a019c5cbcaeb17f3ae0da55070867d6f63d (patch)
tree4a4c2c6b3563f2261717c320d078cbab7f613725 /libavcodec/dnxhddec.c
parent8e8ed57ea7d33fa2b872884ead5ec3033637ce92 (diff)
dnxhddec: simplify block parsing calls
Fewer arguments, less duplicated code. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dnxhddec.c')
-rw-r--r--libavcodec/dnxhddec.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 34cf379884..007eabeafc 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -62,22 +62,18 @@ typedef struct DNXHDContext {
int mbaff;
int act;
void (*decode_dct_block)(const struct DNXHDContext *ctx,
- RowContext *row, int16_t *block,
- int n);
+ RowContext *row, int n);
} DNXHDContext;
#define DNXHD_VLC_BITS 9
#define DNXHD_DC_VLC_BITS 7
static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx,
- RowContext *row, int16_t *block,
- int n);
+ RowContext *row, int n);
static void dnxhd_decode_dct_block_10(const DNXHDContext *ctx,
- RowContext *row, int16_t *block,
- int n);
+ RowContext *row, int n);
static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,
- RowContext *row, int16_t *block,
- int n);
+ RowContext *row, int n);
static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
{
@@ -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,
RowContext *row,
- int16_t *block, int n,
+ int n,
int index_bits,
int level_bias,
int level_shift)
@@ -282,9 +278,12 @@ static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx,
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;
+ int16_t *block = row->blocks[n];
const int eob_index = ctx->cid_table->eob_index;
OPEN_READER(bs, &row->gb);
+ ctx->bdsp.clear_block(block);
+
if (!ctx->is_444) {
if (n & 2) {
component = 1 + (n & 1);
@@ -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,
- RowContext *row, int16_t *block,
- int n)
+ RowContext *row, 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,
- RowContext *row, int16_t *block,
- int n)
+ RowContext *row, 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,
- RowContext *row, int16_t *block,
- int n)
+ RowContext *row, 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,
@@ -418,15 +414,8 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
row->last_qscale = qscale;
}
- for (i = 0; i < 8; i++) {
- ctx->bdsp.clear_block(row->blocks[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);
- }
+ for (i = 0; i < 8 + 4 * ctx->is_444; i++) {
+ ctx->decode_dct_block(ctx, row, i);
}
if (frame->interlaced_frame) {