[FFmpeg-devel] [PATCH] vorbis_enc.c: avoid div zero that causes noise
Frank Barchard
fbarchard
Wed Jun 2 05:02:26 CEST 2010
On Tue, Jun 1, 2010 at 6:01 PM, Michael Niedermayer <michaelni at gmx.at>wrote:
> On Tue, Jun 01, 2010 at 02:10:54PM -0700, Frank Barchard wrote:
>
> On Tue, Jun 1, 2010 at 12:39 PM, Michael Niedermayer <michaelni at gmx.at>
> > wrote:
> > > does
> > > average= sqrt(tot_average * average) * pow(1.25, position*0.005)
> > >
> > > work as well (without the 0 special casing of course) ?
>
It does. Much nicer, thanks.
Index: libavcodec/vorbis_enc.c
===================================================================
--- libavcodec/vorbis_enc.c (revision 23412)
+++ libavcodec/vorbis_enc.c (working copy)
@@ -681,7 +681,7 @@
float average = averages[i];
int j;
- average *= pow(tot_average / average, 0.5) * pow(1.25,
position/200.); // MAGIC!
+ average = sqrt(tot_average * average) * pow(1.25f,
position*0.005f); // MAGIC!
for (j = 0; j < range - 1; j++)
if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] >
average)
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbis_divzero_mult.patch
Type: application/octet-stream
Size: 587 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100601/0258e5ab/attachment.obj>
More information about the ffmpeg-devel
mailing list