[FFmpeg-devel] [PATCH] atrac decoder
Benjamin Larsson
banan
Wed Aug 12 20:45:55 CEST 2009
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;
}
}
I have some bug in there but the code would look something like that. Do
you prefer this solution ?
MvH
Benjamin Larsson
More information about the ffmpeg-devel
mailing list