faad2
faad2 copied to clipboard
Values begin, end variables in pns.c may not be correct in the case of short window sequences
Some months the variables offs, size where replaced by begin and end variables which are basically calculated as:
min(group* (frame_length/8) + ics->swb_offset[x], ics->swb_offset_max)
In the case of HEIGHT_SHORT_SEQUENCE, ics->swb_offset_max is frame_length/8 (see specrec.c) which means for group > 0 the values of both begin and end will always be equal to frame_length/8. => this means the subsequent calls to generate_rand_vector generate nothing for group > 0.
Speaking of the ics->swb_offset table, it can be safely replaced by a pointer to the relevant constant table in specrec.c. The code in there copies into the swb_offset table the entries of the relevant swb_offset_xxx_yy table and put frame_length or frame_length/8 in swb_offset[ics->num_swbs] but as you can see swb_offset_xxx_yy[ics->num_swbs] already contains the appropriate value, to you can just point to the table directly instead of taking a copy.
This also points to the fact that all those min(ics->swb_offset[x], ics->swb_offset_max) in various source files are unnecessary. Since ics->swb_offset[ics->num_swbs] = ics->swb_offset_max this means that ics->swb_offset[x] is always <= ics->swb_offset_max as long as x <= ics->num_swbs (i.e. you don't read past the table end). This in turn is guaranteed as long as ics->max_sfb <= ics->num_swbs.