History

cosmetics: Remove unnecessary {} around if/for blocks; move statements after if/for to the next line.

Originally committed as revision 19378 to svn://svn.ffmpeg.org/ffmpeg/trunk

Diego Biurrun committed 17 years ago

Commit c8f47d81 parent 99d61d34 files · +36 −51Browse files

Unified · Split

4 files
  1. libavcodec/aaccoder.c +17 −22
  2. libavcodec/aacenc.c +13 −17
  3. libavcodec/aacpsy.c +4 −8
  4. libavcodec/psymodel.c +2 −4
libavcodec/aaccoder.c+17−22
@@ -84,9 +84,8 @@ static void abs_pow34_v(float *out, const float *in, const int size) · 83 unmodified lines
8484 {
8585 #ifndef USE_REALLY_FULL_SEARCH
8686 int i;
87− for (i = 0; i < size; i++) {
87+ for (i = 0; i < size; i++)
8888 out[i] = pow(fabsf(in[i]), 0.75);
89− }
9089 #endif /* USE_REALLY_FULL_SEARCH */
9190 }
9291
@@ -141,9 +140,8 @@ static float quantize_band_cost(struct AACEncContext *s, const float *in, · 48 unmodified lines
141140 #ifndef USE_REALLY_FULL_SEARCH
142141 int (*quants)[2] = &s->qcoefs[i];
143142 mincost = 0.0f;
144− for (j = 0; j < dim; j++) {
143+ for (j = 0; j < dim; j++)
145144 mincost += in[i+j]*in[i+j]*lambda;
146− }
147145 minidx = IS_CODEBOOK_UNSIGNED(cb) ? 0 : 40;
148146 minbits = ff_aac_spectral_bits[cb-1][minidx];
149147 mincost += minbits;
@@ -256,9 +254,8 @@ static void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb, · 106 unmodified lines
256254 #ifndef USE_REALLY_FULL_SEARCH
257255 int (*quants)[2] = &s->qcoefs[i];
258256 mincost = 0.0f;
259− for (j = 0; j < dim; j++) {
257+ for (j = 0; j < dim; j++)
260258 mincost += in[i+j]*in[i+j]*lambda;
261− }
262259 minidx = IS_CODEBOOK_UNSIGNED(cb) ? 0 : 40;
263260 minbits = ff_aac_spectral_bits[cb-1][minidx];
264261 mincost += minbits;
@@ -429,10 +426,9 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce · 164 unmodified lines
429426 //convert resulting path from backward-linked list
430427 stack_len = 0;
431428 idx = 0;
432− for (cb = 1; cb < 12; cb++) {
429+ for (cb = 1; cb < 12; cb++)
433430 if (path[max_sfb][cb].cost < path[max_sfb][idx].cost)
434431 idx = cb;
435− }
436432 ppos = max_sfb;
437433 while (ppos > 0) {
438434 cb = idx;
@@ -523,7 +519,8 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 84 unmodified lines
523519 nz = 1;
524520 for (i = 0; i < sce->ics.swb_sizes[g]; i++) {
525521 float t = fabsf(coefs[w2*128+i]);
526− if (t > 0.0f) qmin = fminf(qmin, t);
522+ if (t > 0.0f)
523+ qmin = fminf(qmin, t);
527524 qmax = fmaxf(qmax, t);
528525 }
529526 }
@@ -540,10 +537,9 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 10 unmodified lines
540537 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
541538 FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
542539 int cb;
543− for (cb = 0; cb <= ESC_BT; cb++) {
540+ for (cb = 0; cb <= ESC_BT; cb++)
544541 dists[cb] += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g],
545542 q, cb, lambda / band->threshold, INFINITY, NULL);
546− }
547543 }
548544 dist = dists[0];
549545 for (i = 1; i <= ESC_BT; i++)
@@ -725,22 +721,19 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 175 unmodified lines
725721 }
726722 }
727723 if (tbits > destbits) {
728− for (i = 0; i < 128; i++) {
729− if (sce->sf_idx[i] < 218 - qstep) {
724+ for (i = 0; i < 128; i++)
725+ if (sce->sf_idx[i] < 218 - qstep)
730726 sce->sf_idx[i] += qstep;
731− }
732− }
733727 } else {
734− for (i = 0; i < 128; i++) {
735− if (sce->sf_idx[i] > 60 - qstep) {
728+ for (i = 0; i < 128; i++)
729+ if (sce->sf_idx[i] > 60 - qstep)
736730 sce->sf_idx[i] -= qstep;
737− }
738− }
739731 }
740732 qstep >>= 1;
741733 if (!qstep && tbits > destbits*1.02)
742734 qstep = 1;
743− if (sce->sf_idx[0] >= 217)break;
735+ if (sce->sf_idx[0] >= 217)
736+ break;
744737 } while (qstep);
745738
746739 fflag = 0;
@@ -916,7 +909,8 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s, · 169 unmodified lines
916909 else
917910 minq = FFMIN(minq, sce->sf_idx[i]);
918911 }
919− if (minq == INT_MAX) minq = 0;
912+ if (minq == INT_MAX)
913+ minq = 0;
920914 minq = FFMIN(minq, SCALE_MAX_POS);
921915 maxsf = FFMIN(minq + SCALE_MAX_DIFF, SCALE_MAX_POS);
922916 for (i = 126; i >= 0; i--) {
@@ -951,7 +945,8 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, · 28 unmodified lines
951945 }
952946 }
953947 for (i = 0; i < 128; i++) {
954− sce->sf_idx[i] = 140;//av_clip(sce->sf_idx[i], minq, minq + SCALE_MAX_DIFF - 1);
948+ sce->sf_idx[i] = 140;
949+ //av_clip(sce->sf_idx[i], minq, minq + SCALE_MAX_DIFF - 1);
955950 }
956951 //set the same quantizers inside window groups
957952 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
libavcodec/aacenc.c+13−17
@@ -276,9 +276,8 @@ static void put_ics_info(AACEncContext *s, IndividualChannelStream *info) · 275 unmodified lines
276276 put_bits(&s->pb, 1, 0); // no prediction
277277 } else {
278278 put_bits(&s->pb, 4, info->max_sfb);
279− for (w = 1; w < 8; w++) {
279+ for (w = 1; w < 8; w++)
280280 put_bits(&s->pb, 1, !info->group_len[w]);
281− }
282281 }
283282 }
284283
@@ -291,12 +290,10 @@ static void encode_ms_info(PutBitContext *pb, ChannelElement *cpe) · 6 unmodified lines
291290 int i, w;
292291
293292 put_bits(pb, 2, cpe->ms_mode);
294− if (cpe->ms_mode == 1) {
295− for (w = 0; w < cpe->ch[0].ics.num_windows; w += cpe->ch[0].ics.group_len[w]) {
293+ if (cpe->ms_mode == 1)
294+ for (w = 0; w < cpe->ch[0].ics.num_windows; w += cpe->ch[0].ics.group_len[w])
296295 for (i = 0; i < cpe->ch[0].ics.max_sfb; i++)
297296 put_bits(pb, 1, cpe->ms_mask[w*16 + i]);
298− }
299− }
300297 }
301298
302299 /**
@@ -324,7 +321,8 @@ static void adjust_frame_information(AACEncContext *apc, ChannelElement *cpe, in · 21 unmodified lines
324321 }
325322 start += ics->swb_sizes[g];
326323 }
327− for (cmaxsfb = ics->num_swb; cmaxsfb > 0 && cpe->ch[ch].zeroes[w+cmaxsfb-1]; cmaxsfb--);
324+ for (cmaxsfb = ics->num_swb; cmaxsfb > 0 && cpe->ch[ch].zeroes[w+cmaxsfb-1]; cmaxsfb--)
325+ ;
328326 maxsfb = FFMAX(maxsfb, cmaxsfb);
329327 }
330328 ics->max_sfb = maxsfb;
@@ -352,7 +350,8 @@ static void adjust_frame_information(AACEncContext *apc, ChannelElement *cpe, in · 21 unmodified lines
352350 ics1->max_sfb = ics0->max_sfb;
353351 for (w = 0; w < ics0->num_windows*16; w += 16)
354352 for (i = 0; i < ics0->max_sfb; i++)
355− if (cpe->ms_mask[w+i]) msc++;
353+ if (cpe->ms_mask[w+i])
354+ msc++;
356355 if (msc == 0 || ics0->max_sfb == 0)
357356 cpe->ms_mode = 0;
358357 else
@@ -367,9 +366,8 @@ static void encode_band_info(AACEncContext *s, SingleChannelElement *sce) · 8 unmodified lines
367366 {
368367 int w;
369368
370− for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
369+ for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
371370 s->coder->encode_window_bands_info(s, sce, w, sce->ics.group_len[w], s->lambda);
372− }
373371 }
374372
375373 /**
@@ -427,13 +425,12 @@ static void encode_spectral_coeffs(AACEncContext *s, SingleChannelElement *sce) · 51 unmodified lines
427425 start += sce->ics.swb_sizes[i];
428426 continue;
429427 }
430− for (w2 = w; w2 < w + sce->ics.group_len[w]; w2++) {
428+ for (w2 = w; w2 < w + sce->ics.group_len[w]; w2++)
431429 s->coder->quantize_and_encode_band(s, &s->pb, sce->coeffs + start + w2*128,
432430 sce->ics.swb_sizes[i],
433431 sce->sf_idx[w*16 + i],
434432 sce->band_type[w*16 + i],
435433 s->lambda);
436− }
437434 start += sce->ics.swb_sizes[i];
438435 }
439436 }
@@ -514,9 +511,8 @@ static int aac_encode_frame(AVCodecContext *avctx, · 74 unmodified lines
514511 }
515512
516513 init_put_bits(&s->pb, frame, buf_size*8);
517− if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT)) {
514+ if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))
518515 put_bitstream_info(avctx, s, LIBAVCODEC_IDENT);
519− }
520516 start_ch = 0;
521517 memset(chan_el_counter, 0, sizeof(chan_el_counter));
522518 for (i = 0; i < chan_map[0]; i++) {
@@ -526,7 +522,8 @@ static int aac_encode_frame(AVCodecContext *avctx, · 3 unmodified lines
526522 cpe = &s->cpe[i];
527523 samples2 = samples + start_ch;
528524 la = samples2 + 1024 * avctx->channels + start_ch;
529− if (!data) la = NULL;
525+ if (!data)
526+ la = NULL;
530527 for (j = 0; j < chans; j++) {
531528 IndividualChannelStream *ics = &cpe->ch[j].ics;
532529 int k;
@@ -588,10 +585,9 @@ static int aac_encode_frame(AVCodecContext *avctx, · 55 unmodified lines
588585 s->lambda *= ratio;
589586 }
590587
591− if (avctx->frame_bits > 6144*avctx->channels) {
588+ if (avctx->frame_bits > 6144*avctx->channels)
592589 av_log(avctx, AV_LOG_ERROR, "input buffer violation %d > %d.\n",
593590 avctx->frame_bits, 6144*avctx->channels);
594− }
595591
596592 if (!data)
597593 s->last_frame = 1;
libavcodec/aacpsy.c+4−8
@@ -140,9 +140,8 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { · 139 unmodified lines
140140 start = 0;
141141 for (g = 0; g < ctx->num_bands[j]; g++) {
142142 minscale = ath(ctx->avctx->sample_rate * start / 1024.0, ATH_ADD);
143− for (i = 1; i < ctx->bands[j][g]; i++) {
143+ for (i = 1; i < ctx->bands[j][g]; i++)
144144 minscale = fminf(minscale, ath(ctx->avctx->sample_rate * (start + i) / 1024.0 / 2.0, ATH_ADD));
145− }
146145 coeffs->ath[g] = minscale - minath;
147146 start += ctx->bands[j][g];
148147 }
@@ -283,19 +282,16 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, · 134 unmodified lines
283282 //modify thresholds - spread, threshold in quiet - 5.4.3 "Spreaded Energy Calculation"
284283 for (w = 0; w < wi->num_windows*16; w += 16) {
285284 Psy3gppBand *band = &pch->band[w];
286− for (g = 1; g < num_bands; g++) {
285+ for (g = 1; g < num_bands; g++)
287286 band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_low[g-1]);
288− }
289− for (g = num_bands - 2; g >= 0; g--) {
287+ for (g = num_bands - 2; g >= 0; g--)
290288 band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_hi [g]);
291− }
292289 for (g = 0; g < num_bands; g++) {
293290 band[g].thr_quiet = FFMAX(band[g].thr, coeffs->ath[g]);
294− if (wi->num_windows != 8 && wi->window_type[1] != EIGHT_SHORT_SEQUENCE) {
291+ if (wi->num_windows != 8 && wi->window_type[1] != EIGHT_SHORT_SEQUENCE)
295292 band[g].thr_quiet = fmaxf(PSY_3GPP_RPEMIN*band[g].thr_quiet,
296293 fminf(band[g].thr_quiet,
297294 PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
298− }
299295 band[g].thr = FFMAX(band[g].thr, band[g].thr_quiet * 0.25);
300296
301297 ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr;
libavcodec/psymodel.c+2−4
@@ -105,16 +105,14 @@ void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, · 104 unmodified lines
105105 {
106106 int ch, i;
107107 if (ctx->fstate) {
108− for (ch = 0; ch < channels; ch++) {
108+ for (ch = 0; ch < channels; ch++)
109109 ff_iir_filter(ctx->fcoeffs, ctx->fstate[tag+ch], ctx->avctx->frame_size,
110110 audio + ch, ctx->avctx->channels,
111111 dest + ch, ctx->avctx->channels);
112− }
113112 } else {
114− for (ch = 0; ch < channels; ch++) {
113+ for (ch = 0; ch < channels; ch++)
115114 for (i = 0; i < ctx->avctx->frame_size; i++)
116115 dest[i*ctx->avctx->channels + ch] = audio[i*ctx->avctx->channels + ch];
117− }
118116 }
119117 }
120118

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t