Skip to content
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

Update dav1d and dcv-color-primitives #1870

Closed
wants to merge 1 commit into from

Conversation

averyanalex
Copy link

I license past and future contributions under the dual MIT/Apache-2.0 license,
allowing licensees to choose either at their option.

@averyanalex averyanalex marked this pull request as draft March 5, 2023 10:08
@averyanalex
Copy link
Author

primary_decoder.get_picture() always returns dav1d::Error::Again. Adding primary_decoder.flush() doesn't help.

@Quackdoc
Copy link

Quackdoc commented Mar 15, 2023

I was looking into this the other day myself

I was able to get decoding working by using something along the lines of this. though it was a little different, however I started running into issues with dcp so I stopped working on this. it doesnt seem like dcp supports greater then 8bit yet either so I dont really have a lot of motivation here. I wanted to look at the possibility of using the yuvxyb crate for color conversion but never got around to it.

-        let mut primary_decoder = dav1d::Decoder::new();
-        let coded = ctx.primary_item_coded_data();
-        primary_decoder
-            .send_data(coded, None, None, None)
-            .map_err(error_map)?;
+        let mut dsettings = dav1d::Settings::new();
+        dsettings.set_n_threads(1);
+        let mut primary_decoder = dav1d::Decoder::with_settings(&dsettings).unwrap();
+        let coded = ctx.primary_item_coded_data().to_owned();
+        primary_decoder.send_data(coded, None, None, None).map_err(error_map)?;

@HeroicKatora
Copy link
Member

Alright, this should be at least covered by the test suite. Does that mean you have a reproduction you could contribute @Quackdoc ?

@Quackdoc
Copy link

Quackdoc commented Apr 28, 2023

sorry, this got burried in my mail, I think it would probably be best to swap out dcv-color-primitives for yuvxyb crate since that would get us 422 support and 444 support.

here is a patch I used to decode the avif
dav1d.patch
and here is a sample avif that doesn't work
https://files.catbox.moe/vmkzie.avif

currently it's failing at

            dcp::convert_image(
                width,
                height,
                &src_format,
                Some(strides),
                &src_buffers,
                &dst_format,
                None,
                dst_buffers,
            )
            .map_err(error_map)?;

as far as I can tell the avif should be compatible with what is there since it's 8bit yuv420p.

EDIT: it's worth noting that yuvxyb has an odd preformance issue as it stands though when compiled with msys, gcc is fine

@MonterraByte
Copy link

as far as I can tell the avif should be compatible with what is there since it's 8bit yuv420p.

It looks like dcv-color-primitives only supports converting from I420 to Bgra, not to Rgba (which is what's requested), see here.

@fintelia
Copy link
Contributor

This ended up getting implemented in a different PR, but thanks for raising this!

@fintelia fintelia closed this Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants