Cykooz / libheif-rs

Safe wrapper to libheif-sys for parsing heif/heic files
MIT License
34 stars 11 forks source link

Consider using HEIF and AVIF formats for test data #16

Closed kalev closed 11 months ago

kalev commented 1 year ago

I am packaging libheif-rs for Fedora and when running self tests, I noticed that most of the tests are failing due to either

Error: HeifError { code: UnsupportedFeature, sub_code: UnsupportedCodec, message: "Unsupported feature: Unsupported codec" }

or

Error: HeifError { code: UnsupportedFileType, sub_code: Unspecified, message: "Unknown error" }

This is because libheif that's packaged for Fedora doesn't actually include a HEIC decoder due to patent concerns. /usr/lib64/libheif/libheif-libde265.so and /usr/lib64/libheif/libheif-x265.so plugins that enable HEIC support in libheif are split out and not included, which makes libheif-rs tests that use .heic files fail. There are 3rd party repositories (e.g. rpmfusion) that ship the missing plugins, but they are unavailable in the Fedora build system when libheif-rs is built (but they are available for end users to install from third party repositories if they so choose).

What's supported out of the box are HEIF and AVIF formats: I wonder if it would make sense to update the test files in libheif-rs to mostly use HEIF and AVIF? And maybe skip HEIC tests if the format is unavailable? That way, we could run the test suite during package compilation and make sure nothing regresses.

Due to this, I've disabled all self tests for now, but I've verified that all of them actually pass (with the exception of https://github.com/Cykooz/libheif-rs/issues/14 that I filed earlier) if I locally install the missing plugins.

Cykooz commented 1 year ago

I have released v0.21. Almost all tests now use HEIF testing files. Only one test uses HEIC, but it checks that Hevc decoder is available.

kalev commented 11 months ago

Thanks a lot! I've enabled the self tests in the Fedora package build now and just skipping test_encoder now.

test_encoder is still failing with:

---- test_encoder stdout ----
Error: HeifError { code: UnsupportedFileType, sub_code: Unspecified, message: "Unknown error" }

Is let mut encoder = lib_heif.encoder_for_format(CompressionFormat::Hevc)?; supposed to exit early when the encoder isn't available? For some reason the early exit doesn't seem to work.

Cykooz commented 11 months ago

Upss... I missed this test. I will fix it.

Cykooz commented 11 months ago

I have pushed the fix into master branch.

kalev commented 11 months ago

Awesome, thanks! I just tested it and all tests are passing here now.