[FFmpeg-soc] [soc]: r1033 - in eac3: eac3.h eac3dec.c
bwolowiec
subversion at mplayerhq.hu
Sun Aug 19 21:49:05 CEST 2007
Author: bwolowiec
Date: Sun Aug 19 21:49:05 2007
New Revision: 1033
Log:
remove redundant variables
Modified:
eac3/eac3.h
eac3/eac3dec.c
Modified: eac3/eac3.h
==============================================================================
--- eac3/eac3.h (original)
+++ eac3/eac3.h Sun Aug 19 21:49:05 2007
@@ -79,21 +79,7 @@ typedef struct EAC3Context{
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
///@}
///@name Audio Frame
///@{
@@ -112,7 +98,6 @@ typedef struct EAC3Context{
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
@@ -127,8 +112,7 @@ typedef struct EAC3Context{
///@{
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
+ float 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
@@ -161,18 +145,9 @@ typedef struct EAC3Context{
int rematflg[4]; ///< Rematrixing flag
int cplabsexp; ///< Coupling absolute exponent
- 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
Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c (original)
+++ eac3/eac3dec.c Sun Aug 19 21:49:05 2007
@@ -171,22 +171,17 @@ static int parse_bsi(GetBitContext *gbc,
if(s->infomdate){
/* Informational metadata */
GET_BITS(s->bsmod, gbc, 3);
- GET_BITS(s->copyrightb, gbc, 1);
- GET_BITS(s->origbs, gbc, 1);
+ skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
if(s->acmod == AC3_ACMOD_STEREO) /* if in 2/0 mode */{
- GET_BITS(s->dsurmod, gbc, 2);
- GET_BITS(s->dheadphonmod, gbc, 2);
+ skip_bits(gbc, 4); //skip Dolby surround and headphone mode
}
if(s->acmod >= 0x6){
/* if both surround channels exist */
- GET_BITS(s->dsurexmod, gbc, 2);
+ skip_bits(gbc, 2); //skip Dolby surround EX mode
}
for(i = 0; i < (s->acmod?1:2); i++){
- GET_BITS(s->audprodie[i], gbc, 1);
- if(s->audprodie[i]){
- GET_BITS(s->mixlevel[i], gbc, 5);
- GET_BITS(s->roomtyp[i], gbc, 2);
- GET_BITS(s->adconvtyp[i], gbc, 1);
+ if(get_bits1(gbc)){
+ skip_bits(gbc, 8); //skip Mix level, Room type and A/D converter type
}
}
if(s->fscod < 0x3){
@@ -201,14 +196,13 @@ static int parse_bsi(GetBitContext *gbc,
/* if bit stream converted from AC-3 */
if(s->numblkscod == 0x3 || get_bits1(gbc)){
/* 6 blocks per frame */
- GET_BITS(s->frmsizecod, gbc, 6);
+ skip_bits(gbc, 6); // skip Frame size code
}
}
- GET_BITS(s->addbsie, gbc, 1);
- if(s->addbsie){
- GET_BITS(s->addbsil, gbc, 6);
- for(i=0; i<s->addbsil+1; i++){
- GET_BITS(s->addbsi[i], gbc, 8);
+ if(get_bits1(gbc)){
+ int addbsil = get_bits(gbc, 6);
+ for(i=0; i<addbsil+1; i++){
+ skip_bits(gbc, 8); // Additional bit stream information
}
}
@@ -298,7 +292,7 @@ static int parse_audfrm(GetBitContext *g
if(s->strmtyp == 0x0){
if(s->numblkscod == 0x3 || get_bits1(gbc)){
for(ch = 1; ch <= s->nfchans; ch++){
- GET_BITS(s->convexpstr[ch], gbc, 5);
+ skip_bits(gbc, 5); //skip Converter channel exponent strategy
}
}
}
@@ -406,12 +400,11 @@ static int parse_audblk(GetBitContext *g
/* Dynamic range control */
for(i = 0; i < (s->acmod?1:2); i++){
- GET_BITS(s->dynrnge[i], gbc, 1);
- if(s->dynrnge[i]){
- GET_BITS(s->dynrng[i], gbc, 8);
+ if(get_bits1(gbc)){
+ s->dynrng[i] = ff_ac3_dynrng_tbl[get_bits(gbc, 8)];
}else{
if(blk==0){
- s->dynrng[i] = 0;
+ s->dynrng[i] = 1.0f;
}
}
}
@@ -775,17 +768,17 @@ static int parse_audblk(GetBitContext *g
/* Bit-allocation parametric information */
if(s->bamode){
- GET_BITS(s->baie, gbc, 1);
- if(!blk && !s->baie){
- av_log(s->avctx, AV_LOG_ERROR, "no bit allocation information in first block\n");
- return -1;
- }
- if(s->baie){
+ if(get_bits1(gbc)){
s->bit_alloc_params.sdecay = ff_sdecaytab[get_bits(gbc, 2)]; /* Table 7.6 */
s->bit_alloc_params.fdecay = ff_fdecaytab[get_bits(gbc, 2)]; /* Table 7.7 */
s->bit_alloc_params.sgain = ff_sgaintab [get_bits(gbc, 2)]; /* Table 7.8 */
s->bit_alloc_params.dbknee = ff_dbkneetab[get_bits(gbc, 2)]; /* Table 7.9 */
s->bit_alloc_params.floor = ff_floortab [get_bits(gbc, 3)]; /* Table 7.10 */
+ }else{
+ if(!blk){
+ av_log(s->avctx, AV_LOG_ERROR, "no bit allocation information in first block\n");
+ return -1;
+ }
}
}else{
s->bit_alloc_params.sdecay = ff_sdecaytab[0x2]; /* Table 7.6 */
@@ -820,9 +813,8 @@ static int parse_audblk(GetBitContext *g
}
}
if(s->strmtyp == 0x0){
- GET_BITS(s->convsnroffste, gbc, 1);
- if(s->convsnroffste){
- GET_BITS(s->convsnroffst, gbc, 10);
+ if(get_bits1(gbc)){
+ skip_bits(gbc, 10); //Converter SNR offset
}
}
if(s->cplinu[blk]){
@@ -1298,9 +1290,9 @@ static int eac3_decode_frame(AVCodecCont
for(ch=1; ch<=c->nfchans + c->lfeon; ch++) {
float gain=2.0f;
if(c->acmod == AC3_ACMOD_DUALMONO) {
- gain *= c->dialnorm[ch-1] * ff_ac3_dynrng_tbl[c->dynrng[ch-1]];
+ gain *= c->dialnorm[ch-1] * c->dynrng[ch-1];
} else {
- gain *= c->dialnorm[0] * ff_ac3_dynrng_tbl[c->dynrng[0]];
+ gain *= c->dialnorm[0] * c->dynrng[0];
}
for(i=0; i<c->endmant[ch]; i++) {
c->transform_coeffs[ch][i] *= gain;
More information about the FFmpeg-soc
mailing list