[soc]: r1341 - in eac3: eac3.h eac3dec.c
Author: bwolowiec Date: Wed Sep 12 09:53:51 2007 New Revision: 1341 Log: rename ntchans to num_channels Modified: eac3/eac3.h eac3/eac3dec.c Modified: eac3/eac3.h ============================================================================== --- eac3/eac3.h (original) +++ eac3/eac3.h Wed Sep 12 09:53:51 2007 @@ -176,7 +176,7 @@ typedef struct EAC3Context{ AVRandomState dith_state; ///< for dither generation - int ntchans; ///< Total of all channels + int num_channels; ///< Total of all channels int lfe_channel; ///< Index of LFE channel GetBitContext *gbc; ///< Bitstream reader Modified: eac3/eac3dec.c ============================================================================== --- eac3/eac3dec.c (original) +++ eac3/eac3dec.c Wed Sep 12 09:53:51 2007 @@ -351,14 +351,14 @@ static int parse_bsi(GetBitContext *gbc, // calculate number of channels s->nfchans = ff_ac3_channels[s->acmod]; - s->ntchans = s->nfchans; - s->lfe_channel = s->ntchans+1; + s->num_channels = s->nfchans; + s->lfe_channel = s->num_channels+1; if(s->lfeon){ s->strtmant[s->lfe_channel] = 0; s->endmant[s->lfe_channel] = 7; s->nchgrps[s->lfe_channel] = 2; s->chincpl[s->lfe_channel] = 0; - s->ntchans++; + s->num_channels++; } s->bsid = get_bits(gbc, 5); @@ -607,21 +607,21 @@ static int parse_audfrm(GetBitContext *g /* ncplregs derived from cplstre and cplexpstr - see Section E3.3.2 */ int nchregs; s->chahtinu[CPL_CH]=0; - for(ch = (s->ncplblks!=6); ch <= s->ntchans; ch++){ + for(ch = (s->ncplblks!=6); ch <= s->num_channels; ch++){ nchregs = 0; for(blk = 0; blk < 6; blk++) nchregs += (s->chexpstr[blk][ch] != EXP_REUSE); s->chahtinu[ch] = (nchregs == 1) && get_bits1(gbc); } }else{ - for(ch=0; ch<=s->ntchans; ch++) + for(ch=0; ch<=s->num_channels; ch++) s->chahtinu[ch] = 0; } /* Audio frame SNR offset data */ if(s->snroffststr == 0x0){ int csnroffst = (get_bits(gbc, 6) - 15) << 4; int snroffst = (csnroffst + get_bits(gbc, 4)) << 2; - for(ch=0; ch<= s->ntchans; ch++) + for(ch=0; ch<= s->num_channels; ch++) s->snroffst[ch] = snroffst; } /* Audio frame transient pre-noise processing data */ @@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g } } /* Exponents */ - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){ s->dexps[ch][0] = get_bits(gbc, 4) << !ch; ff_ac3_decode_exponents(gbc, s->chexpstr[blk][ch], s->nchgrps[ch], @@ -1089,21 +1089,21 @@ static int parse_audblk(GetBitContext *g int csnroffst = (get_bits(gbc, 6) - 15) << 4; if(s->snroffststr == 0x1){ int snroffst = (csnroffst + get_bits(gbc, 4)) << 2; - for(ch=!s->cplinu[blk]; ch<= s->ntchans; ch++) + for(ch=!s->cplinu[blk]; ch<= s->num_channels; ch++) s->snroffst[ch] = snroffst; }else if(s->snroffststr == 0x2){ - for(ch=!s->cplinu[blk]; ch<= s->ntchans; ch++) + for(ch=!s->cplinu[blk]; ch<= s->num_channels; ch++) s->snroffst[ch] = (csnroffst + get_bits(gbc, 4)) << 2; } } } if(s->frmfgaincode && get_bits1(gbc)){ - for(ch = !s->cplinu[blk]; ch <= s->ntchans; ch++) + for(ch = !s->cplinu[blk]; ch <= s->num_channels; ch++) s->fgain[ch] = ff_fgaintab[get_bits(gbc, 3)]; }else{ if(!blk){ - for(ch = !s->cplinu[blk]; ch <= s->ntchans; ch++) + for(ch = !s->cplinu[blk]; ch <= s->num_channels; ch++) s->fgain[ch] = ff_fgaintab[0x4]; } } @@ -1142,7 +1142,7 @@ static int parse_audblk(GetBitContext *g } }else{ if(!blk){ - for(ch=0; ch<=s->ntchans; ch++){ + for(ch=0; ch<=s->num_channels; ch++){ s->deltbae[ch] = DBA_NONE; } } @@ -1157,7 +1157,7 @@ static int parse_audblk(GetBitContext *g } /* run bit allocation */ - for(ch = !s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch = !s->cplinu[blk]; ch<=s->num_channels; ch++){ int start=0, end=0; start = s->strtmant[ch]; end = s->endmant[ch]; @@ -1188,11 +1188,11 @@ static int parse_audblk(GetBitContext *g got_cplchan = 0; // TODO only for debug - for(ch=0; ch<=s->ntchans; ch++) + for(ch=0; ch<=s->num_channels; ch++) memset(s->transform_coeffs[ch], 0, 256*sizeof(float)); /* Quantized mantissa values */ - for(ch = 1; ch <= s->ntchans; ch++){ + for(ch = 1; ch <= s->num_channels; ch++){ get_eac3_transform_coeffs_ch(gbc, s, blk, ch, &m); if(s->cplinu[blk] && s->chincpl[ch] && !got_cplchan){ get_eac3_transform_coeffs_ch(gbc, s, blk, CPL_CH, &m); @@ -1267,15 +1267,15 @@ static int eac3_decode_frame(AVCodecCont /* channel config */ if (avctx->request_channels == 0) { if(avctx->channels == 0) - avctx->channels = c->ntchans; - } else if(c->ntchans < avctx->request_channels) { + avctx->channels = c->num_channels; + } else if(c->num_channels < avctx->request_channels) { av_log(avctx, AV_LOG_ERROR, "Cannot upmix EAC3 from %d to %d channels.\n", - c->ntchans, avctx->request_channels); + c->num_channels, avctx->request_channels); return -1; } else { - if(avctx->request_channels > 2 && avctx->request_channels != c->ntchans) { + if(avctx->request_channels > 2 && avctx->request_channels != c->num_channels) { av_log(avctx, AV_LOG_ERROR, "Cannot downmix EAC3 from %d to %d channels.\n", - c->ntchans, avctx->request_channels); + c->num_channels, avctx->request_channels); return -1; } avctx->channels = avctx->request_channels; @@ -1308,7 +1308,7 @@ static int eac3_decode_frame(AVCodecCont do_imdct(c); - if(avctx->channels != c->ntchans){ + if(avctx->channels != c->num_channels){ ff_ac3_downmix(c->output, c->nfchans, avctx->channels, c->downmix_coeffs); }
On Wed, Sep 12, 2007 at 09:53:51AM +0200, bwolowiec wrote:
--- eac3/eac3dec.c (original) +++ eac3/eac3dec.c Wed Sep 12 09:53:51 2007 @@ -351,14 +351,14 @@ static int parse_bsi(GetBitContext *gbc,
s->nfchans = ff_ac3_channels[s->acmod]; - s->ntchans = s->nfchans; - s->lfe_channel = s->ntchans+1; + s->num_channels = s->nfchans; + s->lfe_channel = s->num_channels+1; if(s->lfeon){ s->strtmant[s->lfe_channel] = 0; s->endmant[s->lfe_channel] = 7; s->nchgrps[s->lfe_channel] = 2; s->chincpl[s->lfe_channel] = 0; - s->ntchans++; + s->num_channels++;
Note that this could be nicely aligned (same in other places).
@@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){
Note that "for (" and "if (" is preferred. Diego
Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 09:53:51AM +0200, bwolowiec wrote:
@@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){
Note that "for (" and "if (" is preferred.
Diego
For as long as I've been a part of FFmpeg, there has never been any focus on small stylistic differences such as these, only on consistency. I personally don't use spaces between my for's/if's/while's and the parentheses. Nobody has ever called me out for it or suggested I change my coding style. -Justin
On Wed, Sep 12, 2007 at 11:25:16PM -0400, Justin Ruggles wrote:
Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 09:53:51AM +0200, bwolowiec wrote:
@@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){
Note that "for (" and "if (" is preferred.
For as long as I've been a part of FFmpeg, there has never been any focus on small stylistic differences such as these, only on consistency. I personally don't use spaces between my for's/if's/while's and the parentheses. Nobody has ever called me out for it or suggested I change my coding style.
Consistency is more important, true. Nevertheless, if you look at some of Michael's recent reviews, you will notice that the spaced forms are indeed preferred. Also, this code was mixing both forms. Diego
Hi On Thu, Sep 13, 2007 at 10:44:32AM +0200, Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 11:25:16PM -0400, Justin Ruggles wrote:
Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 09:53:51AM +0200, bwolowiec wrote:
@@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){
Note that "for (" and "if (" is preferred.
For as long as I've been a part of FFmpeg, there has never been any focus on small stylistic differences such as these, only on consistency. I personally don't use spaces between my for's/if's/while's and the parentheses. Nobody has ever called me out for it or suggested I change my coding style.
Consistency is more important, true. Nevertheless, if you look at some of Michael's recent reviews, you will notice that the spaced forms are indeed preferred.
Also, this code was mixing both forms.
i never complained about the lack of space, only about it being inconsistent personally i normally write for(i=0; i<X; i++){ } grep 'for(i=' snow.c |wc 54 170 1747 grep 'for *( *i *=' snow.c | grep -v 'for(i='|wc 5 44 195 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle
On Thu, Sep 13, 2007 at 12:05:01PM +0200, Michael Niedermayer wrote:
On Thu, Sep 13, 2007 at 10:44:32AM +0200, Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 11:25:16PM -0400, Justin Ruggles wrote:
Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 09:53:51AM +0200, bwolowiec wrote:
@@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){
Note that "for (" and "if (" is preferred.
For as long as I've been a part of FFmpeg, there has never been any focus on small stylistic differences such as these, only on consistency. I personally don't use spaces between my for's/if's/while's and the parentheses. Nobody has ever called me out for it or suggested I change my coding style.
Consistency is more important, true. Nevertheless, if you look at some of Michael's recent reviews, you will notice that the spaced forms are indeed preferred.
Also, this code was mixing both forms.
i never complained about the lack of space, only about it being inconsistent
personally i normally write for(i=0; i<X; i++){ }
grep 'for(i=' snow.c |wc 54 170 1747
grep 'for *( *i *=' snow.c | grep -v 'for(i='|wc 5 44 195
You are inconsistent ;-p I thought you preferred the spaced form. I personally prefer spaces, but don't mind either way. It should be consistent, though. Diego
Hi On Thu, Sep 13, 2007 at 02:13:23PM +0200, Diego Biurrun wrote:
On Thu, Sep 13, 2007 at 12:05:01PM +0200, Michael Niedermayer wrote:
On Thu, Sep 13, 2007 at 10:44:32AM +0200, Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 11:25:16PM -0400, Justin Ruggles wrote:
Diego Biurrun wrote:
On Wed, Sep 12, 2007 at 09:53:51AM +0200, bwolowiec wrote:
@@ -1051,7 +1051,7 @@ static int parse_audblk(GetBitContext *g - for(ch=!s->cplinu[blk]; ch<=s->ntchans; ch++){ + for(ch=!s->cplinu[blk]; ch<=s->num_channels; ch++){ if(s->chexpstr[blk][ch]!=EXP_REUSE){
Note that "for (" and "if (" is preferred.
For as long as I've been a part of FFmpeg, there has never been any focus on small stylistic differences such as these, only on consistency. I personally don't use spaces between my for's/if's/while's and the parentheses. Nobody has ever called me out for it or suggested I change my coding style.
Consistency is more important, true. Nevertheless, if you look at some of Michael's recent reviews, you will notice that the spaced forms are indeed preferred.
Also, this code was mixing both forms.
i never complained about the lack of space, only about it being inconsistent
personally i normally write for(i=0; i<X; i++){ }
grep 'for(i=' snow.c |wc 54 170 1747
grep 'for *( *i *=' snow.c | grep -v 'for(i='|wc 5 44 195
You are inconsistent ;-p
3 of these are from a patch, i didnt investigate where the other 2 are from
I thought you preferred the spaced form. I personally prefer spaces, but don't mind either way. It should be consistent, though.
feel free to fix the 5 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates
participants (4)
-
bwolowiec -
Diego Biurrun -
Justin Ruggles -
Michael Niedermayer