aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-03 21:46:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-10-03 21:46:42 +0200
commit4a63c69faac6fca4eea6fc4e8466ebdc8c4575c5 (patch)
tree93e2a4a8b3f3af332e04fd09157e394832f210b7
parent2ece7d94bc35ba0ee2b650caec25853b9fcc2eb7 (diff)
parent79cbac8cd456c3f1c914bd1e7262b55e48de13a7 (diff)
downloadffmpeg-4a63c69faac6fca4eea6fc4e8466ebdc8c4575c5.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: atrac3: Generalize gain compensation code Conflicts: libavcodec/atrac.c libavcodec/atrac.h libavcodec/atrac3.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/atrac.c14
-rw-r--r--libavcodec/atrac.h16
-rw-r--r--libavcodec/atrac3.c9
3 files changed, 19 insertions, 20 deletions
diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c
index f960ffc594..12e8997dbc 100644
--- a/libavcodec/atrac.c
+++ b/libavcodec/atrac.c
@@ -88,7 +88,8 @@ void ff_atrac_gain_compensation(AtracGCContext *gctx, float *in, float *prev,
float lev, gc_scale, gain_inc;
int i, pos, lastpos;
- gc_scale = gc_next->num_points ? gctx->gain_tab1[gc_next->levcode[0]] : 1.0f;
+ gc_scale = gc_next->num_points ? gctx->gain_tab1[gc_next->lev_code[0]]
+ : 1.0f;
if (!gc_now->num_points) {
for (pos = 0; pos < num_samples; pos++)
@@ -97,13 +98,12 @@ void ff_atrac_gain_compensation(AtracGCContext *gctx, float *in, float *prev,
pos = 0;
for (i = 0; i < gc_now->num_points; i++) {
- lastpos = gc_now->loccode[i] << gctx->loc_scale;
+ lastpos = gc_now->loc_code[i] << gctx->loc_scale;
- lev = gctx->gain_tab1[gc_now->levcode[i]];
- gain_inc = gctx->gain_tab2[(i + 1 < gc_now->num_points
- ? gc_now->levcode[i + 1]
- : gctx->id2exp_offset)
- - gc_now->levcode[i] + 15];
+ lev = gctx->gain_tab1[gc_now->lev_code[i]];
+ gain_inc = gctx->gain_tab2[(i + 1 < gc_now->num_points ? gc_now->lev_code[i + 1]
+ : gctx->id2exp_offset) -
+ gc_now->lev_code[i] + 15];
/* apply constant gain level and overlap */
for (; pos < lastpos; pos++)
diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h
index c389256723..05208bbee6 100644
--- a/libavcodec/atrac.h
+++ b/libavcodec/atrac.h
@@ -33,20 +33,20 @@
* Gain control parameters for one subband.
*/
typedef struct AtracGainInfo {
- int num_points; ///< number of gain control points
- int levcode[7]; ///< level at corresponding control point
- int loccode[7]; ///< location of gain control points
+ int num_points; ///< number of gain control points
+ int lev_code[7]; ///< level at corresponding control point
+ int loc_code[7]; ///< location of gain control points
} AtracGainInfo;
/**
* Gain compensation context structure.
*/
typedef struct AtracGCContext {
- float gain_tab1[16]; ///< gain compensation level table
- float gain_tab2[31]; ///< gain compensation interpolation table
- int id2exp_offset; ///< offset for converting level index into level exponent
- int loc_scale; ///< scale of location code = 2^loc_scale samples
- int loc_size; ///< size of location code in samples
+ float gain_tab1[16]; ///< gain compensation level table
+ float gain_tab2[31]; ///< gain compensation interpolation table
+ int id2exp_offset; ///< offset for converting level index into level exponent
+ int loc_scale; ///< scale of location code = 2^loc_scale samples
+ int loc_size; ///< size of location code in samples
} AtracGCContext;
extern float ff_atrac_sf_table[64];
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index 9d8cf01ed5..5fdb363009 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -413,16 +413,15 @@ static int decode_tonal_components(GetBitContext *gb,
static int decode_gain_control(GetBitContext *gb, GainBlock *block,
int num_bands)
{
- int j, b;
-
+ int b, j;
int *level, *loc;
AtracGainInfo *gain = block->g_block;
for (b = 0; b <= num_bands; b++) {
gain[b].num_points = get_bits(gb, 3);
- level = gain[b].levcode;
- loc = gain[b].loccode;
+ level = gain[b].lev_code;
+ loc = gain[b].loc_code;
for (j = 0; j < gain[b].num_points; j++) {
level[j] = get_bits(gb, 4);
@@ -432,7 +431,7 @@ static int decode_gain_control(GetBitContext *gb, GainBlock *block,
}
}
- /* Clear unused blocks. */
+ /* Clear the unused blocks. */
for (; b < 4 ; b++)
gain[b].num_points = 0;