shithub: aacdec

Download patch

ref: 8328e1320cdd1231fc958ab50759cdc569379ef7
parent: 450fed9d988ef8dad6819df9ca6da7cbb0f4d82f
author: menno <menno>
date: Mon Sep 16 16:43:37 EDT 2002

RVLC fix for PNS scalefactors

--- a/libfaad/huffman.h
+++ b/libfaad/huffman.h
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: huffman.h,v 1.9 2002/06/15 15:38:22 menno Exp $
+** $Id: huffman.h,v 1.10 2002/09/16 20:43:37 menno Exp $
 **/
 
 #ifndef __HUFFMAN_H__
@@ -130,6 +130,7 @@
         if (cb >= 16)
             cb = 11;
 #endif
+
         cw = faad_showbits(ld, hcbN[cb]);
         offset = hcb_table[cb][cw].offset;
         extra_bits = hcb_table[cb][cw].extra_bits;
--- a/libfaad/rvlc_scale_factors.c
+++ b/libfaad/rvlc_scale_factors.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: rvlc_scale_factors.c,v 1.3 2002/08/10 19:01:19 menno Exp $
+** $Id: rvlc_scale_factors.c,v 1.4 2002/09/16 20:43:37 menno Exp $
 **/
 
 #include "common.h"
@@ -119,8 +119,12 @@
 
     int16_t scale_factor = ics->global_gain;
     int16_t is_position = 0;
-    int16_t noise_energy = ics->global_gain - 90;
+    int16_t noise_energy = ics->global_gain - 90 - 256;
 
+#if 0
+    printf("\nglobal_gain: %d\n", ics->global_gain);
+#endif
+
     for (g = 0; g < ics->num_window_groups; g++)
     {
         for (sfb = 0; sfb < ics->max_sfb; sfb++)
@@ -175,6 +179,10 @@
 
                     break;
                 }
+#if 0
+                printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
+                    ics->scale_factors[g][sfb]);
+#endif
                 if (t == 99)
                 {
                     error = 1;
@@ -182,6 +190,9 @@
             }
         }
     }
+#if 0
+    printf("\n\n");
+#endif
 
     return 0;
 }
@@ -271,7 +282,7 @@
     { 46, 20, 473501 },
     { 47, 20, 473502 },
     { 48, 20, 473503 },
-    {  99, 21,  0 } /* Shouldn't come this far */
+    { 99, 21,  0 } /* Shouldn't come this far */
 };
 
 static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc)
@@ -319,7 +330,7 @@
     uint8_t i, j;
     uint32_t cw;
     rvlc_huff_table *h = book_escape;
-    
+
     i = h->len;
     cw = faad_getbits(ld, i);