-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix all the files that fail to compare correctly #26
Comments
So, as of the 0.9.1 release, only these 5 files are remaining. I ran
|
There has been a bug that led lewton to wrongly decode singlemap-test.ogg as well as audio_simple_with_error.ogg. I tracked it down by printing out intermediary values for lewton as well as for stb_vorbis and comparing them. First, I saw that there was a mismatch in the pre imdct values. Then, I tracked it down to a mismatch in the residue values. After that, I found out that the codebook values were wrong. And then, I saw that the settings for codebook_minimum_value and codebook_delta_value have been parsed wrongly by lewton, which caused all the other mismatches. This wrong parsing has been caused by a bug in the behaviour of the float conversion routine float32_unpack. The deployed fix was to replace the overengineered and overoptimized bit twiddling implementation by a more straight forward, spec following one. Performance impact wasn't measured, but the code is super cold: It's called only during header setup and even there only twice per codebook. In singlemap-test.ogg, it was called a few dozen times or such. Fixes #24, and also addresses parts of #26.
There has been a bug that led lewton to wrongly decode singlemap-test.ogg as well as audio_simple_with_error.ogg. I tracked it down by printing out intermediary values for lewton as well as for stb_vorbis and comparing them. First, I saw that there was a mismatch in the pre imdct values. Then, I tracked it down to a mismatch in the residue values. After that, I found out that the codebook values were wrong. And then, I saw that the settings for codebook_minimum_value and codebook_delta_value have been parsed wrongly by lewton, which caused all the other mismatches. This wrong parsing has been caused by a bug in the behaviour of the float conversion routine float32_unpack. The deployed fix was to replace the overengineered and overoptimized bit twiddling implementation by a more straight forward, spec following one. Performance impact wasn't measured, but the code is super cold: It's called only during header setup and even there only twice per codebook. In singlemap-test.ogg, it was called a few dozen times or such. Fixes #24, and also addresses parts of #26.
With 1073e58, singlemap-test.ogg has been fixed.
|
Fixes comparison to libvorbis for two sample files by fixing two bugs in lewton: 1. In cases where the last header packet was directly followed by audio packets, without any page boundary, libvorbis just ignored those packets. lewton didn't so it treated the packets as normal content. This created a misalignment between lewton and libvorbis when parsing the sample files. Such a situation occured in test-short.ogg as well as chain-test2.ogg. The spec says that audio packets must start in a fresh page, so this means that the files are technically invalid. However, libvorbis parses them just fine. 2. Second, we move the last = 0 resetting into the outer loop. This is what the spec says, and it is also needed in order to fix the comparison to libvorbis for the two files. Otherwise, there'd be just silence, as the floor0 samples would assume crazy values. As we rely on a new function that has been added to the ogg crate for the very purpose of using it in this commit, we bump the version requirement for the ogg crate to 0.6.1. Both files get fixed at once as chain-test2.ogg is just a concatenation of test-short.ogg with another file where no mismatch to libvorbis was present. Transparency notice: this commit marks the first and hopefully last time I've ever looked into the vorbis source code for my work on the lewton crate. I think that this creates no change in the licensing situation of the lewton crate. The changes of this commit are so small that they don't fall under copyright. This commit addresses parts of #26.
Fixes comparison to libvorbis for two sample files by fixing two bugs in lewton: 1. In cases where the last header packet was directly followed by audio packets, without any page boundary, libvorbis just ignored those packets. lewton didn't so it treated the packets as normal content. This created a misalignment between lewton and libvorbis when parsing the sample files. Such a situation occured in test-short.ogg as well as chain-test2.ogg. The spec says that audio packets must start in a fresh page, so this means that the files are technically invalid. However, libvorbis parses them just fine. 2. Second, we move the last = 0 resetting into the outer loop. This is what the spec says, and it is also needed in order to fix the comparison to libvorbis for the two files. Otherwise, there'd be just silence, as the floor0 samples would assume crazy values. As we rely on a new function that has been added to the ogg crate for the very purpose of using it in this commit, we bump the version requirement for the ogg crate to 0.6.1. Both files get fixed at once as chain-test2.ogg is just a concatenation of test-short.ogg with another file where no mismatch to libvorbis was present. Transparency notice: this commit marks the first and hopefully last time I've ever looked into the vorbis source code for my work on the lewton crate. I think that this creates no change in the licensing situation of the lewton crate. The changes of this commit are so small that they don't fall under copyright. This commit addresses parts of #26.
Fixes comparison to libvorbis for two sample files by fixing two bugs in lewton: 1. In cases where the last header packet was directly followed by audio packets, without any page boundary, libvorbis just ignored those packets. lewton didn't so it treated the packets as normal content. This created a misalignment between lewton and libvorbis when parsing the sample files. Such a situation occured in test-short.ogg as well as chain-test3.ogg. The spec says that audio packets must start in a fresh page, so this means that the files are technically invalid. However, libvorbis parses them just fine. 2. Second, we move the last = 0 resetting into the outer loop. This is what the spec says, and it is also needed in order to fix the comparison to libvorbis for the two files. Otherwise, there'd be just silence, as the floor0 samples would assume crazy values. As we rely on a new function that has been added to the ogg crate for the very purpose of using it in this commit, we bump the version requirement for the ogg crate to 0.6.1. Both files get fixed at once as chain-test3.ogg is just a concatenation of test-short.ogg with another file where no mismatch to libvorbis was present. Transparency notice: this commit marks the first and hopefully last time I've ever looked into the vorbis source code for my work on the lewton crate. I think that this creates no change in the licensing situation of the lewton crate. The changes of this commit are so small that they don't fall under copyright. This commit addresses parts of #26.
With commit e2b38e8, only |
Prior to this commit, the individual streams that make up chain-test1.ogg all had no difference to libvorbis in isolation, but when their concatenation was played back, a decoding mismatch occured for every packet of the second stream. The issue was that the last packet of the first stream should have been shorter than the one lewton outputted. E.g. if you put code like if n == 2022 { dec_data.truncate(1044); } right before the let mut diffs = 0; in the `cmp_output` function, you'd get a match because that'd have leveled out the mismatch. The vorbis spec says that the absgp of each page marks the last sample inside the last packet that ends it. It also says that if the absgp of the last page of the entire stream is before the actually decoded length of the last packet, truncation is neccessary. This truncation was the cause for the mismatch as vorbis implemented and we didn't. This commit implements the truncation and thus fixes the mismatch for chain-test1.ogg. Addresses parts of #26.
Progress on |
With commit 31f64bb , I could fix the last mismatch and thus, this bug can be closed! |
Commits 3224e94...6352249 have added files to the testsuite from
libnogg
as well as fromxiphmont
. Some are commented out however, as lewton shows mismatches to libvorbis.xiph testsuite failures (27 test files in total):
chain-test1.ogg
(dbfaae5)chain-test2.ogg
(e051c7e)chain-test3.ogg
(e2b38e8)singlemap-test.ogg
(1073e58)test-short.ogg
(e2b38e8)unused-mode-test.ogg
(0517494)libnogg testsuite failures (32 test files in total):
6ch-all-page-types.ogg
(6b0a2f8, 4718132)6ch-long-first-packet.ogg
(6b0a2f8, 4718132)6ch-moving-sine-floor0.ogg
(71190ca)6ch-moving-sine.ogg
(6b0a2f8)bad-continued-packet-flag.ogg
(95fa236)noise-6ch.ogg
(6b0a2f8)single-code-2bits.ogg
(95fa236)single-code-nonsparse.ogg
(10c479d)single-code-ordered.ogg
(b312ce4)single-code-sparse.ogg
(can decode with b312ce4, correct samples with 6b0a2f8)square-interleaved.ogg
(31f64bb)(eb231f7) → actually an ogg crate issue Dealing with junk at the end of a file? ogg#7square-with-junk.ogg
The text was updated successfully, but these errors were encountered: