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
Revert "Revert "Enable and test high bit depth input (#437)" (#442)" and fix reconstruction output #447
Conversation
Currently compiles, encodes and decodes with desynchronization
Commented out by default, to enable as needed for local testing.
The test failure in CI is due to CDEF changes introduced after #437. Setting |
What do you mean? Stream copy example works fine for me with nyan12.y4m, producing playable 12-bit file. |
@Kagami interesting, on my end encoding the reconstruction in rav1e panicks with "bad input" above 8-bit, which I thought was happening on |
Regarding the reconstruction output at high bit depths, here is the relevant issue in We can perform our own conversion for now using |
src/lib.rs
Outdated
fs.rec.planes[1].cfg.stride, | ||
fs.rec.planes[2].cfg.stride); | ||
|
||
for (y, line) in fs.rec.planes[0].data.chunks_mut(stride_y).enumerate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rec does not mutate and you can use chunks_mut()
on rec_y
and friends.
for (line, line_out) in fs.rec.planes[0].data.chunks().zip(rec_y.chunks_mut(pitch_y))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thank you.
LGTM. |
…h#442)" (xiph#447) * Attempt to process 10-bit Y4M input Currently compiles, encodes and decodes with desynchronization * Use high bit depth quantization tables * Move context::clamp() to util.rs * Fix partition context initialization for high bit depth * Enable and test 10-bit input * Add 10- and 12-bit test clips to build.sh Commented out by default, to enable as needed for local testing. * Use the same bit depth as y4m_dec for y4m_enc * Fix benchmark module compilation * Fix high bit depth test encoding in 8-bit * Fix header syntax for 12-bit 4:2:0 input * Enable and test 12-bit input * Reflect 12-bit support in README.md * Keep the default C420jpeg color space in y4m_encoder * Do not allow reconstruction output at high bit depths * Fix reconstruction output at high bit depths * Clean up reconstruction copy to frame buffers
…h#442)" (xiph#447) * Attempt to process 10-bit Y4M input Currently compiles, encodes and decodes with desynchronization * Use high bit depth quantization tables * Move context::clamp() to util.rs * Fix partition context initialization for high bit depth * Enable and test 10-bit input * Add 10- and 12-bit test clips to build.sh Commented out by default, to enable as needed for local testing. * Use the same bit depth as y4m_dec for y4m_enc * Fix benchmark module compilation * Fix high bit depth test encoding in 8-bit * Fix header syntax for 12-bit 4:2:0 input * Enable and test 12-bit input * Reflect 12-bit support in README.md * Keep the default C420jpeg color space in y4m_encoder * Do not allow reconstruction output at high bit depths * Fix reconstruction output at high bit depths * Clean up reconstruction copy to frame buffers
After investigating the errors caused by the original PR, it seems that the tools used for comparison are interpolating samples from Y4M files labelled as using the
C420jpeg
color space, which the libaom decoder always uses, regardless of the chroma positioning indicated in the header.In order to support outputting Y4M reconstructions at high bit depths, a change in
rav1e.rs
set the Y4M encoder's color space to be the same as that of the input file's. This means that rav1e was now outputtingC420Mpeg2
reconstructions for input files using that color space, while the decoder output was alwaysC420jpeg
and therefore required interpolating chroma samples in order to be converted to a raw image. Of course, the result was that due to interpolation error, there was a difference in raw output between the reconstructed output and the AOM decoder output.The change that causes this issue was reverted in order to maintain compatibility between the two output streams, and because it does not currently affect compatibility with high bit depth streams, asHowever, the real issue that prompted a reversal of the original PR stems from:thewe do not yet support encoding Y4M files at high bit depths.y4m
crate doesI recommend testing encoder output by comparing the reconstructed and decoded Y4M files, excluding the header, in the future.
The changes to this PR compared to #437 are as follows:
the Y4M encoder used to output reconstruction is no longer initialized to a non-default color spaceusing the-r
option at high bit depths will panic, as they4m
crate does not currently support high bit depth encodingRelevant libaom issue: https://bugs.chromium.org/p/aomedia/issues/detail?id=2096