Mercurial > libavcodec.hg
comparison vorbis_enc.c @ 3889:a0462572fefa libavcodec
Original Commit: r90 | ods15 | 2006-09-29 22:14:40 +0300 (Fri, 29 Sep 2006) | 3 lines
much better magic for floor, the first psychoacoustic in this encoder!
now creates valid, 175kbps audio, which sounds good! :)
author | ods15 |
---|---|
date | Mon, 02 Oct 2006 06:08:55 +0000 |
parents | e89e213459cf |
children | de883494646e |
comparison
equal
deleted
inserted
replaced
3888:e89e213459cf | 3889:a0462572fefa |
---|---|
778 int position = fc->list[fc->list[i].sort].x; | 778 int position = fc->list[fc->list[i].sort].x; |
779 int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x; | 779 int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x; |
780 int end = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x; | 780 int end = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x; |
781 int j; | 781 int j; |
782 float average = 0; | 782 float average = 0; |
783 begin = (position + begin) / 2; | |
784 end = (position + end ) / 2; | |
785 | 783 |
786 assert(end <= samples); | 784 assert(end <= samples); |
787 for (j = begin; j < end; j++) average += fabs(coeffs[j]); | 785 for (j = begin; j < end; j++) average += fabs(coeffs[j]); |
788 average /= end - begin; | 786 average /= end - begin; |
789 average /= 32; // MAGIC! | 787 average /= pow(4, 1 - position/400.); // MAGIC! |
790 for (j = 0; j < range - 1; j++) if (floor1_inverse_db_table[j * fc->multiplier] > average) break; | 788 for (j = 0; j < range - 1; j++) if (floor1_inverse_db_table[j * fc->multiplier] > average) break; |
791 posts[fc->list[i].sort] = j; | 789 posts[fc->list[i].sort] = j; |
792 } | 790 } |
793 } | 791 } |
794 | 792 |