History

aaccoder: use roundf() instead of ceilf()

The specifications explicitly state to use roundf() which also rounds half-integer values away from zero. This does fix a few IS artifacts.

Rostislav Pehlivanov committed 11 years ago

Commit b9b1fd11 parent 92aa3e71 file · +2 −2Browse files

Unified · Split

libavcodec/aaccoder.c+2−2
@@ -332,11 +332,11 @@ static void set_special_band_scalefactors(AACEncContext *s, SingleChannelElement · 331 unmodified lines
332 start = 0;332 start = 0;
333 for (g = 0; g < sce->ics.num_swb; g++) {333 for (g = 0; g < sce->ics.num_swb; g++) {
334 if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) {334 if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) {
335 sce->sf_idx[w*16+g] = av_clip(ceilf(log2f(sce->is_ener[w*16+g])*2), -155, 100);335 sce->sf_idx[w*16+g] = av_clip(roundf(log2f(sce->is_ener[w*16+g])*2), -155, 100);
336 minscaler_i = FFMIN(minscaler_i, sce->sf_idx[w*16+g]);336 minscaler_i = FFMIN(minscaler_i, sce->sf_idx[w*16+g]);
337 bands++;337 bands++;
338 } else if (sce->band_type[w*16+g] == NOISE_BT) {338 } else if (sce->band_type[w*16+g] == NOISE_BT) {
339 sce->sf_idx[w*16+g] = av_clip(4+log2f(sce->pns_ener[w*16+g])*2, -100, 155);339 sce->sf_idx[w*16+g] = av_clip(roundf(log2f(sce->pns_ener[w*16+g])*2), -100, 155);
340 minscaler_n = FFMIN(minscaler_n, sce->sf_idx[w*16+g]);340 minscaler_n = FFMIN(minscaler_n, sce->sf_idx[w*16+g]);
341 bands++;341 bands++;
342 }342 }

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