On Apr 21, 2004, at 1:09 AM, Grigory A. wrote:
Now I am looking on void III_reorder(mad_fixed_t xr[576], struct channel const *channel, unsigned char const sfbwidth[39])
C implementation takes ~30 000 cycles - it is too much. So could you tell me can I use for reordering this one simple scheme
for sb=0 to 31 do //For all 32 subbands for window=0 to 2 do //For each of the 3 windows for ws=0 to 5 do //For each sample within a window Xro[18*sb + ss] = Xdis[18*sb + window + 3*ws] //Reorder end for end for end for
If answer is "no" - so could you explain the role of unsigned char const sfbwidth[39] in original MAD reordering function very shortly of course.
A couple of notes:
- Only short block scalefactor bands should be reordered. So, if it is a mixed block, only subbands 2-31 should be reordered. (This is the purpose of the 18*sb expression, because long block scalefactor bands 0-35 correspond to subbands 0-1.)
- The sfbwidth array provides the width of each scalefactor band (per window), and varies according to sampling frequency and whether the block is a normal short block or a mixed block.
- The purpose of reordering is to put the samples into subband order, with three windows per subband, and six samples per window (3*6 = 18, the width of one subband). Thus scalefactor bands with more than six samples per window will be spread across several subbands (placed into the correct window), and scalefactor bands with fewer than six samples per window will be coalesced with neighboring band windows.