comparison vorbis_enc.c @ 11812:b7d5e6078e04 libavcodec

Avoid division by zero that caused noise, typically at the beginning or end of a file. Patch by Frank Barchard, fbarchard google
author cehoyos
date Wed, 02 Jun 2010 16:09:19 +0000
parents 906fdc96cdf4
children 9f3522743348
comparison
equal deleted inserted replaced
11811:2501df1cabc5 11812:b7d5e6078e04
679 for (i = 0; i < fc->values; i++) { 679 for (i = 0; i < fc->values; i++) {
680 int position = fc->list[fc->list[i].sort].x; 680 int position = fc->list[fc->list[i].sort].x;
681 float average = averages[i]; 681 float average = averages[i];
682 int j; 682 int j;
683 683
684 average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); // MAGIC! 684 average = sqrt(tot_average * average) * pow(1.25f, position*0.005f); // MAGIC!
685 for (j = 0; j < range - 1; j++) 685 for (j = 0; j < range - 1; j++)
686 if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average) 686 if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average)
687 break; 687 break;
688 posts[fc->list[i].sort] = j; 688 posts[fc->list[i].sort] = j;
689 } 689 }