Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Values begin, end variables in pns.c may not be correct in the case of short window sequences #191

Open
atimmernans opened this issue Nov 18, 2023 · 0 comments

Comments

@atimmernans
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant