[FFmpeg-soc] [soc]: r904 - in eac3: ac3dec.c ac3dec.h eac3.h

bwolowiec subversion at mplayerhq.hu
Fri Aug 17 11:26:12 CEST 2007


Author: bwolowiec
Date: Fri Aug 17 11:26:12 2007
New Revision: 904

Log:
adding documentation, clearing code


Modified:
   eac3/ac3dec.c
   eac3/ac3dec.h
   eac3/eac3.h

Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c	(original)
+++ eac3/ac3dec.c	Fri Aug 17 11:26:12 2007
@@ -77,14 +77,6 @@ float ff_ac3_dynrng_tbl[256];
 /** dialogue normalization table */
 float ff_ac3_dialnorm_tbl[32];
 
-/** Adjustments in dB gain */
-#define LEVEL_MINUS_3DB         0.7071067811865476
-#define LEVEL_MINUS_4POINT5DB   0.5946035575013605
-#define LEVEL_MINUS_6DB         0.5000000000000000
-#define LEVEL_MINUS_9DB         0.3535533905932738
-#define LEVEL_ZERO              0.0000000000000000
-#define LEVEL_ONE               1.0000000000000000
-
 static const float gain_levels[6] = {
     LEVEL_ZERO,
     LEVEL_ONE,

Modified: eac3/ac3dec.h
==============================================================================
--- eac3/ac3dec.h	(original)
+++ eac3/ac3dec.h	Fri Aug 17 11:26:12 2007
@@ -82,4 +82,13 @@ int ff_ac3_get_transform_coeffs_ch(mant_
 
 void ff_ac3_do_rematrixing(float (*transform_coeffs)[256], int end, int nrematbnd, int *rematflg);
 
+/** Adjustments in dB gain */
+#define LEVEL_MINUS_3DB         0.7071067811865476
+#define LEVEL_MINUS_4POINT5DB   0.5946035575013605
+#define LEVEL_MINUS_6DB         0.5000000000000000
+#define LEVEL_MINUS_9DB         0.3535533905932738
+#define LEVEL_ZERO              0.0000000000000000
+#define LEVEL_ONE               1.0000000000000000
+
+
 #endif /* AC3DEC_H */

Modified: eac3/eac3.h
==============================================================================
--- eac3/eac3.h	(original)
+++ eac3/eac3.h	Fri Aug 17 11:26:12 2007
@@ -21,8 +21,6 @@
 #ifndef EAC3_H
 #define EAC3_H
 
-// TODO clean...
-
 #include "dsputil.h"
 #include "avcodec.h"
 #include "ac3.h"
@@ -33,242 +31,218 @@
 #undef AC3_MAX_CHANNELS
 #define AC3_MAX_CHANNELS 7
 
-#define DBA_NEW      0x01
-#define DBA_NONE     0x02
-#define DBA_RESERVED 0x03
-#define DBA_REUSE    0x00
-
 #define AC3_MAX_COEFS   256
 
-// TODO
-#define MAX_CHANNELS AC3_MAX_CHANNELS
-
-/** adjustments in dB gain */
-#define LEVEL_MINUS_3DB         (0.7071067811865476f) /* sqrt(2)/2 */
-#define LEVEL_MINUS_4POINT5DB   (0.5946035575013605f)
-#define LEVEL_MINUS_6DB         (0.5000000000000000f)
-#define LEVEL_PLUS_3DB          (1.4142135623730951f) /* sqrt(2) */
-#define LEVEL_PLUS_6DB          (2.0000000000000000f)
-#define LEVEL_ZERO              (0.0000000000000000f)
-
 #define AC3_BLOCK_SIZE  256
 #define MAX_BLOCKS 6
 #define MAX_SPX_CODES 18
-#define TODO_SIZE 1024
-
 
+// TODO use new downmixing
 /** output configurations. */
 #define AC3_OUTPUT_UNMODIFIED 0x01
 #define AC3_OUTPUT_MONO       0x02
 #define AC3_OUTPUT_STEREO     0x04
 #define AC3_OUTPUT_DOLBY      0x08
 #define AC3_OUTPUT_LFEON      0x10
-/** AC-3 channel mode (audio coding mode) */
 
 typedef struct EAC3Context{
-    // TODO erase unused variables
-    // TODO add documentation
-
-    AVCodecContext *avctx;
-//Syncinfo
+    AVCodecContext *avctx;           ///< Parent context
     int syncword;
-
-//BSI
-    int strmtyp; // 2);              ///< Stream type
-    int substreamid; // 3);          ///< Substream identification
-    int frmsiz; // 11);              ///< Frame size
-    int fscod; // 2);                ///< Sample rate code
-    int fscod2; // 2);               ///< Sample rate code 2
-    int numblkscod; // 2);           ///< Number of audio blocks
-    int acmod; // 3);                ///< Audio coding mode
-    int lfeon; // 1);                ///< Low frequency effect channel on
-    int bsid; // 5);                 ///< Bit stream identification
-    float dialnorm[2]; // 5);        ///< Dialogue normalization
-    int compr[2]; // 8);             ///< Compression gain word
-    int chanmap; // 16);             ///< Custom channel map
-    int mixmdate; // 1);             ///< Mixing meta-data exists
-    int dmixmod; // 2);              ///<
-    int ltrtcmixlev; // 3);
-    int lorocmixlev; // 3);
-    int ltrtsurmixlev; // 3);
-    int lorosurmixlev; // 3);
-    int lfemixlevcode; // 1);        ///< lfe mix level code exists
-    int lfemixlevcod; // 5);         ///< lfe mix level code
-    int pgmscl[2]; // 6);            ///< Program scale factor
-    int extpgmscl; // 6);            ///< External program scale factor
-    int mixdef; // 2);               ///< Mix control type
-    int mixdeflen; // 5);            ///< Length of mixing parameter data field
-    int paninfo[2]; // 14);          ///< Pan information
-    int frmmixcfginfoe; // 1);       ///< Frame mixing configuration information exists
-    int blkmixcfginfo0; // 5);
-    int blkmixcfginfoe; // 1);       ///< Block mixing configuration information exists
-    int blkmixcfginfoblk; // 5);     ///< Block mixing configuration information
-    int infomdate; // 1);            ///< Informational meta-data exists
-    int bsmod; // 3);                ///< Bit stream mode
-    int copyrightb; // 1);           ///< Copyright bit
-    int origbs; // 1); ///< Original bit stream
-    int dsurmod; // 2);
-    int dheadphonmod; // 2);
-    int dsurexmod; // 2);
-    int audprodie[2]; // 1);
-    int mixlevel[2]; // 5);          ///< Mix level
-    int roomtyp[2]; // 2);           ///< Room type
-    int adconvtyp[2]; // 1);         ///< A/D converter type
-    int audprodi2e; // 1);           ///< Audio production information exists ch2
-    int sourcefscod; // 1);          ///< Source sample rate code
-    int frmsizecod; // 6);           ///< Frame size code
-    int addbsie; // 1);              ///< Additional bit stream information exists
-    int addbsil; // 6);              ///< Additional bit stream information length
+///@name Bit stream information
+///@{
+    int strmtyp;                     ///< Stream type
+    int substreamid;                 ///< Substream identification
+    int frmsiz;                      ///< Frame size
+    int fscod;                       ///< Sample rate code
+    int fscod2;                      ///< Sample rate code 2
+    int numblkscod;                  ///< Number of audio blocks
+    int acmod;                       ///< Audio coding mode
+    int lfeon;                       ///< Low frequency effect channel on
+    int bsid;                        ///< Bit stream identification
+    float dialnorm[2];               ///< Dialogue normalization
+    int compr[2];                    ///< Compression gain word
+    int chanmap;                     ///< Custom channel map
+    int mixmdate;                    ///< Mixing meta-data exists
+    int dmixmod;                     ///< Preferred stereo downmix mode
+    int ltrtcmixlev;                 ///< Lt/Rt center mix level
+    int lorocmixlev;                 ///< Lo/Ro center mix level
+    int ltrtsurmixlev;               ///< Lt/Rt surround mix level
+    int lorosurmixlev;               ///< Lo/Ro surround mix level
+    int lfemixlevcode;               ///< lfe mix level code exists
+    int lfemixlevcod;                ///< lfe mix level code
+    int pgmscl[2];                   ///< Program scale factor
+    int extpgmscl;                   ///< External program scale factor
+    int mixdef;                      ///< Mix control type
+    int mixdeflen;                   ///< Length of mixing parameter data field
+    int paninfo[2];                  ///< Pan information
+    int frmmixcfginfoe;              ///< Frame mixing configuration information exists
+    int blkmixcfginfo[6];            ///< Block mixing configuration information
+    int infomdate;                   ///< Informational meta-data exists
+    int bsmod;                       ///< Bit stream mode
+    int copyrightb;                  ///< Copyright bit
+    int origbs;                      ///< Original bit stream
+    int dsurmod;                     ///< Dolby surround mode
+    int dheadphonmod;                ///< Dolby headphone mode
+    int dsurexmod;                   ///< Dolby surround EX mode
+    int audprodie[2];                ///< Audio production information exists
+    int mixlevel[2];                 ///< Mix level
+    int roomtyp[2];                  ///< Room type
+    int adconvtyp[2];                ///< A/D converter type
+    int audprodi2e;                  ///< Audio production information exists ch2
+    int sourcefscod;                 ///< Source sample rate code
+    int frmsizecod;                  ///< Frame size code
+    int addbsie;                     ///< Additional bit stream information exists
+    int addbsil;                     ///< Additional bit stream information length
     int addbsi[64];                  ///< Additional bit stream information
-
-//Audfrm
-    int expstre; // 1);              ///< Exponent strategy syntax enabled
-    int ahte; // 1);                 ///< Adaptive hybrid transform enabled
-    int snroffststr; // 2);          ///< SNR offset strategy
+///@}
+///@name Audio Frame
+///@{
+    int expstre;                     ///< Exponent strategy syntax enabled
+    int ahte;                        ///< Adaptive hybrid transform enabled
+    int snroffststr;                 ///< SNR offset strategy
     int snroffst[AC3_MAX_CHANNELS];  ///< SNR offset
-    int transproce; // 1);           ///< Transient pre-noise processing enabled
-    int blkswe; // 1);               ///< Block switch syntax enabled
-    int dithflage; // 1);            ///< Dither flag syntax enabled
-    int bamode; // 1);               ///< Bit allocation model syntax enabled
-    int frmfgaincode; // 1);         ///< Fast gain codes enabled
-    int dbaflde; // 1);              ///< Delta bit allocation syntax enabled
-    int skipflde; // 1);             ///< Skip Filed syntax enabled
-    int spxattene; // 1);            ///< Spectral extension attenuation enabled
-    int cplinu[MAX_BLOCKS]; // 1);   ///< Coupling in use
-    int cplstre[MAX_BLOCKS]; // 1);  ///< Coupling strategy exists
-    int chexpstr[MAX_BLOCKS][MAX_CHANNELS]; // 2); ///< Channel exponent strategy
-    int convexpstr[MAX_CHANNELS];    ///< Converter channel exponent strategy
-    int chahtinu[MAX_CHANNELS];      ///< Channel AHT in use
-    int chintransproc[MAX_CHANNELS]; ///< Channel in transient pre-noise processing
-    int transprocloc[MAX_CHANNELS];  ///< Transient location relative to start of frame
-    int transproclen[MAX_CHANNELS];  ///< Transient processing length
-    int chinspxatten[MAX_CHANNELS];  ///< Channel in spectral extension attenuation process
-    int spxattencod[MAX_CHANNELS];   ///< spectral extension attenuation code
-    int blkstrtinfoe; // 1);         ///< Block start information exists
+    int transproce;                  ///< Transient pre-noise processing enabled
+    int blkswe;                      ///< Block switch syntax enabled
+    int dithflage;                   ///< Dither flag syntax enabled
+    int bamode;                      ///< Bit allocation model syntax enabled
+    int frmfgaincode;                ///< Fast gain codes enabled
+    int dbaflde;                     ///< Delta bit allocation syntax enabled
+    int skipflde;                    ///< Skip Filed syntax enabled
+    int spxattene;                   ///< Spectral extension attenuation enabled
+    int cplinu[MAX_BLOCKS];          ///< Coupling in use
+    int cplstre[MAX_BLOCKS];         ///< Coupling strategy exists
+    int chexpstr[MAX_BLOCKS][AC3_MAX_CHANNELS];  ///< Channel exponent strategy
+    int convexpstr[AC3_MAX_CHANNELS];    ///< Converter channel exponent strategy
+    int chahtinu[AC3_MAX_CHANNELS];      ///< Channel AHT in use
+    int chintransproc[AC3_MAX_CHANNELS]; ///< Channel in transient pre-noise processing
+    int transprocloc[AC3_MAX_CHANNELS];  ///< Transient location relative to start of frame
+    int transproclen[AC3_MAX_CHANNELS];  ///< Transient processing length
+    int chinspxatten[AC3_MAX_CHANNELS];  ///< Channel in spectral extension attenuation process
+    int spxattencod[AC3_MAX_CHANNELS];   ///< spectral extension attenuation code
+    int blkstrtinfoe;                ///< Block start information exists
     uint32_t blkstrtinfo;            ///< Block start information
     int ncplblks;
-
-// EAC3Audblk
-    int blksw[MAX_CHANNELS]; // 1);  ///< Block switch flag
-    int dithflag[MAX_CHANNELS];      ///< Dither flag
-    int dynrnge[2]; // 1);           ///< Dynamic range gain word exists
-    int dynrng[2]; // 8);            ///< Dynamic range gain word
-    int spxinu; // 1);               ///< spectral extension in use
-    int chinspx[MAX_CHANNELS];       ///< Channel in spectral extension
-    int spxstrtf; // 2);             ///< Spectral extension start copy frequency code
-    int spxbegf; // 3);              ///< Spectral extension begin frequency code
-    int spxendf; // 3);              ///< Spectral extension end frequency code
-    int spxbndstrce; // 1);          ///< Spectral extension band structure exists
+///@}
+///@name Audio block
+///@{
+    int blksw[AC3_MAX_CHANNELS];     ///< Block switch flag
+    int dithflag[AC3_MAX_CHANNELS];  ///< Dither flag
+    int dynrnge[2];                  ///< Dynamic range gain word exists
+    int dynrng[2];                   ///< Dynamic range gain word
+    int spxinu;                      ///< spectral extension in use
+    int chinspx[AC3_MAX_CHANNELS];   ///< Channel in spectral extension
+    int spxstrtf;                    ///< Spectral extension start copy frequency code
+    int spxbegf;                     ///< Spectral extension begin frequency code
+    int spxendf;                     ///< Spectral extension end frequency code
+    int spxbndstrce;                 ///< Spectral extension band structure exists
     int spxbndstrc[MAX_SPX_CODES];   ///< Spectral extension band structure
-    int spxcoe[MAX_CHANNELS];        ///< Spectral extension coordinates exists
-    int spxblnd[MAX_CHANNELS];       ///< Spectral extension blend
-    int ecplinu; // 1);              ///< Enhanced coupling in use
-    int chincpl[MAX_CHANNELS];       ///< Channel in coupling
-    int phsflginu; // 1);            ///< Phase flag in use
-    int cplbegf; // 4);              ///< Coupling begin frequency code
-    int cplendf; // 4);              ///< Coupling end frequency code
-    int cplbndstrce; // 1);          ///< Coupling band structure exists
-    int cplbndstrc[19]; // 1);       ///< Coupling band structure
-    int ecplbegf; // 4);             ///< Enhanced coupling begin frequency code
-    int ecplendf; // 4);             ///< Enhanced coupling end frequency code
-    int ecplbndstrce; // 1);         ///< Enhanced coupling band structure exists
-    int ecplbndstrc[TODO_SIZE];      ///< Enhanced coupling band structure
-    int cplcoe[MAX_CHANNELS];        ///< Coupling coordinates exists
-    int phsflg[18]; // 1);           ///< Phase flag
-    int ecplangleintrp; // 1);       ///< Enhanced coupling angle interpolation flag
-    int ecplparam1e[MAX_CHANNELS];   ///< Enhanced coupling parameters 1 exists
-    int ecplparam2e[MAX_CHANNELS];   ///< Enhanced coupling parameters 2 exists
-    int ecplamp[MAX_CHANNELS][TODO_SIZE];   ///< Enhanced coupling amplitude scaling
-    int ecplangle[MAX_CHANNELS][TODO_SIZE]; ///< Enhanced coupling angle
-    int ecplchaos[MAX_CHANNELS][TODO_SIZE]; ///< Enhanced coupling chaos
-    int ecpltrans[MAX_CHANNELS];     ///< Enhanced coupling transient present
-    int rematstr; // 1);             ///< Rematrixing strategy
-    int rematflg[TODO_SIZE]; // 1);  ///< Rematrixing flag
-    int cplabsexp; // 4);            ///< Coupling absolute exponent
+    int spxcoe[AC3_MAX_CHANNELS];    ///< Spectral extension coordinates exists
+    int spxblnd[AC3_MAX_CHANNELS];   ///< Spectral extension blend
+    int ecplinu;                     ///< Enhanced coupling in use
+    int chincpl[AC3_MAX_CHANNELS];   ///< Channel in coupling
+    int phsflginu;                   ///< Phase flag in use
+    int cplbegf;                     ///< Coupling begin frequency code
+    int cplendf;                     ///< Coupling end frequency code
+    int cplbndstrce;                 ///< Coupling band structure exists
+    int cplbndstrc[19];              ///< Coupling band structure
+    int ecplbegf;                    ///< Enhanced coupling begin frequency code
+    int ecplendf;                    ///< Enhanced coupling end frequency code
+    int ecplbndstrce;                ///< Enhanced coupling band structure exists
+    int ecplbndstrc[23];             ///< Enhanced coupling band structure
+    int cplcoe[AC3_MAX_CHANNELS];    ///< Coupling coordinates exists
+    int phsflg[18];                  ///< Phase flag
+    int ecplangleintrp;              ///< Enhanced coupling angle interpolation flag
+    int ecplparam1e[AC3_MAX_CHANNELS];   ///< Enhanced coupling parameters 1 exists
+    int ecplparam2e[AC3_MAX_CHANNELS];   ///< Enhanced coupling parameters 2 exists
+    int ecplamp[AC3_MAX_CHANNELS][23];   ///< Enhanced coupling amplitude scaling
+    int ecplangle[AC3_MAX_CHANNELS][23]; ///< Enhanced coupling angle
+    int ecplchaos[AC3_MAX_CHANNELS][23]; ///< Enhanced coupling chaos
+    int ecpltrans[AC3_MAX_CHANNELS];     ///< Enhanced coupling transient present
+    int rematstr;                    ///< Rematrixing strategy
+    int rematflg[4];                 ///< Rematrixing flag
+    int cplabsexp;                   ///< Coupling absolute exponent
 
-    int gainrng[MAX_CHANNELS];  ///< Channel Gain range code
-//    int lfeexps[3]; // 7); // 0...nlfegrps = const 0...2
-    int baie; // 1);                 ///< Bit allocation information exists
-    int fgain[MAX_CHANNELS];         ///< Channel fast gain
-    int convsnroffste; // 1);        ///< Converter SNR offset exists
-    int convsnroffst; // 10);        ///< Converter SNR offset
-    int cplleake; // 1);             ///< Coupling leak initialization exists
-    int deltbaie; // 1);             ///< Delta bit allocation information exists
-    int cpldeltbae; // 2);           ///< Coupling delta bit allocation exists
-    uint8_t deltbae[MAX_CHANNELS];   ///< Delta bit allocation exists
-    int cpldeltnseg; // 3);          ///< Coupling delta bit allocation number of segments
-    int cpldeltoffst[9]; // 5);      ///< Coupling bit allocation offset
-    int cpldeltlen[9]; // 4);        ///< Coupling delta bit allocation length
-    int cpldeltba[9]; // 3);         ///< Coupling delta bit allocation
-    uint8_t deltnseg[MAX_CHANNELS];  ///< Channel delta bit allocation number of segments
-    uint8_t deltoffst[MAX_CHANNELS][9]; ///< Channel delta bit allocation offset
-    uint8_t deltlen[MAX_CHANNELS][9];   ///< Channel delta bit allocation length
-    uint8_t deltba[MAX_CHANNELS][9];    ///< Channel delta bit allocation
+    int gainrng[AC3_MAX_CHANNELS];   ///< Channel Gain range code
+    int baie;                        ///< Bit allocation information exists
+    int fgain[AC3_MAX_CHANNELS];     ///< Channel fast gain
+    int convsnroffste;               ///< Converter SNR offset exists
+    int convsnroffst;                ///< Converter SNR offset
+    int cplleake;                    ///< Coupling leak initialization exists
+    int deltbaie;                    ///< Delta bit allocation information exists
+    int cpldeltbae;                  ///< Coupling delta bit allocation exists
+    uint8_t deltbae[AC3_MAX_CHANNELS];   ///< Delta bit allocation exists
+    int cpldeltnseg;                 ///< Coupling delta bit allocation number of segments
+    int cpldeltoffst[9];             ///< Coupling bit allocation offset
+    int cpldeltlen[9];               ///< Coupling delta bit allocation length
+    int cpldeltba[9];                ///< Coupling delta bit allocation
+    uint8_t deltnseg[AC3_MAX_CHANNELS];  ///< Channel delta bit allocation number of segments
+    uint8_t deltoffst[AC3_MAX_CHANNELS][9]; ///< Channel delta bit allocation offset
+    uint8_t deltlen[AC3_MAX_CHANNELS][9];   ///< Channel delta bit allocation length
+    uint8_t deltba[AC3_MAX_CHANNELS][9];    ///< Channel delta bit allocation
 
     int got_cplchan;
-    int chgaqmod[MAX_CHANNELS];                 ///< Channel gain adaptive quantization mode
-    int chgaqgain[MAX_CHANNELS][256];           ///< Channel gain adaptive quantization gain
-    float pre_chmant[6][MAX_CHANNELS][256];     ///< Pre channel mantissas
-
-    int firstspxcos[MAX_CHANNELS]; // TODO type ? ///< First spectral extension coordinates states
-    int firstcplcos[MAX_CHANNELS]; // TODO type ? ///< First coupling coordinates states
-    int firstcplleak; // TODO type ?              ///< First coupling leak state
-
+    int chgaqmod[AC3_MAX_CHANNELS];                 ///< Channel gain adaptive quantization mode
+    int chgaqgain[AC3_MAX_CHANNELS][256];           ///< Channel gain adaptive quantization gain
+    float pre_chmant[6][AC3_MAX_CHANNELS][256];     ///< Pre channel mantissas
 
+    int firstspxcos[AC3_MAX_CHANNELS];              ///< First spectral extension coordinates states
+    int firstcplcos[AC3_MAX_CHANNELS];              ///< First coupling coordinates states
+    int firstcplleak;                               ///< First coupling leak state
+///@}
 
     // TODO
-    int chgaqbin[MAX_CHANNELS][256]; // [][nchmant]
-    int chgaqsections[MAX_CHANNELS];
-    int chactivegaqbins[MAX_CHANNELS];
-    int nchmant[MAX_CHANNELS];         ///< Number of fbw channel mantissas
+    int chgaqbin[AC3_MAX_CHANNELS][256];
+    int chgaqsections[AC3_MAX_CHANNELS];
+    int chactivegaqbins[AC3_MAX_CHANNELS];
+
+    int nrematbnds;                    ///< Number of rematrixing bands
+    int nchmant[AC3_MAX_CHANNELS];     ///< Number of fbw channel mantissas
     int ncplsubnd;                     ///< Number of coupling sub-bands
     int ncplbnd;                       ///< Number of structured coupled bands
-    int nrematbnds;
 
-    int nchgrps[MAX_CHANNELS];         ///< Number of fbw channel exponent groups
-    uint8_t dexps[MAX_CHANNELS][AC3_MAX_COEFS]; ///< Differential exponents
+    int nchgrps[AC3_MAX_CHANNELS];                  ///< Number of fbw channel exponent groups
+    uint8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< Differential exponents
 
-    int endmant[MAX_CHANNELS];
-    int strtmant[MAX_CHANNELS];
+    int strtmant[AC3_MAX_CHANNELS];    ///< Start frequency bin
+    int endmant[AC3_MAX_CHANNELS];     ///< End frequency bin
     int firstchincpl;
-    int ecpl_start_subbnd, ecpl_end_subbnd;
-
-    int necplbnd;
-    int nspxbnds;
-    int spxbndsztab[MAX_SPX_CODES]; // max_spxendf + 1 = 18 ?
-    int nfchans; ///< Number of fbw channels
+    int ecpl_start_subbnd;             ///< Enhanced coupling begin frequency
+    int ecpl_end_subbnd;               ///< Enhanced coupling end frequency
 
-    uint8_t bap[MAX_CHANNELS][AC3_MAX_COEFS]; ///< bit allocation pointers
-    uint8_t hebap[MAX_CHANNELS][AC3_MAX_COEFS];
-    int16_t psd[MAX_CHANNELS][AC3_MAX_COEFS]; ///< scaled exponents
-    int16_t bndpsd[MAX_CHANNELS][350];        ///< interpolated exponents FIXME in ac3dec [50] !?
-    int16_t mask[MAX_CHANNELS][350];          ///< masking values
+    int necplbnd;                      ///< Number of structured enhanced coupling bands
+    int nspxbnds;                      ///< Number of structured spectral extension bands
+    int spxbndsztab[MAX_SPX_CODES];    ///< Sizes of spectral extension bands
+    int nfchans;                       ///< Number of fbw channels
 
-    float   cplco[AC3_MAX_CHANNELS][18];        ///< coupling coordinates
-    float   spxco[AC3_MAX_CHANNELS][18];        ///< Spectral extension coordinates
+    uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< bit allocation pointers
+    uint8_t hebap[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< high-efficiency bit allocation pointers for AHT
+    int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< scaled exponents
+    int16_t bndpsd[AC3_MAX_CHANNELS][50];           ///< interpolated exponents
+    int16_t mask[AC3_MAX_CHANNELS][50];             ///< masking values
 
-    DECLARE_ALIGNED_16(float, transform_coeffs[MAX_CHANNELS][AC3_MAX_COEFS]);
+    float   cplco[AC3_MAX_CHANNELS][18];            ///< coupling coordinates
+    float   spxco[AC3_MAX_CHANNELS][18];            ///< Spectral extension coordinates
 
-    AC3BitAllocParameters bit_alloc_params;
+    AC3BitAllocParameters bit_alloc_params;         ///< Bit allocation parameters
 
     AVRandomState dith_state;        ///< for dither generation
 
+    int ntchans;                     ///< Total of all channels
+    int lfe_channel;                 ///< Index of LFE channel
 
-    int ntchans; ///< Total of all channels
-    int lfe_channel;
-
-    GetBitContext *gbc;
+    GetBitContext *gbc;              ///< Bitstream reader
 
     MDCTContext imdct_512;           ///< for 512 sample imdct transform
     MDCTContext imdct_256;           ///< for 256 sample imdct transform
     DSPContext  dsp;                 ///< for optimization
 
-    DECLARE_ALIGNED_16(float, delay[MAX_CHANNELS][AC3_BLOCK_SIZE]);  ///< delay - added to the next block
+    DECLARE_ALIGNED_16(float, transform_coeffs[AC3_MAX_CHANNELS][AC3_MAX_COEFS]);
+    DECLARE_ALIGNED_16(float, delay[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]);  ///< delay - added to the next block
     DECLARE_ALIGNED_16(float, window[AC3_BLOCK_SIZE]);               ///< window coefficients
     DECLARE_ALIGNED_16(float, tmp_output[AC3_BLOCK_SIZE * 24]);      ///< temp storage for output before windowing
     DECLARE_ALIGNED_16(float, tmp_imdct[AC3_BLOCK_SIZE * 24]);       ///< temp storage for imdct transform
-    DECLARE_ALIGNED_16(float, output[MAX_CHANNELS][AC3_BLOCK_SIZE]); ///< output after imdct transform and windowing
-    DECLARE_ALIGNED_16(int16_t, int_output[MAX_CHANNELS][AC3_BLOCK_SIZE]);///< final 16-bit integer output
+    DECLARE_ALIGNED_16(float, output[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]); ///< output after imdct transform and windowing
+    DECLARE_ALIGNED_16(int16_t, int_output[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]);///< final 16-bit integer output
 
 
     float add_bias;                  ///< offset for float_to_int16 conversion
@@ -284,9 +258,12 @@ int ff_eac3_parse_audfrm(GetBitContext *
 int ff_eac3_parse_audblk(GetBitContext *gbc, EAC3Context *s, const int blk);
 int ff_eac3_parse_auxdata(GetBitContext *gbc, EAC3Context *s);
 
-#define EAC3_GAQ_NO 0
-#define EAC3_GAQ_12 1
-#define EAC3_GAQ_14 2
-#define EAC3_GAQ_124 3
+/** Channel gain adaptive quantization mode */
+typedef enum {
+    EAC3_GAQ_NO =0,
+    EAC3_GAQ_12,
+    EAC3_GAQ_14,
+    EAC3_GAQ_124
+} EAC3GaqMode;
 
 #endif



More information about the FFmpeg-soc mailing list