[FFmpeg-devel] [PATCH] atrac decoder

Michael Niedermayer michaelni
Thu Aug 13 04:02:28 CEST 2009


On Wed, Aug 12, 2009 at 08:45:55PM +0200, Benjamin Larsson wrote:
> Michael Niedermayer wrote:
> 
> > if the groups are a power of 2 you can do
> > 0123456789ABCDEF
> > ^3
> > 32107654...
> > 
> > thats just a ^C in the index and can be omited when filling whole
> > blocks of size C with zeros
> > 
> 
> When implemented this code
> 
> pos = su->bsm[band_num] ? bfu_start_short[bfu_num] :
> bfu_start_long[bfu_num];
> 
> for (i=0 ; i<num_specs ; i++) {
> /* read in a quantized spec and convert it to signed and then inverse
> quantization */
>    spec[pos + i] = get_sbits(gb, word_len) *
>                       sf_tab[su->idsfs[bfu_num]] * max_quant;
> 
> 
> becomes this code
> 
> if (su->bsm[band_num]) {
>  /* get the position of the 1st spec according to the block size mode */
>     pos = bfu_start_short[bfu_num];
>     for (i=0 ; i<num_specs ; i++) {
>         int j = band_num ? ((pos&~31)+((pos+i)^31)) : pos +i;
>         spec[j] = get_sbits(gb, word_len) *
>                             sf_tab[su->idsfs[bfu_num]] * max_quant;
>     }
> } else {
>  /* get the position of the 1st spec according to the block size mode */
>     pos = bfu_start_long[bfu_num];
>     for (i=0 ; i<num_specs ; i++) {
>         int j = band_num ? 511 - (pos +i) : pos + i;
>         /* read in a quantized spec and convert it to signed and then
> inverse quantization */
>         spec[j] = get_sbits(gb, word_len) *
>                             sf_tab[su->idsfs[bfu_num]] * max_quant;
>     }
> }


cant the loops be merged with a ^variable? instead of constants
btw, instead of checking for the first band, it could be reordered
later, i assume that would get rid of most reordering and still keep
the code simple and fast


> 
> 
> I have some bug in there but the code would look something like that. Do
> you prefer this solution ?

speed is what matters ...
if its slower i surely dont prefer it ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- 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/20090813/18e4dae7/attachment.pgp>



More information about the ffmpeg-devel mailing list