Skip to content

APIs for direct image item payload access #1814

@programingKing

Description

@programingKing

Hello,

Our team runs an image processing system that handles transcoding and operations across multiple image formats. For HEIC, we use the libheif C API with NVIDIA hardware (NVDEC/NVENC).
libheif's codec plugin mechanism doesn't fit our system well — we're facing issues similar to #1793.
As a workaround, I wrote a passthrough plugin that just forwards the bytes to our external decoder. It works, but it feels hacky.
A more natural fit for our case would be direct APIs to:

  1. Extract an image item's HEVC bitstream.
  2. Build an image item from a pre-encoded HEVC bitstream.

I think the codec plugin might be an intentional abstraction. That said, the plugin contract makes integration difficult for us. Would you be open to adding a public API for accessing the codec-level data, something like below? I'd be happy to contribute if possible.

// 1. Get the coded bitstream (config NALs + slice NALs) of an image item,
//    either length-prefixed or in Annex B form.
heif_image_handle_get_compressed_data(...)

// 2. Create an image item from pre-encoded HEVC bytes
//    (VPS/SPS/PPS + slice NALs), building hvcC + iloc from the input.
heif_context_add_compressed_image(...)

// 3. Link an image item as the alpha auxiliary of another image item
//    (sets up auxC property + auxl iref).
heif_image_handle_assign_as_alpha_of(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions