What causes decoding issues with AVIF images in LIBHEIF and DAV1D decoder?

I’m a Windows/C/C++ developer integrating HEIF and AVIF image functionality (decoding only for now) into my application using LIBHEIF, libde265, and DAV1D codecs. While HEIF images work, AVIF images do not, resulting in an “unspecified error” even with LIBHEIF’s example.avif.

The image has 4 OBUs (two OBU_SEQ_HDR, one OBU_FRAME_HDR, and one OBU_TILE_GRP), but the parser seems unable to decode any frame, always returning false from output_picture_ready(), and eventually giving an EAGAIN error. Is this structure correct, and what could be causing the issue?

1 Like


It seems like you have correctly identified the components of the AVIF file with the OBUs. The structure you described two sequence headers (OBU_SEQ_HDR), one frame header (OBU_FRAME_HDR), and one tile group (OBU_TILE_GRP) is typical for AVIF files.
However, the issue seems to be with the decoding process.

The output_picture_ready() function returning false suggests that the decoder cannot process the frame data correctly. This could be due to several reasons:

  • Incorrect Codec Configuration: Ensure the DAV1D codec is configured and initialized in your application. It must align with the AVIF file’s encoding parameters.

  • Incomplete File Data: Verify that the example AVIF file is not corrupted or incomplete. Try testing with different AVIF files to rule out file-specific issues.

  • Library Integration: Double-check the integration of LIBHEIF, libde265, and DAV1D in your application. Make sure that the libraries are not only built and linked correctly but also that they are interacting as expected.

  • Codec Compatibility: Ensure that the version of DAV1D you’re using is compatible with the AVIF files you’re trying to decode. Sometimes, codec versions can have specific limitations or bugs.

  • Error Handling: Investigate how errors are handled in your application. The EAGAIN error generally indicates that additional data is required to proceed, which might suggest an issue with how the file data is fed into the decoder.

Given the complexity of image format decoding, you can look into the documentation and community forums for LIBHEIF and DAV1D for any known issues or updates that might be relevant to your situation.

I hope this may help you. Do let me know if you need more help.

Thank you