Skip to content
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

Failed to decode image: Unsupported feature: Unsupported codec #1145

Open
anonomousxxx opened this issue Mar 12, 2024 · 8 comments
Open

Failed to decode image: Unsupported feature: Unsupported codec #1145

anonomousxxx opened this issue Mar 12, 2024 · 8 comments

Comments

@anonomousxxx
Copy link

anonomousxxx commented Mar 12, 2024

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

@bradh
Copy link
Contributor

bradh commented Mar 13, 2024

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

@anonomousxxx
Copy link
Author

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

@bradh
Copy link
Contributor

bradh commented Mar 27, 2024

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?

@anonomousxxx
Copy link
Author

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

@bradh
Copy link
Contributor

bradh commented Mar 28, 2024

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?

@anonomousxxx
Copy link
Author

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"

@kmilos
Copy link
Contributor

kmilos commented Mar 28, 2024

option(WITH_LIBDE265 "" OFF)

libheif doesn't see libde265 in my configuration

@anonomousxxx
Copy link
Author

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

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

3 participants