Commit 6d175158 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov Committed by Michael Niedermayer

aacenc: remove redundant argument from coder functions

This commit removes a redundant argument from the functions in aaccoder.
The argument lambda was redundant as it was just a copy of s->lambda,
to which all functions have access to anyway. This cleans up the function
pointers a bit which is helpful as there are a lot of other search_for_*
functions under development and with them populated it gets messy.
Reviewed-by: 's avatarClaudio Freire <klaussfreire@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2ef6994e
...@@ -1177,10 +1177,10 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, ...@@ -1177,10 +1177,10 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g]; sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g];
} }
static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce, static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
const float lambda)
{ {
int start = 0, w, w2, g; int start = 0, w, w2, g;
const float lambda = s->lambda;
const float freq_mult = avctx->sample_rate/(1024.0f/sce->ics.num_windows)/2.0f; const float freq_mult = avctx->sample_rate/(1024.0f/sce->ics.num_windows)/2.0f;
const float spread_threshold = NOISE_SPREAD_THRESHOLD*(lambda/120.f); const float spread_threshold = NOISE_SPREAD_THRESHOLD*(lambda/120.f);
const float thr_mult = NOISE_LAMBDA_NUMERATOR/lambda; const float thr_mult = NOISE_LAMBDA_NUMERATOR/lambda;
...@@ -1214,8 +1214,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne ...@@ -1214,8 +1214,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
} }
} }
static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe, static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
const float lambda)
{ {
float IS[128]; float IS[128];
float *L34 = s->scoefs + 128*0, *R34 = s->scoefs + 128*1; float *L34 = s->scoefs + 128*0, *R34 = s->scoefs + 128*1;
...@@ -1224,6 +1223,7 @@ static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen ...@@ -1224,6 +1223,7 @@ static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen
SingleChannelElement *sce1 = &cpe->ch[1]; SingleChannelElement *sce1 = &cpe->ch[1];
int start = 0, count = 0, i, w, w2, g; int start = 0, count = 0, i, w, w2, g;
const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f; const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f;
const float lambda = s->lambda;
for (w = 0; w < 128; w++) for (w = 0; w < 128; w++)
if (sce1->band_type[w] >= INTENSITY_BT2) if (sce1->band_type[w] >= INTENSITY_BT2)
...@@ -1312,12 +1312,12 @@ static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen ...@@ -1312,12 +1312,12 @@ static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen
cpe->is_mode = !!count; cpe->is_mode = !!count;
} }
static void search_for_ms(AACEncContext *s, ChannelElement *cpe, static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
const float lambda)
{ {
int start = 0, i, w, w2, g; int start = 0, i, w, w2, g;
float M[128], S[128]; float M[128], S[128];
float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3; float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
const float lambda = s->lambda;
SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce0 = &cpe->ch[0];
SingleChannelElement *sce1 = &cpe->ch[1]; SingleChannelElement *sce1 = &cpe->ch[1];
if (!cpe->common_window) if (!cpe->common_window)
......
...@@ -696,7 +696,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -696,7 +696,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
if (s->options.pns && s->coder->search_for_pns) { if (s->options.pns && s->coder->search_for_pns) {
for (ch = 0; ch < chans; ch++) { for (ch = 0; ch < chans; ch++) {
s->cur_channel = start_ch + ch; s->cur_channel = start_ch + ch;
s->coder->search_for_pns(s, avctx, &cpe->ch[ch], s->lambda); s->coder->search_for_pns(s, avctx, &cpe->ch[ch]);
} }
} }
s->cur_channel = start_ch; s->cur_channel = start_ch;
...@@ -707,11 +707,11 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -707,11 +707,11 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
for (g = 0; g < ics->num_swb; g++) for (g = 0; g < ics->num_swb; g++)
cpe->ms_mask[w*16+g] = 1; cpe->ms_mask[w*16+g] = 1;
} else if (s->coder->search_for_ms) { } else if (s->coder->search_for_ms) {
s->coder->search_for_ms(s, cpe, s->lambda); s->coder->search_for_ms(s, cpe);
} }
} }
if (chans > 1 && s->options.intensity_stereo && s->coder->search_for_is) { if (chans > 1 && s->options.intensity_stereo && s->coder->search_for_is) {
s->coder->search_for_is(s, avctx, cpe, s->lambda); s->coder->search_for_is(s, avctx, cpe);
if (cpe->is_mode) is_mode = 1; if (cpe->is_mode) is_mode = 1;
} }
if (s->coder->set_special_band_scalefactors) if (s->coder->set_special_band_scalefactors)
......
...@@ -56,9 +56,9 @@ typedef struct AACCoefficientsEncoder { ...@@ -56,9 +56,9 @@ typedef struct AACCoefficientsEncoder {
void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, int size, void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, int size,
int scale_idx, int cb, const float lambda, int rtz); int scale_idx, int cb, const float lambda, int rtz);
void (*set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce); void (*set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce);
void (*search_for_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce, const float lambda); void (*search_for_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce);
void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const float lambda); void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe);
void (*search_for_is)(struct AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe, const float lambda); void (*search_for_is)(struct AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe);
} AACCoefficientsEncoder; } AACCoefficientsEncoder;
extern AACCoefficientsEncoder ff_aac_coders[]; extern AACCoefficientsEncoder ff_aac_coders[];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment