summaryrefslogtreecommitdiffstats
path: root/libavcodec/aaccoder.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-08-21 18:30:51 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-08-21 18:30:51 +0100
commit32be264cea542b4dc721b10092bf1dfe511a28ee (patch)
tree0b45e999b69f460e9e10728eecc8557174c145ac /libavcodec/aaccoder.c
parent907373ea9d23f782d438dd18babfd75cb5ab305a (diff)
downloadffmpeg-streaming-32be264cea542b4dc721b10092bf1dfe511a28ee.zip
ffmpeg-streaming-32be264cea542b4dc721b10092bf1dfe511a28ee.tar.gz
aacenc: coding style changes
This commit only changes the coding style to a saner way of accessing coefficients (makes more sense to get the memory address of a coefficients and start from there rather than adding arbitrary numbers to offset a pointer). Some compilers might detect an out of bounds access easier. Also the way M/S and IS coefficients are calculated has been changed, but should still have the same result (with the exception that IS now applies from the normal coefficients rather than the pristine ones, this is needed for upcoming commits). Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aaccoder.c')
-rw-r--r--libavcodec/aaccoder.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index f5ad5ea..24ea48e 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -330,8 +330,8 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
}
for (w = 0; w < group_len; w++) {
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(win+w)*16+swb];
- rd += quantize_band_cost(s, sce->coeffs + start + w*128,
- s->scoefs + start + w*128, size,
+ rd += quantize_band_cost(s, &sce->coeffs[start + w*128],
+ &s->scoefs[start + w*128], size,
sce->sf_idx[(win+w)*16+swb], aac_cb_out_map[cb],
lambda / band->threshold, INFINITY, NULL, 0);
}
@@ -461,8 +461,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
continue;
}
for (w = 0; w < group_len; w++) {
- bits += quantize_band_cost(s, sce->coeffs + start + w*128,
- s->scoefs + start + w*128, size,
+ bits += quantize_band_cost(s, &sce->coeffs[start + w*128],
+ &s->scoefs[start + w*128], size,
sce->sf_idx[win*16+swb],
aac_cb_out_map[cb],
0, INFINITY, NULL, 0);
@@ -636,7 +636,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
- const float *coefs = sce->coeffs + start;
+ const float *coefs = &sce->coeffs[start];
float qmin, qmax;
int nz = 0;
@@ -800,8 +800,8 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
- const float *coefs = sce->coeffs + start;
- const float *scaled = s->scoefs + start;
+ const float *coefs = &sce->coeffs[start];
+ const float *scaled = &s->scoefs[start];
int bits = 0;
int cb;
float dist = 0.0f;
@@ -896,7 +896,7 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
}
} else {
for (w = 0; w < 8; w++) {
- const float *coeffs = sce->coeffs + w*128;
+ const float *coeffs = &sce->coeffs[w*128];
curband = start = 0;
for (i = 0; i < 128; i++) {
if (i - start >= sce->ics.swb_sizes[curband]) {
@@ -921,7 +921,7 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
- float *coefs = sce->coeffs + start;
+ float *coefs = &sce->coeffs[start];
const int size = sce->ics.swb_sizes[g];
int start2 = start, end2 = start + size, peakpos = start;
float maxval = -1, thr = 0.0f, t;
@@ -962,8 +962,8 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
- const float *coefs = sce->coeffs + start;
- const float *scaled = s->scoefs + start;
+ const float *coefs = &sce->coeffs[start];
+ const float *scaled = &s->scoefs[start];
const int size = sce->ics.swb_sizes[g];
int scf, prev_scf, step;
int min_scf = -1, max_scf = 256;
@@ -1229,22 +1229,22 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
float minthr = FFMIN(band0->threshold, band1->threshold);
float maxthr = FFMAX(band0->threshold, band1->threshold);
for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
- M[i] = (sce0->pcoeffs[start+(w+w2)*128+i]
- + sce1->pcoeffs[start+(w+w2)*128+i]) * 0.5;
+ M[i] = (sce0->coeffs[start+(w+w2)*128+i]
+ + sce1->coeffs[start+(w+w2)*128+i]) * 0.5;
S[i] = M[i]
- - sce1->pcoeffs[start+(w+w2)*128+i];
+ - sce1->coeffs[start+(w+w2)*128+i];
}
abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
- dist1 += quantize_band_cost(s, sce0->coeffs + start + (w+w2)*128,
+ dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],
L34,
sce0->ics.swb_sizes[g],
sce0->sf_idx[(w+w2)*16+g],
sce0->band_type[(w+w2)*16+g],
lambda / band0->threshold, INFINITY, NULL, 0);
- dist1 += quantize_band_cost(s, sce1->coeffs + start + (w+w2)*128,
+ dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],
R34,
sce1->ics.swb_sizes[g],
sce1->sf_idx[(w+w2)*16+g],
OpenPOWER on IntegriCloud