diff --git a/.github/workflows/build-tests.yml b/.github/workflows/build-tests.yml index 928c3bbd..20d2fef9 100644 --- a/.github/workflows/build-tests.yml +++ b/.github/workflows/build-tests.yml @@ -2,8 +2,6 @@ name: Build tests on: push: - branches: - - main pull_request: @@ -13,48 +11,63 @@ jobs: build: strategy: matrix: - version: [ipu6epmtl, ipu6ep, ipu6] + version: [ipu6] os: ["ubuntu:24.04", "ubuntu:22.04", "ubuntu:20.04"] runs-on: ubuntu-latest container: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Build test for ${{ matrix.version }} on ${{ matrix.os }} - timeout-minutes: 10 + with: + repository: intel/ipu6-camera-bins + ref: main + path: bins + + - name: Install from intel/ipu6-camera-bins + run: | + cd "${GITHUB_WORKSPACE}/bins" + + cat README.md | \ + awk 'BEGIN { \ + FS="/"; \ + } \ + /^```/ { \ + getline; \ + if ($1 == "# Runtime files") { \ + while ($1 != "```") { \ + print $0; \ + getline; \ + } \ + } \ + }' | \ + sed 's,ipu6-camera-bins/,./,' | \ + sh -x + + - uses: actions/checkout@v4 + with: + path: hal + + - name: Install prerequisite packages run: | - case "${{ matrix.version }}" in - (ipu6) - PLATFORM="ipu_tgl" - ;; - (ipu6ep) - PLATFORM="ipu_adl" - ;; - (ipu6epmtl) - PLATFORM="ipu_mtl" - ;; - (*) - echo "Not support for ${IPU_VER} yet." - exit 1 - ;; - esac echo 'APT::Get::Always-Include-Phased-Updates True;' | tee -a /etc/apt/apt.conf echo 'Acquire::http::User-Agent-Non-Interactive "true";' | tee -a /etc/apt/apt.conf apt-get update -q export TZ=Asia/Shanghai echo "" | apt-get install -qy tzdata echo "" | apt-get install git build-essential cmake libexpat-dev automake libtool libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev libdrm-dev --yes - git clone https://github.com/intel/ipu6-camera-bins -b main --depth 1 - cp -rv ipu6-camera-bins/include/"${PLATFORM}" /usr/include/ - cp -rv ipu6-camera-bins/lib/"${PLATFORM}" /usr/lib/ - rm -fr /usr/lib/"${PLATFORM}"/pkgconfig - cp -rv ipu6-camera-bins/lib/"${PLATFORM}"/pkgconfig/* /usr/lib/pkgconfig/ - rm -fr ipu6-camera-bins - mkdir -p ./build/out/install/usr && cd ./build/ - cmake -DCMAKE_BUILD_TYPE=Release \ - -DIPU_VER="${{ matrix.version }}" \ - -DENABLE_VIRTUAL_IPU_PIPE=OFF \ - -DUSE_PG_LITE_PIPE=ON \ - -DUSE_STATIC_GRAPH=OFF \ - -DCMAKE_INSTALL_PREFIX=/usr .. - make + - name: Build test for ${{ matrix.version }} on ${{ matrix.os }} + timeout-minutes: 10 + run: | + cd "${GITHUB_WORKSPACE}/hal" + + mkdir build && cd build + cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_CAMHAL_TESTS=OFF \ + -DBUILD_CAMHAL_ADAPTOR=ON \ + -DBUILD_CAMHAL_PLUGIN=ON \ + -DIPU_VERSIONS="ipu6;ipu6ep;ipu6epmtl" \ + -DUSE_PG_LITE_PIPE=ON \ + .. + VERBOSE=1 make make install diff --git a/CMakeLists.txt b/CMakeLists.txt index d0d22e69..a4f50689 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,12 @@ cmake_minimum_required(VERSION 2.8) project(libcamhal) +option(BUILD_CAMHAL_PLUGIN "Build libcamhal as plugins" OFF) +option(BUILD_CAMHAL_ADAPTOR "Build hal_adaptor as libcamhal" OFF) -#---------------------------- Fold settings ---------------------------- +#------------------------- Global settings ------------------------- + +#------------------------- folder settings ------------------------- # Source directories set(SRC_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/src) @@ -52,8 +56,8 @@ endif() #SUPPORT_LIVE_TUNING # ia_cipr is only used by psysprocessor if (USE_PG_LITE_PIPE) -set(IA_CIPR_DIR ${MODULES_DIR}/ia_cipr) -set(MODULE_IA_CSS_DIR ${MODULES_DIR}/ia_css) + set(IA_CIPR_DIR ${MODULES_DIR}/ia_cipr) + set(MODULE_IA_CSS_DIR ${MODULES_DIR}/ia_css) endif() #USE_PG_LITE_PIPE # CMake module directory @@ -65,20 +69,25 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}" CACHE PATH "Target location for install command." FORCE) endif() -message(STATUS "install prefix: " ${CMAKE_INSTALL_PREFIX}) - -if (UPSTREAM_CODE) - add_compile_definitions(IPU6_UPSTREAM=1) -else() - add_compile_definitions(IPU6_UPSTREAM=0) -endif() - -#------------------------- Compilation settings ------------------------- +#------------------------- compile and link options ------------------------- include(GNUInstallDirs) +# code coverage. +include(code-coverage) -# -fPIC in xos way -set(CMAKE_POSITION_INDEPENDENT_CODE ON) +message(STATUS "install prefix: " ${CMAKE_INSTALL_PREFIX}) + +set (CMAKE_CXX_STANDARD 11) +add_compile_options( + -Wall + -Werror + -fstack-protector + -fPIE + -fPIC + -DDCHECK_ALWAYS_ON + -Wformat + -Wformat-security +) include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(-faligned-new COMPILER_SUPPORTS_ALIGNED_NEW) @@ -86,77 +95,8 @@ if (COMPILER_SUPPORTS_ALIGNED_NEW) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new") endif() -set (CMAKE_CXX_STANDARD 11) -add_compile_options(-Wall -Werror - -fstack-protector - -fPIE -fPIC - -DDCHECK_ALWAYS_ON - -Wformat -Wformat-security - ) -# code coverage. -include(code-coverage) - -add_definitions(-D__STDC_FORMAT_MACROS - -DHAVE_PTHREADS - -DHAVE_LINUX_OS - -DHAVE_IA_TYPES - -DHAVE_PRCTL - ) - -if (USE_PG_LITE_PIPE) - add_definitions(-DUSE_PG_LITE_PIPE) -endif() #USE_PG_LITE_PIPE - -if (CAL_BUILD) - message("Chrome enabled ") - add_definitions(-DCAL_BUILD) - add_definitions(-DDUMP_IMAGE) -else() - add_definitions(-DSUPPORT_MULTI_PROCESS) - add_definitions(-DLINUX_BUILD) -endif() #CAL_BUILD - -if (FACE_DETECTION) - add_definitions(-DFACE_DETECTION) -endif() #FACE_DETECTION - -# IPU6_FEATURE_S -if (IPU_VER MATCHES "ipu6") - add_definitions(-DIPU_SYSVER_IPU6) -endif() -# IPU6_FEATURE_E - -# IPU6_SE_FEATURE_S -if ("${IPU_VER}" STREQUAL "ipu6sepla") - add_definitions(-DIPU_SYSVER_ipu6v3) -endif() -# IPU6_SE_FEATURE_E - -if ("${IPU_VER}" STREQUAL "ipu6ep") - message(INFO "add definition -DIPU_SYSVER_ipu6v5 for ipu6ep") - add_definitions(-DIPU_SYSVER_ipu6v5) -endif() - -if ("${IPU_VER}" STREQUAL "ipu6epmtl") - message(INFO "add definition -DIPU_SYSVER_ipu6v6 for ipu6ep") - add_definitions(-DIPU_SYSVER_ipu6v6) -endif() - -include_directories(include - include/api include/utils - ${CMAKE_INSTALL_PREFIX}/include/ia_camera - ${CMAKE_INSTALL_PREFIX}/include/ - ${CMAKE_CURRENT_LIST_DIR} - src - src/v4l2 src/core src/metadata - src/platformdata src/platformdata/gc - src/3a src/3a/intel3a src/3a/external - src/fd src/scheduler - src/core/psysprocessor - src/image_process - ) - -set(LIBCAMHAL_LD_FLAGS "-fPIE -fPIC -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now") +set (THREADS_PREFER_PTHREAD_FLAG ON) +find_package (Threads REQUIRED) # check if _FORTIFY_SOURCE is default defined with -O include(CheckFortifyLevel) @@ -167,17 +107,94 @@ if(FORTIFY_SOURCE_VALUE) else() message(STATUS "_FORTIFY_SOURCE is not defined or could not be determined.") add_compile_options(-D_FORTIFY_SOURCE=2) - set(LIBCAMHAL_LD_FLAGS "${LIBCAMHAL_LD_FLAGS} -D_FORTIFY_SOURCE=2") message(STATUS "define _FORTIFY_SOURCE=2") endif() -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LIBCAMHAL_LD_FLAGS}") +add_link_options( + -fPIE + -fPIC + -Wformat + -Wformat-security + -Wl,-z,relro + -Wl,-z,now + -Wl,--no-as-needed + -Wl,--no-undefined +) + +# -fPIC in xos way +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +#------------------- common definitions, includes and link -------------------- + +add_definitions(-D__STDC_FORMAT_MACROS -DHAVE_PTHREADS -DHAVE_LINUX_OS -DHAVE_IA_TYPES -DHAVE_PRCTL) + +include_directories( + include + include/api include/utils + ${CMAKE_INSTALL_PREFIX}/include/ia_camera + ${CMAKE_INSTALL_PREFIX}/include/ + ${CMAKE_CURRENT_LIST_DIR} + src + src/v4l2 src/core src/metadata + src/platformdata src/platformdata/gc + src/3a src/3a/intel3a src/3a/external + src/fd src/scheduler + src/core/psysprocessor + src/image_process +) + +set(LIBCAMHAL_LINK_LIBS ${LIBCAMHAL_LINK_LIBS} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} expat rt) add_subdirectory(src) add_subdirectory(modules) -# Set source files +if (USE_PG_LITE_PIPE) + add_definitions(-DUSE_PG_LITE_PIPE) +endif() #USE_PG_LITE_PIPE + + set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${IIO_SRCS}) + +if (SUPPORT_LIVE_TUNING) + include_directories(modules/livetune) + set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${LIVE_TUNING_SRCS}) +endif() #SUPPORT_LIVE_TUNING + +if(FACE_DETECTION) + add_definitions(-DFACE_DETECTION) + set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${FACE_DETECTION_SRCS}) + set(LIBCAMHAL_LINK_LIBS + ${LIBCAMHAL_LINK_LIBS} + pvl_eye_detection + pvl_face_detection + pvl_mouth_detection + ${WORK_DIR_TMP}/src/fd/libface_detection.a + ) +endif() #FACE_DETECTION + +if(ENABLE_SANDBOXING) + find_package(LIBMOJO) + find_package(LIBCAMERA_IPC) + find_package(LIBCAB) + add_definitions(-DENABLE_SANDBOXING) + set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${SANDBOXING_CLIENT_SRCS}) + include_directories( + ${USR_INCLUDE_HEADER}/base-${BASEVER} + ${LIBMOJO_INCLUDE_DIRS} + ${LIBCAMERA_IPC_INCLUDE_DIRS} + ${LIBCAB_INCLUDE_DIRS} + ) + link_directories( + ${CMAKE_PREFIX_PATH} + ${LIBMOJO_LIBS} + ${LIBCAMERA_IPC_LIBS} + ${LIBCAB_LIBS} + ) + set(LIBCAMHAL_LINK_LIBS ${LIBCAMHAL_LINK_LIBS} ${LIBCAB_LIBS} ${LIBMOJO_LIBS} ${LIBCAMERA_IPC_LIBS} ${CMAKE_PREFIX_PATH}/librt.a) +endif() #ENABLE_SANDBOXING + if (CAL_BUILD) + message("Chrome enabled ") + add_definitions(-DCAL_BUILD -DDUMP_IMAGE) if (SW_JPEG_ENCODE) add_definitions(-DSW_JPEG_ENCODE) include_directories(src/jpeg/sw) @@ -193,40 +210,51 @@ if (CAL_BUILD) add_subdirectory(aal) - set(LIBCAMHAL_SRCS - ${LIBCAMHAL_SRCS} - ${MEMORY_SRCS} - ${AAL_SRCS} - ${JPEG_SRCS} - ) + set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${MEMORY_SRCS} ${AAL_SRCS} ${JPEG_SRCS}) include_directories(include include/api include/utils include/linux - ${USR_INCLUDE_HEADER}/android/system/core/include/ - ${USR_INCLUDE_HEADER}/ia_imaging - ${USR_INCLUDE_HEADER}/usr/lib${IPU_VER} - ${USR_INCLUDE_HEADER}/android/hardware/libhardware/include/ - aal aal/chrome src/iutils src/jpeg - modules/memory modules/memory/chrome + ${USR_INCLUDE_HEADER}/android/system/core/include/ + ${USR_INCLUDE_HEADER}/ia_imaging + ${USR_INCLUDE_HEADER}/usr/lib${IPU_VER} + ${USR_INCLUDE_HEADER}/android/hardware/libhardware/include/ + aal aal/chrome src/iutils src/jpeg + modules/memory modules/memory/chrome + ) + find_package(LIBCAMERA_CLIENT) + find_package(LIBCAMERA_COMMON) + find_package(LIBCAMERA_METADATA) + find_package(LIBCAMERA_V4L2_DEVICE) + find_package(LIBSYNC) + find_package(LIBCBM) + + include_directories(${LIBCAMERA_CLIENT_INCLUDE_DIRS} ${LIBCAMERA_COMMON_INCLUDE_DIRS} + ${LIBCAMERA_METADATA_INCLUDE_DIRS} ${LIBCAMERA_V4L2_DEVICE_INCLUDE_DIRS} + ${LIBSYNC_INCLUDE_DIRS} + ${LIBCBM_INCLUDE_DIRS} ) -endif() #CAL_BUILD + link_directories(${CMAKE_PREFIX_PATH} ${LIBCAMERA_CLIENT_LIBS} ${LIBCAMERA_METADATA_LIBS} + ${LIBCAMERA_COMMON_LIBS} ${LIBSYNC_LIBS} + ${LIBCBM_LIBS} + ) -if (SUPPORT_LIVE_TUNING) - set(LIBCAMHAL_SRCS ${LIVE_TUNING_SRCS}) - include_directories(modules/livetune) -endif() #SUPPORT_LIVE_TUNING + set(LIBCAMHAL_LINK_LIBS ${LIBCAMHAL_LINK_LIBS} ${LIBCAMERA_CLIENT_LIBS} ${LIBCAMERA_COMMON_LIBS} + ${LIBCAMERA_METADATA_LIBS} ${LIBCAMERA_V4L2_DEVICE_LIBS} + ${LIBSYNC_LIBS} jpeg ${CMAKE_PREFIX_PATH}/libyuv.pic.a + ${LIBCBM_LIBS} camera_v4l2_device + ) +endif() #CAL_BUILD -if (USE_PG_LITE_PIPE) -add_subdirectory(${MODULE_IA_CSS_DIR}) -include_directories(${MODULE_IA_CSS_HEADER_INCLUDE_DIR}) -set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${MODULE_IA_CSS_SRC}) - -# suppress modules/ia_css .c code compiling error -include(CheckCCompilerFlag) -CHECK_C_COMPILER_FLAG("-Wno-error=unused-but-set-variable" COMPILER_SUPPORTS_NO_UNUSED_BUT_SET_VAR) -if (COMPILER_SUPPORTS_NO_UNUSED_BUT_SET_VAR) - set_source_files_properties(${MODULE_IA_CSS_SRC} PROPERTIES COMPILE_FLAGS - "-Wno-error=unused-but-set-variable ${CMAKE_C_FLAGS}") +if (NOT CAL_BUILD) + message("Linux build") + add_definitions(-DSUPPORT_MULTI_PROCESS) + add_definitions(-DLINUX_BUILD) + include_directories(${MODULES_DIR}/v4l2) + find_package(LIBDRM) + if(LIBDRM_FOUND AND ("${LIBDRM_VERSION}" VERSION_GREATER_EQUAL 2.4.114)) + include_directories(${LIBDRM_INCLUDE_DIRS}) + set(LIBCAMHAL_LINK_LIBS ${LIBCAMHAL_LINK_LIBS} ${LIBDRM_LIBS}) + add_definitions(-DLIBDRM_SUPPORT_MMAP_OFFSET) + endif() endif() -endif() #USE_PG_LITE_PIPE set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} @@ -246,208 +274,156 @@ set(LIBCAMHAL_SRCS ${MODULES_DIR}/ia_cipr/src/Event.cpp ${MODULES_DIR}/ia_cipr/src/Command.cpp ${MODULES_DIR}/ia_cipr/src/Utils.cpp - ) +) -if(FACE_DETECTION) -set(LIBCAMHAL_SRCS - ${LIBCAMHAL_SRCS} - ${FACE_DETECTION_SRCS} - ) -endif() #FACE_DETECTION +#------------------------- Target settings ------------------------- -if(ENABLE_SANDBOXING) -set(LIBCAMHAL_SRCS - ${LIBCAMHAL_SRCS} - ${SANDBOXING_CLIENT_SRCS} - ) -endif() #ENABLE_SANDBOXING - - set(LIBCAMHAL_SRCS ${LIBCAMHAL_SRCS} ${IIO_SRCS}) +if (NOT IPU_VERSIONS) + set(IPU_VERSIONS ${IPU_VER}) +endif() -# Add libcamhal using the specified sources -if (${CMAKE_VERSION} VERSION_LESS 3.11) - add_library(camhal SHARED ${LIBCAMHAL_SRCS}) -else() - add_library(camhal SHARED $) +if (BUILD_CAMHAL_ADAPTOR) + add_subdirectory(src/hal/hal_adaptor) + if (NOT BUILD_CAMHAL_PLUGIN) + message(NOTICE "Will not build libcamhal plugins") + set(IPU_VERSIONS "") + endif() endif() -set_target_properties(camhal PROPERTIES SOVERSION 0) -set_target_properties(camhal PROPERTIES VERSION "0.0.0") -add_library(camhal_static STATIC ${LIBCAMHAL_SRCS}) +# Add different targets according to array IPU_VERSIONS +foreach(IPU_VER ${IPU_VERSIONS}) -if (NOT CAL_BUILD AND (NOT "${CMAKE_INSTALL_SUB_PATH}" STREQUAL "")) - set(CMAKE_SKIP_RPATH TRUE) - set_target_properties(camhal PROPERTIES LINK_FLAGS - "-Wl,-rpath,/usr/lib/${CMAKE_INSTALL_SUB_PATH}") - add_compile_definitions(SUB_CONFIG_PATH="${CMAKE_INSTALL_SUB_PATH}") +if (BUILD_CAMHAL_PLUGIN) + set(TARGET_SUFFIX "-${IPU_VER}") endif() -set_target_properties(camhal_static PROPERTIES OUTPUT_NAME "camhal") -#---------------------------- Link settings ---------------------------- -target_link_libraries(camhal ${CMAKE_DL_LIBS}) -target_link_libraries(camhal_static ${CMAKE_DL_LIBS}) +set(TARGET_INCLUDE "") +set(TARGET_DEFINITIONS "") +set(TARGET_SRCS "") +set(TARGET_LINK_LIBS "") -set (THREADS_PREFER_PTHREAD_FLAG ON) -find_package (Threads REQUIRED) -target_link_libraries(camhal ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries(camhal_static ${CMAKE_THREAD_LIBS_INIT}) +if (USE_PG_LITE_PIPE) + add_subdirectory(modules/ia_css modules/ia_css${TARGET_SUFFIX}) + set(TARGET_INCLUDE ${TARGET_INCLUDE} ${MODULE_IA_CSS_HEADER_INCLUDE_DIR}) + set(TARGET_SRCS ${TARGET_SRCS} ${MODULE_IA_CSS_SRC}) +endif() #USE_PG_LITE_PIPE -target_link_libraries(camhal expat rt) -target_link_libraries(camhal_static expat rt) +if (IPU_VER MATCHES "ipu6") + message(STATUS "add definition -DIPU_SYSVER_IPU6 for ${IPU_VER}") + set(TARGET_DEFINITIONS ${TARGET_DEFINITIONS} -DIPU_SYSVER_IPU6) + if (IPU_VER STREQUAL "ipu6sepla") + message(STATUS "add definition -DIPU_SYSVER_ipu6v3 for ${IPU_VER}") + set(TARGET_DEFINITIONS ${TARGET_DEFINITIONS} -DIPU_SYSVER_ipu6v3) + elseif (IPU_VER STREQUAL "ipu6ep") + message(STATUS "add definition -DIPU_SYSVER_ipu6v5 for ${IPU_VER}") + set(TARGET_DEFINITIONS ${TARGET_DEFINITIONS} -DIPU_SYSVER_ipu6v5) + elseif (IPU_VER STREQUAL "ipu6epmtl") + message(STATUS "add definition -DIPU_SYSVER_ipu6v6 for ${IPU_VER}") + set(TARGET_DEFINITIONS ${TARGET_DEFINITIONS} -DIPU_SYSVER_ipu6v6) + endif() +endif() -if (CAL_BUILD) - target_link_libraries(camhal camera_v4l2_device) - target_link_libraries(camhal_static camera_v4l2_device) +if (NOT CAL_BUILD) + set(TARGET_DEFINITIONS ${TARGET_DEFINITIONS} "-DCAMERA_DEFAULT_CFG_PATH=\"${CMAKE_INSTALL_FULL_SYSCONFDIR}/camera/${IPU_VER}/\"") endif() # Link libraries, the building will be interrupted if libs/includes not found - # Link ia_imaging find_package(IA_IMAGING) - include_directories(${IA_IMAGING_INCLUDE_DIRS}) - target_link_libraries(camhal ${IA_IMAGING_LIBS}) - target_link_libraries(camhal_static ${IA_IMAGING_LIBS}) - -if(USE_PG_LITE_PIPE) - find_package(LIBGCSS) - include_directories(${LIBGCSS_INCLUDE_DIRS}) - target_link_libraries(camhal ${LIBGCSS_LIBS}) - target_link_libraries(camhal_static ${LIBGCSS_LIBS}) -else() - # Link libiacss - find_package(LIBIACSS) - include_directories(${LIBIACSS_INCLUDE_DIRS}) - target_link_libraries(camhal ${LIBIACSS_LIBS}) - target_link_libraries(camhal_static ${LIBIACSS_LIBS}) -endif() - -find_package(LIBDRM) -if(LIBDRM_FOUND AND ("${LIBDRM_VERSION}" VERSION_GREATER_EQUAL 2.4.114)) -include_directories(${LIBDRM_INCLUDE_DIRS}) -target_link_libraries(camhal ${LIBDRM_LIBS}) -target_link_libraries(camhal_static ${LIBDRM_LIBS}) -add_definitions(-DLIBDRM_SUPPORT_MMAP_OFFSET) -endif() + set(TARGET_INCLUDE ${TARGET_INCLUDE} ${IA_IMAGING${TARGET_SUFFIX}_INCLUDE_DIRS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${IA_IMAGING${TARGET_SUFFIX}_LIBS}) + + if(USE_PG_LITE_PIPE) + find_package(LIBGCSS) + set(TARGET_INCLUDE ${TARGET_INCLUDE} ${LIBGCSS${TARGET_SUFFIX}_INCLUDE_DIRS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBGCSS${TARGET_SUFFIX}_LIBS}) + # Include libipu(4) headers + find_package(LIBIPU) + set(TARGET_INCLUDE ${TARGET_INCLUDE} ${LIBIPU${TARGET_SUFFIX}_INCLUDE_DIRS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBIPU${TARGET_SUFFIX}_LIBS}) + else() + # Link libiacss + find_package(LIBIACSS) + set(TARGET_INCLUDE ${TARGET_INCLUDE} ${LIBIACSS${TARGET_SUFFIX}_INCLUDE_DIRS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBIACSS${TARGET_SUFFIX}_LIBS}) + endif() -# Include libipu(4) headers -find_package(LIBIPU) -include_directories(${LIBIPU_INCLUDE_DIRS}) +#--------------------------- Add libcamhal target --------------------------- -if (USE_PG_LITE_PIPE) - target_link_libraries(camhal ${IPU_LIB}) - target_link_libraries(camhal_static ${IPU_LIB}) +if (BUILD_CAMHAL_PLUGIN) + set(CAMHAL_TARGET ${IPU_VER}) + set(CAMHAL_STATIC_TARGET ${IPU_VER}_static) +else() + set(CAMHAL_TARGET camhal) + set(CAMHAL_STATIC_TARGET camhal_static) endif() -if (CAL_BUILD) - find_package(LIBCAMERA_CLIENT) - find_package(LIBCAMERA_COMMON) - find_package(LIBCAMERA_METADATA) - find_package(LIBCAMERA_V4L2_DEVICE) - find_package(LIBSYNC) - find_package(LIBCBM) - - include_directories(${LIBCAMERA_CLIENT_INCLUDE_DIRS} ${LIBCAMERA_COMMON_INCLUDE_DIRS} - ${LIBCAMERA_METADATA_INCLUDE_DIRS} ${LIBCAMERA_V4L2_DEVICE_INCLUDE_DIRS} - ${LIBSYNC_INCLUDE_DIRS} - ${LIBCBM_INCLUDE_DIRS} - ) - link_directories(${CMAKE_PREFIX_PATH} ${LIBCAMERA_CLIENT_LIBS} ${LIBCAMERA_METADATA_LIBS} - ${LIBCAMERA_COMMON_LIBS} ${LIBSYNC_LIBS} - ${LIBCBM_LIBS} - ) - - target_link_libraries(camhal ${LIBCAMERA_CLIENT_LIBS} ${LIBCAMERA_COMMON_LIBS} - ${LIBCAMERA_METADATA_LIBS} ${LIBCAMERA_V4L2_DEVICE_LIBS} - ${LIBSYNC_LIBS} jpeg ${CMAKE_PREFIX_PATH}/libyuv.pic.a - ${LIBCBM_LIBS} - ) - target_link_libraries(camhal_static ${LIBCAMERA_CLIENT_LIBS} ${LIBCAMERA_COMMON_LIBS} - ${LIBCAMERA_METADATA_LIBS} ${LIBCAMERA_V4L2_DEVICE_LIBS} - ${LIBSYNC_LIBS} jpeg ${CMAKE_PREFIX_PATH}/libyuv.pic.a - ${LIBCBM_LIBS} - ) -endif() #CAL_BUILD +# Add libcamhal using the specified sources +add_library(${CAMHAL_STATIC_TARGET} STATIC ${LIBCAMHAL_SRCS} ${TARGET_SRCS}) -if (NOT CAL_BUILD) - include_directories(${MODULES_DIR}/v4l2) +if (${CMAKE_VERSION} VERSION_LESS 3.11) + add_library(${CAMHAL_TARGET} SHARED ${LIBCAMHAL_SRCS} ${TARGET_SRCS}) +else() + add_library(${CAMHAL_TARGET} SHARED $) endif() -if (FACE_DETECTION) - target_link_libraries(camhal pvl_eye_detection pvl_face_detection pvl_mouth_detection) - target_link_libraries(camhal_static pvl_eye_detection pvl_face_detection pvl_mouth_detection) - target_link_libraries(camhal ${WORK_DIR_TMP}/src/fd/libface_detection.a) - target_link_libraries(camhal_static ${WORK_DIR_TMP}/src/fd/libface_detection.a) +target_include_directories(${CAMHAL_STATIC_TARGET} PRIVATE ${TARGET_INCLUDE}) +target_include_directories(${CAMHAL_TARGET} PRIVATE ${TARGET_INCLUDE}) +target_compile_definitions(${CAMHAL_STATIC_TARGET} PRIVATE ${TARGET_DEFINITIONS}) +target_compile_definitions(${CAMHAL_TARGET} PRIVATE ${TARGET_DEFINITIONS}) +target_link_libraries(${CAMHAL_STATIC_TARGET} PRIVATE ${LIBCAMHAL_LINK_LIBS} ${TARGET_LINK_LIBS}) +target_link_libraries(${CAMHAL_TARGET} PRIVATE ${LIBCAMHAL_LINK_LIBS} ${TARGET_LINK_LIBS}) + +if (BUILD_CAMHAL_PLUGIN) + set_target_properties(${CAMHAL_STATIC_TARGET} PROPERTIES PREFIX "") + set_target_properties(${CAMHAL_TARGET} PROPERTIES PREFIX "") + set_target_properties(${CAMHAL_STATIC_TARGET} PROPERTIES OUTPUT_NAME ${IPU_VER}) + set_target_properties(${CAMHAL_TARGET} PROPERTIES OUTPUT_NAME ${IPU_VER}) +else() + set_target_properties(${CAMHAL_STATIC_TARGET} PROPERTIES OUTPUT_NAME ${CAMHAL_TARGET}) + set_target_properties(${CAMHAL_TARGET} PROPERTIES SOVERSION 0) + set_target_properties(${CAMHAL_TARGET} PROPERTIES VERSION "0.0.0") + set_target_properties(${CAMHAL_TARGET} PROPERTIES OUTPUT_NAME ${CAMHAL_TARGET}) endif() -if (ENABLE_SANDBOXING) - add_definitions(-DENABLE_SANDBOXING) - - find_package(LIBMOJO) - find_package(LIBCAMERA_IPC) - find_package(LIBCAB) - - include_directories(${USR_INCLUDE_HEADER}/base-${BASEVER}) - include_directories(${LIBMOJO_INCLUDE_DIRS}) - include_directories(${LIBCAMERA_IPC_INCLUDE_DIRS}) - include_directories(${LIBCAB_INCLUDE_DIRS}) - - link_directories(${CMAKE_PREFIX_PATH} - ${LIBMOJO_LIBS} - ${LIBCAMERA_IPC_LIBS} - ${LIBCAB_LIBS} - ) - - target_link_libraries(camhal ${LIBCAB_LIBS}) - target_link_libraries(camhal ${LIBMOJO_LIBS}) - target_link_libraries(camhal ${LIBCAMERA_IPC_LIBS}) - target_link_libraries(camhal ${CMAKE_PREFIX_PATH}/librt.a) - - target_link_libraries(camhal_static ${LIBCAB_LIBS}) - target_link_libraries(camhal_static ${LIBMOJO_LIBS}) - target_link_libraries(camhal_static ${LIBCAMERA_IPC_LIBS}) - target_link_libraries(camhal_static ${CMAKE_PREFIX_PATH}/librt.a) -endif() #ENABLE_SANDBOXING - #--------------------------- Install settings --------------------------- if (NOT CAL_BUILD) -# Install headers -if ("${CMAKE_INSTALL_SUB_PATH}" STREQUAL "") - install(DIRECTORY include/ DESTINATION usr/include/libcamhal) - if (SUPPORT_LIVE_TUNING) - install(FILES modules/livetune/LiveTuning.h DESTINATION usr/include/libcamhal/api) - endif() #SUPPORT_LIVE_TUNING -endif() - -# Install configure files, by default ipu4 is used -if(("${IPU_VER}" STREQUAL "") OR ("${IPU_VER}" STREQUAL "ipu4")) - message("Install camera configure files for ipu4") - install(DIRECTORY config/linux/ipu4/ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/camera/${CMAKE_INSTALL_SUB_PATH}) -else() - message("Install camera configure files for " ${IPU_VER}) - if (UPSTREAM_CODE) - install(DIRECTORY config/linux/${IPU_VER}_upstream/ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/camera/${CMAKE_INSTALL_SUB_PATH}) - else() - install(DIRECTORY config/linux/${IPU_VER}/ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/camera/${CMAKE_INSTALL_SUB_PATH}) + if (NOT BUILD_CAMHAL_PLUGIN) + # Install headers + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcamhal) + if (SUPPORT_LIVE_TUNING) + install(FILES modules/livetune/LiveTuning.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcamhal/api) + endif() #SUPPORT_LIVE_TUNING endif() -endif() -# Install libraries -if (${CMAKE_VERSION} VERSION_LESS 3.11) -install(TARGETS camhal camhal_static - LIBRARY DESTINATION usr/lib/${CMAKE_INSTALL_SUB_PATH} - ARCHIVE DESTINATION usr/lib/${CMAKE_INSTALL_SUB_PATH} - ) -else() -install(TARGETS camhal camhal_static DESTINATION usr/lib/${CMAKE_INSTALL_SUB_PATH}) -endif() + # Install configure files, by default ipu4 is used + message("Install camera configure files for ${IPU_VER}") + install(DIRECTORY config/linux/${IPU_VER}/ DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/camera/${IPU_VER}) -# Install package config file -configure_file(${PROJECT_SOURCE_DIR}/cmake/libcamhal.pc.cmakein - ${PROJECT_SOURCE_DIR}/libcamhal.pc @ONLY) -install(FILES libcamhal.pc - DESTINATION usr/${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH}/pkgconfig) + # Install libraries + set(CAMHAL_TARGETS ${CAMHAL_TARGET} ${CAMHAL_STATIC_TARGET}) + if (BUILD_CAMHAL_PLUGIN) + set(CAMHAL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/libcamhal/plugins) + else() + set(CAMHAL_DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + if (${CMAKE_VERSION} VERSION_LESS 3.11) + install(TARGETS ${CAMHAL_TARGETS} + LIBRARY DESTINATION ${CAMHAL_DESTINATION} + ARCHIVE DESTINATION ${CAMHAL_DESTINATION}) + else() + install(TARGETS ${CAMHAL_TARGETS} DESTINATION ${CAMHAL_DESTINATION}) + endif() + if (NOT BUILD_CAMHAL_PLUGIN) + # Install package config file + configure_file(${PROJECT_SOURCE_DIR}/cmake/libcamhal.pc.cmakein + ${PROJECT_SOURCE_DIR}/libcamhal.pc @ONLY) + install(FILES libcamhal.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + endif() endif() #NOT CAL_BUILD +endforeach() #IPU_VERSIONS + set(CPACK_GENERATOR "RPM") include(CPack) diff --git a/README.md b/README.md index ab995692..41839eaa 100644 --- a/README.md +++ b/README.md @@ -16,27 +16,18 @@ There are 4 repositories that provide the complete setup: Please follow https://github.com/intel/ipu6-camera-bins README to install. - Dependencies: libexpat-dev automake libtool libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libdrm-dev - -- Build and install: - Recommend to build together with icamerasrc and using `build.sh` in this repo. -1. Put ipu6-camera-hal, icameasrc and build.sh parallel as below: - ``` - cp build.sh .. && cd .. - # work - # ├── build.sh - # ├── icamerasrc - # ├── ipu6-camera-hal - # └── out - ``` - -2. In `work` folder, run `./build.sh`. Output binaries will be in `out/install`. (RPM build is not implemented yet) - -3. Install contents in `out/install` to your `/usr`: - ```sh - sudo cp -r ./out/install/etc/* /etc/ - sudo cp -r ./out/install/include/* /usr/include/ - sudo cp -r ./out/install/lib/* /usr/lib/ - sudo cp -r ./out/install/usr/* /usr/ - ``` - -For more building details please reference the `build.sh`. \ No newline at end of file +```sh +# Please follow common cmake, make & make install flow +cd ipu6-camera-hal +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_CAMHAL_TESTS=OFF \ + -DBUILD_CAMHAL_ADAPTOR=ON \ + -DBUILD_CAMHAL_PLUGIN=ON \ + -DIPU_VERSIONS="ipu6;ipu6ep;ipu6epmtl" \ + -DUSE_PG_LITE_PIPE=ON \ + .. +make && sudo make install +``` \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index f6b27bae..00000000 --- a/build.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash - -function check_result() { - local res=$1 - local func=$2 - - if [ $res -eq 0 ] ; then - echo "###############" " $func OK " "#############" - else - echo "###############" " $func FAIL " "#############" - exit 1 - fi -} - -function parse_argument() { - export SOURCE_DIR=${PWD} - export INSTALL_DIR=${PWD}/out - export BOARD_LIST="ipu_tgl ipu_adl ipu_mtl" - export BUILD_RPM=ON - - while true; do - case $1 in - -s|--source) - export SOURCE_DIR=$2 - echo "$2" - shift - ;; - -i|--install) - export INSTALL_DIR=$2 - echo "$2" - shift - ;; - --no-rpm) - export BUILD_RPM=OFF - ;; - --board) - shift - export BOARD_LIST=$@ - echo "$$" - break - ;; - -?*) - echo "WARNING: not supported option: $1" - ;; - *) - break - esac - - shift - done - - echo "=========================== Build Config ============================" - echo "SOURCE_DIR: $SOURCE_DIR" - echo "INSTALL_DIR: $INSTALL_DIR" - echo "BUILD_RPM: $BUILD_RPM" - echo "BOARD_LIST: $BOARD_LIST" - echo "=====================================================================" -} - -function print_helper() { - echo - echo "========================= Command Helper ============================" - echo "./build_release.sh -s source_dir -i install_dir --board target1 targert2 ..." - echo "=====================================================================" - echo -} - -standardize_pkg_config_path(){ - if [[ ! -f $1 ]]; then echo "file $1 not exsist."; exit 0; fi - sed -i '1c prefix=\/usr' $* -} - -function build_target() { - rm -fr build && mkdir -p build && cd build - - local target=$1 - export IPU_VERSION= - if [ "$target" = "ipu_tgl" ]; then - IPU_VERSION=ipu6 - elif [ "$target" = "ipu_adl" ]; then - IPU_VERSION=ipu6ep - elif [ "$target" = "ipu_mtl" ]; then - IPU_VERSION=ipu6epmtl - else - echo "Error: unsupport the target name : $target" - exit -1 - fi - - # indicate the install folder of binary package - # export PKG_CONFIG_PATH=~/work/linux/camera_submit/camera/out/install/lib/$target/pkgconfig:$PKG_CONFIG_PATH - export PKG_CONFIG_PATH=/usr/lib/$target/pkgconfig:$PKG_CONFIG_PATH - - command cmake -DCMAKE_BUILD_TYPE=Release \ - -DIPU_VER=$IPU_VERSION \ - -DBUILD_CAMHAL_TESTS=OFF \ - -DUSE_PG_LITE_PIPE=ON \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/install \ - -DCMAKE_INSTALL_SUB_PATH=$target .. - - # make and install - make -j`nproc` - check_result $? "$FUNCNAME: $target" - - make install - check_result $? "$FUNCNAME: $target" - standardize_pkg_config_path ${INSTALL_DIR}/install/usr/lib/${target}/pkgconfig/libcamhal.pc - cd .. -} - -function build_hal() { - cd $SOURCE_DIR/ipu6-camera-hal - - for target in $BOARD_LIST - do - build_target $target - done -} - -function build_hal_adaptor() { - cd $SOURCE_DIR/ipu6-camera-hal/src/hal/hal_adaptor - rm -fr build && mkdir -p build && cd build - - command cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/install ../ - - # make and install - make -j - check_result $? $FUNCNAME - - make install - check_result $? $FUNCNAME - standardize_pkg_config_path ${INSTALL_DIR}/install/lib/pkgconfig/hal_adaptor.pc -} - -function build_icamerasrc() { - cd $SOURCE_DIR/icamerasrc/ - - export CAMHAL_LIBS="-L$INSTALL_DIR/install/lib -lhal_adaptor" - export CAMHAL_CFLAGS="-I$INSTALL_DIR/install/include/hal_adaptor \ - -I$INSTALL_DIR/install/include/hal_adaptor/api \ - -I$INSTALL_DIR/install/include/hal_adaptor/utils \ - -I$INSTALL_DIR/install/include/hal_adaptor/linux" - export CHROME_SLIM_CAMHAL=ON - export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH}" - - rm -fr config.h.in autom4te.cache/ aclocal.m4 *-libtool config.guess compile \ - config.sub configure depcomp install-sh ltmain.sh m4 - autoreconf --install - CFLAGS="-O2" CXXFLAGS="-O2" ./configure --with-haladaptor=yes ${CONFIGURE_FLAGS} \ - --prefix=$INSTALL_DIR/install DEFAULT_CAMERA=0 - check_result $? $FUNCNAME - - make clean - make -j - check_result $? $FUNCNAME - - make install - check_result $? $FUNCNAME - find $INSTALL_DIR/install/ -name "*.la" -exec rm -f "{}" \; - standardize_pkg_config_path ${INSTALL_DIR}/install/lib/pkgconfig/libgsticamerasrc.pc -} - -function main () { - parse_argument $@ - if [ -z "$SOURCE_DIR" ] || [ -z "$INSTALL_DIR" ] || [ -z "$BOARD_LIST" ]; then - print_helper - exit 1 - fi - rm -fr $INSTALL_DIR/install $INSTALL_DIR/rpm && mkdir -p $INSTALL_DIR/install $INSTALL_DIR/rpm - build_hal - build_hal_adaptor - build_icamerasrc - - # TODO: Generate the RPM for hal, hal_adaptor and icamerasrc together -} - -main $@ diff --git a/cmake/FindIA_IMAGING.cmake b/cmake/FindIA_IMAGING.cmake index 05afd78e..26cbce5e 100644 --- a/cmake/FindIA_IMAGING.cmake +++ b/cmake/FindIA_IMAGING.cmake @@ -23,76 +23,69 @@ endif() include(FindPackageHandleStandardArgs) find_package(PkgConfig) -pkg_check_modules(IA_IMAGING ia_imaging) -if(NOT IA_IMAGING_FOUND) - message(FATAL_ERROR "IA_IMAGING not found") +pkg_check_modules(IA_IMAGING${TARGET_SUFFIX} ia_imaging${TARGET_SUFFIX}) +if(NOT IA_IMAGING${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "IA_IMAGING${TARGET_SUFFIX} not found") endif() -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${IA_IMAGING_LIBRARY_DIRS}) +set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${IA_IMAGING${TARGET_SUFFIX}_LIBRARY_DIRS}) # Libraries -find_library(IA_CCA_LIB ia_cca) -find_library(IA_AIQ_LIB ia_aiq) -find_library(IA_AIQB_PARSER_LIB ia_aiqb_parser) -find_library(IA_CMC_PARSER_LIB ia_cmc_parser) -if (NOT ENABLE_SANDBOXING) -find_library(IA_LARD_LIB ia_lard) -endif() #ENABLE_SANDBOXING -find_library(IA_EXC_LIB ia_exc) -find_library(IA_MKN_LIB ia_mkn) +find_library(IA_CCA${TARGET_SUFFIX}_LIB ia_cca${TARGET_SUFFIX}) +find_library(IA_AIQ${TARGET_SUFFIX}_LIB ia_aiq${TARGET_SUFFIX}) +find_library(IA_AIQB_PARSER${TARGET_SUFFIX}_LIB ia_aiqb_parser${TARGET_SUFFIX}) +find_library(IA_CMC_PARSER${TARGET_SUFFIX}_LIB ia_cmc_parser${TARGET_SUFFIX}) +find_library(IA_EXC${TARGET_SUFFIX}_LIB ia_exc${TARGET_SUFFIX}) +find_library(IA_MKN${TARGET_SUFFIX}_LIB ia_mkn${TARGET_SUFFIX}) # SENSOR_EMD_DECODER -find_library(IA_EMD_LIB ia_emd_decoder) +find_library(IA_EMD${TARGET_SUFFIX}_LIB ia_emd_decoder${TARGET_SUFFIX}) # DOL_FEATURE_S -find_library(IA_BCOMP_LIB ia_bcomp) +find_library(IA_BCOMP${TARGET_SUFFIX}_LIB ia_bcomp${TARGET_SUFFIX}) # DOL_FEATURE_E -find_library(IA_NVM_LIB ia_nvm) -find_library(IA_LOG_LIB ia_log) -find_library(IA_DVS_LIB ia_dvs) -find_library(IA_COORDINATE_LIB ia_coordinate) -find_library(IA_LTM_LIB ia_ltm) -find_library(IA_DVS_LIB ia_dvs) -find_library(IA_ISP_BXT_LIB ia_isp_bxt) -find_library(BXT_IA_PAL_LIB broxton_ia_pal) -if (USE_PG_LITE_PIPE) -find_library(P2P_LIB_NAME ia_p2p_${IPU_VER}) -endif() +find_library(IA_NVM${TARGET_SUFFIX}_LIB ia_nvm${TARGET_SUFFIX}) +find_library(IA_LOG${TARGET_SUFFIX}_LIB ia_log${TARGET_SUFFIX}) +find_library(IA_DVS${TARGET_SUFFIX}_LIB ia_dvs${TARGET_SUFFIX}) +find_library(IA_COORDINATE${TARGET_SUFFIX}_LIB ia_coordinate${TARGET_SUFFIX}) +find_library(IA_LTM${TARGET_SUFFIX}_LIB ia_ltm${TARGET_SUFFIX}) +find_library(IA_DVS${TARGET_SUFFIX}_LIB ia_dvs${TARGET_SUFFIX}) +find_library(IA_ISP_BXT${TARGET_SUFFIX}_LIB ia_isp_bxt${TARGET_SUFFIX}) +find_library(BXT_IA_PAL${TARGET_SUFFIX}_LIB broxton_ia_pal${TARGET_SUFFIX}) -set(IA_IMAGING_LIBS - ${IA_CCA_LIB} - ${IA_AIQ_LIB} - ${IA_AIQB_PARSER_LIB} - ${IA_CMC_PARSER_LIB} - ${IA_EXC_LIB} - ${IA_MKN_LIB} - ${IA_EMD_LIB} - ${IA_BCOMP_LIB} - ${IA_NVM_LIB} - ${IA_LOG_LIB} - ${IA_DVS_LIB} - ${IA_COORDINATE_LIB} - ${IA_LTM_LIB} - ${IA_DVS_LIB} - ${IA_OB_LIB} +set(IA_IMAGING${TARGET_SUFFIX}_LIBS + ${IA_CCA${TARGET_SUFFIX}_LIB} + ${IA_AIQ${TARGET_SUFFIX}_LIB} + ${IA_AIQB_PARSER${TARGET_SUFFIX}_LIB} + ${IA_CMC_PARSER${TARGET_SUFFIX}_LIB} + ${IA_EXC${TARGET_SUFFIX}_LIB} + ${IA_MKN${TARGET_SUFFIX}_LIB} + ${IA_EMD${TARGET_SUFFIX}_LIB} + ${IA_BCOMP${TARGET_SUFFIX}_LIB} + ${IA_NVM${TARGET_SUFFIX}_LIB} + ${IA_LOG${TARGET_SUFFIX}_LIB} + ${IA_DVS${TARGET_SUFFIX}_LIB} + ${IA_COORDINATE${TARGET_SUFFIX}_LIB} + ${IA_LTM${TARGET_SUFFIX}_LIB} + ${IA_DVS${TARGET_SUFFIX}_LIB} + ${IA_OB${TARGET_SUFFIX}_LIB} + ${IA_ISP_BXT${TARGET_SUFFIX}_LIB} + ${BXT_IA_PAL${TARGET_SUFFIX}_LIB} ) if (NOT ENABLE_SANDBOXING) -set(IA_IMAGING_LIBS - ${IA_IMAGING_LIBS} - ${IA_LARD_LIB} - ) + find_library(IA_LARD${TARGET_SUFFIX}_LIB ia_lard${TARGET_SUFFIX}) + set(IA_IMAGING${TARGET_SUFFIX}_LIBS ${IA_IMAGING${TARGET_SUFFIX}_LIBS} ${IA_LARD${TARGET_SUFFIX}_LIB}) endif() #ENABLE_SANDBOXING if (USE_PG_LITE_PIPE) -set(IA_IMAGING_LIBS ${IA_IMAGING_LIBS} ${P2P_LIB_NAME}) + find_library(IA_P2P${TARGET_SUFFIX}_LIB ia_p2p${TARGET_SUFFIX}) + set(IA_IMAGING${TARGET_SUFFIX}_LIBS ${IA_IMAGING${TARGET_SUFFIX}_LIBS} ${IA_P2P${TARGET_SUFFIX}_LIB}) endif() -set(IA_IMAGING_LIBS ${IA_IMAGING_LIBS} ${IA_ISP_BXT_LIB} ${BXT_IA_PAL_LIB}) - # handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if # all listed variables are TRUE -find_package_handle_standard_args(IA_IMAGING - REQUIRED_VARS IA_IMAGING_INCLUDE_DIRS IA_IMAGING_LIBS) +find_package_handle_standard_args(IA_IMAGING${TARGET_SUFFIX} + REQUIRED_VARS IA_IMAGING${TARGET_SUFFIX}_INCLUDE_DIRS IA_IMAGING${TARGET_SUFFIX}_LIBS) -if(NOT IA_IMAGING_FOUND) - message(FATAL_ERROR "IA_IMAGING not found") +if(NOT IA_IMAGING${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "IA_IMAGING${TARGET_SUFFIX} not found") endif() diff --git a/cmake/FindLIBGCSS.cmake b/cmake/FindLIBGCSS.cmake index fd6770b9..dd0ff799 100644 --- a/cmake/FindLIBGCSS.cmake +++ b/cmake/FindLIBGCSS.cmake @@ -18,22 +18,22 @@ include(FindPackageHandleStandardArgs) find_package(PkgConfig) -pkg_check_modules(LIBGCSS libgcss) -if(NOT LIBGCSS_FOUND) - message(FATAL_ERROR "LIBGCSS not found") +pkg_check_modules(LIBGCSS${TARGET_SUFFIX} libgcss${TARGET_SUFFIX}) +if(NOT LIBGCSS${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "LIBGCSS${TARGET_SUFFIX} not found") endif() -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBGCSS_LIBRARY_DIRS}) +set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBGCSS${TARGET_SUFFIX}_LIBRARY_DIRS}) # Libraries -find_library(GCSS_LIB gcss) -set(LIBGCSS_LIBS ${GCSS_LIB}) +find_library(GCSS${TARGET_SUFFIX}_LIB gcss${TARGET_SUFFIX}) +set(LIBGCSS${TARGET_SUFFIX}_LIBS ${GCSS${TARGET_SUFFIX}_LIB}) # handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if # all listed variables are TRUE -find_package_handle_standard_args(LIBGCSS REQUIRED_VARS LIBGCSS_INCLUDE_DIRS LIBGCSS_LIBS) +find_package_handle_standard_args(LIBGCSS${TARGET_SUFFIX} REQUIRED_VARS LIBGCSS${TARGET_SUFFIX}_INCLUDE_DIRS LIBGCSS${TARGET_SUFFIX}_LIBS) -if(NOT LIBGCSS_FOUND) - message(FATAL_ERROR "LIBGCSS not found") +if(NOT LIBGCSS${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "LIBGCSS${TARGET_SUFFIX} not found") endif() diff --git a/cmake/FindLIBIPU.cmake b/cmake/FindLIBIPU.cmake index 44c26459..9f8d9fc6 100644 --- a/cmake/FindLIBIPU.cmake +++ b/cmake/FindLIBIPU.cmake @@ -15,8 +15,16 @@ # if (TARGET ${IPU_VER}) - message("libcamhal found lib${IPU_VER} target") - return() + if (NOT BUILD_CAMHAL_PLUGIN) + message("libcamhal found lib${IPU_VER} target") + return() + endif() +endif() + +if(NOT DEFINED IPU_VER) + set(libipu_ver libipu4) +else() + set(libipu_ver lib${IPU_VER}) endif() # Get include and lib paths for LIBIPU from pkgconfig @@ -24,28 +32,22 @@ include(FindPackageHandleStandardArgs) # Include directory find_package(PkgConfig) -if(NOT DEFINED IPU_VER) -set(libipu_ver libipu4) -else() -set(libipu_ver lib${IPU_VER}) -endif() -pkg_check_modules(LIBIPU ${libipu_ver}) -if(NOT LIBIPU_FOUND) - message(FATAL_ERROR "LIBIPU not found") +pkg_check_modules(LIBIPU${TARGET_SUFFIX} ${libipu_ver}) +if(NOT LIBIPU${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "LIBIPU${TARGET_SUFFIX} not found") endif() -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBIPU_LIBRARY_DIRS}) +set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBIPU${TARGET_SUFFIX}_LIBRARY_DIRS}) # Libraries -find_library(IPU_LIB NAMES ${libipu_ver}.a) - -set(LIBIPU_LIBS ${IPU_LIB}) +find_library(IPU${TARGET_SUFFIX}_LIB NAMES ${libipu_ver}.a) +set(LIBIPU${TARGET_SUFFIX}_LIBS ${IPU${TARGET_SUFFIX}_LIB}) # handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if # all listed variables are TRUE -find_package_handle_standard_args(LIBIPU - REQUIRED_VARS LIBIPU_INCLUDE_DIRS LIBIPU_LIBS) +find_package_handle_standard_args(LIBIPU${TARGET_SUFFIX} + REQUIRED_VARS LIBIPU${TARGET_SUFFIX}_INCLUDE_DIRS LIBIPU${TARGET_SUFFIX}_LIBS) -if(NOT LIBIPU_FOUND) - message(FATAL_ERROR "LIBIPU not found") +if(NOT LIBIPU${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "LIBIPU${TARGET_SUFFIX} not found") endif() diff --git a/cmake/libcamhal.pc.cmakein b/cmake/libcamhal.pc.cmakein index b63d711a..e08ab497 100644 --- a/cmake/libcamhal.pc.cmakein +++ b/cmake/libcamhal.pc.cmakein @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix}/@CMAKE_INSTALL_SUB_PATH@ -libdir=${prefix}/lib/@CMAKE_INSTALL_SUB_PATH@ -includedir=${prefix}/include/@CMAKE_INSTALL_SUB_PATH@/libcamhal +exec_prefix=${prefix} +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/include/libcamhal Name: libcamhal Description: Camera HAL Library diff --git a/config/linux/ipu6/gcss/graph_settings_hm11b1.xml b/config/linux/ipu6/gcss/graph_settings_hm11b1.xml index 289e0668..97063548 100644 --- a/config/linux/ipu6/gcss/graph_settings_hm11b1.xml +++ b/config/linux/ipu6/gcss/graph_settings_hm11b1.xml @@ -262,7 +262,7 @@ limitations under the License. - + @@ -1131,7 +1131,7 @@ limitations under the License. - + diff --git a/config/linux/ipu6/sensors/hm11b1-uf.xml b/config/linux/ipu6/sensors/hm11b1-uf.xml index a5a418b3..12d3038a 100644 --- a/config/linux/ipu6/sensors/hm11b1-uf.xml +++ b/config/linux/ipu6/sensors/hm11b1-uf.xml @@ -16,12 +16,12 @@ - + - - + + @@ -31,6 +31,17 @@ + + + + + + + + + + + @@ -63,7 +74,7 @@ - + diff --git a/config/linux/ipu6/sensors/imx390.xml b/config/linux/ipu6/sensors/imx390.xml index 4bd6dbb7..2afed977 100644 --- a/config/linux/ipu6/sensors/imx390.xml +++ b/config/linux/ipu6/sensors/imx390.xml @@ -109,6 +109,7 @@ + @@ -203,6 +204,7 @@ + @@ -297,6 +299,7 @@ + @@ -391,7 +394,388 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -487,7 +871,8 @@ - + + @@ -583,7 +968,8 @@ - + + @@ -679,7 +1065,8 @@ - + + @@ -775,6 +1162,395 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -836,6 +1612,7 @@ + diff --git a/config/linux/ipu6/sensors/isx031.xml b/config/linux/ipu6/sensors/isx031.xml new file mode 100644 index 00000000..f1ba28e3 --- /dev/null +++ b/config/linux/ipu6/sensors/isx031.xml @@ -0,0 +1,545 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6/sensors/ov01a1s-uf.xml b/config/linux/ipu6/sensors/ov01a1s-uf.xml index 77404a59..ebb22baa 100644 --- a/config/linux/ipu6/sensors/ov01a1s-uf.xml +++ b/config/linux/ipu6/sensors/ov01a1s-uf.xml @@ -33,6 +33,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/HM2170_1SG205N3_MB_ADL.aiqb b/config/linux/ipu6ep/HM2170_1SG205N3_MB_ADL.aiqb deleted file mode 100644 index f6cc9e5d..00000000 Binary files a/config/linux/ipu6ep/HM2170_1SG205N3_MB_ADL.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/HM2170_1SG205N3_OS_ADL.aiqb b/config/linux/ipu6ep/HM2170_1SG205N3_OS_ADL.aiqb deleted file mode 100644 index f6cc9e5d..00000000 Binary files a/config/linux/ipu6ep/HM2170_1SG205N3_OS_ADL.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/IMX390_HDR_TGL.aiqb b/config/linux/ipu6ep/IMX390_HDR_TGL.aiqb deleted file mode 100644 index 2df11318..00000000 Binary files a/config/linux/ipu6ep/IMX390_HDR_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/IMX390_HDR_TGL_2.aiqb b/config/linux/ipu6ep/IMX390_HDR_TGL_2.aiqb deleted file mode 100644 index 2df11318..00000000 Binary files a/config/linux/ipu6ep/IMX390_HDR_TGL_2.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/gcss/graph_settings_hm2170_1SG205N3_ADL.xml b/config/linux/ipu6ep/gcss/graph_settings_hm2170_1SG205N3_ADL.xml deleted file mode 100644 index c24aab0b..00000000 --- a/config/linux/ipu6ep/gcss/graph_settings_hm2170_1SG205N3_ADL.xml +++ /dev/null @@ -1,2507 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6ep/hi556.aiqb b/config/linux/ipu6ep/hi556.aiqb deleted file mode 100644 index fa457e46..00000000 Binary files a/config/linux/ipu6ep/hi556.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/libcamhal_profile.xml b/config/linux/ipu6ep/libcamhal_profile.xml index 3bc4ff67..f167d84f 100644 --- a/config/linux/ipu6ep/libcamhal_profile.xml +++ b/config/linux/ipu6ep/libcamhal_profile.xml @@ -21,6 +21,6 @@ + isx031,imx390,ar0234,external_source,ar0234_usb,lt6911uxc,lt6911uxe"/> diff --git a/config/linux/ipu6ep/sensors/hi556-uf.xml b/config/linux/ipu6ep/sensors/hi556-uf.xml index 648bb55a..338952cd 100644 --- a/config/linux/ipu6ep/sensors/hi556-uf.xml +++ b/config/linux/ipu6ep/sensors/hi556-uf.xml @@ -31,6 +31,17 @@ + + + + + + + + + + + @@ -266,6 +277,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/hm2170-uf.xml b/config/linux/ipu6ep/sensors/hm2170-uf.xml index d3337a69..4e72419d 100644 --- a/config/linux/ipu6ep/sensors/hm2170-uf.xml +++ b/config/linux/ipu6ep/sensors/hm2170-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + @@ -97,6 +108,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/imx390.xml b/config/linux/ipu6ep/sensors/imx390.xml index 133bfeab..2e104dfb 100644 --- a/config/linux/ipu6ep/sensors/imx390.xml +++ b/config/linux/ipu6ep/sensors/imx390.xml @@ -1,5 +1,5 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -633,7 +809,7 @@ - + @@ -723,7 +899,7 @@ - + @@ -813,7 +989,7 @@ - + @@ -903,7 +1079,7 @@ - + @@ -911,15 +1087,15 @@ - - + + - - + + - + @@ -930,15 +1106,15 @@ - - + + - - + + - + @@ -993,7 +1169,7 @@ - + @@ -1001,15 +1177,15 @@ - - + + - - + + - + @@ -1020,15 +1196,15 @@ - - + + - - + + - + @@ -1082,4 +1258,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/isx031.xml b/config/linux/ipu6ep/sensors/isx031.xml new file mode 100644 index 00000000..d7525f52 --- /dev/null +++ b/config/linux/ipu6ep/sensors/isx031.xml @@ -0,0 +1,545 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/linux/ipu6ep/sensors/ov01a10-uf.xml b/config/linux/ipu6ep/sensors/ov01a10-uf.xml index 84122f90..9691ad6e 100644 --- a/config/linux/ipu6ep/sensors/ov01a10-uf.xml +++ b/config/linux/ipu6ep/sensors/ov01a10-uf.xml @@ -33,6 +33,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/ov01a1s-uf.xml b/config/linux/ipu6ep/sensors/ov01a1s-uf.xml index 38918069..333db94a 100644 --- a/config/linux/ipu6ep/sensors/ov01a1s-uf.xml +++ b/config/linux/ipu6ep/sensors/ov01a1s-uf.xml @@ -33,6 +33,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/ov02c10-uf.xml b/config/linux/ipu6ep/sensors/ov02c10-uf.xml index bd7604f8..200cb19b 100644 --- a/config/linux/ipu6ep/sensors/ov02c10-uf.xml +++ b/config/linux/ipu6ep/sensors/ov02c10-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + @@ -96,6 +107,17 @@ + + + + + + + + + + + @@ -163,6 +185,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/ov08a10-uf.xml b/config/linux/ipu6ep/sensors/ov08a10-uf.xml index 3cd03672..f4a1727c 100644 --- a/config/linux/ipu6ep/sensors/ov08a10-uf.xml +++ b/config/linux/ipu6ep/sensors/ov08a10-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/ov13b10-uf.xml b/config/linux/ipu6ep/sensors/ov13b10-uf.xml index d638c487..13f579b3 100644 --- a/config/linux/ipu6ep/sensors/ov13b10-uf.xml +++ b/config/linux/ipu6ep/sensors/ov13b10-uf.xml @@ -31,7 +31,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/ov8856-uf.xml b/config/linux/ipu6ep/sensors/ov8856-uf.xml index c0aca646..92cc817c 100644 --- a/config/linux/ipu6ep/sensors/ov8856-uf.xml +++ b/config/linux/ipu6ep/sensors/ov8856-uf.xml @@ -31,6 +31,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6ep/sensors/ov8856-wf.xml b/config/linux/ipu6ep/sensors/ov8856-wf.xml index 65cc1c0e..7c636c31 100644 --- a/config/linux/ipu6ep/sensors/ov8856-wf.xml +++ b/config/linux/ipu6ep/sensors/ov8856-wf.xml @@ -31,6 +31,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/HM2170_1SG205N3_MB_ADL.aiqb b/config/linux/ipu6epmtl/HM2170_1SG205N3_MB_ADL.aiqb deleted file mode 100644 index f6cc9e5d..00000000 Binary files a/config/linux/ipu6epmtl/HM2170_1SG205N3_MB_ADL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/HM2170_1SG205N3_OS_ADL.aiqb b/config/linux/ipu6epmtl/HM2170_1SG205N3_OS_ADL.aiqb deleted file mode 100644 index f6cc9e5d..00000000 Binary files a/config/linux/ipu6epmtl/HM2170_1SG205N3_OS_ADL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX390_HDR_TGL.aiqb b/config/linux/ipu6epmtl/IMX390_HDR_TGL.aiqb deleted file mode 100644 index 2df11318..00000000 Binary files a/config/linux/ipu6epmtl/IMX390_HDR_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/gcss/graph_settings_hm2170_1SG205N3_ADL.xml b/config/linux/ipu6epmtl/gcss/graph_settings_hm2170_1SG205N3_ADL.xml deleted file mode 100644 index c24aab0b..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_settings_hm2170_1SG205N3_ADL.xml +++ /dev/null @@ -1,2507 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/gcss/graph_settings_ov01a10.xml b/config/linux/ipu6epmtl/gcss/graph_settings_ov01a10.xml deleted file mode 100644 index 9d71bb42..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_settings_ov01a10.xml +++ /dev/null @@ -1,1915 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/hi556.aiqb b/config/linux/ipu6epmtl/hi556.aiqb deleted file mode 100644 index fa457e46..00000000 Binary files a/config/linux/ipu6epmtl/hi556.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/libcamhal_profile.xml b/config/linux/ipu6epmtl/libcamhal_profile.xml index 27485312..e51ac861 100644 --- a/config/linux/ipu6epmtl/libcamhal_profile.xml +++ b/config/linux/ipu6epmtl/libcamhal_profile.xml @@ -1,5 +1,5 @@ - - + + + + + + + + + + + + + + + + + + - + + + + - + - diff --git a/config/linux/ipu6epmtl/sensors/ar0234-2.xml b/config/linux/ipu6epmtl/sensors/ar0234-2.xml new file mode 100644 index 00000000..2e329251 --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/ar0234-2.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ar0234.xml b/config/linux/ipu6epmtl/sensors/ar0234.xml deleted file mode 100644 index 756f8374..00000000 --- a/config/linux/ipu6epmtl/sensors/ar0234.xml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/hi556-uf.xml b/config/linux/ipu6epmtl/sensors/hi556-uf.xml index 648bb55a..338952cd 100644 --- a/config/linux/ipu6epmtl/sensors/hi556-uf.xml +++ b/config/linux/ipu6epmtl/sensors/hi556-uf.xml @@ -31,6 +31,17 @@ + + + + + + + + + + + @@ -266,6 +277,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/hm2170-uf.xml b/config/linux/ipu6epmtl/sensors/hm2170-uf.xml index d3337a69..4e72419d 100644 --- a/config/linux/ipu6epmtl/sensors/hm2170-uf.xml +++ b/config/linux/ipu6epmtl/sensors/hm2170-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + @@ -97,6 +108,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/hm2172-uf.xml b/config/linux/ipu6epmtl/sensors/hm2172-uf.xml index f21dfcf4..fb210c3b 100644 --- a/config/linux/ipu6epmtl/sensors/hm2172-uf.xml +++ b/config/linux/ipu6epmtl/sensors/hm2172-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390.xml b/config/linux/ipu6epmtl/sensors/imx390.xml index 45a4d01b..e400a2be 100644 --- a/config/linux/ipu6epmtl/sensors/imx390.xml +++ b/config/linux/ipu6epmtl/sensors/imx390.xml @@ -370,15 +370,15 @@ - - + + - - + + @@ -388,15 +388,15 @@ - - + + - - + + @@ -451,22 +451,22 @@ - + - - + + - - + + @@ -476,15 +476,15 @@ - - + + - - + + @@ -539,7 +539,7 @@ - + diff --git a/config/linux/ipu6epmtl/sensors/isx031.xml b/config/linux/ipu6epmtl/sensors/isx031.xml new file mode 100644 index 00000000..199ba441 --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/isx031.xml @@ -0,0 +1,545 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/lt6911uxe-1.xml b/config/linux/ipu6epmtl/sensors/lt6911uxe-1.xml new file mode 100644 index 00000000..7e9f28fd --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/lt6911uxe-1.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/lt6911uxe.xml b/config/linux/ipu6epmtl/sensors/lt6911uxe-2.xml similarity index 53% rename from config/linux/ipu6epmtl/sensors/lt6911uxe.xml rename to config/linux/ipu6epmtl/sensors/lt6911uxe-2.xml index d0ce0dfc..c8ec91b7 100644 --- a/config/linux/ipu6epmtl/sensors/lt6911uxe.xml +++ b/config/linux/ipu6epmtl/sensors/lt6911uxe-2.xml @@ -1,5 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - s - - - - - - - - - - - + @@ -176,6 +87,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -198,6 +209,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ov01a1s-uf.xml b/config/linux/ipu6epmtl/sensors/ov01a1s-uf.xml index 02de85e1..23d243c9 100644 --- a/config/linux/ipu6epmtl/sensors/ov01a1s-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov01a1s-uf.xml @@ -33,6 +33,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ov02c10-uf.xml b/config/linux/ipu6epmtl/sensors/ov02c10-uf.xml index 72a7703c..eb456069 100644 --- a/config/linux/ipu6epmtl/sensors/ov02c10-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov02c10-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + @@ -96,6 +107,17 @@ + + + + + + + + + + + @@ -163,6 +185,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ov02e10-uf.xml b/config/linux/ipu6epmtl/sensors/ov02e10-uf.xml index 1e1784a3..6a5be509 100644 --- a/config/linux/ipu6epmtl/sensors/ov02e10-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov02e10-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ov05c10-uf.xml b/config/linux/ipu6epmtl/sensors/ov05c10-uf.xml index e78611b2..9cefa580 100644 --- a/config/linux/ipu6epmtl/sensors/ov05c10-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov05c10-uf.xml @@ -29,6 +29,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ov08x40-uf.xml b/config/linux/ipu6epmtl/sensors/ov08x40-uf.xml index 77cdf649..51b9d320 100644 --- a/config/linux/ipu6epmtl/sensors/ov08x40-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov08x40-uf.xml @@ -26,6 +26,17 @@ + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/ov13b10-uf.xml b/config/linux/ipu6epmtl/sensors/ov13b10-uf.xml index a5187a7c..8d7cbf11 100644 --- a/config/linux/ipu6epmtl/sensors/ov13b10-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov13b10-uf.xml @@ -59,6 +59,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/config/linux/ipu6epmtl/sensors/ov13b10-wf.xml b/config/linux/ipu6epmtl/sensors/ov13b10-wf.xml index 4a632390..4fc52108 100644 --- a/config/linux/ipu6epmtl/sensors/ov13b10-wf.xml +++ b/config/linux/ipu6epmtl/sensors/ov13b10-wf.xml @@ -59,6 +59,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/config/linux/ipu6epmtl_upstream/gcss/graph_descriptor.xml b/config/linux/ipu6epmtl_upstream/gcss/graph_descriptor.xml deleted file mode 100644 index 5108edd4..00000000 --- a/config/linux/ipu6epmtl_upstream/gcss/graph_descriptor.xml +++ /dev/null @@ -1,15238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/config/linux/ipu6epmtl_upstream/gcss/graph_settings_OV13B10_09B13_DPC_T3_MTL.xml b/config/linux/ipu6epmtl_upstream/gcss/graph_settings_OV13B10_09B13_DPC_T3_MTL.xml deleted file mode 100644 index a1de3c8f..00000000 --- a/config/linux/ipu6epmtl_upstream/gcss/graph_settings_OV13B10_09B13_DPC_T3_MTL.xml +++ /dev/null @@ -1,18602 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/gcss/graph_settings_ar0234.xml b/config/linux/ipu6epmtl_upstream/gcss/graph_settings_ar0234.xml deleted file mode 100644 index 902a4ef8..00000000 --- a/config/linux/ipu6epmtl_upstream/gcss/graph_settings_ar0234.xml +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/libcamhal_profile.xml b/config/linux/ipu6epmtl_upstream/libcamhal_profile.xml deleted file mode 100644 index b3b0b6fc..00000000 --- a/config/linux/ipu6epmtl_upstream/libcamhal_profile.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/psys_policy_profiles.xml b/config/linux/ipu6epmtl_upstream/psys_policy_profiles.xml deleted file mode 100644 index 8091bfe2..00000000 --- a/config/linux/ipu6epmtl_upstream/psys_policy_profiles.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/sensors/lt6911uxe.xml b/config/linux/ipu6epmtl_upstream/sensors/lt6911uxe.xml deleted file mode 100644 index 9f18bee6..00000000 --- a/config/linux/ipu6epmtl_upstream/sensors/lt6911uxe.xml +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/sensors/ov13b10-uf.xml b/config/linux/ipu6epmtl_upstream/sensors/ov13b10-uf.xml deleted file mode 100644 index 1fcb4c31..00000000 --- a/config/linux/ipu6epmtl_upstream/sensors/ov13b10-uf.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/sensors/ov13b10-wf.xml b/config/linux/ipu6epmtl_upstream/sensors/ov13b10-wf.xml deleted file mode 100644 index 6b73665e..00000000 --- a/config/linux/ipu6epmtl_upstream/sensors/ov13b10-wf.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl_upstream/tunning_profiles.xml b/config/linux/ipu6epmtl_upstream/tunning_profiles.xml deleted file mode 100644 index f1bc2c1f..00000000 --- a/config/linux/ipu6epmtl_upstream/tunning_profiles.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - diff --git a/include/api/Parameters.h b/include/api/Parameters.h index 37b1b11f..c696d064 100644 --- a/include/api/Parameters.h +++ b/include/api/Parameters.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project - * Copyright (C) 2015-2023 Intel Corporation. + * Copyright (C) 2015-2024 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,6 +94,7 @@ typedef struct { } vc_info_t; // VIRTUAL_CHANNEL_E +// IPU7_FEATURE_S /** * \struct device_info_t: Define each camera basic information */ @@ -104,6 +105,7 @@ typedef struct { const char* name; /**< Sensor name */ const char* description; /**< Sensor description */ } device_info_t; +// IPU7_FEATURE_E /** * Basic definition will be inherited by more complicated structure. @@ -277,7 +279,7 @@ typedef struct { properties */ uint64_t timestamp; /**< buffer timestamp, it's a time reference measured in nanosecond */ uint32_t frameNumber; /**< buffer frameNumber, it's an id of buffer */ - void *priv; /**< used to pass private data */ + uint64_t privateHandle; /**< used to pass private data */ uint64_t reserved; /**< reserved for future */ } camera_buffer_t; @@ -1089,11 +1091,13 @@ typedef enum { LENS_SHADING_MAP_MODE_ON } camera_lens_shading_map_mode_type_t; +// IPU7_FEATURE_S typedef enum { CAMERA_STATISTICS_FACE_DETECT_MODE_OFF, CAMERA_STATISTICS_FACE_DETECT_MODE_SIMPLE, CAMERA_STATISTICS_FACE_DETECT_MODE_FULL, } camera_statistics_face_detect_mode_t; +// IPU7_FEATURE_E typedef enum { ROTATE_NONE, diff --git a/modules/algowrapper/IntelEvcp.cpp b/modules/algowrapper/IntelEvcp.cpp deleted file mode 100644 index bcc3d5f2..00000000 --- a/modules/algowrapper/IntelEvcp.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelEvcp - -#include "modules/algowrapper/IntelEvcp.h" - -#include - -#include - -#include "igfxcmrt/cm_rt.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { -IntelEvcp::IntelEvcp() : mWidth(0), mHeight(0) {} - -int IntelEvcp::init(int width, int height) { - mWidth = width; - mHeight = height; - mEvcpDLL = std::unique_ptr(new UltraManEvcp(width, height)); - - return mEvcpDLL->init() ? OK : UNKNOWN_ERROR; -} - -bool IntelEvcp::runEvcpFrame(void* inBufAddr, int size) { - auto flushCacheBlock = [](void* start, size_t sz) { - const int CACHE_LINE_SIZE_FOR_ADL = 64; - const int CACHE_LINE_MASK_FOR_ADL = CACHE_LINE_SIZE_FOR_ADL - 1; - - char* p = - reinterpret_cast(reinterpret_cast(start) & ~CACHE_LINE_MASK_FOR_ADL); - char* end = reinterpret_cast(start) + sz; - - asm volatile("mfence" ::: "memory"); - while (p < end) { - asm volatile("clflush (%0)" ::"r"(p)); - p += CACHE_LINE_SIZE_FOR_ADL; - } - asm volatile("mfence" ::: "memory"); - return true; - }; - - return runEvcpFrameNoncopy(inBufAddr) && flushCacheBlock(inBufAddr, size); -} - -bool IntelEvcp::runEvcpFrameNoncopy(void* inBufAddr) { - CmSurface2DUP* inSurface = createCMSurface(reinterpret_cast(inBufAddr)); - - bool r = mEvcpDLL->processFrame(inSurface); - - return destroyCMSurface(inSurface) && r; -} - -CmSurface2DUP* IntelEvcp::createCMSurface(void* bufAddr) { - CmSurface2DUP* cmSurface = nullptr; - - mEvcpDLL->createCMSurface2DUP(mWidth, mHeight, CM_SURFACE_FORMAT_NV12, bufAddr, cmSurface); - - return cmSurface; -} - -bool IntelEvcp::destroyCMSurface(CmSurface2DUP* surface) { - return mEvcpDLL->destroyCMSurface2DUP(surface); -} - -bool IntelEvcp::updateEvcpParam(const EvcpParam* evcpParam) { - return mEvcpDLL->updateEvcpInfo(evcpParam); -} - -void IntelEvcp::getEvcpParam(EvcpParam* evcpParam) const { - evcpParam->evcpEccEnabled = mEvcpDLL->isEccEnabled(); - evcpParam->evcpBdEnabled = mEvcpDLL->isDimmerEnabled(); - evcpParam->evcpEnableTurbo = mEvcpDLL->isTurboOn(); - evcpParam->evcpPowerSave = mEvcpDLL->isLowPowerMode(); - evcpParam->evcpBGConcealment = mEvcpDLL->isBGConcelment(); - evcpParam->evcpBGReplacement = mEvcpDLL->isBGReplacement(); - evcpParam->evcpFaceBea = mEvcpDLL->isFaceBeaEnable(); - evcpParam->evcpFaceFra = mEvcpDLL->isFaceFraEnable(); -} - -} // namespace icamera diff --git a/modules/algowrapper/IntelEvcp.h b/modules/algowrapper/IntelEvcp.h deleted file mode 100644 index 66d39a62..00000000 --- a/modules/algowrapper/IntelEvcp.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wbitfield-constant-conversion" -#pragma clang diagnostic ignored "-Wunused-private-field" -// HANDLE is redefined in cm_rt.h, avoid the redefinition build error -#define HANDLE cancel_fw_pre_define -#include "igfxcmrt/cm_rt.h" -#pragma clang diagnostic pop - -#include "PlatformData.h" -#include "evcp/UltraManEvcp.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" -#include "src/evcp/EvcpCommon.h" - -namespace icamera { - -class IntelEvcp { - public: - IntelEvcp(); - ~IntelEvcp() {} - int init(int width, int height); - - bool runEvcpFrame(void* inBufAddr, int size); - bool updateEvcpParam(const EvcpParam* evcpParam); - void getEvcpParam(EvcpParam* evcpParam) const; // caller to ensure not nullptr - - private: - bool runEvcpFrameNoncopy(void* inBufAddr); - - CmSurface2DUP* createCMSurface(void* bufAddr); - bool destroyCMSurface(CmSurface2DUP* surface); - - private: - int mWidth; - int mHeight; - - std::unique_ptr mEvcpDLL; - - DISALLOW_COPY_AND_ASSIGN(IntelEvcp); -}; - -} // namespace icamera diff --git a/modules/ia_css/ipu6ep/include/ia_css_psys_process_group_impl.h b/modules/ia_css/ipu6ep/include/ia_css_psys_process_group_impl.h index 614eaad3..6a515cc4 100644 --- a/modules/ia_css/ipu6ep/include/ia_css_psys_process_group_impl.h +++ b/modules/ia_css/ipu6ep/include/ia_css_psys_process_group_impl.h @@ -535,6 +535,7 @@ int ia_css_process_group_print( ia_css_rbm_t routing_bitmap; NOT_USED(fid); + NOT_USED(routing_bitmap); IA_CSS_TRACE_0(PSYSAPI_DYNAMIC, VERBOSE, "ia_css_process_group_print(): enter:\n"); @@ -689,6 +690,7 @@ bool ia_css_can_process_group_submit( int i; bool can_submit = false; int retval = -1; + NOT_USED(retval); uint8_t terminal_count = ia_css_process_group_get_terminal_count(process_group); @@ -701,6 +703,7 @@ bool ia_css_can_process_group_submit( ia_css_terminal_t *terminal = ia_css_process_group_get_terminal(process_group, i); vied_vaddress_t buffer; + NOT_USED(buffer); ia_css_buffer_state_t buffer_state; verifexitval(terminal != NULL, EINVAL); @@ -772,6 +775,7 @@ bool ia_css_can_enqueue_buffer_set( int i; bool can_enqueue = false; int retval = -1; + NOT_USED(retval); uint8_t terminal_count; IA_CSS_TRACE_0(PSYSAPI_DYNAMIC, INFO, @@ -795,6 +799,7 @@ bool ia_css_can_enqueue_buffer_set( ia_css_terminal_t *terminal = ia_css_process_group_get_terminal(process_group, i); vied_vaddress_t buffer; + NOT_USED(buffer); ia_css_buffer_state_t buffer_state; verifexitval(terminal != NULL, EINVAL); @@ -854,6 +859,7 @@ bool ia_css_can_process_group_start( int i; bool can_start = false; int retval = -1; + NOT_USED(retval); uint8_t terminal_count; IA_CSS_TRACE_0(PSYSAPI_DYNAMIC, INFO, diff --git a/modules/ia_css/ipu6se/include/ia_css_psys_process_group_impl.h b/modules/ia_css/ipu6se/include/ia_css_psys_process_group_impl.h index 5e074b71..fa76827c 100644 --- a/modules/ia_css/ipu6se/include/ia_css_psys_process_group_impl.h +++ b/modules/ia_css/ipu6se/include/ia_css_psys_process_group_impl.h @@ -535,6 +535,7 @@ int ia_css_process_group_print( ia_css_rbm_t routing_bitmap; NOT_USED(fid); + NOT_USED(routing_bitmap); IA_CSS_TRACE_0(PSYSAPI_DYNAMIC, VERBOSE, "ia_css_process_group_print(): enter:\n"); @@ -701,6 +702,7 @@ bool ia_css_can_process_group_submit( ia_css_terminal_t *terminal = ia_css_process_group_get_terminal(process_group, i); vied_vaddress_t buffer; + NOT_USED(buffer); ia_css_buffer_state_t buffer_state; verifexitval(terminal != NULL, EINVAL); @@ -795,6 +797,7 @@ bool ia_css_can_enqueue_buffer_set( ia_css_terminal_t *terminal = ia_css_process_group_get_terminal(process_group, i); vied_vaddress_t buffer; + NOT_USED(buffer); ia_css_buffer_state_t buffer_state; verifexitval(terminal != NULL, EINVAL); diff --git a/modules/sandboxing/CMakeLists.txt b/modules/sandboxing/CMakeLists.txt deleted file mode 100644 index 4a03d27b..00000000 --- a/modules/sandboxing/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (C) 2019 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -add_subdirectory(client) - -#--------------------------- build libcam_algo.so --------------------------- -add_subdirectory(server) diff --git a/modules/sandboxing/IPCCommon.cpp b/modules/sandboxing/IPCCommon.cpp deleted file mode 100644 index 59447a70..00000000 --- a/modules/sandboxing/IPCCommon.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "modules/sandboxing/IPCCommon.h" - -#include -#include - -namespace icamera { -const char* IntelAlgoIpcCmdToString(IPC_CMD cmd) { - static const char* gIpcCmdMapping[] = { - "IPC_FD_INIT", "IPC_FD_RUN", "IPC_FD_DEINIT", "IPC_GRAPH_ADD_KEY", "IPC_GRAPH_PARSE", - "IPC_GRAPH_RELEASE_NODES", "IPC_GRAPH_QUERY_GRAPH_SETTINGS", "IPC_GRAPH_CONFIG_STREAMS", - "IPC_GRAPH_GET_CONFIG_DATA", "IPC_GRAPH_GET_CONNECTION", "IPC_GRAPH_GET_PG_ID", - "IPC_CCA_CONSTRUCT", "IPC_CCA_DESTRUCT", "IPC_CCA_INIT", - "IPC_CCA_RUN_AEC", "IPC_CCA_RUN_AIQ", "IPC_CCA_RUN_LTM", "IPC_CCA_UPDATE_ZOOM", - "IPC_CCA_RUN_DVS", "IPC_CCA_GET_CMC", "IPC_CCA_GET_AIQD", - "IPC_CCA_UPDATE_TUNING", "IPC_CCA_DEINIT", "IPC_CCA_RUN_AIC", "IPC_CCA_GET_PAL_SIZE", - "IPC_PG_PARAM_INIT", "IPC_PG_PARAM_PREPARE", - "IPC_PG_PARAM_ALLOCATE_PG", "IPC_PG_PARAM_GET_FRAG_DESCS", "IPC_PG_PARAM_PREPARE_PROGRAM", - "IPC_PG_PARAM_REGISTER_PAYLOADS", "IPC_PG_PARAM_ENCODE", "IPC_PG_PARAM_DECODE", - "IPC_PG_PARAM_DEINIT", "IPC_GPU_TNR_INIT", "IPC_GPU_TNR_GET_SURFACE_INFO", - "IPC_GPU_TNR_PREPARE_SURFACE", "IPC_GPU_TNR_RUN_FRAME", "IPC_GPU_TNR_PARAM_UPDATE", - "IPC_GPU_TNR_DEINIT", - // LEVEL0_ICBM_S - "IPC_ICBM_INIT", "IPC_ICBM_RUN_FRAME", "IPC_ICBM_DEINIT", - // LEVEL0_ICBM_E - "IPC_GPU_TNR_THREAD2_RUN_FRAME", - "IPC_GPU_TNR_THREAD2_PARAM_UPDATE"}; - - unsigned int num = sizeof(gIpcCmdMapping) / sizeof(gIpcCmdMapping[0]); - return cmd < num ? gIpcCmdMapping[cmd] : gIpcCmdMapping[0]; -} - -IPC_GROUP IntelAlgoIpcCmdToGroup(IPC_CMD cmd) { - IPC_GROUP group = IPC_GROUP_CPU_OTHER; - if (cmd >= IPC_CCA_CONSTRUCT && cmd <= IPC_CCA_DEINIT) { - group = IPC_GROUP_AIQ; - } else if (cmd >= IPC_CCA_RUN_AIC && cmd <= IPC_CCA_GET_PAL_SIZE) { - group = IPC_GROUP_PAL; - } else if (cmd >= IPC_PG_PARAM_INIT && cmd <= IPC_PG_PARAM_DEINIT) { - group = IPC_GROUP_PSYS; - } else if (cmd >= IPC_FD_INIT && cmd <= IPC_FD_DEINIT) { - group = IPC_GROUP_FD; - } else if (cmd >= IPC_GPU_TNR_INIT && cmd <= IPC_GPU_TNR_DEINIT) { - group = IPC_GROUP_GPU; - } else if (cmd >= IPC_GPU_TNR_THREAD2_RUN_FRAME && cmd <= IPC_GPU_TNR_THREAD2_PARAM_UPDATE) { - group = IPC_GROUP_GPU_THREAD2; - // LEVEL0_ICBM_S - } else if (cmd >= IPC_ICBM_INIT && cmd <= IPC_ICBM_DEINIT) { - group = IPC_GROUP_GPU_ICBM; - // LEVEL0_ICBM_E - } else { - group = IPC_GROUP_CPU_OTHER; - } - - return group; -} - -const char* IntelAlgoServerThreadName(int index) { - int count = 0; -#ifndef GPU_ALGO_SERVER - static const char* gIpcCmdMapping[IPC_CPU_GROUP_NUM] = { - "AiqCPUAlgoServer", "PalCPUAlgoServer", "PsysCPUAlgoServer", - "FdCPUAlgoServer", "OtherCPUAlgoServer"}; - count = IPC_CPU_GROUP_NUM; -#else - static const char* gIpcCmdMapping[IPC_GPU_GROUP_NUM] = {"GPUAlgoServer", - // LEVEL0_ICBM_S - "GPUICBMServer", - // LEVEL0_ICBM_E - "GPUAlgoServer2"}; - count = IPC_GPU_GROUP_NUM; -#endif - - return index < count ? gIpcCmdMapping[index] : "unknown"; -} -} /* namespace icamera */ diff --git a/modules/sandboxing/IPCCommon.h b/modules/sandboxing/IPCCommon.h deleted file mode 100644 index 4c73ad3b..00000000 --- a/modules/sandboxing/IPCCommon.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -#include "iutils/Errors.h" - -namespace icamera { -#define IPC_MATCHING_KEY 0x56 // the value is randomly chosen -#define IPC_REQUEST_HEADER_USED_NUM 1 -#define SHM_NAME "shm" - -enum IPC_CMD { - // CPU IPC COMMANDS - IPC_FD_INIT, - IPC_FD_RUN, - IPC_FD_DEINIT, - IPC_GRAPH_ADD_KEY, - IPC_GRAPH_PARSE, - IPC_GRAPH_RELEASE_NODES, - IPC_GRAPH_QUERY_GRAPH_SETTINGS, - IPC_GRAPH_CONFIG_STREAMS, - IPC_GRAPH_GET_CONFIG_DATA, - IPC_GRAPH_GET_CONNECTION, - IPC_GRAPH_GET_PG_ID, - IPC_CCA_CONSTRUCT, - IPC_CCA_DESTRUCT, - IPC_CCA_INIT, - IPC_CCA_RUN_AEC, - IPC_CCA_RUN_AIQ, - IPC_CCA_RUN_LTM, - IPC_CCA_UPDATE_ZOOM, - IPC_CCA_RUN_DVS, - IPC_CCA_GET_CMC, - IPC_CCA_GET_AIQD, - IPC_CCA_UPDATE_TUNING, - IPC_CCA_DEINIT, - IPC_CCA_RUN_AIC, - IPC_CCA_GET_PAL_SIZE, - IPC_PG_PARAM_INIT, - IPC_PG_PARAM_PREPARE, - IPC_PG_PARAM_ALLOCATE_PG, - IPC_PG_PARAM_GET_FRAG_DESCS, - IPC_PG_PARAM_PREPARE_PROGRAM, - IPC_PG_PARAM_REGISTER_PAYLOADS, - IPC_PG_PARAM_ENCODE, - IPC_PG_PARAM_DECODE, - IPC_PG_PARAM_DEINIT, - // GPU IPC COMMANDS - IPC_GPU_TNR_INIT, - IPC_GPU_TNR_GET_SURFACE_INFO, - IPC_GPU_TNR_PREPARE_SURFACE, - IPC_GPU_TNR_RUN_FRAME, - IPC_GPU_TNR_PARAM_UPDATE, - IPC_GPU_TNR_DEINIT, - // LEVEL0_ICBM_S - IPC_ICBM_INIT, - IPC_ICBM_RUN_FRAME, - IPC_ICBM_DEINIT, - // LEVEL0_ICBM_E - IPC_GPU_TNR_THREAD2_RUN_FRAME, - IPC_GPU_TNR_THREAD2_PARAM_UPDATE, -}; - -#define MAX_IA_BINARY_DATA_SIZE 800000 -struct ia_binary_data_mod { - unsigned int size; - char data[MAX_IA_BINARY_DATA_SIZE]; -}; - -const char* IntelAlgoIpcCmdToString(IPC_CMD cmd); - -enum IPC_GROUP { - // IPC command group for cpu - IPC_GROUP_AIQ, - IPC_GROUP_PAL, - IPC_GROUP_PSYS, - IPC_GROUP_FD, - IPC_GROUP_CPU_OTHER, - // IPU command group for gpu - IPC_GROUP_GPU, - // LEVEL0_ICBM_S - IPC_GROUP_GPU_ICBM, - // LEVEL0_ICBM_E - IPC_GROUP_GPU_THREAD2, -}; -#define IPC_GROUP_NUM (IPC_GROUP_GPU_THREAD2 + 1) -#define IPC_CPU_GROUP_NUM (IPC_GROUP_CPU_OTHER + 1) -#define IPC_GPU_GROUP_NUM (IPC_GROUP_GPU_THREAD2 - IPC_GROUP_GPU + 1) - -IPC_GROUP IntelAlgoIpcCmdToGroup(IPC_CMD cmd); -const char* IntelAlgoServerThreadName(int index); -} /* namespace icamera */ diff --git a/modules/sandboxing/IPCGraphConfig.cpp b/modules/sandboxing/IPCGraphConfig.cpp deleted file mode 100644 index b929f9cc..00000000 --- a/modules/sandboxing/IPCGraphConfig.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (C) 2019-2022 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IPC_GRAPH_CONFIG - -#include "modules/sandboxing/IPCGraphConfig.h" - -#include - -#include - -#include "iutils/CameraLog.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" - -namespace icamera { - -status_t IPCGraphConfig::readDataFromXml(const char* fileName, char* dataPtr, size_t* dataSize, - int maxSize) { - CheckAndLogError(!dataSize || !fileName || !dataPtr, UNKNOWN_ERROR, - "%s, Wrong parameters, dataSize: %p, fileName: %p, dataPtr: %p", __func__, - dataSize, fileName, dataPtr); - - struct stat statBuf; - int ret = stat(fileName, &statBuf); - CheckAndLogError((ret != 0), UNKNOWN_ERROR, "Failed to query the size of file: %s!", fileName); - CheckAndLogError(statBuf.st_size > maxSize, BAD_VALUE, - "The memory size: %d less than file size: %d", maxSize, statBuf.st_size); - - *dataSize = static_cast(statBuf.st_size); - LOG1("%s, fileName: %s, size: %zu", __func__, fileName, *dataSize); - - FILE* file = fopen(fileName, "rb"); - CheckAndLogError(!file, NAME_NOT_FOUND, "%s, Failed to open file: %s", __func__, fileName); - - size_t len = fread(dataPtr, 1, *dataSize, file); - fclose(file); - - CheckAndLogError((len != *dataSize), UNKNOWN_ERROR, "%s, Failed to read data from file: %s", - __func__, fileName); - - return OK; -} - -bool IPCGraphConfig::clientFlattenParse(void* pData, uint32_t size, int cameraId, - const char* graphDescFile, const char* settingsFile) { - CheckAndLogError(!pData || !graphDescFile || !settingsFile || size < sizeof(GraphParseParams), - false, "@%s, wrong parameters, pData: %p, GD: %p, settings: %p, size: %u", - __func__, pData, graphDescFile, settingsFile, size); - - GraphParseParams* params = static_cast(pData); - CLEAR(*params); - - params->cameraId = cameraId; - int ret = - readDataFromXml(graphDescFile, params->GD, &(params->gdSize), MAX_GRAPH_DESCRIPTOR_SIZE); - CheckAndLogError(ret != OK, false, "Failed to read the graph descriptor file: %s", - graphDescFile); - - ret = readDataFromXml(settingsFile, params->GS, &(params->gsSize), MAX_GRAPH_SETTINGS_SIZE); - CheckAndLogError(ret != OK, false, "Failed to read the graph settings file: %s", settingsFile); - - return true; -} - -bool IPCGraphConfig::serverUnflattenParse(void* pData, uint32_t size, - GraphParseParams** parseParam) { - CheckAndLogError(!pData || !parseParam || size < sizeof(GraphParseParams), false, - "@%s, Wrong parameters, pData: %p, parseParam: %p, size: %u", __func__, pData, - parseParam, size); - - GraphParseParams* params = static_cast(pData); - *parseParam = params; - - return true; -} - -bool IPCGraphConfig::clientFlattenConfigStreams(void* pData, uint32_t size, GraphBaseInfo info, - GraphSettingType type, bool dummyStillSink, - const std::vector& streams) { - LOG1("@%s, pData: %p, configMode: %d, dummyStillSink: %d", info.cameraId, __func__, pData, - info.configMode, dummyStillSink); - - CheckAndLogError(!pData || size < sizeof(GraphConfigStreamParams) || streams.empty(), false, - "@%s, Wrong parameters, pData: %p, size: %u, streams count: %d", __func__, - pData, size, streams.size()); - - GraphConfigStreamParams* params = static_cast(pData); - CLEAR(*params); - - params->baseInfo = info; - params->type = type; - for (size_t i = 0; i < streams.size(); ++i) { - params->streamCfg[i] = *(streams[i]); - params->streamPriv[i] = *(static_cast(streams[i]->mPrivate)); - params->streamNum++; - } - params->dummyStillSink = dummyStillSink; - return true; -} - -bool IPCGraphConfig::serverUnflattenConfigStreams(void* pData, uint32_t size, GraphBaseInfo* info, - GraphSettingType* type, bool* dummyStillSink, - std::vector* streams) { - CheckAndLogError(!pData || size < sizeof(GraphConfigStreamParams) || !info || !type || - !streams || !dummyStillSink, - false, - "@%s, Wrong parameters, pData: %p, size: %u, info: %p, type: %p, streams: %p, " - "dummyStillSink: %p", - __func__, pData, size, info, type, streams, dummyStillSink); - - GraphConfigStreamParams* params = static_cast(pData); - - *info = params->baseInfo; - *type = params->type; - *dummyStillSink = params->dummyStillSink; - for (uint32_t i = 0; i < params->streamNum; ++i) { - params->streamCfg[i].mPrivate = static_cast(&(params->streamPriv[i])); - streams->push_back(&(params->streamCfg[i])); - } - - return true; -} - -bool IPCGraphConfig::clientFlattenGetGraphData(void* pData, uint32_t size, GraphBaseInfo info) { - CheckAndLogError(!pData || size < sizeof(GraphGetDataParams), false, - "@%s, Wrong parameters, pData: %p, size: %u", __func__, pData, size); - - GraphGetDataParams* params = static_cast(pData); - CLEAR(*params); - - params->baseInfo = info; - - return true; -} - -bool IPCGraphConfig::serverUnflattenGetGraphData(void* pData, uint32_t size, GraphBaseInfo* info) { - CheckAndLogError(!pData || !info || size < sizeof(GraphGetDataParams), false, - "@%s, Wrong parameters, pData: %p, info: %p, size: %u", __func__, pData, info, - size); - - GraphGetDataParams* params = static_cast(pData); - *info = params->baseInfo; - - return true; -} - -bool IPCGraphConfig::serverFlattenGetGraphData(void* pData, uint32_t size, - IGraphType::GraphConfigData graphData) { - CheckAndLogError(!pData || size < sizeof(GraphGetDataParams), false, - "@%s, Wrong parameters, pData: %p, size: %u", __func__, pData, size); - - GraphGetDataParams* params = static_cast(pData); - - params->mcId = graphData.mcId; - params->graphId = graphData.graphId; - - params->csiReso = graphData.csiReso; - - LOG1("@%s, mcId: %d, graphId: %d", __func__, params->mcId, params->graphId); - - params->gdcInfoNum = graphData.gdcInfos.size(); - for (size_t i = 0; i < graphData.gdcInfos.size(); ++i) { - params->mGdcInfo[i] = graphData.gdcInfos[i]; - } - - params->streamIdNum = graphData.streamIds.size(); - for (size_t i = 0; i < graphData.streamIds.size(); ++i) { - params->streamIdData[i] = graphData.streamIds[i]; - } - - params->tuningModeNum = graphData.tuningModes.size(); - for (size_t i = 0; i < graphData.tuningModes.size(); ++i) { - params->tuningModes[i] = graphData.tuningModes[i]; - } - - params->pgInfoNum = graphData.pgInfo.size(); - for (size_t i = 0; i < graphData.pgInfo.size(); ++i) { - size_t len = graphData.pgInfo[i].pgName.copy(params->pgInfoData[i].pgName, MAX_NAME_LENGTH); - params->pgInfoData[i].pgName[len] = '\0'; - params->pgInfoData[i].pgId = graphData.pgInfo[i].pgId; - params->pgInfoData[i].streamId = graphData.pgInfo[i].streamId; - params->pgInfoData[i].rbmByte = graphData.pgInfo[i].rbmValue.rbm_bytes; - - if (params->pgInfoData[i].rbmByte > 0) { - MEMCPY_S(params->pgInfoData[i].rbmData, MAX_RBM_STR_SIZE, - graphData.pgInfo[i].rbmValue.rbm, graphData.pgInfo[i].rbmValue.rbm_bytes); - } - } - - params->mBrInfoNum = graphData.mbrInfo.size(); - for (size_t i = 0; i < graphData.mbrInfo.size(); ++i) { - params->mBrInfoData[i].streamId = graphData.mbrInfo[i].streamId; - params->mBrInfoData[i].mBrData = graphData.mbrInfo[i].data; - } - - params->pgNamesNum = graphData.pgNames.size(); - for (size_t i = 0; i < params->pgNamesNum; ++i) { - size_t len = graphData.pgNames[i].copy(params->pgNames[i], MAX_NAME_LENGTH); - params->pgNames[i][len] = '\0'; - } - - params->kernelArrayNum = graphData.programGroup.size(); - for (size_t i = 0; i < params->kernelArrayNum; ++i) { - params->kernelArray[i].streamId = graphData.programGroup[i].streamId; - ia_isp_bxt_program_group* pgPtr = graphData.programGroup[i].pgPtr; - params->kernelArray[i].group = *pgPtr; - - for (unsigned int j = 0; j < params->kernelArray[i].group.kernel_count; ++j) { - params->kernelArray[i].runKernels[j] = pgPtr->run_kernels[j]; - if (pgPtr->run_kernels[j].resolution_info) { - params->kernelArray[i].resoInfo[j] = *(pgPtr->run_kernels[j].resolution_info); - params->kernelArray[i].runKernels[j].resolution_info = - &(params->kernelArray[i].resoInfo[j]); - } else { - params->kernelArray[i].runKernels[j].resolution_info = nullptr; - } - - if (pgPtr->run_kernels[j].resolution_history) { - params->kernelArray[i].resoHistory[j] = *(pgPtr->run_kernels[j].resolution_history); - params->kernelArray[i].runKernels[j].resolution_history = - &(params->kernelArray[i].resoHistory[j]); - } else { - params->kernelArray[i].runKernels[j].resolution_history = nullptr; - } - } - params->kernelArray[i].group.run_kernels = params->kernelArray[i].runKernels; - - if (pgPtr->pipe) { - params->kernelArray[i].pipeInfo = *(pgPtr->pipe); - params->kernelArray[i].group.pipe = &(params->kernelArray[i].pipeInfo); - } else { - params->kernelArray[i].group.pipe = nullptr; - } - } - - return true; -} - -bool IPCGraphConfig::clientUnflattenGetGraphData(void* pData, uint32_t size, - IGraphType::GraphConfigData* graphData) { - CheckAndLogError(!pData || !graphData || size < sizeof(GraphGetDataParams), false, - "@%s, Wrong parameters, pData: %p, graphData: %p, size: %u", __func__, pData, - graphData, size); - - GraphGetDataParams* params = static_cast(pData); - - graphData->mcId = params->mcId; - graphData->graphId = params->graphId; - - graphData->csiReso = params->csiReso; - - LOG1("@%s, mcId: %d, graphId: %d", __func__, params->mcId, params->graphId); - - for (size_t i = 0; i < params->gdcInfoNum; i++) { - graphData->gdcInfos.push_back(params->mGdcInfo[i]); - } - - for (size_t i = 0; i < params->streamIdNum; ++i) { - graphData->streamIds.push_back(params->streamIdData[i]); - } - - for (size_t i = 0; i < params->tuningModeNum; ++i) { - graphData->tuningModes.push_back(params->tuningModes[i]); - } - - for (size_t i = 0; i < params->pgInfoNum; ++i) { - IGraphType::PgInfo info; - info.pgName = params->pgInfoData[i].pgName; - info.pgId = params->pgInfoData[i].pgId; - info.streamId = params->pgInfoData[i].streamId; - info.rbmValue.rbm_bytes = params->pgInfoData[i].rbmByte; - if (params->pgInfoData[i].rbmByte > 0) { - MEMCPY_S(info.rbmValue.rbm, MAX_RBM_STR_SIZE, params->pgInfoData[i].rbmData, - params->pgInfoData[i].rbmByte); - } - graphData->pgInfo.push_back(info); - } - - for (size_t i = 0; i < params->mBrInfoNum; ++i) { - IGraphType::MbrInfo info; - info.streamId = params->mBrInfoData[i].streamId; - info.data = params->mBrInfoData[i].mBrData; - graphData->mbrInfo.push_back(info); - } - - for (size_t i = 0; i < params->pgNamesNum; ++i) { - graphData->pgNames.push_back(params->pgNames[i]); - } - - for (size_t i = 0; i < params->kernelArrayNum; ++i) { - IGraphType::ProgramGroupInfo info; - - info.streamId = params->kernelArray[i].streamId; - info.pgPtr = &(params->kernelArray[i].group); - - info.pgPtr->run_kernels = params->kernelArray[i].runKernels; - for (unsigned j = 0; j < info.pgPtr->kernel_count; ++j) { - if (params->kernelArray[i].runKernels[j].resolution_info) { - info.pgPtr->run_kernels[j].resolution_info = &(params->kernelArray[i].resoInfo[j]); - } else { - info.pgPtr->run_kernels[j].resolution_info = nullptr; - } - - if (params->kernelArray[i].runKernels[j].resolution_history) { - info.pgPtr->run_kernels[j].resolution_history = - &(params->kernelArray[i].resoHistory[j]); - } else { - info.pgPtr->run_kernels[j].resolution_history = nullptr; - } - } - - if (params->kernelArray[i].group.pipe) { - info.pgPtr->pipe = &(params->kernelArray[i].pipeInfo); - } else { - info.pgPtr->pipe = nullptr; - } - - graphData->programGroup.push_back(info); - } - - return true; -} - -bool IPCGraphConfig::clientFlattenGetPgId(void* pData, uint32_t size, GraphBaseInfo info, - const int streamId, const int kernelId) { - CheckAndLogError(!pData || size < sizeof(GraphGetPgIdParams), false, - "@%s, Wrong parameters, pData: %p, size: %u", __func__, pData, size); - - GraphGetPgIdParams* params = static_cast(pData); - CLEAR(*params); - - params->baseInfo = info; - params->streamId = streamId; - params->kernelId = kernelId; - - return true; -} - -bool IPCGraphConfig::serverUnFlattenGetPgId(void* pData, uint32_t size, GraphBaseInfo* info, - uint32_t* streamId, int32_t* kernelId) { - CheckAndLogError(!pData || size < sizeof(GraphGetPgIdParams) || !info || !streamId || !kernelId, - false, - "@%s, Wrong parameters, pData: %p, size: %u, info: %p, streamId: %p, " - "kernelId: %p", - __func__, pData, size, info, streamId, kernelId); - - GraphGetPgIdParams* params = static_cast(pData); - - *info = params->baseInfo; - *streamId = params->streamId; - *kernelId = params->kernelId; - - return true; -} - -bool IPCGraphConfig::serverFlattenGetPgId(void* pData, uint32_t size, int32_t pgId) { - CheckAndLogError(!pData || size < sizeof(GraphGetPgIdParams), false, - "@%s, Wrong parameters, pData: %p, size: %u", __func__, pData, size); - - GraphGetPgIdParams* params = static_cast(pData); - params->pgId = pgId; - - return true; -} - -bool IPCGraphConfig::clientUnFlattenGetPgId(void* pData, uint32_t size, int32_t* pgId) { - CheckAndLogError(!pData || !pgId || size < sizeof(GraphGetPgIdParams), false, - "@%s, Wrong parameters, pData: %p, pgId: %p, size: %u", __func__, pData, pgId, - size); - - GraphGetPgIdParams* params = static_cast(pData); - *pgId = params->pgId; - - return true; -} - -bool IPCGraphConfig::clientFlattenGetConnection(void* pData, uint32_t size, GraphBaseInfo info, - const std::vector& pgList) { - CheckAndLogError(!pData || size < sizeof(GraphGetConnectionParams), false, - "@%s, Wrong parameters, pData: %p, size: %u", __func__, pData, size); - GraphGetConnectionParams* params = static_cast(pData); - CLEAR(*params); - - params->baseInfo = info; - params->pgListNum = pgList.size(); - for (size_t i = 0; i < pgList.size(); ++i) { - size_t len = pgList[i].copy(params->pgList[i], MAX_NAME_LENGTH); - params->pgList[i][len] = '\0'; - } - - return true; -} - -bool IPCGraphConfig::serverUnFlattenGetConnection(void* pData, uint32_t size, GraphBaseInfo* info, - std::vector* pgList) { - CheckAndLogError(!pData || size < sizeof(GraphGetConnectionParams) || !info || !pgList, false, - "@%s, Wrong parameters, pData: %p, size: %u, info: %p, pgList: %p", __func__, - pData, size, info, pgList); - - GraphGetConnectionParams* params = static_cast(pData); - - *info = params->baseInfo; - for (size_t i = 0; i < params->pgListNum; ++i) { - pgList->push_back(params->pgList[i]); - } - - return true; -} - -bool IPCGraphConfig::serverFlattenGetConnection( - void* pData, uint32_t size, const std::vector& scalerInfo, - const std::vector& confVector, - const std::vector& tnrPortFormat) { - CheckAndLogError(!pData || size < sizeof(GraphGetConnectionParams), false, - "@%s, Wrong parameters, pData: %p, size: %u", __func__, pData, size); - - GraphGetConnectionParams* params = static_cast(pData); - - params->connectionArraySize = confVector.size(); - for (size_t i = 0; i < confVector.size(); ++i) { - params->connectionArray[i].connection = confVector[i]; - if (params->connectionArray[i].connection.stream) { - params->connectionArray[i].stream = *(confVector[i].stream); - } - } - - params->scalerInfoNum = scalerInfo.size(); - for (size_t i = 0; i < scalerInfo.size(); ++i) { - params->scalerInfoArray[i] = scalerInfo[i]; - } - - params->portFormatNum = tnrPortFormat.size(); - for (size_t i = 0; i < tnrPortFormat.size(); ++i) { - params->portFormatArray[i] = tnrPortFormat[i]; - } - - return true; -} - -bool IPCGraphConfig::clientUnFlattenGetConnection( - void* pData, uint32_t size, std::vector* scalerInfo, - std::vector* confVector, - std::vector* tnrPortFormat) { - CheckAndLogError( - !pData || !scalerInfo || !confVector || size < sizeof(GraphGetConnectionParams), false, - "@%s, Wrong parameters, pData: %p, scalerInfo: %p, confVector: %p, size: %u", __func__, - pData, scalerInfo, confVector, size); - - GraphGetConnectionParams* params = static_cast(pData); - - for (size_t i = 0; i < params->connectionArraySize; ++i) { - if (params->connectionArray[i].connection.stream) { - params->connectionArray[i].connection.stream = &(params->connectionArray[i].stream); - } - confVector->push_back(params->connectionArray[i].connection); - } - - for (size_t i = 0; i < params->scalerInfoNum; ++i) { - scalerInfo->push_back(params->scalerInfoArray[i]); - } - - if (tnrPortFormat) { - for (size_t i = 0; i < params->portFormatNum; ++i) { - tnrPortFormat->push_back(params->portFormatArray[i]); - } - } - - return true; -} -} // namespace icamera diff --git a/modules/sandboxing/IPCGraphConfig.h b/modules/sandboxing/IPCGraphConfig.h deleted file mode 100644 index c2a7ebbf..00000000 --- a/modules/sandboxing/IPCGraphConfig.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2019-2022 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "modules/sandboxing/IPCCommon.h" -#include "src/platformdata/gc/IGraphConfig.h" - -namespace icamera { - -#define MAX_STREAM (4) // Max stream number -#define MAX_GRAPH_SETTINGS_SIZE (2 * 1024 * 1024) // Max graph settings file size -#define MAX_GRAPH_DESCRIPTOR_SIZE (512 * 1024) // Max graph descriptor file size -#define MAX_PG_NUMBER (10) // Max pg number -#define MAX_NAME_LENGTH (128) // Max length for name -#define MAX_CONNECTION_COUNT (64) // Max connection count -#define MAX_STREAM_KERNEL_COUNT (128) // Max kernels info per one stream - -struct GraphBaseInfo { - int cameraId; - ConfigMode configMode; - - bool operator<(const GraphBaseInfo& b) const { - return (cameraId < b.cameraId) ? true : (configMode < b.configMode ? true : false); - } -}; - -struct GraphPgInfo { - char pgName[MAX_NAME_LENGTH]; - uint32_t pgId; - int streamId; - uint32_t rbmByte; - char rbmData[MAX_RBM_STR_SIZE]; -}; - -struct GraphMbrInfo { - int32_t streamId; - ia_isp_bxt_gdc_limits mBrData; -}; - -struct GraphKernelArray { - int32_t streamId; - ia_isp_bxt_program_group group; - ia_isp_bxt_run_kernels_t runKernels[MAX_STREAM_KERNEL_COUNT]; - ia_isp_bxt_resolution_info_t resoInfo[MAX_STREAM_KERNEL_COUNT]; - ia_isp_bxt_resolution_info_t resoHistory[MAX_STREAM_KERNEL_COUNT]; - ia_isp_bxt_pipe_t pipeInfo; -}; - -struct GraphParseParams { - int cameraId; - size_t gdSize; - char GD[MAX_GRAPH_DESCRIPTOR_SIZE]; - size_t gsSize; - char GS[MAX_GRAPH_SETTINGS_SIZE]; -}; - -struct GraphConfigStreamParams { - GraphBaseInfo baseInfo; - GraphSettingType type; - uint32_t streamNum; - HalStream streamCfg[MAX_STREAM]; - stream_t streamPriv[MAX_STREAM]; - bool dummyStillSink; -}; - -struct GraphQueryGraphParams { - GraphConfigStreamParams configParams; - bool isHasGraphSettings; -}; - -struct GraphGetDataParams { - GraphBaseInfo baseInfo; - - int mcId; - int graphId; - - camera_resolution_t csiReso; - - uint32_t gdcInfoNum; - IGraphType::GdcInfo mGdcInfo[MAX_STREAM]; - - uint32_t streamIdNum; - int32_t streamIdData[MAX_STREAM]; - - uint32_t tuningModeNum; - IGraphType::TuningModeInfo tuningModes[MAX_STREAM]; - - uint32_t pgInfoNum; - GraphPgInfo pgInfoData[MAX_PG_NUMBER]; - - uint32_t mBrInfoNum; - GraphMbrInfo mBrInfoData[MAX_STREAM]; - - uint32_t pgNamesNum; - char pgNames[MAX_PG_NUMBER][MAX_NAME_LENGTH]; - - uint32_t kernelArrayNum; - GraphKernelArray kernelArray[MAX_STREAM]; -}; - -struct GraphGetPgIdParams { - GraphBaseInfo baseInfo; - uint32_t streamId; - int32_t kernelId; - int32_t pgId; -}; - -struct GraphConnection { - IGraphType::PipelineConnection connection; - HalStream stream; -}; - -struct GraphGetConnectionParams { - GraphBaseInfo baseInfo; - uint32_t pgListNum; - char pgList[MAX_PG_NUMBER][MAX_NAME_LENGTH]; - uint32_t connectionArraySize; - GraphConnection connectionArray[MAX_CONNECTION_COUNT]; - uint32_t scalerInfoNum; - IGraphType::ScalerInfo scalerInfoArray[MAX_STREAM]; - uint32_t portFormatNum; - IGraphType::PrivPortFormat portFormatArray[MAX_STREAM]; -}; - -class IPCGraphConfig { - public: - IPCGraphConfig() {} - virtual ~IPCGraphConfig() {} - - bool clientFlattenParse(void* pData, uint32_t size, int cameraId, const char* graphDescFile, - const char* settingsFile); - bool serverUnflattenParse(void* pData, uint32_t size, GraphParseParams** parseParam); - bool clientFlattenConfigStreams(void* pData, uint32_t size, GraphBaseInfo info, - GraphSettingType type, bool dummyStillSink, - const std::vector& streams); - bool serverUnflattenConfigStreams(void* pData, uint32_t size, GraphBaseInfo* info, - GraphSettingType* type, bool* dummyStillSink, - std::vector* streams); - bool clientFlattenGetGraphData(void* pData, uint32_t size, GraphBaseInfo info); - bool serverUnflattenGetGraphData(void* pData, uint32_t size, GraphBaseInfo* info); - bool serverFlattenGetGraphData(void* pData, uint32_t size, - IGraphType::GraphConfigData graphData); - bool clientUnflattenGetGraphData(void* pData, uint32_t size, - IGraphType::GraphConfigData* graphData); - bool clientFlattenGetPgId(void* pData, uint32_t size, GraphBaseInfo info, const int streamId, - const int kernelId); - bool serverUnFlattenGetPgId(void* pData, uint32_t size, GraphBaseInfo* info, uint32_t* streamId, - int32_t* kernelId); - bool serverFlattenGetPgId(void* pData, uint32_t size, int32_t pgId); - bool clientUnFlattenGetPgId(void* pData, uint32_t size, int32_t* pgId); - bool clientFlattenGetConnection(void* pData, uint32_t size, GraphBaseInfo info, - const std::vector& pgList); - bool serverUnFlattenGetConnection(void* pData, uint32_t size, GraphBaseInfo* info, - std::vector* pgList); - bool serverFlattenGetConnection(void* pData, uint32_t size, - const std::vector& scalerInfo, - const std::vector& confVector, - const std::vector& tnrPortFormat); - bool clientUnFlattenGetConnection(void* pData, uint32_t size, - std::vector* scalerInfo, - std::vector* confVector, - std::vector* tnrPortFormat); - - private: - status_t readDataFromXml(const char* fileName, char* dataPtr, size_t* dataSize, int maxSize); - - // Disable copy constructor and assignment operator - DISALLOW_COPY_AND_ASSIGN(IPCGraphConfig); -}; -} // namespace icamera diff --git a/modules/sandboxing/IPCIntelCca.h b/modules/sandboxing/IPCIntelCca.h deleted file mode 100644 index 0159ffb7..00000000 --- a/modules/sandboxing/IPCIntelCca.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "IntelCCA.h" - -namespace icamera { - -struct intel_cca_struct_data { - int cameraId; - TuningMode tuningMode; -}; - -struct intel_cca_init_data { - int cameraId; - TuningMode tuningMode; - - cca::cca_init_params inParams; -}; - -struct intel_cca_decode_stats_data { - int cameraId; - TuningMode tuningMode; - - ia_binary_data statsBuffer; - int32_t statsHandle; - uint32_t bitmap; - cca::cca_out_stats outStats; - - ia_isp_bxt_statistics_query_results_t results; -}; - -struct intel_cca_run_aec_data { - int cameraId; - TuningMode tuningMode; - - uint64_t frameId; - cca::cca_ae_input_params inParams; - - bool hasStats; - cca::cca_stats_params inStatsParams; - - bool hasDecodeStats; - intel_cca_decode_stats_data decodeStatsParams; - - cca::cca_ae_results results; -}; - -struct intel_cca_run_aiq_data { - int cameraId; - TuningMode tuningMode; - - uint64_t frameId; - cca::cca_aiq_params inParams; - - cca::cca_aiq_results* results; - int32_t aiqResultHandle; - - ia_mkn_trg type; - - cca::cca_mkn* mknResults; - int32_t mknResultsHandle; -}; - -struct intel_cca_run_ltm_data { - int cameraId; - TuningMode tuningMode; - - uint64_t frameId; - cca::cca_ltm_input_params inParams; -}; - -struct intel_cca_update_zoom_data { - int cameraId; - TuningMode tuningMode; - - cca::cca_dvs_zoom inParams; - uint32_t streamId; -}; - -struct intel_cca_run_dvs_data { - int cameraId; - TuningMode tuningMode; - - uint64_t frameId; - uint32_t streamId; -}; - -struct intel_cca_run_aic_data { - int cameraId; - TuningMode tuningMode; - - uint64_t frameId; - cca::cca_pal_input_params* inParams; - int32_t inParamsHandle; - - ia_binary_data palOutData; - int32_t palDataHandle; -}; - -struct intel_cca_get_cmc_data { - int cameraId; - TuningMode tuningMode; - cca::cca_cpf cpf; - - cca::cca_cmc results; -}; - -struct intel_cca_get_aiqd_data { - int cameraId; - TuningMode tuningMode; - - cca::cca_aiqd results; -}; - -struct intel_cca_update_tuning_data { - int cameraId; - TuningMode tuningMode; - - uint8_t lardTags; - ia_lard_input_params lardParams; - cca::cca_nvm nvmParams; - int32_t streamId; -}; - -struct intel_cca_deinit_data { - int cameraId; - TuningMode tuningMode; -}; - -struct intel_cca_get_pal_data_size { - int cameraId; - TuningMode tuningMode; - - cca::cca_program_group pg; - - uint32_t returnSize; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/IPCIntelFD.cpp b/modules/sandboxing/IPCIntelFD.cpp deleted file mode 100644 index c93a50f4..00000000 --- a/modules/sandboxing/IPCIntelFD.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IPC_FACE_DETECTION - -#include "modules/sandboxing/IPCIntelFD.h" - -#include "CameraLog.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" - -namespace icamera { - -bool IPCIntelFD::clientFlattenInit(unsigned int max_face_num, int cameraId, - FaceDetectionInitParams* params) { - CheckAndLogError(params == nullptr, false, "@%s, params is nullptr", __func__); - - params->max_face_num = max_face_num; - params->cameraId = cameraId; - - return true; -} - -bool IPCIntelFD::serverUnflattenRun(const FaceDetectionRunParams& inParams, void* imageData, - pvl_image* image, int* cameraId) { - CheckAndLogError(image == nullptr || cameraId == nullptr, false, - "@%s, image or cameraId is nullptr", __func__); - - image->size = inParams.size; - image->width = inParams.width; - image->height = inParams.height; - image->format = inParams.format; - image->stride = inParams.stride; - image->rotation = inParams.rotation; - *cameraId = inParams.cameraId; - - if (imageData) { - image->data = const_cast(static_cast(imageData)); - } else { - image->data = const_cast(inParams.data); - } - - return true; -} -} /* namespace icamera */ diff --git a/modules/sandboxing/IPCIntelFD.h b/modules/sandboxing/IPCIntelFD.h deleted file mode 100644 index b5722d1a..00000000 --- a/modules/sandboxing/IPCIntelFD.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include - -#include "FaceType.h" -#include "modules/sandboxing/IPCCommon.h" - -namespace icamera { -struct FaceDetectionInitParams { - unsigned int max_face_num; - int cameraId; -}; - -struct FaceDetectionDeinitParams { - int cameraId; -}; - -struct FaceDetectionPVLResult { - bool faceUpdated; - int faceNum; - pvl_face_detection_result faceResults[MAX_FACES_DETECTABLE]; - pvl_eye_detection_result eyeResults[MAX_FACES_DETECTABLE]; - pvl_mouth_detection_result mouthResults[MAX_FACES_DETECTABLE]; -}; - -struct FaceDetectionRunParams { - uint8_t data[MAX_FACE_FRAME_SIZE_ASYNC]; - int32_t bufferHandle; - uint32_t size; - int32_t width; - int32_t height; - pvl_image_format format; - int32_t stride; - int32_t rotation; - int cameraId; - - FaceDetectionPVLResult results; -}; - -class IPCIntelFD { - public: - IPCIntelFD() {} - virtual ~IPCIntelFD() {} - - bool clientFlattenInit(unsigned int max_face_num, int cameraId, - FaceDetectionInitParams* params); - bool serverUnflattenRun(const FaceDetectionRunParams& inParams, void* imageData, - pvl_image* image, int* cameraId); -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/IPCIntelPGParam.cpp b/modules/sandboxing/IPCIntelPGParam.cpp deleted file mode 100644 index 0d27a091..00000000 --- a/modules/sandboxing/IPCIntelPGParam.cpp +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IPCIntelPGParam - -#include "modules/sandboxing/IPCIntelPGParam.h" - -#include "iutils/CameraLog.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" - -namespace icamera { - -bool IPCIntelPGParam::clientFlattenInit(void* pData, int dataSize, int pgId, uintptr_t client, - ia_p2p_platform_t platform, - const PgConfiguration& pgConfig) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_init_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - - pg_param_init_params* params = static_cast(pData); - CheckAndLogError(pgConfig.pgManifestSize > sizeof(params->pgManifestData), false, - "@%s, manifest buffer size: %d is big", __func__, pgConfig.pgManifestSize); - - params->pgId = pgId; - params->client = client; - params->platform = platform; - - params->pgConfig.fragmentCount = pgConfig.fragmentCount; - params->pgConfig.inputMainFrame = pgConfig.inputMainFrame; - params->pgConfig.outputMainFrame = pgConfig.outputMainFrame; - - params->pgConfig.pgManifestSize = pgConfig.pgManifestSize; - MEMCPY_S(params->pgManifestData, sizeof(params->pgManifestData), pgConfig.pgManifest, - pgConfig.pgManifestSize); - - params->disableDataTermialsCount = pgConfig.disableDataTermials.size(); - CheckAndLogError(params->disableDataTermialsCount > IPU_MAX_TERMINAL_COUNT, false, - "@%s, disableDataTermials cound: %d is big", __func__, - params->disableDataTermialsCount); - memset(params->disableDataTermialsData, -1, sizeof(params->disableDataTermialsData)); - for (int i = 0; i < params->disableDataTermialsCount; i++) { - params->disableDataTermialsData[i] = pgConfig.disableDataTermials[i]; - } - - return true; -} - -bool IPCIntelPGParam::serverUnflattenInit(void* pData, int dataSize, int* pgId, uintptr_t* client, - ia_p2p_platform_t* platform, PgConfiguration* pgConfig) { - CheckAndLogError(!pData || !pgId || !client || !platform || !pgConfig || - dataSize < sizeof(pg_param_init_params), - false, - "@%s, Wrong parameters, pData: %p, pgId: %p, client: %p, platform: %p, " - "pgConfig: %p, dataSize: %d", - __func__, pData, pgId, client, platform, pgConfig, dataSize); - - pg_param_init_params* params = static_cast(pData); - *pgId = params->pgId; - *client = params->client; - *platform = params->platform; - - pgConfig->fragmentCount = params->pgConfig.fragmentCount; - pgConfig->inputMainFrame = params->pgConfig.inputMainFrame; - pgConfig->outputMainFrame = params->pgConfig.outputMainFrame; - pgConfig->pgManifestSize = params->pgConfig.pgManifestSize; - void* dataPtr = static_cast(params->pgManifestData); - pgConfig->pgManifest = static_cast(dataPtr); - - pgConfig->disableDataTermials.clear(); - CheckAndLogError(params->disableDataTermialsCount > IPU_MAX_TERMINAL_COUNT, false, - "@%s, disableDataTermials cound: %d is big", __func__, - params->disableDataTermialsCount); - for (int i = 0; i < params->disableDataTermialsCount; i++) { - pgConfig->disableDataTermials.push_back(params->disableDataTermialsData[i]); - } - - return true; -} - -bool IPCIntelPGParam::clientFlattenPrepare(void* pData, int dataSize, uintptr_t client, - unsigned int ipuParamSize, int32_t ipuParamHandle, - const ia_css_rbm_t* rbm) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_prepare_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - - pg_param_prepare_params* params = static_cast(pData); - params->client = client; - params->ipuParamSize = ipuParamSize; - params->ipuParamHandle = ipuParamHandle; - - if (rbm) { - params->rbm = ¶ms->rbmData; - MEMCPY_S(¶ms->rbmData, sizeof(params->rbmData), rbm, sizeof(*rbm)); - } else { - params->rbm = nullptr; - } - - return true; -} - -bool IPCIntelPGParam::serverUnflattenPrepare(void* pData, int dataSize, uintptr_t* client, - void* palDataAddr, ia_binary_data* ipuParameters, - ia_css_rbm_t** rbm, ia_css_kernel_bitmap_t** bitmap, - uint32_t** maxStatsSize) { - CheckAndLogError(!pData || !client || !ipuParameters || !rbm || !bitmap || !palDataAddr || - dataSize < sizeof(pg_param_prepare_params), - false, - "@%s, Wrong parameters, pData: %p, client: %p, ipuParameters: %p, rbm: %p, " - "bitmap: %p, palDataAddr: %p, dataSize: %d", - __func__, pData, client, ipuParameters, rbm, bitmap, palDataAddr, dataSize); - - pg_param_prepare_params* params = static_cast(pData); - *client = params->client; - ipuParameters->size = params->ipuParamSize; - ipuParameters->data = palDataAddr; - *rbm = params->rbm ? ¶ms->rbmData : nullptr; - *bitmap = ¶ms->bitmapData; - if (maxStatsSize) *maxStatsSize = ¶ms->maxStatsSize; - return true; -} - -bool IPCIntelPGParam::clientUnflattenPrepare(const void* pData, int dataSize, - ia_css_kernel_bitmap_t* bitmap, - uint32_t* maxStatsSize) { - CheckAndLogError(!pData || !bitmap || dataSize < sizeof(pg_param_prepare_params), false, - "@%s, Wrong parameters, pData: %p, bitmap: %p, dataSize: %d", __func__, pData, - bitmap, dataSize); - - const pg_param_prepare_params* params = static_cast(pData); - MEMCPY_S(bitmap, sizeof(*bitmap), ¶ms->bitmapData, sizeof(params->bitmapData)); - - if (maxStatsSize) *maxStatsSize = params->maxStatsSize; - return true; -} - -int IPCIntelPGParam::getTotalPGBufferSize(int pgSize) { - int size = sizeof(pg_param_allocate_pg_params); - size += PAGE_ALIGN(pgSize); - return size; -} - -bool IPCIntelPGParam::assignPGBuffer(void* pData, int dataSize, int pgSize, void** pgBuffer) { - CheckAndLogError(!pData || !pgBuffer || dataSize < pgSize, false, - "@%s, Wrong parameters, pData: %p, pgBuffer: %p, dataSize: %d, pgSize: %d", - __func__, pData, pgBuffer, dataSize, pgSize); - - uintptr_t pgAddr = reinterpret_cast(pData); - CheckAndLogError(pgAddr & ((getpagesize() - 1)), false, "@%s, pg addr is not aligned", - __func__); - *pgBuffer = pData; - return true; -} - -bool IPCIntelPGParam::clientFlattenAllocatePGBuffer(void* pData, int dataSize, uintptr_t client, - int pgSize) { - CheckAndLogError(!pData, false, "@%s, pData is nullptr", __func__); - uintptr_t paramAddr = - reinterpret_cast(pData) + dataSize - sizeof(pg_param_allocate_pg_params); - CheckAndLogError(paramAddr < reinterpret_cast(pData) + pgSize, false, - "@%s, dataSize: %d is small", __func__, dataSize); - - pg_param_allocate_pg_params* params = reinterpret_cast(paramAddr); - params->client = client; - params->pgSize = pgSize; - - return true; -} - -bool IPCIntelPGParam::serverUnflattenAllocatePGBuffer(const void* pData, int dataSize, - uintptr_t* client, int* pgSize) { - CheckAndLogError(!pData || !client || !pgSize || dataSize < sizeof(pg_param_allocate_pg_params), - false, - "@%s, Wrong parameters, pData: %p, client: %p, pgSize: %p, dataSize: %d", - __func__, pData, client, pgSize, dataSize); - uintptr_t paramAddr = - reinterpret_cast(pData) + dataSize - sizeof(pg_param_allocate_pg_params); - pg_param_allocate_pg_params* params = reinterpret_cast(paramAddr); - CheckAndLogError(paramAddr < reinterpret_cast(pData) + params->pgSize, false, - "@%s, dataSize is small", __func__); - *client = params->client; - *pgSize = params->pgSize; - - return true; -} - -bool IPCIntelPGParam::clientFlattenGetFragDescs(void* pData, int dataSize, uintptr_t client, - int descCount) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_get_fragment_desc_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - - pg_param_get_fragment_desc_params* params = - static_cast(pData); - CheckAndLogError(descCount > sizeof(params->descsData), false, "@%s, descCount: %d is big", - __func__, descCount); - - params->client = client; - params->descCount = descCount; - return true; -} - -bool IPCIntelPGParam::serverUnflattenGetFragDescs(void* pData, int dataSize, uintptr_t* client, - int* descCount, ia_p2p_fragment_desc** descs) { - CheckAndLogError(!pData || !client || !descCount || !descs || - dataSize < sizeof(pg_param_get_fragment_desc_params), - false, - "@%s, Wrong parameters, pData: %p, client: %p, descCount: %p, " - "descs: %p, dataSize: %d", - __func__, pData, client, descCount, descs, dataSize); - - pg_param_get_fragment_desc_params* params = - static_cast(pData); - *client = params->client; - *descCount = params->descCount; - *descs = params->descsData; - return true; -} - -bool IPCIntelPGParam::serverFlattenGetFragDescs(void* pData, int dataSize, int count) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_get_fragment_desc_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - - pg_param_get_fragment_desc_params* params = - static_cast(pData); - params->returnCount = count; - return true; -} - -bool IPCIntelPGParam::clientUnflattenGetFragDescs(const void* pData, int dataSize, int* count, - ia_p2p_fragment_desc* descs) { - CheckAndLogError( - !pData || !count || !descs || dataSize < sizeof(pg_param_get_fragment_desc_params), false, - "@%s, Wrong parameters, pData: %p, count: %p, descs: %p, dataSize: %d", __func__, pData, - count, descs, dataSize); - - const pg_param_get_fragment_desc_params* params = - static_cast(pData); - *count = params->returnCount; - MEMCPY_S(descs, sizeof(ia_p2p_fragment_desc) * params->descCount, params->descsData, - sizeof(params->descsData)); - return true; -} - -bool IPCIntelPGParam::clientFlattenPrepareProgram(void* pData, int dataSize, uintptr_t client) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_prepare_program_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - - pg_param_prepare_program_params* params = static_cast(pData); - params->client = client; - return true; -} - -bool IPCIntelPGParam::serverUnflattenPrepareProgram(const void* pData, int dataSize, - uintptr_t* client) { - CheckAndLogError(!pData || !client || dataSize < sizeof(pg_param_prepare_program_params), false, - "@%s, Wrong parameters, pData: %p, client: %p, dataSize: %d", __func__, pData, - client, dataSize); - - const pg_param_prepare_program_params* params = - static_cast(pData); - *client = params->client; - return true; -} - -bool IPCIntelPGParam::serverFlattenPrepareProgram(void* pData, int dataSize, int payloadCount, - const ia_binary_data* payloads) { - CheckAndLogError(!pData || !payloads || dataSize < sizeof(pg_param_prepare_program_params) || - payloadCount > IPU_MAX_TERMINAL_COUNT, - false, - "@%s, Wrong parameters, pData: %p, payloads: %p, dataSize: %d, count: %d", - __func__, pData, payloads, dataSize, payloadCount); - - pg_param_prepare_program_params* params = static_cast(pData); - params->payloadCount = payloadCount; - MEMCPY_S(params->payloads, sizeof(ia_binary_data) * payloadCount, payloads, - sizeof(ia_binary_data) * payloadCount); - return true; -} - -bool IPCIntelPGParam::clientUnflattenPrepareProgram(const void* pData, int dataSize, - int* payloadCount, ia_binary_data* payloads) { - CheckAndLogError(!pData || !payloads || dataSize < sizeof(pg_param_prepare_program_params), - false, "@%s, Wrong parameters, pData: %p, payloads: %p, dataSize: %d", - __func__, pData, payloads, dataSize); - - const pg_param_prepare_program_params* params = - static_cast(pData); - - CheckAndLogError(*payloadCount < params->payloadCount, false, "@%s, payloadCount is small", - __func__); - *payloadCount = params->payloadCount; - for (int i = 0; i < params->payloadCount; i++) { - payloads[i].size = params->payloads[i].size; - payloads[i].data = nullptr; - } - return true; -} - -int IPCIntelPGParam::getTotalPayloadSize(int payloadCount, const ia_binary_data* payloads) { - CheckAndLogError(!payloads, 0, "@%s, payloads is nullptr", __func__); - int size = sizeof(pg_param_register_payloads_params); - for (int i = 0; i < payloadCount; i++) { - if (payloads[i].size) { - size += PAGE_ALIGN(payloads[i].size); - } - } - return size; -} - -bool IPCIntelPGParam::assignPayloads(void* pData, int dataSize, int payloadCount, - ia_binary_data* payloads) { - CheckAndLogError(!pData || !payloads, false, "@%s, pData: %p, payloads: %p is nullptr", - __func__, pData, payloads); - - uintptr_t payloadAddr = reinterpret_cast(pData); - CheckAndLogError(payloadAddr & ((getpagesize() - 1)), false, "@%s, payload addr is not aligned", - __func__); - for (int i = 0; i < payloadCount; i++) { - if (payloads[i].size > 0) { - CheckAndLogError(payloadAddr > reinterpret_cast(pData) + dataSize, false, - "@%s, buffer is small", __func__); - payloads[i].data = reinterpret_cast(payloadAddr); - payloadAddr += PAGE_ALIGN(payloads[i].size); - } - } - return true; -} - -bool IPCIntelPGParam::clientFlattenRegisterPayloads(void* pData, int dataSize, uintptr_t client, - int payloadCount, - const ia_binary_data* payloads) { - CheckAndLogError(!pData || !payloads || dataSize < sizeof(pg_param_register_payloads_params) || - payloadCount > IPU_MAX_TERMINAL_COUNT, - false, - "@%s, Wrong parameters, pData: %p, payloads: %p, dataSize: %d, count: %d", - __func__, pData, payloads, dataSize, payloadCount); - - uintptr_t paramAddr = - reinterpret_cast(pData) + dataSize - sizeof(pg_param_register_payloads_params); - pg_param_register_payloads_params* params = - reinterpret_cast(paramAddr); - params->client = client; - params->payloadCount = payloadCount; - MEMCPY_S(params->cPayloads, sizeof(params->cPayloads), payloads, - sizeof(ia_binary_data) * payloadCount); - getPayloadOffsets(pData, dataSize, payloadCount, payloads, params->payloadOffsets); - return true; -} - -bool IPCIntelPGParam::serverUnflattenRegisterPayloads(void* pData, int dataSize, uintptr_t* client, - int* payloadCount, ia_binary_data** cPayloads, - ia_binary_data** sPayloads) { - CheckAndLogError(!pData || !client || !payloadCount || !cPayloads || !sPayloads || - dataSize < sizeof(pg_param_register_payloads_params), - false, - "@%s, Wrong parameters, pData: %p, client: %p, payloadCount: %p, " - "cPayloads: %p, sPayloads: %p, dataSize: %d", - __func__, pData, client, payloadCount, cPayloads, sPayloads, dataSize); - - uintptr_t paramAddr = - reinterpret_cast(pData) + dataSize - sizeof(pg_param_register_payloads_params); - pg_param_register_payloads_params* params = - reinterpret_cast(paramAddr); - *client = params->client; - MEMCPY_S(params->sPayloads, sizeof(params->sPayloads), params->cPayloads, - sizeof(params->cPayloads)); // save size to sPayloads - *payloadCount = params->payloadCount; - getPayloadData(pData, dataSize, *payloadCount, params->payloadOffsets, params->sPayloads); - *cPayloads = params->cPayloads; - *sPayloads = params->sPayloads; - return true; -} - -bool IPCIntelPGParam::getPayloadOffsets(const void* pData, int dataSize, int payloadCount, - const ia_binary_data* payloads, int32_t* payloadOffsets) { - CheckAndLogError(!pData || !payloads || !payloadOffsets, false, - "@%s, pData: %p, payloads: %p, payloadOffsets: %p is nullptr", __func__, pData, - payloads); - - uintptr_t startAddr = reinterpret_cast(pData); - for (int i = 0; i < payloadCount; i++) { - if (payloads[i].size <= 0) continue; - - int32_t offset = reinterpret_cast(payloads[i].data) - startAddr; - CheckAndLogError((offset > (dataSize - payloads[i].size) || offset < 0), false, - "@%s, error offset %d", __func__, offset); - payloadOffsets[i] = offset; - } - return 0; -} - -bool IPCIntelPGParam::getPayloadData(void* pData, int dataSize, int payloadCount, - const int32_t* payloadOffsets, ia_binary_data* payloads) { - CheckAndLogError(!pData || !payloads || !payloadOffsets, false, - "@%s, pData: %p, payloads: %p, payloadOffsets: %p is nullptr", __func__, pData, - payloads, payloadOffsets); - - unsigned char* startAddr = reinterpret_cast(pData); - for (int i = 0; i < payloadCount; i++) { - if (payloads[i].size <= 0) continue; - - CheckAndLogError(payloadOffsets[i] > dataSize - payloads[i].size, false, - "@%s, error offset %d", __func__, payloadOffsets[i]); - payloads[i].data = startAddr + payloadOffsets[i]; - } - return true; -} - -bool IPCIntelPGParam::clientFlattenEncode(void* pData, int dataSize, uintptr_t client, - unsigned int ipuParamSize, int32_t ipuParamHandle, - int32_t payloadCount, const ia_binary_data* payloads) { - CheckAndLogError(!pData || !payloads || dataSize < sizeof(pg_param_encode_params) || - payloadCount > IPU_MAX_TERMINAL_COUNT, - false, - "@%s, Wrong parameters, pData: %p, payloads: %p, dataSize: %d, count: %d", - __func__, pData, payloads, dataSize, payloadCount); - - pg_param_encode_params* params = static_cast(pData); - params->client = client; - params->ipuParamSize = ipuParamSize; - params->ipuParamHandle = ipuParamHandle; - params->payloadCount = payloadCount; - MEMCPY_S(params->payloads, sizeof(params->payloads), payloads, - sizeof(ia_binary_data) * payloadCount); - return true; -} - -bool IPCIntelPGParam::serverUnflattenEncode(void* pData, int dataSize, uintptr_t* client, - void* palDataAddr, ia_binary_data* ipuParameters, - int32_t* payloadCount, ia_binary_data** payloads) { - CheckAndLogError(!pData || !client || !ipuParameters || !palDataAddr || !payloadCount || - !payloads || dataSize < sizeof(pg_param_encode_params), - false, - "@%s, Wrong parameters, pData: %p, client: %p, ipuParameters: %p, " - "palDataAddr: %p, payloadCount: %p, payloads: %p, dataSize: %d", - __func__, pData, client, ipuParameters, palDataAddr, payloadCount, payloads, - dataSize); - - pg_param_encode_params* params = static_cast(pData); - *client = params->client; - ipuParameters->size = params->ipuParamSize; - ipuParameters->data = palDataAddr; - *payloadCount = params->payloadCount; - *payloads = params->payloads; - return true; -} - -bool IPCIntelPGParam::clientFlattenDecode(void* pData, int dataSize, uintptr_t client, - int32_t payloadCount, const ia_binary_data* payloads, - int32_t statsHandle) { - CheckAndLogError(!pData || !payloads || dataSize < sizeof(pg_param_decode_params) || - payloadCount > IPU_MAX_TERMINAL_COUNT, - false, - "@%s, Wrong parameters, pData: %p, payloads: %p, dataSize: %d, count: %d", - __func__, pData, payloads, dataSize, payloadCount); - - pg_param_decode_params* params = static_cast(pData); - params->client = client; - params->payloadCount = payloadCount; - MEMCPY_S(params->payloads, sizeof(params->payloads), payloads, - sizeof(ia_binary_data) * payloadCount); - params->clientStatsHandle = statsHandle; - return true; -} - -bool IPCIntelPGParam::serverUnflattenDecode(void* pData, int dataSize, uintptr_t* client, - int32_t* payloadCount, ia_binary_data** payloads) { - CheckAndLogError(!pData || !client || !payloadCount || !payloads || - dataSize < sizeof(pg_param_decode_params), - false, - "@%s, Wrong parameters, pData: %p, client: %p, payloadCount: %p, " - "payloads: %p, dataSize: %d", - __func__, pData, client, payloadCount, payloads, dataSize); - - pg_param_decode_params* params = static_cast(pData); - *client = params->client; - *payloadCount = params->payloadCount; - *payloads = params->payloads; - return true; -} - -bool IPCIntelPGParam::serverFlattenDecode(void* pData, int dataSize, - const ia_binary_data& statistics) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_decode_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - pg_param_decode_params* params = static_cast(pData); - params->statsSize = statistics.size; - return true; -} - -bool IPCIntelPGParam::clientUnflattenDecode(void* pData, int dataSize, ia_binary_data* statistics) { - CheckAndLogError(!pData || !statistics || dataSize < sizeof(pg_param_decode_params), false, - "@%s, Wrong parameters, pData: %p, statistics: %p, dataSize: %d", __func__, - pData, statistics, dataSize); - - pg_param_decode_params* params = static_cast(pData); - statistics->size = params->statsSize; - return true; -} - -bool IPCIntelPGParam::clientFlattenDeinit(void* pData, int dataSize, uintptr_t client) { - CheckAndLogError(!pData || dataSize < sizeof(pg_param_deinit_params), false, - "@%s, Wrong parameters, pData: %p, dataSize: %d", __func__, pData, dataSize); - - pg_param_deinit_params* params = static_cast(pData); - params->client = client; - - return true; -} - -bool IPCIntelPGParam::serverUnflattenDeinit(const void* pData, int dataSize, uintptr_t* client) { - CheckAndLogError(!pData || !client || dataSize < sizeof(pg_param_deinit_params), false, - "@%s, Wrong parameters, pData: %p, client: %p, dataSize: %d", __func__, pData, - client, dataSize); - - const pg_param_deinit_params* params = static_cast(pData); - *client = params->client; - - return true; -} - -} // namespace icamera diff --git a/modules/sandboxing/IPCIntelPGParam.h b/modules/sandboxing/IPCIntelPGParam.h deleted file mode 100644 index c783920c..00000000 --- a/modules/sandboxing/IPCIntelPGParam.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "modules/sandboxing/IPCCommon.h" -#include "src/core/psysprocessor/PGUtils.h" - -#include "CameraTypes.h" -#include "modules/sandboxing/IPCIntelCca.h" - -namespace icamera { - -#define MAX_PROCESS_GROUP_SIZE 8192 -#define MAX_PAL_SIZE 0x800000 // 8M -#define MAX_STATISTICS_SIZE MAX_IA_BINARY_DATA_SIZE - -struct pg_param_init_params { - int pgId; - uintptr_t client; - ia_p2p_platform_t platform; - PgConfiguration pgConfig; - unsigned char pgManifestData[MAX_PROCESS_GROUP_SIZE]; - int disableDataTermialsData[IPU_MAX_TERMINAL_COUNT]; - int disableDataTermialsCount; -}; - -struct pg_param_prepare_params { - uintptr_t client; - uint32_t ipuParamSize; - int32_t ipuParamHandle; - ia_css_rbm_t* rbm; - ia_css_rbm_t rbmData; - - // Output - ia_css_kernel_bitmap_t bitmapData; - uint32_t maxStatsSize; -}; - -// Shared memory: pg + struct -// as pg memory addr should be page size aligned -struct pg_param_allocate_pg_params { - uintptr_t client; - int pgSize; -}; - -struct pg_param_get_fragment_desc_params { - uintptr_t client; - int descCount; - - // Output - int returnCount; - ia_p2p_fragment_desc descsData[IPU_MAX_TERMINAL_COUNT * IA_P2P_MAX_FRAGMENTS]; -}; - -struct pg_param_prepare_program_params { - uintptr_t client; - - // Output - int payloadCount; - ia_binary_data payloads[IPU_MAX_TERMINAL_COUNT]; // save size of payloads -}; - -// Shared memory: payloads + struct -// as payload memory addr should be page size aligned -struct pg_param_register_payloads_params { - uintptr_t client; - int payloadCount; - ia_binary_data cPayloads[IPU_MAX_TERMINAL_COUNT]; // save payloads of client - ia_binary_data sPayloads[IPU_MAX_TERMINAL_COUNT]; // save payloads of server - - int32_t payloadOffsets[IPU_MAX_TERMINAL_COUNT]; -}; - -struct pg_param_encode_params { - uintptr_t client; - uint32_t ipuParamSize; - int32_t ipuParamHandle; - int32_t payloadCount; - ia_binary_data payloads[IPU_MAX_TERMINAL_COUNT]; // save payloads of client -}; - -struct pg_param_decode_params { - uintptr_t client; - int32_t payloadCount; - ia_binary_data payloads[IPU_MAX_TERMINAL_COUNT]; // save payloads of client - int32_t clientStatsHandle; - - // Output - uint32_t statsSize; - - // For stats decoding together - intel_cca_decode_stats_data decodeStatsParams; - bool hasStatsDecode; -}; - -struct pg_param_deinit_params { - uintptr_t client; -}; - -class IPCIntelPGParam { - public: - IPCIntelPGParam() {} - virtual ~IPCIntelPGParam() {} - - bool clientFlattenInit(void* pData, int dataSize, int pgId, uintptr_t client, - ia_p2p_platform_t platform, const PgConfiguration& pgConfig); - bool serverUnflattenInit(void* pData, int dataSize, int* pgId, uintptr_t* client, - ia_p2p_platform_t* platform, PgConfiguration* pgConfig); - - bool clientFlattenPrepare(void* pData, int dataSize, uintptr_t client, - unsigned int ipuParamSize, int32_t ipuParamHandle, - const ia_css_rbm_t* rbm); - bool serverUnflattenPrepare(void* pData, int dataSize, uintptr_t* client, void* palDataAddr, - ia_binary_data* ipuParameters, ia_css_rbm_t** rbm, - ia_css_kernel_bitmap_t** bitmap, uint32_t** maxStatsSize); - bool clientUnflattenPrepare(const void* pData, int dataSize, ia_css_kernel_bitmap_t* bitmap, - uint32_t* maxStatsSize = nullptr); - - int getTotalPGBufferSize(int pgSize); - bool assignPGBuffer(void* pData, int dataSize, int pgSize, void** pgBuffer); - bool clientFlattenAllocatePGBuffer(void* pData, int dataSize, uintptr_t client, int pgSize); - bool serverUnflattenAllocatePGBuffer(const void* pData, int dataSize, uintptr_t* client, - int* pgSize); - - bool clientFlattenGetFragDescs(void* pData, int dataSize, uintptr_t client, int descCount); - bool serverUnflattenGetFragDescs(void* pData, int dataSize, uintptr_t* client, int* descCount, - ia_p2p_fragment_desc** descs); - bool serverFlattenGetFragDescs(void* pData, int dataSize, int count); - bool clientUnflattenGetFragDescs(const void* pData, int dataSize, int* count, - ia_p2p_fragment_desc* descs); - - bool clientFlattenPrepareProgram(void* pData, int dataSize, uintptr_t client); - bool serverUnflattenPrepareProgram(const void* pData, int dataSize, uintptr_t* client); - bool serverFlattenPrepareProgram(void* pData, int dataSize, int payloadCount, - const ia_binary_data* payloads); - bool clientUnflattenPrepareProgram(const void* pData, int dataSize, int* payloadCount, - ia_binary_data* payloads); - - int getTotalPayloadSize(int payloadCount, const ia_binary_data* payloads); - bool assignPayloads(void* pData, int dataSize, int payloadCount, ia_binary_data* payloads); - bool clientFlattenRegisterPayloads(void* pData, int dataSize, uintptr_t client, - int payloadCount, const ia_binary_data* payloads); - bool serverUnflattenRegisterPayloads(void* pData, int dataSize, uintptr_t* client, - int* payloadCount, ia_binary_data** cPayloads, - ia_binary_data** sPayloads); - - bool clientFlattenEncode(void* pData, int dataSize, uintptr_t client, unsigned int ipuParamSize, - int32_t ipuParamHandle, int32_t payloadCount, - const ia_binary_data* payloads); - bool serverUnflattenEncode(void* pData, int dataSize, uintptr_t* client, void* palDataAddr, - ia_binary_data* ipuParameters, int32_t* payloadCount, - ia_binary_data** payloads); - - bool clientFlattenDecode(void* pData, int dataSize, uintptr_t client, int32_t payloadCount, - const ia_binary_data* payloads, int32_t statsHandle); - bool serverUnflattenDecode(void* pData, int dataSize, uintptr_t* client, int32_t* payloadCount, - ia_binary_data** payloads); - bool serverFlattenDecode(void* pData, int dataSize, const ia_binary_data& statistics); - bool clientUnflattenDecode(void* pData, int dataSize, ia_binary_data* statistics); - - bool clientFlattenDeinit(void* pData, int dataSize, uintptr_t client); - bool serverUnflattenDeinit(const void* pData, int dataSize, uintptr_t* client); - - private: - bool getPayloadOffsets(const void* pData, int dataSize, int payloadCount, - const ia_binary_data* payloads, int32_t* payloadOffsets); - bool getPayloadData(void* pData, int dataSize, int payloadCount, const int32_t* payloadOffsets, - ia_binary_data* payloads); -}; - -} // namespace icamera diff --git a/modules/sandboxing/client/CMakeLists.txt b/modules/sandboxing/client/CMakeLists.txt deleted file mode 100644 index c4c1c477..00000000 --- a/modules/sandboxing/client/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (C) 2019-2021 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set(SANDBOXING_CLIENT_SRCS - ${SANDBOXING_DIR}/client/IntelAlgoClient.cpp - ${SANDBOXING_DIR}/client/IntelAlgoCommonClient.cpp - ${SANDBOXING_DIR}/client/IntelLard.cpp - ${SANDBOXING_DIR}/client/IntelFaceDetectionClient.cpp - ${SANDBOXING_DIR}/client/GraphConfigImplClient.cpp - ${SANDBOXING_DIR}/IPCCommon.cpp - ${SANDBOXING_DIR}/IPCIntelLard.cpp - ${SANDBOXING_DIR}/IPCIntelFD.cpp - ${SANDBOXING_DIR}/IPCGraphConfig.cpp - CACHE INTERNAL "sandboxing sources" - ) diff --git a/modules/sandboxing/client/GraphConfigImplClient.cpp b/modules/sandboxing/client/GraphConfigImplClient.cpp deleted file mode 100644 index d8878d15..00000000 --- a/modules/sandboxing/client/GraphConfigImplClient.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG GraphConfigImplClient - -#include "modules/sandboxing/client/GraphConfigImplClient.h" - -#include "iutils/CameraLog.h" - -using std::map; -using std::string; -using std::vector; - -namespace icamera { - -GraphConfigImpl::GraphConfigImpl() : mCameraId(-1), mInitialized(false) { - uintptr_t personal = reinterpret_cast(this); - std::string parseName = "/graphParse" + std::to_string(personal) + "Shm"; - - mMems = {{parseName.c_str(), sizeof(GraphParseParams), &mMemParse, false}}; - - bool success = mCommon.allocateAllShmMems(&mMems); - if (!success) { - mCommon.releaseAllShmMems(mMems); - return; - } - - mInitialized = true; - LOG1(" %s Construct done", mCameraId, __func__); -} - -GraphConfigImpl::GraphConfigImpl(int32_t camId, ConfigMode mode, GraphSettingType type) - : mCameraId(camId), - mConfigMode(mode), - mType(type), - mInitialized(false) { - uintptr_t personal = reinterpret_cast(this); - std::string queryGraphSettings = "/graphQueryGraph" + std::to_string(personal) + "Shm"; - std::string configStreamsName = "/graphConfigStreams" + std::to_string(personal) + "Shm"; - std::string getGraphDataName = "/graphGetData" + std::to_string(personal) + "Shm"; - std::string getPgIdName = "/graphGetPgId" + std::to_string(personal) + "Shm"; - std::string getConnection = "/graphGetConnection" + std::to_string(personal) + "Shm"; - - mMems = { - {queryGraphSettings.c_str(), sizeof(GraphQueryGraphParams), &mMemQueryGraphSettings, false}, - {configStreamsName.c_str(), sizeof(GraphConfigStreamParams), &mMemConfig, false}, - {getGraphDataName.c_str(), sizeof(GraphGetDataParams), &mMemGetData, false}, - {getPgIdName.c_str(), sizeof(GraphGetPgIdParams), &mMemGetPgId, false}, - {getConnection.c_str(), sizeof(GraphGetConnectionParams), &mMemGetConnection, false}}; - - bool success = mCommon.allocateAllShmMems(&mMems); - if (!success) { - mCommon.releaseAllShmMems(mMems); - return; - } - - mInitialized = true; - LOG1(" %s Construct done, configMode: %d, type %d", mCameraId, __func__, mConfigMode, - mType); -} - -GraphConfigImpl::~GraphConfigImpl() { - LOG1(" %s Destroy, configMode: %d, type %d", mCameraId, __func__, mConfigMode, mType); - - mInitialized = false; - mCommon.releaseAllShmMems(mMems); - mMems.clear(); -} - -void GraphConfigImpl::addCustomKeyMap() { - LOG1(" Add Custom KeyMap", mCameraId); - CheckAndLogError(!mInitialized, VOID_VALUE, "addCustomKeyMap mInitialized is false"); - - bool ret = mCommon.requestSync(IPC_GRAPH_ADD_KEY); - CheckAndLogError(!ret, VOID_VALUE, "addCustomKeyMap requestSync fails"); -} - -status_t GraphConfigImpl::parse(int cameraId, const char* graphDescFile, const char* settingsFile) { - LOG1(" Parse GD file %s and setting file %s", cameraId, graphDescFile, settingsFile); - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "parse mInitialized is false"); - - bool ret = mIpc.clientFlattenParse(mMemParse.mAddr, mMemParse.mSize, cameraId, graphDescFile, - settingsFile); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientFlattenParse fails"); - - status_t rt = mCommon.requestSync(IPC_GRAPH_PARSE, mMemParse.mHandle); - CheckAndLogError(!rt, UNKNOWN_ERROR, "parse requestSync fails"); - - return OK; -} - -void GraphConfigImpl::releaseGraphNodes() { - CheckAndLogError(!mInitialized, VOID_VALUE, "releaseGraphNodes mInitialized is false"); - - bool ret = mCommon.requestSync(IPC_GRAPH_RELEASE_NODES); - CheckAndLogError(!ret, VOID_VALUE, "releaseGraphNodes requestSync fails"); -} - -bool GraphConfigImpl::queryGraphSettings(const vector& activeStreams) { - CheckAndLogError(!mInitialized, false, "queryGraphSettings mInitialized is false"); - - GraphBaseInfo info = {mCameraId, mConfigMode}; - memset(mMemQueryGraphSettings.mAddr, 0, sizeof(GraphQueryGraphParams)); - bool ret = mIpc.clientFlattenConfigStreams(mMemQueryGraphSettings.mAddr, mMemConfig.mSize, info, - mType, false, activeStreams); - CheckAndLogError(!ret, false, "clientFlattenConfigStreams fails"); - - ret = mCommon.requestSync(IPC_GRAPH_QUERY_GRAPH_SETTINGS, mMemQueryGraphSettings.mHandle); - CheckAndLogError(!ret, false, "queryGraphSettings requestSync fails"); - - GraphQueryGraphParams* params = - static_cast(mMemQueryGraphSettings.mAddr); - return params->isHasGraphSettings; -} - -status_t GraphConfigImpl::configStreams(const vector& activeStreams, - bool dummyStillSink) { - LOG1(" %s, dummyStillSink: %d", mCameraId, __func__, dummyStillSink); - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "configStreams mInitialized is false"); - - GraphBaseInfo info = {mCameraId, mConfigMode}; - bool ret = mIpc.clientFlattenConfigStreams(mMemConfig.mAddr, mMemConfig.mSize, info, mType, - dummyStillSink, activeStreams); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientFlattenConfigStreams fails"); - - ret = mCommon.requestSync(IPC_GRAPH_CONFIG_STREAMS, mMemConfig.mHandle); - CheckAndLogError(!ret, UNKNOWN_ERROR, "configStreams requestSync fails"); - - return OK; -} - -status_t GraphConfigImpl::getGraphConfigData(IGraphType::GraphConfigData* data) { - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "getGraphConfigData mInitialized is false"); - - GraphBaseInfo info = {mCameraId, mConfigMode}; - bool ret = mIpc.clientFlattenGetGraphData(mMemGetData.mAddr, mMemGetData.mSize, info); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientFlattenGetGraphData fails"); - - ret = mCommon.requestSync(IPC_GRAPH_GET_CONFIG_DATA, mMemGetData.mHandle); - CheckAndLogError(!ret, UNKNOWN_ERROR, "getGraphConfigData requestSync fails"); - - ret = mIpc.clientUnflattenGetGraphData(mMemGetData.mAddr, mMemGetData.mSize, data); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientUnflattenGetGraphData fails"); - - return OK; -} - -status_t GraphConfigImpl::pipelineGetConnections( - const std::vector& pgList, std::vector* scalerInfo, - std::vector* confVector, - std::vector* tnrPortFormat) { - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "GetConnections mInitialized is false"); - - GraphBaseInfo info = {mCameraId, mConfigMode}; - bool ret = mIpc.clientFlattenGetConnection(mMemGetConnection.mAddr, mMemGetConnection.mSize, - info, pgList); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientFlattenGetConnection fails"); - - ret = mCommon.requestSync(IPC_GRAPH_GET_CONNECTION, mMemGetConnection.mHandle); - CheckAndLogError(!ret, UNKNOWN_ERROR, "GetConnections requestSync fails"); - - ret = mIpc.clientUnFlattenGetConnection(mMemGetConnection.mAddr, mMemGetConnection.mSize, - scalerInfo, confVector, tnrPortFormat); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientUnFlattenGetConnection fails"); - - return OK; -} - -status_t GraphConfigImpl::getPgIdForKernel(const uint32_t streamId, const int32_t kernelId, - int32_t* pgId) { - LOG1(" getPgIdForKernel stream %d, kernel %d", mCameraId, streamId, kernelId); - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "@%s, mInitialized is false", __func__); - - GraphBaseInfo info = {mCameraId, mConfigMode}; - bool ret = - mIpc.clientFlattenGetPgId(mMemGetPgId.mAddr, mMemGetPgId.mSize, info, streamId, kernelId); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientFlattenGetPgId fails"); - - ret = mCommon.requestSync(IPC_GRAPH_GET_PG_ID, mMemGetPgId.mHandle); - CheckAndLogError(!ret, UNKNOWN_ERROR, "getPgId requestSync fails"); - - ret = mIpc.clientUnFlattenGetPgId(mMemGetPgId.mAddr, mMemGetPgId.mSize, pgId); - CheckAndLogError(!ret, UNKNOWN_ERROR, "clientUnFlattenGetPgId fails"); - - return OK; -} -} // namespace icamera diff --git a/modules/sandboxing/client/GraphConfigImplClient.h b/modules/sandboxing/client/GraphConfigImplClient.h deleted file mode 100644 index 1ae8df16..00000000 --- a/modules/sandboxing/client/GraphConfigImplClient.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -#include "IntelAlgoCommonClient.h" -#include "iutils/Errors.h" -#include "iutils/Thread.h" -#include "iutils/Utils.h" -#include "modules/sandboxing/IPCGraphConfig.h" -#include "src/platformdata/CameraTypes.h" -#include "src/platformdata/gc/HalStream.h" -#include "src/platformdata/gc/IGraphConfig.h" - -namespace icamera { - -class GraphConfigImpl { - public: - GraphConfigImpl(); - GraphConfigImpl(int32_t camId, ConfigMode mode, GraphSettingType type); - virtual ~GraphConfigImpl(); - - void addCustomKeyMap(); - status_t parse(int cameraId, const char* graphDescFile, const char* settingsFile); - void releaseGraphNodes(); - - bool queryGraphSettings(const std::vector& activeStreams); - status_t configStreams(const std::vector& activeStreams, bool dummyStillSink); - status_t getGraphConfigData(IGraphType::GraphConfigData* data); - status_t getPgIdForKernel(const uint32_t streamId, const int32_t kernelId, int32_t* pgId); - - status_t pipelineGetConnections(const std::vector& pgList, - std::vector* scalerInfo, - std::vector* confVector, - std::vector* tnrPortFormat); - - private: - IPCGraphConfig mIpc; - IntelAlgoCommon mCommon; - - ShmMemInfo mMemParse; - ShmMemInfo mMemQueryGraphSettings; - ShmMemInfo mMemConfig; - ShmMemInfo mMemGetData; - ShmMemInfo mMemGetPgId; - ShmMemInfo mMemGetConnection; - - std::vector mMems; - - int mCameraId; - ConfigMode mConfigMode; - GraphSettingType mType; - bool mInitialized; - - // Disable copy constructor and assignment operator - DISALLOW_COPY_AND_ASSIGN(GraphConfigImpl); -}; -} // namespace icamera diff --git a/modules/sandboxing/client/IntelAlgoClient.cpp b/modules/sandboxing/client/IntelAlgoClient.cpp deleted file mode 100644 index 6257bd8e..00000000 --- a/modules/sandboxing/client/IntelAlgoClient.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelAlgoClient - -#include "modules/sandboxing/client/IntelAlgoClient.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include "Parameters.h" -#include "PlatformData.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" -#include "modules/sandboxing/client/IntelCcaClient.h" - -namespace icamera { - -IntelAlgoClient* IntelAlgoClient::sInstance = nullptr; -Mutex IntelAlgoClient::sLock; - -IntelAlgoClient* IntelAlgoClient::getInstance() { - AutoMutex lock(sLock); - - if (!sInstance) { - sInstance = new IntelAlgoClient; - } - - return sInstance; -} - -void IntelAlgoClient::releaseInstance() { - AutoMutex lock(sLock); - - icamera::IntelCca::releaseAllInstances(); - - if (sInstance) { - delete sInstance; - sInstance = nullptr; - } -} - -IntelAlgoClient::IntelAlgoClient() - : mErrCb(nullptr), - mGpuBridge(nullptr), - mIPCStatus(true), - mMojoManagerToken(nullptr), - mInitialized(false) { - LOG1("%s, Construct", __func__); -} - -IntelAlgoClient::~IntelAlgoClient() { - LOG1("%s, Destroy", __func__); -} - -int IntelAlgoClient::initialize() { - LOG1("@%s, mMojoManagerToken: %p", __func__, mMojoManagerToken); - CheckAndLogError(!mMojoManagerToken, UNKNOWN_ERROR, "@%s, mMojoManagerToken is nullptr", - __func__); - - mCallback = base::BindRepeating(&IntelAlgoClient::callbackHandler, base::Unretained(this)); - IntelAlgoClient::return_callback = returnCallback; - - mNotifyCallback = base::BindRepeating(&IntelAlgoClient::notifyHandler, base::Unretained(this)); - IntelAlgoClient::notify = notifyCallback; - - mBridge = cros::CameraAlgorithmBridge::CreateInstance(cros::CameraAlgorithmBackend::kVendorCpu, - mMojoManagerToken); - CheckAndLogError(!mBridge, UNKNOWN_ERROR, "@%s, mBridge is nullptr", __func__); - CheckAndLogError(mBridge->Initialize(this) != 0, UNKNOWN_ERROR, "@%s, mBridge init fails", - __func__); - - if (PlatformData::isUsingGpuAlgo()) { - LOG1("GPU algo enabled"); - mGpuBridge = cros::CameraAlgorithmBridge::CreateInstance( - cros::CameraAlgorithmBackend::kVendorGpu, mMojoManagerToken); - CheckAndLogError(!mGpuBridge, UNKNOWN_ERROR, "mGpuBridge is nullptr"); - CheckAndLogError(mGpuBridge->Initialize(this) != 0, UNKNOWN_ERROR, "mGpuBridge init fails"); - } - - for (int i = 0; i < IPC_GROUP_NUM; i++) { - if (static_cast(i) < IPC_GROUP_GPU) { - mRunner[i] = - std::unique_ptr(new Runner(static_cast(i), mBridge.get())); - } else if (mGpuBridge) { - mRunner[i] = - std::unique_ptr(new Runner(static_cast(i), mGpuBridge.get())); - } - } - - mIPCStatus = true; - mInitialized = true; - - return OK; -} - -bool IntelAlgoClient::isIPCFine() { - std::lock_guard l(mIPCStatusMutex); - - return mIPCStatus; -} - -void IntelAlgoClient::registerErrorCallback(const camera_callback_ops_t* errCb) { - LOG1("@%s, errCb:%p", __func__, errCb); - - std::lock_guard l(mIPCStatusMutex); - mErrCb = errCb; - - if (!mIPCStatus && mErrCb) { - camera_msg_data_t data = {CAMERA_IPC_ERROR, {}}; - mErrCb->notify(mErrCb, data); - } -} - -int IntelAlgoClient::allocateShmMem(const std::string& name, int size, int* fd, void** addr) { - *fd = -1; - *addr = nullptr; - int shmFd = -1; - void* shmAddr = nullptr; - - shmFd = shm_open(name.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); - CheckAndLogError((shmFd == -1), UNKNOWN_ERROR, "call shm_open fail"); - - do { - int ret = fcntl(shmFd, F_GETFD); - if (ret == -1) { - LOGE("call fcntl fail, error %s", strerror(errno)); - break; - } - - ret = ftruncate(shmFd, size); - if (ret == -1) { - LOGE("call ftruncate fail, error %s", strerror(errno)); - break; - } - - struct stat sb; - ret = fstat(shmFd, &sb); - if (ret == -1) { - LOGE("call fstat fail, error %s", strerror(errno)); - break; - } - - shmAddr = mmap(0, sb.st_size, PROT_WRITE, MAP_SHARED, shmFd, 0); - if (!shmAddr) { - LOGE("call mmap fail, error %s", strerror(errno)); - break; - } - - *fd = shmFd; - *addr = shmAddr; - - return OK; - } while (0); - - close(shmFd); - return UNKNOWN_ERROR; -} - -void IntelAlgoClient::releaseShmMem(const std::string& name, int size, int fd, void* addr) { - munmap(addr, size); - close(fd); - shm_unlink(name.c_str()); -} - -int IntelAlgoClient::requestSync(IPC_CMD cmd, int32_t bufferHandle) { - LOG2("requestSync cmd:%d:%s, bufferHandle:%d, mInitialized:%d", cmd, - IntelAlgoIpcCmdToString(cmd), bufferHandle, mInitialized); - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, " mInitialized is false"); - CheckAndLogError(!isIPCFine(), UNKNOWN_ERROR, "IPC error happens"); - - IPC_GROUP group = IntelAlgoIpcCmdToGroup(cmd); - - return mRunner[group]->requestSync(cmd, bufferHandle); -} - -int IntelAlgoClient::requestSync(IPC_CMD cmd) { - return requestSync(cmd, -1); -} - -int32_t IntelAlgoClient::registerBuffer(int bufferFd, void* addr, ShmMemUsage usage) { - LOG2("%s bufferFd: %d, mInitialized: %d, addr: %p, usage: %d", __func__, bufferFd, mInitialized, - addr, usage); - CheckAndLogError(!mInitialized, -1, "mInitialized is false"); - CheckAndLogError(usage >= MAX_ALGO_SHM, -1, "usage: %d isn't supported", usage); - CheckAndLogError(!isIPCFine(), -1, "IPC error happens"); - - int32_t handle = -1; - if (usage == CPU_ALGO_SHM) { - handle = mBridge->RegisterBuffer(bufferFd); - } else if (mGpuBridge) { - handle = mGpuBridge->RegisterBuffer(bufferFd); - } - if (handle >= 0) { - std::lock_guard l(mShmMapMutex); - mShmMap[usage][addr] = handle; - } - - return handle; -} - -void IntelAlgoClient::deregisterBuffer(int32_t bufferHandle, ShmMemUsage usage) { - LOG2("%s, bufferHandle: %d, mInitialized: %d, usage: %d", __func__, bufferHandle, mInitialized, - usage); - CheckAndLogError(!mInitialized, VOID_VALUE, "mInitialized is false"); - CheckAndLogError(usage >= MAX_ALGO_SHM, VOID_VALUE, "usage: %d isn't supported", usage); - CheckAndLogError(!isIPCFine(), VOID_VALUE, "IPC error happens"); - - { - std::lock_guard l(mShmMapMutex); - for (auto& item : mShmMap[usage]) { - if (item.second == bufferHandle) { - mShmMap[usage].erase(item.first); - break; - } - } - } - - std::vector handles({bufferHandle}); - if (usage == CPU_ALGO_SHM) { - mBridge->DeregisterBuffers(handles); - } else if (mGpuBridge) { - mGpuBridge->DeregisterBuffers(handles); - } -} - -int32_t IntelAlgoClient::registerGbmBuffer(int bufferFd, ShmMemUsage usage) { - LOG2("%s bufferFd:%d, mInitialized:%d, usage:%d", __func__, bufferFd, mInitialized, usage); - CheckAndLogError(!mInitialized, -1, "mInitialized is false"); - CheckAndLogError(!isIPCFine(), -1, "IPC error happens"); - CheckAndLogError(usage >= MAX_ALGO_SHM, -1, "usage: %d isn't supported", usage); - - if (usage == CPU_ALGO_SHM) { - return mBridge->RegisterBuffer(bufferFd); - } else if (mGpuBridge) { - return mGpuBridge->RegisterBuffer(bufferFd); - } - return OK; -} - -void IntelAlgoClient::deregisterGbmBuffer(int32_t bufferHandle, ShmMemUsage usage) { - LOG1("%s bufferHandle:%d, mInitialized:%d, usage:%d", __func__, bufferHandle, mInitialized, - usage); - CheckAndLogError(!mInitialized, VOID_VALUE, "mInitialized is false"); - CheckAndLogError(!isIPCFine(), VOID_VALUE, "IPC error happens"); - CheckAndLogError(usage >= MAX_ALGO_SHM, VOID_VALUE, "usage: %d isn't supported", usage); - - std::vector handles({bufferHandle}); - if (usage == CPU_ALGO_SHM) { - mBridge->DeregisterBuffers(handles); - } else if (mGpuBridge) { - mGpuBridge->DeregisterBuffers(handles); - } -} - -int32_t IntelAlgoClient::getBufferHandle(void* addr, ShmMemUsage usage) { - CheckAndLogError(!mInitialized, -1, "mInitialized is false"); - CheckAndLogError(usage >= MAX_ALGO_SHM, -1, "usage: %d isn't supported", usage); - if (!addr) return -1; - - LOG2("the buffer addr: %p, usage: %d", addr, usage); - std::lock_guard l(mShmMapMutex); - CheckAndLogError(mShmMap[usage].find(addr) == mShmMap[usage].end(), -1, - "%s, Invalid client addr: %p, usage: %d", __func__, addr, usage); - - return mShmMap[usage][addr]; -} - -void IntelAlgoClient::callbackHandler(uint32_t req_id, uint32_t status, int32_t buffer_handle) { - IPC_GROUP group = IntelAlgoIpcCmdToGroup(static_cast(req_id)); - mRunner[group]->callbackHandler(status, buffer_handle); -} - -void IntelAlgoClient::notifyHandler(uint32_t msg) { - if (msg != CAMERA_ALGORITHM_MSG_IPC_ERROR) { - LOGE("receive msg:%d, not CAMERA_ALGORITHM_MSG_IPC_ERROR", msg); - return; - } - - std::lock_guard l(mIPCStatusMutex); - mIPCStatus = false; - - if (mErrCb) { - camera_msg_data_t data = {CAMERA_IPC_ERROR, {}}; - mErrCb->notify(mErrCb, data); - } else { - LOGE("mErrCb is nullptr, no device error is sent out"); - } - LOGE("receive CAMERA_ALGORITHM_MSG_IPC_ERROR"); -} - -void IntelAlgoClient::returnCallback(const camera_algorithm_callback_ops_t* callback_ops, - uint32_t req_id, uint32_t status, int32_t buffer_handle) { - CheckAndLogError(!callback_ops, VOID_VALUE, "callback_ops is nullptr"); - - auto s = const_cast(static_cast(callback_ops)); - s->callbackHandler(req_id, status, buffer_handle); -} - -void IntelAlgoClient::notifyCallback(const struct camera_algorithm_callback_ops* callback_ops, - camera_algorithm_error_msg_code_t msg) { - CheckAndLogError(!callback_ops, VOID_VALUE, "callback_ops is nullptr"); - - auto s = const_cast(static_cast(callback_ops)); - s->notifyHandler((uint32_t)msg); -} - -IntelAlgoClient::Runner::Runner(IPC_GROUP group, cros::CameraAlgorithmBridge* bridge) - : mGroup(group), - mBridge(bridge), - mIsCallbacked(false), - mCbStatus(OK), - mInitialized(false) { - LOG1("Runner Construct group:%d", mGroup); - - pthread_condattr_t attr; - int ret = pthread_condattr_init(&attr); - if (ret != 0) { - LOGE("call pthread_condattr_init fails, ret:%d", ret); - pthread_condattr_destroy(&attr); - return; - } - - ret = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); - if (ret != 0) { - LOGE("call pthread_condattr_setclock fails, ret:%d", ret); - pthread_condattr_destroy(&attr); - return; - } - - ret = pthread_cond_init(&mCbCond, &attr); - if (ret != 0) { - LOGE("call pthread_cond_init fails, ret:%d", ret); - pthread_condattr_destroy(&attr); - return; - } - - pthread_condattr_destroy(&attr); - - ret = pthread_mutex_init(&mCbLock, nullptr); - CheckAndLogError(ret != 0, VOID_VALUE, "call pthread_mutex_init fails, ret:%d", ret); - - mInitialized = true; -} - -IntelAlgoClient::Runner::~Runner() { - LOG1("Runner Destroy, group:%d", mGroup); - - int ret = pthread_cond_destroy(&mCbCond); - if (ret != 0) { - LOGE("call pthread_cond_destroy fails, ret:%d", ret); - } - - ret = pthread_mutex_destroy(&mCbLock); - if (ret != 0) { - LOGE("call pthread_mutex_destroy fails, ret:%d", ret); - } -} - -int IntelAlgoClient::Runner::requestSync(IPC_CMD cmd, int32_t bufferHandle) { - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "mInitialized is false, cmd:%d:%s", cmd, - IntelAlgoIpcCmdToString(cmd)); - - std::lock_guard lck(mMutex); - - std::vector reqHeader(IPC_REQUEST_HEADER_USED_NUM); - reqHeader[0] = IPC_MATCHING_KEY; - - // cmd is for request id, no duplicate command will be issued at any given time. - mBridge->Request(cmd, reqHeader, bufferHandle); - int ret = waitCallback(); - CheckAndLogError((ret != OK), UNKNOWN_ERROR, "waitCallback fails, cmd:%d:%s", cmd, - IntelAlgoIpcCmdToString(cmd)); - - // check callback result - CheckAndLogError((mCbStatus != OK && mCbStatus != ia_err_not_run), mCbStatus, - "callback fails, cmd:%d:%s, mCbStatus:%d", cmd, IntelAlgoIpcCmdToString(cmd), - mCbStatus); - - return mCbStatus; -} - -void IntelAlgoClient::Runner::callbackHandler(uint32_t status, int32_t buffer_handle) { - if (status != 0 && status != ia_err_not_run) { - LOGE("Runner callbackHandler group:%d, status:%d, buffer_handle:%d", mGroup, status, - buffer_handle); - } - mCbStatus = status; - - pthread_mutex_lock(&mCbLock); - mIsCallbacked = true; - int ret = pthread_cond_signal(&mCbCond); - pthread_mutex_unlock(&mCbLock); - - CheckAndLogError(ret != 0, VOID_VALUE, "group:%d, call pthread_cond_signal fails, ret:%d", - mGroup, ret); -} - -int IntelAlgoClient::Runner::waitCallback() { - nsecs_t startTime = CameraUtils::systemTime(); - - pthread_mutex_lock(&mCbLock); - if (!mIsCallbacked) { - int ret = 0; - struct timespec ts = {0, 0}; - clock_gettime(CLOCK_MONOTONIC, &ts); - ts.tv_sec += 5; // 5s timeout - - while (!mIsCallbacked && !ret) { - ret = pthread_cond_timedwait(&mCbCond, &mCbLock, &ts); - } - if (ret != 0) { - LOGE("%s, group:%d, call pthread_cond_timedwait fail, ret:%d, it takes %" PRId64 " ms", - __func__, mGroup, ret, (CameraUtils::systemTime() - startTime) / 1000000); - pthread_mutex_unlock(&mCbLock); - return UNKNOWN_ERROR; - } - } - mIsCallbacked = false; - pthread_mutex_unlock(&mCbLock); - - LOG2("%s, group:%d IPC call takes %" PRId64 " ms", __func__, mGroup, - (CameraUtils::systemTime() - startTime) / 1000000); - - return OK; -} - -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelAlgoClient.h b/modules/sandboxing/client/IntelAlgoClient.h deleted file mode 100644 index 30c57e85..00000000 --- a/modules/sandboxing/client/IntelAlgoClient.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include -#include -#include -#include - -#include "CameraLog.h" -#include "Parameters.h" -#include "base/functional/bind.h" -#include "base/functional/callback.h" -#include "cros-camera/camera_algorithm_bridge.h" -#include "iutils/Thread.h" -#include "modules/sandboxing/IPCCommon.h" - -namespace icamera { - -typedef enum { - CPU_ALGO_SHM, - GPU_ALGO_SHM, - MAX_ALGO_SHM, -} ShmMemUsage; - -class IntelAlgoClient : public camera_algorithm_callback_ops_t { - public: - static IntelAlgoClient* getInstance(); - static void releaseInstance(); - - IntelAlgoClient(); - virtual ~IntelAlgoClient(); - - void setMojoManagerToken(cros::CameraMojoChannelManagerToken* token) { - mMojoManagerToken = token; - } - - // Connect to the algo processes(cpu and gpu) - // It must be called after all preparation are ready in camera service - int initialize(); - - bool isIPCFine(); - - // when IPC error happens, device error - // will be sent out via the camera_callback_ops_t which belongs to CameraHal. - // before the CameraHal be terminated, set nullptr in the function. - void registerErrorCallback(const camera_callback_ops_t* errCb); - - int allocateShmMem(const std::string& name, int size, int* fd, void** addr); - void releaseShmMem(const std::string& name, int size, int fd, void* addr); - - int requestSync(IPC_CMD cmd, int32_t bufferHandle); - int requestSync(IPC_CMD cmd); - - int32_t registerBuffer(int bufferFd, void* addr, ShmMemUsage usage = CPU_ALGO_SHM); - void deregisterBuffer(int32_t bufferHandle, ShmMemUsage usage = CPU_ALGO_SHM); - int32_t registerGbmBuffer(int bufferFd, ShmMemUsage usage = CPU_ALGO_SHM); - void deregisterGbmBuffer(int32_t bufferHandle, ShmMemUsage usage = CPU_ALGO_SHM); - int32_t getBufferHandle(void* addr, ShmMemUsage usage = CPU_ALGO_SHM); - - private: - int waitCallback(); - - void callbackHandler(uint32_t req_id, uint32_t status, int32_t buffer_handle); - void notifyHandler(uint32_t msg); - - // when the request is done, the callback will be received. - static void returnCallback(const camera_algorithm_callback_ops_t* callback_ops, uint32_t req_id, - uint32_t status, int32_t buffer_handle); - // when IPC error happens in the bridge, notifyCallback will be called. - static void notifyCallback(const struct camera_algorithm_callback_ops* callback_ops, - camera_algorithm_error_msg_code_t msg); - - private: - /* - * Get access to the IntelAlgoClient singleton. - */ - static IntelAlgoClient* sInstance; - static Mutex sLock; // Guard for singleton creation. - - const camera_callback_ops_t* mErrCb; - - std::unique_ptr mBridge; - std::unique_ptr mGpuBridge; - - base::RepeatingCallback mCallback; - base::RepeatingCallback mNotifyCallback; - bool mIPCStatus; // true: no error happens, false: error happens - std::mutex mIPCStatusMutex; // the mutex for mIPCStatus - - // - std::unordered_map mShmMap[MAX_ALGO_SHM]; - std::mutex mShmMapMutex; // the mutex for mShmMap - - cros::CameraMojoChannelManagerToken* mMojoManagerToken; - bool mInitialized; - - private: - class Runner { - public: - Runner(IPC_GROUP group, cros::CameraAlgorithmBridge* bridge); - virtual ~Runner(); - int requestSync(IPC_CMD cmd, int32_t bufferHandle); - void callbackHandler(uint32_t status, int32_t buffer_handle); - - private: - int waitCallback(); - - private: - IPC_GROUP mGroup; - cros::CameraAlgorithmBridge* mBridge; - pthread_mutex_t mCbLock; - pthread_cond_t mCbCond; - bool mIsCallbacked; - int mCbStatus; - - bool mInitialized; - - std::mutex mMutex; // the mutex for the public method - }; - - std::unique_ptr mRunner[IPC_GROUP_NUM]; -}; - -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelAlgoCommonClient.cpp b/modules/sandboxing/client/IntelAlgoCommonClient.cpp deleted file mode 100644 index a4e3a46c..00000000 --- a/modules/sandboxing/client/IntelAlgoCommonClient.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelAlgoCommonClient - -#include "modules/sandboxing/client/IntelAlgoCommonClient.h" - -#include -#include - -#include "CameraLog.h" -#include "PlatformData.h" - -namespace icamera { -IntelAlgoCommon::IntelAlgoCommon() { - mClient = IntelAlgoClient::getInstance(); - LOG1("@%s, Construct, mClient:%p", __func__, mClient); -} - -IntelAlgoCommon::~IntelAlgoCommon() { - LOG1("@%s Destroy", __func__); -} - -bool IntelAlgoCommon::allocShmMem(const std::string& name, int size, ShmMemInfo* shm, - ShmMemUsage usage) { - CheckAndLogError(mClient == nullptr, false, "@%s, mClient is nullptr", __func__); - - shm->mName = name; - shm->mSize = size; - int ret = mClient->allocateShmMem(shm->mName, shm->mSize, &shm->mFd, &shm->mAddr); - CheckAndLogError((ret != OK), false, "@%s, call allocateShmMem fail", __func__); - - shm->mHandle = mClient->registerBuffer(shm->mFd, shm->mAddr, usage); - if (shm->mHandle < 0) { - LOGE("@%s, call mBridge->RegisterBuffer fail", __func__); - mClient->releaseShmMem(shm->mName, shm->mSize, shm->mFd, shm->mAddr); - return false; - } - - return true; -} - -int32_t IntelAlgoCommon::registerGbmBuffer(int bufferFd, ShmMemUsage usage) { - CheckAndLogError(mClient == nullptr, -1, "@%s, mClient is nullptr", __func__); - - return mClient->registerGbmBuffer(bufferFd, usage); -} - -void IntelAlgoCommon::deregisterGbmBuffer(int32_t bufferHandle, ShmMemUsage usage) { - CheckAndLogError(mClient == nullptr, VOID_VALUE, "@%s, mClient is nullptr", __func__); - - mClient->deregisterGbmBuffer(bufferHandle, usage); -} - -bool IntelAlgoCommon::requestSync(IPC_CMD cmd, int32_t handle) { - CheckAndLogError(mClient == nullptr, false, "@%s, mClient is nullptr", __func__); - - return mClient->requestSync(cmd, handle) == OK ? true : false; -} - -bool IntelAlgoCommon::requestSync(IPC_CMD cmd) { - CheckAndLogError(mClient == nullptr, false, "@%s, mClient is nullptr", __func__); - - return mClient->requestSync(cmd) == OK ? true : false; -} - -ia_err IntelAlgoCommon::requestSyncCca(IPC_CMD cmd, int32_t handle) { - CheckAndLogError(mClient == nullptr, ia_err_argument, "@%s, mClient is nullptr", __func__); - - return (ia_err)(mClient->requestSync(cmd, handle)); -} - -ia_err IntelAlgoCommon::requestSyncCca(IPC_CMD cmd) { - CheckAndLogError(mClient == nullptr, ia_err_argument, "@%s, mClient is nullptr", __func__); - - return (ia_err)(mClient->requestSync(cmd)); -} - -void IntelAlgoCommon::freeShmMem(const ShmMemInfo& shm, ShmMemUsage usage) { - CheckAndLogError(mClient == nullptr, VOID_VALUE, "@%s, mClient is nullptr", __func__); - if (shm.mHandle < 0 || shm.mFd < 0) { - LOGE("@%s, mHandle:%d, mFd:%d, one of them < 0", __func__, shm.mHandle, shm.mFd); - return; - } - - mClient->deregisterBuffer(shm.mHandle, usage); - mClient->releaseShmMem(shm.mName, shm.mSize, shm.mFd, shm.mAddr); -} - -bool IntelAlgoCommon::allocateAllShmMems(std::vector* mems) { - for (auto& it : *mems) { - ShmMemInfo* mem = it.mem; - mem->mName = it.name; - mem->mSize = it.size; - bool ret = allocShmMem(mem->mName, mem->mSize, mem); - CheckAndLogError(!ret, false, "@%s, allocShmMem fails, name:%s, size:%d", __func__, - mem->mName.c_str(), mem->mSize); - it.allocated = true; - } - - return true; -} - -void IntelAlgoCommon::releaseAllShmMems(const std::vector& mems) { - for (auto& it : mems) { - if (it.allocated) { - freeShmMem(*it.mem); - } - } -} - -int32_t IntelAlgoCommon::getShmMemHandle(void* addr, ShmMemUsage usage) { - CheckAndLogError(mClient == nullptr, -1, "@%s, mClient is nullptr", __func__); - return mClient->getBufferHandle(addr, usage); -} - -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelAlgoCommonClient.h b/modules/sandboxing/client/IntelAlgoCommonClient.h deleted file mode 100644 index a127352b..00000000 --- a/modules/sandboxing/client/IntelAlgoCommonClient.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "IntelAlgoClient.h" - -namespace icamera { -typedef struct ShmMemInfo { - std::string mName; - int mSize; - int mFd; - void* mAddr; - int32_t mHandle; - ShmMemInfo() : mName(""), mSize(0), mFd(-1), mAddr(nullptr), mHandle(-1) {} -} ShmMemInfo; - -typedef struct ShmMem { - std::string name; - int size; - ShmMemInfo* mem; - bool allocated; -} ShmMem; - -class IntelAlgoCommon { - public: - IntelAlgoCommon(); - virtual ~IntelAlgoCommon(); - - bool allocShmMem(const std::string& name, int size, ShmMemInfo* shm, - ShmMemUsage usage = CPU_ALGO_SHM); - int32_t registerGbmBuffer(int bufferFd, ShmMemUsage usage = CPU_ALGO_SHM); - void deregisterGbmBuffer(int32_t bufferHandle, ShmMemUsage usage = CPU_ALGO_SHM); - bool requestSync(IPC_CMD cmd, int32_t handle); - bool requestSync(IPC_CMD cmd); - ia_err requestSyncCca(IPC_CMD cmd, int32_t handle); - ia_err requestSyncCca(IPC_CMD cmd); - void freeShmMem(const ShmMemInfo& shm, ShmMemUsage usage = CPU_ALGO_SHM); - - bool allocateAllShmMems(std::vector* mems); - void releaseAllShmMems(const std::vector& mems); - - int32_t getShmMemHandle(void* addr, ShmMemUsage usage = CPU_ALGO_SHM); - - private: - IntelAlgoClient* mClient; -}; - -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelCcaClient.cpp b/modules/sandboxing/client/IntelCcaClient.cpp deleted file mode 100644 index 31795180..00000000 --- a/modules/sandboxing/client/IntelCcaClient.cpp +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelCcaClient - -#include "modules/sandboxing/client/IntelCcaClient.h" - -#include - -#include "PlatformData.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -std::vector IntelCca::sCcaInstance; -Mutex IntelCca::sLock; - -IntelCca* IntelCca::getInstance(int cameraId, TuningMode mode) { - AutoMutex lock(sLock); - for (auto& it : sCcaInstance) { - if (cameraId == it.cameraId) { - if (it.ccaHandle.find(mode) == it.ccaHandle.end()) { - it.ccaHandle[mode] = new IntelCca(cameraId, mode); - } - - return it.ccaHandle[mode]; - } - } - - IntelCca::CCAHandle handle = {}; - handle.cameraId = cameraId; - handle.ccaHandle[mode] = new IntelCca(cameraId, mode); - sCcaInstance.push_back(handle); - - return handle.ccaHandle[mode]; -} - -void IntelCca::releaseInstance(int cameraId, TuningMode mode) { - AutoMutex lock(sLock); - for (auto& it : sCcaInstance) { - if (cameraId == it.cameraId && it.ccaHandle.find(mode) != it.ccaHandle.end()) { - IntelCca* cca = it.ccaHandle[mode]; - it.ccaHandle.erase(mode); - delete cca; - } - } -} - -void IntelCca::releaseAllInstances() { - AutoMutex lock(sLock); - - for (auto& it : sCcaInstance) { - for (auto& oneCcaHandle : it.ccaHandle) { - IntelCca* intelCca = oneCcaHandle.second; - delete intelCca; - } - it.ccaHandle.clear(); - } -} - -IntelCca::IntelCca(int cameraId, TuningMode mode) - : mCameraId(cameraId), - mTuningMode(mode), - mHasMknData(false) { - LOG1(" @%s, tuningMode:%d", cameraId, __func__, mode); - - std::string number = std::to_string(cameraId) + std::to_string(mode) + - std::to_string(reinterpret_cast(this)); - std::string structName = "/ccaStruct" + number + SHM_NAME; - std::string initName = "/ccaInit" + number + SHM_NAME; - std::string aecName = "/ccaAec" + number + SHM_NAME; - std::string aiqName = "/ccaAiq" + number + SHM_NAME; - std::string ltmName = "/ccaLtm" + number + SHM_NAME; - std::string zoomName = "/ccaZoom" + number + SHM_NAME; - std::string dvsName = "/ccaDvs" + number + SHM_NAME; - std::string aicName = "/ccaAic" + number + SHM_NAME; - std::string cmcName = "/ccaCmc" + number + SHM_NAME; - std::string aiqdName = "/ccaAiqd" + number + SHM_NAME; - std::string tuningName = "/ccaTuning" + number + SHM_NAME; - std::string deinitName = "/ccaDeinit" + number + SHM_NAME; - std::string decodeStatsName = "/ccaDecodeStats" + number + SHM_NAME; - std::string palSizeName = "/ccaPalSize" + number + SHM_NAME; - - mMems = { - {structName.c_str(), sizeof(intel_cca_struct_data), &mMemStruct, false}, - {initName.c_str(), sizeof(intel_cca_init_data), &mMemInit, false}, - {aecName.c_str(), sizeof(intel_cca_run_aec_data), &mMemAEC, false}, - {aiqName.c_str(), sizeof(intel_cca_run_aiq_data), &mMemAIQ, false}, - {ltmName.c_str(), sizeof(intel_cca_run_ltm_data), &mMemLTM, false}, - {zoomName.c_str(), sizeof(intel_cca_update_zoom_data), &mMemZoom, false}, - {dvsName.c_str(), sizeof(intel_cca_run_dvs_data), &mMemDVS, false}, - {aicName.c_str(), sizeof(intel_cca_run_aic_data), &mMemAIC, false}, - {cmcName.c_str(), sizeof(intel_cca_get_cmc_data), &mMemCMC, false}, - {aiqdName.c_str(), sizeof(intel_cca_get_aiqd_data), &mMemAIQD, false}, - {tuningName.c_str(), sizeof(intel_cca_update_tuning_data), &mMemTuning, false}, - {deinitName.c_str(), sizeof(intel_cca_deinit_data), &mMemDeinit, false}, - {decodeStatsName.c_str(), sizeof(intel_cca_decode_stats_data), &mMemDecodeStats, false}, - {palSizeName.c_str(), sizeof(intel_cca_get_pal_data_size), &mMemPalSize, false}}; - - bool success = mCommon.allocateAllShmMems(&mMems); - if (!success) { - mCommon.releaseAllShmMems(mMems); - return; - } - - // construct the remote CCA - intel_cca_struct_data* params = static_cast(mMemStruct.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - mCommon.requestSyncCca(IPC_CCA_CONSTRUCT, mMemStruct.mHandle); - - LOG1("@%s, Construct done", __func__); -} - -IntelCca::~IntelCca() { - LOG1(" @%s, tuningMode:%d", mCameraId, __func__, mTuningMode); - - // destruct the remote CCA - intel_cca_struct_data* params = static_cast(mMemStruct.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - mCommon.requestSyncCca(IPC_CCA_DESTRUCT, mMemStruct.mHandle); - - mCommon.releaseAllShmMems(mMems); - - for (auto& it : mMemsOuter) { - mCommon.freeShmMem(it.second); - } - mMemsOuter.clear(); - - freeStatsDataMem(); -} - -ia_err IntelCca::init(const cca::cca_init_params& initParams) { - LOG1(" @%s, tuningMode:%d, bitmap:0x%x", mCameraId, __func__, mTuningMode, - initParams.bitmap); - - intel_cca_init_data* params = static_cast(mMemInit.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - params->inParams = initParams; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_INIT, mMemInit.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - return ret; -} - -ia_err IntelCca::decodeStats(uint64_t statsPointer, uint32_t statsSize, uint32_t bitmap, - ia_isp_bxt_statistics_query_results_t* results, - cca::cca_out_stats* outStats) { - LOG2(" @%s, tuningMode:%d, statsPointer:0x%lx, statsSize:%d, bitmap:0x%x", mCameraId, - __func__, mTuningMode, statsPointer, statsSize, bitmap); - - if (results) return ia_err_none; - - intel_cca_run_aec_data* aecParams = static_cast(mMemAEC.mAddr); - intel_cca_decode_stats_data* params = &aecParams->decodeStatsParams; - - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - params->statsHandle = mCommon.getShmMemHandle(reinterpret_cast(statsPointer)); - params->statsBuffer.data = nullptr; - params->statsBuffer.size = statsSize; - params->bitmap = bitmap; - params->outStats.get_rgbs_stats = false; - aecParams->hasDecodeStats = true; - - return ia_err_none; -} - -ia_err IntelCca::setStatsParams(const cca::cca_stats_params& params) { - LOG2(" @%s, tuningMode:%d, in params size:%zu", mCameraId, __func__, mTuningMode, - sizeof(cca::cca_stats_params)); - - // Set stats when running AEC - intel_cca_run_aec_data* aecParams = static_cast(mMemAEC.mAddr); - aecParams->inStatsParams = params; - aecParams->hasStats = true; - - return ia_err_none; -} - -ia_err IntelCca::runAEC(uint64_t frameId, const cca::cca_ae_input_params& params, - cca::cca_ae_results* results) { - LOG2(" @%s, tuningMode:%d, in params size:%zu, results size:%zu", mCameraId, - frameId, __func__, mTuningMode, sizeof(cca::cca_ae_input_params), - sizeof(cca::cca_ae_results)); - - CheckAndLogError(!results, ia_err_argument, "@%s, results is nullptr", __func__); - - intel_cca_run_aec_data* aecParams = static_cast(mMemAEC.mAddr); - aecParams->cameraId = mCameraId; - aecParams->tuningMode = mTuningMode; - aecParams->frameId = frameId; - aecParams->inParams = params; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_RUN_AEC, mMemAEC.mHandle); - aecParams->hasStats = false; - - if (aecParams->hasDecodeStats) { - LOG2("%s, query results: rgbs_grid(%d), af_grid(%d), dvs_stats(%d)", __func__, - aecParams->decodeStatsParams.results.rgbs_grid, - aecParams->decodeStatsParams.results.af_grid, - aecParams->decodeStatsParams.results.dvs_stats); - aecParams->hasDecodeStats = false; - } - - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - *results = aecParams->results; - - return ret; -} - -ia_err IntelCca::runAIQ(uint64_t frameId, const cca::cca_aiq_params& params, - cca::cca_aiq_results* results, camera_makernote_mode_t mode) { - LOG2(" @%s, tuningMode:%d, in params size:%zu, results size:%zu", mCameraId, - frameId, __func__, mTuningMode, sizeof(cca::cca_aiq_params), sizeof(cca::cca_aiq_results)); - CheckAndLogError(!results, ia_err_argument, "@%s, results is nullptr", __func__); - - intel_cca_run_aiq_data* aiqParams = static_cast(mMemAIQ.mAddr); - aiqParams->cameraId = mCameraId; - aiqParams->tuningMode = mTuningMode; - aiqParams->frameId = frameId; - aiqParams->inParams = params; - - aiqParams->mknResultsHandle = -1; - bool dump = false; - void* ptr = PlatformData::getMakernoteBuf(mCameraId, mode, dump); - if (ptr) { - aiqParams->mknResults = static_cast(ptr); - aiqParams->type = - ((mode == MAKERNOTE_MODE_JPEG) || dump ? ia_mkn_trg_section_1 : ia_mkn_trg_section_2); - aiqParams->mknResultsHandle = mCommon.getShmMemHandle(aiqParams->mknResults); - } - - aiqParams->aiqResultHandle = mCommon.getShmMemHandle(results); - CheckAndLogError(aiqParams->aiqResultHandle < 0, ia_err_nomemory, "Failed to get result buf"); - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_RUN_AIQ, mMemAIQ.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - if (aiqParams->mknResultsHandle >= 0) mHasMknData = true; - - return ret; -} - -ia_err IntelCca::runLTM(uint64_t frameId, const cca::cca_ltm_input_params& params) { - LOG2(" @%s, tuningMode:%d, in params size:%zu", mCameraId, frameId, __func__, - mTuningMode, sizeof(cca::cca_ltm_input_params)); - intel_cca_run_ltm_data* ltmParams = static_cast(mMemLTM.mAddr); - ltmParams->cameraId = mCameraId; - ltmParams->tuningMode = mTuningMode; - ltmParams->frameId = frameId; - ltmParams->inParams = params; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_RUN_LTM, mMemLTM.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - return ret; -} - -ia_err IntelCca::updateZoom(uint32_t streamId, const cca::cca_dvs_zoom& params) { - LOG1(" @%s, tuningMode:%d, streamId: %u", mCameraId, __func__, mTuningMode, streamId); - - intel_cca_update_zoom_data* zoomParams = - static_cast(mMemZoom.mAddr); - zoomParams->cameraId = mCameraId; - zoomParams->tuningMode = mTuningMode; - zoomParams->inParams = params; - zoomParams->streamId = streamId; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_UPDATE_ZOOM, mMemZoom.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - return ret; -} - -ia_err IntelCca::runDVS(uint32_t streamId, uint64_t frameId) { - LOG2(" @%s, tuningMode:%d, streamId: %u", mCameraId, frameId, __func__, - mTuningMode, streamId); - - intel_cca_run_dvs_data* params = static_cast(mMemDVS.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - params->frameId = frameId; - params->streamId = streamId; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_RUN_DVS, mMemDVS.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - return ret; -} - -ia_err IntelCca::runAIC(uint64_t frameId, cca::cca_pal_input_params* params, ia_binary_data* pal) { - CheckAndLogError(!params, ia_err_argument, "@%s, params is nullptr", __func__); - CheckAndLogError(!pal, ia_err_argument, "@%s, pal is nullptr", __func__); - - intel_cca_run_aic_data* aicParams = static_cast(mMemAIC.mAddr); - aicParams->cameraId = mCameraId; - aicParams->tuningMode = mTuningMode; - aicParams->frameId = frameId; - aicParams->inParams = params; - aicParams->inParamsHandle = mCommon.getShmMemHandle(params); - aicParams->palOutData = *pal; - - int32_t palDataHandle = mCommon.getShmMemHandle(pal->data); - CheckAndLogError(!palDataHandle, ia_err_general, "%s, pal buf:%p is not in SHM", __func__, - pal->data); - aicParams->palDataHandle = palDataHandle; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_RUN_AIC, mMemAIC.mHandle); - CheckAndLogError(ret != ia_err_none && ret != ia_err_not_run, ia_err_general, - "@%s, requestSyncCca fails", __func__); - pal->size = aicParams->palOutData.size; - LOG2(" @%s, tuningMode:%d, in params size:%zu pal size:%d", mCameraId, frameId, - __func__, mTuningMode, sizeof(cca::cca_pal_input_params), pal->size); - - return ret; -} - -ia_err IntelCca::getCMC(cca::cca_cmc* cmc, const cca::cca_cpf* cpf) { - CheckAndLogError(!cmc, ia_err_argument, "@%s, cmc is nullptr", __func__); - - intel_cca_get_cmc_data* params = static_cast(mMemCMC.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - if (cpf && cpf->size) { - MEMCPY_S(params->cpf.buf, cca::MAX_CPF_LEN, cpf->buf, cpf->size); - params->cpf.size = cpf->size; - } else { - params->cpf.size = 0; - } - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_GET_CMC, mMemCMC.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - *cmc = params->results; - - return ret; -} - -ia_err IntelCca::getMKN(ia_mkn_trg type, cca::cca_mkn* mkn) { - UNUSED(type); - UNUSED(mkn); - - // get MKN when calling runAIQ API - if (!mHasMknData) return ia_err_general; - mHasMknData = false; - - return ia_err_none; -} - -ia_err IntelCca::getAiqd(cca::cca_aiqd* aiqd) { - CheckAndLogError(!aiqd, ia_err_argument, "@%s, aiqd is nullptr", __func__); - - intel_cca_get_aiqd_data* params = static_cast(mMemAIQD.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_GET_AIQD, mMemAIQD.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - *aiqd = params->results; - - return ret; -} - -ia_err IntelCca::updateTuning(uint8_t lardTags, const ia_lard_input_params& lardParams, - const cca::cca_nvm& nvm, int32_t streamId) { - LOG2(" @%s, tuningMode:%d", mCameraId, __func__, mTuningMode); - - intel_cca_update_tuning_data* params = - static_cast(mMemTuning.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - params->lardTags = lardTags; - params->lardParams = lardParams; - params->nvmParams = nvm; - params->streamId = streamId; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_UPDATE_TUNING, mMemTuning.mHandle); - CheckAndLogError(ret != ia_err_none, ia_err_general, "@%s, requestSyncCca fails", __func__); - - return ret; -} - -bool IntelCca::allocStatsDataMem(unsigned int size) { - LOG1(" @%s, tuningMode:%d, size:%d", mCameraId, __func__, mTuningMode, size); - - freeStatsDataMem(); - - AutoMutex l(mMemStatsMLock); - for (int i = 0; i < kMaxQueueSize; i++) { - std::string number = std::to_string(i) + std::to_string(mCameraId) + - std::to_string(mTuningMode) + - std::to_string(reinterpret_cast(this)); - std::string finalName = "statsData" + number + SHM_NAME; - StatsBufInfo info = {}; - bool ret = mCommon.allocShmMem(finalName, size, &info.shmMem); - CheckAndLogError(ret == false, false, "mCommon.allocShmMem failed for stats data"); - info.usedSize = size; - info.bufSize = size; - - LOG1("the buffer handle: %d, address: %p", info.shmMem.mHandle, info.shmMem.mAddr); - int64_t index = i * (-1) - 1; // default index list: -1, -2, -3, ... - mMemStatsInfoMap[index] = info; - } - - return true; -} - -void IntelCca::freeStatsDataMem() { - LOG1(" @%s, tuningMode:%d", mCameraId, __func__, mTuningMode); - - AutoMutex l(mMemStatsMLock); - for (auto it = mMemStatsInfoMap.begin(); it != mMemStatsInfoMap.end(); ++it) { - mCommon.freeShmMem(it->second.shmMem); - } - - mMemStatsInfoMap.clear(); -} - -void* IntelCca::getStatsDataBuffer() { - AutoMutex l(mMemStatsMLock); - if (mMemStatsInfoMap.empty()) return nullptr; - - ShmMemInfo memInfo = mMemStatsInfoMap.begin()->second.shmMem; - - return memInfo.mAddr; -} - -void IntelCca::decodeHwStatsDone(int64_t sequence, unsigned int byteUsed) { - LOG2(" @%s, tuningMode:%d, byteUsed:%d", mCameraId, sequence, __func__, - mTuningMode, byteUsed); - - AutoMutex l(mMemStatsMLock); - if (mMemStatsInfoMap.empty() || mMemStatsInfoMap.count(sequence) > 0) return; - - auto it = mMemStatsInfoMap.begin(); - it->second.usedSize = byteUsed; - mMemStatsInfoMap[sequence] = it->second; - - if (sequence != it->first) mMemStatsInfoMap.erase(it->first); -} - -void* IntelCca::fetchHwStatsData(int64_t sequence, unsigned int* byteUsed) { - CheckAndLogError(!byteUsed, nullptr, "byteUsed is nullptr"); - - AutoMutex l(mMemStatsMLock); - if (mMemStatsInfoMap.find(sequence) != mMemStatsInfoMap.end()) { - *byteUsed = mMemStatsInfoMap[sequence].usedSize; - ShmMemInfo memInfo = mMemStatsInfoMap[sequence].shmMem; - LOG2(" @%s, tuningMode:%d, memInfo.mAddr %p", mCameraId, sequence, __func__, - mTuningMode, memInfo.mAddr); - return memInfo.mAddr; - } - - return nullptr; -} - -void IntelCca::deinit() { - LOG1(" @%s, tuningMode:%d", mCameraId, __func__, mTuningMode); - - intel_cca_deinit_data* params = static_cast(mMemDeinit.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_DEINIT, mMemDeinit.mHandle); - CheckAndLogError(ret != ia_err_none, VOID_VALUE, "@%s, requestSyncCca fails", __func__); -} - -uint32_t IntelCca::getPalDataSize(const cca::cca_program_group& programGroup) { - intel_cca_get_pal_data_size* params = - static_cast(mMemPalSize.mAddr); - params->cameraId = mCameraId; - params->tuningMode = mTuningMode; - params->pg = programGroup; - - ia_err ret = mCommon.requestSyncCca(IPC_CCA_GET_PAL_SIZE, mMemPalSize.mHandle); - CheckAndLogError(ret != ia_err_none, 0, "@%s, requestSyncCca fails", __func__); - LOG2(" @%s, tuningMode:%d, in params size:%zu, returnSize:%d", mCameraId, __func__, - mTuningMode, sizeof(cca::cca_program_group), params->returnSize); - - return params->returnSize; -} - -void* IntelCca::allocMem(int streamId, const std::string& name, int index, int size) { - std::string number = std::to_string(streamId) + std::to_string(index) + - std::to_string(mCameraId) + std::to_string(mTuningMode) + - std::to_string(reinterpret_cast(this)); - std::string finalName = name + number + SHM_NAME; - - ShmMemInfo memInfo = {}; - bool ret = mCommon.allocShmMem(finalName, size, &memInfo); - CheckAndLogError(ret == false, nullptr, "%s, mCommon.allocShmMem fails for pal buf", __func__); - LOG1(" @%s, tuningMode:%d, name:%s, index:%d, streamId:%d, size:%d, handle: %d," - "address: %p", - mCameraId, __func__, mTuningMode, name.c_str(), index, streamId, size, memInfo.mHandle, - memInfo.mAddr); - mMemsOuter[memInfo.mAddr] = memInfo; - - return memInfo.mAddr; -} - -void IntelCca::freeMem(void* addr) { - LOG1(" @%s, tuningMode:%d, addr: %p", mCameraId, __func__, mTuningMode, addr); - - if (mMemsOuter.find(addr) != mMemsOuter.end()) { - mCommon.freeShmMem(mMemsOuter[addr]); - mMemsOuter.erase(addr); - return; - } - LOGW("@%s, there is no addr:%p, in the mMemsOuter", __func__, addr); -} -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelCcaClient.h b/modules/sandboxing/client/IntelCcaClient.h deleted file mode 100644 index b36d0117..00000000 --- a/modules/sandboxing/client/IntelCcaClient.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include - -#include "CameraTypes.h" -#include "IntelAlgoCommonClient.h" -#include "iutils/Thread.h" -#include "modules/sandboxing/IPCIntelCca.h" - -namespace icamera { -class IntelCca { - public: - static IntelCca* getInstance(int cameraId, TuningMode mode); - static void releaseInstance(int cameraId, TuningMode mode); - static void releaseAllInstances(); - - ia_err init(const cca::cca_init_params& initParams); - - ia_err setStatsParams(const cca::cca_stats_params& params); - - ia_err runAEC(uint64_t frameId, const cca::cca_ae_input_params& params, - cca::cca_ae_results* results); - ia_err runAIQ(uint64_t frameId, const cca::cca_aiq_params& params, - cca::cca_aiq_results* results, camera_makernote_mode_t mode = MAKERNOTE_MODE_OFF); - - ia_err runLTM(uint64_t frameId, const cca::cca_ltm_input_params& params); - - ia_err updateZoom(uint32_t streamId, const cca::cca_dvs_zoom& params); - - ia_err runDVS(uint32_t streamId, uint64_t frameId); - - ia_err runAIC(uint64_t frameId, cca::cca_pal_input_params* params, ia_binary_data* pal); - - ia_err getCMC(cca::cca_cmc* cmc, const cca::cca_cpf* cpf = nullptr); - ia_err getMKN(ia_mkn_trg type, cca::cca_mkn* mkn); - ia_err getAiqd(cca::cca_aiqd* aiqd); - ia_err updateTuning(uint8_t lardTags, const ia_lard_input_params& lardParams, - const cca::cca_nvm& nvm, int32_t streamId); - - bool allocStatsDataMem(unsigned int size); - void* getStatsDataBuffer(); - void decodeHwStatsDone(int64_t sequence, unsigned int byteUsed); - void* fetchHwStatsData(int64_t sequence, unsigned int* byteUsed); - - void deinit(); - - // No decoding here because decoding should be done - // in IPC_CCA_RUN_AEC or IPC_PG_PARAM_DECODE if it is required. - ia_err decodeStats(uint64_t statsPointer, uint32_t statsSize, uint32_t bitmap, - ia_isp_bxt_statistics_query_results_t* results = nullptr, - cca::cca_out_stats* outStats = nullptr); - - uint32_t getPalDataSize(const cca::cca_program_group& programGroup); - void* allocMem(int streamId, const std::string& name, int index, int size); - void freeMem(void* addr); - - private: - IntelCca(int cameraId, TuningMode mode); - virtual ~IntelCca(); - void freeStatsDataMem(); - - private: - int mCameraId; - TuningMode mTuningMode; - bool mHasMknData; - - IntelAlgoCommon mCommon; - - ShmMemInfo mMemStruct; - ShmMemInfo mMemInit; - ShmMemInfo mMemAEC; - ShmMemInfo mMemAIQ; - ShmMemInfo mMemLTM; - ShmMemInfo mMemZoom; - ShmMemInfo mMemDVS; - ShmMemInfo mMemAIC; - ShmMemInfo mMemCMC; - ShmMemInfo mMemAIQD; - ShmMemInfo mMemTuning; - ShmMemInfo mMemDeinit; - ShmMemInfo mMemDecodeStats; - ShmMemInfo mMemPalSize; - - std::vector mMems; - - // Only 3 buffers will be held in AiqResultStorage (kAiqResultStorageSize is 3) - // So it is safe to use other 3 buffers. - static const int kMaxQueueSize = 6; - Mutex mMemStatsMLock; // protect mMemStatsInfoMap - struct StatsBufInfo { - unsigned int bufSize; - ShmMemInfo shmMem; - unsigned int usedSize; - }; - // first: sequence id, second: stats buffer info - std::map mMemStatsInfoMap; - - std::unordered_map mMemsOuter; - - private: - struct CCAHandle { - int cameraId; - std::unordered_map ccaHandle; // TuningMode to IntelCca map - }; - static std::vector sCcaInstance; - static Mutex sLock; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelEvcpClient.cpp b/modules/sandboxing/client/IntelEvcpClient.cpp deleted file mode 100644 index ca9da787..00000000 --- a/modules/sandboxing/client/IntelEvcpClient.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelEVCPClient - -#include "modules/sandboxing/client/IntelEvcpClient.h" - -#include - -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -IntelEvcp::~IntelEvcp() { - bool ret = mCommon.requestSync(IPC_EVCP_DEINIT); - if (!ret) LOGE("@%s, EVCP DEINIT Fails", __func__); - - mCommon.freeShmMem(mParamMems, GPU_ALGO_SHM); - mCommon.freeShmMem(mEvcpRunInfoMem, GPU_ALGO_SHM); -} - -int IntelEvcp::init(int width, int height, EvcpParam* param) { - bool ret = initResolution(width, height); - if (!ret) return UNKNOWN_ERROR; - - ret = initRunInfoBuffer(); - if (!ret) return UNKNOWN_ERROR; - - ret = initParamBuffer(); - if (!ret) return UNKNOWN_ERROR; - - if (param) { - ret = updateEvcpParam(param); - } else { - EvcpParam defParam = {false, false, false, false}; - ret = updateEvcpParam(&defParam); - } - - if (!ret) return UNKNOWN_ERROR; - - return OK; -} - -bool IntelEvcp::initRunInfoBuffer() { - std::string name = - "/evcpRuninfo" + std::to_string(reinterpret_cast(this)) + SHM_NAME; - mEvcpRunInfoMem.mName = name.c_str(); - mEvcpRunInfoMem.mSize = sizeof(EvcpRunInfo); - return mCommon.allocShmMem(mEvcpRunInfoMem.mName, mEvcpRunInfoMem.mSize, &mEvcpRunInfoMem, - GPU_ALGO_SHM); -} - -bool IntelEvcp::initParamBuffer() { - std::string name = "/evcpParam" + std::to_string(reinterpret_cast(this)) + SHM_NAME; - mParamMems.mName = name.c_str(); - mParamMems.mSize = sizeof(EvcpParam); - return mCommon.allocShmMem(mParamMems.mName, mParamMems.mSize, &mParamMems, GPU_ALGO_SHM); -} - -bool IntelEvcp::initResolution(int width, int height) { - ShmMemInfo resolutionMems; - resolutionMems.mName = "/evcpResolutionShm"; - resolutionMems.mSize = sizeof(EvcpResolution); - - bool ret = mCommon.allocShmMem(resolutionMems.mName, resolutionMems.mSize, &resolutionMems, - GPU_ALGO_SHM); - CheckAndLogError(!ret, false, "@%s, Alloc resolution allocShmMem fails", __func__); - - EvcpResolution* res = reinterpret_cast(resolutionMems.mAddr); - res->width = width; - res->height = height; - - ret = mCommon.requestSync(IPC_EVCP_INIT, resolutionMems.mHandle); - mCommon.freeShmMem(resolutionMems, GPU_ALGO_SHM); - - return ret; -} - -bool IntelEvcp::runEvcpFrame(int dmafd, int dataSize) { - EvcpRunInfo* runInfo = reinterpret_cast(mEvcpRunInfoMem.mAddr); - - runInfo->inHandle = mCommon.registerGbmBuffer(dmafd, GPU_ALGO_SHM); - CheckAndLogError(runInfo->inHandle < 0, false, "@%s, Cannot register GBM buffers.", __func__); - - runInfo->bufSize = dataSize; - - auto runInfoHandle = mCommon.getShmMemHandle(reinterpret_cast(runInfo), GPU_ALGO_SHM); - if (runInfoHandle < 0) { - LOGE("@%s, Cannot get shm handle.", __func__); - mCommon.deregisterGbmBuffer(runInfo->inHandle, GPU_ALGO_SHM); - return false; - } - - bool ret = mCommon.requestSync(IPC_EVCP_RUN_FRAME, runInfoHandle); - mCommon.deregisterGbmBuffer(runInfo->inHandle, GPU_ALGO_SHM); - - return ret; -} - -void IntelEvcp::getEvcpParam(EvcpParam* evcpParam) { - EvcpParam* pamem = reinterpret_cast(mParamMems.mAddr); - - mCommon.requestSync(IPC_EVCP_GETCONF, mParamMems.mHandle); - *evcpParam = *pamem; -} - -bool IntelEvcp::updateEvcpParam(EvcpParam* param) { - EvcpParam* pamem = reinterpret_cast(mParamMems.mAddr); - *pamem = *param; - - return mCommon.requestSync(IPC_EVCP_UPDCONF, mParamMems.mHandle); -} - -} // namespace icamera diff --git a/modules/sandboxing/client/IntelEvcpClient.h b/modules/sandboxing/client/IntelEvcpClient.h deleted file mode 100644 index b37f951e..00000000 --- a/modules/sandboxing/client/IntelEvcpClient.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "BufferQueue.h" -#include "CameraBuffer.h" -#include "Parameters.h" -#include "PlatformData.h" -#include "src/evcp/EvcpCommon.h" - -namespace icamera { - -class IntelEvcp { - public: - IntelEvcp() {} - ~IntelEvcp(); - int init(int width, int height, EvcpParam* param = nullptr); - - bool runEvcpFrame(int dmafd, int dataSize); - bool updateEvcpParam(EvcpParam* evcpParam); - void getEvcpParam(EvcpParam* evcpParam); - - private: - bool initResolution(int width, int height); - bool initParamBuffer(); - bool initRunInfoBuffer(); - - IntelAlgoCommon mCommon; - ShmMemInfo mParamMems; - ShmMemInfo mEvcpRunInfoMem; - - DISALLOW_COPY_AND_ASSIGN(IntelEvcp); -}; -} // namespace icamera diff --git a/modules/sandboxing/client/IntelFaceDetectionClient.cpp b/modules/sandboxing/client/IntelFaceDetectionClient.cpp deleted file mode 100644 index 6f2bc2ec..00000000 --- a/modules/sandboxing/client/IntelFaceDetectionClient.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelFaceDetectionClient - -#include "modules/sandboxing/client/IntelFaceDetectionClient.h" - -#include - -#include "FaceType.h" - -namespace icamera { -IntelFaceDetection::IntelFaceDetection() : mInitialized(false) { - uintptr_t personal = reinterpret_cast(this); - mMems = {{("/faceDetectionInit" + std::to_string(personal) + "Shm"), - sizeof(FaceDetectionInitParams), &mMemInit, false}, - {("/faceDetectionDeinit" + std::to_string(personal) + "Shm"), - sizeof(FaceDetectionDeinitParams), &mMemDeinit, false}}; - - for (int i = 0; i < MAX_STORE_FACE_DATA_BUF_NUM; i++) { - mMems.push_back( - {("/faceDetectionRun" + std::to_string(i) + std::to_string(personal) + "Shm"), - sizeof(FaceDetectionRunParams), &mMemRunBufs[i], false}); - } - - bool success = mCommon.allocateAllShmMems(&mMems); - if (!success) { - LOGE("@%s,Failed to call allocateAllShmMems", __func__); - mCommon.releaseAllShmMems(mMems); - return; - } - - LOG1("@%s, Construct done", __func__); - mInitialized = true; -} - -IntelFaceDetection::~IntelFaceDetection() { - LOG1("@%s, Destroy", __func__); - mCommon.releaseAllShmMems(mMems); -} - -status_t IntelFaceDetection::init(FaceDetectionInitParams* initParams, int dataSize) { - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "@%s, mInitialized is false", __func__); - - CheckAndLogError( - initParams == nullptr || dataSize < static_cast(sizeof(FaceDetectionInitParams)), - UNKNOWN_ERROR, "@%s, initParams: %p, dataSize: %d", __func__, initParams, dataSize); - - unsigned int maxFacesNum = - std::min(initParams->max_face_num, static_cast(MAX_FACES_DETECTABLE)); - LOG1(" @%s, maxFacesNum:%d", initParams->cameraId, __func__, maxFacesNum); - - FaceDetectionInitParams* params = static_cast(mMemInit.mAddr); - - bool ret = mIpc.clientFlattenInit(maxFacesNum, initParams->cameraId, params); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenInit fails", __func__); - - ret = mCommon.requestSync(IPC_FD_INIT, mMemInit.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - return OK; -} - -status_t IntelFaceDetection::deinit(FaceDetectionDeinitParams* deinitParams, int dataSize) { - LOG1("@%s", __func__); - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "@%s, mInitialized is false", __func__); - CheckAndLogError( - deinitParams == nullptr || dataSize < static_cast(sizeof(FaceDetectionDeinitParams)), - UNKNOWN_ERROR, "@%s, deinitParams: %p, dataSize: %d", __func__, deinitParams, dataSize); - - FaceDetectionDeinitParams* params = static_cast(mMemDeinit.mAddr); - params->cameraId = deinitParams->cameraId; - bool ret = mCommon.requestSync(IPC_FD_DEINIT, mMemDeinit.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - return OK; -} - -FaceDetectionRunParams* IntelFaceDetection::prepareRunBuffer(unsigned int index) { - CheckAndLogError(!mInitialized, nullptr, "@%s, mInitialized is false", __func__); - CheckAndLogError(index >= MAX_STORE_FACE_DATA_BUF_NUM, nullptr, "@%s, index: %d is error", - __func__, index); - LOG2("%s, index: %d", __func__, index); - - return static_cast(mMemRunBufs[index].mAddr); -} - -status_t IntelFaceDetection::run(FaceDetectionRunParams* runParams, int dataSize, int dmafd) { - CheckAndLogError(!mInitialized, UNKNOWN_ERROR, "@%s, mInitialized is false", __func__); - CheckAndLogError(!runParams || dataSize < static_cast(sizeof(FaceDetectionRunParams)), - UNKNOWN_ERROR, "@%s, runParams: %p dataSize: %d", __func__, runParams, - dataSize); - LOG2("@%s, dmafd: %d", __func__, dmafd); - - if (dmafd >= 0) { - runParams->bufferHandle = mCommon.registerGbmBuffer(dmafd); - CheckAndLogError((runParams->bufferHandle < 0), false, - "@%s, call mCommon.registerGbmBuffer", __func__); - } - - int32_t runBufHandle = mCommon.getShmMemHandle(static_cast(runParams)); - CheckAndLogError(runBufHandle < 0, UNKNOWN_ERROR, "@%s, getShmMemHandle fails", __func__); - - bool ret = mCommon.requestSync(IPC_FD_RUN, runBufHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - if (dmafd >= 0) { - mCommon.deregisterGbmBuffer(runParams->bufferHandle); - } - - return OK; -} -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelFaceDetectionClient.h b/modules/sandboxing/client/IntelFaceDetectionClient.h deleted file mode 100644 index 0f65e32a..00000000 --- a/modules/sandboxing/client/IntelFaceDetectionClient.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "FaceType.h" -#include "IntelAlgoCommonClient.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" -#include "modules/sandboxing/IPCIntelFD.h" - -namespace icamera { -class IntelFaceDetection { - public: - IntelFaceDetection(); - virtual ~IntelFaceDetection(); - - status_t init(FaceDetectionInitParams* initData, int dataSize); - status_t deinit(FaceDetectionDeinitParams* deinitParams, int dataSize); - status_t run(FaceDetectionRunParams* runParams, int dataSize, int dmafd = -1); - FaceDetectionRunParams* prepareRunBuffer(unsigned int index); - - private: - IPCIntelFD mIpc; - IntelAlgoCommon mCommon; - - bool mInitialized; - - ShmMemInfo mMemInit; - ShmMemInfo mMemDeinit; - ShmMemInfo mMemRunBufs[MAX_STORE_FACE_DATA_BUF_NUM]; - std::vector mMems; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/client/IntelICBMClient.cpp b/modules/sandboxing/client/IntelICBMClient.cpp deleted file mode 100644 index e63ca1e7..00000000 --- a/modules/sandboxing/client/IntelICBMClient.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2022-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelICBMClient - -#include "modules/sandboxing/client/IntelICBMClient.h" - -#include - -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -int IntelICBM::shutdown(const ICBMReqInfo& reqInfo) { - ICBMReqInfo* runInfo = reinterpret_cast(mRunInfoMem.mAddr); - *runInfo = reqInfo; - - bool ret = mCommon.requestSync(IPC_ICBM_DEINIT, mRunInfoMem.mHandle); - if (!ret) LOGE("%s, Intel ICBM shutdown failed", __func__); - - mCommon.freeShmMem(mRunInfoMem, GPU_ALGO_SHM); - return ret; -} - -int IntelICBM::setup(ICBMInitInfo* initParam) { - auto ret = initRunInfoBuffer(); - if (ret != OK) return ret; - - ShmMemInfo initMems; - initMems.mName = "/IntelICBMInitMem"; - - ICBMInitInfo dummy{}; - - if (initParam == nullptr) initParam = &dummy; - - initMems.mSize = sizeof(*initParam); - - auto re = mCommon.allocShmMem(initMems.mName, initMems.mSize, &initMems, GPU_ALGO_SHM); - CheckAndLogError(!re, UNKNOWN_ERROR, "%s, Alloc init allocShmMem failed", __func__); - - ICBMInitInfo* im = reinterpret_cast(initMems.mAddr); - *im = *initParam; - - re = mCommon.requestSync(IPC_ICBM_INIT, initMems.mHandle); - mCommon.freeShmMem(initMems, GPU_ALGO_SHM); - - return re ? OK : UNKNOWN_ERROR; -} - -int IntelICBM::initRunInfoBuffer() { - std::string name = - "/IntelICBMRuninfo" + std::to_string(reinterpret_cast(this)) + SHM_NAME; - mRunInfoMem.mName = name.c_str(); - mRunInfoMem.mSize = sizeof(ICBMReqInfo); - - auto ret = - mCommon.allocShmMem(mRunInfoMem.mName, mRunInfoMem.mSize, &mRunInfoMem, GPU_ALGO_SHM); - - CheckAndLogError(!ret, UNKNOWN_ERROR, "%s, RunInfo SHM alloc error!", __func__); - - return OK; -} - -int IntelICBM::processFrame(const ICBMReqInfo& reqInfo) { - ICBMReqInfo* runInfo = reinterpret_cast(mRunInfoMem.mAddr); - - *runInfo = reqInfo; - runInfo->inHandle = mCommon.registerGbmBuffer(reqInfo.inII.gfxHandle, GPU_ALGO_SHM); - CheckAndLogError(runInfo->inHandle < 0, UNKNOWN_ERROR, "%s, Cannot register in GBM buffers.", - __func__); - - runInfo->outHandle = mCommon.registerGbmBuffer(reqInfo.outII.gfxHandle, GPU_ALGO_SHM); - CheckAndLogError(runInfo->outHandle < 0, UNKNOWN_ERROR, "%s, Cannot register out GBM buffers.", - __func__); - - auto runInfoHandle = mCommon.getShmMemHandle(reinterpret_cast(runInfo), GPU_ALGO_SHM); - if (runInfoHandle < 0) { - LOGE("%s, Cannot get GBMSHM handle.", __func__); - mCommon.deregisterGbmBuffer(runInfo->inHandle, GPU_ALGO_SHM); - mCommon.deregisterGbmBuffer(runInfo->outHandle, GPU_ALGO_SHM); - return UNKNOWN_ERROR; - } - - bool ret = mCommon.requestSync(IPC_ICBM_RUN_FRAME, runInfoHandle); - mCommon.deregisterGbmBuffer(runInfo->inHandle, GPU_ALGO_SHM); - mCommon.deregisterGbmBuffer(runInfo->outHandle, GPU_ALGO_SHM); - - CheckAndLogError(!ret, UNKNOWN_ERROR, "%s, Run frame IPC error!", __func__); - return OK; -} - -int IntelICBM::runTnrFrame(const ICBMReqInfo& reqInfo) { - ICBMReqInfo* runInfo = reinterpret_cast(mRunInfoMem.mAddr); - *runInfo = reqInfo; - - runInfo->inHandle = reqInfo.inII.gfxHandle; - runInfo->outHandle = reqInfo.outII.gfxHandle; - return mCommon.requestSync(IPC_ICBM_RUN_FRAME, mRunInfoMem.mHandle); -} - -} // namespace icamera diff --git a/modules/sandboxing/client/IntelICBMClient.h b/modules/sandboxing/client/IntelICBMClient.h deleted file mode 100644 index 30e5f078..00000000 --- a/modules/sandboxing/client/IntelICBMClient.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2022-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "CameraBuffer.h" -#include "Parameters.h" -#include "PlatformData.h" -#include "src/icbm/ICBMTypes.h" - -namespace icamera { - -class IntelICBM { - public: - IntelICBM() {} - ~IntelICBM(){}; - - int setup(ICBMInitInfo* initParam); - int shutdown(const ICBMReqInfo& reqInfo); - int processFrame(const ICBMReqInfo& reqInfo); - int runTnrFrame(const ICBMReqInfo& reqInfo); - - private: - int initRunInfoBuffer(); - - IntelAlgoCommon mCommon; - ShmMemInfo mRunInfoMem; - - DISALLOW_COPY_AND_ASSIGN(IntelICBM); -}; -} // namespace icamera diff --git a/modules/sandboxing/client/IntelPGParamClient.cpp b/modules/sandboxing/client/IntelPGParamClient.cpp deleted file mode 100644 index 6b5a5de9..00000000 --- a/modules/sandboxing/client/IntelPGParamClient.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelPGParamClient - -#include "modules/sandboxing/client/IntelPGParamClient.h" - -#include - -#include "AiqResultStorage.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -IntelPGParam::IntelPGParam(int pgId, int cameraId, TuningMode tuningMode) - : mInitialized(false), - mPgId(pgId), - mClient(reinterpret_cast(this)), - mPayloadCount(0), - mPGBuffer(nullptr), - mCameraId(cameraId), - mTuningMode(tuningMode) { - std::string initName = "/pgParamInit" + std::to_string(mClient) + SHM_NAME; - std::string prepareName = "/pgParamPrepare" + std::to_string(mClient) + SHM_NAME; - std::string getFragDescsName = "/pgParamGetFragDescs" + std::to_string(mClient) + SHM_NAME; - std::string prepareProgramName = "/pgParamPrepareProgram" + std::to_string(mClient) + SHM_NAME; - std::string encodeName = "/pgParamEncode" + std::to_string(mClient) + SHM_NAME; - std::string decodeName = "/pgParamDecode" + std::to_string(mClient) + SHM_NAME; - std::string deinitName = "/pgParamDeinit" + std::to_string(mClient) + SHM_NAME; - - mMems = { - {initName.c_str(), sizeof(pg_param_init_params), &mMemInit, false}, - {prepareName.c_str(), sizeof(pg_param_prepare_params), &mMemPrepare, false}, - {getFragDescsName.c_str(), sizeof(pg_param_get_fragment_desc_params), &mMemGetFragDescs, - false}, - {prepareProgramName.c_str(), sizeof(pg_param_prepare_program_params), &mMemPrepareProgram, - false}, - {encodeName.c_str(), sizeof(pg_param_encode_params), &mMemEncode, false}, - {decodeName.c_str(), sizeof(pg_param_decode_params), &mMemDecode, false}, - {deinitName.c_str(), sizeof(pg_param_deinit_params), &mMemDeinit, false}, - }; - - bool success = mCommon.allocateAllShmMems(&mMems); - if (!success) { - mCommon.releaseAllShmMems(mMems); - return; - } - - // Allocate when use - mMemAllocatePGBuffer.mName = "/pgParamAllocPG" + std::to_string(mClient) + SHM_NAME; - mMemAllocatePGBuffer.mSize = 0; - mMemStatistics.mName = "/pgParamStats" + std::to_string(mClient) + SHM_NAME; - mMemStatistics.mSize = 0; - mMaxStatsSize = 0; - - mIntelCca = IntelCca::getInstance(mCameraId, mTuningMode); - CheckAndLogError(!mIntelCca, VOID_VALUE, "%s: Can't get IntelCca", __func__); - - mInitialized = true; - LOG1("@%s, Construct done", __func__); -} - -IntelPGParam::~IntelPGParam() { - mCommon.releaseAllShmMems(mMems); - while (!mMemAllocatePayloads.empty()) { - mCommon.freeShmMem(mMemAllocatePayloads.back()); - mMemAllocatePayloads.pop_back(); - } - if (mMemAllocatePGBuffer.mSize) { - mCommon.freeShmMem(mMemAllocatePGBuffer); - } - if (mMemStatistics.mSize) { - mCommon.freeShmMem(mMemStatistics); - } - LOG1("@%s", __func__); -} - -int IntelPGParam::init(ia_p2p_platform_t platform, const PgConfiguration& pgConfig) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - - bool ret = - mIpc.clientFlattenInit(mMemInit.mAddr, mMemInit.mSize, mPgId, mClient, platform, pgConfig); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenInit fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_INIT, mMemInit.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - return OK; -} - -int IntelPGParam::prepare(const ia_binary_data* ipuParameters, const ia_css_rbm_t* rbm, - ia_css_kernel_bitmap_t* bitmap, uint32_t* maxStatsSize) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - CheckAndLogError(!ipuParameters, INVALID_OPERATION, "@%s, ipuParams error", __func__); - - int32_t palHandle = mCommon.getShmMemHandle(ipuParameters->data); - bool ret = mIpc.clientFlattenPrepare(mMemPrepare.mAddr, mMemPrepare.mSize, mClient, - ipuParameters->size, palHandle, rbm); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenPrepare fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_PREPARE, mMemPrepare.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - ret = mIpc.clientUnflattenPrepare(mMemPrepare.mAddr, mMemPrepare.mSize, bitmap, &mMaxStatsSize); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientUnflattenPrepare fails", __func__); - - if (mMemStatistics.mAddr && mMemStatistics.mSize <= mMaxStatsSize) { - mCommon.freeShmMem(mMemStatistics); - mMemStatistics.mSize = 0; - mMemStatistics.mAddr = nullptr; - } - if (maxStatsSize) *maxStatsSize = mMaxStatsSize; - return OK; -} - -int IntelPGParam::getFragmentDescriptors(int descCount, ia_p2p_fragment_desc* descs) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - - bool ret = mIpc.clientFlattenGetFragDescs(mMemGetFragDescs.mAddr, mMemGetFragDescs.mSize, - mClient, descCount); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenGetFragDescs fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_GET_FRAG_DESCS, mMemGetFragDescs.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - int count = 0; - ret = mIpc.clientUnflattenGetFragDescs(mMemGetFragDescs.mAddr, mMemGetFragDescs.mSize, &count, - descs); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientUnflattenGetFragDescs fails", - __func__); - return count; -} - -void* IntelPGParam::allocatePGBuffer(int pgSize) { - CheckAndLogError(mInitialized == false, nullptr, "@%s, mInitialized is false", __func__); - - mPGBuffer = nullptr; - int size = mIpc.getTotalPGBufferSize(pgSize); - if (mMemAllocatePGBuffer.mAddr && mMemAllocatePGBuffer.mSize < size) { - mCommon.freeShmMem(mMemAllocatePGBuffer); - mMemAllocatePGBuffer.mSize = 0; - mMemAllocatePGBuffer.mAddr = nullptr; - } - if (!mMemAllocatePGBuffer.mAddr) { - mMemAllocatePGBuffer.mSize = size; - bool ret = mCommon.allocShmMem(mMemAllocatePGBuffer.mName, mMemAllocatePGBuffer.mSize, - &mMemAllocatePGBuffer); - CheckAndLogError(ret == false, nullptr, "@%s, allocShmMem fails", __func__); - } - - void* pgBuffer = nullptr; - bool ret = mIpc.assignPGBuffer(mMemAllocatePGBuffer.mAddr, mMemAllocatePGBuffer.mSize, pgSize, - &pgBuffer); - CheckAndLogError(ret == false, nullptr, "@%s, assignPGBuffer fails", __func__); - - ret = mIpc.clientFlattenAllocatePGBuffer(mMemAllocatePGBuffer.mAddr, mMemAllocatePGBuffer.mSize, - mClient, pgSize); - CheckAndLogError(ret == false, nullptr, "@%s, clientFlattenAllocatePGBuffer fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_ALLOCATE_PG, mMemAllocatePGBuffer.mHandle); - CheckAndLogError(ret == false, nullptr, "@%s, requestSync fails", __func__); - - mPGBuffer = reinterpret_cast(pgBuffer); - return mPGBuffer; -} - -int IntelPGParam::setPGAndPrepareProgram(ia_css_process_group_t* pg) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - CheckAndLogError(mPGBuffer != pg, INVALID_OPERATION, "@%s, pg is not recognized", __func__); - - bool ret = mIpc.clientFlattenPrepareProgram(mMemPrepareProgram.mAddr, mMemPrepareProgram.mSize, - mClient); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenPrepareProgram fails", - __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_PREPARE_PROGRAM, mMemPrepareProgram.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - // Get size of payloads - mPayloadCount = ARRAY_SIZE(mPayloads); - ret = mIpc.clientUnflattenPrepareProgram(mMemPrepareProgram.mAddr, mMemPrepareProgram.mSize, - &mPayloadCount, mPayloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientUnlattenPrepareProgram fails", - __func__); - - return OK; -} - -int IntelPGParam::getPayloadSizes(int payloadCount, ia_binary_data* payloads) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - CheckAndLogError(payloadCount < mPayloadCount, UNKNOWN_ERROR, - "@%s, payloadCount: %d is small than %d", __func__, payloadCount, - mPayloadCount); - CheckAndLogError(!payloads, UNKNOWN_ERROR, "@%s, payloads is nullptr", __func__); - - MEMCPY_S(payloads, sizeof(ia_binary_data) * payloadCount, mPayloads, sizeof(mPayloads)); - return mPayloadCount; -} - -int IntelPGParam::allocatePayloads(int payloadCount, ia_binary_data* payloads) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - CheckAndLogError(payloadCount > IPU_MAX_TERMINAL_COUNT, UNKNOWN_ERROR, - "@%s, payloadCount: %d exceeded max count", __func__, payloadCount); - CheckAndLogError(!payloads, UNKNOWN_ERROR, "@%s, payloads is nullptr", __func__); - - // Allocate memory - int size = mIpc.getTotalPayloadSize(payloadCount, payloads); - CheckAndLogError(size <= 0, UNKNOWN_ERROR, "@%s, payloads size error", __func__); - mMemAllocatePayloads.resize(mMemAllocatePayloads.size() + 1); - - ShmMemInfo& info = mMemAllocatePayloads.back(); - info.mName = "/pgParamAllocPayloads" + std::to_string(mClient) + - std::to_string(mMemAllocatePayloads.size()) + SHM_NAME; - info.mSize = size; - info.mAddr = nullptr; - bool ret = mCommon.allocShmMem(info.mName, info.mSize, &info); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, allocShmMem fails", __func__); - - // Split memory of payloads in client side - ret = mIpc.assignPayloads(info.mAddr, info.mSize, payloadCount, payloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, allocatePayloads fails", __func__); - - ret = - mIpc.clientFlattenRegisterPayloads(info.mAddr, info.mSize, mClient, payloadCount, payloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenRegisterPayloads fails", - __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_REGISTER_PAYLOADS, info.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - return OK; -} - -int IntelPGParam::updatePALAndEncode(const ia_binary_data* ipuParameters, int payloadCount, - ia_binary_data* payloads) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - CheckAndLogError(!ipuParameters, INVALID_OPERATION, "@%s, ipuParams error", __func__); - // Check shared memory of payloads - CheckAndLogError(payloadCount != mPayloadCount, BAD_VALUE, - "@%s, payloadCount :%d should equal to %d", __func__, payloadCount, - mPayloadCount); - - int32_t palHandle = mCommon.getShmMemHandle(ipuParameters->data); - bool ret = mIpc.clientFlattenEncode(mMemEncode.mAddr, mMemEncode.mSize, mClient, - ipuParameters->size, palHandle, payloadCount, payloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenEncode fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_ENCODE, mMemEncode.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - return OK; -} - -int IntelPGParam::decode(int payloadCount, ia_binary_data* payloads, ia_binary_data* statistics, - int64_t sequence) { - CheckAndLogError(mInitialized == false, INVALID_OPERATION, "@%s, mInitialized is false", - __func__); - // Check shared memory of payloads - CheckAndLogError(payloadCount != mPayloadCount, BAD_VALUE, - "@%s, payloadCount :%d should equal to %d", __func__, payloadCount, - mPayloadCount); - - // Check share memory of statistics - CheckAndLogError(!statistics, BAD_VALUE, "@%s, statistics nullptr", __func__); - CheckAndLogError(!mMaxStatsSize, BAD_VALUE, "@%s, bad max stats size", __func__); - bool ret = true; - int32_t statsHandle = -1; - if (!statistics->data) { - // Prepare shared stats memory - if (!mMemStatistics.mAddr) { - mMemStatistics.mSize = mMaxStatsSize; - ret = mCommon.allocShmMem(mMemStatistics.mName, mMemStatistics.mSize, &mMemStatistics); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, alloc statsData fails", __func__); - } - statsHandle = mCommon.getShmMemHandle(mMemStatistics.mAddr); - statistics->data = mMemStatistics.mAddr; - } else { - statsHandle = mCommon.getShmMemHandle(statistics->data); - } - - cca::cca_out_stats* outStats = fetchOutStats(sequence); - pg_param_decode_params* params = static_cast(mMemDecode.mAddr); - intel_cca_decode_stats_data& decodeStatsParams = params->decodeStatsParams; - if (outStats && mIntelCca) { - params->hasStatsDecode = true; - decodeStatsParams.cameraId = mCameraId; - decodeStatsParams.tuningMode = mTuningMode; - decodeStatsParams.statsHandle = statsHandle; - decodeStatsParams.statsBuffer.data = nullptr; - decodeStatsParams.statsBuffer.size = 0; // not decode pg yet - decodeStatsParams.bitmap = cca::CCA_STATS_RGBS | cca::CCA_STATS_HIST | cca::CCA_STATS_AF | - cca::CCA_STATS_YV | cca::CCA_STATS_LTM | cca::CCA_STATS_DVS; - if (PlatformData::isPdafEnabled(mCameraId)) decodeStatsParams.bitmap |= cca::CCA_STATS_PDAF; - decodeStatsParams.outStats.get_rgbs_stats = outStats->get_rgbs_stats; - } else { - params->hasStatsDecode = false; - } - - ret = mIpc.clientFlattenDecode(mMemDecode.mAddr, mMemDecode.mSize, mClient, payloadCount, - payloads, statsHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenDecode fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_DECODE, mMemDecode.mHandle); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, requestSync fails", __func__); - - ret = mIpc.clientUnflattenDecode(mMemDecode.mAddr, mMemDecode.mSize, statistics); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientUnflattenDecode fails", __func__); - - if (outStats && mIntelCca) { - // print query result: params->results - if (outStats && decodeStatsParams.outStats.get_rgbs_stats) { - *outStats = decodeStatsParams.outStats; - for (unsigned int i = 0; i < cca::MAX_NUM_EXPOSURE; ++i) { - outStats->rgbs_grid[i].blocks_ptr = outStats->rgbs_blocks[i]; - } - } - ia_isp_bxt_statistics_query_results_t& queryResults = decodeStatsParams.results; - LOG2("%s, query results: rgbs_grid(%d), af_grid(%d), dvs_stats(%d), paf_grid(%d)", __func__, - queryResults.rgbs_grid, queryResults.af_grid, queryResults.dvs_stats, - queryResults.paf_grid); - } - return OK; -} - -void IntelPGParam::deinit() { - CheckAndLogError(mInitialized == false, VOID_VALUE, "@%s, mInitialized is false", __func__); - - bool ret = mIpc.clientFlattenDeinit(mMemDeinit.mAddr, mMemDeinit.mSize, mClient); - CheckAndLogError(ret == false, VOID_VALUE, "@%s, clientFlattenDeinit fails", __func__); - - ret = mCommon.requestSync(IPC_PG_PARAM_DEINIT, mMemDeinit.mHandle); - CheckAndLogError(ret == false, VOID_VALUE, "@%s, requestSync fails", __func__); -} - -cca::cca_out_stats* IntelPGParam::fetchOutStats(int64_t sequence) { - if (sequence < 0) return nullptr; - - AiqResult* aiqResult = - const_cast(AiqResultStorage::getInstance(mCameraId)->getAiqResult(sequence)); - // Check if the frame needs stats decoding together - if (aiqResult && aiqResult->mAiqParam.callbackRgbs) { - // Request decodeStats together when rgbCallback is enabled - aiqResult->mOutStats.get_rgbs_stats = true; - return &aiqResult->mOutStats; - } else if (aiqResult && !PlatformData::isStatsRunningRateSupport(mCameraId)) { - // Request decodeStats together when running rate is disabled - aiqResult->mOutStats.get_rgbs_stats = false; - return &aiqResult->mOutStats; - } - - return nullptr; -} - -} // namespace icamera diff --git a/modules/sandboxing/client/IntelPGParamClient.h b/modules/sandboxing/client/IntelPGParamClient.h deleted file mode 100644 index f99917a1..00000000 --- a/modules/sandboxing/client/IntelPGParamClient.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "CameraTypes.h" -#include "IntelAlgoCommonClient.h" -#include "modules/sandboxing/IPCIntelPGParam.h" -#include "modules/sandboxing/client/IntelCcaClient.h" - -namespace icamera { - -class IntelPGParam { - public: - explicit IntelPGParam(int pgId, int cameraId = 0, - TuningMode tuningMode = TUNING_MODE_VIDEO); - ~IntelPGParam(); - - int init(ia_p2p_platform_t platform, const PgConfiguration& Pgconfiguration); - int prepare(const ia_binary_data* ipuParameters, const ia_css_rbm_t* rbm, - ia_css_kernel_bitmap_t* bitmap, uint32_t* maxStatsSize = nullptr); - void* allocatePGBuffer(int pgSize); - int getFragmentDescriptors(int terminalIdx, ia_p2p_fragment_desc* desc); - int setPGAndPrepareProgram(ia_css_process_group_t* pg); - int getPayloadSizes(int payloadCount, ia_binary_data* payloads); - int allocatePayloads(int payloadCount, ia_binary_data* payloads); - int updatePALAndEncode(const ia_binary_data* ipuParams, int payloadCount, - ia_binary_data* payloads); - int decode(int payloadCount, ia_binary_data* payload, ia_binary_data* statistics, - int64_t sequence = -1); - void deinit(); - -private: - cca::cca_out_stats* fetchOutStats(int64_t sequence); - - private: - IPCIntelPGParam mIpc; - IntelAlgoCommon mCommon; - bool mInitialized; - - ShmMemInfo mMemInit; - ShmMemInfo mMemPrepare; - ShmMemInfo mMemGetFragDescs; - ShmMemInfo mMemAllocatePGBuffer; - ShmMemInfo mMemPrepareProgram; - ShmMemInfo mMemEncode; - ShmMemInfo mMemDecode; - ShmMemInfo mMemDeinit; - ShmMemInfo mMemStatistics; - std::vector mMems; - - std::vector mMemAllocatePayloads; - - int mPgId; - uintptr_t mClient; - - // Shared memory in client, to avoid memory copy - int mPayloadCount; - ia_binary_data mPayloads[IPU_MAX_TERMINAL_COUNT]; // save sizes - ia_css_process_group_t* mPGBuffer; - uint32_t mMaxStatsSize; - - IntelCca* mIntelCca; - int mCameraId; - TuningMode mTuningMode; -}; - -} // namespace icamera diff --git a/modules/sandboxing/client/IntelTNR7USClient.cpp b/modules/sandboxing/client/IntelTNR7USClient.cpp deleted file mode 100644 index e046ff99..00000000 --- a/modules/sandboxing/client/IntelTNR7USClient.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelTNR7USClient - -#include "modules/sandboxing/client/IntelTNR7USClient.h" - -#include -#include - -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" -namespace icamera { - -IntelTNR7US* IntelTNR7US::createIntelTNR(int cameraId) { - if (!PlatformData::isGpuTnrEnabled()) return nullptr; -#ifdef TNR7_CM - return new IntelC4mTNR(cameraId); -#else - return new IntelLevel0TNR(cameraId); -#endif -} - -Tnr7Param* IntelTNR7US::allocTnr7ParamBuf() { - uintptr_t personal = reinterpret_cast(this); - std::string initName = "/TnrParam" + std::to_string(personal) + "Shm"; - - mParamMems.mName = initName.c_str(); - mParamMems.mSize = sizeof(Tnr7Param); - bool ret = mCommon.allocShmMem(mParamMems.mName, mParamMems.mSize, &mParamMems, GPU_ALGO_SHM); - CheckAndLogError(!ret, nullptr, "@%s, allocShmMem fails", __func__); - - return reinterpret_cast(mParamMems.mAddr); -} - -void* IntelTNR7US::allocCamBuf(uint32_t bufSize, int id) { - uintptr_t personal = reinterpret_cast(this); - std::string initName = "/TnrCam" + std::to_string(personal) + std::to_string(id) + "Shm"; - ShmMemInfo shm; - shm.mName = initName.c_str(); - shm.mSize = bufSize; - bool ret = mCommon.allocShmMem(shm.mName, shm.mSize, &shm, GPU_ALGO_SHM); - CheckAndLogError(!ret, nullptr, "@%s, allocShmMem fails", __func__); - - mCamBufMems.push_back(shm); - return shm.mAddr; -} - -void IntelTNR7US::freeAllBufs() { - if (mParamMems.mAddr) { - mCommon.freeShmMem(mParamMems, GPU_ALGO_SHM); - } - for (auto& camBuf : mCamBufMems) { - if (camBuf.mAddr) { - mCommon.freeShmMem(camBuf, GPU_ALGO_SHM); - } - } -} - -#ifdef TNR7_CM -IntelC4mTNR::IntelC4mTNR(int cameraId) - : IntelTNR7US(cameraId), - mTnrType(TNR_INSTANCE_MAX), - mTnrRequestInfo(nullptr) { - LOG1(" %s, Construct", cameraId, __func__); -} - -IntelC4mTNR::~IntelC4mTNR() { - // the instance not initialized, don't need to free - if (mTnrType != TNR_INSTANCE_MAX) { - mTnrRequestInfo->type = mTnrType; - mTnrRequestInfo->cameraId = mCameraId; - - int32_t requestHandle = - mCommon.getShmMemHandle(static_cast(mTnrRequestInfo), GPU_ALGO_SHM); - int ret = mCommon.requestSync(IPC_GPU_TNR_DEINIT, requestHandle); - CheckAndLogError(!ret, VOID_VALUE, "@%s, requestSync fails", __func__); - mCommon.freeShmMem(mTnrRequestInfoMem, GPU_ALGO_SHM); - } - LOG1(" %s, Destroy", mCameraId, __func__); -} - -int IntelC4mTNR::init(int width, int height, TnrType type) { - uintptr_t personal = reinterpret_cast(this); - std::string initName = "/TnrRun" + std::to_string(personal) + "Shm"; - mTnrRequestInfoMem.mName = initName.c_str(); - mTnrRequestInfoMem.mSize = sizeof(TnrRequestInfo); - bool ret = mCommon.allocShmMem(mTnrRequestInfoMem.mName, mTnrRequestInfoMem.mSize, - &mTnrRequestInfoMem, GPU_ALGO_SHM); - CheckAndLogError(!ret, UNKNOWN_ERROR, "@%s, allocShmMem fails", __func__); - mTnrRequestInfo = static_cast(mTnrRequestInfoMem.mAddr); - - initName = "/TnrInit" + std::to_string(personal) + "Shm"; - ShmMemInfo initInfoMems; - initInfoMems.mName = initName.c_str(); - initInfoMems.mSize = sizeof(TnrInitInfo); - ret = mCommon.allocShmMem(initInfoMems.mName, initInfoMems.mSize, &initInfoMems, GPU_ALGO_SHM); - if (!ret) { - LOGE("@%s, alloc initInfo ShmMem fails", __func__); - mCommon.freeShmMem(mTnrRequestInfoMem, GPU_ALGO_SHM); - return UNKNOWN_ERROR; - } - - TnrInitInfo* initInfo = static_cast(initInfoMems.mAddr); - *initInfo = {width, height, mCameraId, type}; - - ret = mCommon.requestSync(IPC_GPU_TNR_INIT, initInfoMems.mHandle); - if (!ret) { - LOGE("@%s, IPC %d failed", __func__, IPC_GPU_TNR_INIT); - mCommon.freeShmMem(mTnrRequestInfoMem, GPU_ALGO_SHM); - } - mCommon.freeShmMem(initInfoMems, GPU_ALGO_SHM); - mTnrType = type; - LOG1("%s, GPU TNR instance size %dx%d, type %d", __func__, width, height, mTnrType); - - return ret ? OK : UNKNOWN_ERROR; -} - -int IntelC4mTNR::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate, int fd) { - LOG2("%s, type: %d, syncUpdate: %d, fd: %d", __func__, mTnrType, syncUpdate, fd); - CheckAndLogError(!inBufAddr || !outBufAddr || !tnrParam, UNKNOWN_ERROR, - "@%s, invalid data buffer or parameter buffer", __func__); - int32_t inHandle = mCommon.getShmMemHandle(const_cast(inBufAddr), GPU_ALGO_SHM); - CheckAndLogError(inHandle < 0, UNKNOWN_ERROR, "@%s, can't find inBuf handle", __func__); - CheckAndLogError(mParamMems.mAddr != tnrParam, UNKNOWN_ERROR, "@%s, invalid tnr parameter", - __func__); - - if (fd >= 0) { - mTnrRequestInfo->outHandle = mCommon.registerGbmBuffer(fd, GPU_ALGO_SHM); - } else { - mTnrRequestInfo->outHandle = - mCommon.getShmMemHandle(static_cast(outBufAddr), GPU_ALGO_SHM); - } - CheckAndLogError(mTnrRequestInfo->outHandle < 0, UNKNOWN_ERROR, "@%s, can't init outBuf handle", - __func__); - - mTnrRequestInfo->inHandle = inHandle; - mTnrRequestInfo->paramHandle = mParamMems.mHandle; - mTnrRequestInfo->type = mTnrType; - mTnrRequestInfo->cameraId = mCameraId; - mTnrRequestInfo->outBufFd = fd; - mTnrRequestInfo->isForceUpdate = syncUpdate; - - int32_t requestHandle = - mCommon.getShmMemHandle(static_cast(mTnrRequestInfo), GPU_ALGO_SHM); - - IPC_CMD cmd = mTnrType > 0 ? IPC_GPU_TNR_THREAD2_RUN_FRAME : IPC_GPU_TNR_RUN_FRAME; - bool ret = mCommon.requestSync(cmd, requestHandle); - - if (fd >= 0) { - mCommon.deregisterGbmBuffer(mTnrRequestInfo->outHandle, GPU_ALGO_SHM); - } - - CheckAndLogError(!ret, OK, "@%s, run tnr fails", __func__); - - return OK; -} - -void* IntelC4mTNR::allocCamBuf(uint32_t bufSize, int id) { - uintptr_t personal = reinterpret_cast(this); - std::string initName = "/TnrCam" + std::to_string(personal) + std::to_string(id) + "Shm"; - ShmMemInfo shm; - shm.mName = initName.c_str(); - shm.mSize = bufSize; - bool ret = mCommon.allocShmMem(shm.mName, shm.mSize, &shm, GPU_ALGO_SHM); - CheckAndLogError(!ret, nullptr, "@%s, allocShmMem fails", __func__); - mTnrRequestInfo->surfaceHandle = shm.mHandle; - mTnrRequestInfo->type = mTnrType; - mTnrRequestInfo->cameraId = mCameraId; - - int32_t requestHandle = - mCommon.getShmMemHandle(static_cast(mTnrRequestInfo), GPU_ALGO_SHM); - ret = mCommon.requestSync(IPC_GPU_TNR_PREPARE_SURFACE, requestHandle); - if (!ret) { - mCommon.freeShmMem(shm, GPU_ALGO_SHM); - return nullptr; - } - mCamBufMems.push_back(shm); - - return shm.mAddr; -} - -int IntelC4mTNR::asyncParamUpdate(int gain, bool forceUpdate) { - LOG2("%s, type: %d, gain: %d, forceUpdate: %d", __func__, mTnrType, gain, forceUpdate); - mTnrRequestInfo->gain = gain; - mTnrRequestInfo->type = mTnrType; - mTnrRequestInfo->cameraId = mCameraId; - mTnrRequestInfo->isForceUpdate = forceUpdate; - - int32_t requestHandle = - mCommon.getShmMemHandle(static_cast(mTnrRequestInfo), GPU_ALGO_SHM); - - IPC_CMD cmd = mTnrType > 0 ? IPC_GPU_TNR_THREAD2_PARAM_UPDATE : IPC_GPU_TNR_PARAM_UPDATE; - bool ret = mCommon.requestSync(cmd, requestHandle); - - CheckAndLogError(!ret, UNKNOWN_ERROR, "@%s, IPC_GPU_TNR_PARAM_UPDATE requestSync fails", - __func__); - return OK; -} - -int IntelC4mTNR::getTnrBufferSize(int width, int height, uint32_t* size) { - mTnrRequestInfo->width = width; - mTnrRequestInfo->height = height; - mTnrRequestInfo->type = mTnrType; - mTnrRequestInfo->cameraId = mCameraId; - - int32_t requestHandle = - mCommon.getShmMemHandle(static_cast(mTnrRequestInfo), GPU_ALGO_SHM); - - bool ret = mCommon.requestSync(IPC_GPU_TNR_GET_SURFACE_INFO, requestHandle); - CheckAndLogError(!ret, UNKNOWN_ERROR, "@%s, IPC_GPU_TNR_GET_SURFACE_INFO requestSync fails", - __func__); - if (size) *size = mTnrRequestInfo->surfaceSize; - return OK; -} -#elif defined(TNR7_LEVEL0) -IntelLevel0TNR::~IntelLevel0TNR() { - LOG1(" %s", mCameraId, __func__); - if (mIntelICBM) { - icamera::ICBMReqInfo reqInfo; - reqInfo.cameraId = mCameraId; - reqInfo.reqType = icamera::ICBMReqType::LEVEL0_TNR; - mIntelICBM->shutdown(reqInfo); - mIntelICBM = nullptr; - } -} - -int IntelLevel0TNR::init(int width, int height, TnrType type) { - LOG1(" %s %dx%d", mCameraId, __func__, width, height); - mWidth = width; - mHeight = height; - mIntelICBM = std::make_unique(); - icamera::ICBMInitInfo initParam = {.cameraId = mCameraId, - .reqType = icamera::ICBMReqType::LEVEL0_TNR}; - int ret = mIntelICBM->setup(&initParam); - CheckAndLogError(ret != OK, ret, "%s: Init failed", __func__); - - return ret; -} - -int IntelLevel0TNR::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate, int fd) { - (void)syncUpdate; - ImageInfo input = {}; - input.width = mWidth; - input.height = mHeight; - input.size = inBufSize; - input.stride = mWidth; - input.gfxHandle = mCommon.getShmMemHandle(const_cast(inBufAddr), GPU_ALGO_SHM); - - ImageInfo output = {}; - output.width = mWidth; - output.height = mHeight; - output.size = outBufSize; - output.stride = mWidth; - - if (fd >= 0) { - output.gfxHandle = mCommon.registerGbmBuffer(fd, GPU_ALGO_SHM); - } else { - output.gfxHandle = mCommon.getShmMemHandle(static_cast(outBufAddr), GPU_ALGO_SHM); - } - - ICBMReqInfo reqInfo; - reqInfo.cameraId = mCameraId; - reqInfo.reqType = ICBMReqType::LEVEL0_TNR; - reqInfo.paramHandle = mParamMems.mHandle; - reqInfo.inII = input; - reqInfo.outII = output; - - int ret = mIntelICBM->runTnrFrame(reqInfo); - - if (fd >= 0) { - mCommon.deregisterGbmBuffer(output.gfxHandle, GPU_ALGO_SHM); - } - - return ret; -} -#endif -} // namespace icamera diff --git a/modules/sandboxing/client/IntelTNR7USClient.h b/modules/sandboxing/client/IntelTNR7USClient.h deleted file mode 100644 index 88ebe2e8..00000000 --- a/modules/sandboxing/client/IntelTNR7USClient.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "BufferQueue.h" -#include "CameraBuffer.h" -#include "Parameters.h" -#include "PlatformData.h" -#include "TNRCommon.h" -#ifdef TNR7_LEVEL0 -#include "src/icbm/ICBMTypes.h" -#include "modules/sandboxing/client/IntelICBMClient.h" -#endif - -namespace icamera { -class IntelTNR7US { - public: - static IntelTNR7US* createIntelTNR(int cameraId); - virtual ~IntelTNR7US(){}; - virtual int init(int width, int height, TnrType type = TNR_INSTANCE0) = 0; - /** - * call tnr api to calc tnr result - * - * \param inBufAddr: input image buffer - * \param outBufAddr: tnr output - * \param tnrParam: tnr parameters from ISP - * \param fd: user output buffer file handle - */ - virtual int runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate = true, - int fd = -1) = 0; - virtual Tnr7Param* allocTnr7ParamBuf(); - virtual void* allocCamBuf(uint32_t bufSize, int id); - virtual void freeAllBufs(); - int prepareSurface(void* bufAddr, int size) { return OK; } - virtual int asyncParamUpdate(int gain, bool forceUpdate) { return OK; } - virtual int getTnrBufferSize(int width, int height, uint32_t* size) { return BAD_VALUE; } - - protected: - int mCameraId; - IntelAlgoCommon mCommon; - std::vector mCamBufMems; - ShmMemInfo mParamMems; - explicit IntelTNR7US(int cameraId) : mCameraId(cameraId){}; -}; - -#ifdef TNR7_CM -class IntelC4mTNR : public IntelTNR7US { - public: - explicit IntelC4mTNR(int cameraId); - virtual ~IntelC4mTNR(); - virtual int init(int width, int height, TnrType type = TNR_INSTANCE0); - virtual int runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate = true, - int fd = -1); - virtual void* allocCamBuf(uint32_t bufSize, int id); - virtual int asyncParamUpdate(int gain, bool forceUpdate); - virtual int getTnrBufferSize(int width, int height, uint32_t* size); - - private: - TnrType mTnrType; - TnrRequestInfo* mTnrRequestInfo; - ShmMemInfo mTnrRequestInfoMem; - DISALLOW_COPY_AND_ASSIGN(IntelC4mTNR); -}; - -#elif defined(TNR7_LEVEL0) -class IntelLevel0TNR : public IntelTNR7US { - public: - explicit IntelLevel0TNR(int cameraId) : IntelTNR7US(cameraId){}; - virtual ~IntelLevel0TNR(); - virtual int init(int width, int height, TnrType type = TNR_INSTANCE0); - virtual int runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate = true, - int fd = -1); - - private: - std::unique_ptr mIntelICBM; - int mWidth; - int mHeight; - - private: - DISALLOW_COPY_AND_ASSIGN(IntelLevel0TNR); -}; -#endif - -} // namespace icamera diff --git a/modules/sandboxing/server/CMakeLists.txt b/modules/sandboxing/server/CMakeLists.txt deleted file mode 100644 index 8aa73668..00000000 --- a/modules/sandboxing/server/CMakeLists.txt +++ /dev/null @@ -1,75 +0,0 @@ -# -# Copyright (C) 2019-2021 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -cmake_minimum_required(VERSION 2.8) - -project(libcam_algo) - -include_directories(${USR_INCLUDE_HEADER}/ia_imaging) -include_directories(${IUTILS_DIR}) - -set(LIBCAM_ALGO_SRCS - ${IUTILS_DIR}/Utils.cpp - ${IUTILS_DIR}/Trace.cpp - ${IUTILS_DIR}/ScopedAtrace.cpp - ${IUTILS_DIR}/Thread.cpp - ${IUTILS_DIR}/CameraLog.cpp - ${PLATFORMDATA_DIR}/gc/GraphUtils.cpp - ${SANDBOXING_DIR}/IPCCommon.cpp - ${SANDBOXING_DIR}/IPCIntelLard.cpp - ${SANDBOXING_DIR}/IPCIntelFD.cpp - ${SANDBOXING_DIR}/server/IntelFDServer.cpp - ${SANDBOXING_DIR}/IPCGraphConfig.cpp - ${SANDBOXING_DIR}/server/IntelAlgoServer.cpp - ${SANDBOXING_DIR}/server/IntelLardServer.cpp - ${SANDBOXING_DIR}/server/GraphConfigServer.cpp - ${MODULES_DIR}/algowrapper/IntelLard.cpp - ${MODULES_DIR}/algowrapper/IntelFaceDetection.cpp - ${MODULES_DIR}/algowrapper/graph/GraphConfigImpl.cpp - ${MODULES_DIR}/algowrapper/graph/GraphConfigPipe.cpp - CACHE INTERNAL "libcam_algo sources" - ) - -add_library(libcam_algo SHARED ${LIBCAM_ALGO_SRCS}) - -find_package(LIBCAB) -find_package(LIBMOJO) -find_package(IA_IMAGING) -find_package(LIBIACSS) - -include_directories(${IA_IMAGING_INCLUDE_DIRS}) -include_directories(${LIBCAB_INCLUDE_DIRS}) -include_directories(${LIBMOJO_INCLUDE_DIRS}) -include_directories(${SRC_ROOT_DIR}/fd/FaceBase.h) -include_directories(${LIBIACSS_INCLUDE_DIRS}) - -link_directories(${CMAKE_PREFIX_PATH} - ${LIBMOJO_LIBS} - ${LIBCAB_LIBS} - ) - -target_link_libraries(libcam_algo ${LIBCAB_LIBS}) -target_link_libraries(libcam_algo ${LIBMOJO_LIBS}) -target_link_libraries(libcam_algo ${CMAKE_PREFIX_PATH}/libia_lard.so) -target_link_libraries(libcam_algo ${IA_IMAGING_LIBS}) -target_link_libraries(libcam_algo ${LIBIACSS_LIBS}) - -if (FACE_DETECTION) - target_link_libraries(libcam_algo pvl_eye_detection pvl_face_detection pvl_mouth_detection) -endif() - -install(TARGETS libcam_algo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -set_target_properties(libcam_algo PROPERTIES OUTPUT_NAME "cam_algo") diff --git a/modules/sandboxing/server/GraphConfigServer.cpp b/modules/sandboxing/server/GraphConfigServer.cpp deleted file mode 100644 index 99c55840..00000000 --- a/modules/sandboxing/server/GraphConfigServer.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG GraphConfigServer - -#include "modules/sandboxing/server/GraphConfigServer.h" - -#include -#include - -#include "CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { -GraphConfigServer::GraphConfigServer() { - LOG1("@%s", __func__); -} - -GraphConfigServer::~GraphConfigServer() { - LOG1("@%s", __func__); -} - -void GraphConfigServer::addCustomKeyMap() { - std::shared_ptr graphConfigImpl = std::make_shared(); - graphConfigImpl->addCustomKeyMap(); -} - -status_t GraphConfigServer::parse(void* pData, size_t dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - - GraphParseParams* parseParam = nullptr; - bool ret = mIpc.serverUnflattenParse(pData, dataSize, &parseParam); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenParse fails", __func__); - - std::shared_ptr graphConfigImpl = std::make_shared(); - status_t rt = graphConfigImpl->parse(parseParam->cameraId, parseParam->GD, parseParam->gdSize, - parseParam->GS, parseParam->gsSize); - CheckAndLogError(rt != OK, UNKNOWN_ERROR, "@%s, Failed to parse the graph xml data", __func__); - - return OK; -} - -void GraphConfigServer::releaseGraphNodes() { - if (mGraphConfigMap.empty()) return; - mGraphConfigMap.begin()->second->releaseGraphNodes(); -} - -status_t GraphConfigServer::queryGraphSettings(void* pData, size_t dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - - GraphBaseInfo info; - GraphSettingType type; - std::vector streams; - bool dummyStillSink; - bool ret = - mIpc.serverUnflattenConfigStreams(pData, dataSize, &info, &type, &dummyStillSink, &streams); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, clientFlattenConfigStreams fails", - __func__); - - GraphQueryGraphParams* params = static_cast(pData); - std::shared_ptr graphConfigImpl = - std::make_shared(info.cameraId, info.configMode, type); - params->isHasGraphSettings = graphConfigImpl->queryGraphSettings(streams); - - return OK; -} - -status_t GraphConfigServer::configStreams(void* pData, size_t dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - - GraphBaseInfo info; - GraphSettingType type; - std::vector streams; - bool dummyStillSink; - bool ret = - mIpc.serverUnflattenConfigStreams(pData, dataSize, &info, &type, &dummyStillSink, &streams); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenConfigStreams fails", - __func__); - - // release the old item - auto it = mGraphConfigMap.find(info); - if (it != mGraphConfigMap.end()) { - mGraphConfigMap.erase(it); - } - LOG1(" @%s configMode: %d, settingType: %d, dummyStillSink: %d", info.cameraId, __func__, - info.configMode, type, dummyStillSink); - std::shared_ptr graphConfigImpl = - std::make_shared(info.cameraId, info.configMode, type); - status_t rt = graphConfigImpl->configStreams(streams, dummyStillSink); - CheckAndLogError(rt != OK, ret, " @%s, Failed to configStreams, configMode: %d", - info.cameraId, __func__, info.configMode); - - mGraphConfigMap[info] = graphConfigImpl; - - return OK; -} - -status_t GraphConfigServer::getGraphConfigData(void* pData, size_t dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - - GraphBaseInfo info; - bool ret = mIpc.serverUnflattenGetGraphData(pData, dataSize, &info); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenGetGraphData fails", - __func__); - - auto it = mGraphConfigMap.find(info); - CheckAndLogError(it == mGraphConfigMap.end(), UNKNOWN_ERROR, - " @%s, Failed to find the graph config", info.cameraId, __func__); - - IGraphType::GraphConfigData graphData; - status_t rt = it->second->getGraphConfigData(&graphData); - CheckAndLogError(rt != OK, UNKNOWN_ERROR, " @%s, Failed to getGraphConfigData", - info.cameraId, __func__); - - ret = mIpc.serverFlattenGetGraphData(pData, dataSize, graphData); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverFlattenGetGraphData fails", __func__); - - return OK; -} - -status_t GraphConfigServer::getPgIdForKernel(void* pData, size_t dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - - uint32_t streamId = -1; - int32_t kernelId = 0; - GraphBaseInfo info; - bool ret = mIpc.serverUnFlattenGetPgId(pData, dataSize, &info, &streamId, &kernelId); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnFlattenGetPgId fails", __func__); - - auto it = mGraphConfigMap.find(info); - CheckAndLogError(it == mGraphConfigMap.end(), UNKNOWN_ERROR, - " @%s, Failed to find the graph config", info.cameraId, __func__); - - int32_t pgId = -1; - it->second->getPgIdForKernel(streamId, kernelId, &pgId); - - ret = mIpc.serverFlattenGetPgId(pData, dataSize, pgId); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverFlattenGetPgId fails", __func__); - - return OK; -} - -status_t GraphConfigServer::pipelineGetConnections(void* pData, size_t dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - - GraphBaseInfo info; - std::vector pgList; - bool ret = mIpc.serverUnFlattenGetConnection(pData, dataSize, &info, &pgList); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnFlattenGetPgId fails", __func__); - - auto it = mGraphConfigMap.find(info); - CheckAndLogError(it == mGraphConfigMap.end(), UNKNOWN_ERROR, - " @%s, Failed to find the graph config", info.cameraId, __func__); - - std::vector confVector; - std::vector scalerInfo; - std::vector tnrPortFormat; - status_t rt = - it->second->pipelineGetConnections(pgList, &scalerInfo, &confVector, &tnrPortFormat); - CheckAndLogError(rt != OK, UNKNOWN_ERROR, " @%s, Failed to getConnection", info.cameraId, - __func__); - - ret = mIpc.serverFlattenGetConnection(pData, dataSize, scalerInfo, confVector, tnrPortFormat); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverFlattenGetPgId fails", __func__); - - return OK; -} -} // namespace icamera diff --git a/modules/sandboxing/server/GraphConfigServer.h b/modules/sandboxing/server/GraphConfigServer.h deleted file mode 100644 index 309fac08..00000000 --- a/modules/sandboxing/server/GraphConfigServer.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "iutils/Errors.h" -#include "modules/algowrapper/graph/GraphConfigImpl.h" -#include "modules/sandboxing/IPCGraphConfig.h" - -namespace icamera { -class GraphConfigServer { - public: - GraphConfigServer(); - virtual ~GraphConfigServer(); - - void addCustomKeyMap(); - status_t parse(void* pData, size_t dataSize); - void releaseGraphNodes(); - status_t queryGraphSettings(void* pData, size_t dataSize); - status_t configStreams(void* pData, size_t dataSize); - status_t getGraphConfigData(void* pData, size_t dataSize); - status_t getPgIdForKernel(void* pData, size_t dataSize); - status_t pipelineGetConnections(void* pData, size_t dataSize); - - private: - std::map > mGraphConfigMap; - IPCGraphConfig mIpc; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelAlgoServer.cpp b/modules/sandboxing/server/IntelAlgoServer.cpp deleted file mode 100644 index 2ca29d54..00000000 --- a/modules/sandboxing/server/IntelAlgoServer.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelAlgoServer - -#include "modules/sandboxing/server/IntelAlgoServer.h" - -#include -#include -#include -#include - -#include -#include - -#include "iutils/Utils.h" -#ifndef GPU_ALGO_SERVER -#include "modules/sandboxing/server/IntelCPUAlgoServer.h" -#else -#include "modules/sandboxing/server/IntelGPUAlgoServer.h" -#endif - -namespace icamera { - -IntelAlgoServer* IntelAlgoServer::mInstance = nullptr; - -void IntelAlgoServer::init() { - if (mInstance == nullptr) { - mInstance = new IntelAlgoServer; - } -} - -void IntelAlgoServer::deInit() { - delete mInstance; - mInstance = nullptr; -} - -IntelAlgoServer::IntelAlgoServer() : mCallback(nullptr) { - ia_env env = {&Log::ccaPrintInfo, &Log::ccaPrintError, &Log::ccaPrintInfo}; - ia_log_init(&env); - - for (int i = 0; i < kThreadNum; i++) { - std::string name = IntelAlgoServerThreadName(i); - mThreads[i] = std::unique_ptr(new base::Thread(name)); - mThreads[i]->Start(); - } -#ifndef GPU_ALGO_SERVER - mRequestHandler = std::unique_ptr(new IntelCPUAlgoServer(this)); -#else - mRequestHandler = std::unique_ptr(new IntelGPUAlgoServer(this)); -#endif - - for (int32_t i = 1; i <= HANDLE_INDEX_MAX_VALUE; i++) { - mHandlesQueue.push(i); - } - - LOG1("@%s Construct done, %d threads started", __func__, kThreadNum); -} - -IntelAlgoServer::~IntelAlgoServer() { - LOG1("@%s Destroy", __func__); - ia_log_deinit(); -} - -int32_t IntelAlgoServer::initialize(const camera_algorithm_callback_ops_t* callback_ops) { - CheckAndLogError((!callback_ops), -EINVAL, "@%s, the callback_ops is nullptr", __func__); - LOG1("@%s, callback_ops:%p", __func__, callback_ops); - - mCallback = callback_ops; - - return 0; -} - -int32_t IntelAlgoServer::registerBuffer(int buffer_fd) { - std::lock_guard l(mRegisterBufMutex); - CheckAndLogError((mHandles.find(buffer_fd) != mHandles.end()), -EINVAL, - "@%s, Buffer already registered", __func__); - CheckAndLogError(mHandlesQueue.empty(), -EBADFD, "@%s, Failed to get buffer handle index", - __func__); - - struct stat sb; - int ret = fstat(buffer_fd, &sb); - CheckAndLogError((ret == -1), -EBADFD, "@%s, Failed to get buffer status", __func__); - - void* addr = mmap(0, sb.st_size, PROT_WRITE, MAP_SHARED, buffer_fd, 0); - CheckAndLogError((!addr), -EBADFD, "@%s, Failed to map buffer", __func__); - - int32_t handle = mHandlesQueue.front(); - mHandlesQueue.pop(); - mHandles[buffer_fd] = handle; - - mShmInfoMap[handle].fd = buffer_fd; - mShmInfoMap[handle].addr = addr; - mShmInfoMap[handle].size = sb.st_size; - - return handle; -} - -int IntelAlgoServer::parseReqHeader(const uint8_t req_header[], uint32_t size) { - CheckAndLogError(size < IPC_REQUEST_HEADER_USED_NUM || req_header[0] != IPC_MATCHING_KEY, -1, - "@%s, fails, req_header[0]:%d, size:%d", __func__, req_header[0], size); - - return 0; -} - -void IntelAlgoServer::returnCallback(uint32_t req_id, status_t status, int32_t buffer_handle) { - (*mCallback->return_callback)(mCallback, req_id, status, buffer_handle); -} - -status_t IntelAlgoServer::getShmInfo(const int32_t buffer_handle, ShmInfo* memInfo) { - CheckAndLogError(!memInfo, UNKNOWN_ERROR, "%s, memInfo is nullptr", __func__); - if (buffer_handle == -1) return OK; - - CheckAndLogError(mShmInfoMap.find(buffer_handle) == mShmInfoMap.end(), UNKNOWN_ERROR, - "%s, Invalid buffer handle", __func__); - *memInfo = mShmInfoMap[buffer_handle]; - - return OK; -} - -void IntelAlgoServer::handleRequest(const MsgReq& msg) { - CheckAndLogError(!mRequestHandler, VOID_VALUE, "@%s, handler is null", __func__); - mRequestHandler->handleRequest(msg); -} - -void IntelAlgoServer::request(uint32_t req_id, const uint8_t req_header[], uint32_t size, - int32_t buffer_handle) { - IPC_GROUP group = IntelAlgoIpcCmdToGroup(static_cast(req_id)); - - int ret = parseReqHeader(req_header, size); - if (ret != 0) { - returnCallback(req_id, UNKNOWN_ERROR, buffer_handle); - return; - } - - MsgReq msg = {req_id, buffer_handle}; - -#ifndef GPU_ALGO_SERVER - int threadId = group; -#else - // GPU server thread id start from IPC_GROUP_GPU - int threadId = group - IPC_GROUP_GPU; -#endif - if (threadId >= 0 && threadId < kThreadNum) { - if (mThreads[threadId] && mThreads[threadId]->task_runner()) { - mThreads[threadId]->task_runner()->PostTask( - FROM_HERE, - base::BindOnce(&IntelAlgoServer::handleRequest, base::Unretained(this), msg)); - } - } -} - -void IntelAlgoServer::deregisterBuffers(const int32_t buffer_handles[], uint32_t size) { - std::lock_guard l(mRegisterBufMutex); - for (uint32_t i = 0; i < size; i++) { - int32_t handle = buffer_handles[i]; - if (mShmInfoMap.find(handle) == mShmInfoMap.end()) { - continue; - } - - mHandles.erase(mShmInfoMap[handle].fd); - - munmap(mShmInfoMap[handle].addr, mShmInfoMap[handle].size); - close(mShmInfoMap[handle].fd); - mShmInfoMap.erase(handle); - mHandlesQueue.push(handle); - } -} - -static int32_t initialize(const camera_algorithm_callback_ops_t* callback_ops) { - return IntelAlgoServer::getInstance()->initialize(callback_ops); -} - -static int32_t registerBuffer(int32_t buffer_fd) { - return IntelAlgoServer::getInstance()->registerBuffer(buffer_fd); -} - -static void request(uint32_t req_id, const uint8_t req_header[], uint32_t size, - int32_t buffer_handle) { - IntelAlgoServer::getInstance()->request(req_id, req_header, size, buffer_handle); -} - -static void deregisterBuffers(const int32_t buffer_handles[], uint32_t size) { - return IntelAlgoServer::getInstance()->deregisterBuffers(buffer_handles, size); -} - -extern "C" { -camera_algorithm_ops_t CAMERA_ALGORITHM_MODULE_INFO_SYM - __attribute__((__visibility__("default"))) = {.initialize = initialize, - .register_buffer = registerBuffer, - .request = request, - .deregister_buffers = deregisterBuffers}; -} - -__attribute__((constructor)) void initIntelAlgoServer() { - icamera::Log::setDebugLevel(); - IntelAlgoServer::init(); -} - -__attribute__((destructor)) void deinitIntelAlgoServer() { - IntelAlgoServer::deInit(); -} - -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelAlgoServer.h b/modules/sandboxing/server/IntelAlgoServer.h deleted file mode 100644 index 654689a7..00000000 --- a/modules/sandboxing/server/IntelAlgoServer.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include -#include -#include -#include - -#include "CameraLog.h" -#include "cros-camera/camera_algorithm.h" -#include "iutils/Errors.h" -#include "iutils/Thread.h" -#include "iutils/Utils.h" -#include "modules/sandboxing/IPCCommon.h" - -namespace icamera { - -#define HANDLE_INDEX_MAX_VALUE 1024 -struct MsgReq { - uint32_t req_id; - int32_t buffer_handle; -}; - -typedef struct { - int32_t fd; - void* addr; - size_t size; -} ShmInfo; - -class IntelAlgoServer; -class RequestHandler { - public: - explicit RequestHandler(IntelAlgoServer* server) { mIntelAlgoServer = server; } - virtual ~RequestHandler() {} - virtual void handleRequest(const MsgReq& msg) = 0; - IntelAlgoServer* getIntelAlgoServer() { return mIntelAlgoServer; } - - private: - IntelAlgoServer* mIntelAlgoServer; -}; - -class IntelAlgoServer { - public: - static void init(); - static void deInit(); - - static IntelAlgoServer* getInstance() { return mInstance; } - - int32_t initialize(const camera_algorithm_callback_ops_t* callback_ops); - int32_t registerBuffer(int buffer_fd); - void request(uint32_t req_id, const uint8_t req_header[], uint32_t size, int32_t buffer_handle); - void deregisterBuffers(const int32_t buffer_handles[], uint32_t size); - - void handleRequest(const MsgReq& msg); - status_t getShmInfo(const int32_t buffer_handle, ShmInfo* memInfo); - void returnCallback(uint32_t req_id, status_t status, int32_t buffer_handle); - - private: - IntelAlgoServer(); - ~IntelAlgoServer(); - int parseReqHeader(const uint8_t req_header[], uint32_t size); - - private: - static IntelAlgoServer* mInstance; -#ifndef GPU_ALGO_SERVER - static const int kThreadNum = IPC_CPU_GROUP_NUM; -#else - static const int kThreadNum = IPC_GPU_GROUP_NUM; -#endif - std::unique_ptr mThreads[kThreadNum]; - std::unique_ptr mRequestHandler; - - const camera_algorithm_callback_ops_t* mCallback; - - // key: shared memory fd from client - // value: handle that returns from RegisterBuffer() - std::unordered_map mHandles; - - // key: handle that returns from RegisterBuffer() - // value: shared memory fd and mapped address - std::unordered_map mShmInfoMap; - std::queue mHandlesQueue; - std::mutex mRegisterBufMutex; - - DISALLOW_COPY_AND_ASSIGN(IntelAlgoServer); -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelCPUAlgoServer.cpp b/modules/sandboxing/server/IntelCPUAlgoServer.cpp deleted file mode 100644 index c8f112bd..00000000 --- a/modules/sandboxing/server/IntelCPUAlgoServer.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelCPUAlgoServer - -#include "modules/sandboxing/server/IntelCPUAlgoServer.h" - -#include -#include -#include -#include - -#include -#include - -#include "iutils/Utils.h" - -namespace icamera { - -// Common check before the function call -#define FUNCTION_PREPARED_RETURN \ - uint16_t key = getKey(p->cameraId, p->tuningMode); \ - if (mCcas.find(key) == mCcas.end()) { \ - LOGE("@%s, req_id:%d, it doesn't find the cca", __func__, req_id); \ - status = UNKNOWN_ERROR; \ - break; \ - } - -IntelCPUAlgoServer::~IntelCPUAlgoServer() { - for (auto& it : mCcas) { - delete it.second; - } -} - -void IntelCPUAlgoServer::handleRequest(const MsgReq& msg) { - uint32_t req_id = msg.req_id; - int32_t buffer_handle = msg.buffer_handle; - - ShmInfo info = {}; - status_t status = getIntelAlgoServer()->getShmInfo(buffer_handle, &info); - if (status != OK) { - LOGE("@%s, Invalid buffer handle", __func__); - getIntelAlgoServer()->returnCallback(req_id, UNKNOWN_ERROR, buffer_handle); - return; - } - - size_t requestSize = info.size; - void* addr = info.addr; - - switch (req_id) { - case IPC_FD_INIT: - status = mFaceDetection.init(addr, requestSize); - break; - case IPC_FD_RUN: { - FaceDetectionRunParams* palParams = static_cast(addr); - void* addrImage = nullptr; - if (palParams->bufferHandle >= 0) { - ShmInfo imageDataInfo; - status = getIntelAlgoServer()->getShmInfo(palParams->bufferHandle, &imageDataInfo); - if (status != OK) { - LOGE("%s, the buffer handle for image data is invalid", __func__); - break; - } - addrImage = imageDataInfo.addr; - } - status = mFaceDetection.run(addr, requestSize, addrImage); - break; - } - case IPC_FD_DEINIT: - status = mFaceDetection.deinit(addr, requestSize); - break; - case IPC_GRAPH_ADD_KEY: - mGraph.addCustomKeyMap(); - break; - case IPC_GRAPH_PARSE: - mGraph.parse(addr, requestSize); - break; - case IPC_GRAPH_RELEASE_NODES: - mGraph.releaseGraphNodes(); - break; - case IPC_GRAPH_QUERY_GRAPH_SETTINGS: - status = mGraph.queryGraphSettings(addr, requestSize); - break; - case IPC_GRAPH_CONFIG_STREAMS: - mGraph.configStreams(addr, requestSize); - break; - case IPC_GRAPH_GET_CONFIG_DATA: - mGraph.getGraphConfigData(addr, requestSize); - break; - case IPC_GRAPH_GET_CONNECTION: - mGraph.pipelineGetConnections(addr, requestSize); - break; - case IPC_GRAPH_GET_PG_ID: - mGraph.getPgIdForKernel(addr, requestSize); - break; - case IPC_CCA_CONSTRUCT: { - intel_cca_struct_data* p = static_cast(addr); - uint16_t key = getKey(p->cameraId, p->tuningMode); - if (mCcas.find(key) != mCcas.end()) { - delete mCcas[key]; - mCcas.erase(key); - } - - mCcas[key] = new IntelCcaServer(p->cameraId, p->tuningMode); - - break; - } - case IPC_CCA_DESTRUCT: { - intel_cca_struct_data* p = static_cast(addr); - uint16_t key = getKey(p->cameraId, p->tuningMode); - if (mCcas.find(key) == mCcas.end()) { - LOGE("@%s, req_id:%d, it doesn't find the cca", __func__, req_id); - status = UNKNOWN_ERROR; - break; - } - - delete mCcas[key]; - mCcas.erase(key); - - break; - } - case IPC_CCA_INIT: { - intel_cca_init_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->init(addr, requestSize); - break; - } - case IPC_CCA_RUN_AEC: { - intel_cca_run_aec_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - if (p->hasDecodeStats) { - intel_cca_decode_stats_data* pDecodeStats = &p->decodeStatsParams; - status = decodeStats(pDecodeStats, key); - if (status != OK) { - LOGE("failed to decode stats in sandbox"); - break; - } - } - - status = mCcas[key]->runAEC(addr, requestSize); - break; - } - case IPC_CCA_RUN_AIQ: { - intel_cca_run_aiq_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - if (p->mknResultsHandle >= 0) { - ShmInfo paramsInfo = {}; - status = getIntelAlgoServer()->getShmInfo(p->mknResultsHandle, ¶msInfo); - if (status != OK) { - LOGE("%s, the buffer handle for mknResultsHandle is invalid", __func__); - break; - } - p->mknResults = static_cast(paramsInfo.addr); - } - - if (p->aiqResultHandle >= 0) { - ShmInfo paramsInfo = {}; - status = getIntelAlgoServer()->getShmInfo(p->aiqResultHandle, ¶msInfo); - if (status != OK) { - LOGE("%s, the buffer handle for aiqResultsHandle is invalid", __func__); - break; - } - p->results = static_cast(paramsInfo.addr); - } - - status = mCcas[key]->runAIQ(addr, requestSize); - break; - } - case IPC_CCA_RUN_LTM: { - intel_cca_run_ltm_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->runLTM(addr, requestSize); - break; - } - case IPC_CCA_UPDATE_ZOOM: { - intel_cca_update_zoom_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->updateZoom(addr, requestSize); - break; - } - case IPC_CCA_RUN_DVS: { - intel_cca_run_dvs_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->runDVS(addr, requestSize); - break; - } - case IPC_CCA_RUN_AIC: { - status = UNKNOWN_ERROR; - intel_cca_run_aic_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - if (p->palDataHandle >= 0) { - ShmInfo inParamsInfo = {}; - status = getIntelAlgoServer()->getShmInfo(p->inParamsHandle, &inParamsInfo); - if (status != OK) { - LOGE("%s, the buffer handle for inParamsHandle is invalid", __func__); - break; - } - p->inParams = static_cast(inParamsInfo.addr); - - ShmInfo palDataInfo = {}; - status = getIntelAlgoServer()->getShmInfo(p->palDataHandle, &palDataInfo); - if (status != OK) { - LOGE("%s, the buffer handle for palDataHandle is invalid", __func__); - break; - } - p->palOutData.data = palDataInfo.addr; - - status = mCcas[key]->runAIC(addr, requestSize); - } - break; - } - case IPC_CCA_GET_CMC: { - intel_cca_get_cmc_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->getCMC(addr, requestSize); - break; - } - case IPC_CCA_GET_AIQD: { - intel_cca_get_aiqd_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->getAiqd(addr, requestSize); - break; - } - case IPC_CCA_UPDATE_TUNING: { - intel_cca_update_tuning_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - mCcas[key]->updateTuning(addr, requestSize); - break; - } - case IPC_CCA_DEINIT: { - intel_cca_deinit_data* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->deinit(addr, requestSize); - break; - } - case IPC_CCA_GET_PAL_SIZE: { - intel_cca_get_pal_data_size* p = static_cast(addr); - FUNCTION_PREPARED_RETURN - - status = mCcas[key]->getPalDataSize(addr, requestSize); - break; - } - case IPC_PG_PARAM_INIT: - status = mPGParam.init(addr, requestSize); - break; - case IPC_PG_PARAM_PREPARE: { - pg_param_prepare_params* prepareParams = static_cast(addr); - ShmInfo palDataInfo = {}; - status = getIntelAlgoServer()->getShmInfo(prepareParams->ipuParamHandle, &palDataInfo); - if (status != OK) { - LOGE("%s, the buffer handle for pal data is invalid", __func__); - break; - } - status = mPGParam.prepare(addr, requestSize, palDataInfo.addr); - break; - } - case IPC_PG_PARAM_ALLOCATE_PG: - status = mPGParam.allocatePGBuffer(addr, requestSize); - break; - case IPC_PG_PARAM_GET_FRAG_DESCS: - status = mPGParam.getFragmentDescriptors(addr, requestSize); - break; - case IPC_PG_PARAM_PREPARE_PROGRAM: - status = mPGParam.setPGAndPrepareProgram(addr, requestSize); - break; - case IPC_PG_PARAM_REGISTER_PAYLOADS: - status = mPGParam.registerPayloads(addr, requestSize); - break; - case IPC_PG_PARAM_ENCODE: { - pg_param_encode_params* encodeParams = static_cast(addr); - ShmInfo palDataInfo = {}; - status = getIntelAlgoServer()->getShmInfo(encodeParams->ipuParamHandle, &palDataInfo); - if (status != OK) { - LOGE("%s, the buffer handle for pal data is invalid", __func__); - break; - } - status = mPGParam.updatePALAndEncode(addr, requestSize, palDataInfo.addr); - break; - } - case IPC_PG_PARAM_DECODE: { - pg_param_decode_params* decodeParams = static_cast(addr); - ShmInfo decodeInfo = {}; - status = getIntelAlgoServer()->getShmInfo(decodeParams->clientStatsHandle, &decodeInfo); - if (status == OK) { - status = mPGParam.decode(addr, requestSize, decodeInfo.addr); - } else { - LOGE("%s, the buffer handle for stats data is invalid", __func__); - } - - if (decodeParams->hasStatsDecode) { - // Update stats bin size - intel_cca_decode_stats_data* p = &decodeParams->decodeStatsParams; - p->statsBuffer.size = decodeParams->statsSize; - FUNCTION_PREPARED_RETURN - status = decodeStats(p, key); - } - - break; - } - case IPC_PG_PARAM_DEINIT: - mPGParam.deinit(addr, requestSize); - break; - default: - LOGE("@%s, req_id:%d is not defined", __func__, req_id); - status = UNKNOWN_ERROR; - break; - } - - LOG2("@%s, req_id:%d:%s, status:%d", __func__, req_id, - IntelAlgoIpcCmdToString(static_cast(req_id)), status); - getIntelAlgoServer()->returnCallback(req_id, status, buffer_handle); -} - -status_t IntelCPUAlgoServer::decodeStats(intel_cca_decode_stats_data* p, uint16_t key) { - ShmInfo info = {}; - status_t status = getIntelAlgoServer()->getShmInfo(p->statsHandle, &info); - CheckAndLogError(status != OK, status, "the handle for stats data is invalid"); - - return mCcas[key]->decodeStats(p, info.addr); -} - -uint16_t IntelCPUAlgoServer::getKey(int cameraId, TuningMode mode) { - return ((cameraId & 0xFF) << 8) + (mode & 0xFF); -} -} // namespace icamera diff --git a/modules/sandboxing/server/IntelCPUAlgoServer.h b/modules/sandboxing/server/IntelCPUAlgoServer.h deleted file mode 100644 index 30b7fbeb..00000000 --- a/modules/sandboxing/server/IntelCPUAlgoServer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include -#include -#include - -#include "CameraLog.h" -#include "GraphConfigServer.h" -#include "IntelAlgoServer.h" -#include "IntelCcaServer.h" -#include "IntelFDServer.h" -#include "IntelPGParamServer.h" -#include "cros-camera/camera_algorithm.h" -#include "iutils/Errors.h" -#include "iutils/Thread.h" -#include "modules/sandboxing/IPCCommon.h" - -namespace icamera { - -class IntelCPUAlgoServer : public RequestHandler { - public: - explicit IntelCPUAlgoServer(IntelAlgoServer* server) : RequestHandler(server) {} - virtual ~IntelCPUAlgoServer(); - void handleRequest(const MsgReq& msg); - - private: - uint16_t getKey(int cameraId, TuningMode mode); - status_t decodeStats(intel_cca_decode_stats_data* p, uint16_t key); - - private: - IntelFDServer mFaceDetection; - GraphConfigServer mGraph; - IntelPGParamServer mPGParam; - std::unordered_map mCcas; -}; -} // namespace icamera diff --git a/modules/sandboxing/server/IntelCcaServer.cpp b/modules/sandboxing/server/IntelCcaServer.cpp deleted file mode 100644 index 53c721a6..00000000 --- a/modules/sandboxing/server/IntelCcaServer.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelCcaServer - -#include "modules/sandboxing/server/IntelCcaServer.h" - -#include -#include -#include - -#include "CameraLog.h" -#include "iutils/Utils.h" -#include "modules/sandboxing/IPCGraphConfig.h" - -namespace icamera { -IntelCcaServer::IntelCcaServer(int cameraId, TuningMode mode) - : mCameraId(cameraId), - mTuningMode(mode), - mCca(nullptr) { - LOG1("@%s, mode:%d", cameraId, __func__, mode); - - mCca = IntelCca::getInstance(cameraId, mode); - CheckAndLogError(!mCca, VOID_VALUE, "%s, IntelCca::getInstance fails, cameraId(%d), mode(%d)", - __func__, mCameraId, mTuningMode); -} - -IntelCcaServer::~IntelCcaServer() { - LOG1("@%s", __func__); - - IntelCca::releaseInstance(mCameraId, mTuningMode); -} - -status_t IntelCcaServer::init(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_init_data* params = static_cast(pData); - LOG1("@%s, params->bitmap:0x%x", __func__, params->inParams.bitmap); - - ia_err ret = mCca->init(params->inParams); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::runAEC(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_run_aec_data* params = static_cast(pData); - - if (params->hasStats) { - ia_err ret = mCca->setStatsParams(params->inStatsParams); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails to set stats: %d", __func__, - ret); - } - - ia_err ret = mCca->runAEC(params->frameId, params->inParams, ¶ms->results); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::runAIQ(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_run_aiq_data* params = static_cast(pData); - - ia_err ret = mCca->runAIQ(params->frameId, params->inParams, params->results); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - if (params->mknResultsHandle >= 0) { - ret = mCca->getMKN(params->type, params->mknResults); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails to get MKN: %d", __func__, - ret); - } - - return OK; -} - -status_t IntelCcaServer::runLTM(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_run_ltm_data* params = static_cast(pData); - - ia_err ret = mCca->runLTM(params->frameId, params->inParams); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::updateZoom(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_update_zoom_data* params = static_cast(pData); - - ia_err ret = mCca->updateZoom(params->streamId, params->inParams); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::runDVS(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_run_dvs_data* params = static_cast(pData); - - ia_err ret = mCca->runDVS(params->streamId, params->frameId); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::runAIC(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_run_aic_data* params = static_cast(pData); - - bool retVal = unflattenProgramGroup(¶ms->inParams->program_group); - CheckAndLogError(retVal != true, UNKNOWN_ERROR, "@%s, unflattenProgramGroup fails", __func__); - - ia_err ret = mCca->runAIC(params->frameId, params->inParams, ¶ms->palOutData); - CheckAndLogError(ret != ia_err_none && ret != ia_err_not_run, ret, "@%s, fails: %d", __func__, - ret); - - return ret; -} - -status_t IntelCcaServer::getCMC(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_get_cmc_data* params = static_cast(pData); - - ia_err ret = mCca->getCMC(¶ms->results, params->cpf.size ? ¶ms->cpf : nullptr); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::getAiqd(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_get_aiqd_data* params = static_cast(pData); - - ia_err ret = mCca->getAiqd(¶ms->results); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::updateTuning(void* pData, int dataSize) { - PERF_CAMERA_ATRACE(); - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_update_tuning_data* params = static_cast(pData); - - ia_err ret = mCca->updateTuning(params->lardTags, params->lardParams, params->nvmParams, - params->streamId); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -status_t IntelCcaServer::deinit(void* pData, int dataSize) { - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - mCca->deinit(); - LOG1("@%s", __func__); - - return OK; -} - -status_t IntelCcaServer::decodeStats(void* pData, void* statsAddr) { - PERF_CAMERA_ATRACE(); - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(statsAddr == nullptr, UNKNOWN_ERROR, "@%s, statsAddr is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_decode_stats_data* params = static_cast(pData); - - if (params->statsBuffer.size > 0) { - params->statsBuffer.data = statsAddr; - } - - ia_err ret = mCca->decodeStats(reinterpret_cast(params->statsBuffer.data), - params->statsBuffer.size, params->bitmap, ¶ms->results, - ¶ms->outStats); - CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - return OK; -} - -bool IntelCcaServer::unflattenProgramGroup(cca::cca_program_group* result) { - CheckAndLogError(!result, false, "@%s, result is nullptr", __func__); - CheckAndLogError(result->base.kernel_count > MAX_STREAM_KERNEL_COUNT, false, - "%s, the buffer of kernel array is too small", __func__); - - result->base.run_kernels = result->run_kernels; - for (unsigned j = 0; j < result->base.kernel_count; ++j) { - if (result->run_kernels[j].resolution_info) { - result->run_kernels[j].resolution_info = &result->resolution_info[j]; - } - - if (result->run_kernels[j].resolution_history) { - result->run_kernels[j].resolution_history = &result->resolution_history[j]; - } - } - if (result->base.pipe) { - result->base.pipe = result->pipe; - } - - return true; -} - -status_t IntelCcaServer::getPalDataSize(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(mCca == nullptr, UNKNOWN_ERROR, "@%s, mCca is nullptr", __func__); - - intel_cca_get_pal_data_size* params = static_cast(pData); - bool ret = unflattenProgramGroup(¶ms->pg); - CheckAndLogError(ret != true, UNKNOWN_ERROR, "@%s, unflattenProgramGroup fails", __func__); - - uint32_t size = mCca->getPalDataSize(params->pg); - CheckAndLogError(size == 0, UNKNOWN_ERROR, "@%s, fails: %d", __func__, ret); - - params->returnSize = size; - - return OK; -} -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelCcaServer.h b/modules/sandboxing/server/IntelCcaServer.h deleted file mode 100644 index 4d26d915..00000000 --- a/modules/sandboxing/server/IntelCcaServer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "memory" -#include - -#include "iutils/Errors.h" -#include "modules/algowrapper/IntelCca.h" -#include "modules/sandboxing/IPCIntelCca.h" - -namespace icamera { -class IntelCcaServer { - public: - IntelCcaServer(int cameraId, TuningMode mode); - virtual ~IntelCcaServer(); - - status_t init(void* pData, int dataSize); - status_t runAEC(void* pData, int dataSize); - status_t runAIQ(void* pData, int dataSize); - status_t runLTM(void* pData, int dataSize); - status_t updateZoom(void* pData, int dataSize); - status_t runDVS(void* pData, int dataSize); - status_t runAIC(void* pData, int dataSize); - status_t getCMC(void* pData, int dataSize); - status_t getAiqd(void* pData, int dataSize); - status_t updateTuning(void* pData, int dataSize); - status_t deinit(void* pData, int dataSize); - status_t decodeStats(void* pData, void* statsAddr); - status_t getPalDataSize(void* pData, int dataSize); - - private: - bool unflattenProgramGroup(cca::cca_program_group* result); - - private: - int mCameraId; - TuningMode mTuningMode; - - IntelCca* mCca; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelEvcpServer.cpp b/modules/sandboxing/server/IntelEvcpServer.cpp deleted file mode 100644 index 602c1edc..00000000 --- a/modules/sandboxing/server/IntelEvcpServer.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelEVCPServer - -#include "modules/sandboxing/server/IntelEvcpServer.h" - -#include "CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { -int IntelEvcpServer::init(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "%s, pData is nullptr", __func__); - CheckAndLogError(dataSize < static_cast(sizeof(EvcpResolution)), UNKNOWN_ERROR, - "%s, Buffer mismatch", __func__); - - EvcpResolution* res = reinterpret_cast(pData); - mIntelEvcp = std::unique_ptr(new IntelEvcp()); - - return mIntelEvcp->init(res->width, res->height); -} - -int IntelEvcpServer::deInit() { - mIntelEvcp = nullptr; - - return OK; -} - -int IntelEvcpServer::runEvcpFrame(void* bufferAddr, int size) { - CheckAndLogError(bufferAddr == nullptr, UNKNOWN_ERROR, "%s, Buffer is nullptr", __func__); - - return mIntelEvcp->runEvcpFrame(bufferAddr, size) ? OK : UNKNOWN_ERROR; -} - -int IntelEvcpServer::updateEvcpParam(EvcpParam* param) { - CheckAndLogError(param == nullptr, UNKNOWN_ERROR, "%s, new param is nullptr", __func__); - - return mIntelEvcp->updateEvcpParam(param) ? OK : UNKNOWN_ERROR; -} - -int IntelEvcpServer::getEvcpParam(EvcpParam* param) const { - CheckAndLogError(param == nullptr, UNKNOWN_ERROR, "%s, param is nullptr", __func__); - - mIntelEvcp->getEvcpParam(param); - - return OK; -} - -} // namespace icamera diff --git a/modules/sandboxing/server/IntelEvcpServer.h b/modules/sandboxing/server/IntelEvcpServer.h deleted file mode 100644 index 3077bade..00000000 --- a/modules/sandboxing/server/IntelEvcpServer.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "evcp/EvcpCommon.h" -#include "iutils/Errors.h" -#include "modules/algowrapper/IntelEvcp.h" - -namespace icamera { - -class IntelEvcpServer { - public: - IntelEvcpServer() {} - ~IntelEvcpServer() {} - - int init(void* pData, int dataSize); - int deInit(); - - int runEvcpFrame(void* bufAddr, int size); - int updateEvcpParam(EvcpParam* param); - int getEvcpParam(EvcpParam* evcpParam) const; - - private: - std::unique_ptr mIntelEvcp; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelFDServer.cpp b/modules/sandboxing/server/IntelFDServer.cpp deleted file mode 100644 index 94640d5d..00000000 --- a/modules/sandboxing/server/IntelFDServer.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelFDServer - -#include "modules/sandboxing/server/IntelFDServer.h" - -#include - -#include "CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { -IntelFDServer::IntelFDServer() { - LOG1("@%s Construct", __func__); -} - -IntelFDServer::~IntelFDServer() { - LOG1("@%s Destroy", __func__); -} - -status_t IntelFDServer::init(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(dataSize < static_cast(sizeof(FaceDetectionInitParams)), UNKNOWN_ERROR, - "@%s, buffer size: %d is small", __func__, dataSize); - - FaceDetectionInitParams* inParams = static_cast(pData); - if (mFaceDetection.find(inParams->cameraId) == mFaceDetection.end()) { - mFaceDetection[inParams->cameraId] = - std::unique_ptr(new IntelFaceDetection()); - } - - return mFaceDetection[inParams->cameraId]->init(inParams, dataSize); -} - -status_t IntelFDServer::run(void* pData, int dataSize, void* imageData) { - PERF_CAMERA_ATRACE(); - TRACE_LOG_PROCESS("IntelFDServer", "runFaceDetection"); - - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(dataSize < static_cast(sizeof(FaceDetectionRunParams)), UNKNOWN_ERROR, - "@%s, buffer size: %d is small", __func__, dataSize); - pvl_image image; - int cameraId; - FaceDetectionRunParams* pFdRunParams = static_cast(pData); - mIpcFD.serverUnflattenRun(*pFdRunParams, imageData, &image, &cameraId); - CheckAndLogError((mFaceDetection.find(cameraId) == mFaceDetection.end()), UNKNOWN_ERROR, - " @%s, mFaceDetection is nullptr", cameraId, __func__); - - return mFaceDetection[cameraId]->run(&image, &pFdRunParams->results); -} - -status_t IntelFDServer::deinit(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(dataSize < static_cast(sizeof(FaceDetectionDeinitParams)), UNKNOWN_ERROR, - "@%s, buffer size: %d is small", __func__, dataSize); - - FaceDetectionDeinitParams* deinitParams = static_cast(pData); - CheckAndLogError((mFaceDetection.find(deinitParams->cameraId) == mFaceDetection.end()), - UNKNOWN_ERROR, " @%s, mFaceDetection is nullptr", deinitParams->cameraId, - __func__); - - return mFaceDetection[deinitParams->cameraId]->deinit(deinitParams, dataSize); -} -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelFDServer.h b/modules/sandboxing/server/IntelFDServer.h deleted file mode 100644 index e7d28496..00000000 --- a/modules/sandboxing/server/IntelFDServer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "iutils/Errors.h" -#include "modules/algowrapper/IntelFaceDetection.h" -#include "modules/sandboxing/IPCIntelFD.h" - -namespace icamera { -class IntelFDServer { - public: - IntelFDServer(); - virtual ~IntelFDServer(); - - status_t init(void* pData, int dataSize); - status_t run(void* pData, int dataSize, void* imageData); - status_t deinit(void* pData, int dataSize); - - private: - std::unordered_map> mFaceDetection; - IPCIntelFD mIpcFD; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelGPUAlgoServer.cpp b/modules/sandboxing/server/IntelGPUAlgoServer.cpp deleted file mode 100644 index 15fcd4b9..00000000 --- a/modules/sandboxing/server/IntelGPUAlgoServer.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelGPUAlgoServer - -#include "modules/sandboxing/server/IntelGPUAlgoServer.h" - -#include -#include -#include -#include - -#include -#include - -#include "iutils/Utils.h" - -namespace icamera { - -void IntelGPUAlgoServer::handleRequest(const MsgReq& msg) { - uint32_t req_id = msg.req_id; - int32_t buffer_handle = msg.buffer_handle; - - ShmInfo info = {}; - status_t status = getIntelAlgoServer()->getShmInfo(buffer_handle, &info); - if (status != OK) { - LOGE("@%s, Invalid buffer handle", __func__); - getIntelAlgoServer()->returnCallback(req_id, UNKNOWN_ERROR, buffer_handle); - return; - } - - size_t requestSize = info.size; - void* addr = info.addr; - - switch (req_id) { -#ifdef TNR7_CM - case IPC_GPU_TNR_INIT: - status = mTNR.init(addr, requestSize); - break; - case IPC_GPU_TNR_GET_SURFACE_INFO: { - TnrRequestInfo* requestInfo = static_cast(addr); - status = mTNR.getTnrBufferSize(requestInfo); - break; - } - case IPC_GPU_TNR_PREPARE_SURFACE: { - TnrRequestInfo* requestInfo = static_cast(addr); - ShmInfo surfaceBuffer = {}; - if (requestInfo->surfaceHandle >= 0) { - status = - getIntelAlgoServer()->getShmInfo(requestInfo->surfaceHandle, &surfaceBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for surfaceBuffer data is invalid", __func__); - break; - } - } - status = mTNR.prepareSurface(surfaceBuffer.addr, surfaceBuffer.size, requestInfo); - break; - } - case IPC_GPU_TNR_RUN_FRAME: - case IPC_GPU_TNR_THREAD2_RUN_FRAME: { - TnrRequestInfo* requestInfo = static_cast(addr); - ShmInfo inBuffer = {}; - ShmInfo outBuffer = {}; - ShmInfo paramBuffer = {}; - if (requestInfo->inHandle >= 0) { - status = getIntelAlgoServer()->getShmInfo(requestInfo->inHandle, &inBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for inBuffer data is invalid", __func__); - break; - } - } - if (requestInfo->outHandle >= 0) { - status = getIntelAlgoServer()->getShmInfo(requestInfo->outHandle, &outBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for outBuffer data is invalid", __func__); - break; - } - } - if (requestInfo->paramHandle >= 0) { - status = getIntelAlgoServer()->getShmInfo(requestInfo->paramHandle, ¶mBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for parameter is invalid", __func__); - break; - } - } - - status = mTNR.runTnrFrame(inBuffer.addr, outBuffer.addr, inBuffer.size, outBuffer.size, - paramBuffer.addr, requestInfo); - break; - } - case IPC_GPU_TNR_PARAM_UPDATE: - case IPC_GPU_TNR_THREAD2_PARAM_UPDATE: { - TnrRequestInfo* requestInfo = static_cast(addr); - status = mTNR.asyncParamUpdate(requestInfo); - break; - } - case IPC_GPU_TNR_DEINIT: { - TnrRequestInfo* requestInfo = static_cast(addr); - status = mTNR.deInit(requestInfo); - break; - } -#endif - - // LEVEL0_ICBM_S - case IPC_ICBM_INIT: - (void) requestSize; - status = mICBMServer.setup(reinterpret_cast(addr)); - break; - case IPC_ICBM_RUN_FRAME: { - status = UNKNOWN_ERROR; - ICBMReqInfo* runInfo = reinterpret_cast(addr); - ShmInfo inBuffer = {}; - if (runInfo->inHandle < 0) break; - ShmInfo outBuffer = {}; - if (runInfo->inHandle < 0) break; - - status = getIntelAlgoServer()->getShmInfo(runInfo->inHandle, &inBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for ICBM inBuffer data is invalid", __func__); - break; - } - - status = getIntelAlgoServer()->getShmInfo(runInfo->outHandle, &outBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for ICBM outBuffer data is invalid", __func__); - break; - } - if (runInfo->paramHandle >= 0) { - ShmInfo paramBuffer = {}; - status = getIntelAlgoServer()->getShmInfo(runInfo->paramHandle, ¶mBuffer); - if (status != OK) { - LOGE("%s, the buffer handle for parameter is invalid", __func__); - break; - } - runInfo->paramAddr = paramBuffer.addr; - } - runInfo->inII.bufAddr = inBuffer.addr; - runInfo->outII.bufAddr = outBuffer.addr; - - status = mICBMServer.processFrame(*runInfo); - - runInfo->inII.bufAddr = nullptr; - runInfo->outII.bufAddr = nullptr; - runInfo->paramAddr = nullptr; - break; - } - case IPC_ICBM_DEINIT: { - ICBMReqInfo* shutInfo = static_cast(addr); - status = mICBMServer.shutdown(*shutInfo); - break; - } - // LEVEL0_ICBM_E - default: - LOGE("@%s, req_id:%d is not defined", __func__, req_id); - status = UNKNOWN_ERROR; - break; - } - LOG1("@%s, req_id:%d:%s, status:%d", __func__, req_id, - IntelAlgoIpcCmdToString(static_cast(req_id)), status); - - (void)requestSize; - (void)addr; - getIntelAlgoServer()->returnCallback(req_id, status, buffer_handle); -} -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelGPUAlgoServer.h b/modules/sandboxing/server/IntelGPUAlgoServer.h deleted file mode 100644 index 98aeed68..00000000 --- a/modules/sandboxing/server/IntelGPUAlgoServer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include -#include -#include - -#include "CameraLog.h" -#include "IntelAlgoServer.h" -#include "cros-camera/camera_algorithm.h" -#include "iutils/Errors.h" -#include "iutils/Thread.h" -#include "modules/sandboxing/IPCCommon.h" -#ifdef TNR7_CM -#include "modules/sandboxing/server/IntelTNRServer.h" -#endif - -// LEVEL0_ICBM_S -#include "modules/sandboxing/server/IntelICBMServer.h" -// LEVEL0_ICBM_E - -namespace icamera { - -class IntelGPUAlgoServer : public RequestHandler { - public: - explicit IntelGPUAlgoServer(IntelAlgoServer* server) : RequestHandler(server) {} - virtual ~IntelGPUAlgoServer() {} - void handleRequest(const MsgReq& msg); - -#ifdef TNR7_CM - private: - IntelTNRServer mTNR; -#endif - - // LEVEL0_ICBM_S - private: - IntelICBMServer mICBMServer; - // LEVEL0_ICBM_E -}; - -} // namespace icamera diff --git a/modules/sandboxing/server/IntelICBMServer.cpp b/modules/sandboxing/server/IntelICBMServer.cpp deleted file mode 100644 index cf3c7381..00000000 --- a/modules/sandboxing/server/IntelICBMServer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2022-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelICBMServer - -#include "modules/sandboxing/server/IntelICBMServer.h" - -#include "CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -int IntelICBMServer::setup(ICBMInitInfo* initParam) { - mIntelICBM = std::unique_ptr(new IntelICBM()); - - return mIntelICBM->setup(initParam); -} - -int IntelICBMServer::shutdown(const ICBMReqInfo& reqInfo) { - int ret = mIntelICBM->shutdown(reqInfo); - - return ret >= 0 ? OK : ret; -} - -int IntelICBMServer::processFrame(const ICBMReqInfo& reqInfo) { - return mIntelICBM->processFrame(reqInfo); -} - -} // namespace icamera diff --git a/modules/sandboxing/server/IntelICBMServer.h b/modules/sandboxing/server/IntelICBMServer.h deleted file mode 100644 index 0dbc15d3..00000000 --- a/modules/sandboxing/server/IntelICBMServer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2022-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "icbm/ICBMTypes.h" -#include "iutils/Errors.h" -#include "modules/algowrapper/IntelICBM.h" - -namespace icamera { - -class IntelICBMServer { - public: - IntelICBMServer(){}; - ~IntelICBMServer(){}; - - int setup(ICBMInitInfo* initParam); - int shutdown(const ICBMReqInfo& reqInfo); - - int processFrame(const ICBMReqInfo& reqInfo); - - private: - std::unique_ptr mIntelICBM; -}; -} /* namespace icamera */ diff --git a/modules/sandboxing/server/IntelPGParamServer.cpp b/modules/sandboxing/server/IntelPGParamServer.cpp deleted file mode 100644 index 9962e98c..00000000 --- a/modules/sandboxing/server/IntelPGParamServer.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelPGParamS - -#include "modules/sandboxing/server/IntelPGParamServer.h" - -#include "iutils/CameraLog.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" - -namespace icamera { - -IntelPGParamServer::IntelPGParamServer() {} - -IntelPGParamServer::~IntelPGParamServer() {} - -int IntelPGParamServer::init(void* pData, int dataSize) { - int pgId = 0; - uintptr_t client = 0; - ia_p2p_platform_t platform = IA_P2P_PLATFORM_IPU6; - PgConfiguration pgConfig; - - bool ret = mIpc.serverUnflattenInit(pData, dataSize, &pgId, &client, &platform, &pgConfig); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenInit fails", __func__); - - PGParamPackage package; - package.pgId = pgId; - package.mPayloadCount = 0; - CLEAR(package.mPayloads); - package.mPGBuffer = nullptr; - mPGParamPackages[client] = package; - mPGParamPackages[client].mPGParamAdapt = std::shared_ptr(new IntelPGParam(pgId)); - int result = mPGParamPackages[client].mPGParamAdapt->init(platform, pgConfig); - CheckAndLogError(result != OK, result, "@%s, init fails", __func__); - - return OK; -} - -int IntelPGParamServer::prepare(void* pData, int dataSize, void* palDataAddr) { - uintptr_t client = 0; - ia_binary_data ipuParameters = {nullptr, 0}; - ia_css_rbm_t* rbm = nullptr; - ia_css_kernel_bitmap_t* bitmap = nullptr; - uint32_t* maxStatsSize = nullptr; - bool ret = mIpc.serverUnflattenPrepare(pData, dataSize, &client, palDataAddr, &ipuParameters, - &rbm, &bitmap, &maxStatsSize); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenPrepare fails", __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - - int result = - mPGParamPackages[client].mPGParamAdapt->prepare(&ipuParameters, rbm, bitmap, maxStatsSize); - CheckAndLogError(result != OK, result, "@%s, prepare fails", __func__); - - return OK; -} - -int IntelPGParamServer::allocatePGBuffer(void* pData, int dataSize) { - uintptr_t client = 0; - int pgSize = 0; - bool ret = mIpc.serverUnflattenAllocatePGBuffer(pData, dataSize, &client, &pgSize); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenAllocatePGBuffer fails", - __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - - // Get server data pointer of PGBuffer - void* pgBuffer = nullptr; - ret = mIpc.assignPGBuffer(pData, dataSize, pgSize, &pgBuffer); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, assignPGBuffer fails", __func__); - - mPGParamPackages[client].mPGBuffer = reinterpret_cast(pgBuffer); - return OK; -} - -int IntelPGParamServer::getFragmentDescriptors(void* pData, int dataSize) { - uintptr_t client = 0; - int descCount = 0; - ia_p2p_fragment_desc* descs = nullptr; - bool ret = mIpc.serverUnflattenGetFragDescs(pData, dataSize, &client, &descCount, &descs); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenGetFragDescs fails", - __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - - int count = mPGParamPackages[client].mPGParamAdapt->getFragmentDescriptors(descCount, descs); - CheckAndLogError(count <= 0, count, "@%s, getFragmentDescriptors fails", __func__); - - ret = mIpc.serverFlattenGetFragDescs(pData, dataSize, count); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverFlattenGetFragDescs fails", __func__); - - return OK; -} - -int IntelPGParamServer::setPGAndPrepareProgram(void* pData, int dataSize) { - uintptr_t client = 0; - bool ret = mIpc.serverUnflattenPrepareProgram(pData, dataSize, &client); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenPrepareProgram fails", - __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - PGParamPackage& package = mPGParamPackages[client]; - - int result = package.mPGParamAdapt->setPGAndPrepareProgram(package.mPGBuffer); - CheckAndLogError(result != OK, result, "@%s, setPGAndPrepareProgram fails", __func__); - - // Get payload size here - package.mPayloadCount = - package.mPGParamAdapt->getPayloadSizes(ARRAY_SIZE(package.mPayloads), package.mPayloads); - CheckAndLogError(!package.mPayloadCount, UNKNOWN_ERROR, "@%s, getPayloadSizes fails", __func__); - - ret = - mIpc.serverFlattenPrepareProgram(pData, dataSize, package.mPayloadCount, package.mPayloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverFlattenPrepareProgram fails", - __func__); - - return OK; -} - -int IntelPGParamServer::registerPayloads(void* pData, int dataSize) { - uintptr_t client = 0; - int payloadCount = 0; - ia_binary_data* cPayloads = nullptr; - ia_binary_data* sPayloads = nullptr; - bool ret = mIpc.serverUnflattenRegisterPayloads(pData, dataSize, &client, &payloadCount, - &cPayloads, &sPayloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenRegisterPayloads fails", - __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - PGParamPackage& package = mPGParamPackages[client]; - - // Save - for (int i = 0; i < payloadCount; i++) { - if (cPayloads[i].size > 0) { - package.mAllocatedPayloads[cPayloads[i].data] = sPayloads[i]; - } - } - - return OK; -} - -int IntelPGParamServer::updatePALAndEncode(void* pData, int dataSize, void* palDataAddr) { - PERF_CAMERA_ATRACE(); - TRACE_LOG_PROCESS("IntelPGParamServer", "updatePALAndEncode"); - uintptr_t client = 0; - ia_binary_data ipuParameters = {nullptr, 0}; - ia_binary_data* payloads = nullptr; - int32_t payloadCount = 0; - - bool ret = mIpc.serverUnflattenEncode(pData, dataSize, &client, palDataAddr, &ipuParameters, - &payloadCount, &payloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenEncode fails", __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - PGParamPackage& package = mPGParamPackages[client]; - CheckAndLogError(payloadCount != package.mPayloadCount, UNKNOWN_ERROR, - "@%s, wrong payloadCount", __func__); - - int result = findPayloads(package.mPayloadCount, payloads, &package.mAllocatedPayloads, - package.mPayloads); - CheckAndLogError(result != OK, result, "@%s, findPayloads fails", __func__); - - result = package.mPGParamAdapt->updatePALAndEncode(&ipuParameters, package.mPayloadCount, - package.mPayloads); - CheckAndLogError(result != OK, result, "@%s, updatePALAndEncode fails", __func__); - - return OK; -} - -int IntelPGParamServer::decode(void* pData, int dataSize, void* statsAddr) { - PERF_CAMERA_ATRACE(); - TRACE_LOG_PROCESS("IntelPGParamServer", "decode"); - uintptr_t client = 0; - ia_binary_data statistics = {statsAddr, 0}; - ia_binary_data* payloads = nullptr; - int32_t payloadCount = 0; - - bool ret = mIpc.serverUnflattenDecode(pData, dataSize, &client, &payloadCount, &payloads); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverUnflattenDecode fails", __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), UNKNOWN_ERROR, - "%s, the pg doesn't exist in the table", __func__); - PGParamPackage& package = mPGParamPackages[client]; - CheckAndLogError(payloadCount != package.mPayloadCount, UNKNOWN_ERROR, - "@%s, wrong payloadCount", __func__); - - int result = findPayloads(package.mPayloadCount, payloads, &package.mAllocatedPayloads, - package.mPayloads); - CheckAndLogError(result != OK, result, "@%s, findPayloads fails", __func__); - - result = package.mPGParamAdapt->decode(package.mPayloadCount, package.mPayloads, &statistics); - CheckAndLogError(result != OK, result, "@%s, decode fails", __func__); - - ret = mIpc.serverFlattenDecode(pData, dataSize, statistics); - CheckAndLogError(ret == false, UNKNOWN_ERROR, "@%s, serverFlattenDecode fails", __func__); - - return OK; -} - -void IntelPGParamServer::deinit(void* pData, int dataSize) { - uintptr_t client = 0; - - bool ret = mIpc.serverUnflattenDeinit(pData, dataSize, &client); - CheckAndLogError(ret == false, VOID_VALUE, "@%s, serverUnflattenDeinit fails", __func__); - - CheckAndLogError((mPGParamPackages.find(client) == mPGParamPackages.end()), VOID_VALUE, - "%s, the pg doesn't exist in the table", __func__); - - mPGParamPackages[client].mPGParamAdapt->deinit(); - mPGParamPackages.erase(client); -} - -int IntelPGParamServer::findPayloads(int32_t payloadCount, ia_binary_data* clientPayloads, - std::unordered_map* allocated, - ia_binary_data* serverPayloads) { - CheckAndLogError(!clientPayloads, BAD_VALUE, "@%s, payloads is nullptr", __func__); - CLEAR(*serverPayloads); - for (size_t i = 0; i < payloadCount; i++) { - if (!clientPayloads[i].size) continue; - - CheckAndLogError(allocated->find(clientPayloads[i].data) == allocated->end(), UNKNOWN_ERROR, - "%s: can't find client payload %p for term %zu", __func__, - clientPayloads[i].data, i); - ia_binary_data& alloc = allocated->at(clientPayloads[i].data); - CheckAndLogError(alloc.size != clientPayloads[i].size, UNKNOWN_ERROR, - "%s: payload size mismatch for term %zu", __func__, i); - serverPayloads[i] = alloc; - } - return OK; -} - -} // namespace icamera diff --git a/modules/sandboxing/server/IntelPGParamServer.h b/modules/sandboxing/server/IntelPGParamServer.h deleted file mode 100644 index 3b27cc1b..00000000 --- a/modules/sandboxing/server/IntelPGParamServer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "modules/algowrapper/IntelPGParam.h" -#include "modules/sandboxing/IPCIntelPGParam.h" - -namespace icamera { - -class IntelPGParamServer { - public: - IntelPGParamServer(); - ~IntelPGParamServer(); - - int init(void* pData, int dataSize); - int prepare(void* pData, int dataSize, void* palDataAddr); - int allocatePGBuffer(void* pData, int dataSize); - int getFragmentDescriptors(void* pData, int dataSize); - int setPGAndPrepareProgram(void* pData, int dataSize); - int registerPayloads(void* pData, int dataSize); - int updatePALAndEncode(void* pData, int dataSize, void* palDataAddr); - int decode(void* pData, int dataSize, void* statsAddr); - void deinit(void* pData, int dataSize); - - private: - struct PGParamPackage { - int pgId; - std::shared_ptr mPGParamAdapt; - ia_binary_data mPayloads[IPU_MAX_TERMINAL_COUNT]; // match terminals for encode/decode - int mPayloadCount; - ia_css_process_group_t* mPGBuffer; - - // - std::unordered_map mAllocatedPayloads; - }; - - private: - int findPayloads(int32_t payloadCount, ia_binary_data* clientPayloads, - std::unordered_map* allocated, - ia_binary_data* serverPayloads); - - IPCIntelPGParam mIpc; - std::unordered_map mPGParamPackages; -}; - -} // namespace icamera diff --git a/modules/sandboxing/server/IntelTNRServer.cpp b/modules/sandboxing/server/IntelTNRServer.cpp deleted file mode 100644 index c111e3cf..00000000 --- a/modules/sandboxing/server/IntelTNRServer.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG IntelTNRServer - -#include "modules/sandboxing/server/IntelTNRServer.h" - -#include - -#include "CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -IntelTNRServer::IntelTNRServer() { - LOG1("@%s Construct", __func__); -} - -IntelTNRServer::~IntelTNRServer() { - mIntelTNRMap.clear(); - mLockMap.clear(); - LOG1("@%s Destroy", __func__); -} - -int IntelTNRServer::init(void* pData, int dataSize) { - CheckAndLogError(pData == nullptr, UNKNOWN_ERROR, "@%s, pData is nullptr", __func__); - CheckAndLogError(dataSize < static_cast(sizeof(TnrInitInfo)), UNKNOWN_ERROR, - "@%s, buffer size %d is small", __func__, dataSize); - TnrInitInfo* initInfo = static_cast(pData); - CheckAndLogError(initInfo->type >= TNR_INSTANCE_MAX || initInfo->type < 0, UNKNOWN_ERROR, - "@%s, invalid tnr type: %d", __func__, static_cast(initInfo->type)); - - CheckAndLogError(mIntelTNRMap.size() == TNR_INSTANCE_MAX, UNKNOWN_ERROR, - "@%s, tnr resource is busy", __func__); - - int tnrInstance; - // choose a free tnr instance - for (tnrInstance = TNR_INSTANCE0; tnrInstance < TNR_INSTANCE_MAX; tnrInstance++) { - bool find = false; - for (auto& ins : mTnrSlotMap) { - if (ins.second == tnrInstance) { - find = true; - break; - } - } - if (!find) break; - } - CheckAndLogError(tnrInstance == TNR_INSTANCE_MAX, UNKNOWN_ERROR, - "@%s, no avaliable tnr instance", __func__); - - int key = getIndex(initInfo->cameraId, initInfo->type); - if (mIntelTNRMap.find(key) == mIntelTNRMap.end()) { - mIntelTNRMap[key] = - std::unique_ptr(IntelTNR7US::createIntelTNR(initInfo->cameraId)); - } - - mLockMap[key] = std::unique_ptr(new std::mutex); - mTnrSlotMap[key] = static_cast(tnrInstance); - std::unique_lock lock(*mLockMap[key]); - - return mIntelTNRMap[key]->init(initInfo->width, initInfo->height, - static_cast(tnrInstance)); -} - -int IntelTNRServer::deInit(TnrRequestInfo* requestInfo) { - CheckAndLogError(requestInfo == nullptr, UNKNOWN_ERROR, "@%s, requestInfo is nullptr", - __func__); - int key = getIndex(requestInfo->cameraId, requestInfo->type); - CheckAndLogError((mIntelTNRMap.find(key) == mIntelTNRMap.end()), UNKNOWN_ERROR, - " @%s, IntelTNR type: %d is invalid", requestInfo->cameraId, __func__, - requestInfo->type); - { - std::unique_lock lock(*mLockMap[key]); - mIntelTNRMap.erase(key); - mTnrSlotMap.erase(key); - } - mLockMap.erase(key); - return OK; -} - -int IntelTNRServer::prepareSurface(void* pData, int dataSize, TnrRequestInfo* requestInfo) { - CheckAndLogError(pData == nullptr || requestInfo == nullptr, UNKNOWN_ERROR, - "@%s, invalid params, pData: %p, requestInfo: %p", __func__, pData, - requestInfo); - int key = getIndex(requestInfo->cameraId, requestInfo->type); - CheckAndLogError((mIntelTNRMap.find(key) == mIntelTNRMap.end()), UNKNOWN_ERROR, - " @%s, IntelTNR type: %d is invalid", requestInfo->cameraId, __func__, - requestInfo->type); - std::unique_lock lock(*mLockMap[key]); - - return mIntelTNRMap[key]->prepareSurface(pData, dataSize); -} - -int IntelTNRServer::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, void* tnrParam, TnrRequestInfo* requestInfo) { - CheckAndLogError(requestInfo == nullptr, UNKNOWN_ERROR, "@%s, requestInfo is nullptr", - __func__); - int key = getIndex(requestInfo->cameraId, requestInfo->type); - CheckAndLogError((mIntelTNRMap.find(key) == mIntelTNRMap.end()), UNKNOWN_ERROR, - " @%s, IntelTNR type: %d is invalid", requestInfo->cameraId, __func__, - requestInfo->type); - std::unique_lock lock(*mLockMap[key]); - - return mIntelTNRMap[key]->runTnrFrame(inBufAddr, outBufAddr, inBufSize, outBufSize, - static_cast(tnrParam), - requestInfo->isForceUpdate, requestInfo->outBufFd); -} - -int IntelTNRServer::asyncParamUpdate(TnrRequestInfo* requestInfo) { - CheckAndLogError(requestInfo == nullptr, UNKNOWN_ERROR, "@%s, requestInfo is nullptr", - __func__); - int key = getIndex(requestInfo->cameraId, requestInfo->type); - CheckAndLogError((mIntelTNRMap.find(key) == mIntelTNRMap.end()), UNKNOWN_ERROR, - " @%s, IntelTNR type: %d is invalid", requestInfo->cameraId, __func__, - requestInfo->type); - std::unique_lock lock(*mLockMap[key]); - - return mIntelTNRMap[key]->asyncParamUpdate(requestInfo->gain, requestInfo->isForceUpdate); -} - -int IntelTNRServer::getTnrBufferSize(TnrRequestInfo* requestInfo) { - CheckAndLogError(requestInfo == nullptr, UNKNOWN_ERROR, "@%s, requestInfo is nullptr", - __func__); - int key = getIndex(requestInfo->cameraId, requestInfo->type); - CheckAndLogError((mIntelTNRMap.find(key) == mIntelTNRMap.end()), UNKNOWN_ERROR, - " @%s, IntelTNR type: %d is invalid", requestInfo->cameraId, __func__, - requestInfo->type); - std::unique_lock lock(*mLockMap[key]); - - return mIntelTNRMap[key]->getTnrBufferSize(requestInfo->width, requestInfo->height, - &requestInfo->surfaceSize); -} - -} // namespace icamera diff --git a/modules/sandboxing/server/IntelTNRServer.h b/modules/sandboxing/server/IntelTNRServer.h deleted file mode 100644 index 6ea1be35..00000000 --- a/modules/sandboxing/server/IntelTNRServer.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2020-2023 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "iutils/Errors.h" -#include "modules/algowrapper/IntelTNR7US.h" - -namespace icamera { - -class IntelTNRServer { - public: - IntelTNRServer(); - virtual ~IntelTNRServer(); - - int init(void* pData, int dataSize); - int deInit(TnrRequestInfo* requestInfo); - int prepareSurface(void* pData, int dataSize, TnrRequestInfo* requestInfo); - int runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, void* tnrParam, TnrRequestInfo* requestInfo); - int asyncParamUpdate(TnrRequestInfo* requestInfo); - int getTnrBufferSize(TnrRequestInfo* requestInfo); - - private: - // the tnr instance of the id - std::unordered_map mTnrSlotMap; - std::unordered_map> mIntelTNRMap; - std::unordered_map> mLockMap; - // transfer cameraId and type to index of the mTnrSlotMap and mIntelTNRMap - int getIndex(int cameraId, TnrType type) { return (cameraId << TNR_INSTANCE_MAX) + type; } -}; -} /* namespace icamera */ diff --git a/src/core/CameraBuffer.cpp b/src/core/CameraBuffer.cpp index 17266e38..df093f09 100644 --- a/src/core/CameraBuffer.cpp +++ b/src/core/CameraBuffer.cpp @@ -37,13 +37,12 @@ namespace icamera { CameraBuffer::CameraBuffer(int cameraId, int usage, int memory, uint32_t size, int index, - int format) + int format, v4l2_buf_type v4l2BufType) : mNumPlanes(1), mAllocatedMemory(false), mU(nullptr), mBufferUsage(usage), mSettingSequence(-1) { - v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; int num_plane = 1; LOG2("%s: construct buffer with usage:%d, memory:%d, size:%d, format:%d, index:%d", @@ -62,28 +61,22 @@ CameraBuffer::CameraBuffer(int cameraId, int usage, int memory, uint32_t size, i case BUFFER_USAGE_GENERAL: if (PlatformData::isIsysEnabled(cameraId) && PlatformData::isCSIFrontEndCapture(cameraId)) { - type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; num_plane = CameraUtils::getNumOfPlanes(format); - } else { - type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; } break; - case BUFFER_USAGE_PSYS_STATS: - type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - break; case BUFFER_USAGE_MIPI_CAPTURE: case BUFFER_USAGE_METADATA: - type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; num_plane = CameraUtils::getNumOfPlanes(format); break; default: LOGE("Not supported Usage"); + break; } CLEAR(mMmapAddrs); CLEAR(mDmaFd); - initBuffer(memory, type, size, index, num_plane); + initBuffer(memory, v4l2BufType, size, index, num_plane); } CameraBuffer::~CameraBuffer() { @@ -104,7 +97,6 @@ void CameraBuffer::initBuffer(int memType, v4l2_buf_type bufType, uint32_t size, if (!V4L2_TYPE_IS_MULTIPLANAR(bufType)) { mV.SetOffset(0, 0); mV.SetLength(size, 0); - LOGE("SINGLE PLANE!"); } else { mV.SetLength(num_plane, 0); mNumPlanes = num_plane; diff --git a/src/core/CameraBuffer.h b/src/core/CameraBuffer.h index 0e65750c..e5fc4443 100644 --- a/src/core/CameraBuffer.h +++ b/src/core/CameraBuffer.h @@ -54,7 +54,8 @@ class CameraBuffer { int srcWidth = -1, int srcHeight = -1); public: - CameraBuffer(int cameraId, int usage, int memory, uint32_t size, int index, int format = -1); + CameraBuffer(int cameraId, int usage, int memory, uint32_t size, int index, int format = -1, + v4l2_buf_type v4l2BufType = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); virtual ~CameraBuffer(); public: diff --git a/src/core/CameraStream.cpp b/src/core/CameraStream.cpp index c3d2897f..e98e8aff 100644 --- a/src/core/CameraStream.cpp +++ b/src/core/CameraStream.cpp @@ -98,10 +98,12 @@ shared_ptr CameraStream::userBufferToCameraBuffer(camera_buffer_t* } if (!camBuffer) { // Not found in the pool, so create a new CameraBuffer for it. + v4l2_buf_type v4l2BufType = PlatformData::getV4L2BufType(mCameraId); ubuffer->index = mUserBuffersPool.size(); camBuffer = std::make_shared(mCameraId, BUFFER_USAGE_GENERAL, ubuffer->s.memType, - ubuffer->s.size, ubuffer->index, ubuffer->s.format); + ubuffer->s.size, ubuffer->index, ubuffer->s.format, + v4l2BufType); CheckAndLogError(!camBuffer, nullptr, "@%s: fail to alloc CameraBuffer", __func__); mUserBuffersPool.push_back(camBuffer); } diff --git a/src/core/DeviceBase.cpp b/src/core/DeviceBase.cpp index cf286fc7..800fdd4a 100644 --- a/src/core/DeviceBase.cpp +++ b/src/core/DeviceBase.cpp @@ -59,7 +59,7 @@ DeviceBase::DeviceBase(int cameraId, VideoNodeType nodeType, VideoNodeDirection nodeType); mDevice = new V4L2VideoNode(devName); -#ifndef CAL_BUILD +#ifdef LINUX_BUILD mBufType = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; #endif } @@ -77,21 +77,23 @@ int DeviceBase::openDevice() { SyncManager::getInstance()->updateSyncCamNum(); // FRAME_SYNC_E -#ifdef CAL_BUILD - return mDevice->Open(O_RDWR); -#else +#ifdef LINUX_BUILD int ret = mDevice->Open(O_RDWR); if (ret) return ret; int dev_caps = mDevice->GetDeviceCaps(); if (dev_caps & V4L2_CAP_VIDEO_CAPTURE) { - mBufType = static_cast(V4L2_BUF_TYPE_VIDEO_CAPTURE); + mBufType = V4L2_BUF_TYPE_VIDEO_CAPTURE; } else { - mBufType = static_cast(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); + mBufType = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; } + PlatformData::setV4L2BufType(mCameraId, mBufType); + return OK; +#else + return mDevice->Open(O_RDWR); #endif } @@ -157,7 +159,7 @@ int DeviceBase::queueBuffer(int64_t sequence) { mBufferQueuing = true; } -#ifndef CAL_BUILD +#ifdef LINUX_BUILD buffer->getV4L2Buffer().SetType(mBufType); #endif @@ -346,10 +348,10 @@ int MainDevice::createBufferPool(const stream_t& config) { v4l2fmt.fmt.pix.sizeimage = 0; } -#ifdef CAL_BUILD - v4l2fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -#else +#ifdef LINUX_BUILD v4l2fmt.type = mBufType; +#else + v4l2fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; #endif V4L2Format tmpbuf{v4l2fmt}; int ret = mDevice->SetFormat(tmpbuf); @@ -454,10 +456,10 @@ int DolCaptureDevice::createBufferPool(const stream_t& config) { v4l2fmt.fmt.pix.sizeimage = 0; v4l2fmt.fmt.pix_mp.field = 0; -#ifdef CAL_BUILD - v4l2fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -#else +#ifdef LINUX_BUILD v4l2fmt.type = mBufType; +#else + v4l2fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; #endif V4L2Format tmpbuf{v4l2fmt}; int ret = mDevice->SetFormat(tmpbuf); diff --git a/src/core/DeviceBase.h b/src/core/DeviceBase.h index b03123de..95d60ce6 100644 --- a/src/core/DeviceBase.h +++ b/src/core/DeviceBase.h @@ -152,8 +152,8 @@ class DeviceBase : public EventSource { uint32_t mMaxBufferNumber; bool mBufferQueuing; -#ifndef CAL_BUILD - uint32_t mBufType; +#ifdef LINUX_BUILD + v4l2_buf_type mBufType; #endif private: diff --git a/src/evcp/EvcpCommon.h b/src/evcp/EvcpCommon.h deleted file mode 100644 index 94215a85..00000000 --- a/src/evcp/EvcpCommon.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.||g/licenses/LICENSE-2.0 - * - * Unless required by applicable law || agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES || CONDITIONS OF ANY KIND, either express || implied. - * See the License f|| the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#define FNLEN 256 - -struct EvcpParam { - bool evcpEccEnabled; - bool evcpBdEnabled; - bool evcpEnableTurbo; - bool evcpPowerSave; - - bool evcpBGConcealment; - bool evcpBGReplacement; - bool evcpFaceBea; - bool evcpFaceFra; - - uint32_t evcpBGBufferHandle; - char evcpBGFileName[FNLEN]; -}; - -static bool inline evcpParamCmp(const EvcpParam* p1, const EvcpParam* p2) { - if (p1->evcpEccEnabled != p2->evcpEccEnabled || p1->evcpBdEnabled != p2->evcpBdEnabled || - p1->evcpBGConcealment != p2->evcpBGConcealment || - p1->evcpBGReplacement != p2->evcpBGReplacement || p1->evcpFaceFra != p2->evcpFaceFra || - p1->evcpBGBufferHandle != p2->evcpBGBufferHandle) { - return false; - } - return true; -} - -typedef EvcpParam ECCParam; - -struct EvcpRunParam { - void* bufferHandle; -}; - -struct EvcpResolution { - int32_t width; - int32_t height; -}; - -struct EvcpRunInfo { - int32_t inHandle; - uint32_t bufSize; -}; - -#define MAX_STORE_EVCP_DATA_BUF_NUM 10 diff --git a/src/evcp/EvcpManager.cpp b/src/evcp/EvcpManager.cpp deleted file mode 100644 index f056f580..00000000 --- a/src/evcp/EvcpManager.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG EvcpManager - -#include "src/evcp/EvcpManager.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "PlatformData.h" -#include "core/CameraBuffer.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { -std::unordered_map EvcpManager::sInstances; -std::unordered_map EvcpManager::mLatestParam; -Mutex EvcpManager::sLock; -Mutex EvcpManager::sParamLock; - -EvcpManager* EvcpManager::getInstance(int cameraId) { - AutoMutex lock(sLock); - - if (sInstances.find(cameraId) == sInstances.end()) { - return nullptr; - } - - return sInstances[cameraId]; -} - -bool EvcpManager::createInstance(int cameraId, int width, int height) { - AutoMutex lock(sLock); - if (sInstances.find(cameraId) == sInstances.end()) { - EvcpManager* thr = new EvcpManager(cameraId, width, height, nullptr); - bool r = thr->init(); - if (!r) { - delete thr; - return false; - } - sInstances[cameraId] = thr; - } - - return true; -} - -void EvcpManager::destoryInstance(int cameraId) { - AutoMutex lock(sLock); - - if (sInstances.find(cameraId) != sInstances.end()) { - delete sInstances[cameraId]; - sInstances.erase(cameraId); - } -} - -EvcpManager::EvcpManager(int cameraId, int width, int height, EvcpParam* evcpParam) - : mCameraId(cameraId), - mWidth(width), - mHeight(height) {} - -bool EvcpManager::init() { - mEvcp = std::unique_ptr(new IntelEvcp()); - int ret = mEvcp->init(mWidth, mHeight); - CheckAndLogError(ret != OK, false, "$%s: mEvcp init fails, ret %d", __func__, ret); - - return mEvcp->updateEvcpParam(&mLatestParam[mCameraId]); -} - -bool EvcpManager::checkingStatus() { - AutoMutex lock(sParamLock); - - if (!mLatestParam[mCameraId].evcpEccEnabled && !mLatestParam[mCameraId].evcpBGConcealment && - !mLatestParam[mCameraId].evcpFaceBea && !mLatestParam[mCameraId].evcpFaceFra) { - return false; - } - - return true; -} - -bool EvcpManager::saveNV12Img(int fd, int width, int height, char* filename) { - std::string fn; - - struct stat sb; - if (::fstat(fd, &sb)) return false; - - int filesize = sb.st_size; - - void* p = ::mmap(nullptr, filesize, PROT_READ, MAP_SHARED, fd, 0); - - if (p == MAP_FAILED) return false; - - fn = "/run/camera/Babun_"; - fn += std::to_string(width); - fn += "x"; - fn += std::to_string(height); - fn += ".NV12"; - - std::fstream ofs; - ofs.open(fn, std::ios::out | std::ios::binary | std::ios::trunc); - if (!ofs.is_open()) { - ::munmap(p, filesize); - return false; - } - - ofs.write(reinterpret_cast(p), filesize); - - ::munmap(p, filesize); - ::strncpy(filename, fn.c_str(), FNLEN); - - return true; -} - -EvcpParam EvcpManager::getParamFromExp(const icamera::Parameters* param) { - EvcpParam earam = {}; - - uint8_t eccEnable, bcMode, ffMode; - int w, h, bgFD; - - param->getEvcpEccMode(&eccEnable); - param->getEvcpBCMode(&bcMode); - param->getEvcpBRParameters(&w, &h, &bgFD); - param->getEvcpFFMode(&ffMode); - - earam.evcpEccEnabled = eccEnable; - if (bcMode == INTEL_VENDOR_CAMERA_IC_BC_MODE_BLUR) { - earam.evcpBGConcealment = true; - } else if (bcMode == INTEL_VENDOR_CAMERA_IC_BC_MODE_REPLACEMENT) { - earam.evcpBGConcealment = true; - earam.evcpBGReplacement = true; - - if (bgFD > 0) { - earam.evcpBGBufferHandle = bgFD; - if (saveNV12Img(bgFD, w, h, earam.evcpBGFileName) == false) { - earam.evcpBGConcealment = false; - earam.evcpBGReplacement = false; - earam.evcpBGBufferHandle = -1; - earam.evcpBGFileName[0] = '\0'; - } - } - } - earam.evcpFaceFra = ffMode == INTEL_VENDOR_CAMERA_IC_FF_MODE_AUTO; - - return earam; -} - -void EvcpManager::prepare4Param(icamera::Parameters* param) { - EvcpParam curParam = getEvcpParam(); - EvcpParam expParam = getParamFromExp(param); - - if (!evcpParamCmp(&curParam, &expParam)) updateEvcpParam(expParam); -} - -void EvcpManager::runEvcp(const camera_buffer_t& buffer, icamera::Parameters* param) { - prepare4Param(param); - if (checkingStatus() == false) return; - - runEvcpL(buffer); -} - -void EvcpManager::runEvcpL(const camera_buffer_t& buffer) { - int size = buffer.s.size; - - nsecs_t startTime = CameraUtils::systemTime(); - -#ifdef ENABLE_SANDBOXING - bool ret = mEvcp->runEvcpFrame(buffer.dmafd, size); -#else - void* pBuf = (buffer.s.memType == V4L2_MEMORY_DMABUF) ? - CameraBuffer::mapDmaBufferAddr(buffer.dmafd, size) : - buffer.addr; - - bool ret = mEvcp->runEvcpFrame(pBuf, size); - - if (buffer.s.memType == V4L2_MEMORY_DMABUF) { - CameraBuffer::unmapDmaBufferAddr(pBuf, size); - } -#endif - - if (ret == false) { - LOGW("@%s Evcp run frame fails", __func__); - } - - LOG2("@%s: ret:%s, Evcp takes %ums", __func__, ret ? "true" : "false", - (unsigned)((CameraUtils::systemTime() - startTime) / 1000000)); -} - -bool EvcpManager::updateEvcpParam(EvcpParam evcpParam) { - if (mEvcp->updateEvcpParam(&evcpParam)) { - AutoMutex lock(sParamLock); - mLatestParam[mCameraId] = evcpParam; - - return true; - } - - return false; -} - -EvcpParam EvcpManager::getEvcpParam() const { - AutoMutex lock(sParamLock); - - return mLatestParam[mCameraId]; -} - -} // namespace icamera diff --git a/src/evcp/EvcpManager.h b/src/evcp/EvcpManager.h deleted file mode 100644 index 9e44027e..00000000 --- a/src/evcp/EvcpManager.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#ifdef ENABLE_SANDBOXING -#include "modules/sandboxing/client/IntelEvcpClient.h" -#else -#include "modules/algowrapper/IntelEvcp.h" -#endif - -#include -#include -#include - -#include "EvcpCommon.h" -#include "Parameters.h" -#include "iutils/Errors.h" -#include "iutils/Thread.h" -#include "iutils/Utils.h" - -namespace icamera { -class IntelECC; - -class EvcpManager { - public: - EvcpManager(int cameraId, int width, int height, EvcpParam* evcpParam); - ~EvcpManager() {} - - static bool createInstance(int cameraId, int width, int height); - static EvcpManager* getInstance(int cameraId); - static void destoryInstance(int cameraId); - - void runEvcp(const camera_buffer_t& buffer, icamera::Parameters* param); - bool updateEvcpParam(EvcpParam evcpParam); - EvcpParam getEvcpParam() const; - - private: - void runEvcpL(const camera_buffer_t& buffer); - bool init(); - bool checkingStatus(); - void prepare4Param(icamera::Parameters* param); - EvcpParam getParamFromExp(const icamera::Parameters* param); - bool saveNV12Img(int fd, int width, int height, char* filename); - - static Mutex sLock; - static std::unordered_map sInstances; - - static Mutex sParamLock; - static std::unordered_map mLatestParam; - - int mCameraId; - - std::unique_ptr mEvcp; - - int mWidth; - int mHeight; - - DISALLOW_COPY_AND_ASSIGN(EvcpManager); -}; - -} // namespace icamera diff --git a/src/evcp/UltraManEvcp.cpp b/src/evcp/UltraManEvcp.cpp deleted file mode 100644 index 35f2057d..00000000 --- a/src/evcp/UltraManEvcp.cpp +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG UltraManEvcp - -#include "src/evcp/UltraManEvcp.h" - -#include -#include - -#include - -#include "iutils/CameraLog.h" -#include "iutils/Thread.h" -#include "iutils/Utils.h" - -#define EVCP_SUCCESS 0 -#define LIBEVCP_NAME "libevcp.so" - -namespace icamera { - -UltraManEvcp::UltraManEvcp(int width, int height) - : mCurrWidth(width), - mCurrHeight(height), - mFrameCount(0), - mEccEnabled(false), - mDimmerEnabled(false), - mLowPowerMode(false), - mMdfTurbo(false), - mEvcpBGConcelment(false), - mEvcpBGReplacement(false), - mFaceBea(false), - mFaceFra(false), - mCtx(nullptr), - mInit(false), - mHandleEvcpLib(nullptr) {} - -bool UltraManEvcp::init() { - setenv("NoJitter", "1", 1); - setenv("EccTaskOverwhelm", "0 1,0 1", 1); - - memset(&mApi, 0, sizeof(mApi)); - - mDevice = getSystemCMDevice(); - CheckAndLogError(mDevice == nullptr, false, "$%s:CMDevice is nullptr", __func__); - - loadEvcpLibrary(); - CheckAndLogError(mApi.EvcpCreate == nullptr, false, "$%s:Cannot call Evcp ctor", __func__); - - mCtx = mApi.EvcpCreate(mCurrWidth, mCurrHeight, mDevice, 1); - CheckAndLogError(mCtx == nullptr, false, "$%s:Evcp context is nullptr", __func__); - - mInit = true; - return true; -} - -UltraManEvcp::~UltraManEvcp() { - if (!mInit) return; - - mInit = false; - if (mCtx && mApi.EvcpDestroy) { - LOG1("@%s EVCP Shutdown ", __func__); - mApi.EvcpDestroy(mCtx); - } - ::DestroyCmDevice(mDevice); - CameraUtils::dlcloseLibrary(mHandleEvcpLib); - mHandleEvcpLib = nullptr; -} - -bool UltraManEvcp::checkEVCPBackgroundURL(const std::string& name) const { - if (name.empty()) { - LOGW("%s, FileName empty ", __func__); - return true; - } - if (access(name.c_str(), R_OK) != 0) { - LOGE("%s, Cannot read file: [%s]", __func__, name.c_str()); - return false; - } - - std::size_t pos; - pos = name.find_last_of("_"); - if (pos == std::string::npos) { - LOGW("%s, Malform filename: %s", __func__, name.c_str()); - return true; - } - - std::size_t extPos; - extPos = name.find(".nv12"); - if (pos == std::string::npos) { - LOGW("%s, Malform filename: %s", __func__, name.c_str()); - return true; - } - - if (extPos - pos <= 3) { - LOGW("%s, Malform filename: %s", __func__, name.c_str()); - return true; - } - - std::string sizeInfo = name.substr(pos + 1, extPos - pos - 1); - - std::size_t xPos = sizeInfo.find('x'); - int width = std::atol(std::string(sizeInfo.begin(), sizeInfo.begin() + xPos).c_str()); - int height = std::atol(sizeInfo.data() + xPos + 1); - - if ((width != mCurrWidth) || (height != mCurrHeight)) { - LOGW("%s Size mismatch, width = %d, height = %, mCurrHeight = %d, mCurrHeight = %d", - __func__, width, height, mCurrWidth, mCurrHeight); - } - - return true; -} - -bool UltraManEvcp::isEvcpEnable() const { - return isEccEnabled() || isBGConcelment() || isFaceBeaEnable() || isFaceFraEnable(); -} - -bool UltraManEvcp::processFrame(CmSurface2DUP* pSample) { - if (!isEvcpEnable()) { - return true; - } - - if (!mApi.EvcpProcessFrame || !mCtx) { - LOGE("%s, Evcp function error.", __func__); - return false; - } - - bool lockStatus = mCritMutexEccObject.try_lock(); - CheckAndLogError(lockStatus == false, false, "%s return as lock is occupied by others", - __func__); - - if (mApi.EvcpProcessFrame(&mCtx, pSample, pSample) == EVCP_SUCCESS) { - mFrameCount++; - mCritMutexEccObject.unlock(); - return true; - } - - // Not a fatal error - LOGW("%s EvcpProcessFrame BAD", __func__); - mCritMutexEccObject.unlock(); - return true; -} - -bool UltraManEvcp::updateEvcpInfo(const EvcpParam* param) { - if (!param->evcpBGConcealment && param->evcpBGReplacement) { - LOGW("%s EvcpBGConcealment and EvcpBGReplacement conflict", __func__); - return false; - } - - if (strlen(param->evcpBGFileName) && - !checkEVCPBackgroundURL(std::string(param->evcpBGFileName))) { - LOGE("%s checkEVCPBackgroundURL FAILED", __func__); - return false; - } - - bool res = flushStatus(param); - if (!res) LOGE("%s flushStatus FAILED", __func__); - - LOG1("@%s ECC [%d], DIM [%d], LP [%d], TURBO [%d] CON [%d] REPL [%d], FB[%d], FF[%d]", __func__, - mEccEnabled, mDimmerEnabled, mLowPowerMode, mMdfTurbo, mEvcpBGConcelment, - mEvcpBGReplacement, mFaceBea, mFaceFra); - - return true; -} - -bool UltraManEvcp::loadEvcpLibrary() { - mHandleEvcpLib = CameraUtils::dlopenLibrary(LIBEVCP_NAME, RTLD_NOW); - CheckAndLogError(!mHandleEvcpLib, false, "mHandleEvcpLib is nullptr"); -#ifndef TIGA -#define TIGA(member, fn_name) \ - do { \ - mApi.member = \ - (EVCP_API_HANDLE::pFn##member)CameraUtils::dlsymLibrary(mHandleEvcpLib, #fn_name); \ - if (mApi.member == nullptr) { \ - LOG1("@%s: LOADING " #fn_name "failed for member", __func__); \ - } \ - LOG1("@%s: " #fn_name "= %x", __func__, mApi.member); \ - } while (0) -#endif - TIGA(EvcpCreate, evcp_create_context); - TIGA(EvcpDestroy, evcp_destroy_context); - TIGA(EvcpToggleEcc, evcp_toggle_ecc); - TIGA(EvcpSetMdfTurbo, evcp_set_mdf_turbo); - TIGA(EvcpSetVerbose, evcp_set_verbose); - TIGA(EvcpSetPowerSavingMode, evcp_set_power_saving_mode); - TIGA(EvcpProcessFrame, evcp_process_frame3); - TIGA(EvcpProcessFrame2D, evcp_process_frame2); - TIGA(EvcpSetBackGroundURL, evcp_set_background_url); - TIGA(EvcpToggleBackgroundConcelment, evcp_toggle_background_concealment); - TIGA(EvcpToggleBackgroundReplacement, evcp_toggle_background_replacement); - TIGA(EvcpSetFaceBea, evcp_toggle_face_beautify); - TIGA(EvcpSetFaceFra, evcp_toggle_face_centering); -#undef TIGA - - return true; -} - -bool UltraManEvcp::setEvcpEnable(bool v) { - bool res = false; - - if (mApi.EvcpToggleEcc) { - LOG1("%s mEccEnabled will setting to %d", __func__, (int)v); - if (mApi.EvcpToggleEcc(mCtx, static_cast(v)) == EVCP_SUCCESS) { - mEccEnabled = v; - res = true; - } - } - return res; -} - -bool UltraManEvcp::setEvcpPowerSavingMode(bool v) { - bool res = false; - - if (mApi.EvcpSetPowerSavingMode) { - LOG1("%s mEvcpSetPowerSavingMode setting to %d", __func__, (int)v); - if (mApi.EvcpSetPowerSavingMode(mCtx, static_cast(v)) == EVCP_SUCCESS) { - mLowPowerMode = v; - res = true; - } - } - return res; -} - -bool UltraManEvcp::setEvcpSetMdfTurbo(bool v) { - bool res = false; - - if (mApi.EvcpSetMdfTurbo) { - LOG1("%s mMdfTurbo setting to %d", __func__, (int)v); - if (mApi.EvcpSetMdfTurbo(mCtx, static_cast(v)) == EVCP_SUCCESS) { - mMdfTurbo = v; - res = true; - } - } - return res; -} - -bool UltraManEvcp::setEvcpFaceBea(bool v) { - bool res = false; - - if (mApi.EvcpSetFaceBea) { - LOG1("%s EvcpSetFaceBea setting to %d", __func__, (int)v); - if (mApi.EvcpSetFaceBea(mCtx, static_cast(v)) == EVCP_SUCCESS) { - mFaceBea = v; - res = true; - } - } - return res; -} - -bool UltraManEvcp::setEvcpFaceFra(bool v) { - bool res = false; - - if (mApi.EvcpSetFaceFra) { - LOG1("%s FF will setting to %d", __func__, (int)v); - if (mApi.EvcpSetFaceFra(mCtx, static_cast(v)) == EVCP_SUCCESS) { - mFaceFra = v; - res = true; - } - } - return res; -} - -bool UltraManEvcp::setEvcpConcelment(bool con, bool replace, const char* filePath) { - bool res = true; - - if (mApi.EvcpToggleBackgroundConcelment) { - if (mApi.EvcpToggleBackgroundConcelment(mCtx, static_cast(con)) == EVCP_SUCCESS) { - LOG1("%s setEvcpConcelment OK", __func__); - mEvcpBGConcelment = con; - if (!mEvcpBGConcelment) mEvcpBGReplacement = false; - } else { - LOGE("%s setEvcpConcelment FAILED", __func__); - res = false; - } - } - - if (res && mApi.EvcpToggleBackgroundReplacement) { - res = setEvcpReplacement(replace, filePath); - if (res == false) { - LOGE("%s setEvcpReplacement FAILED", __func__); - } - } - - return res; -} - -bool UltraManEvcp::setEvcpReplacement(bool replace, const char* filePath) { - bool res = true; - - if (filePath) { - if (mApi.EvcpSetBackGroundURL(mCtx, filePath) == EVCP_SUCCESS) { - LOG1("%s EvcpSetBackGroundURL OK", __func__); - mEvcpBackgroundURL = std::string(filePath); - } else { - LOGE("%s EvcpSetBackGroundURL FAILED", __func__); - res = false; - } - } else { - replace = false; - } - - if (res) { - if (mApi.EvcpToggleBackgroundReplacement(mCtx, static_cast(replace)) == EVCP_SUCCESS) { - LOG1("%s EvcpToggleBackgroundReplacement OK", __func__); - mEvcpBGReplacement = replace; - } else { - LOGE("%s EvcpToggleBackgroundReplacement FAILED", __func__); - res = false; - } - } - - return res; -} - -bool UltraManEvcp::flushStatus(const EvcpParam* param) { - AutoMutex lock(mCritMutexEccObject); - - if (mEccEnabled != param->evcpEccEnabled) { - bool res = setEvcpEnable(param->evcpEccEnabled); - CheckAndLogError(res != true, false, "%s: SetEvcpEnable fails, ret %d", __func__, - static_cast(res)); - } - - if (mLowPowerMode != param->evcpPowerSave) { - bool res = setEvcpPowerSavingMode(param->evcpPowerSave); - CheckAndLogError(res != true, false, "%s: SetEvcpPowerSavingMode fails, ret %d", __func__, - static_cast(res)); - } - - if (mMdfTurbo != param->evcpEnableTurbo) { - bool res = setEvcpSetMdfTurbo(param->evcpEnableTurbo); - CheckAndLogError(res != true, false, "%s: SetEvcpSetMdfTurbo fails, ret %d", __func__, - static_cast(res)); - } - - if (mEvcpBGConcelment != param->evcpBGConcealment || - (mEvcpBGConcelment && param->evcpBGReplacement != mEvcpBGReplacement) || - ((mEvcpBGConcelment && param->evcpBGReplacement == mEvcpBGReplacement && - mEvcpBackgroundURL != param->evcpBGFileName))) { - bool res = setEvcpConcelment(param->evcpBGConcealment, param->evcpBGReplacement, - param->evcpBGFileName); - CheckAndLogError(res != true, false, "%s: SetEvcpConcelment fails, ret %d", __func__, - static_cast(res)); - } - - if (mFaceBea != param->evcpFaceBea) { - bool res = setEvcpFaceBea(param->evcpFaceBea); - CheckAndLogError(res != true, false, "%s: SetFaceBea fails, ret %d", __func__, - static_cast(res)); - } - - if (mFaceFra != param->evcpFaceFra) { - bool res = setEvcpFaceFra(param->evcpFaceFra); - CheckAndLogError(res != true, false, "%s: SetFaceFra fails, ret %d", __func__, - static_cast(res)); - } - - return true; -} - -CmDevice* UltraManEvcp::getSystemCMDevice() { - unsigned int version = 0; - - if (CreateCmDevice(mDevice, version) != CM_SUCCESS) { - LOGE("%s CreateCmDevice Failed", __func__); - return nullptr; - } - - return mDevice; -} - -bool UltraManEvcp::createCMSurface2DUP(uint32_t width, uint32_t height, CM_SURFACE_FORMAT format, - void* sysMem, CmSurface2DUP*& surface) { - if (mDevice->CreateSurface2DUP(width, height, format, sysMem, surface) != CM_SUCCESS) { - LOGE("%s CreateSurface2DUP FAILED", __func__); - return false; - } - - return true; -} - -bool UltraManEvcp::destroyCMSurface2DUP(CmSurface2DUP*& surface) { - if (mDevice->DestroySurface2DUP(surface) != CM_SUCCESS) { - LOGE("%s destroyCMSurface2DUP FAILED", __func__); - return false; - } - - return true; -} - -} // namespace icamera diff --git a/src/evcp/UltraManEvcp.h b/src/evcp/UltraManEvcp.h deleted file mode 100644 index 49b68d7e..00000000 --- a/src/evcp/UltraManEvcp.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include -#include - -#include "EvcpCommon.h" -#include "iutils/Utils.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wbitfield-constant-conversion" -#pragma clang diagnostic ignored "-Wunused-private-field" -#pragma clang diagnostic ignored "-Werror" -// HANDLE is redefined in cm_rt.h, avoid the redefinition build error -#define HANDLE cancel_fw_pre_define -#include "igfxcmrt/cm_rt.h" - -#pragma clang diagnostic pop - -struct evcp_context; - -struct EVCP_API_HANDLE { -#define _DEF_FUNC(ret, name, ...) \ - typedef ret (*pFn##name)(__VA_ARGS__); \ - pFn##name name - - _DEF_FUNC(evcp_context*, EvcpCreate, int w, int h, void* hdl, int bit); - _DEF_FUNC(void, EvcpDestroy, evcp_context* ctx); - _DEF_FUNC(int, EvcpToggleEcc, evcp_context* ctx, int enable); - _DEF_FUNC(int, EvcpSetMdfTurbo, evcp_context* ctx, bool enable); - _DEF_FUNC(int, EvcpSetVerbose, evcp_context* ctx, int verbose); - _DEF_FUNC(int, EvcpSetPowerSavingMode, evcp_context* ctx, bool enable); - _DEF_FUNC(int, EvcpProcessFrame, evcp_context** ctx, CmSurface2DUP* src, CmSurface2DUP* dst); - _DEF_FUNC(int, EvcpProcessFrame2D, evcp_context** ctx, CmSurface2D* src, CmSurface2D* dst); - _DEF_FUNC(int, EvcpSetBackGroundURL, evcp_context* ctx, const char* path); - _DEF_FUNC(int, EvcpToggleBackgroundConcelment, evcp_context* ctx, int enable); - _DEF_FUNC(int, EvcpToggleBackgroundReplacement, evcp_context* ctx, int enable); - _DEF_FUNC(int, EvcpSetFaceBea, evcp_context* ctx, int enable); - _DEF_FUNC(int, EvcpSetFaceFra, evcp_context* ctx, int enable); -#undef _DEF_FUNC -}; - -namespace icamera { - -class UltraManEvcp { - public: - UltraManEvcp(int width, int height); - bool init(); - - virtual ~UltraManEvcp(); - bool updateEvcpInfo(const EvcpParam* param); - bool processFrame(CmSurface2DUP* pSample); - - bool isEccEnabled() const { return mEccEnabled; } - bool isDimmerEnabled() const { return mDimmerEnabled; } - bool isLowPowerMode() const { return mLowPowerMode; } - bool isTurboOn() const { return mMdfTurbo; } - bool isBGConcelment() const { return mEvcpBGConcelment; } - bool isBGReplacement() const { return mEvcpBGReplacement; } - bool isFaceBeaEnable() const { return mFaceBea; } - bool isFaceFraEnable() const { return mFaceFra; } - std::string getBGFilePath() const { return mEvcpBackgroundURL; } - - bool createCMSurface2DUP(uint32_t width, uint32_t height, CM_SURFACE_FORMAT format, - void* sysMem, CmSurface2DUP*& surface); - - bool destroyCMSurface2DUP(CmSurface2DUP*& surface); - - private: - bool flushStatus(const EvcpParam* param); - bool checkEVCPBackgroundURL(const std::string& name) const; - - CmDevice* getSystemCMDevice(); - bool loadEvcpLibrary(); - - bool setEvcpEnable(bool v); - bool setEvcpPowerSavingMode(bool v); - bool setEvcpSetMdfTurbo(bool v); - bool setEvcpConcelment(bool con, bool replace, const char* filePath); - bool setEvcpReplacement(bool replace, const char* filePath); - bool isEvcpEnable() const; - std::string mEvcpBackgroundURL; - - bool setEvcpFaceBea(bool v); - bool setEvcpFaceFra(bool v); - - uint32_t mCurrWidth; - uint32_t mCurrHeight; - uint64_t mFrameCount; - bool mEccEnabled; - bool mDimmerEnabled; - bool mLowPowerMode; - bool mMdfTurbo; - - bool mEvcpBGConcelment; - bool mEvcpBGReplacement; - - bool mFaceBea; - bool mFaceFra; - - std::mutex mCritMutexEccObject; - EVCP_API_HANDLE mApi; - - evcp_context* mCtx; - CmDevice* mDevice; - bool mInit; - void* mHandleEvcpLib; - - DISALLOW_COPY_AND_ASSIGN(UltraManEvcp); -}; -} // namespace icamera diff --git a/src/hal/hal_adaptor/CMakeLists.txt b/src/hal/hal_adaptor/CMakeLists.txt index 68589e0b..9de5e13a 100644 --- a/src/hal/hal_adaptor/CMakeLists.txt +++ b/src/hal/hal_adaptor/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2023 Intel Corporation +# Copyright (C) 2023-2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,75 +14,25 @@ # limitations under the License. # -cmake_minimum_required(VERSION 2.8) -project(hal_adaptor) - # Source directories set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../) set(METADATA_DIR ${ROOT_DIR}/src/metadata) set(IUTILS_DIR ${ROOT_DIR}/src/iutils) set(HAL_ADAPTOR_DIR ${ROOT_DIR}/src/hal/hal_adaptor) -include_directories(${ROOT_DIR}/include - ${ROOT_DIR}/include/api - ${ROOT_DIR}/include/utils - ${ROOT_DIR}/src/metadata - ${ROOT_DIR}/src/iutils - ${ROOT_DIR}/src/core - ${ROOT_DIR}/src/platformdata - ${ROOT_DIR}/src/isp_control - ${ROOT_DIR}/src - ${ROOT_DIR}/modules/v4l2 - ${ROOT_DIR} - ) - -# Install directories -# CMAKE_INSTALL_PREFIX is defined when executing cmake. -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}" CACHE PATH "Target location for install command." FORCE) -endif() -message(STATUS "install prefix: " ${CMAKE_INSTALL_PREFIX}) - -include(GNUInstallDirs) - -# Set the aligned flag -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG(-faligned-new COMPILER_SUPPORTS_ALIGNED_NEW) -if (COMPILER_SUPPORTS_ALIGNED_NEW) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new") -endif() - -# Set the CXX to 11 -set (CMAKE_CXX_STANDARD 11) -add_compile_options(-Wall -Werror - -fstack-protector - -fPIE -fPIC - -DDCHECK_ALWAYS_ON - -Wformat -Wformat-security - ) - -add_definitions(-D__STDC_FORMAT_MACROS - -DHAVE_PTHREADS - -DHAVE_LINUX_OS - ) - -set(HAL_ADAPTOR_LD_FLAGS "-fPIE -fPIC -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now") - -# check if _FORTIFY_SOURCE is default defined with -O -include(${ROOT_DIR}/cmake/CheckFortifyLevel.cmake) -set(FORTIFY_SOURCE_VALUE) -check_fortify_source(FORTIFY_SOURCE_VALUE) -if(FORTIFY_SOURCE_VALUE) - message(STATUS "compiler default _FORTIFY_SOURCE=${FORTIFY_SOURCE_VALUE}") -else() - message(STATUS "_FORTIFY_SOURCE is not defined or could not be determined.") - add_compile_options(-D_FORTIFY_SOURCE=2) - set(CMAKE_SHARED_LINKER_FLAGS "${LIBCAMHAL_LD_FLAGS} -D_FORTIFY_SOURCE=2") - message(STATUS "define _FORTIFY_SOURCE=2") -endif() - -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${HAL_ADAPTOR_LD_FLAGS}") +set(HAL_ADAPTOR_INCLUDEDIRS + ${ROOT_DIR}/include + ${ROOT_DIR}/include/api + ${ROOT_DIR}/include/utils + ${ROOT_DIR}/src/metadata + ${ROOT_DIR}/src/iutils + ${ROOT_DIR}/src/core + ${ROOT_DIR}/src/platformdata + ${ROOT_DIR}/src/isp_control + ${ROOT_DIR}/src + ${ROOT_DIR}/modules/v4l2 + ${ROOT_DIR} + ) set(HAL_ADAPTOR_SRCS ${METADATA_DIR}/icamera_metadata_base.cpp @@ -100,6 +50,14 @@ set(HAL_ADAPTOR_SRCS ) add_library(hal_adaptor SHARED ${HAL_ADAPTOR_SRCS}) +target_include_directories(hal_adaptor PRIVATE ${HAL_ADAPTOR_INCLUDEDIRS}) +target_compile_definitions(hal_adaptor PRIVATE + -D__STDC_FORMAT_MACROS + -DHAVE_PTHREADS + -DHAVE_LINUX_OS + "-DCAMHAL_PLUGIN_DIR=\"${CMAKE_INSTALL_FULL_LIBDIR}/libcamhal/plugins/\"" + ) +set_target_properties(hal_adaptor PROPERTIES OUTPUT_NAME camhal) set_target_properties(hal_adaptor PROPERTIES SOVERSION 0) set_target_properties(hal_adaptor PROPERTIES VERSION "0.0.0") @@ -111,9 +69,9 @@ target_link_libraries(hal_adaptor ${CMAKE_DL_LIBS}) target_link_libraries(hal_adaptor rt) # Install headers -install(DIRECTORY ${ROOT_DIR}/include/ DESTINATION include/hal_adaptor) +install(DIRECTORY ${ROOT_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcamhal) if (SUPPORT_LIVE_TUNING) - install(FILES ${ROOT_DIR}/modules/livetune/LiveTuning.h DESTINATION include/hal_adaptor/api) + install(FILES ${ROOT_DIR}/modules/livetune/LiveTuning.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcamhal/api) endif() # Install libraries @@ -127,10 +85,7 @@ else() endif() # Install package config file -configure_file(${PROJECT_SOURCE_DIR}/hal_adaptor.pc.cmakein - ${PROJECT_SOURCE_DIR}/hal_adaptor.pc @ONLY) -install(FILES hal_adaptor.pc +configure_file(${PROJECT_SOURCE_DIR}/cmake/libcamhal.pc.cmakein + ${PROJECT_SOURCE_DIR}/libcamhal.pc @ONLY) +install(FILES ${PROJECT_SOURCE_DIR}/libcamhal.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - -set(CPACK_GENERATOR "RPM") -include(CPack) diff --git a/src/hal/hal_adaptor/HalAdaptor.cpp b/src/hal/hal_adaptor/HalAdaptor.cpp index 5651063d..4926798a 100644 --- a/src/hal/hal_adaptor/HalAdaptor.cpp +++ b/src/hal/hal_adaptor/HalAdaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation. + * Copyright (C) 2023-2024 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ namespace icamera { static void* gCameraHalLib = nullptr; static HalApiHandle gCameraHalAdaptor = {}; static char gPciId[8]; -static bool gUpstreamIpuDriver; #define CheckFuncCall(function) \ do { \ @@ -47,7 +46,7 @@ static bool gUpstreamIpuDriver; LOGE("@%s: LOADING: " #fnName "failed: %s", __func__, dlerror()); \ return; \ } \ - LOG2("@%s: LOADING: " #fnName "= %x", __func__, gCameraHalAdaptor.member); \ + LOG2("@%s: LOADING: " #fnName "= %p", __func__, gCameraHalAdaptor.member); \ } while (0) static bool get_ipu_info(const std::string& path) { @@ -75,19 +74,6 @@ static bool get_ipu_info(const std::string& path) { if (pciId.length() > 0) { retval = true; strncpy(gPciId, pciId.c_str(), sizeof(gPciId) - 1); - // TODO: Use another way to identify whether using upstream IPU driver. - // Upstream IPU isys driver use e.g. "intel_ipu6.isys.40" instead of - // "intel-ipu6-isys0". We use "." to identify it. - std::string pciPath = path + '/' + entry->d_name; - DIR* pciDir = opendir(pciPath.c_str()); - struct dirent* pciEntry; - while ((pciEntry = readdir(pciDir)) != nullptr) { - if (strstr(pciEntry->d_name, "intel")) { - gUpstreamIpuDriver = (strchr(pciEntry->d_name, '.') != nullptr); - break; - } - } - closedir(pciDir); break; } } @@ -107,28 +93,27 @@ static void load_camera_hal_library() { CheckAndLogError(!(hasIpu6Info || hasIpu7Info), VOID_VALUE, "%s, failed to open PCI device. error: %s", __func__, dlerror()); - std::string libName = "/usr/lib/"; + std::string libName = CAMHAL_PLUGIN_DIR; if (strstr(gPciId, "0xa75d") != nullptr /* RPL */ || strstr(gPciId, "0x462e") != nullptr /* ADLN */ || strstr(gPciId, "0x465d") != nullptr /* ADLP */) { - libName += "ipu_adl"; + libName += "ipu6ep"; } else if (strstr(gPciId, "0x7d19") != nullptr /* MTL */) { - libName += "ipu_mtl"; + libName += "ipu6epmtl"; } else if (strstr(gPciId, "0x645d") != nullptr /* LNL */) { - libName += "ipu_lnl"; + libName += "ipu7x"; + } else if (strstr(gPciId, "0xb05d") != nullptr /* PTL */) { + libName += "ipu75xa"; } else if (strstr(gPciId, "0x9a19") != nullptr /* TGL */) { - libName += "ipu_tgl"; + libName += "ipu6"; } else if (strstr(gPciId, "0x4e19") != nullptr /* JSL */) { - libName += "ipu_jsl"; + libName += "ipu6sepla"; } else { LOGE("%s, Not support the PCI device %s for hal adaptor API", __func__, gPciId); return; } - if (hasIpu6Info && gUpstreamIpuDriver) { - libName += "_upstream"; - } - libName += "/libcamhal.so"; + libName += ".so"; LOG1("%s, the library name: %s", __func__, libName.c_str()); gCameraHalLib = dlopen(libName.c_str(), RTLD_NOW); diff --git a/src/hal/hal_adaptor/HalAdaptor.h b/src/hal/hal_adaptor/HalAdaptor.h index cca1dab0..3c5c3275 100644 --- a/src/hal/hal_adaptor/HalAdaptor.h +++ b/src/hal/hal_adaptor/HalAdaptor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation. + * Copyright (C) 2023-2024 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hal/hal_adaptor/hal_adaptor.pc.cmakein b/src/hal/hal_adaptor/hal_adaptor.pc.cmakein deleted file mode 100644 index e77e7178..00000000 --- a/src/hal/hal_adaptor/hal_adaptor.pc.cmakein +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/hal_adaptor - -Name: libhal_adaptor -Description: Camera HAL Adaptor Library -URL: -Version: @VERSION@ -Libs: -L${libdir} -lhal_adaptor -Cflags: -I${includedir} -I${includedir}/api -I${includedir}/utils diff --git a/src/icbm/ICBMBuilder.h b/src/icbm/ICBMBuilder.h deleted file mode 100644 index 122e3856..00000000 --- a/src/icbm/ICBMBuilder.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "IntelICBM.h" -#include "OnePunchIC2.h" - -namespace icamera { - -#define USE_INTEL_OPIC2 - -#ifdef USE_INTEL_OPIC2 -static inline IIntelICBM* createIntelICBM() { - return new IntelOPIC2; -} - -#else -static inline IIntelICBM* createIntelICBM() { - return nullptr; -} -#endif - -} // namespace icamera diff --git a/src/icbm/IntelICBM.h b/src/icbm/IntelICBM.h deleted file mode 100644 index 69a53532..00000000 --- a/src/icbm/IntelICBM.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2023 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "src/icbm/ICBMTypes.h" - -namespace icamera { - -class IIntelICBM { - public: - virtual ~IIntelICBM() {} - - virtual int setup(void* initParams) = 0; - virtual void shutdown() = 0; - virtual int processFrame(const ImageInfo& iii, const ImageInfo& iio, - const ICBMReqInfo& reqInfo) = 0; -}; - -} // namespace icamera diff --git a/src/jpeg/CMakeLists.txt b/src/jpeg/CMakeLists.txt deleted file mode 100644 index 409f472e..00000000 --- a/src/jpeg/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2019 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if (SW_JPEG_ENCODE) - set(JPEG_SRCS - ${JPEG_DIR}/sw/SWJpegEncoder.cpp - CACHE INTERNAL "jpeg sources" - ) -else () - set(JPEG_SRCS - ${JPEG_DIR}/chrome/JpegEncoderCore.cpp - CACHE INTERNAL "jpeg sources" - ) -endif() - -set(JPEG_SRCS - ${JPEG_SRCS} - ${JPEG_DIR}/ExifCreater.cpp - ${JPEG_DIR}/EXIFMetaData.cpp - ${JPEG_DIR}/EXIFMaker.cpp - ${JPEG_DIR}/JpegMaker.cpp - CACHE INTERNAL "jpeg sources" - ) diff --git a/src/jpeg/EXIFMaker.cpp b/src/jpeg/EXIFMaker.cpp deleted file mode 100644 index 77e6fb95..00000000 --- a/src/jpeg/EXIFMaker.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* - * Copyright (C) 2016-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG EXIFMaker - -#include "EXIFMaker.h" - -#include - -#include -#include -#include - -#include "ParameterHelper.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -#define DEFAULT_ISO_SPEED 100 - -// The property file directory -static const char* CAMERA_CACHE_DIR = "/var/cache/camera/"; -/* - * Property file defines product name and manufactory info - * Used for EXIF header of JPEG. Format: key=value in each line - */ -static const char* CAMERA_PROPERTY_FILE = "camera.prop"; - -EXIFMaker::EXIFMaker() - : mExifSize(-1), - mInitialized(false), - mProductName(""), - mManufacturerName("") { - LOG1("@%s", __func__); - - CLEAR(mExifAttributes); - mMakernoteSection = new unsigned char[MAKERNOTE_SECTION1_SIZE + MAKERNOTE_SECTION2_SIZE]; - readProperty(); -} - -EXIFMaker::~EXIFMaker() { - LOG1("@%s", __func__); - delete[] mMakernoteSection; -} - -void EXIFMaker::readProperty() { - LOG2("@%s", __func__); - std::string cameraPropertyPath = - std::string(CAMERA_CACHE_DIR) + std::string(CAMERA_PROPERTY_FILE); - std::fstream props(cameraPropertyPath.c_str(), std::ios::in); - - if (!props.is_open()) { - LOG2("There isn't camera property file."); - return; - } - - const std::string kModel = "ro.product.model"; - const std::string kManufacturer = "ro.product.manufacturer"; - const std::string kDelimiter = "="; - std::unordered_map properties; - - while (!props.eof()) { - size_t pos; - std::string line, key, value; - - std::getline(props, line); - pos = line.find(kDelimiter); - if (pos != std::string::npos) { - key = line.substr(0, pos); - value = line.substr(pos + 1); - properties[key] = value; - LOG2("%s, new key,value: %s,%s", __func__, key.c_str(), value.c_str()); - } - } - - if (properties.find(kManufacturer) != properties.end()) { - mManufacturerName = properties[kManufacturer]; - } - if (properties.find(kModel) != properties.end()) { - mProductName = properties[kModel]; - } -} - -/** - * Fills EXIF data after a picture has been taken to - * record the active sensor, 3A and ISP state to EXIF metadata. - * - * This function is intented to set EXIF tags belonging - * to the EXIF "Per Picture Camera Setting" group. - * - * @arg params active Android HAL parameters - */ -void EXIFMaker::pictureTaken(ExifMetaData* exifmetadata) { - LOG2("@%s", __func__); - - mExifAttributes.contrast = 0; - mExifAttributes.saturation = 0; - mExifAttributes.sharpness = 0; - LOG2("EXIF: contrast=%d, saturation=%d, sharpness=%d (0:normal 1:low 2:high)", - mExifAttributes.contrast, mExifAttributes.saturation, mExifAttributes.sharpness); - - // set the exposure program mode - icamera::camera_ae_mode_t aeMode = exifmetadata->aeMode; - switch (aeMode) { - case AE_MODE_MANUAL: - mExifAttributes.exposure_program = EXIF_EXPOSURE_PROGRAM_MANUAL; - mExifAttributes.exposure_mode = EXIF_EXPOSURE_MANUAL; - LOG2("EXIF: Exposure Program = Manual, Exposure Mode = Manual"); - break; - case AE_MODE_AUTO: - default: - mExifAttributes.exposure_program = EXIF_EXPOSURE_PROGRAM_NORMAL; - mExifAttributes.exposure_mode = EXIF_EXPOSURE_AUTO; - LOG2("EXIF: Exposure Program = Normal, Exposure Mode = Auto"); - break; - } - - mExifAttributes.metering_mode = EXIF_METERING_AVERAGE; - - // white balance mode. 0: auto; 1: manual - icamera::camera_awb_mode_t awbMode = exifmetadata->awbMode; - LOG2("EXIF: awbMode = %d", awbMode); - switch (awbMode) { - case AWB_MODE_AUTO: - case AWB_MODE_MAX: - mExifAttributes.white_balance = EXIF_WB_AUTO; - break; - default: - mExifAttributes.white_balance = EXIF_WB_MANUAL; - break; - } - - // light source type. Refer to EXIF V2.2 - // TBD. Now light source is only set to UNKNOWN, when WB is auto mode. - std::unordered_map awbModeLightMap = { - {AWB_MODE_AUTO, EXIF_LIGHT_SOURCE_UNKNOWN}, - {AWB_MODE_SUNSET, EXIF_LIGHT_SOURCE_TUNGSTEN}, - {AWB_MODE_DAYLIGHT, EXIF_LIGHT_SOURCE_FINE_WEATHER}, - {AWB_MODE_PARTLY_OVERCAST, EXIF_LIGHT_SOURCE_CLOUDY_WEATHER}, - {AWB_MODE_FLUORESCENT, EXIF_LIGHT_SOURCE_FLUORESCENT}, - {AWB_MODE_INCANDESCENT, EXIF_LIGHT_SOURCE_TUNGSTEN}, - {AWB_MODE_MAX, EXIF_LIGHT_SOURCE_OTHER_LIGHT_SOURCE}, - }; - if (awbModeLightMap.find(awbMode) != awbModeLightMap.end()) { - mExifAttributes.light_source = awbModeLightMap[awbMode]; - } else { - mExifAttributes.light_source = EXIF_LIGHT_SOURCE_UNKNOWN; - } - - mExifAttributes.scene_capture_type = EXIF_SCENE_STANDARD; - - int rotation = exifmetadata->mJpegSetting.orientation; - mExifAttributes.orientation = EXIF_ORIENTATION_UP; - if (0 == rotation) - mExifAttributes.orientation = EXIF_ORIENTATION_UP; - else if (90 == rotation) - mExifAttributes.orientation = EXIF_ORIENTATION_90; - else if (180 == rotation) - mExifAttributes.orientation = EXIF_ORIENTATION_180; - else if (270 == rotation) - mExifAttributes.orientation = EXIF_ORIENTATION_270; - - // Platform has no HW rotation. No swap here - // if (rotation % 180 == 90) - // swap(mExifAttributes.width, mExifAttributes.height); - - mExifAttributes.zoom_ratio.num = exifmetadata->zoomRatio; - mExifAttributes.zoom_ratio.den = 100; - // the unit of subjectDistance is meter, focus distance from 3A is mm. - mExifAttributes.subject_distance.num = - static_cast(exifmetadata->currentFocusDistance); - mExifAttributes.subject_distance.den = 1000; - mExifAttributes.custom_rendered = - exifmetadata->hdr ? EXIF_CUSTOM_RENDERED_HDR : EXIF_DEF_CUSTOM_RENDERED; - LOG2("subject_distance is %d", mExifAttributes.subject_distance.num); -} - -/** - * Called when the the camera static configuration is known. - * - * @arg width: width of the main JPEG picture. - * @arg height: height of the main JPEG picture. - */ -void EXIFMaker::initialize(int width, int height) { - /* We clear the exif attributes, so we won't be using some old values - * from a previous EXIF generation. - */ - clear(); - - // Initialize the mExifAttributes with specific values - // time information - time_t rawtime; - struct tm* timeinfo; - time(&rawtime); - timeinfo = localtime(&rawtime); - if (timeinfo) { - strftime(reinterpret_cast(mExifAttributes.date_time), - sizeof(mExifAttributes.date_time), "%Y:%m:%d %H:%M:%S", timeinfo); - // fields: tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday, tm_yday, tm_isdst, - // tm_gmtoff, tm_zone - } else { - LOGW("nullptr timeinfo from localtime(), using defaults..."); - struct tm tmpTime = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "UTC"}; - strftime(reinterpret_cast(mExifAttributes.date_time), - sizeof(mExifAttributes.date_time), "%Y:%m:%d %H:%M:%S", &tmpTime); - } - - // set default subsec time to 1000 - const char subsecTime[] = "1000"; - MEMCPY_S(reinterpret_cast(mExifAttributes.subsec_time), - sizeof(mExifAttributes.subsec_time), subsecTime, sizeof(subsecTime)); - - // conponents configuration. - // Default = 4 5 6 0(if RGB uncompressed), 1 2 3 0(other cases) - // 0 = does not exist; 1 = Y; 2 = Cb; 3 = Cr; 4 = R; 5 = G; 6 = B; other = reserved - mExifAttributes.components_configuration[0] = 1; - mExifAttributes.components_configuration[1] = 2; - mExifAttributes.components_configuration[2] = 3; - mExifAttributes.components_configuration[3] = 0; - - // set default values for fnumber and focal length - // (see EXIFMaker::setDriverData() how to override these) - mExifAttributes.fnumber.num = EXIF_DEF_FNUMBER_NUM; - mExifAttributes.fnumber.den = EXIF_DEF_FNUMBER_DEN; - mExifAttributes.focal_length.num = EXIF_DEF_FOCAL_LEN_NUM; - mExifAttributes.focal_length.den = EXIF_DEF_FOCAL_LEN_DEN; - - mExifAttributes.iso_speed_rating = DEFAULT_ISO_SPEED; - - mExifAttributes.aperture.den = EXIF_DEF_APEX_DEN; - mExifAttributes.aperture.num = EXIF_DEF_APEX_NUM; - // max aperture. the smallest F number of the lens. unit is APEX value. - mExifAttributes.max_aperture.num = mExifAttributes.aperture.num; - mExifAttributes.max_aperture.den = mExifAttributes.aperture.den; - - // subject distance, 0 means distance unknown; (~0) means infinity. - mExifAttributes.subject_distance.num = EXIF_DEF_SUBJECT_DISTANCE_UNKNOWN; - mExifAttributes.subject_distance.den = 1; - - // light source, 0 means light source unknown - mExifAttributes.light_source = 0; - - // gain control, 0 = none; - // 1 = low gain up; 2 = high gain up; 3 = low gain down; 4 = high gain down - mExifAttributes.gain_control = 0; - - // contrast, 0 = normal; 1 = soft; 2 = hard; other = reserved - mExifAttributes.contrast = EXIF_CONTRAST_NORMAL; - - // saturation, 0 = normal; 1 = Low saturation; 2 = High saturation; other = reserved - mExifAttributes.saturation = EXIF_SATURATION_NORMAL; - - // sharpness, 0 = normal; 1 = soft; 2 = hard; other = reserved - mExifAttributes.sharpness = EXIF_SHARPNESS_NORMAL; - - // the picture's width and height - mExifAttributes.width = width; - mExifAttributes.height = height; - - mExifAttributes.orientation = 1; - - mExifAttributes.custom_rendered = EXIF_DEF_CUSTOM_RENDERED; - - // metering mode, 0 = normal; 1 = soft; 2 = hard; other = reserved - mExifAttributes.metering_mode = EXIF_METERING_UNKNOWN; - mInitialized = true; -} - -void EXIFMaker::initializeLocation(ExifMetaData* metadata) { - // GIS information - bool gpsEnabled = false; - double latitude = metadata->mGpsSetting.latitude; - double longitude = metadata->mGpsSetting.longitude; - double altitude = metadata->mGpsSetting.altitude; - long timestamp = metadata->mGpsSetting.gpsTimeStamp; - char* pprocmethod = metadata->mGpsSetting.gpsProcessingMethod; - - // check whether the GIS Information is valid - if (!(latitude >= -EPSILON && latitude <= EPSILON) || - !(longitude >= -EPSILON && longitude <= EPSILON) || - !(altitude >= -EPSILON && altitude <= EPSILON) || (timestamp != 0) || - (strlen(pprocmethod) != 0)) - gpsEnabled = true; - - mExifAttributes.enableGps = 0; - LOG1("@%s,EXIF: gpsEnabled: %d", __func__, gpsEnabled); - - // the version is given as 2.2.0.0, it is mandatory when GPSInfo tag is present - if (gpsEnabled) { - const unsigned char gpsversion[4] = {0x02, 0x02, 0x00, 0x00}; - MEMCPY_S(mExifAttributes.gps_version_id, sizeof(mExifAttributes.gps_version_id), gpsversion, - sizeof(gpsversion)); - } else { - return; - } - - // latitude, for example, 39.904214 degrees, N - if (latitude > 0) - MEMCPY_S(mExifAttributes.gps_latitude_ref, sizeof(mExifAttributes.gps_latitude_ref), "N", - sizeof(mExifAttributes.gps_latitude_ref)); - else - MEMCPY_S(mExifAttributes.gps_latitude_ref, sizeof(mExifAttributes.gps_latitude_ref), "S", - sizeof(mExifAttributes.gps_latitude_ref)); - - latitude = fabs(latitude); - mExifAttributes.gps_latitude[0].num = (uint32_t)latitude; - mExifAttributes.gps_latitude[0].den = 1; - mExifAttributes.gps_latitude[1].num = - (uint32_t)((latitude - mExifAttributes.gps_latitude[0].num) * 60); - mExifAttributes.gps_latitude[1].den = 1; - mExifAttributes.gps_latitude[2].num = - (uint32_t)(((latitude - mExifAttributes.gps_latitude[0].num) * 60 - - mExifAttributes.gps_latitude[1].num) * - 60 * 100); - mExifAttributes.gps_latitude[2].den = 100; - mExifAttributes.enableGps |= EXIF_GPS_LATITUDE; - LOG1("EXIF: latitude, ref:%s, dd:%d, mm:%d, ss:%d", mExifAttributes.gps_latitude_ref, - mExifAttributes.gps_latitude[0].num, mExifAttributes.gps_latitude[1].num, - mExifAttributes.gps_latitude[2].num); - - // longitude, for example, 116.407413 degrees, E - if (longitude > 0) - MEMCPY_S(mExifAttributes.gps_longitude_ref, sizeof(mExifAttributes.gps_longitude_ref), "E", - sizeof(mExifAttributes.gps_longitude_ref)); - else - MEMCPY_S(mExifAttributes.gps_longitude_ref, sizeof(mExifAttributes.gps_longitude_ref), "W", - sizeof(mExifAttributes.gps_longitude_ref)); - longitude = fabs(longitude); - mExifAttributes.gps_longitude[0].num = (uint32_t)longitude; - mExifAttributes.gps_longitude[0].den = 1; - mExifAttributes.gps_longitude[1].num = - (uint32_t)((longitude - mExifAttributes.gps_longitude[0].num) * 60); - mExifAttributes.gps_longitude[1].den = 1; - mExifAttributes.gps_longitude[2].num = - (uint32_t)(((longitude - mExifAttributes.gps_longitude[0].num) * 60 - - mExifAttributes.gps_longitude[1].num) * - 60 * 100); - mExifAttributes.gps_longitude[2].den = 100; - mExifAttributes.enableGps |= EXIF_GPS_LONGITUDE; - LOG1("EXIF: longitude, ref:%s, dd:%d, mm:%d, ss:%d", mExifAttributes.gps_longitude_ref, - mExifAttributes.gps_longitude[0].num, mExifAttributes.gps_longitude[1].num, - mExifAttributes.gps_longitude[2].num); - - // altitude - // altitude, sea level or above sea level, set it to 0; below sea level, set it to 1 - mExifAttributes.gps_altitude_ref = ((altitude > 0) ? 0 : 1); - altitude = fabs(altitude); - mExifAttributes.gps_altitude.num = (uint32_t)altitude; - mExifAttributes.gps_altitude.den = 1; - mExifAttributes.enableGps |= EXIF_GPS_ALTITUDE; - LOG1("EXIF: altitude, ref:%d, height:%d", mExifAttributes.gps_altitude_ref, - mExifAttributes.gps_altitude.num); - - // timestamp - if (timestamp >= LONG_MAX || timestamp <= LONG_MIN) { - timestamp = 0; - LOGW("invalid timestamp was provided, defaulting to 0 (i.e. 1970)"); - } - struct tm time; - gmtime_r(×tamp, &time); - time.tm_year += 1900; - time.tm_mon += 1; - mExifAttributes.gps_timestamp[0].num = time.tm_hour; - mExifAttributes.gps_timestamp[0].den = 1; - mExifAttributes.gps_timestamp[1].num = time.tm_min; - mExifAttributes.gps_timestamp[1].den = 1; - mExifAttributes.gps_timestamp[2].num = time.tm_sec; - mExifAttributes.gps_timestamp[2].den = 1; - mExifAttributes.enableGps |= EXIF_GPS_TIMESTAMP; - - snprintf(reinterpret_cast(mExifAttributes.gps_datestamp), - sizeof(mExifAttributes.gps_datestamp), "%04d:%02d:%02d", time.tm_year, time.tm_mon, - time.tm_mday); - - LOG1("EXIF: timestamp, year:%d,mon:%d,day:%d,hour:%d,min:%d,sec:%d", time.tm_year, time.tm_mon, - time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec); - - // processing method - MEMCPY_S(mExifAttributes.gps_processing_method, sizeof(mExifAttributes.gps_processing_method), - metadata->mGpsSetting.gpsProcessingMethod, - sizeof(metadata->mGpsSetting.gpsProcessingMethod)); - mExifAttributes.gps_processing_method[sizeof(mExifAttributes.gps_processing_method) - 1] = 0; - - mExifAttributes.enableGps |= EXIF_GPS_PROCMETHOD; - LOG1("EXIF: GPS processing method:%s", mExifAttributes.gps_processing_method); -} - -void EXIFMaker::setSensorAeConfig(const Parameters& params) { - LOG1("@%s", __func__); - - int64_t expTime = 0; - params.getExposureTime(expTime); - - if (expTime > 0) { - // EXIF exposure rational value is in seconds and the unit of exposure time in 3A is usecs - mExifAttributes.exposure_time.num = expTime; - mExifAttributes.exposure_time.den = 1000000; - uint32_t tv = APEX_EXPOSURE_TO_SHUTTER(static_cast(expTime) / - mExifAttributes.exposure_time.den); - mExifAttributes.shutter_speed.num = tv * 65536; - mExifAttributes.shutter_speed.den = 65536; - } else { - mExifAttributes.exposure_time.num = 0; - mExifAttributes.exposure_time.den = 1; - mExifAttributes.shutter_speed.num = 0; - mExifAttributes.shutter_speed.den = 1; - } - - float stepEv = 1 / 3.0f; - icamera::camera_rational_t aeCompensationStep; - if (params.getAeCompensationStep(aeCompensationStep) == 0) { - stepEv = static_cast(aeCompensationStep.numerator) / aeCompensationStep.denominator; - } - - int32_t ev = 0; - float evBias = 0; - if (params.getAeCompensation(ev) == 0) { - evBias = static_cast(ev) * stepEv; - } - - // exposure bias. unit is APEX value. -99.99 to 99.99 - const int evLowerBound = -100, evUpperBound = 100; - if (evBias > evLowerBound && evBias < evUpperBound) { - mExifAttributes.exposure_bias.num = static_cast(evBias) * 100; - mExifAttributes.exposure_bias.den = 100; - LOG2("EXIF: Ev = %.2f", evBias); - } else { - mExifAttributes.exposure_bias.num = 0; - mExifAttributes.exposure_bias.den = 100; - LOG2("EXIF: Invalid Ev!"); - } - - int32_t iso; - mExifAttributes.iso_speed_rating = DEFAULT_ISO_SPEED; - if (params.getSensitivityIso(iso) == 0) { - mExifAttributes.iso_speed_rating = iso; - } - - LOG2("EXIF: ISO=%d", mExifAttributes.iso_speed_rating); - LOG2("EXIF: shutter speed=%u/%u", mExifAttributes.shutter_speed.num, - mExifAttributes.shutter_speed.den); - LOG2("EXIF: exposure time=%u/%u", mExifAttributes.exposure_time.num, - mExifAttributes.exposure_time.den); - - if (mExifAttributes.fnumber.den > 0 && expTime > 0 && mExifAttributes.iso_speed_rating > 0) { - // 'dAv + dTv = dSv + dBv' based on the equation of APEX system - double dAv = APEX_FNUM_TO_APERTURE(static_cast(mExifAttributes.fnumber.num) / - mExifAttributes.fnumber.den); - double dTv = APEX_EXPOSURE_TO_SHUTTER(static_cast(expTime) / 1000000); - double dSv = APEX_ISO_TO_FILMSENSITIVITY(mExifAttributes.iso_speed_rating); - mExifAttributes.brightness.num = (dAv + dTv - dSv) * EXIF_DEF_BRIGHTNESSVALUE_DEN; - mExifAttributes.brightness.den = EXIF_DEF_BRIGHTNESSVALUE_DEN; - LOG2("EXIF: brightness = %d / %d", mExifAttributes.brightness.num, - mExifAttributes.brightness.den); - } -} - -/* - * more secure attribute copy routine. - * \param dst pointer to dst buffer - * \param dstSize dst buffer size - * \param src pointer to src character buffer - * \param srcLength src buffer length in characters, not including null byte - */ -void EXIFMaker::copyAttribute(uint8_t* dst, size_t dstSize, const char* src, size_t srcLength) { - size_t dstMaxLength = dstSize - 1; // leave space for null - MEMCPY_S(dst, dstMaxLength, src, srcLength); // copy chars (not null) - // add null termination - size_t len = std::min(dstMaxLength, srcLength); - dst[len] = '\0'; -} - -void EXIFMaker::clear() { - LOG1("@%s", __func__); - // Reset all the attributes - CLEAR(mExifAttributes); - // Initialize the common values - mExifAttributes.enableThumb = false; - copyAttribute(mExifAttributes.image_description, sizeof(mExifAttributes.image_description), - EXIF_DEF_IMAGE_DESCRIPTION, strlen(EXIF_DEF_IMAGE_DESCRIPTION)); - - copyAttribute(mExifAttributes.maker, sizeof(mExifAttributes.maker), mManufacturerName.c_str(), - strlen(mManufacturerName.c_str())); - - copyAttribute(mExifAttributes.model, sizeof(mExifAttributes.model), mProductName.c_str(), - strlen(mProductName.c_str())); - - copyAttribute(mExifAttributes.software, sizeof(mExifAttributes.software), EXIF_DEF_SOFTWARE, - strlen(EXIF_DEF_SOFTWARE)); - - copyAttribute(mExifAttributes.exif_version, sizeof(mExifAttributes.exif_version), - EXIF_DEF_EXIF_VERSION, strlen(EXIF_DEF_EXIF_VERSION)); - - copyAttribute(mExifAttributes.flashpix_version, sizeof(mExifAttributes.flashpix_version), - EXIF_DEF_FLASHPIXVERSION, strlen(EXIF_DEF_FLASHPIXVERSION)); - - // initially, set default flash - mExifAttributes.flash = EXIF_DEF_FLASH; - - // normally it is sRGB, 1 means sRGB. FFFF.H means uncalibrated - mExifAttributes.color_space = EXIF_DEF_COLOR_SPACE; - - // the number of pixels per ResolutionUnit in the w or h direction - // 72 means the image resolution is unknown - mExifAttributes.x_resolution.num = EXIF_DEF_RESOLUTION_NUM; - mExifAttributes.x_resolution.den = EXIF_DEF_RESOLUTION_DEN; - mExifAttributes.y_resolution.num = mExifAttributes.x_resolution.num; - mExifAttributes.y_resolution.den = mExifAttributes.x_resolution.den; - // resolution unit, 2 means inch - mExifAttributes.resolution_unit = EXIF_DEF_RESOLUTION_UNIT; - // when thumbnail uses JPEG compression, this tag 103H's value is set to 6 - mExifAttributes.compression_scheme = EXIF_DEF_COMPRESSION; - - // the TIFF default is 1 (centered) - mExifAttributes.ycbcr_positioning = EXIF_DEF_YCBCR_POSITIONING; - - // Clear the Intel 3A Makernote information - mExifAttributes.makerNoteData = mMakernoteSection; - mExifAttributes.makerNoteDataSize = 0; - mExifAttributes.makernoteToApp2 = ENABLE_APP2_MARKER; - - mInitialized = false; -} - -void EXIFMaker::enableFlash(bool enable, int8_t aeMode, int8_t flashMode) { - mExifAttributes.flash = EXIF_DEF_FLASH; -} - -void EXIFMaker::setThumbnail(unsigned char* data, size_t size, int width, int height) { - LOG1("@%s: data = %p, size = %zu", __func__, data, size); - mExifAttributes.enableThumb = true; - mExifAttributes.widthThumb = width; - mExifAttributes.heightThumb = height; - if (mEncoder.setThumbData(data, size) != EXIF_SUCCESS) { - LOGE("Error in setting EXIF thumbnail"); - } -} - -bool EXIFMaker::isThumbnailSet() const { - return mEncoder.isThumbDataSet(); -} - -size_t EXIFMaker::makeExif(unsigned char* data) { - LOG2("@%s", __func__); - CheckAndLogError(!data, 0, "nullptr passed for EXIF. Cannot generate EXIF!"); - - if (mEncoder.makeExif(data, &mExifAttributes, &mExifSize) == EXIF_SUCCESS) { - LOG1("Generated EXIF (@%p) of size: %zu", data, mExifSize); - return mExifSize; - } - return 0; -} - -void EXIFMaker::setMaker(const char* data) { - LOG2("@%s: data = %s", __func__, data); - - snprintf((char*)mExifAttributes.maker, sizeof(mExifAttributes.maker), "%s", data); -} - -void EXIFMaker::setModel(const char* data) { - LOG2("@%s: data = %s", __func__, data); - - snprintf((char*)mExifAttributes.model, sizeof(mExifAttributes.model), "%s", data); -} - -void EXIFMaker::setSoftware(const char* data) { - LOG2("@%s: data = %s", __func__, data); - - snprintf((char*)mExifAttributes.software, sizeof(mExifAttributes.software), "%s", data); -} - -void EXIFMaker::saveMakernote(const Parameters& params) { - unsigned int size = sizeof(unsigned char) * (MAKERNOTE_SECTION1_SIZE + MAKERNOTE_SECTION2_SIZE); - if (params.getMakernoteData(mMakernoteSection, &size) == OK) { - mExifAttributes.makerNoteDataSize = size; - } -} - -void EXIFMaker::updateSensorInfo(const Parameters& params) { - float focal = 0.0; - params.getFocalLength(focal); - - if (focal < EPSILON) { - // Focal length is not supported, set to default value - const icamera::CameraMetadata& meta = icamera::ParameterHelper::getMetadata(params); - - icamera_metadata_ro_entry entry = meta.find(CAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS); - if (entry.count >= 1) { - focal = entry.data.f[0]; - } - } - - LOG2("focal length is %f", focal); - mExifAttributes.focal_length.num = focal * mExifAttributes.focal_length.den; - float aperture = 0.0; - params.getAperture(aperture); - mExifAttributes.aperture.num = aperture * mExifAttributes.aperture.den; - - mExifAttributes.fnumber.num = aperture * mExifAttributes.aperture.den; - mExifAttributes.fnumber.den = mExifAttributes.aperture.den; -} - -} // namespace icamera diff --git a/src/jpeg/EXIFMaker.h b/src/jpeg/EXIFMaker.h deleted file mode 100644 index adad8d07..00000000 --- a/src/jpeg/EXIFMaker.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2016-2020 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "EXIFMetaData.h" -#include "ExifCreater.h" -#include "iutils/Utils.h" - -namespace icamera { - -/** - * \class EXIFMaker - * - */ -class EXIFMaker { - public: - EXIFMaker(); - ~EXIFMaker(); - - void readProperty(); - void initialize(int width, int height); - bool isInitialized() { return mInitialized; } - void initializeLocation(ExifMetaData* metadata); - uint32_t getMakerNoteDataSize() const; - void pictureTaken(ExifMetaData* exifmetadata); - void enableFlash(bool enable, int8_t aeMode, int8_t flashMode); - void setThumbnail(unsigned char* data, size_t size, int width, int height); - bool isThumbnailSet() const; - size_t makeExif(unsigned char* data); - void setMaker(const char* data); - void setModel(const char* data); - void setSoftware(const char* data); - void updateSensorInfo(const Parameters& params); - void saveMakernote(const Parameters& params); - void setSensorAeConfig(const Parameters& params); - - private: // member variables - ExifCreater mEncoder; - exif_attribute_t mExifAttributes; - size_t mExifSize; - bool mInitialized; - unsigned char* mMakernoteSection; - std::string mProductName; - std::string mManufacturerName; - - private: - // prevent copy constructor and assignment operator - DISALLOW_COPY_AND_ASSIGN(EXIFMaker); - - private: // Methods - void copyAttribute(uint8_t* dst, size_t dstSize, const char* src, size_t srcLength); - - void clear(); -}; - -} // namespace icamera diff --git a/src/jpeg/EXIFMetaData.cpp b/src/jpeg/EXIFMetaData.cpp deleted file mode 100644 index dc2fbd8e..00000000 --- a/src/jpeg/EXIFMetaData.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2016-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG EXIFMetaData - -#include "EXIFMetaData.h" - -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -#define DEFAULT_ISO_SPEED 100 - -ExifMetaData::ExifMetaData() - : effectMode(CAM_EFFECT_NONE), - software(nullptr), - hdr(false), - flashFired(false), - v3AeMode(BAD_VALUE), - flashMode(BAD_VALUE), - saveMirrored(false), - cameraOrientation(0), - currentOrientation(0), - zoomRatio(1), - aeMode(AE_MODE_AUTO), - awbMode(AWB_MODE_AUTO), - currentFocusDistance(0.0) { - LOG1("@%s", __func__); - mJpegSetting.jpegQuality = 90; - mJpegSetting.jpegThumbnailQuality = 90; - mJpegSetting.orientation = 0; - mJpegSetting.thumbWidth = 320; - mJpegSetting.thumbHeight = 240; - mGpsSetting.latitude = 0.0; - mGpsSetting.longitude = 0.0; - mGpsSetting.altitude = 0.0; - CLEAR(mGpsSetting.gpsProcessingMethod); - mGpsSetting.gpsTimeStamp = 0; -} - -ExifMetaData::~ExifMetaData() {} - -} // namespace icamera diff --git a/src/jpeg/EXIFMetaData.h b/src/jpeg/EXIFMetaData.h deleted file mode 100644 index 7cd37f31..00000000 --- a/src/jpeg/EXIFMetaData.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2016-2020 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "Parameters.h" -#include "iutils/Errors.h" -namespace icamera { - -#define MAX_NUM_GPS_PROCESSING_METHOD 64 - -/** - * \class ExifMetaData - * - */ -class ExifMetaData { - public: - ExifMetaData(); - virtual ~ExifMetaData(); - - // jpeg info - struct JpegSetting { - uint8_t jpegQuality; - uint8_t jpegThumbnailQuality; - int thumbWidth; - int thumbHeight; - int orientation; - }; - // GPS info - struct GpsSetting { - double latitude; - double longitude; - double altitude; - char gpsProcessingMethod[MAX_NUM_GPS_PROCESSING_METHOD]; - long gpsTimeStamp; - }; - // exif info - JpegSetting mJpegSetting; - GpsSetting mGpsSetting; - camera_effect_mode_t effectMode; - char* software; /*!< software string from HAL */ - bool hdr; /*!< whether hdr was used */ - bool flashFired; /*!< whether flash was fired */ - int8_t v3AeMode; /*!< v3 ae mode (e.g. for flash) */ - int8_t flashMode; /*!< flash mode (e.g. TORCH,SINGLE,OFF) */ - bool saveMirrored; /*!< whether to do mirroring */ - int cameraOrientation; /*!< camera sensor orientation */ - int currentOrientation; /*!< Current orientation of the device */ - int zoomRatio; - icamera::camera_ae_mode_t aeMode; - icamera::camera_awb_mode_t awbMode; - float currentFocusDistance; -}; - -} // namespace icamera diff --git a/src/jpeg/Exif.h b/src/jpeg/Exif.h deleted file mode 100644 index bce7b71e..00000000 --- a/src/jpeg/Exif.h +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright Samsung Electronics Co.,LTD. - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2016-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#define EXIF_LOG2(x) (log((double)(x)) / log(2.0)) -#define APEX_FNUM_TO_APERTURE(x) (2.0 * (EXIF_LOG2((double)(x)))) -#define APEX_EXPOSURE_TO_SHUTTER(x) (-1.0 * (EXIF_LOG2((double)(x)))) -#define APEX_ISO_TO_FILMSENSITIVITY(x) (EXIF_LOG2((x) / 3.125)) - -#define NUM_SIZE 2 -#define IFD_SIZE 12 -#define OFFSET_SIZE 4 - -#define NUM_0TH_IFD_TIFF 14 -#define NUM_0TH_IFD_EXIF 36 -#define NUM_0TH_IFD_GPS 12 -#define NUM_1TH_IFD_TIFF 9 -// For QVGA: 320 * 240 * 1.5 -#define EXIF_SIZE_LIMITATION 0x10000 -// Limite the thumbnail size to 32k, to make sure the whole exif size does -// not exceed the exif size limitation. We guess the total size of all the -// other fields is smaller than 32k. (Currently the size is about 26k.) -#define THUMBNAIL_SIZE_LIMITATION 0x8000 - -/* Type */ -#define EXIF_TYPE_BYTE 1 -#define EXIF_TYPE_ASCII 2 -#define EXIF_TYPE_SHORT 3 -#define EXIF_TYPE_LONG 4 -#define EXIF_TYPE_RATIONAL 5 -#define EXIF_TYPE_UNDEFINED 7 -#define EXIF_TYPE_SLONG 9 -#define EXIF_TYPE_SRATIONAL 10 - -#define EXIF_FILE_SIZE 28800 - -/* 0th IFD TIFF Tags */ -#define EXIF_TAG_IMAGE_WIDTH 0x0100 -#define EXIF_TAG_IMAGE_HEIGHT 0x0101 -#define EXIF_TAG_IMAGE_DESCRIPTION 0x010e -#define EXIF_TAG_MAKE 0x010f -#define EXIF_TAG_MODEL 0x0110 -#define EXIF_TAG_ORIENTATION 0x0112 -#define EXIF_TAG_X_RESOLUTION 0x011A -#define EXIF_TAG_Y_RESOLUTION 0x011B -#define EXIF_TAG_RESOLUTION_UNIT 0x0128 -#define EXIF_TAG_SOFTWARE 0x0131 -#define EXIF_TAG_DATE_TIME 0x0132 -#define EXIF_TAG_YCBCR_POSITIONING 0x0213 -#define EXIF_TAG_EXIF_IFD_POINTER 0x8769 -#define EXIF_TAG_GPS_IFD_POINTER 0x8825 - -/* 0th IFD Exif Private Tags */ -#define EXIF_TAG_EXPOSURE_TIME 0x829A -#define EXIF_TAG_FNUMBER 0x829D -#define EXIF_TAG_EXPOSURE_PROGRAM 0x8822 -#define EXIF_TAG_ISO_SPEED_RATING 0x8827 -#define EXIF_TAG_EXIF_VERSION 0x9000 -#define EXIF_TAG_DATE_TIME_ORG 0x9003 -#define EXIF_TAG_DATE_TIME_DIGITIZE 0x9004 -#define EXIF_TAG_COMPONENTS_CONFIGURATION 0x9101 -#define EXIF_TAG_SHUTTER_SPEED 0x9201 -#define EXIF_TAG_APERTURE 0x9202 -#define EXIF_TAG_BRIGHTNESS 0x9203 -#define EXIF_TAG_EXPOSURE_BIAS 0x9204 -#define EXIF_TAG_MAX_APERTURE 0x9205 -#define EXIF_TAG_SUBJECT_DISTANCE 0x9206 -#define EXIF_TAG_METERING_MODE 0x9207 -#define EXIF_TAG_LIGHT_SOURCE 0x9208 -#define EXIF_TAG_FLASH 0x9209 -#define EXIF_TAG_FOCAL_LENGTH 0x920A -#define EXIF_TAG_MAKER_NOTE 0x927C -#define EXIF_TAG_USER_COMMENT 0x9286 -#define EXIF_TAG_SUBSEC_TIME 0x9290 -#define EXIF_TAG_SUBSEC_TIME_ORIG 0x9291 -#define EXIF_TAG_SUBSEC_TIME_DIG 0x9292 -#define EXIF_TAG_FLASH_PIX_VERSION 0xA000 -#define EXIF_TAG_COLOR_SPACE 0xA001 -#define EXIF_TAG_PIXEL_X_DIMENSION 0xA002 -#define EXIF_TAG_PIXEL_Y_DIMENSION 0xA003 -#define EXIF_TAG_CUSTOM_RENDERED 0xA401 -#define EXIF_TAG_EXPOSURE_MODE 0xA402 -#define EXIF_TAG_WHITE_BALANCE 0xA403 -#define EXIF_TAG_JPEG_ZOOM_RATIO 0XA404 -#define EXIF_TAG_SCENCE_CAPTURE_TYPE 0xA406 -#define EXIF_TAG_GAIN_CONTROL 0xA407 -#define EXIF_TAG_CONTRAST 0xA408 -#define EXIF_TAG_SATURATION 0xA409 -#define EXIF_TAG_SHARPNESS 0xA40A - -/* 0th IFD GPS Info Tags */ -#define EXIF_TAG_GPS_VERSION_ID 0x0000 -#define EXIF_TAG_GPS_LATITUDE_REF 0x0001 -#define EXIF_TAG_GPS_LATITUDE 0x0002 -#define EXIF_TAG_GPS_LONGITUDE_REF 0x0003 -#define EXIF_TAG_GPS_LONGITUDE 0x0004 -#define EXIF_TAG_GPS_ALTITUDE_REF 0x0005 -#define EXIF_TAG_GPS_ALTITUDE 0x0006 -#define EXIF_TAG_GPS_TIMESTAMP 0x0007 -#define EXIF_TAG_GPS_IMG_DIRECTION_REF 0x0010 -#define EXIF_TAG_GPS_IMG_DIRECTION 0x0011 -#define EXIF_TAG_GPS_PROCESSING_METHOD 0x001B -#define EXIF_TAG_GPS_DATESTAMP 0x001D - -/* 1th IFD TIFF Tags */ -#define EXIF_TAG_COMPRESSION_SCHEME 0x0103 -/* -#define EXIF_TAG_X_RESOLUTION 0x011A -#define EXIF_TAG_Y_RESOLUTION 0x011B -#define EXIF_TAG_RESOLUTION_UNIT 0x0128 -*/ -#define EXIF_TAG_JPEG_INTERCHANGE_FORMAT 0x0201 -#define EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202 - -typedef enum { - EXIF_ORIENTATION_UP = 1, - EXIF_ORIENTATION_90 = 6, - EXIF_ORIENTATION_180 = 3, - EXIF_ORIENTATION_270 = 8, -} ExifOrientationType; - -typedef enum { - EXIF_SCENE_STANDARD, - EXIF_SCENE_LANDSCAPE, - EXIF_SCENE_PORTRAIT, - EXIF_SCENE_NIGHT, -} CamExifSceneCaptureType; - -typedef enum { - EXIF_METERING_UNKNOWN, - EXIF_METERING_AVERAGE, - EXIF_METERING_CENTER, - EXIF_METERING_SPOT, - EXIF_METERING_MULTISPOT, - EXIF_METERING_PATTERN, - EXIF_METERING_PARTIAL, - EXIF_METERING_OTHER = 255, -} CamExifMeteringModeType; - -typedef enum { - EXIF_EXPOSURE_AUTO, - EXIF_EXPOSURE_MANUAL, - EXIF_EXPOSURE_AUTO_BRACKET, -} CamExifExposureModeType; - -typedef enum { - EXIF_WB_AUTO, - EXIF_WB_MANUAL, -} CamExifWhiteBalanceType; - -typedef enum { - EXIF_LIGHT_SOURCE_UNKNOWN, - EXIF_LIGHT_SOURCE_DAYLIGHT, - EXIF_LIGHT_SOURCE_FLUORESCENT, - EXIF_LIGHT_SOURCE_TUNGSTEN, - EXIF_LIGHT_SOURCE_FLASH, - EXIF_LIGHT_SOURCE_FINE_WEATHER = 9, - EXIF_LIGHT_SOURCE_CLOUDY_WEATHER, - EXIF_LIGHT_SOURCE_SHADE, - EXIF_LIGHT_SOURCE_DAYLIGHT_FLUORESCENT, - EXIF_LIGHT_SOURCE_DAY_WHITE_FLUORESCENT, - EXIF_LIGHT_SOURCE_COOL_WHITE_FLUORESCENT, - EXIF_LIGHT_SOURCE_WHITE_FLUORESCENT, - EXIF_LIGHT_SOURCE_WARM_WHITE_FLUORESCENT, // value 16 is used in EXIF V2.3, not for EXIF V2.2 - EXIF_LIGHT_SOURCE_STANDARD_LIGHT_A, - EXIF_LIGHT_SOURCE_STANDARD_LIGHT_B, - EXIF_LIGHT_SOURCE_STANDARD_LIGHT_C, - EXIF_LIGHT_SOURCE_D55, - EXIF_LIGHT_SOURCE_D65, - EXIF_LIGHT_SOURCE_D75, - EXIF_LIGHT_SOURCE_D50, - EXIF_LIGHT_SOURCE_ISO_STUDIO_TUNGSTEN, - EXIF_LIGHT_SOURCE_OTHER_LIGHT_SOURCE = 255, -} CamExifLightSourceType; - -typedef enum { - EXIF_EXPOSURE_PROGRAM_MANUAL = 1, - EXIF_EXPOSURE_PROGRAM_NORMAL = 2, - EXIF_EXPOSURE_PROGRAM_APERTURE_PRIORITY = 3, - EXIF_EXPOSURE_PROGRAM_SHUTTER_PRIORITY = 4 -} CamExifExposureProgramType; - -typedef enum { - EXIF_CONTRAST_NORMAL = 0, - EXIF_CONTRAST_SOFT = 1, - EXIF_CONTRAST_HARD = 2, -} CamExifContrastType; - -typedef enum { - EXIF_SATURATION_NORMAL = 0, - EXIF_SATURATION_LOW = 1, - EXIF_SATURATION_HIGH = 2, -} CamExifSaturationType; - -typedef enum { - EXIF_SHARPNESS_NORMAL = 0, - EXIF_SHARPNESS_SOFT = 1, - EXIF_SHARPNESS_HARD = 2, -} CamExifSharpnessType; - -/* define the flag of enable gps info */ -const uint8_t EXIF_GPS_LATITUDE = 0x01; -const uint8_t EXIF_GPS_LONGITUDE = 0x02; -const uint8_t EXIF_GPS_ALTITUDE = 0x04; -const uint8_t EXIF_GPS_TIMESTAMP = 0x08; -const uint8_t EXIF_GPS_PROCMETHOD = 0x10; -const uint8_t EXIF_GPS_IMG_DIRECTION = 0x20; - -/* Values */ -#define EXIF_DEF_IMAGE_DESCRIPTION "Jpeg" -#define EXIF_DEF_SOFTWARE "Android" -#define EXIF_DEF_EXIF_VERSION "0220" -#define EXIF_DEF_USERCOMMENTS " " -#define EXIF_DEF_FLASHPIXVERSION "0100" /* Flashpix Format Version 1.0 */ - -#define EXIF_DEF_YCBCR_POSITIONING 1 /* centered */ -#define EXIF_DEF_FNUMBER_NUM 26 /* 2.6 */ -#define EXIF_DEF_FNUMBER_DEN 10 -#define EXIF_DEF_EXPOSURE_PROGRAM 3 /* aperture priority */ -#define EXIF_DEF_FOCAL_LEN_NUM 2780 /* 2.78mm */ -#define EXIF_DEF_FOCAL_LEN_DEN 1000 -#define EXIF_DEF_FLASH 0 /* O: off, 1: on*/ -#define EXIF_FLASH_FORCED_ON 1 << 3; /* mode description */ -#define EXIF_FLASH_FORCED_OFF 1 << 4; /* mode description */ -#define EXIF_FLASH_AUTO 1 << 3 | 1 << 4; /* mode description */ -#define EXIF_FLASH_ON 1 /* O: off, 1: on - fired or not*/ -#define EXIF_DEF_COLOR_SPACE 1 -#define EXIF_DEF_CUSTOM_RENDERED 0 -#define EXIF_CUSTOM_RENDERED_HDR 1 -#define EXIF_DEF_EXPOSURE_MODE EXIF_EXPOSURE_AUTO -#define EXIF_DEF_APEX_DEN 10 -#define EXIF_DEF_APEX_NUM 25 -#define EXIF_DEF_SUBJECT_DISTANCE_UNKNOWN 0 - -#define EXIF_DEF_COMPRESSION 6 -#define EXIF_DEF_RESOLUTION_NUM 72 -#define EXIF_DEF_RESOLUTION_DEN 1 -#define EXIF_DEF_RESOLUTION_UNIT 2 /* inches */ - -#define EXIF_DEF_BRIGHTNESSVALUE_DEN 100 - -typedef struct { - uint32_t num; - uint32_t den; -} rational_t; - -typedef struct { - int32_t num; - int32_t den; -} srational_t; - -typedef struct { - bool enableThumb; - - uint8_t image_description[32]; - uint8_t flashpix_version[4]; - uint8_t components_configuration[4]; - uint8_t maker[32]; - uint8_t model[32]; - uint8_t software[32]; - uint8_t exif_version[4]; - uint8_t date_time[20]; - uint8_t subsec_time[8]; - uint8_t user_comment[150]; - - uint32_t width; - uint32_t height; - uint32_t widthThumb; - uint32_t heightThumb; - - uint16_t orientation; - uint16_t ycbcr_positioning; - uint16_t exposure_program; - uint16_t iso_speed_rating; - uint16_t metering_mode; - uint16_t flash; - uint16_t color_space; - uint16_t custom_rendered; - uint16_t exposure_mode; - uint16_t white_balance; - rational_t zoom_ratio; - uint16_t scene_capture_type; - uint16_t light_source; - uint16_t gain_control; - uint16_t contrast; - uint16_t saturation; - uint16_t sharpness; - - rational_t exposure_time; - rational_t fnumber; - rational_t aperture; - rational_t max_aperture; - rational_t focal_length; - rational_t subject_distance; - - srational_t shutter_speed; - srational_t brightness; - srational_t exposure_bias; - - // bit 0~4 indicate whether Gps items latitude, longitude, altitude, timestamp, - // datastamp exist or not. - uint8_t enableGps; - uint8_t gps_latitude_ref[2]; - uint8_t gps_longitude_ref[2]; - - uint8_t gps_version_id[4]; - uint8_t gps_altitude_ref; - - rational_t gps_latitude[3]; - rational_t gps_longitude[3]; - rational_t gps_altitude; - rational_t gps_timestamp[3]; - uint8_t gps_datestamp[11]; - uint8_t gps_processing_method[100]; - - uint8_t gps_img_direction_ref[2]; - rational_t gps_img_direction; - - rational_t x_resolution; - rational_t y_resolution; - uint16_t resolution_unit; - uint16_t compression_scheme; - - uint16_t makerNoteDataSize; - unsigned char* makerNoteData; - bool makernoteToApp2; -} exif_attribute_t; diff --git a/src/jpeg/ExifCreater.cpp b/src/jpeg/ExifCreater.cpp deleted file mode 100644 index 70c01917..00000000 --- a/src/jpeg/ExifCreater.cpp +++ /dev/null @@ -1,538 +0,0 @@ -/* - * Copyright Samsung Electronics Co.,LTD. - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2016-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * JPEG DRIVER MODULE (ExifCreater.cpp) - * Author : ge.lee -- initial version - * Date : 03 June 2010 - * Purpose : This file implements the JPEG encoder APIs as needed by Camera HAL - */ - -#define LOG_TAG ExifCreater - -#include "ExifCreater.h" - -#include -#include - -#include "iutils/CameraLog.h" - -static const char ExifAsciiPrefix[] = {0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0}; - -// the exif size without thumbnail is less than 2k -#define EXIF_SIZE_WITHOUT_THUMBNAIL 0x800 - -namespace icamera { - -ExifCreater::ExifCreater() { - m_thumbBuf = nullptr; - m_thumbSize = 0; -} - -ExifCreater::~ExifCreater() {} - -exif_status ExifCreater::setThumbData(const void* thumbBuf, unsigned int thumbSize) { - if ((thumbSize + EXIF_SIZE_WITHOUT_THUMBNAIL) >= EXIF_SIZE_LIMITATION) { - LOGE("ERROR: Too big thumb size %d (limit: %d)", thumbSize, EXIF_SIZE_LIMITATION); - m_thumbBuf = nullptr; - m_thumbSize = 0; - return EXIF_FAIL; - } - - m_thumbBuf = static_cast(const_cast(thumbBuf)); - m_thumbSize = thumbSize; - return EXIF_SUCCESS; -} - -bool ExifCreater::isThumbDataSet() const { - return m_thumbBuf != nullptr; -} - -// if exif tags size + thumbnail size is > 64K, it will disable thumbnail -exif_status ExifCreater::makeExif(void* exifOut, exif_attribute_t* exifInfo, size_t* size) { - LOG1("makeExif start"); - - unsigned char *pCur, *pApp1Start, *pIfdStart, *pGpsIfdPtr, *pNextIfdOffset; - unsigned int tmp, LongerTagOffset = 0; - pApp1Start = pCur = static_cast(exifOut); - - // 2 Exif Identifier Code & TIFF Header - pCur += 4; // Skip 4 Byte for APP1 marker and length - - unsigned char ExifIdentifierCode[6] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00}; - MEMCPY_S(pCur, sizeof(ExifIdentifierCode), ExifIdentifierCode, sizeof(ExifIdentifierCode)); - pCur += 6; - - /* Byte Order - little endian, Offset of IFD - 0x00000008.H */ - unsigned char TiffHeader[8] = {0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00}; - MEMCPY_S(pCur, sizeof(TiffHeader), TiffHeader, sizeof(TiffHeader)); - pIfdStart = pCur; - pCur += 8; - - // 2 0th IFD TIFF Tags - if (exifInfo->enableGps) - tmp = NUM_0TH_IFD_TIFF; - else - tmp = NUM_0TH_IFD_TIFF - 1; - - MEMCPY_S(pCur, NUM_SIZE, (int8_t*)&tmp, NUM_SIZE); - pCur += NUM_SIZE; - - LongerTagOffset += 8 + NUM_SIZE + tmp * IFD_SIZE + OFFSET_SIZE; - - writeExifIfd(&pCur, EXIF_TAG_IMAGE_WIDTH, EXIF_TYPE_LONG, 1, exifInfo->width); - writeExifIfd(&pCur, EXIF_TAG_IMAGE_HEIGHT, EXIF_TYPE_LONG, 1, exifInfo->height); - writeExifIfd(&pCur, EXIF_TAG_IMAGE_DESCRIPTION, EXIF_TYPE_ASCII, - strlen(reinterpret_cast(exifInfo->image_description)) + 1, - exifInfo->image_description, &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_MAKE, EXIF_TYPE_ASCII, strlen((char*)exifInfo->maker) + 1, - exifInfo->maker, &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_MODEL, EXIF_TYPE_ASCII, strlen((char*)exifInfo->model) + 1, - exifInfo->model, &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_ORIENTATION, EXIF_TYPE_SHORT, 1, exifInfo->orientation); - writeExifIfd(&pCur, EXIF_TAG_X_RESOLUTION, EXIF_TYPE_RATIONAL, 1, &exifInfo->x_resolution, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_Y_RESOLUTION, EXIF_TYPE_RATIONAL, 1, &exifInfo->y_resolution, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_RESOLUTION_UNIT, EXIF_TYPE_SHORT, 1, exifInfo->resolution_unit); - writeExifIfd(&pCur, EXIF_TAG_SOFTWARE, EXIF_TYPE_ASCII, strlen((char*)exifInfo->software) + 1, - exifInfo->software, &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_DATE_TIME, EXIF_TYPE_ASCII, 20, exifInfo->date_time, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_YCBCR_POSITIONING, EXIF_TYPE_SHORT, 1, - exifInfo->ycbcr_positioning); - writeExifIfd(&pCur, EXIF_TAG_EXIF_IFD_POINTER, EXIF_TYPE_LONG, 1, LongerTagOffset); - - pGpsIfdPtr = pCur; - if (exifInfo->enableGps) { - pCur += IFD_SIZE; // Skip a ifd size for gps IFD pointer - } - - pNextIfdOffset = pCur; // Skip a offset size for next IFD offset - pCur += OFFSET_SIZE; - - // 2 0th IFD Exif Private Tags - pCur = pIfdStart + LongerTagOffset; - - int drop_num = 0; - if (exifInfo->exposure_time.den == 0) drop_num++; - if (exifInfo->shutter_speed.den == 0) drop_num++; - if (exifInfo->makerNoteDataSize == 0 || exifInfo->makernoteToApp2) { - // skip the makernote IFD in APP1, when we don't have any, - // or if we want it to APP2 - drop_num++; - } - tmp = NUM_0TH_IFD_EXIF - drop_num; - MEMCPY_S(pCur, NUM_SIZE, &tmp, NUM_SIZE); - pCur += NUM_SIZE; - - LongerTagOffset += NUM_SIZE + tmp * IFD_SIZE + OFFSET_SIZE; - if (exifInfo->exposure_time.den != 0) { - writeExifIfd(&pCur, EXIF_TAG_EXPOSURE_TIME, EXIF_TYPE_RATIONAL, 1, &exifInfo->exposure_time, - &LongerTagOffset, pIfdStart); - } - writeExifIfd(&pCur, EXIF_TAG_FNUMBER, EXIF_TYPE_RATIONAL, 1, &exifInfo->fnumber, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_EXPOSURE_PROGRAM, EXIF_TYPE_SHORT, 1, exifInfo->exposure_program); - writeExifIfd(&pCur, EXIF_TAG_ISO_SPEED_RATING, EXIF_TYPE_SHORT, 1, exifInfo->iso_speed_rating); - writeExifIfd(&pCur, EXIF_TAG_EXIF_VERSION, EXIF_TYPE_UNDEFINED, 4, exifInfo->exif_version); - writeExifIfd(&pCur, EXIF_TAG_DATE_TIME_ORG, EXIF_TYPE_ASCII, 20, exifInfo->date_time, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_DATE_TIME_DIGITIZE, EXIF_TYPE_ASCII, 20, exifInfo->date_time, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_COMPONENTS_CONFIGURATION, EXIF_TYPE_UNDEFINED, 4, - exifInfo->components_configuration); - if (exifInfo->shutter_speed.den != 0) { - writeExifIfd(&pCur, EXIF_TAG_SHUTTER_SPEED, EXIF_TYPE_SRATIONAL, 1, - reinterpret_cast(&exifInfo->shutter_speed), &LongerTagOffset, - pIfdStart); - } - writeExifIfd(&pCur, EXIF_TAG_APERTURE, EXIF_TYPE_RATIONAL, 1, &exifInfo->aperture, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_BRIGHTNESS, EXIF_TYPE_SRATIONAL, 1, - reinterpret_cast(&exifInfo->brightness), &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_EXPOSURE_BIAS, EXIF_TYPE_SRATIONAL, 1, - reinterpret_cast(&exifInfo->exposure_bias), &LongerTagOffset, - pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_MAX_APERTURE, EXIF_TYPE_RATIONAL, 1, &exifInfo->max_aperture, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_SUBJECT_DISTANCE, EXIF_TYPE_RATIONAL, 1, - &exifInfo->subject_distance, &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_METERING_MODE, EXIF_TYPE_SHORT, 1, exifInfo->metering_mode); - writeExifIfd(&pCur, EXIF_TAG_LIGHT_SOURCE, EXIF_TYPE_SHORT, 1, exifInfo->light_source); - writeExifIfd(&pCur, EXIF_TAG_FLASH, EXIF_TYPE_SHORT, 1, exifInfo->flash); - writeExifIfd(&pCur, EXIF_TAG_FOCAL_LENGTH, EXIF_TYPE_RATIONAL, 1, &exifInfo->focal_length, - &LongerTagOffset, pIfdStart); - char code[8] = {0x41, 0x53, 0x43, 0x49, 0x49, 0x00, 0x00, 0x00}; - size_t commentsLen = strlen((char*)exifInfo->user_comment) + 1; - if (commentsLen > (sizeof(exifInfo->user_comment) - sizeof(code))) return EXIF_FAIL; - memmove(exifInfo->user_comment + sizeof(code), exifInfo->user_comment, commentsLen); - MEMCPY_S(exifInfo->user_comment, sizeof(exifInfo->user_comment), code, sizeof(code)); - writeExifIfd(&pCur, EXIF_TAG_USER_COMMENT, EXIF_TYPE_UNDEFINED, commentsLen + sizeof(code), - exifInfo->user_comment, &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_SUBSEC_TIME, EXIF_TYPE_ASCII, - strlen((char*)exifInfo->subsec_time) + 1, exifInfo->subsec_time, &LongerTagOffset, - pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_SUBSEC_TIME_ORIG, EXIF_TYPE_ASCII, - strlen((char*)exifInfo->subsec_time) + 1, exifInfo->subsec_time, &LongerTagOffset, - pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_SUBSEC_TIME_DIG, EXIF_TYPE_ASCII, - strlen((char*)exifInfo->subsec_time) + 1, exifInfo->subsec_time, &LongerTagOffset, - pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_FLASH_PIX_VERSION, EXIF_TYPE_UNDEFINED, 4, - exifInfo->flashpix_version); - writeExifIfd(&pCur, EXIF_TAG_COLOR_SPACE, EXIF_TYPE_SHORT, 1, exifInfo->color_space); - writeExifIfd(&pCur, EXIF_TAG_PIXEL_X_DIMENSION, EXIF_TYPE_LONG, 1, exifInfo->width); - writeExifIfd(&pCur, EXIF_TAG_PIXEL_Y_DIMENSION, EXIF_TYPE_LONG, 1, exifInfo->height); - writeExifIfd(&pCur, EXIF_TAG_CUSTOM_RENDERED, EXIF_TYPE_SHORT, 1, exifInfo->custom_rendered); - writeExifIfd(&pCur, EXIF_TAG_EXPOSURE_MODE, EXIF_TYPE_SHORT, 1, exifInfo->exposure_mode); - writeExifIfd(&pCur, EXIF_TAG_WHITE_BALANCE, EXIF_TYPE_SHORT, 1, exifInfo->white_balance); - writeExifIfd(&pCur, EXIF_TAG_JPEG_ZOOM_RATIO, EXIF_TYPE_RATIONAL, 1, &exifInfo->zoom_ratio, - &LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_SCENCE_CAPTURE_TYPE, EXIF_TYPE_SHORT, 1, - exifInfo->scene_capture_type); - writeExifIfd(&pCur, EXIF_TAG_GAIN_CONTROL, EXIF_TYPE_SHORT, 1, exifInfo->gain_control); - writeExifIfd(&pCur, EXIF_TAG_CONTRAST, EXIF_TYPE_SHORT, 1, exifInfo->contrast); - writeExifIfd(&pCur, EXIF_TAG_SATURATION, EXIF_TYPE_SHORT, 1, exifInfo->saturation); - writeExifIfd(&pCur, EXIF_TAG_SHARPNESS, EXIF_TYPE_SHORT, 1, exifInfo->sharpness); - - // Save MakerNote data to APP1, unless we want it APP2 - if (exifInfo->makerNoteDataSize > 0 && !exifInfo->makernoteToApp2) { - writeExifIfd(&pCur, EXIF_TAG_MAKER_NOTE, EXIF_TYPE_UNDEFINED, exifInfo->makerNoteDataSize, - (unsigned char*)exifInfo->makerNoteData, &LongerTagOffset, pIfdStart); - } - - tmp = 0; - MEMCPY_S(pCur, OFFSET_SIZE, (int8_t*)&tmp, OFFSET_SIZE); // next IFD offset - pCur += OFFSET_SIZE; - - // 2 0th IFD GPS Info Tags - if (exifInfo->enableGps) { - writeExifIfd(&pGpsIfdPtr, EXIF_TAG_GPS_IFD_POINTER, EXIF_TYPE_LONG, 1, - LongerTagOffset); // GPS IFD pointer skipped on 0th IFD - - pCur = pIfdStart + LongerTagOffset; - - tmp = NUM_0TH_IFD_GPS; - if ((exifInfo->enableGps & EXIF_GPS_LATITUDE) == 0) tmp -= 2; - if ((exifInfo->enableGps & EXIF_GPS_LONGITUDE) == 0) tmp -= 2; - if ((exifInfo->enableGps & EXIF_GPS_ALTITUDE) == 0) tmp -= 2; - if ((exifInfo->enableGps & EXIF_GPS_TIMESTAMP) == 0) tmp -= 1; - if ((exifInfo->enableGps & EXIF_GPS_PROCMETHOD) == 0) tmp -= 1; - if ((exifInfo->enableGps & EXIF_GPS_IMG_DIRECTION) == 0) tmp -= 2; - - MEMCPY_S(pCur, NUM_SIZE, (int8_t*)&tmp, NUM_SIZE); - pCur += NUM_SIZE; - - LongerTagOffset += NUM_SIZE + tmp * IFD_SIZE + OFFSET_SIZE; - - writeExifIfd(&pCur, EXIF_TAG_GPS_VERSION_ID, EXIF_TYPE_BYTE, 4, exifInfo->gps_version_id); - if (exifInfo->enableGps & EXIF_GPS_LATITUDE) { - writeExifIfd(&pCur, EXIF_TAG_GPS_LATITUDE_REF, EXIF_TYPE_ASCII, 2, - exifInfo->gps_latitude_ref); - writeExifIfd(&pCur, EXIF_TAG_GPS_LATITUDE, EXIF_TYPE_RATIONAL, 3, - exifInfo->gps_latitude, &LongerTagOffset, pIfdStart); - } - - if (exifInfo->enableGps & EXIF_GPS_LONGITUDE) { - writeExifIfd(&pCur, EXIF_TAG_GPS_LONGITUDE_REF, EXIF_TYPE_ASCII, 2, - exifInfo->gps_longitude_ref); - writeExifIfd(&pCur, EXIF_TAG_GPS_LONGITUDE, EXIF_TYPE_RATIONAL, 3, - exifInfo->gps_longitude, &LongerTagOffset, pIfdStart); - } - - if (exifInfo->enableGps & EXIF_GPS_ALTITUDE) { - writeExifIfd(&pCur, EXIF_TAG_GPS_ALTITUDE_REF, EXIF_TYPE_BYTE, 1, - exifInfo->gps_altitude_ref); - writeExifIfd(&pCur, EXIF_TAG_GPS_ALTITUDE, EXIF_TYPE_RATIONAL, 1, - &exifInfo->gps_altitude, &LongerTagOffset, pIfdStart); - } - - if (exifInfo->enableGps & EXIF_GPS_TIMESTAMP) { - writeExifIfd(&pCur, EXIF_TAG_GPS_TIMESTAMP, EXIF_TYPE_RATIONAL, 3, - exifInfo->gps_timestamp, &LongerTagOffset, pIfdStart); - } - - if (exifInfo->enableGps & EXIF_GPS_IMG_DIRECTION) { - writeExifIfd(&pCur, EXIF_TAG_GPS_IMG_DIRECTION_REF, EXIF_TYPE_ASCII, 2, - exifInfo->gps_img_direction_ref); - writeExifIfd(&pCur, EXIF_TAG_GPS_IMG_DIRECTION, EXIF_TYPE_RATIONAL, 1, - &exifInfo->gps_img_direction, &LongerTagOffset, pIfdStart); - } - - if (exifInfo->enableGps & EXIF_GPS_PROCMETHOD) { - tmp = strlen((char*)exifInfo->gps_processing_method); - if (tmp > 0) { - if (tmp > 100) { - tmp = 100; - } - unsigned char tmp_buf[100 + sizeof(ExifAsciiPrefix)]; - MEMCPY_S(tmp_buf, sizeof(tmp_buf), ExifAsciiPrefix, sizeof(ExifAsciiPrefix)); - MEMCPY_S(&tmp_buf[sizeof(ExifAsciiPrefix)], 100, exifInfo->gps_processing_method, - tmp); - writeExifIfd(&pCur, EXIF_TAG_GPS_PROCESSING_METHOD, EXIF_TYPE_UNDEFINED, - tmp + sizeof(ExifAsciiPrefix), tmp_buf, &LongerTagOffset, pIfdStart); - } - } - writeExifIfd(&pCur, EXIF_TAG_GPS_DATESTAMP, EXIF_TYPE_ASCII, 11, exifInfo->gps_datestamp, - &LongerTagOffset, pIfdStart); - tmp = 0; - MEMCPY_S(pCur, OFFSET_SIZE, (int8_t*)&tmp, OFFSET_SIZE); // next IFD offset - pCur += OFFSET_SIZE; - } - - CheckAndLogError(LongerTagOffset >= EXIF_SIZE_LIMITATION, EXIF_FAIL, - "%s, the size exceeds 64K, line:%d", __func__, __LINE__); - - // 2 1th IFD TIFF Tags - if (exifInfo->enableThumb && (m_thumbBuf != nullptr) && (m_thumbSize > 0)) { - writeThumbData(pIfdStart, pNextIfdOffset, &LongerTagOffset, exifInfo); - } else { - tmp = 0; - MEMCPY_S(pNextIfdOffset, OFFSET_SIZE, (int8_t*)&tmp, - OFFSET_SIZE); // NEXT IFD offset skipped on 0th IFD - } - - // fill APP1 maker - unsigned char App1Marker[2] = {0xff, 0xe1}; - MEMCPY_S(pApp1Start, 2, App1Marker, 2); - pApp1Start += 2; - - // calc and fill the APP1 segment total size, 2 is length; 6 is ExifIdentifierCode - *size = 2 + 6 + LongerTagOffset; - - writeMarkerSizeToBuf(pApp1Start, *size); - - unsigned app2StartOffset = *size; - *size += 2; // APP1 marker size - - exif_status status = EXIF_SUCCESS; - - if (exifInfo->makernoteToApp2) { - LOG1("Makernote goes to APP2 segment."); - status = makeApp2((pApp1Start + app2StartOffset), *size, exifInfo); - } - - if (status != EXIF_SUCCESS) LOGW("Failed to create EXIF APP2 section"); - - LOG1("makeExif End"); - - return status; -} - -void ExifCreater::writeMarkerSizeToBuf(unsigned char* ptrTo, unsigned int size) { - unsigned char size_mm[2] = {static_cast((size >> 8) & 0xFF), - static_cast(size & 0xFF)}; - - MEMCPY_S(ptrTo, 2, size_mm, 2); -} - -/** - * makeApp2 - * - * Write the makernote to APP2 segment. Use multiple APP2 segments if makernote - * size is more than one segment (64 kb) - * - * \param pStartApp2 [IN] APP2 start address - * \param exifInfo [IN] Data to be written - * \param writeId [IN] Whether to write the Intel Makernote ID string. - * \param size [OUT] Total size after APP2 is written - */ -exif_status ExifCreater::makeApp2(void* pStartApp2, size_t& size, exif_attribute_t* exifInfo, - bool writeId) { - // APP2 marker will be written starting from the pos pointed to by - // pStartApp2 - - if (exifInfo->makerNoteDataSize <= 0) return EXIF_SUCCESS; - - int bytesLeftForSegment = EXIF_SIZE_LIMITATION; - int bytesToWrite = exifInfo->makerNoteDataSize; - - unsigned char *pCur = nullptr, *pApp2Start = nullptr; - unsigned char App2Marker[SIZEOF_APP2_MARKER] = {0xff, 0xe2}; - int writeCount = 0; - unsigned char* toWrite = exifInfo->makerNoteData; - - pCur = static_cast(pStartApp2); - - // Write Makernote up to ~64kB, then split to a new - // APP2 segment, if needed - while (bytesToWrite > 0) { - pApp2Start = pCur; - pCur += 4; // Skip 4 bytes for APP2 marker and length - - if (writeId) { - MEMCPY_S(pCur, sizeof(MAKERNOTE_ID), MAKERNOTE_ID, sizeof(MAKERNOTE_ID)); - pCur += sizeof(MAKERNOTE_ID); - size += sizeof(MAKERNOTE_ID); - // ID overhead for one APP2 segment - bytesLeftForSegment -= sizeof(MAKERNOTE_ID); - } - - // Overhead for one APP2 segment: - bytesLeftForSegment -= (sizeof(App2Marker) + SIZEOF_LENGTH_FIELD); - - if (bytesToWrite > bytesLeftForSegment) { - // More data to write than what fits to one APP2 marker - writeCount = bytesLeftForSegment; - } else { - // All data fits to one APP2 segment - writeCount = bytesToWrite; - } - - bytesToWrite -= writeCount; - - MEMCPY_S(pCur, writeCount, toWrite, writeCount); - pCur += writeCount; - toWrite += writeCount; - size += writeCount; - - // Last, put the APP2 marker to the beginning of the segment - MEMCPY_S(pApp2Start, sizeof(App2Marker), App2Marker, sizeof(App2Marker)); - pApp2Start += sizeof(App2Marker); - - // Length field goes after the APP2 marker - int app2SegmentSize = writeCount + SIZEOF_LENGTH_FIELD; // Raw data written + overhead - if (writeId) app2SegmentSize += sizeof(MAKERNOTE_ID); - - writeMarkerSizeToBuf(pApp2Start, app2SegmentSize); - - // add the 2 bytes for both length field and APP2 marker, the caller has to know the total - // size - size += sizeof(App2Marker) + SIZEOF_LENGTH_FIELD; - - // Reset byte counts for another APP2 segment, if needed - bytesLeftForSegment = EXIF_SIZE_LIMITATION; - } - - return EXIF_SUCCESS; -} - -void ExifCreater::writeThumbData(unsigned char* pIfdStart, unsigned char* pNextIfdOffset, - unsigned int* LongerTagOffset, exif_attribute_t* exifInfo) { - unsigned char* pCur; - unsigned int tmp; - - // firstly calc the exif total size, if it's > 64K, we'll disable the thumbnail - tmp = 4 + 6 + *LongerTagOffset; // 4 is APP1 marker and length; 6 is ExifIdentifierCode - tmp += NUM_SIZE + NUM_1TH_IFD_TIFF * IFD_SIZE + OFFSET_SIZE; - tmp += sizeof(exifInfo->x_resolution) + sizeof(exifInfo->y_resolution); - tmp += m_thumbSize; - - if (tmp > EXIF_SIZE_LIMITATION) { - LOG1("line:%d, in makeExif, exif total size(%d) > 64K, we'll disable thumbnail.", __LINE__, - tmp); - m_thumbSize = 0; - m_thumbBuf = nullptr; - tmp = 0; - MEMCPY_S(pNextIfdOffset, OFFSET_SIZE, (int8_t*)&tmp, - OFFSET_SIZE); // NEXT IFD offset skipped on 0th IFD - } else { - tmp = *LongerTagOffset; - MEMCPY_S(pNextIfdOffset, OFFSET_SIZE, (int8_t*)&tmp, - OFFSET_SIZE); // NEXT IFD offset skipped on 0th IFD - - pCur = pIfdStart + *LongerTagOffset; - - tmp = NUM_1TH_IFD_TIFF; - MEMCPY_S(pCur, NUM_SIZE, (int8_t*)&tmp, NUM_SIZE); - pCur += NUM_SIZE; - - *LongerTagOffset += NUM_SIZE + NUM_1TH_IFD_TIFF * IFD_SIZE + OFFSET_SIZE; - - writeExifIfd(&pCur, EXIF_TAG_IMAGE_WIDTH, EXIF_TYPE_LONG, 1, exifInfo->widthThumb); - writeExifIfd(&pCur, EXIF_TAG_IMAGE_HEIGHT, EXIF_TYPE_LONG, 1, exifInfo->heightThumb); - writeExifIfd(&pCur, EXIF_TAG_COMPRESSION_SCHEME, EXIF_TYPE_SHORT, 1, - exifInfo->compression_scheme); - writeExifIfd(&pCur, EXIF_TAG_ORIENTATION, EXIF_TYPE_SHORT, 1, exifInfo->orientation); - writeExifIfd(&pCur, EXIF_TAG_X_RESOLUTION, EXIF_TYPE_RATIONAL, 1, &exifInfo->x_resolution, - LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_Y_RESOLUTION, EXIF_TYPE_RATIONAL, 1, &exifInfo->y_resolution, - LongerTagOffset, pIfdStart); - writeExifIfd(&pCur, EXIF_TAG_RESOLUTION_UNIT, EXIF_TYPE_SHORT, 1, - exifInfo->resolution_unit); - writeExifIfd(&pCur, EXIF_TAG_JPEG_INTERCHANGE_FORMAT, EXIF_TYPE_LONG, 1, *LongerTagOffset); - writeExifIfd(&pCur, EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LEN, EXIF_TYPE_LONG, 1, m_thumbSize); - - tmp = 0; - MEMCPY_S(pCur, OFFSET_SIZE, (int8_t*)&tmp, OFFSET_SIZE); // next IFD offset - // pCur += OFFSET_SIZE; - - MEMCPY_S(pIfdStart + *LongerTagOffset, m_thumbSize, m_thumbBuf, m_thumbSize); - *LongerTagOffset += m_thumbSize; - } -} - -void ExifCreater::writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, uint32_t value) { - MEMCPY_S(*pCur, 2, (int8_t*)&tag, 2); - *pCur += 2; - MEMCPY_S(*pCur, 2, (int8_t*)&type, 2); - *pCur += 2; - MEMCPY_S(*pCur, 4, (int8_t*)&count, 4); - *pCur += 4; - MEMCPY_S(*pCur, 4, (int8_t*)&value, 4); - *pCur += 4; -} - -void ExifCreater::writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, unsigned char* pValue) { - char buf[4] = { - 0, - }; - - MEMCPY_S(buf, count, pValue, count); - MEMCPY_S(*pCur, 2, (int8_t*)&tag, 2); - *pCur += 2; - MEMCPY_S(*pCur, 2, (int8_t*)&type, 2); - *pCur += 2; - MEMCPY_S(*pCur, 4, (int8_t*)&count, 4); - *pCur += 4; - MEMCPY_S(*pCur, 4, (int8_t*)buf, 4); - *pCur += 4; -} - -void ExifCreater::writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, unsigned char* pValue, unsigned int* offset, - unsigned char* start) { - MEMCPY_S(*pCur, 2, (int8_t*)&tag, 2); - *pCur += 2; - MEMCPY_S(*pCur, 2, (int8_t*)&type, 2); - *pCur += 2; - MEMCPY_S(*pCur, 4, (int8_t*)&count, 4); - *pCur += 4; - MEMCPY_S(*pCur, 4, (int8_t*)offset, 4); - *pCur += 4; - MEMCPY_S(start + *offset, count, pValue, count); - *offset += count; -} - -void ExifCreater::writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, rational_t* pValue, unsigned int* offset, - unsigned char* start) { - MEMCPY_S(*pCur, 2, (int8_t*)&tag, 2); - *pCur += 2; - MEMCPY_S(*pCur, 2, (int8_t*)&type, 2); - *pCur += 2; - MEMCPY_S(*pCur, 4, (int8_t*)&count, 4); - *pCur += 4; - MEMCPY_S(*pCur, 4, (int8_t*)offset, 4); - *pCur += 4; - MEMCPY_S(start + *offset, 8 * count, (int8_t*)pValue, 8 * count); - *offset += 8 * count; -} - -} // namespace icamera diff --git a/src/jpeg/ExifCreater.h b/src/jpeg/ExifCreater.h deleted file mode 100644 index bf90e260..00000000 --- a/src/jpeg/ExifCreater.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright Samsung Electronics Co.,LTD. - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2016-2020 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * JPEG DRIVER MODULE (JpegEncoder.h) - * Author : ge.lee -- initial version - * Date : 03 June 2010 - * Purpose : This file implements the JPEG encoder APIs as needed by Camera HAL - */ - -#pragma once - -#include -#include - -#include "Exif.h" -#include "iutils/Utils.h" - -namespace icamera { - -#define MAX_JPG_WIDTH 4352 -#define MAX_JPG_HEIGHT 3264 -#define MAX_JPG_RESOLUTION (MAX_JPG_WIDTH * MAX_JPG_HEIGHT) - -#define MAX_JPG_THUMBNAIL_WIDTH 640 -#define MAX_JPG_THUMBNAIL_HEIGHT 480 -#define MAX_JPG_THUMBNAIL_RESOLUTION (MAX_JPG_THUMBNAIL_WIDTH * MAX_JPG_THUMBNAIL_HEIGHT) - -#define MAX_RGB_WIDTH 800 -#define MAX_RGB_HEIGHT 480 -#define MAX_RGB_RESOLUTION (MAX_RGB_WIDTH * MAX_RGB_HEIGHT) - -/*******************************************************************************/ -/* define JPG & image memory */ -/* memory area is 4k(PAGE_SIZE) aligned because of VirtualCopyEx() */ -#define JPG_STREAM_BUF_SIZE ((MAX_JPG_RESOLUTION / PAGE_SIZE + 1) * PAGE_SIZE) -#define JPG_STREAM_THUMB_BUF_SIZE ((MAX_JPG_THUMBNAIL_RESOLUTION / PAGE_SIZE + 1) * PAGE_SIZE) -#define JPG_FRAME_BUF_SIZE (((MAX_JPG_RESOLUTION * 3) / PAGE_SIZE + 1) * PAGE_SIZE) -#define JPG_FRAME_THUMB_BUF_SIZE (((MAX_JPG_THUMBNAIL_RESOLUTION * 3) / PAGE_SIZE + 1) * PAGE_SIZE) -#define JPG_RGB_BUF_SIZE (((MAX_RGB_RESOLUTION * 4) / PAGE_SIZE + 1) * PAGE_SIZE) - -#define JPG_TOTAL_BUF_SIZE \ - (JPG_STREAM_BUF_SIZE + JPG_STREAM_THUMB_BUF_SIZE + JPG_FRAME_BUF_SIZE + \ - JPG_FRAME_THUMB_BUF_SIZE + JPG_RGB_BUF_SIZE) - -#define JPG_MAIN_START 0x00 -#define JPG_THUMB_START JPG_STREAM_BUF_SIZE -#define IMG_MAIN_START (JPG_STREAM_BUF_SIZE + JPG_STREAM_THUMB_BUF_SIZE) -#define IMG_THUMB_START (IMG_MAIN_START + JPG_FRAME_BUF_SIZE) -/*******************************************************************************/ - -const char MAKERNOTE_ID[] = {0x49, 0x6e, 0x74, 0x65, 0x6c, 0x4d, - 0x6b, 0x6e, 0x6f, 0x74, 0x65, 0x0 /* "IntelMknote\0" */}; - -const unsigned SIZEOF_LENGTH_FIELD = 2; -const unsigned SIZEOF_APP2_MARKER = 2; -const unsigned SIZEOF_APP2_OVERHEAD = - sizeof(MAKERNOTE_ID) + SIZEOF_APP2_MARKER + SIZEOF_LENGTH_FIELD; -const bool ENABLE_APP2_MARKER = true; -typedef enum { EXIF_FAIL = -1, EXIF_SUCCESS = 0 } exif_status; - -class ExifCreater { - public: - ExifCreater(); - virtual ~ExifCreater(); - - exif_status setThumbData(const void* thumbBuf, unsigned int thumbSize); - - bool isThumbDataSet() const; - - exif_status makeExif(void* exifOut, exif_attribute_t* exifInfo, size_t* size); - - private: - exif_status makeApp2(void* pStartApp2, size_t& size, exif_attribute_t* exifInfo, - bool writeId = true); - void writeMarkerSizeToBuf(unsigned char* ptrTo, unsigned int size); - /* - Every IFD has 12Bytes. - Tag ID, 2B; Type, 2B; Count, 4B; Value/Offset, 4B; - If it is Value, please use the first two functions. - If it is Offset, please use the last two functions - and store the data in the rear. - */ - void writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, uint32_t value); - void writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, unsigned char* pValue); - void writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, rational_t* pValue, unsigned int* offset, - unsigned char* start); - void writeExifIfd(unsigned char** pCur, unsigned short tag, unsigned short type, - unsigned int count, unsigned char* pValue, unsigned int* offset, - unsigned char* start); - void writeThumbData(unsigned char* pIfdStart, unsigned char* pNextIfdOffset, - unsigned int* LongerTagOffset, exif_attribute_t* exifInfo); - - unsigned char* m_thumbBuf; // MAP: Added to set thumbnail from external data - unsigned int m_thumbSize; // MAP: Added to set thumbnail from external data -}; - -} // namespace icamera diff --git a/src/jpeg/IJpegEncoder.h b/src/jpeg/IJpegEncoder.h deleted file mode 100644 index 9e810b07..00000000 --- a/src/jpeg/IJpegEncoder.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "iutils/Utils.h" - -namespace icamera { - -#define DEFAULT_JPEG_QUALITY 95 -static const unsigned char mJpegMarkerSOI[2] = {0xFF, 0xD8}; - -struct EncodePackage { - EncodePackage() - : inputWidth(0), - inputHeight(0), - inputStride(0), - inputFormat(0), - inputSize(0), - inputBufferHandle(nullptr), - inputData(nullptr), - outputWidth(0), - outputHeight(0), - outputSize(0), - outputBufferHandle(nullptr), - outputData(nullptr), - quality(0), - encodedDataSize(0), - exifData(nullptr), - exifDataSize(0) {} - - /* input buffer info */ - int inputWidth; - int inputHeight; - int inputStride; - int inputFormat; - unsigned int inputSize; - void* inputBufferHandle; - void* inputData; - - /* output buffer info */ - int outputWidth; - int outputHeight; - unsigned int outputSize; - void* outputBufferHandle; - void* outputData; - - int quality; - uint32_t encodedDataSize; - uint8_t* exifData; - uint32_t exifDataSize; -}; - -class IJpegEncoder { - public: - IJpegEncoder(){}; - virtual ~IJpegEncoder(){}; - - static std::unique_ptr createJpegEncoder(); - virtual bool doJpegEncode(EncodePackage* package) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(IJpegEncoder); -}; -} // namespace icamera diff --git a/src/jpeg/JpegMaker.cpp b/src/jpeg/JpegMaker.cpp deleted file mode 100644 index 4e38bbf0..00000000 --- a/src/jpeg/JpegMaker.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2016-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG JpegMaker - -#include "JpegMaker.h" - -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -namespace icamera { - -JpegMaker::JpegMaker() { - LOG2("@%s", __func__); - mExifMaker = std::unique_ptr(new EXIFMaker()); -} - -JpegMaker::~JpegMaker() { - LOG2("@%s", __func__); -} - -status_t JpegMaker::setupExifWithMetaData(int bufWidth, int bufHeight, const Parameters& parameter, - ExifMetaData* metaData) { - LOG2("@%s", __func__); - - status_t status = OK; - - status = processJpegSettings(parameter, metaData); - CheckAndLogError(status != OK, status, "@%s: Process settngs for JPEG failed!", __func__); - - mExifMaker->initialize(bufWidth, bufHeight); - mExifMaker->pictureTaken(metaData); - - mExifMaker->enableFlash(metaData->flashFired, metaData->v3AeMode, metaData->flashMode); - mExifMaker->updateSensorInfo(parameter); - mExifMaker->saveMakernote(parameter); - - status = processExifSettings(parameter, metaData); - if (status != OK) { - LOGE("@%s: Process settngs for Exif! %d", __func__, status); - return status; - } - - mExifMaker->initializeLocation(metaData); - mExifMaker->setSensorAeConfig(parameter); - - if (metaData->software) mExifMaker->setSoftware(metaData->software); - - return status; -} - -status_t JpegMaker::getExif(const EncodePackage& thumbnailPackage, uint8_t* exifPtr, - uint32_t* exifSize) { - if (thumbnailPackage.encodedDataSize > 0 && thumbnailPackage.quality > 0) { - mExifMaker->setThumbnail(static_cast(thumbnailPackage.outputData), - thumbnailPackage.encodedDataSize, thumbnailPackage.outputWidth, - thumbnailPackage.outputHeight); - } - *exifSize = mExifMaker->makeExif(exifPtr); - return *exifSize > 0 ? OK : UNKNOWN_ERROR; -} - -status_t JpegMaker::processExifSettings(const Parameters& params, ExifMetaData* metaData) { - LOG2("@%s:", __func__); - status_t status = OK; - - status = processGpsSettings(params, metaData); - status |= processColoreffectSettings(params, metaData); - status |= processScalerCropSettings(params, metaData); - - return status; -} - -/* copy exif data into output buffer */ -void JpegMaker::writeExifData(EncodePackage* package) { - CheckAndLogError(package == nullptr, VOID_VALUE, "@%s, package is nullptr", __func__); - - if (package->exifDataSize == 0) return; - - CheckAndLogError(!package->outputData, VOID_VALUE, "@%s, outputData is nullptr", __func__); - CheckAndLogError(!package->exifData, VOID_VALUE, "@%s, exifData is nullptr", __func__); - - unsigned int jSOISize = sizeof(mJpegMarkerSOI); - unsigned char* jpegOut = reinterpret_cast(package->outputData); - MEMCPY_S(jpegOut, jSOISize, mJpegMarkerSOI, jSOISize); - jpegOut += jSOISize; - - MEMCPY_S(jpegOut, package->exifDataSize, reinterpret_cast(package->exifData), - package->exifDataSize); -} - -/** - * processJpegSettings - * - * Store JPEG settings to the exif metadata - * - * \param [IN] jpeg parameters - * \ metaData [out] metadata of the request - * - */ -status_t JpegMaker::processJpegSettings(const Parameters& params, ExifMetaData* metaData) { - LOG2("@%s:", __func__); - status_t status = OK; - - CheckAndLogError(!metaData, UNKNOWN_ERROR, "MetaData struct not intialized"); - - // make jpeg with thumbnail or not - camera_resolution_t thumbSize = {0}; - params.getJpegThumbnailSize(thumbSize); - LOG2("%s request thumbname size %dx%d", __func__, thumbSize.width, thumbSize.height); - - uint8_t new_jpeg_quality = DEFAULT_JPEG_QUALITY; - int ret = params.getJpegQuality(&new_jpeg_quality); - if (ret != icamera::OK) { - LOGW("cannot find jpeg quality, use default"); - } - metaData->mJpegSetting.jpegQuality = new_jpeg_quality; - - uint8_t new_jpeg_thumb_quality = DEFAULT_JPEG_QUALITY; - params.getJpegThumbnailQuality(&new_jpeg_thumb_quality); - metaData->mJpegSetting.jpegThumbnailQuality = new_jpeg_thumb_quality; - metaData->mJpegSetting.thumbWidth = thumbSize.width; - metaData->mJpegSetting.thumbHeight = thumbSize.height; - - int new_rotation = 0; - params.getJpegRotation(new_rotation); - metaData->mJpegSetting.orientation = new_rotation; - - LOG1("jpegQuality=%d,thumbQuality=%d,thumbW=%d,thumbH=%d,orientation=%d", - metaData->mJpegSetting.jpegQuality, metaData->mJpegSetting.jpegThumbnailQuality, - metaData->mJpegSetting.thumbWidth, metaData->mJpegSetting.thumbHeight, - metaData->mJpegSetting.orientation); - - params.getAeMode(metaData->aeMode); - params.getAwbMode(metaData->awbMode); - - metaData->currentFocusDistance = 0.0; - float focusDistance = 0.0; - params.getFocusDistance(focusDistance); - if (focusDistance != 0) { - metaData->currentFocusDistance = ceil(1000.0 / focusDistance); - } - LOG2("aeMode=%d, awbMode=%d, currentFocusDistance=%f", metaData->aeMode, metaData->awbMode, - metaData->currentFocusDistance); - - return status; -} - -/** - * This function will get GPS metadata from request setting - * - * \param[in] settings The Anroid metadata to process GPS settings from - * \param[out] metadata The EXIF data where the GPS setting are written to - */ -status_t JpegMaker::processGpsSettings(const Parameters& param, ExifMetaData* metadata) { - LOG2("@%s:", __func__); - status_t status = OK; - - // gps latitude - double new_gps_latitude = 0.0; - param.getJpegGpsLatitude(new_gps_latitude); - metadata->mGpsSetting.latitude = new_gps_latitude; - - double new_gps_longitude = 0.0; - param.getJpegGpsLongitude(new_gps_longitude); - metadata->mGpsSetting.longitude = new_gps_longitude; - - double new_gps_altitude = 0.0; - param.getJpegGpsAltitude(new_gps_altitude); - metadata->mGpsSetting.altitude = new_gps_altitude; - - // gps timestamp - int64_t new_gps_timestamp = 0; - param.getJpegGpsTimeStamp(new_gps_timestamp); - metadata->mGpsSetting.gpsTimeStamp = new_gps_timestamp; - - // gps processing method - char new_gps_processing_method[MAX_NUM_GPS_PROCESSING_METHOD + 1]; - CLEAR(new_gps_processing_method); - param.getJpegGpsProcessingMethod(MAX_NUM_GPS_PROCESSING_METHOD, new_gps_processing_method); - if (strlen(new_gps_processing_method) != 0) { - snprintf(metadata->mGpsSetting.gpsProcessingMethod, - sizeof(metadata->mGpsSetting.gpsProcessingMethod), "%s", - new_gps_processing_method); - } - - return status; -} - -status_t JpegMaker::processColoreffectSettings(const Parameters& param, ExifMetaData* metaData) { - LOG2("@%s:", __func__); - status_t status = OK; - - camera_effect_mode_t new_image_effect = CAM_EFFECT_NONE; - param.getImageEffect(new_image_effect); - metaData->effectMode = new_image_effect; - LOG2("effect mode=%d", metaData->effectMode); - - return status; -} - -status_t JpegMaker::processScalerCropSettings(const Parameters& param, ExifMetaData* metaData) { - LOG2("@%s:", __func__); - status_t status = OK; - - return status; -} - -} // namespace icamera diff --git a/src/jpeg/JpegMaker.h b/src/jpeg/JpegMaker.h deleted file mode 100644 index 8f503621..00000000 --- a/src/jpeg/JpegMaker.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2016-2020 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "EXIFMaker.h" -#include "EXIFMetaData.h" -#include "IJpegEncoder.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" - -namespace icamera { - -/** - * \class JpegMaker - * Does the EXIF header creation and appending to the provided jpeg buffer - * - */ -class JpegMaker { - public: /* Methods */ - explicit JpegMaker(); - virtual ~JpegMaker(); - status_t setupExifWithMetaData(int bufWidth, int bufHeight, const Parameters& parameter, - ExifMetaData* metaData); - status_t getExif(const EncodePackage& thumbnailPackage, uint8_t* exifPtr, uint32_t* exifSize); - void writeExifData(EncodePackage* package); - - private: /* Methods */ - // prevent copy constructor and assignment operator - DISALLOW_COPY_AND_ASSIGN(JpegMaker); - - status_t processExifSettings(const Parameters& params, ExifMetaData* metaData); - status_t processJpegSettings(const Parameters& params, ExifMetaData* metaData); - status_t processGpsSettings(const Parameters& params, ExifMetaData* metadata); - status_t processColoreffectSettings(const Parameters& params, ExifMetaData* metaData); - status_t processScalerCropSettings(const Parameters& params, ExifMetaData* metaData); - - private: /* Members */ - std::unique_ptr mExifMaker; -}; -} // namespace icamera diff --git a/src/jpeg/chrome/JpegEncoderCore.cpp b/src/jpeg/chrome/JpegEncoderCore.cpp deleted file mode 100644 index 1e4d4d63..00000000 --- a/src/jpeg/chrome/JpegEncoderCore.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2019-2022 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG JpegEncoderCore - -#include "JpegEncoderCore.h" - -#include -#include - -#include "iutils/CameraLog.h" -#include "iutils/Errors.h" -#include "iutils/Utils.h" -#include "PlatformData.h" - -namespace icamera { - -JpegEncoderCore::JpegEncoderCore() : mJpegCompressor(cros::JpegCompressor::GetInstance()) {} - -JpegEncoderCore::~JpegEncoderCore() {} - -std::unique_ptr IJpegEncoder::createJpegEncoder() { - return std::unique_ptr(new JpegEncoderCore()); -} - -/** - * doJpegEncode - * - * Do HW / SW JPEG encoding for the main buffer - * Do SW JPEG encoding for the thumbnail buffer - * - * \param pa [IN/OUT] Information that should be encoded - */ -bool JpegEncoderCore::doJpegEncode(EncodePackage* pa) { - HAL_TRACE_CALL(CAMERA_DEBUG_LOG_LEVEL1); - CheckAndLogError(pa == nullptr, false, "@%s, pa is nullptr", __func__); - - CheckAndLogError(pa->inputWidth != pa->outputWidth || pa->inputHeight != pa->outputHeight, - false, "@%s, input size != output size", __func__); - CheckAndLogError(pa->inputWidth <= 0 || pa->outputWidth <= 0, false, - "@%s, inputWidth:%d, outputWidth:%d", __func__, pa->inputWidth, - pa->outputWidth); - CheckAndLogError(pa->inputHeight <= 0 || pa->outputHeight <= 0, false, - "@%s, inputHeight:%d, outputHeight:%d", __func__, pa->inputHeight, - pa->outputHeight); - - LOG1("@%s: Using Google encoding...", __func__); - - nsecs_t startTime = CameraUtils::systemTime(); - - bool ret = false; - if (pa->inputBufferHandle && pa->outputBufferHandle && PlatformData::supportHwJpegEncode()) { - LOG1("%s, use buffer handle to do jpeg encode input: %p, output: %p", __func__, - pa->inputBufferHandle, pa->outputBufferHandle); - ret = mJpegCompressor->CompressImageFromHandle( - *reinterpret_cast(pa->inputBufferHandle), - *reinterpret_cast(pa->outputBufferHandle), pa->inputWidth, - pa->inputHeight, pa->quality, pa->exifData, pa->exifDataSize, &pa->encodedDataSize); - } else if (pa->inputData && pa->outputData) { - LOG1("%s, use buffer address to do jpeg encode input: %p, output: %p", __func__, - pa->inputData, pa->outputData); - ret = mJpegCompressor->CompressImageFromMemory( - pa->inputData, V4L2_PIX_FMT_NV12, pa->outputData, pa->outputSize, pa->inputWidth, - pa->inputHeight, pa->quality, pa->exifData, pa->exifDataSize, &pa->encodedDataSize); - } else { - LOGE("%s: Google encode input type and output type does not match", __func__); - } - - LOG1("@%s: Google encoding ret:%d, %dx%d need %ld ms, jpeg size %u, quality %d)", __func__, ret, - pa->outputWidth, pa->outputHeight, (CameraUtils::systemTime() - startTime) / 1000000, - pa->encodedDataSize, pa->quality); - return ret && pa->encodedDataSize > 0; -} -} // namespace icamera diff --git a/src/jpeg/chrome/JpegEncoderCore.h b/src/jpeg/chrome/JpegEncoderCore.h deleted file mode 100644 index 1c391724..00000000 --- a/src/jpeg/chrome/JpegEncoderCore.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019-2021 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "IJpegEncoder.h" -#include "cros-camera/jpeg_compressor.h" -#include "iutils/Utils.h" - -namespace icamera { - -class JpegEncoderCore : public IJpegEncoder { - public: - JpegEncoderCore(); - ~JpegEncoderCore(); - - virtual bool doJpegEncode(EncodePackage* pa); - - private: - DISALLOW_COPY_AND_ASSIGN(JpegEncoderCore); - - std::unique_ptr mJpegCompressor; -}; -} // namespace icamera diff --git a/src/jpeg/sw/SWJpegEncoder.cpp b/src/jpeg/sw/SWJpegEncoder.cpp deleted file mode 100644 index c8d42254..00000000 --- a/src/jpeg/sw/SWJpegEncoder.cpp +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * Copyright (C) 2016-2021 Intel Corporation. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#define LOG_TAG SWJpegEncoder - -#include "SWJpegEncoder.h" - -#include - -#include "ImageConverter.h" -#include "iutils/CameraLog.h" -#include "iutils/Utils.h" - -#define RESOLUTION_1_3MP_WIDTH 1280 -#define RESOLUTION_1_3MP_HEIGHT 960 - -namespace icamera { - -SWJpegEncoder::SWJpegEncoder() - : mJpegSize(-1), - mTotalWidth(0), - mTotalHeight(0), - mDstBuf(nullptr), - mCPUCoresNum(1) { - LOG2("@%s, line:%d", __func__, __LINE__); -} - -SWJpegEncoder::~SWJpegEncoder() { - LOG2("@%s, line:%d", __func__, __LINE__); -} - -std::unique_ptr IJpegEncoder::createJpegEncoder() { - return std::unique_ptr(new SWJpegEncoder()); -} - -/** - * \param package: encode package for either thumbnail or main image - * \return true if encoding succeeds - * \return false if encoding fails - */ -bool SWJpegEncoder::doJpegEncode(EncodePackage* package) { - CheckAndLogError(package == nullptr, false, "@%s, package is nullptr", __func__); - - int status = 0; - nsecs_t startTime = CameraUtils::systemTime(); - - LOG2("@%s: IN = {buf:%p, w:%u, h:%u, sz:%u, stride:%d, fmt:%s}", __func__, package->inputData, - package->inputWidth, package->inputHeight, package->inputSize, package->inputStride, - icamera::CameraUtils::format2string(package->inputFormat).c_str()); - - LOG2("@%s: OUT = {buf:%p, w:%u, h:%u, sz:%u, q:%d}", __func__, package->outputData, - package->outputWidth, package->outputHeight, package->outputSize, package->quality); - - if (package->inputWidth == 0 || package->inputHeight == 0 || package->inputFormat == 0) { - ALOGE("Invalid input received!"); - mJpegSize = -1; - goto exit; - } - - mTotalWidth = package->inputWidth; - mTotalHeight = package->inputHeight; - - /* - * For encoding main buffer, need to skip the exif data and SOI header. - * Because the SOI(jpeg maker) is written in the beginning of jpeg data when - * do encode, so only skip the exif data size here, and the SOI will be moved - * to the head of output buffer - */ - mDstBuf = reinterpret_cast(package->outputData) + package->exifDataSize; - - if (useMultiThreadEncoding(package->inputWidth, package->inputHeight)) - status = swEncodeMultiThread(*package); - else - status = swEncode(*package); - - if (status < 0) goto exit; - - package->encodedDataSize = mJpegSize; - - LOG2("@%s encode, total consume:%ums, encoded jpeg size: %d", __func__, - (unsigned)((CameraUtils::systemTime() - startTime) / 1000000), mJpegSize); - - return mJpegSize > 0 ? true : false; -exit: - return false; -} - -/** - * This function will decide if we need to enable the multi thread jpeg encoding. - * currently, we have two conditions to use the old single jpeg encoding. - * one is that the resolution is smaller than the 1.3M - * the other is that the CPU number is 1 - * - * \param width: the Jpeg width - * \param height: the Jpeg height - * - * \return false if we don't need multi thread Jpeg encoding - * \return true if we need multi thread Jpeg encoding - */ -bool SWJpegEncoder::useMultiThreadEncoding(int width, int height) { - LOG2("@%s, line:%d, width:%d, height:%d", __func__, __LINE__, width, height); - bool ret = false; - - /* more conditions could be added to here by according to the request */ - if ((width < RESOLUTION_1_3MP_WIDTH && height < RESOLUTION_1_3MP_HEIGHT)) - ret = false; - else if (width & 0xf) - ret = false; - else - ret = true; - - LOG2("@%s, line:%d, ret:%d", __func__, __LINE__, ret); - return ret; -} - -/** - * encode jpeg by calling the SWJpegEncoder which is the libjpeg wrapper - * single thread. - * - * \param package: jpeg encode package - * \return 0 if encoding was successful - * \return -1 if encoding failed - */ -int SWJpegEncoder::swEncode(const EncodePackage& package) { - LOG2("@%s, line:%d, use the libjpeg to do sw jpeg encoding", __func__, __LINE__); - int status = 0; - Codec encoder; - - encoder.init(); - encoder.setJpegQuality(package.quality); - status = encoder.configEncoding(package.inputWidth, package.inputHeight, package.inputStride, - static_cast(mDstBuf), - (package.outputSize - package.exifDataSize)); - const void* uv_buf = - static_cast(package.inputData) + package.inputStride * package.inputHeight; - - if (status) goto exit; - - status = encoder.doJpegEncoding(package.inputData, uv_buf, package.inputFormat); - if (status) goto exit; - -exit: - if (status) - mJpegSize = -1; - else - encoder.getJpegSize(&mJpegSize); - - encoder.deInit(); - - return (status ? -1 : 0); -} - -/** - * encode jpeg by calling the SWJpegEncoder which is the libjpeg wrapper - * multi thread. - * the thread number depends on the CPU number. - * - * \param package: jpeg encode package - * \return 0 if encoding was successful - * \return -1 if encoding failed - */ -int SWJpegEncoder::swEncodeMultiThread(const EncodePackage& package) { - LOG2("@%s, line:%d, use the libjpeg to do sw jpeg encoding", __func__, __LINE__); - int status = 0; - - init(mCPUCoresNum); - config(package); - - status = doJpegEncodingMultiThread(); - if (status) goto exit; - -exit: - mJpegSize = status ? -1 : mergeJpeg(); - deInit(); - - return (status ? -1 : 0); -} - -/** - * Initialize for the multi thread jpeg encoding - * - * it will create n CodecWorkerThread by according to the thread number. - */ -void SWJpegEncoder::init(unsigned int threadNum) { - unsigned int num = CLIP(threadNum, MAX_THREAD_NUM, MIN_THREAD_NUM); - LOG2("@%s, line:%d, thread number, pass:%d, real:%d", __func__, __LINE__, threadNum, num); - - for (unsigned int i = 0; i < num; i++) { - std::shared_ptr codecWorkerThread(new CodecWorkerThread); - mSwJpegEncoder.push_back(codecWorkerThread); - } -} - -/** - * deInit for the multi thread jpeg encoding - * - * it will release all n CodecWorkerThread - */ -void SWJpegEncoder::deInit(void) { - LOG2("@%s, line:%d", __func__, __LINE__); - for (auto& encoder : mSwJpegEncoder) { - encoder.reset(); - } - - mSwJpegEncoder.clear(); -} - -/** - * configue every thread for multi thread jpeg - * - * \param package: jpeg encode package - */ -void SWJpegEncoder::config(const EncodePackage& package) { - LOG2("@%s, line:%d", __func__, __LINE__); - std::shared_ptr encThread; - CodecWorkerThread::CodecConfig cfg; - - for (unsigned int i = 0; i < mSwJpegEncoder.size(); i++) { - cfg.width = package.inputWidth; - /* - for example, there are 4 threads. - the first 3 threads must align to 16 which is NV12_MCU_SIZE - but for the last thread, it doesn't have this request. - */ - cfg.height = ALIGN_16(package.inputHeight / mSwJpegEncoder.size()); - cfg.stride = package.inputStride; - /* - * For NV12 format, Y and UV data are independent, total size is width*height*1.5; - * For YUYV format, Y and UV data are crossing, total size is width*height*2; - * So the inBufY and inBufUV should be distinguished base on format. - */ - cfg.fourcc = package.inputFormat; - cfg.inBufY = - (cfg.fourcc == V4L2_PIX_FMT_YUYV) ? - static_cast(package.inputData) + cfg.stride * cfg.height * 2 * i : - static_cast(package.inputData) + cfg.stride * cfg.height * i; - cfg.inBufUV = - (cfg.fourcc == V4L2_PIX_FMT_NV12 || cfg.fourcc == V4L2_PIX_FMT_NV21) ? - (static_cast(package.inputData) + - package.inputStride * package.inputHeight + cfg.stride * cfg.height * i / 2) : - nullptr; - cfg.quality = package.quality; - cfg.outBufSize = (package.outputSize - package.exifDataSize - DEST_BUF_OFFSET) / - package.inputHeight * cfg.height; - cfg.outBuf = static_cast(mDstBuf) + DEST_BUF_OFFSET + cfg.outBufSize * i; - /* update the last thread's height */ - if (i == mSwJpegEncoder.size() - 1) { - cfg.height = package.inputHeight - cfg.height * (mSwJpegEncoder.size() - 1); - cfg.outBufSize = package.outputSize - package.exifDataSize - DEST_BUF_OFFSET - - cfg.outBufSize * (mSwJpegEncoder.size() - 1); - } - - encThread = mSwJpegEncoder[i]; - encThread->setConfig(cfg); - LOG2("@%s, line:%d, the %d picture thread cfg", __func__, __LINE__, i); - LOG2("@%s, line:%d, cfg.width:%d, cfg.height:%d", __func__, __LINE__, cfg.width, - cfg.height); - LOG2("@%s, line:%d, cfg.fourcc:%d, cfg.quality:%d", __func__, __LINE__, cfg.fourcc, - cfg.quality); - LOG2("@%s, line:%d, cfg.inBufY:%p, cfg.inBufUV:%p", __func__, __LINE__, cfg.inBufY, - cfg.inBufUV); - LOG2("@%s, line:%d, cfg.outBuf:%p, cfg.outBufSize:%d", __func__, __LINE__, cfg.outBuf, - cfg.outBufSize); - } -} - -/** - * the function will trigger the multi jpeg encoding - * - * \return 0 if encoding was successful - * \return -1 if encoding failed - */ -int SWJpegEncoder::doJpegEncodingMultiThread(void) { - LOG2("@%s, line:%d", __func__, __LINE__); - std::shared_ptr encThread; - status_t status = OK; - std::string threadName("CamHAL_SWEncodeMultiThread"); - - /* run all threads */ - for (unsigned int i = 0; i < mSwJpegEncoder.size(); i++) { - threadName = threadName + ":" + std::to_string(i); - LOG2("@%s, new sw jpeg thread name:%s", __func__, threadName.c_str()); - encThread = mSwJpegEncoder[i]; - status = encThread->runThread(threadName.c_str()); - if (status != OK) { - ALOGE("@%s, line:%d, start jpeg thread fail, thread name:%s", __func__, __LINE__, - threadName.c_str()); - return status; - } - } - - /* wait all threads to finish */ - for (unsigned int i = 0; i < mSwJpegEncoder.size(); i++) { - LOG2("@%s, the %d sw jpeg encoder thread before join!", __func__, i); - encThread = mSwJpegEncoder[i]; - encThread->waitThreadFinish(); - if (encThread->getJpegDataSize() == -1) status = UNKNOWN_ERROR; - } - - return status; -} - -/** - * the function will merge all jpeg pictures which are generated in multi threads - * to one jpeg picture - * - * \return int the merged jpeg size - */ -int SWJpegEncoder::mergeJpeg(void) { -#define HEADER_TOTAL_LEN 623 -#define HEADER_SOS_LEN 14 -#define HEADER_EOI_LEN 2 -#define HEADER_HEIGHT_POS 163 -#define HEADER_WIDTH_POS 165 -#define NV12_MCU_SIZE 16 - LOG2("@%s, line:%d", __func__, __LINE__); - int size = HEADER_TOTAL_LEN - HEADER_SOS_LEN; - CodecWorkerThread::CodecConfig cfg; - nsecs_t startTime; - std::shared_ptr encThread = mSwJpegEncoder.at(0); - if (encThread == nullptr) { - ALOGE("encThread is nullptr"); - return -1; - } - encThread->getConfig(&cfg); - - /* Write the JPEG header */ - MEMCPY_S(mDstBuf, size, cfg.outBuf, size); - - /* Update the width and height info */ - mDstBuf[HEADER_HEIGHT_POS] = (mTotalHeight >> 8) & 0xFF; - mDstBuf[HEADER_HEIGHT_POS + 1] = mTotalHeight & 0xFF; - mDstBuf[HEADER_WIDTH_POS] = (mTotalWidth >> 8) & 0xFF; - mDstBuf[HEADER_WIDTH_POS + 1] = mTotalWidth & 0xFF; - - /* Write the restarting interval */ - if (mSwJpegEncoder.size() > 1) { - unsigned int MCUs = (cfg.height / NV12_MCU_SIZE) * (cfg.width / NV12_MCU_SIZE); - mDstBuf[size++] = 0xFF; - mDstBuf[size++] = 0xDD; - mDstBuf[size++] = 0; - mDstBuf[size++] = 4; - mDstBuf[size++] = (MCUs >> 8) & 0xFF; - mDstBuf[size++] = MCUs & 0xFF; - } - - /* Write the SOS */ - MEMCPY_S(reinterpret_cast((unsigned long)mDstBuf + size), HEADER_SOS_LEN, - reinterpret_cast((unsigned long)cfg.outBuf + HEADER_TOTAL_LEN - HEADER_SOS_LEN), - HEADER_SOS_LEN); - size += HEADER_SOS_LEN; - - /* Write coded segments */ - for (unsigned int i = 0; i < mSwJpegEncoder.size(); i++) { - encThread = mSwJpegEncoder[i]; - startTime = CameraUtils::systemTime(); - encThread->getConfig(&cfg); - memmove(reinterpret_cast((unsigned long)mDstBuf + size), - reinterpret_cast((unsigned long)cfg.outBuf + HEADER_TOTAL_LEN), - (encThread->getJpegDataSize() - HEADER_TOTAL_LEN - HEADER_EOI_LEN)); - LOG2("@%s, wr %d segments, size:%d, consume:%ums", __func__, i, - (encThread->getJpegDataSize() - HEADER_TOTAL_LEN - HEADER_EOI_LEN), - (unsigned)((CameraUtils::systemTime() - startTime) / 1000000)); - size += (encThread->getJpegDataSize() - HEADER_TOTAL_LEN - HEADER_EOI_LEN); - - if (i != (mSwJpegEncoder.size() - 1)) { - mDstBuf[size++] = 0xFF; - mDstBuf[size++] = (i & 0x7) | 0xD0; - } - } - - /* Write EOI */ - mDstBuf[size++] = 0xFF; - mDstBuf[size++] = 0xD9; - - return size; -} - -SWJpegEncoder::CodecWorkerThread::CodecWorkerThread() : mDataSize(-1) { - LOG2("@%s, line:%d", __func__, __LINE__); - CLEAR(mCfg); -} - -SWJpegEncoder::CodecWorkerThread::~CodecWorkerThread() { - LOG2("@%s, line:%d", __func__, __LINE__); -} - -/** - * run one thread for multi thread jpeg encoding - * - * \param name: the thread name - */ -status_t SWJpegEncoder::CodecWorkerThread::runThread(const char* name) { - LOG2("@%s, line:%d", __func__, __LINE__); - return this->run(name); -} - -/** - * wait one thread until it has finished - * - */ -void SWJpegEncoder::CodecWorkerThread::waitThreadFinish(void) { - LOG2("@%s, line:%d", __func__, __LINE__); - this->join(); - this->requestExitAndWait(); -} - -/** - * get jpeg size which is done in one thread - * - * \return int the coded jpeg size - */ -int SWJpegEncoder::CodecWorkerThread::getJpegDataSize(void) { - LOG2("@%s, line:%d", __func__, __LINE__); - return mDataSize; -} - -/** - * the thread exe function for one jpeg thread - * when the encoding has been done, it will return false to terminate the thread - * - * \return false - */ -bool SWJpegEncoder::CodecWorkerThread::threadLoop() { - LOG2("@%s, line:%d, in CodecWorkerThread", __func__, __LINE__); - nsecs_t startTime = CameraUtils::systemTime(); - int ret = swEncode(); - LOG2("@%s one swEncode done!, consume:%ums, ret:%d", __func__, - (unsigned)((CameraUtils::systemTime() - startTime) / 1000000), ret); - - return false; -} - -/** - * this function will call the SWJpegEncoder to encode one jpeg. - * it's the main function of the threadLoop - * - * \return 0 if encoding was successful - * \return -1 if encoding failed - */ -int SWJpegEncoder::CodecWorkerThread::swEncode(void) { - LOG2("@%s, line:%d, in CodecWorkerThread", __func__, __LINE__); - int status = 0; - Codec encoder; - - encoder.init(); - encoder.setJpegQuality(mCfg.quality); - status = encoder.configEncoding(mCfg.width, mCfg.height, mCfg.stride, - static_cast(mCfg.outBuf), mCfg.outBufSize); - if (status) goto exit; - - status = encoder.doJpegEncoding(mCfg.inBufY, mCfg.inBufUV, mCfg.fourcc); - if (status) goto exit; - -exit: - if (status) - mDataSize = -1; - else - encoder.getJpegSize(&mDataSize); - - encoder.deInit(); - - return (status ? -1 : 0); -} - -SWJpegEncoder::Codec::Codec() : mStride(-1), mJpegQuality(DEFAULT_JPEG_QUALITY) { - LOG2("@%s", __func__); - CLEAR(mCInfo); - CLEAR(mJErr); -} - -SWJpegEncoder::Codec::~Codec() { - LOG2("@%s", __func__); -} - -/** - * Init the SW jpeg encoder - * - * It will init the libjpeg library - */ -void SWJpegEncoder::Codec::init(void) { - LOG2("@%s", __func__); - CLEAR(mCInfo); - mCInfo.err = jpeg_std_error(&mJErr); - jpeg_create_compress(&mCInfo); -} - -/** - * deInit the SW jpeg encoder - * - * It will deinit the libjpeg library - */ -void SWJpegEncoder::Codec::deInit(void) { - LOG2("@%s", __func__); - jpeg_destroy_compress(&mCInfo); -} - -/** - * Set the jpeg quality - * - * \param quality: one value from 0 to 100 - * - */ -void SWJpegEncoder::Codec::setJpegQuality(int quality) { - LOG2("@%s, quality:%d", __func__, quality); - mJpegQuality = CLIP(quality, 100, 1); -} - -/** - * Config the SW jpeg encoder. - * - * mainly, it will set the destination buffer manager, color space, quality. - * - * \param width: the width of the jpeg dimentions. - * \param height: the height of the jpeg dimentions. - * \param jpegBuf: the dest buffer to store the jpeg data - * \param jpegBufSize: the size of jpegBuf buffer - * - * \return 0 if the configuration is right. - * \return -1 if the configuration fails. - */ -int SWJpegEncoder::Codec::configEncoding(int width, int height, int stride, void* jpegBuf, - int jpegBufSize) { - LOG2("@%s", __func__); - - mStride = stride; - mCInfo.input_components = 3; - mCInfo.in_color_space = (J_COLOR_SPACE)SUPPORTED_FORMAT; - mCInfo.image_width = width; - mCInfo.image_height = height; - - if (setupJpegDestMgr(&mCInfo, static_cast(jpegBuf), jpegBufSize) < 0) { - ALOGE("@%s, line:%d, setupJpegDestMgr fail", __func__, __LINE__); - return -1; - } - - jpeg_set_defaults(&mCInfo); - jpeg_set_colorspace(&mCInfo, (J_COLOR_SPACE)SUPPORTED_FORMAT); - jpeg_set_quality(&mCInfo, mJpegQuality, TRUE); - mCInfo.raw_data_in = TRUE; - mCInfo.dct_method = JDCT_ISLOW; - mCInfo.comp_info[0].h_samp_factor = 2; - mCInfo.comp_info[0].v_samp_factor = 2; - mCInfo.comp_info[1].h_samp_factor = 1; - mCInfo.comp_info[1].v_samp_factor = 1; - mCInfo.comp_info[2].h_samp_factor = 1; - mCInfo.comp_info[2].v_samp_factor = 1; - jpeg_start_compress(&mCInfo, TRUE); - - return 0; -} - -/** - * Do the SW jpeg encoding. - * - * it will convert the YUV data to P411 and then do jpeg encoding. - * - * \param y_buf: the source buffer for Y data - * \param uv_buf: the source buffer for UV data, - * \it could be nullptr if fourcc is V4L2_PIX_FMT_YUYV - * \return 0 if the encoding is successful. - * \return -1 if the encoding fails. - */ -int SWJpegEncoder::Codec::doJpegEncoding(const void* y_buf, const void* uv_buf, int fourcc) { - LOG2("@%s", __func__); - - unsigned char* srcY = nullptr; - unsigned char* srcUV = nullptr; - unsigned char* p411 = nullptr; - JSAMPROW y[16], u[16], v[16]; - JSAMPARRAY data[3]; - int i, j, width, height; - - width = mCInfo.image_width; - height = mCInfo.image_height; - srcY = (unsigned char*)y_buf; - srcUV = (unsigned char*)uv_buf; - p411 = new unsigned char[width * height * 3 / 2]; - - switch (fourcc) { - case V4L2_PIX_FMT_YUYV: - ImageConverter::YUY2ToP411(width, height, mStride, srcY, p411); - break; - case V4L2_PIX_FMT_NV12: - ImageConverter::NV12ToP411Separate(width, height, mStride, srcY, srcUV, p411); - break; - case V4L2_PIX_FMT_NV21: - ImageConverter::NV21ToP411Separate(width, height, mStride, srcY, srcUV, p411); - break; - default: - ALOGE("%s Unsupported fourcc %d", __func__, fourcc); - delete[] p411; - return -1; - } - - data[0] = y; - data[1] = u; - data[2] = v; - for (i = 0; i < height; i += 16) { - for (j = 0; j < 16 && (i + j) < height; j++) { - y[j] = p411 + width * (j + i); - if (j % 2 == 0) { - u[j / 2] = p411 + width * height + width / 2 * ((j + i) / 2); - v[j / 2] = p411 + width * height + width * height / 4 + width / 2 * ((j + i) / 2); - } - } - jpeg_write_raw_data(&mCInfo, data, 16); - } - - jpeg_finish_compress(&mCInfo); - - delete[] p411; - p411 = nullptr; - - return 0; -} - -/** - * Get the jpeg size. - * - * \param jpegSize: get the real jpeg size, it will be -1, if encoding fails - */ -void SWJpegEncoder::Codec::getJpegSize(int* jpegSize) { - LOG2("@%s", __func__); - - JpegDestMgrPtr dest = (JpegDestMgrPtr)mCInfo.dest; - - *jpegSize = (false == dest->encodeSuccess) ? -1 : dest->codedSize; -} - -/** - * Setup the jpeg destination buffer manager - * - * it will convert the YUV data to P411 and then do jpeg encoding. - * - * \param cInfo: the compress pointer - * \param jpegBuf: the buffer pointer for jpeg data - * \param jpegBufSize: the jpegBuf buffer's size - * \return 0 if it's successful. - * \return -1 if it fails. - */ -int SWJpegEncoder::Codec::setupJpegDestMgr(j_compress_ptr cInfo, JSAMPLE* jpegBuf, - int jpegBufSize) { - LOG2("@%s", __func__); - JpegDestMgrPtr dest; - - if (nullptr == jpegBuf || jpegBufSize <= 0) { - ALOGE("@%s, line:%d, jpegBuf:%p, jpegBufSize:%d", __func__, __LINE__, jpegBuf, jpegBufSize); - return -1; - } - - if (cInfo->dest == nullptr) { - cInfo->dest = (struct jpeg_destination_mgr*)(*cInfo->mem->alloc_small)( - (j_common_ptr)cInfo, JPOOL_PERMANENT, sizeof(JpegDestMgr)); - CLEAR(*cInfo->dest); - } - dest = (JpegDestMgrPtr)cInfo->dest; - - dest->pub.init_destination = initDestination; - dest->pub.empty_output_buffer = emptyOutputBuffer; - dest->pub.term_destination = termDestination; - dest->outJpegBuf = jpegBuf; - dest->outJpegBufSize = jpegBufSize; - - return 0; -} - -/** - * Init the destination - * - * It's the first function which be called - * among initDestination, emptyOutputBuffer and termDestination - * - * \param cInfo: the compress pointer - */ -void SWJpegEncoder::Codec::initDestination(j_compress_ptr cInfo) { - LOG2("@%s", __func__); - JpegDestMgrPtr dest = (JpegDestMgrPtr)cInfo->dest; - - dest->pub.next_output_byte = dest->outJpegBuf; - dest->pub.free_in_buffer = dest->outJpegBufSize; - dest->encodeSuccess = true; -} - -/** - * Empty the output buffer - * - * The function should not be called, - * because we should allocate enough memory for the jpeg destination buffer - * If we return FALSE, the libjpeg will terminate, so return TRUE always. - * But when the function is called, the encoding failing will be recorded. - * - * \param cInfo: the compress pointer - * \return TRUE if it is successful. - * \return FALSE if something is wrong - */ -boolean SWJpegEncoder::Codec::emptyOutputBuffer(j_compress_ptr cInfo) { - LOG2("@%s", __func__); - ALOGE("@%s, line:%d, buffer overflow!", __func__, __LINE__); - JpegDestMgrPtr dest = (JpegDestMgrPtr)cInfo->dest; - - /* re-cfg the buffer info */ - dest->pub.next_output_byte = dest->outJpegBuf; - dest->pub.free_in_buffer = dest->outJpegBufSize; - dest->encodeSuccess = false; - - return TRUE; /* if return FALSE, the total taking picture will fail */ -} - -/** - * Terminate the destination - * - * The function will be called as the last function, - * among initDestination, emptyOutputBuffer and termDestination. - * We can get the encoded jpeg size from it. - * - * \param cInfo: the compress pointer - */ -void SWJpegEncoder::Codec::termDestination(j_compress_ptr cInfo) { - LOG2("@%s", __func__); - JpegDestMgrPtr dest = (JpegDestMgrPtr)cInfo->dest; - - dest->codedSize = dest->outJpegBufSize - dest->pub.free_in_buffer; - LOG2("@%s, line:%d, codedSize:%d", __func__, __LINE__, dest->codedSize); -} - -} // namespace icamera diff --git a/src/jpeg/sw/SWJpegEncoder.h b/src/jpeg/sw/SWJpegEncoder.h deleted file mode 100644 index 170dfdbb..00000000 --- a/src/jpeg/sw/SWJpegEncoder.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * Copyright (C) 2016-2020 Intel Corporation. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - *\file SWJpegEncoder.h - * - * Abstracts the SW jpeg encoder - * - * This class calls the libjpeg ditectly. And libskia's performance is poor. - * The SW jpeg encoder is used for the thumbnail encoding mainly. - * But When the HW jpeg encoding fails, it will use the SW jpeg encoder also. - * - */ - -#pragma once - -#include -#include - -#include - -#include "IJpegEncoder.h" -#include "iutils/Errors.h" -#include "iutils/Thread.h" -#include "iutils/Utils.h" - -#ifdef __cplusplus -extern "C" { -#endif -#include "jpeglib.h" -#ifdef __cplusplus -} -#endif - -namespace icamera { - -/** - * \class SWJpegEncoder - * - * This class is used for sw jpeg encoder. - * It will use single or multi thread to do the sw jpeg encoding - * It just support NV12 input currently. - */ -class SWJpegEncoder : public IJpegEncoder { - public: - SWJpegEncoder(); - ~SWJpegEncoder(); - - virtual bool doJpegEncode(EncodePackage* package); - - private: - // prevent copy constructor and assignment operator - DISALLOW_COPY_AND_ASSIGN(SWJpegEncoder); - - private: - bool useMultiThreadEncoding(int width, int height); - int swEncode(const EncodePackage& package); - int swEncodeMultiThread(const EncodePackage& package); - - int mJpegSize; /*!< it's used to store jpeg size */ - int mTotalWidth; /*!< the final jpeg width */ - int mTotalHeight; /*!< the final jpeg height */ - unsigned char* mDstBuf; /*!< the dest buffer to store the final jpeg */ - unsigned int mCPUCoresNum; /*!< use to remember the CPU Cores number */ - - private: - /** - * \class CodecWorkerThread - * - * This class will create one thread to do one sw jpeg encoder. - * It will call the SWJpegEncoderWrapper directly. - */ - class CodecWorkerThread : public Thread { - public: - struct CodecConfig { - // input buffer configuration - int width; - int height; - int stride; - int fourcc; - void* inBufY; - void* inBufUV; - // output buffer configuration - int quality; - void* outBuf; - int outBufSize; - }; - - CodecWorkerThread(); - ~CodecWorkerThread(); - - void setConfig(const CodecConfig& cfg) { mCfg = cfg; } - void getConfig(CodecConfig* cfg) const { *cfg = mCfg; } - status_t runThread(const char* name); - void waitThreadFinish(void); - int getJpegDataSize(void); - - private: - int mDataSize; /*!< the jpeg data size in one thread */ - CodecConfig mCfg; /*!< the cfg in one thread */ - private: - virtual bool threadLoop(); - int swEncode(void); - }; - - private: - void init(unsigned int threadNum = 1); - void deInit(void); - void config(const EncodePackage& package); - int doJpegEncodingMultiThread(void); - int mergeJpeg(void); - - std::vector > mSwJpegEncoder; - static const unsigned int MAX_THREAD_NUM = 8; /*!< the same as max jpeg restart time */ - static const unsigned int MIN_THREAD_NUM = 1; - - /*!< it's used to use one buffer to merge the multi jpeg data to one jpeg data */ - static const unsigned int DEST_BUF_OFFSET = 1024; - - private: - /** - * \class Codec - * - * This class is used for sw jpeg encoder. - * It will call the libjpeg directly. - * It just support NV12 input currently. - */ - class Codec { - public: - Codec(); - ~Codec(); - - void init(void); - void deInit(void); - void setJpegQuality(int quality); - int configEncoding(int width, int height, int stride, void* jpegBuf, int jpegBufSize); - /* - if fourcc is V4L2_PIX_FMT_NV12, y_buf and uv_buf must be passed - if fourcc is V4L2_PIX_FMT_YUYV, y_buf must be passed, uv_buf could be nullptr - */ - int doJpegEncoding(const void* y_buf, const void* uv_buf = nullptr, - int fourcc = V4L2_PIX_FMT_NV12); - void getJpegSize(int* jpegSize); - - private: - // prevent copy constructor and assignment operator - DISALLOW_COPY_AND_ASSIGN(Codec); - - private: - typedef struct { - struct jpeg_destination_mgr pub; - JSAMPLE* outJpegBuf; /*!< jpeg output buffer */ - int outJpegBufSize; /*!< jpeg output buffer size */ - int codedSize; /*!< the final encoded out jpeg size */ - bool encodeSuccess; /*!< if buffer overflow, it will be set to false */ - } JpegDestMgr, *JpegDestMgrPtr; - - int mStride; - struct jpeg_compress_struct mCInfo; - struct jpeg_error_mgr mJErr; - int mJpegQuality; - static const unsigned int SUPPORTED_FORMAT = JCS_YCbCr; - - int setupJpegDestMgr(j_compress_ptr cInfo, JSAMPLE* jpegBuf, int jpegBufSize); - // the below three functions are for the dest buffer manager. - static void initDestination(j_compress_ptr cInfo); - static boolean emptyOutputBuffer(j_compress_ptr cInfo); - static void termDestination(j_compress_ptr cInfo); - }; -}; - -} // namespace icamera diff --git a/src/opic2/OPIC2Api.h b/src/opic2/OPIC2Api.h deleted file mode 100644 index 10c132ba..00000000 --- a/src/opic2/OPIC2Api.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2022 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef IC2API_FOR_CHROME_H -#define IC2API_FOR_CHROME_H - -#define EVCP_SUCCESS 0 - -extern "C" { - -#define KEYPOINTSCOUNT 40 -struct FaceResult { - int x; - int y; - int width; - int height; - float keypoints[KEYPOINTSCOUNT][2]; - bool valid; -}; - -enum iaic_media_format { iaic_nv12 }; -enum iaic_log_level { trace = 0, debug, info, warning, error, fatal }; - -enum class iaic_session_status { - uninitialized, - opening, - opened, - shutdown, - critical -}; - -struct iaic_memory { - const char* port_name; - const char* feature_name; - - union { - void* p; - void* r; - }; - - unsigned long long size[4]; - iaic_media_format media_type; - bool has_gfx; - struct iaic_memory* next; -}; - -struct iaic_options { - bool profiling = false; - bool blocked_init = false; - unsigned int threads = 1; - void* external_device = nullptr; -}; - -struct iaic_join_desc { - iaic_join_desc* next = nullptr; - const char* src_feature_name = nullptr; - const char* src_port_name = nullptr; - const char* dst_feature_name = nullptr; - const char* dst_port_name = nullptr; -}; - -typedef unsigned int iaic_session; - -extern void iaic_query_version(int* major, int* minor, int* patch); -extern void iaic_startup(); -extern void iaic_shutdown(); - -extern void iaic_query_features(char* future_d, size_t* fsize); -extern void iaic_startup(); -extern void iaic_shutdown(); - -extern void iaic_set_loglevel(iaic_log_level level); -extern void iaic_create_session(iaic_session uid, const char* feature, iaic_options opt); -extern void iaic_close_session(iaic_session uid, const char* feature); -extern void iaic_join_session(iaic_session uid, iaic_join_desc desc); -extern void iaic_disjoin_session(iaic_session uid, iaic_join_desc desc); -extern void iaic_pause_feature(iaic_session uid, const char* feature); -extern void iaic_resume_feature(iaic_session uid, const char* feature); -extern bool iaic_execute(iaic_session uid, iaic_memory in, iaic_memory out); -extern void iaic_set_data(iaic_session uid, iaic_memory& data); -extern void iaic_get_data(iaic_session uid, iaic_memory& data); -extern iaic_session_status iaic_get_status(iaic_session uid, const char* feature); - -struct evcp_context { - std::unique_ptr obj; - iaic_session sessionid; - short width; - short height; - void* hdl; - int sync; -}; - -extern evcp_context* evcp_create_context(int w, int h, void* hdl, int bit); -extern void evcp_destroy_context(evcp_context* ctx); -extern int evcp_toggle_ecc(evcp_context* ctx, int enable); -extern int evcp_toggle_background_concealment(evcp_context* ctx, int enable); -extern int evcp_toggle_background_replacement(evcp_context* ctx, int enable); -extern int evcp_set_background_url(evcp_context* ctx, const char* path); -extern int evcp_toggle_face_centering(evcp_context* ctx, int enable); -extern int evcp_toggle_face_detection(evcp_context* ctx, int enable); -extern int evcp_get_face_result(evcp_context* ctx, FaceResult* result); - -} - -#endif diff --git a/src/platformdata/CameraParser.cpp b/src/platformdata/CameraParser.cpp index defffab7..507a46f6 100644 --- a/src/platformdata/CameraParser.cpp +++ b/src/platformdata/CameraParser.cpp @@ -49,8 +49,11 @@ CameraParser::CameraParser(MediaControl* mc, PlatformData::StaticCfg* cfg) mCurrentDataField(FIELD_INVALID), mSensorNum(0), mCurrentSensor(0), + mCaptureIdLinkIndex(0), + mCaptureIdIndex(0), pCurrentCam(nullptr), mInMediaCtlCfg(false), + mSkipMediaCtlCfg(false), mInStaticMetadata(false), mMC(mc), mMetadataCache(nullptr), @@ -58,6 +61,8 @@ CameraParser::CameraParser(MediaControl* mc, PlatformData::StaticCfg* cfg) LOG1("@%s", __func__); CheckAndLogError(cfg == nullptr, VOID_VALUE, "@%s, cfg is nullptr", __func__); + memset(mCaptureId, 0, sizeof(mCaptureId)); + // Get common data from libcamhal_profile.xml int ret = getDataFromXmlFile(LIBCAMHAL_PROFILE_NAME); CheckAndLogError(ret != OK, VOID_VALUE, "Failed to get libcamhal profile data from %s", @@ -132,12 +137,14 @@ CameraParser::~CameraParser() { * one example: "imx319 $I2CBUS" * Replacing $CSI_PORT with the real mCsiPort if the value contains the string "$CSI_PORT" * one example: "Intel IPU6 CSI-2 $CSI_PORT" or "Intel IPU6 CSI2 $CSI_PORT" + * Replacing $CAPTURE_ID with the real mCaptureId if the value contains the string "$CAPTURE_ID" * * \param profiles: the pointer of the CameraParser. * \param value: camera information. * \return: if the value contains the string, it will be replaced. */ -string CameraParser::replaceStringInXml(CameraParser* profiles, const char* value) { +string CameraParser::replaceStringInXml(CameraParser* profiles, const char* value, + const char* name) { string valueTmp; CheckAndLogError(value == nullptr, valueTmp, "value is nullptr"); @@ -147,6 +154,20 @@ string CameraParser::replaceStringInXml(CameraParser* profiles, const char* valu valueTmp.replace(found, sizeof("$I2CBUS"), profiles->mI2CBus); } else if ((found = valueTmp.find("$CSI_PORT")) != string::npos) { valueTmp.replace(found, sizeof("$CSI_PORT"), profiles->mCsiPort); + } else if ((found = valueTmp.find("$CAPTURE_ID")) != string::npos) { + if (strcmp(name, "link") == 0 && profiles->mCaptureIdLinkIndex < IPU_ISYS_CAPTURE_ID_MAX) { + int captureId = std::stoi(profiles->mCsiPort) * 8 + profiles->mCaptureIdLinkIndex; + valueTmp.replace(found, sizeof("$CAPTURE_ID"), std::to_string(captureId)); + profiles->mCaptureId[profiles->mCaptureIdLinkIndex] = captureId; + profiles->mCaptureIdLinkIndex++; + profiles->mCaptureIdIndex = 0; + } else if (strcmp(name, "videonode") == 0 && + profiles->mCaptureIdIndex < IPU_ISYS_CAPTURE_ID_MAX) { + valueTmp.replace(found, sizeof("$CAPTURE_ID"), + std::to_string(profiles->mCaptureId[profiles->mCaptureIdIndex])); + profiles->mCaptureIdIndex++; + profiles->mCaptureIdLinkIndex = 0; + } } return valueTmp; @@ -838,6 +859,7 @@ int CameraParser::parseLardTags(const char* str, vector& lardTags void CameraParser::parseMediaCtlConfigElement(CameraParser* profiles, const char* name, const char** atts) { MediaCtlConf mc; + bool skipMediaCtlCfg = true; int idx = 0; while (atts[idx]) { @@ -857,10 +879,22 @@ void CameraParser::parseMediaCtlConfigElement(CameraParser* profiles, const char } else if (strcmp(key, "vbp") == 0) { mc.vbp = strtoul(atts[idx + 1], nullptr, 10); // DOL_FEATURE_E + } else if (strcmp(key, "mediaCfg") == 0) { + skipMediaCtlCfg = false; + if (strtol(atts[idx + 1], nullptr, 10) != profiles->mStaticCfg->mMediaCfgId) { + profiles->mSkipMediaCtlCfg = true; + return; + } } idx += 2; } + if (profiles->mSkipMediaCtlCfg || + (skipMediaCtlCfg && profiles->mStaticCfg->mMediaCfgId == IPU6_UPSTREAM_MEDIA_CFG)) { + profiles->mSkipMediaCtlCfg = true; + return; + } + LOG2("@%s, name:%s, atts[0]:%s, id: %d", __func__, name, atts[0], mc.mcId); // Add a new empty MediaControl Configuration profiles->pCurrentCam->mMediaCtlConfs.push_back(mc); @@ -879,7 +913,7 @@ void CameraParser::parseControlElement(CameraParser* profiles, const char* name, const char* val = atts[idx + 1]; LOG2("@%s, name:%s, atts[%d]:%s, atts[%d]:%s", __func__, name, idx, key, idx + 1, val); if (strcmp(key, "name") == 0) { - ctl.entityName = replaceStringInXml(profiles, val); + ctl.entityName = replaceStringInXml(profiles, val, name); if (profiles->mMC) { ctl.entity = profiles->mMC->getEntityIdByName(ctl.entityName.c_str()); } @@ -956,7 +990,7 @@ void CameraParser::parseSelectionElement(CameraParser* profiles, const char* nam const char* val = atts[idx + 1]; LOG2("@%s, name:%s, atts[%d]:%s, atts[%d]:%s", __func__, name, idx, key, idx + 1, val); if (strcmp(key, "name") == 0) { - sel.entityName = replaceStringInXml(profiles, val); + sel.entityName = replaceStringInXml(profiles, val, name); if (profiles->mMC) { sel.entity = profiles->mMC->getEntityIdByName(sel.entityName.c_str()); } @@ -1299,7 +1333,7 @@ void CameraParser::parseFormatElement(CameraParser* profiles, const char* name, const char* val = atts[idx + 1]; LOG2("@%s, name:%s, atts[%d]:%s, atts[%d]:%s", __func__, name, idx, key, idx + 1, val); if (strcmp(key, "name") == 0) { - fmt.entityName = replaceStringInXml(profiles, val); + fmt.entityName = replaceStringInXml(profiles, val, name); if (profiles->mMC) { fmt.entity = profiles->mMC->getEntityIdByName(fmt.entityName.c_str()); } @@ -1345,14 +1379,14 @@ void CameraParser::parseLinkElement(CameraParser* profiles, const char* name, co const char* val = atts[idx + 1]; LOG2("@%s, name:%s, atts[%d]:%s, atts[%d]:%s", __func__, name, idx, key, idx + 1, val); if (strcmp(key, "srcName") == 0) { - link.srcEntityName = replaceStringInXml(profiles, val); + link.srcEntityName = replaceStringInXml(profiles, val, name); if (profiles->mMC) { link.srcEntity = profiles->mMC->getEntityIdByName(link.srcEntityName.c_str()); } } else if (strcmp(key, "srcPad") == 0) { link.srcPad = strtoul(val, nullptr, 10); } else if (strcmp(key, "sinkName") == 0) { - link.sinkEntityName = replaceStringInXml(profiles, val); + link.sinkEntityName = replaceStringInXml(profiles, val, name); if (profiles->mMC) { link.sinkEntity = profiles->mMC->getEntityIdByName(link.sinkEntityName.c_str()); } @@ -1379,7 +1413,7 @@ void CameraParser::parseRouteElement(CameraParser* profiles, const char* name, c const char* val = atts[idx + 1]; LOG2("@%s, name:%s, atts[%d]:%s, atts[%d]:%s", __func__, name, idx, key, idx + 1, val); if (strcmp(key, "name") == 0) { - route.entityName = replaceStringInXml(profiles, val); + route.entityName = replaceStringInXml(profiles, val, name); if (profiles->mMC) { route.entity = profiles->mMC->getEntityIdByName(route.entityName.c_str()); } @@ -1400,12 +1434,12 @@ void CameraParser::parseRouteElement(CameraParser* profiles, const char* name, c mc.routes.push_back(route); } -void CameraParser::parseVideoElement(CameraParser* profiles, const char* /*name*/, +void CameraParser::parseVideoElement(CameraParser* profiles, const char* name, const char** atts) { McVideoNode videoNode; MediaCtlConf& mc = profiles->pCurrentCam->mMediaCtlConfs.back(); - videoNode.name = replaceStringInXml(profiles, atts[1]); + videoNode.name = replaceStringInXml(profiles, atts[1], name); videoNode.videoNodeType = GetNodeType(atts[3]); LOG2("@%s, name:%s, videoNodeType:%d", __func__, videoNode.name.c_str(), videoNode.videoNodeType); @@ -1716,6 +1750,10 @@ int CameraParser::getSupportedFormat(const char* str, vector& supportedForm void CameraParser::handleMediaCtlCfg(CameraParser* profiles, const char* name, const char** atts) { LOG2("@%s, name:%s, atts[0]:%s, profiles->mCurrentSensor:%d", __func__, name, atts[0], profiles->mCurrentSensor); + + if (profiles->mSkipMediaCtlCfg) + return; + if (strcmp(name, "MediaCtlConfig") == 0) { parseMediaCtlConfigElement(profiles, name, atts); } else if (strcmp(name, "link") == 0) { @@ -2132,6 +2170,7 @@ void CameraParser::endParseElement(void* userData, const char* name) { if (strcmp(name, "MediaCtlConfig") == 0) { LOG2("@%s %s, mInMediaCtlCfg is set to false", __func__, name); profiles->mInMediaCtlCfg = false; + profiles->mSkipMediaCtlCfg = false; } if (strcmp(name, "StaticMetadata") == 0) { @@ -2298,19 +2337,20 @@ void CameraParser::getNVMDirectory(CameraParser* profiles) { * 1. * The value is "'camera name'-wf/uf-'CSI port number'". * For example: camera name is "ov8856". Sensor's sink entity name is - * "Intel IPU6 CSI-2 2" or "Intel IPU6 CSI2 2" and it is word facing. + * "Intel IPU6 CSI-2 2" or "Intel IPU6 CSI2 2" and it is world-facing. * The value is ov8856-wf-2. * 2. the platform value must be uppercase letter. * */ std::vector CameraParser::getAvailableSensors( - const std::string& ipuName, const std::vector& sensorsList) { + const std::string& ipuName, const std::vector& sensorsList, int mediaCfgId) { LOG2("@%s, ipuName:%s", __func__, ipuName.c_str()); // sensor's sink entity name prefix:"Intel IPU6 CSI-2 2" or "Intel IPU6 CSI2 2" std::string sensorSinkName = "Intel "; sensorSinkName.append(ipuName); - if (IPU6_UPSTREAM) + + if (mediaCfgId == IPU6_UPSTREAM_MEDIA_CFG) sensorSinkName.append(" CSI2 "); else sensorSinkName.append(" CSI-2 "); @@ -2322,11 +2362,12 @@ std::vector CameraParser::getAvailableSensors( if (mMC && mMC->checkAvailableSensor(sensor)) { availableSensors.push_back(sensor); LOG2("@%s, available sensor name: %s", __func__, sensor.c_str()); +#ifdef LINUX_BUILD } else if (sensor.find("_usb") != string::npos) { - availableSensors.push_back(sensor); - LOG2("@%s, available usb sensor name: %s", __func__, sensor.c_str()); + availableSensors.push_back(sensor); + LOG2("@%s, available usb sensor name: %s", __func__, sensor.c_str()); +#endif } - } else { // sensors with suffix port number std::string portNum = sensor.substr(sensor.find_last_of('-') + 1); @@ -2368,7 +2409,8 @@ void CameraParser::getSensorDataFromXmlFile(void) { // According to sensor name to get sensor data LOG1("%s, available sensors: %zu", __func__, mStaticCfg->mCommonConfig.availableSensors.size()); vector allSensors = getAvailableSensors(mStaticCfg->mCommonConfig.ipuName, - mStaticCfg->mCommonConfig.availableSensors); + mStaticCfg->mCommonConfig.availableSensors, + mStaticCfg->mMediaCfgId); if (allSensors.size() == 0) { LOGW("The style of libcamhal_profile is too old, please switch it as soon as possible !!!"); diff --git a/src/platformdata/CameraParser.h b/src/platformdata/CameraParser.h index 9782bd67..025c424e 100644 --- a/src/platformdata/CameraParser.h +++ b/src/platformdata/CameraParser.h @@ -74,6 +74,7 @@ struct CameraModuleInfo { #define CAMERA_MODULE_INFO_OFFSET 32 #define CAMERA_MODULE_INFO_SIZE 32 #define DEFAULT_MODULE_NAME "default" +#define IPU_ISYS_CAPTURE_ID_MAX 8 /** * \class CameraParser * @@ -96,6 +97,15 @@ class CameraParser : public ParserBase { int mCurrentSensor; std::string mI2CBus; std::string mCsiPort; + + /** + * mCaptureId is used to store Intel IPU6 ISYS Capture Id for each sensor. + * When parse Link, if it has video capture, mCaptureIdLinkIndex will add, and put value + * into mCaptureId. Otherwise, mCaptureIdIndex will add and get value from mCaptureId. + */ + int mCaptureId[IPU_ISYS_CAPTURE_ID_MAX]; + int mCaptureIdLinkIndex; + int mCaptureIdIndex; struct AvailableSensorInfo { std::string sinkEntityName; bool sensorFlag; @@ -103,6 +113,7 @@ class CameraParser : public ParserBase { std::unordered_map mAvailableSensor; PlatformData::StaticCfg::CameraInfo* pCurrentCam; bool mInMediaCtlCfg; + bool mSkipMediaCtlCfg; bool mInStaticMetadata; MediaControl* mMC; CameraMetadata mMetadata; @@ -131,7 +142,8 @@ class CameraParser : public ParserBase { char** endptr = nullptr); std::vector getAvailableSensors(const std::string& ipuName, - const std::vector& sensorsList); + const std::vector& sensorsList, + int mediaCfgId); void getSensorDataFromXmlFile(void); void getCsiPortAndI2CBus(CameraParser* profiles); void checkField(CameraParser* profiles, const char* name, const char** atts); @@ -174,7 +186,7 @@ class CameraParser : public ParserBase { void parseOutputMap(const char* str, std::vector& outputMap); - std::string replaceStringInXml(CameraParser* profiles, const char* value); + std::string replaceStringInXml(CameraParser* profiles, const char* value, const char* name); void getNVMDirectory(CameraParser* profiles); int getCameraModuleNameFromEEPROM(PlatformData::StaticCfg::CameraInfo* cam); diff --git a/src/platformdata/PlatformData.cpp b/src/platformdata/PlatformData.cpp index 357b9b76..37db7486 100644 --- a/src/platformdata/PlatformData.cpp +++ b/src/platformdata/PlatformData.cpp @@ -62,6 +62,7 @@ PlatformData::PlatformData() { MediaControl* mc = MediaControl::getInstance(); if (mc) { mc->initEntities(); + mStaticCfg.mMediaCfgId = mc->getMediaCfgId(); } CameraParser CameraParser(mc, &mStaticCfg); @@ -1556,14 +1557,10 @@ bool PlatformData::isCSIBackEndCapture(int cameraId) { CheckAndLogError(!mc, false, "getMediaCtlConf returns nullptr, cameraId:%d", cameraId); for (const auto& node : mc->videoNodes) { - if (IPU6_UPSTREAM && node.videoNodeType == VIDEO_GENERIC && - node.name.find("ISYS capture") != string::npos) { - isCsiBECapture = true; - break; - } if (node.videoNodeType == VIDEO_GENERIC && (node.name.find("BE capture") != string::npos || - node.name.find("BE SOC capture") != string::npos)) { + node.name.find("BE SOC capture") != string::npos || + node.name.find("ISYS capture") != string::npos)) { isCsiBECapture = true; break; } @@ -1578,13 +1575,10 @@ bool PlatformData::isCSIFrontEndCapture(int cameraId) { CheckAndLogError(!mc, false, "getMediaCtlConf returns nullptr, cameraId:%d", cameraId); for (const auto& node : mc->videoNodes) { - if (IPU6_UPSTREAM && node.videoNodeType == VIDEO_GENERIC && - node.name.find("CSI2") != string::npos) { - isCsiFeCapture = true; - break; - } if (node.videoNodeType == VIDEO_GENERIC && - (node.name.find("CSI-2") != string::npos || node.name.find("TPG") != string::npos)) { + (node.name.find("CSI-2") != string::npos || + node.name.find("TPG") != string::npos || + node.name.find("CSI2") != string::npos)) { isCsiFeCapture = true; break; } @@ -1756,10 +1750,6 @@ camera_coordinate_system_t PlatformData::getActivePixelArray(int cameraId) { string PlatformData::getCameraCfgPath() { string cfgPath = string(CAMERA_DEFAULT_CFG_PATH); -#ifdef SUB_CONFIG_PATH - cfgPath += string(SUB_CONFIG_PATH); - cfgPath.append("/"); -#endif char* p = getenv("CAMERA_CFG_PATH"); return p ? string(p) : cfgPath; @@ -1996,6 +1986,18 @@ int64_t PlatformData::getReqWaitTimeout(int cameraId) { return getInstance()->mStaticCfg.mCameras[cameraId].mReqWaitTimeout; } +v4l2_buf_type PlatformData::getV4L2BufType(int cameraId) { + return getInstance()->mStaticCfg.mCameras[cameraId].mV4l2BufType; +} + +void PlatformData::setV4L2BufType(int cameraId, v4l2_buf_type v4l2BufType) { + getInstance()->mStaticCfg.mCameras[cameraId].mV4l2BufType = v4l2BufType; +} + +int PlatformData::getMediaCfgId() { + return getInstance()->mStaticCfg.mMediaCfgId; +} + // LEVEL0_ICBM_S bool PlatformData::isGPUICBMEnabled() { return getInstance()->mStaticCfg.mCommonConfig.isGPUICBMEnabled; diff --git a/src/platformdata/PlatformData.h b/src/platformdata/PlatformData.h index ebb0f0df..59699f6d 100644 --- a/src/platformdata/PlatformData.h +++ b/src/platformdata/PlatformData.h @@ -89,11 +89,14 @@ namespace icamera { #define MAX_CAMERA_NUMBER 100 // Temporarily using current path to save aiqd file for none CAL platforms. #define CAMERA_CACHE_DIR "./" -#define CAMERA_DEFAULT_CFG_PATH "/etc/camera/" #define CAMERA_GRAPH_DESCRIPTOR_FILE "gcss/graph_descriptor.xml" #define CAMERA_GRAPH_SETTINGS_DIR "gcss/" #endif +#ifndef CAMERA_DEFAULT_CFG_PATH +#error CAMERA_DEFAULT_CFG_PATH not defined +#endif + #define NVM_DATA_PATH "/sys/bus/i2c/devices/" #define TNR7US_RESTART_THRESHOLD 5 @@ -108,7 +111,8 @@ class PlatformData { public: class StaticCfg { public: - StaticCfg() { mCameras.clear(); } + StaticCfg() + : mMediaCfgId(IPU6_DOWNSTREAM_MEDIA_CFG) { mCameras.clear(); } ~StaticCfg() {} // not release resource by design /** @@ -213,7 +217,8 @@ class PlatformData { mDisableBLCAGainLow(-1), mDisableBLCAGainHigh(-1), mResetLinkRoute(true), - mReqWaitTimeout(0) {} + mReqWaitTimeout(0), + mV4l2BufType(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {} std::vector mMediaCtlConfs; @@ -365,6 +370,7 @@ class PlatformData { bool mResetLinkRoute; /* mReqWaitTimeout is used to override dqbuf timeout (ns) */ int64_t mReqWaitTimeout; + v4l2_buf_type mV4l2BufType; }; /** @@ -376,6 +382,7 @@ class PlatformData { std::vector mPolicyConfig; CommonConfig mCommonConfig; std::string mBoardName; + int mMediaCfgId; }; private: @@ -1835,6 +1842,29 @@ class PlatformData { */ static int64_t getReqWaitTimeout(int cameraId); + /** + * Get V4L2 buffer type + * + * \param cameraId: [0, MAX_CAMERA_NUMBER - 1] + * \return V4L2 buffer type + */ + static v4l2_buf_type getV4L2BufType(int cameraId); + + /** + * Set V4L2 buffer type + * + * \param cameraId: [0, MAX_CAMERA_NUMBER - 1] + * \param v4l2BufType:V4L2 buffer type + */ + static void setV4L2BufType(int cameraId, v4l2_buf_type v4l2BufType); + + /** + * Get media configuration ID + * + * \return media configuration ID + */ + static int getMediaCfgId(); + // LEVEL0_ICBM_S /** * Check GPU ICBM is enabled or not diff --git a/src/v4l2/MediaControl.cpp b/src/v4l2/MediaControl.cpp index 4284e6a6..54158cc3 100644 --- a/src/v4l2/MediaControl.cpp +++ b/src/v4l2/MediaControl.cpp @@ -127,7 +127,9 @@ void MediaControl::releaseInstance() { } } -MediaControl::MediaControl(const char* devName) : mDevName(devName) { +MediaControl::MediaControl(const char* devName) + : mDevName(devName), + mMediaCfgId(IPU6_DOWNSTREAM_MEDIA_CFG) { LOG1("@%s device: %s", __func__, devName); } @@ -425,6 +427,7 @@ void MediaControl::dumpEntityDesc(media_entity_desc& desc, media_device_info& de } int MediaControl::enumEntities(int fd, media_device_info& devInfo) { + int mediaCfgId = IPU6_MEDIA_CFG_MAX; MediaEntity entity; uint32_t id; int ret; @@ -440,6 +443,14 @@ int MediaControl::enumEntities(int fd, media_device_info& devInfo) { break; } + if (mediaCfgId == IPU6_MEDIA_CFG_MAX) { + if (!strncmp(entity.info.name, IPU6_DOWNSTREAM_ENTITY, strlen(IPU6_DOWNSTREAM_ENTITY))) + mediaCfgId = IPU6_DOWNSTREAM_MEDIA_CFG; + else if (!strncmp(entity.info.name, IPU6_UPSTREAM_ENTITY, + strlen(IPU6_UPSTREAM_ENTITY))) + mediaCfgId = IPU6_UPSTREAM_MEDIA_CFG; + } + if (Log::isDumpMediaInfo()) dumpEntityDesc(entity.info, devInfo); /* Number of links (for outbound links) plus number of pads (for @@ -465,7 +476,21 @@ int MediaControl::enumEntities(int fd, media_device_info& devInfo) { } } - return ret; + if (ret != 0) + return ret; + + if (mediaCfgId != IPU6_MEDIA_CFG_MAX) + mMediaCfgId = mediaCfgId; + + if ((!strcmp(devInfo.model, IPU6_DOWNSTREAM_DEV_MODEL) && + mMediaCfgId != IPU6_DOWNSTREAM_MEDIA_CFG) || + (!strcmp(devInfo.model, IPU6_UPSTREAM_DEV_MODEL) && + mMediaCfgId != IPU6_UPSTREAM_MEDIA_CFG)) { + LOGE("Invalid media configuration id %d for %s", mMediaCfgId, devInfo.model); + return -EINVAL; + } + + return OK; } int MediaControl::getDevnameFromSysfs(MediaEntity* entity) { diff --git a/src/v4l2/MediaControl.h b/src/v4l2/MediaControl.h index 540937f9..39174c5f 100644 --- a/src/v4l2/MediaControl.h +++ b/src/v4l2/MediaControl.h @@ -51,6 +51,16 @@ struct MediaLink; #define MEDIA_CTL_DEV_NAME "/dev/media" #define MEDIA_DRIVER_NAME "intel-ipu" #define MEDIA_DEVICE_MAX_NUM 256 +#define IPU6_DOWNSTREAM_ENTITY "Intel IPU6 CSI-2" +#define IPU6_UPSTREAM_ENTITY "Intel IPU6 CSI2" +#define IPU6_DOWNSTREAM_DEV_MODEL "ipu6-downstream" +#define IPU6_UPSTREAM_DEV_MODEL "ipu6" + +enum { + IPU6_DOWNSTREAM_MEDIA_CFG = 0, + IPU6_UPSTREAM_MEDIA_CFG = 1, + IPU6_MEDIA_CFG_MAX, +}; enum { FC_FORMAT = 0, @@ -300,6 +310,8 @@ class MediaControl { int getI2CBusAddress(const std::string& sensorEntityName, const std::string& sinkEntityName, std::string* i2cBus); + int getMediaCfgId() { return mMediaCfgId; } + private: MediaControl& operator=(const MediaControl&); MediaControl(const char* devName); @@ -353,6 +365,8 @@ class MediaControl { static MediaControl* sInstance; static Mutex sLock; + + int mMediaCfgId; }; } // namespace icamera