Skip to content

RGB colour value differences after libavif/libaom upgrade across architectures and compilers #2788

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

Open
maupadhyay opened this issue May 6, 2025 · 3 comments

Comments

@maupadhyay
Copy link

maupadhyay commented May 6, 2025

We were previously using libavif v0.9.2 (with libaom v3.1.2), both built locally on a Mac Intel machine with Xcode 12 and Apple Clang 12.0.0 (clang-1200.0.32.29), to decode .avif images and retrieve RGB color values. After upgrading to libavif v1.2.1 (with libaom v3.12.0)—both built locally on a Mac M2 machine with Xcode 16 and Apple Clang 16.0.0 (clang-1600.0.26.6)—we noticed that for some images, the RGB color values differ slightly (by ±1) compared to the results from v0.9.2. Same happens when Mac intel and XCode16 (Apple Clang 16.0.0 (clang-1600.0.26.6)) is used for compiling v1.2.1 (with libaom v3.12.0).

Interestingly, when compiling v1.2.1 (libaom v3.12.0) on the same Mac Intel machine with Xcode 12 and Apple Clang 12.0.0, the RGB values match the previous results exactly.

Is this a known behaviour, and do we have any insights into what might be causing these differences?

@vrabaud
Copy link
Collaborator

vrabaud commented May 6, 2025

So the compiler version is the factor that changes the values. the +1/-1 difference seems like a rounding difference.
There can be 3 culprits:

  • libavif
  • libaom
  • libyuv

What is the CMake command you are using exactly? Can you please attach one of those images?

@maupadhyay
Copy link
Author

maupadhyay commented May 7, 2025

Hi @vrabaud ,

For building libaom using below command to generate Xcode project and then building using Xcode:
cmake ./aom -G Xcode -DAOM_TARGET_CPU=generic -DENABLE_EXAMPLES=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DBUILD_SHARED_LIBS=OFF -DCONFIG_PIC=1 -DENABLE_DOCS=0 -DENABLE_TESTDATA=0 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"

For libavif, I was facing issues similar to #2780 while using Xcode generator for generating Xcode project and then building.
Hence had to use below commands:

cmake -S libavif -B libavif/build -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=LOCAL    -DAVIF_BUILD_APPS=OFF -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DAVIF_LIBSHARPYUV=OFF -DAVIF_JPEG=OFF -DAVIF_ZLIBPNG=OFF


cmake --build libavif/build --config MinSizeRel --parallel 

I have shared sample image over an email.

@maupadhyay
Copy link
Author

Hi @vrabaud ,

Just following up to check if you had a chance to review this issue. Please let me know if you need any further details or clarification. I’d appreciate any updates when you have the time. Thank you!

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

No branches or pull requests

2 participants