[FFmpeg-devel] [PATCH] avoid using fixed size integers in AC3 code

Michael Niedermayer michaelni
Tue Sep 25 02:23:37 CEST 2007


Hi

On Mon, Sep 24, 2007 at 07:47:02PM -0400, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> > Hi
> > 
> > On Sun, Sep 23, 2007 at 10:08:30PM -0400, Justin Ruggles wrote:
> >> $subject
> >>
> >> This was discussed already in the E-AC3 patch thread.
> > 
> > yes, now if i would only remember any details ...
> 
> Hmm...I guess my memory is getting bad.  I looked back and I had 
> misinterpreted your review, then corrected myself.  anyway... I still 
> don't understand why it's preferable to use fixed size integers for some 
> variables but not for others when it's not necessary.
> 
> > 
> > [...]
> >> @@ -170,11 +170,11 @@
> >>      int   endmant[AC3_MAX_CHANNELS];        ///< end frequency bin
> >>      AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters
> >>  
> >> -    int8_t  dexps[AC3_MAX_CHANNELS][256];   ///< decoded exponents
> >> -    uint8_t bap[AC3_MAX_CHANNELS][256];     ///< bit allocation pointers
> >> -    int16_t psd[AC3_MAX_CHANNELS][256];     ///< scaled exponents
> >> -    int16_t bndpsd[AC3_MAX_CHANNELS][50];   ///< interpolated exponents
> >> -    int16_t mask[AC3_MAX_CHANNELS][50];     ///< masking curve values
> >> +    int dexps[AC3_MAX_CHANNELS][256];       ///< decoded exponents
> >> +    int bap[AC3_MAX_CHANNELS][256];         ///< bit allocation pointers
> >> +    int psd[AC3_MAX_CHANNELS][256];         ///< scaled exponents
> >> +    int bndpsd[AC3_MAX_CHANNELS][50];       ///< interpolated exponents
> >> +    int mask[AC3_MAX_CHANNELS][50];         ///< masking curve values
> > 
> > why!? this significantly insreases the size of the context, also it
> > makes SIMD optimizations using these impossible
> 
> Am I missing something here?  That would mean that we should make 
> everything fixed size in case we want to optimize it someday.  Correct 
> me if I'm wrong, but I thought FFmpeg's general guideline was to use 
> generic integers when possible (except for tables which increase binary 
> size).

the part you miss is that 256*AC3_MAX_CHANNELS*sizeof(int) is 7kb
we have 3 of them here -> 21k
this might be alot for an embeded audio player, its general purpose ram
might be quite limited ...

and if you want generic types, theres uint_fast8_t least8_t and such

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070925/77986195/attachment.pgp>



More information about the ffmpeg-devel mailing list