diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-01-03 01:19:23 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-01-03 21:12:53 +0100 |
commit | 43ff4aed26cba2cce230972add631ab938d33b30 (patch) | |
tree | 55e3e95735f6946b852d3bb97ae5ae7c4722760a /libavcodec/atrac3plus.c | |
parent | 713654d9d3a6931a9b4cd0cffa4bb61cd1357977 (diff) | |
download | ffmpeg-43ff4aed26cba2cce230972add631ab938d33b30.tar.gz |
lavc: use get_bitsz to simplify the code
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/atrac3plus.c')
-rw-r--r-- | libavcodec/atrac3plus.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c index b16a13971d..46e0beafc2 100644 --- a/libavcodec/atrac3plus.c +++ b/libavcodec/atrac3plus.c @@ -39,9 +39,6 @@ static VLC spec_vlc_tabs[112]; static VLC gain_vlc_tabs[11]; static VLC tone_vlc_tabs[7]; -#define GET_DELTA(gb, delta_bits) \ - ((delta_bits) ? get_bits((gb), (delta_bits)) : 0) - /** * Generate canonical VLC table from given descriptor. * @@ -384,7 +381,7 @@ static int decode_channel_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, chan->qu_wordlen[i] = get_bits(gb, 3); for (i = pos; i < chan->num_coded_vals; i++) - chan->qu_wordlen[i] = (min_val + GET_DELTA(gb, delta_bits)) & 7; + chan->qu_wordlen[i] = (min_val + get_bitsz(gb, delta_bits)) & 7; } } break; @@ -516,7 +513,7 @@ static int decode_channel_sf_idx(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, /* all others are: min_val + delta */ for (i = num_long_vals; i < ctx->used_quant_units; i++) chan->qu_sf_idx[i] = (chan->qu_sf_idx[i] + min_val + - GET_DELTA(gb, delta_bits)) & 0x3F; + get_bitsz(gb, delta_bits)) & 0x3F; } else { num_long_vals = get_bits(gb, 5); delta_bits = get_bits(gb, 3); @@ -534,7 +531,7 @@ static int decode_channel_sf_idx(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, /* all others are: min_val + delta */ for (i = num_long_vals; i < ctx->used_quant_units; i++) chan->qu_sf_idx[i] = (min_val + - GET_DELTA(gb, delta_bits)) & 0x3F; + get_bitsz(gb, delta_bits)) & 0x3F; } } break; @@ -1014,7 +1011,7 @@ static int decode_gainc_npoints(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, min_val = get_bits(gb, 3); for (i = 0; i < coded_subbands; i++) { - chan->gain_data[i].num_points = min_val + GET_DELTA(gb, delta_bits); + chan->gain_data[i].num_points = min_val + get_bitsz(gb, delta_bits); if (chan->gain_data[i].num_points > 7) return AVERROR_INVALIDDATA; } @@ -1134,7 +1131,7 @@ static int decode_gainc_levels(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, for (sb = 0; sb < coded_subbands; sb++) for (i = 0; i < chan->gain_data[sb].num_points; i++) { - chan->gain_data[sb].lev_code[i] = min_val + GET_DELTA(gb, delta_bits); + chan->gain_data[sb].lev_code[i] = min_val + get_bitsz(gb, delta_bits); if (chan->gain_data[sb].lev_code[i] > 15) return AVERROR_INVALIDDATA; } |