changeset 3848:4d9aba494478 libavcodec

Original Commit: r46 | ods15 | 2006-09-23 11:36:32 +0300 (Sat, 23 Sep 2006) | 2 lines fix normalization, output is (roughly?) same volume as input
author ods15
date Mon, 02 Oct 2006 05:56:40 +0000
parents 9cf71c2ff770
children ead3ae56d1b6
files vorbis_enc.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_enc.c	Mon Oct 02 05:56:37 2006 +0000
+++ b/vorbis_enc.c	Mon Oct 02 05:56:40 2006 +0000
@@ -617,6 +617,7 @@
     int i, j, channel;
     const float * win = venc->win[0];
     int window_len = 1 << (venc->blocksize[0] - 1);
+    float n = (float)(1 << venc->blocksize[0]) / 4.;
     // FIXME use dsp
 
     if (!venc->have_saved && !samples) return 0;
@@ -636,7 +637,7 @@
             float * offset = venc->samples + channel*window_len*2 + window_len;
             j = channel;
             for (i = 0; i < samples; i++, j += venc->channels)
-                offset[i] = audio[j] / 32768. * win[window_len - i];
+                offset[i] = audio[j] / 32768. * win[window_len - i] / n;
         }
     } else {
         for (channel = 0; channel < venc->channels; channel++) {
@@ -653,7 +654,7 @@
             float * offset = venc->saved + channel*window_len;
             j = channel;
             for (i = 0; i < samples; i++, j += venc->channels)
-                offset[i] = audio[j] / 32768. * win[i];
+                offset[i] = audio[j] / 32768. * win[i] / n;
         }
         venc->have_saved = 1;
     } else {
@@ -759,7 +760,7 @@
         }
 
         for (j = 0; j < samples; j++) {
-            venc->floor[i * samples + j] = floor1_inverse_db_table[220];
+            venc->floor[i * samples + j] = floor1_inverse_db_table[113];
         }
     }