forge
Explore
Log in

Don't you dare go Hollow

ec-aac SBR: FIXVAR/VARVAR trailing relative borders applied in reverse order

Browse files at this commit

f9581022075b7e6a6e815132b18fc8fba37d3246Ahmet Kaan GümüşParent: 76482df
sbr_payload.rs parse_grid read the trailing rel borders in wire order but
subtracted the last-read one from the trailing edge. FFmpeg n8.0
aacsbr_template.c read_sbr_grid assigns the first-read rel to t_env[n-1]
(FIXVAR: t_env[bs_num_env-1-i] = t_env[bs_num_env-i] - 2*bits-2, same in
VARVAR). Only differs when there are 2+ trailing rels (num_env >= 3), so a
uniform list hid it. Fix: rel index num_env-1-i in both trailing loops.
crates/ec-aac/src/sbr_payload.rsmodified+2 -2
@@ -350,7 +350,7 @@ impl SbrParser {
350350 t[num_env] = trail;
351351 let mut acc = trail;
352352 for i in (1..num_env).rev() {
353- acc -= rel[i - 1];
353+ acc -= rel[num_env - 1 - i];
354354 t[i] = acc;
355355 }
356356 } else {
@@ -394,7 +394,7 @@ impl SbrParser {
394394 t[num_env] = trail;
395395 let mut acc = trail;
396396 for i in (num_rel0 + 1..num_env).rev() {
397- acc -= rel1[i - num_rel0 - 1];
397+ acc -= rel1[num_env - 1 - i];
398398 t[i] = acc;
399399 }
400400 if t.windows(2).any(|w| w[0] >= w[1]) {