ref: cc4fc2b2ab2a843237afdbef1f53def4506494af
parent: 52b83233750cd76d5b364217bac8075d3f8555fe
author: menno <menno>
date: Sat Sep 4 10:56:30 EDT 2004
Sync CVS small update in winamp plugin
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,29 @@
+3 september 2004 mbakker(at)nero.com
+ - neaacdec.h, decoder.c, syntax.c, structs.h: added output flag for PS
+
+3 september 2004 mbakker(at)nero.com
+ - common.c: added log2_fix()
+
+28 august 2004 gpascutto(at)nero.com
+ - sbr_syntax.c: bugfix with PS_DEC and DRM_PS defines
+
+21 august 2004 mbakker(at)nero.com
+ - cfft.c, cfft_tab.h: added size 128 fixed point FFT tables for HVXC
+
+18 august 2004 mbakker(at)nero.com
+ - sbr_syntax.c: allow only 1 PS data element per SBR extension data
+
+18 august 2004 gpascutto(at)nero.com
+ - specrec.c: safeguard against PS suddenly going on
+
+4 august 2004 gpascutto(at)nero.com
+ - drm_dec.c: make sure we still copy to the right channel if there's no data
+
2 august 2004 gpascutto(at)nero.com
- hcr.c: bugfix
31 july 2004 gpascutto(at)nero.com
- hcr.c: Rewritten and optimized
-
-30 july 2004 mbakker(at)nero.com
- - /mp4ff/: conversion to c++, cleanup
29 july 2004 mbakker(at)nero.com
- /mp4ff/mp4ff.c,mp4atoms.c: support video decoding better
--- a/include/neaacdec.h
+++ b/include/neaacdec.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: neaacdec.h,v 1.4 2004/04/03 10:49:14 menno Exp $
+** $Id: neaacdec.h,v 1.5 2004/09/04 14:56:27 menno Exp $
**/
#ifndef __NEAACDEC_H__
@@ -189,6 +189,9 @@
unsigned char num_back_channels;
unsigned char num_lfe_channels;
unsigned char channel_position[64];
+
+ /* PS: 0: off, 1: on */
+ unsigned char ps;
} NeAACDecFrameInfo;
char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
@@ -226,6 +229,13 @@
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size);
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ unsigned char *buffer,
+ unsigned long buffer_size,
+ void **sample_buffer,
+ unsigned long sample_buffer_size);
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
--- a/libfaad/cfft.c
+++ b/libfaad/cfft.c
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: cfft.c,v 1.28 2004/07/31 15:48:55 menno Exp $
+** $Id: cfft.c,v 1.29 2004/09/04 14:56:27 menno Exp $
**/
/*
@@ -1388,6 +1388,7 @@
case 240: cfft->tab = (complex_t*)cfft_tab_240; break;
#endif
#endif
+ case 128: cfft->tab = (complex_t*)cfft_tab_128; break;
}
#endif
--- a/libfaad/cfft_tab.h
+++ b/libfaad/cfft_tab.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: cfft_tab.h,v 1.16 2004/07/31 15:48:55 menno Exp $
+** $Id: cfft_tab.h,v 1.17 2004/09/04 14:56:28 menno Exp $
**/
#ifndef __CFFT_TAB_H__
@@ -1679,6 +1679,138 @@
#endif
#endif
+
+ALIGN static const complex_t cfft_tab_128[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
#endif
--- a/libfaad/common.c
+++ b/libfaad/common.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
-**
+**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: common.c,v 1.20 2004/07/31 15:48:55 menno Exp $
+** $Id: common.c,v 1.21 2004/09/04 14:56:28 menno Exp $
**/
/* just some common functions that could be used anywhere */
@@ -146,7 +146,7 @@
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short)
{
- /* entry for each sampling rate
+ /* entry for each sampling rate
* 1 Main/LC long window
* 2 Main/LC short window
* 3 SSR long window
@@ -230,14 +230,13 @@
return -1;
}
-/* common malloc function */
void *faad_malloc(size_t size)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
return _aligned_malloc(size, 16);
-#else
+#else // #ifdef 0
return malloc(size);
-#endif
+#endif // #ifdef 0
}
/* common free function */
@@ -247,18 +246,18 @@
_aligned_free(b);
#else
free(b);
-#endif
}
+#endif
static const uint8_t Parity [256] = { // parity
- 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
- 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
- 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
- 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
- 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
- 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
- 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
- 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
};
static uint32_t __r1 = 1;
@@ -293,14 +292,14 @@
*/
uint32_t random_int(void)
{
- uint32_t t1, t2, t3, t4;
+ uint32_t t1, t2, t3, t4;
- t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available
- t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
- t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
- t1 <<= 31; t2 = Parity [t2];
+ t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available
+ t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
+ t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
+ t1 <<= 31; t2 = Parity [t2];
- return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
+ return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
}
uint32_t ones32(uint32_t x)
@@ -496,7 +495,7 @@
{
uint32_t frac;
uint32_t whole = (val);
- int8_t exp = 0;
+ int32_t exp = 0;
uint32_t index;
uint32_t index_frac;
uint32_t x1, x2;
@@ -533,5 +532,49 @@
errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
+}
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+real_t log2_fix(uint32_t val)
+{
+ uint32_t frac;
+ uint32_t whole = (val >> REAL_BITS);
+ int8_t exp = 0;
+ uint32_t index;
+ uint32_t index_frac;
+ uint32_t x1, x2;
+ uint32_t errcorr;
+
+ /* error */
+ if (val == 0)
+ return -100000;
+
+ exp = floor_log2(val);
+ exp -= REAL_BITS;
+
+ /* frac = [1..2] */
+ if (exp >= 0)
+ frac = val >> exp;
+ else
+ frac = val << -exp;
+
+ /* index in the log2 table */
+ index = frac >> (REAL_BITS-TABLE_BITS);
+
+ /* leftover part for linear interpolation */
+ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+ /* leave INTERP_BITS bits */
+ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+ x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+ /* linear interpolation */
+ /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+ errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+ return (exp << REAL_BITS) + errcorr + x1;
}
#endif
--- a/libfaad/common.h
+++ b/libfaad/common.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: common.h,v 1.63 2004/07/31 15:48:55 menno Exp $
+** $Id: common.h,v 1.64 2004/09/04 14:56:28 menno Exp $
**/
#ifndef __COMMON_H__
@@ -396,6 +396,7 @@
#ifdef FIXED_POINT
#define LOG2_MIN_INF REAL_CONST(-10000)
int32_t log2_int(uint32_t val);
+int32_t log2_fix(uint32_t val);
int32_t pow2_int(real_t val);
real_t pow2_fix(real_t val);
#endif
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: decoder.c,v 1.105 2004/07/31 15:48:55 menno Exp $
+** $Id: decoder.c,v 1.106 2004/09/04 14:56:28 menno Exp $
**/
#include "common.h"
@@ -901,6 +901,9 @@
hInfo->header_type = ADIF;
if (hDecoder->adts_header_present)
hInfo->header_type = ADTS;
+#if (defined(PS_DEC) || defined(DRM_PS))
+ hInfo->ps = hDecoder->ps_used_global;
+#endif
/* check if frame has channel elements */
if (channels == 0)
--- a/libfaad/structs.h
+++ b/libfaad/structs.h
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: structs.h,v 1.40 2004/07/31 15:48:57 menno Exp $
+** $Id: structs.h,v 1.41 2004/09/04 14:56:29 menno Exp $
**/
#ifndef __STRUCTS_H__
@@ -366,6 +366,9 @@
/*uint8_t*/ unsigned char num_back_channels;
/*uint8_t*/ unsigned char num_lfe_channels;
/*uint8_t*/ unsigned char channel_position[MAX_CHANNELS];
+
+ /* PS: 0: off, 1: on */
+ /*uint8_t*/ unsigned char ps;
} NeAACDecFrameInfo;
typedef struct
@@ -431,6 +434,7 @@
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
+ uint8_t ps_used_global;
#endif
#ifdef SSR_DEC
--- a/libfaad/syntax.c
+++ b/libfaad/syntax.c
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: syntax.c,v 1.81 2004/07/31 15:48:57 menno Exp $
+** $Id: syntax.c,v 1.82 2004/09/04 14:56:29 menno Exp $
**/
/*
@@ -1042,6 +1042,9 @@
if (hDecoder->sbr[sbr_ele]->ps_used)
{
hDecoder->ps_used[sbr_ele] = 1;
+
+ /* set element independent flag to 1 as well */
+ hDecoder->ps_used_global = 1;
}
#endif
} else {
@@ -1254,6 +1257,7 @@
if (hDecoder->sbr[0]->ps_used)
{
hDecoder->ps_used[0] = 1;
+ hDecoder->ps_used_global = 1;
}
#endif
--- a/plugins/in_mp4/in_mp4.c
+++ b/plugins/in_mp4/in_mp4.c
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through [email protected].
**
-** $Id: in_mp4.c,v 1.53 2004/09/03 21:49:56 gcp Exp $
+** $Id: in_mp4.c,v 1.54 2004/09/04 14:56:30 menno Exp $
**/
//#define DEBUG_OUTPUT
@@ -643,9 +643,13 @@
float seconds;
int track;
+ NeAACDecHandle hDecoder;
+ NeAACDecFrameInfo frameInfo;
mp4AudioSpecificConfig mp4ASC = {0};
unsigned char *buffer = NULL;
int buffer_size = 0;
+ unsigned long sr = 0;
+ unsigned char ch = 0;
if ((track = GetAACTrack(mp4)) < 0)
{
@@ -653,6 +657,8 @@
return;
}
+ hDecoder = NeAACDecOpen();
+
samples = mp4ff_num_samples(mp4, track);
mp4ff_get_decoder_config(mp4, track, &buffer, &buffer_size);
@@ -663,13 +669,39 @@
if (mp4ASC.frameLengthFlag == 1) f = 960.0;
if (mp4ASC.sbr_present_flag == 1) f *= 2;
}
+
+ if(NeAACDecInit2(hDecoder, buffer, buffer_size, &sr, &ch) < 0)
+ {
+ /* If some error initializing occured, skip the file */
+ free(buffer);
+ return;
+ }
+
free(buffer);
+ buffer = NULL;
}
+ if (mp4ff_read_sample(mp4, track, 0, &buffer, &buffer_size) == 0)
+ {
+ return;
+ }
+ NeAACDecDecode(hDecoder, &frameInfo, buffer, buffer_size);
+
+ if (buffer) free(buffer);
+
seconds = (float)samples*(float)(f-1.0)/(float)mp4ASC.samplingFrequency;
- wsprintf(info, "%s %d.%d secs, %d ch, %d Hz\n\n", ot[(mp4ASC.objectTypeIndex > 5)?0:mp4ASC.objectTypeIndex],
- (int)(seconds), (int)(seconds*1000.0 + 0.5) % 1000, mp4ASC.channelsConfiguration, mp4ASC.samplingFrequency);
+ wsprintf(info, "MPEG-4 %s, %d.%d secs, %d ch, %d Hz\nSBR: %s\nParametric stereo: %s",
+ ot[(mp4ASC.objectTypeIndex > 5)?0:mp4ASC.objectTypeIndex],
+ (int)(seconds),
+ (int)(seconds*1000.0 + 0.5) % 1000,
+ mp4ASC.channelsConfiguration,
+ mp4ASC.samplingFrequency,
+ /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
+ (frameInfo.sbr == 0) ? "off" : ((frameInfo.sbr == 1) ? "on, normal" : ((frameInfo.sbr == 2) ? "on, downsampled" : "off, upsampled")),
+ (frameInfo.ps == 0) ? "no" : "yes");
+
+ NeAACDecClose(hDecoder);
}
BOOL CALLBACK mp4_info_dialog_proc(HWND hwndDlg, UINT message,