diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-03-28 05:02:48 +0400 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-04-11 14:09:08 +0400 |
commit | 89ef08c992c484a46711b1a68a988303679c288e (patch) | |
tree | a14b2c03d2c31183f9c72e5f688117b35cfbde2e /libavcodec/dnxhddec.c | |
parent | a7448064c526f097a47355e2ddb7722a06eeb5e3 (diff) |
DNxHD: K&R formatting cosmetics
Diffstat (limited to 'libavcodec/dnxhddec.c')
-rw-r--r-- | libavcodec/dnxhddec.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 021f87da53..4daee04cf0 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -53,9 +53,12 @@ typedef struct DNXHDContext { #define DNXHD_VLC_BITS 9 #define DNXHD_DC_VLC_BITS 7 -static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, int16_t *block, int n, int qscale); -static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, int16_t *block, int n, int qscale); -static void dnxhd_decode_dct_block_10_444(DNXHDContext *ctx, int16_t *block, int n, int qscale); +static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, int16_t *block, + int n, int qscale); +static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, int16_t *block, + int n, int qscale); +static void dnxhd_decode_dct_block_10_444(DNXHDContext *ctx, int16_t *block, + int n, int qscale); static av_cold int dnxhd_decode_init(AVCodecContext *avctx) { @@ -90,14 +93,16 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid) ctx->cid_table->run_bits, 1, 1, ctx->cid_table->run_codes, 2, 2, 0); - ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, ff_zigzag_direct); + ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, + ff_zigzag_direct); ctx->cid = cid; } return 0; } static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, - const uint8_t *buf, int buf_size, int first_field) + const uint8_t *buf, int buf_size, + int first_field) { static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 }; static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 }; @@ -114,7 +119,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, ctx->cur_field = buf[5] & 1; frame->interlaced_frame = 1; frame->top_field_first = first_field ^ ctx->cur_field; - av_log(ctx->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field); + av_log(ctx->avctx, AV_LOG_DEBUG, + "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field); } ctx->height = AV_RB16(buf + 0x18); @@ -161,22 +167,24 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, return AVERROR_INVALIDDATA; } - ctx->mb_width = ctx->width>>4; + ctx->mb_width = ctx->width >> 4; ctx->mb_height = buf[0x16d]; - av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height); + av_dlog(ctx->avctx, + "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height); - if ((ctx->height+15)>>4 == ctx->mb_height && frame->interlaced_frame) + if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame) ctx->height <<= 1; if (ctx->mb_height > 68 || - (ctx->mb_height << frame->interlaced_frame) > (ctx->height+15)>>4) { - av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height); + (ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) { + av_log(ctx->avctx, AV_LOG_ERROR, + "mb height too big: %d\n", ctx->mb_height); return AVERROR_INVALIDDATA; } for (i = 0; i < ctx->mb_height; i++) { - ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2)); + ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2)); av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]); if (buf_size < ctx->mb_scan_index[i] + 0x280) { av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n"); @@ -200,11 +208,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx, OPEN_READER(bs, &ctx->gb); if (!ctx->is_444) { - if (n&2) { - component = 1 + (n&1); + if (n & 2) { + component = 1 + (n & 1); weight_matrix = ctx->cid_table->chroma_weight; } else { - component = 0; + component = 0; weight_matrix = ctx->cid_table->luma_weight; } } else { @@ -255,13 +263,13 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx, break; } - j = ctx->scantable.permutated[i]; - level = (2*level+1) * qscale * weight_matrix[i]; + j = ctx->scantable.permutated[i]; + level = (2 * level + 1) * qscale * weight_matrix[i]; if (level_bias < 32 || weight_matrix[i] != level_bias) level += level_bias; level >>= level_shift; - block[j] = (level^sign) - sign; + block[j] = (level ^ sign) - sign; } CLOSE_READER(bs, &ctx->gb); @@ -285,7 +293,8 @@ static void dnxhd_decode_dct_block_10_444(DNXHDContext *ctx, int16_t *block, dnxhd_decode_dct_block(ctx, block, n, qscale, 6, 32, 6); } -static int dnxhd_decode_macroblock(DNXHDContext *ctx, AVFrame *frame, int x, int y) +static int dnxhd_decode_macroblock(DNXHDContext *ctx, AVFrame *frame, + int x, int y) { int shift1 = ctx->bit_depth == 10; int dct_linesize_luma = frame->linesize[0]; @@ -378,8 +387,8 @@ static int dnxhd_decode_macroblocks(DNXHDContext *ctx, AVFrame *frame, return 0; } -static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, - AVPacket *avpkt) +static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, + int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; @@ -390,7 +399,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, av_dlog(avctx, "frame size %d\n", buf_size); - decode_coding_unit: +decode_coding_unit: if ((ret = dnxhd_decode_header(ctx, picture, buf, buf_size, first_field)) < 0) return ret; |