bugfix: handle negative values according to their bit size in decode_truncated_block_i32 - #4
Open
mwicat wants to merge 1 commit into
Conversation
…truncated_block_i32
mwicat
force-pushed
the
bugfix/error-toowide-in-truncated-compression
branch
from
August 19, 2024 19:03
cee94fd to
8c89cda
Compare
|
How do you reconcile this change with #5 ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I tried to use ncw-convert to convert a sample library consisting of 124 samples from several keygroups. Two of those samples caused some errors which I decided to analyze. This is one of them:
Looking at the file, it consists mostly of "delta decode" blocks but there is also one "bit truncation" block near the beginning that is not properly decoded by ncw-convert. Looking at the code, sequences of bytes for "bit truncation" scheme are treated like unsigned types which result in numbers that are too big to be encoded as signed type when writing to wave file and that in turn causes value checks in WavWriter::write_sample to throw an error. For example:
[0xfc, 0x31, 0xda]is 24-bit little endian representation of-2477572butdecode_truncated_block_i32will interpret is as14299644which is neither real sample value nor a value that can fit inside signed 24-bit type.After applying my fix the file seems to be decoded properly, I hope this is in line with how "bit truncation" should work in general. Attaching the file that causes the mentioned error.
testfile-truncated-compression.zip