-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
Crash when encoding AVIF using rav1e #554
Comments
Could you please confirm that the crash disappears when these two lines
are removed from |
Removing the two lines and It also makes the image grayscale-looking. |
Sure. This is just a test to see if there crash goes away. Problem is that the alpha input image is greyscale and the Cb/Cr pointers point to nothing. |
I'm currently preparing the release v1.14.0 and was wondering if this issue is still relevant. The crash looks like the input alpha image is monochrome only. But as far as I can see, this cannot happen since libheif/libheif/heif_context.cc Line 2209 in 7fc9427
If you still have these crashes, could you please check the value of 'chroma' in |
Please give me few days. I'll install MSYS2 environment again and try to reproduce the problem after building the libheif there. |
Sure, after that long time, a few days won't matter. |
I could still reproduce this crash on the master branch with the --- a/libheif/heif_encoder_rav1e.cc
+++ b/libheif/heif_encoder_rav1e.cc
@@ -512,6 +512,7 @@ struct heif_error rav1e_encode_image(void* encoder_raw, const struct heif_image*
const heif_chroma chroma = heif_image_get_chroma_format(image);
+ std::cout << "chroma=" << chroma << std::endl;
uint8_t yShift = 0;
RaChromaSampling chromaSampling; Prints Line 903 in 6d15810
Applying this patch: --- a/libheif/heif_encoder_rav1e.cc
+++ b/libheif/heif_encoder_rav1e.cc
@@ -522,6 +522,7 @@ struct heif_error rav1e_encode_image(void* encoder_raw, const struct heif_image*
if (input_class == heif_image_input_class_alpha) {
chromaSampling = RA_CHROMA_SAMPLING_CS420; // I can't seem to get RA_CHROMA_SAMPLING_CS400 to work right now, unfortunately
chromaPosition = RA_CHROMA_SAMPLE_POSITION_UNKNOWN; // TODO: set to CENTER when AV1 and rav1e supports this
+ yShift = 1;
}
else {
switch (chroma) { Seems to fix this, and the output image looks OK. So, perhaps this whole if-statement: libheif/libheif/heif_encoder_rav1e.cc Lines 521 to 525 in 5fdba25
Can be removed, assuming it always falls into this case statement for (monochrome-)alpha images: libheif/libheif/heif_encoder_rav1e.cc Lines 535 to 539 in 5fdba25
BTW, I couldn't test commit 6d15810 (and commits after that) in combination with libvips, since the plugins are no longer implicitly registered at startup. Do we have to call |
@kleisauke Thanks, that probably is the issue. I was always looking for a Concerning the change with I've added a separate issue for this (#668). |
I am able to reproduce the crash on MSYS2:
It was build using autotools. BTW, when I try to build using cmake, all heif utilities crash immediately:
|
Thanks, both are working now. |
Commit 0020008 seems to fix this for me on Windows (tested in combination with commit libvips/build-win64-mxe@846d74f). Though, I only checked it with the provided sample image. (fwiw, libvips still prefers aom over the dav1d+rav1e combo due to build difficulties and binary size, but perhaps we'll revisit this) |
Hello,
I am experiencing crashes when Windows GIMP tries to export AVIF images with transparency. It can be reproduced using
heif-enc.exe
under MSYS2 on Windows but for some reason it is not occurring on my Linux.More information in the following issues:
msys2/MINGW-packages#9869
xiph/rav1e#2836
The text was updated successfully, but these errors were encountered: