[non-BE] [allow-regression] Remove temporary input buffers in core-encoder
- Related issues: #2370 (closed)
- Requested reviewers:
Reason why this change is needed
- There are temporary input buffers in the core-encoder on the WC stack.
Description of the change
- In ivas_core_enc_fx(), there are currently defined buffers tmp_input_fx[L_FRAME48k] and tmp_old_input_fx[]. These buffers are used to temporarily store the original values input audio buffer st->input_buffer_fx[]. In the subsequent processing, the buffer st->input_buffer_fx[] is rescaled to Q=-1 to accommodate the SWB BWE encoding. After SWB BWE, the buffer st->input_buffer_fx[] is populated with the original samples stored in tmp_input_fx[L_FRAME48k] and tmp_old_input_fx[]. Instead of storing the original values, it is proposed to scale back the values of the input audio buffer st->input_buffer_fx[].
- Note that samples related to the old input buffer, i.e. those stored in tmp_input_fx[L_FRAME48k], are anyway replaced by actual input audio buffer samples, so technically they do not need to be copied back or scaled back without breaking bit-exactness.
- Saves 3,840 bytes of stack RAM on the worst-case path.
Affected operating points
- Not BE for bitrate switching testcases involving changing the number of TCs.
- In these situations, it happens that in the first frame after the switching, the down-scaling before SWB BWE involves a substantial change of the Q-factor, typically from 5 to -1. The up-scaling back to the original Q-factor then loses a little bit of precision, and the old input audio samples used in the next frame are thus not perfectly reconstructed. However, as it happens during switching of a different number of TCs, which anyway contain subjective artifacts (clicks), this non-bit-exactness plays a negligible role.
Closes #2370 (closed)
Edited by vaclav