aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/alsdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-24 10:15:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-24 10:15:50 +0200
commit865f34823c57fcb1a42a744cc9f38959ec5b427b (patch)
tree3b8f1701a13b7b87a38052c833aa2668aa4d1804 /libavcodec/alsdec.c
parent6bab3430a775183f2f9acbd91d1376c71e87c026 (diff)
parent70ecc175c7b513a153ac87d1c5d219556ca55070 (diff)
downloadandroid_external_ffmpeg-865f34823c57fcb1a42a744cc9f38959ec5b427b.tar.gz
android_external_ffmpeg-865f34823c57fcb1a42a744cc9f38959ec5b427b.tar.bz2
android_external_ffmpeg-865f34823c57fcb1a42a744cc9f38959ec5b427b.zip
Merge commit '70ecc175c7b513a153ac87d1c5d219556ca55070'
* commit '70ecc175c7b513a153ac87d1c5d219556ca55070': alsdec: Fix the clipping range Conflicts: libavcodec/alsdec.c See: feaff427c0df015146f660199453bd8c0314e677 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/alsdec.c')
-rw-r--r--libavcodec/alsdec.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index e7aeb0c7f0..e8235437b7 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1169,6 +1169,12 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
return 0;
}
+static inline int als_weighting(GetBitContext *gb, int k, int off)
+{
+ int idx = av_clip(decode_rice(gb, k) + off,
+ 0, FF_ARRAY_ELEMS(mcc_weightings) - 1);
+ return mcc_weightings[idx];
+}
/** Read the channel data.
*/
@@ -1189,14 +1195,14 @@ static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
if (current->master_channel != c) {
current->time_diff_flag = get_bits1(gb);
- current->weighting[0] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
- current->weighting[1] = mcc_weightings[av_clip(decode_rice(gb, 2) + 14, 0, 31)];
- current->weighting[2] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
+ current->weighting[0] = als_weighting(gb, 1, 16);
+ current->weighting[1] = als_weighting(gb, 2, 14);
+ current->weighting[2] = als_weighting(gb, 1, 16);
if (current->time_diff_flag) {
- current->weighting[3] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
- current->weighting[4] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
- current->weighting[5] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
+ current->weighting[3] = als_weighting(gb, 1, 16);
+ current->weighting[4] = als_weighting(gb, 1, 16);
+ current->weighting[5] = als_weighting(gb, 1, 16);
current->time_diff_sign = get_bits1(gb);
current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;