libheif icon indicating copy to clipboard operation
libheif copied to clipboard

Failed to decode image: Unsupported feature: Unsupported codec

Open oleksii-iermolenko opened this issue 1 year ago • 8 comments

Hi!

I've had this setup before for heic decoding on Android:

CMakeLists.txt

if (POLICY CMP0079)
    cmake_policy(SET CMP0079 NEW)
endif ()

FetchContent_Declare(libheif
        GIT_REPOSITORY https://github.com/strukturag/libheif
        GIT_TAG v1.12.0
        PATCH_COMMAND echo "" > tests/CMakeLists.txt
        BINARY_DIR build
        SUBBUILD_DIR subbuild
)

include(libde265.cmake)

option(BUILD_SHARED_LIBS "" OFF)
option(WITH_EXAMPLES "" OFF)
option(WITH_DAV1D "" OFF)
option(WITH_LIBDE265 "" OFF)
option(WITH_X265 "" OFF)
option(WITH_AOM "" OFF)
option(WITH_RAV1E "" OFF)

FetchContent_MakeAvailable(libheif)

target_include_directories(heifdecoder PRIVATE ${libheif_BINARY_DIR} ${libheif_SOURCE_DIR})
target_link_libraries(heifdecoder heif)

libde265.cmake

FetchContent_Declare(libde265
        GIT_REPOSITORY  https://github.com/strukturag/libde265.git
        GIT_TAG         v1.0.8
        BINARY_DIR      libde265-build
        SUBBUILD_DIR    libde265-subbuild
)

option(BUILD_SHARED_LIBS "" OFF)
option(ENABLE_SDL "" OFF)
if (${ANDROID} AND NOT ${ANDROID_ABI} STREQUAL "x86" AND NOT ${ANDROID_ABI} STREQUAL "x86_64")
    option(DISABLE_SSE "" ON)
endif()

FetchContent_MakeAvailable(libde265)

set(LIBDE265_FOUND 1)
set(LIBDE265_LIBRARIES libde265)
set(LIBDE265_INCLUDE_DIR
        "${libde265_SOURCE_DIR}"
        "${libde265_BINARY_DIR}"
)

Main CMakeLists.txt

cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_CXX_STANDARD 17)
set(Root_DIR ${CMAKE_SOURCE_DIR}/../../../..)

project(heifdecoder C CXX ASM)
include(FetchContent)

add_library(heifdecoder SHARED
        HeifDecoder.cpp
)

get_filename_component(deps "../_deps" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(FETCHCONTENT_BASE_DIR ${deps})

add_subdirectory(libheif)
add_definitions(-DHAVE_LIBHEIF)

target_link_libraries(heifdecoder android jnigraphics log)

This worked perfectly until I tried to update the libraries to the latest versions (1.17.6 and 1.0.15) Now I get this error:

Failed to decode image: Unsupported feature: Unsupported codec

As I understand libheif can't find the libde265 plugin anymore, but not sure why this happens. Did something change in the configuration with library updates?

Thanks

oleksii-iermolenko avatar Mar 12 '24 13:03 oleksii-iermolenko

Libheif has its own cmake configuration. Does it work if you use that?

bradh avatar Mar 13 '24 21:03 bradh

How can I use Libheif's cmake with libde265? As I understand, I need to install libde265 separately

oleksii-iermolenko avatar Mar 27 '24 10:03 oleksii-iermolenko

How can I use Libheif's cmake with libde265? As I understand, I need to install libde265 separately

Yes. Perhaps I don't understand the problem you have. Do you not want to install libde265?

bradh avatar Mar 27 '24 21:03 bradh

How can I use Libheif's cmake with libde265? As I understand, I need to install libde265 separately

Yes. Perhaps I don't understand the problem you have. Do you not want to install libde265?

I'm trying to decode HEIF images on android, so I need libheif with libde265

oleksii-iermolenko avatar Mar 27 '24 23:03 oleksii-iermolenko

How can I use Libheif's cmake with libde265? As I understand, I need to install libde265 separately

Yes. Perhaps I don't understand the problem you have. Do you not want to install libde265?

I'm trying to decode HEIF images on android, so I need libheif with libde265

I'm sorry I still don't get the problem.

Can you build libde265?

Can you install libde265?

Can you build libheif?

bradh avatar Mar 28 '24 00:03 bradh

How can I use Libheif's cmake with libde265? As I understand, I need to install libde265 separately

Yes. Perhaps I don't understand the problem you have. Do you not want to install libde265?

I'm trying to decode HEIF images on android, so I need libheif with libde265

I'm sorry I still don't get the problem.

Can you build libde265?

Can you install libde265?

Can you build libheif?

I can build, but libheif doesn't see libde265 in my configuration, so I get an "Unsupported codec error"

oleksii-iermolenko avatar Mar 28 '24 07:03 oleksii-iermolenko

option(WITH_LIBDE265 "" OFF)

libheif doesn't see libde265 in my configuration

kmilos avatar Mar 28 '24 13:03 kmilos

option(WITH_LIBDE265 "" OFF)

libheif doesn't see libde265 in my configuration

It works for the versions above, but not for higher ones. Seems like the way plugins are loaded was changed in 1.14.0

oleksii-iermolenko avatar Mar 28 '24 18:03 oleksii-iermolenko