-
Notifications
You must be signed in to change notification settings - Fork 77
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
File decoding fails #143
Comments
eustas
added a commit
to eustas/faad2
that referenced
this issue
Jun 2, 2023
eustas
added a commit
to eustas/faad2
that referenced
this issue
Jun 5, 2023
In earlier changelist, following the comments on scale_factor field I've "unified" checking of scale_factor for all 3 major cases. That was a mistake. Some files stopped decoding failing exactly at point where scale_factor is checked. There are 3 types of scale_factor: "quant", "intensity" and "noise". "intensity" and "noise" scale_factors have different meaning. Removed checks at parsing time for them and added capping at processing. "noise" scale_factor stands for magnitude of generated signal. Large negative factor means inaudible noise. On encoder side (e.g. in FAAC) it is even replaced with "silence" after some threshold (MSE < 0.4, it renders to exp ~= -6). Large positive factor means "loud" noise. Again too-big values simply does not fit output format. Same reasoning applies to floating point calculations. For floating point noise scale factor is capped with [-120,120] range, i.e. scale is (9.3e-10,1.7e+9) For fixed poind noise scale factor is capped with [-60,60]. "intensity" stands for "joint stereo". In FAAC encoder if the difference between scale_factor is 30 or more, the quieter channel is encoded as silence. I.e. if difference in power more than 180 that feels like there is only one audio source. Given that same cap is applied to "intensity" scale_factor. Moreover, for "quant" scale_factor limit is 0..255 with an offset of 100, i.e. it is -100..155; close enough to the new limits for other two scale_factor.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried
sample4.aac
from https://filesamples.com/formats/aacDecoder returns
Scalefactor out of range
(error code 4).This happens because in the given file "intensity" scale factor is sometimes negative. Overall it ranges
-3..4
.Capping to non-negative values results in decoding success. Waveform looks similar to produced with other decoder.
Looking at code, delta applied to each next scale_factor is
-60..60
. Logically, if we want to have all possibilities for next value, then scale factor range width should be 60. But is it -30..30 or 0..60? Will try to find an answer in internet...The text was updated successfully, but these errors were encountered: