History

Make the faac inspired quantizer search make sense for a slightly narrower definition of "make sense."

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

Alex Converse committed 16 years ago

Commit 32fa7721 parent 9e94bd31 file · +9 −7Browse files

Showing the changes to libavcodec/aaccoder.c (1 of 1 file). Show all

Unified · Split

libavcodec/aaccoder.c+9−7
@@ -763,7 +763,7 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s, · 762 unmodified lines
763 const float *scaled = s->scoefs + start;763 const float *scaled = s->scoefs + start;
764 const int size = sce->ics.swb_sizes[g];764 const int size = sce->ics.swb_sizes[g];
765 int scf, prev_scf, step;765 int scf, prev_scf, step;
766 int min_scf = 0, max_scf = 255;766 int min_scf = -1, max_scf = 256;
767 float curdiff;767 float curdiff;
768 if (maxq[w*16+g] < 21.544) {768 if (maxq[w*16+g] < 21.544) {
769 sce->zeroes[w*16+g] = 1;769 sce->zeroes[w*16+g] = 1;
@@ -797,21 +797,23 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s, · 27 unmodified lines
797 }797 }
798 prev_scf = scf;798 prev_scf = scf;
799 curdiff = fabsf(dist - uplim[w*16+g]);799 curdiff = fabsf(dist - uplim[w*16+g]);
800 if (curdiff == 0.0f)800 if (curdiff <= 1.0f)
801 step = 0;801 step = 0;
802 else802 else
803 step = fabsf(log2(curdiff));803 step = log2(curdiff);
804 if (dist > uplim[w*16+g])804 if (dist > uplim[w*16+g])
805 step = -step;805 step = -step;
806 scf += step;
807 av_clip_uint8(scf);
808 step = scf - prev_scf;
806 if (FFABS(step) <= 1 || (step > 0 && scf >= max_scf) || (step < 0 && scf <= min_scf)) {809 if (FFABS(step) <= 1 || (step > 0 && scf >= max_scf) || (step < 0 && scf <= min_scf)) {
807 sce->sf_idx[w*16+g] = scf;810 sce->sf_idx[w*16+g] = av_clip(scf, min_scf, max_scf);
808 break;811 break;
809 }812 }
810 scf += step;
811 if (step > 0)813 if (step > 0)
812 min_scf = scf;814 min_scf = prev_scf;
813 else815 else
814 max_scf = scf;816 max_scf = prev_scf;
815 }817 }
816 start += size;818 start += size;
817 }819 }

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