diff --git a/CMakeLists.txt b/CMakeLists.txt index 926850aa..43d387ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,6 +256,13 @@ else() endif() add_library(camhal_static STATIC ${LIBCAMHAL_SRCS}) + +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}") +endif() set_target_properties(camhal_static PROPERTIES OUTPUT_NAME "camhal") #---------------------------- Link settings ---------------------------- @@ -378,10 +385,12 @@ endif() #ENABLE_SANDBOXING #--------------------------- Install settings --------------------------- if (NOT CAL_BUILD) # Install headers -install(DIRECTORY include/ DESTINATION include/${CMAKE_INSTALL_SUB_PATH}/libcamhal) -if (SUPPORT_LIVE_TUNING) - install(FILES modules/livetune/LiveTuning.h DESTINATION include/${CMAKE_INSTALL_SUB_PATH}/libcamhal/api) -endif() #SUPPORT_LIVE_TUNING +if ("${CMAKE_INSTALL_SUB_PATH}" STREQUAL "") + install(DIRECTORY include/ DESTINATION include/libcamhal) + if (SUPPORT_LIVE_TUNING) + install(FILES modules/livetune/LiveTuning.h DESTINATION include/libcamhal/api) + endif() #SUPPORT_LIVE_TUNING +endif() # Install configure files # By default ipu4 is used diff --git a/config/linux/ipu6ep/AR0234_TGL_10bits.aiqb b/config/linux/ipu6ep/AR0234_TGL_10bits.aiqb index 51c3409a..a469723c 100644 Binary files a/config/linux/ipu6ep/AR0234_TGL_10bits.aiqb and b/config/linux/ipu6ep/AR0234_TGL_10bits.aiqb differ diff --git a/config/linux/ipu6ep/sensors/imx390.xml b/config/linux/ipu6ep/sensors/imx390.xml index 6f823d06..cddf78a9 100644 --- a/config/linux/ipu6ep/sensors/imx390.xml +++ b/config/linux/ipu6ep/sensors/imx390.xml @@ -99,6 +99,7 @@ + @@ -185,6 +186,7 @@ + @@ -271,6 +273,7 @@ + @@ -357,6 +360,7 @@ + @@ -443,6 +447,7 @@ + @@ -529,5 +534,540 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/0315_imx274_wfov.IPU6.aiqb b/config/linux/ipu6epmtl/0315_imx274_wfov.IPU6.aiqb deleted file mode 100644 index 59a0bee9..00000000 Binary files a/config/linux/ipu6epmtl/0315_imx274_wfov.IPU6.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/0524_A_IMX477_WFOV_PSS.IPU6.ipdev.IPU6.aiqb b/config/linux/ipu6epmtl/0524_A_IMX477_WFOV_PSS.IPU6.ipdev.IPU6.aiqb deleted file mode 100644 index 1befd020..00000000 Binary files a/config/linux/ipu6epmtl/0524_A_IMX477_WFOV_PSS.IPU6.ipdev.IPU6.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/AR0234_BARCODE_TGL.aiqb b/config/linux/ipu6epmtl/AR0234_BARCODE_TGL.aiqb deleted file mode 100644 index 0eab4246..00000000 Binary files a/config/linux/ipu6epmtl/AR0234_BARCODE_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/AR0234_TGL_10bits.aiqb b/config/linux/ipu6epmtl/AR0234_TGL_10bits.aiqb deleted file mode 100644 index 51c3409a..00000000 Binary files a/config/linux/ipu6epmtl/AR0234_TGL_10bits.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX135_13P2BAD33_TGL.aiqb b/config/linux/ipu6epmtl/IMX135_13P2BAD33_TGL.aiqb deleted file mode 100644 index a977662b..00000000 Binary files a/config/linux/ipu6epmtl/IMX135_13P2BAD33_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX362_A12N08B_MDSVE_TGL.aiqb b/config/linux/ipu6epmtl/IMX362_A12N08B_MDSVE_TGL.aiqb deleted file mode 100644 index c0bc88f4..00000000 Binary files a/config/linux/ipu6epmtl/IMX362_A12N08B_MDSVE_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX362_A12N08B_MD_TGL.aiqb b/config/linux/ipu6epmtl/IMX362_A12N08B_MD_TGL.aiqb deleted file mode 100644 index 86ab8e67..00000000 Binary files a/config/linux/ipu6epmtl/IMX362_A12N08B_MD_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX362_A12N08B_SVE_TGL.aiqb b/config/linux/ipu6epmtl/IMX362_A12N08B_SVE_TGL.aiqb deleted file mode 100644 index 5985f3ce..00000000 Binary files a/config/linux/ipu6epmtl/IMX362_A12N08B_SVE_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX362_A12N08B_TGL.aiqb b/config/linux/ipu6epmtl/IMX362_A12N08B_TGL.aiqb deleted file mode 100644 index 4cf7eb56..00000000 Binary files a/config/linux/ipu6epmtl/IMX362_A12N08B_TGL.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/IMX390_HDR_TGL_2.aiqb b/config/linux/ipu6epmtl/IMX390_HDR_TGL_2.aiqb deleted file mode 100644 index 2df11318..00000000 Binary files a/config/linux/ipu6epmtl/IMX390_HDR_TGL_2.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX477_MOD255I_DOL_TGL.aiqb b/config/linux/ipu6epmtl/IMX477_MOD255I_DOL_TGL.aiqb deleted file mode 100644 index 77409882..00000000 Binary files a/config/linux/ipu6epmtl/IMX477_MOD255I_DOL_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX477_MOD26552_BAYER_TGL.aiqb b/config/linux/ipu6epmtl/IMX477_MOD26552_BAYER_TGL.aiqb deleted file mode 100644 index 0ea2cd75..00000000 Binary files a/config/linux/ipu6epmtl/IMX477_MOD26552_BAYER_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX477_MOD26552_WFOV_TGL.aiqb b/config/linux/ipu6epmtl/IMX477_MOD26552_WFOV_TGL.aiqb deleted file mode 100644 index f3e5b3a3..00000000 Binary files a/config/linux/ipu6epmtl/IMX477_MOD26552_WFOV_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/IMX488_56B6_TGL.aiqb b/config/linux/ipu6epmtl/IMX488_56B6_TGL.aiqb deleted file mode 100644 index 4ade69fd..00000000 Binary files a/config/linux/ipu6epmtl/IMX488_56B6_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV01A1S_YHRN180_TGL.aiqb b/config/linux/ipu6epmtl/OV01A1S_YHRN180_TGL.aiqb deleted file mode 100644 index c372a85a..00000000 Binary files a/config/linux/ipu6epmtl/OV01A1S_YHRN180_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV01A1S_YHRN_TGL.aiqb b/config/linux/ipu6epmtl/OV01A1S_YHRN_TGL.aiqb deleted file mode 100644 index ae2ae7c9..00000000 Binary files a/config/linux/ipu6epmtl/OV01A1S_YHRN_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV13858_MSHW0261_TGL.aiqb b/config/linux/ipu6epmtl/OV13858_MSHW0261_TGL.aiqb deleted file mode 100644 index 62922cdb..00000000 Binary files a/config/linux/ipu6epmtl/OV13858_MSHW0261_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV5693_13P2BA540_BIN_TGL.aiqb b/config/linux/ipu6epmtl/OV5693_13P2BA540_BIN_TGL.aiqb deleted file mode 100644 index 5340be8e..00000000 Binary files a/config/linux/ipu6epmtl/OV5693_13P2BA540_BIN_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV5693_MSHW0220_TGL.aiqb b/config/linux/ipu6epmtl/OV5693_MSHW0220_TGL.aiqb deleted file mode 100644 index e6963d6a..00000000 Binary files a/config/linux/ipu6epmtl/OV5693_MSHW0220_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV5693_MSHW0260_TGL.aiqb b/config/linux/ipu6epmtl/OV5693_MSHW0260_TGL.aiqb deleted file mode 100644 index 95ca220e..00000000 Binary files a/config/linux/ipu6epmtl/OV5693_MSHW0260_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV7251_MSHW0222_TGL.aiqb b/config/linux/ipu6epmtl/OV7251_MSHW0222_TGL.aiqb deleted file mode 100644 index bc5fd22c..00000000 Binary files a/config/linux/ipu6epmtl/OV7251_MSHW0222_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/OV8865_MSHW0221_TGL.aiqb b/config/linux/ipu6epmtl/OV8865_MSHW0221_TGL.aiqb deleted file mode 100644 index 23e90e1f..00000000 Binary files a/config/linux/ipu6epmtl/OV8865_MSHW0221_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/VD55G0_MSHW0262_TGL.aiqb b/config/linux/ipu6epmtl/VD55G0_MSHW0262_TGL.aiqb deleted file mode 100644 index 361c548f..00000000 Binary files a/config/linux/ipu6epmtl/VD55G0_MSHW0262_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/gcss/graph_descriptor.xml b/config/linux/ipu6epmtl/gcss/graph_descriptor.xml deleted file mode 100644 index 30958488..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_descriptor.xml +++ /dev/null @@ -1,17232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/gcss/graph_settings_ar0234.xml b/config/linux/ipu6epmtl/gcss/graph_settings_ar0234.xml deleted file mode 100644 index 040e423a..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_settings_ar0234.xml +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/gcss/graph_settings_external_source.xml b/config/linux/ipu6epmtl/gcss/graph_settings_external_source.xml deleted file mode 100644 index a25b82fc..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_settings_external_source.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - legacy - true - - - diff --git a/config/linux/ipu6epmtl/gcss/graph_settings_imx390.xml b/config/linux/ipu6epmtl/gcss/graph_settings_imx390.xml deleted file mode 100644 index 321e4884..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_settings_imx390.xml +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/gcss/graph_settings_usb.xml b/config/linux/ipu6epmtl/gcss/graph_settings_usb.xml deleted file mode 100644 index f244c832..00000000 --- a/config/linux/ipu6epmtl/gcss/graph_settings_usb.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/libcamhal_profile.xml b/config/linux/ipu6epmtl/libcamhal_profile.xml deleted file mode 100644 index 4514be5c..00000000 --- a/config/linux/ipu6epmtl/libcamhal_profile.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/ov9738_chicony_TGL.aiqb b/config/linux/ipu6epmtl/ov9738_chicony_TGL.aiqb deleted file mode 100644 index e8e919b5..00000000 Binary files a/config/linux/ipu6epmtl/ov9738_chicony_TGL.aiqb and /dev/null differ diff --git a/config/linux/ipu6epmtl/psys_policy_profiles.xml b/config/linux/ipu6epmtl/psys_policy_profiles.xml deleted file mode 100644 index d9c477f8..00000000 --- a/config/linux/ipu6epmtl/psys_policy_profiles.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/ar0234.xml b/config/linux/ipu6epmtl/sensors/ar0234.xml deleted file mode 100644 index 52c444ff..00000000 --- a/config/linux/ipu6epmtl/sensors/ar0234.xml +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/ar0234_usb.xml b/config/linux/ipu6epmtl/sensors/ar0234_usb.xml deleted file mode 100755 index 26f5068d..00000000 --- a/config/linux/ipu6epmtl/sensors/ar0234_usb.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/external_source.xml b/config/linux/ipu6epmtl/sensors/external_source.xml deleted file mode 100644 index 6c85981b..00000000 --- a/config/linux/ipu6epmtl/sensors/external_source.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/imx390.xml b/config/linux/ipu6epmtl/sensors/imx390.xml deleted file mode 100644 index f50fea54..00000000 --- a/config/linux/ipu6epmtl/sensors/imx390.xml +++ /dev/null @@ -1,448 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/lt6911uxc.xml b/config/linux/ipu6epmtl/sensors/lt6911uxc.xml deleted file mode 100644 index 390eacdd..00000000 --- a/config/linux/ipu6epmtl/sensors/lt6911uxc.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/tunning_profiles.xml b/config/linux/ipu6epmtl/tunning_profiles.xml deleted file mode 100644 index f1bc2c1f..00000000 --- a/config/linux/ipu6epmtl/tunning_profiles.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - diff --git a/include/api/Parameters.h b/include/api/Parameters.h index b4d65c4e..0e9d1c82 100644 --- a/include/api/Parameters.h +++ b/include/api/Parameters.h @@ -726,6 +726,7 @@ typedef enum { CAMERA_METADATA_READY, CAMERA_DEVICE_ERROR, CAMERA_IPC_ERROR, + CAMERA_METADATA_ENTRY, } camera_msg_type_t; /** @@ -768,6 +769,22 @@ typedef struct { int64_t sequence; } metadata_ready_t; +/** + * \struct metadata_entry_t: Use to set metadata entry. + */ +typedef struct { + uint32_t tag; + uint32_t frameNumber; + size_t count; + union { + const uint8_t* u8; + const int32_t* i32; + const float* f; + const int64_t* i64; + const double* d; + } data; +} metadata_entry_t; + /** * \struct camera_msg_data_t: Use to specify msg data. */ @@ -776,6 +793,7 @@ typedef struct { union { isp_buffer_ready_t buffer_ready; metadata_ready_t metadata_ready; + metadata_entry_t metadata_entry; } data; } camera_msg_data_t; @@ -2866,82 +2884,6 @@ class Parameters { */ int getCallbackTmCurve(bool* enabled) const; - // ENABLE_EVCP_S - /** - * \brief Set EVCP ECC status - * - * \param[in] int enabled - * - * \return 0 if set successfully, otherwise non-0 value is returned. - */ - int setEvcpEccMode(uint8_t enabled); - /** - * \brief Get EVCP ECC enable status - * - * \param[out] int enabled - * - * \return 0 if flag was set, otherwise non-0 value is returned. - */ - int getEvcpEccMode(uint8_t* enabled) const; - - /** - * \brief Set EVCP BC Mode - * - * \param[in] uint8_t Mode - * - * \return 0 if set successfully, otherwise non-0 value is returned. - */ - int setEvcpBCMode(uint8_t mode); - - /** - * \brief Get EVCP BC Mode - * - * \param[out] uint8_t mode - * - * \return 0 if flag was set, otherwise non-0 value is returned. - */ - int getEvcpBCMode(uint8_t* mode) const; - - /** - * \brief Set EVCP BR Parameters - * - * \param[in] int height - * \param[in] int width - * \param[in] int fd - * - * \return 0 if set successfully, otherwise non-0 value is returned. - */ - int setEvcpBRParameters(int height, int width, int fd); - /** - * \brief Get EVCP BR Parameters - * - * \param[out] int height - * \param[out] int width - * \param[out] int fd - * - * \return 0 if flag was set, otherwise non-0 value is returned. - */ - int getEvcpBRParameters(int* height, int* width, int* fd) const; - - /** - * \brief Set EVCP FF Mode - * - * \param[in] uint8_t Mode - * - * \return 0 if set successfully, otherwise non-0 value is returned. - */ - int setEvcpFFMode(uint8_t mode); - - /** - * \brief Get EVCP FF Mode - * - * \param[out] uint8_t mode - * - * \return 0 if flag was set, otherwise non-0 value is returned. - */ - int getEvcpFFMode(uint8_t* mode) const; - // ENABLE_EVCP_E - /** * \brief Set scale & crop region * diff --git a/include/linux/ipu-isys.h b/include/linux/ipu-isys.h index 7ecf35c4..d96e95e1 100644 --- a/include/linux/ipu-isys.h +++ b/include/linux/ipu-isys.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (C) 2019 Intel Corporation. + * Copyright (C) 2019-2023 Intel Corporation. **************************************************************************** *** *** This header was automatically generated from a Linux kernel header @@ -24,6 +24,7 @@ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define V4L2_CID_IPU_STORE_CSI2_HEADER (V4L2_CID_IPU_BASE + 2) #define V4L2_CID_IPU_ISYS_COMPRESSION (V4L2_CID_IPU_BASE + 3) +#define V4L2_CID_IPU_QUERY_SUB_STREAM (V4L2_CID_IPU_BASE + 4) #define V4L2_IPU_ISA_EN_BLC (1 << 0) #define V4L2_IPU_ISA_EN_LSC (1 << 1) #define V4L2_IPU_ISA_EN_DPC (1 << 2) 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/algowrapper/IntelICBM.cpp b/modules/algowrapper/IntelICBM.cpp index 9eb6ed1d..ec1cef42 100644 --- a/modules/algowrapper/IntelICBM.cpp +++ b/modules/algowrapper/IntelICBM.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * 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. @@ -17,26 +17,34 @@ #define LOG_TAG IntelICBM #include "modules/algowrapper/IntelICBM.h" -#include "src/icbm/ICBMBuilder.h" #include "Errors.h" -#include "iutils/CameraLog.h" +#include "iutils/Utils.h" namespace icamera { int IntelICBM::setup(ICBMInitInfo* initParam) { - mIIntelICBM = std::unique_ptr(createIntelICBM()); + mIntelOPIC2 = IntelOPIC2::getInstance(); - return mIIntelICBM->setup(initParam); + return mIntelOPIC2->setup(initParam); } -void IntelICBM::shutdown() { - mIIntelICBM->shutdown(); +int IntelICBM::shutdown(const ICBMReqInfo& request) { + CheckAndLogError(mIntelOPIC2 == nullptr, UNKNOWN_ERROR, "@%s, no active ICBM session", + __func__); + int ret = mIntelOPIC2->shutdown(request); + // ret is the active session count, only release the object when no active session + if (ret == 0) { + IntelOPIC2::releaseInstance(); + mIntelOPIC2 = nullptr; + } + return ret; } -int IntelICBM::processFrame(const ImageInfo& iii, const ImageInfo& iio, - const ICBMReqInfo& reqInfo) { - return mIIntelICBM->processFrame(iii, iio, reqInfo); +int IntelICBM::processFrame(const ICBMReqInfo& reqInfo) { + CheckAndLogError(mIntelOPIC2 == nullptr, UNKNOWN_ERROR, "@%s, no active ICBM session", + __func__); + return mIntelOPIC2->processFrame(reqInfo); } } // namespace icamera diff --git a/modules/algowrapper/IntelICBM.h b/modules/algowrapper/IntelICBM.h index 742d9b78..90704c8e 100644 --- a/modules/algowrapper/IntelICBM.h +++ b/modules/algowrapper/IntelICBM.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * 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. @@ -19,7 +19,7 @@ #include #include -#include "src/icbm/IntelICBM.h" +#include "src/icbm/OnePunchIC2.h" #include "src/icbm/ICBMTypes.h" namespace icamera { @@ -27,11 +27,11 @@ namespace icamera { class IntelICBM { public: int setup(ICBMInitInfo* initParam); - void shutdown(); + int shutdown(const ICBMReqInfo& reqInfo); - int processFrame(const ImageInfo& iii, const ImageInfo& iio, const ICBMReqInfo& reqInfo); + int processFrame(const ICBMReqInfo& reqInfo); private: - std::unique_ptr mIIntelICBM; + IntelOPIC2* mIntelOPIC2; }; } // namespace icamera diff --git a/modules/algowrapper/IntelTNR7US.cpp b/modules/algowrapper/IntelTNR7US.cpp index 7dc331fb..7866e9e6 100644 --- a/modules/algowrapper/IntelTNR7US.cpp +++ b/modules/algowrapper/IntelTNR7US.cpp @@ -32,42 +32,38 @@ namespace icamera { IntelTNR7US* IntelTNR7US::createIntelTNR(int cameraId) { - return new IntelTNR7US(cameraId); +#ifdef TNR7_CM + return new IntelC4mTNR(cameraId); +#endif } -IntelTNR7US::IntelTNR7US(int cameraId) - : mCameraId(cameraId), - mWidth(0), - mHeight(0), - mTnrType(TNR_INSTANCE_MAX), - mTnrParam(nullptr) {} +Tnr7Param* IntelTNR7US::allocTnr7ParamBuf() { + LOG1("@%s, type %d", mCameraId, __func__, mTnrType); + mTnrParam = new Tnr7Param; + return mTnrParam; +} -IntelTNR7US::~IntelTNR7US() { +#ifdef TNR7_CM +IntelC4mTNR::~IntelC4mTNR() { for (auto surface : mCMSurfaceMap) { destroyCMSurface(surface.second); } mCMSurfaceMap.clear(); } -int IntelTNR7US::init(int width, int height, TnrType type) { +int IntelC4mTNR::init(int width, int height, TnrType type) { LOG1("@%s size %dx%d, type %d", mCameraId, __func__, width, height, type); mWidth = width; mHeight = height; mTnrType = type; - std::string threadName = "IntelTNR7US" + std::to_string(type + (mCameraId << 1)); + std::string threadName = "IntelC4mTNR" + std::to_string(type + (mCameraId << 1)); mThread = std::unique_ptr(new base::Thread(threadName)); mThread->Start(); return OK; } -Tnr7Param* IntelTNR7US::allocTnr7ParamBuf() { - LOG1("<%d>@%s, type %d", mCameraId, __func__, mTnrType); - mTnrParam = new Tnr7Param; - return mTnrParam; -} - -void* IntelTNR7US::allocCamBuf(uint32_t bufSize, int id) { +void* IntelC4mTNR::allocCamBuf(uint32_t bufSize, int id) { LOG1("<%d>@%s, type %d, id: %d", mCameraId, __func__, mTnrType, id); void* buffer = nullptr; int ret = posix_memalign(&buffer, getpagesize(), bufSize); @@ -82,7 +78,7 @@ void* IntelTNR7US::allocCamBuf(uint32_t bufSize, int id) { return buffer; } -void IntelTNR7US::freeAllBufs() { +void IntelC4mTNR::freeAllBufs() { LOG1("<%d>@%s, type %d", mCameraId, __func__, mTnrType); for (auto surface : mCMSurfaceMap) { ::free(surface.first); @@ -92,7 +88,7 @@ void IntelTNR7US::freeAllBufs() { } } -int IntelTNR7US::prepareSurface(void* bufAddr, int size) { +int IntelC4mTNR::prepareSurface(void* bufAddr, int size) { CheckAndLogError(size < mWidth * mHeight * 3 / 2, UNKNOWN_ERROR, "%s, invalid buffer size:%d", __func__, size); CmSurface2DUP* surface = createCMSurface(bufAddr); @@ -102,10 +98,10 @@ int IntelTNR7US::prepareSurface(void* bufAddr, int size) { return OK; } -int IntelTNR7US::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, +int IntelC4mTNR::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate, int fd) { PERF_CAMERA_ATRACE(); - TRACE_LOG_PROCESS("IntelTNR7US", "runTnrFrame"); + TRACE_LOG_PROCESS("IntelC4mTNR", "runTnrFrame"); LOG2("<%d>@%s type %d", mCameraId, __func__, mTnrType); CheckAndLogError(inBufAddr == nullptr || outBufAddr == nullptr || tnrParam == nullptr, UNKNOWN_ERROR, "@%s, buffer is nullptr", __func__); @@ -122,7 +118,9 @@ int IntelTNR7US::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t i CheckAndLogError(outSurface == nullptr, UNKNOWN_ERROR, "Failed to get CMSurface for output buffer"); struct timespec beginTime = {}; - if (Log::isLogTagEnabled(ST_GPU_TNR)) clock_gettime(CLOCK_MONOTONIC, &beginTime); + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { + clock_gettime(CLOCK_MONOTONIC, &beginTime); + } /* call Tnr api to run tnr for the inSurface and store the result in outSurface */ int ret = run_tnr7us_frame(mWidth, mHeight, mWidth, inSurface, outSurface, &tnrParam->scale, @@ -131,7 +129,7 @@ int IntelTNR7US::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t i destroyCMSurface(outSurface); } CheckAndLogError(ret != OK, UNKNOWN_ERROR, "tnr7us process failed"); - if (Log::isLogTagEnabled(ST_GPU_TNR)) { + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { struct timespec endTime = {}; clock_gettime(CLOCK_MONOTONIC, &endTime); uint64_t timeUsedUs = (endTime.tv_sec - beginTime.tv_sec) * 1000000 + @@ -141,17 +139,16 @@ int IntelTNR7US::runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t i return OK; } -int IntelTNR7US::asyncParamUpdate(int gain, bool forceUpdate) { +int IntelC4mTNR::asyncParamUpdate(int gain, bool forceUpdate) { if (mThread->task_runner()) { mThread->task_runner()->PostTask( - FROM_HERE, - base::BindOnce(&IntelTNR7US::handleParamUpdate, - base::Unretained(this), gain, forceUpdate)); + FROM_HERE, base::BindOnce(&IntelC4mTNR::handleParamUpdate, base::Unretained(this), gain, + forceUpdate)); } return OK; } -int32_t IntelTNR7US::getTnrBufferSize(int width, int height, uint32_t* size) { +int32_t IntelC4mTNR::getTnrBufferSize(int width, int height, uint32_t* size) { uint32_t pitch = 0; uint32_t physicalSize = 0; int ret = getSurface2DInfo(uint32_t(width), uint32_t(CM_SURFACE_ALIGN_HEIGHT(height)), @@ -162,15 +159,17 @@ int32_t IntelTNR7US::getTnrBufferSize(int width, int height, uint32_t* size) { return OK; } -void IntelTNR7US::handleParamUpdate(int gain, bool forceUpdate) { +void IntelC4mTNR::handleParamUpdate(int gain, bool forceUpdate) { PERF_CAMERA_ATRACE(); LOG2("@%s gain: %d", __func__, gain); // gain value is from AE expore analog_gain * digital_gain struct timespec beginTime = {}; - if (Log::isLogTagEnabled(ST_GPU_TNR)) clock_gettime(CLOCK_MONOTONIC, &beginTime); + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { + clock_gettime(CLOCK_MONOTONIC, &beginTime); + } tnr7usParamUpdate(gain, forceUpdate, mTnrType); - if (Log::isLogTagEnabled(ST_GPU_TNR)) { + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { struct timespec endTime = {}; clock_gettime(CLOCK_MONOTONIC, &endTime); uint64_t timeUsedUs = (endTime.tv_sec - beginTime.tv_sec) * 1000000 + @@ -179,7 +178,7 @@ void IntelTNR7US::handleParamUpdate(int gain, bool forceUpdate) { } } -CmSurface2DUP* IntelTNR7US::getBufferCMSurface(void* bufAddr) { +CmSurface2DUP* IntelC4mTNR::getBufferCMSurface(void* bufAddr) { if (mCMSurfaceMap.find(bufAddr) != mCMSurfaceMap.end()) { return mCMSurfaceMap[bufAddr]; } @@ -187,7 +186,7 @@ CmSurface2DUP* IntelTNR7US::getBufferCMSurface(void* bufAddr) { return nullptr; } -CmSurface2DUP* IntelTNR7US::createCMSurface(void* bufAddr) { +CmSurface2DUP* IntelC4mTNR::createCMSurface(void* bufAddr) { PERF_CAMERA_ATRACE(); CmSurface2DUP* cmSurface = nullptr; int32_t ret = createCmSurface2DUP(mWidth, mHeight, CM_SURFACE_FORMAT_NV12, bufAddr, cmSurface); @@ -195,8 +194,9 @@ CmSurface2DUP* IntelTNR7US::createCMSurface(void* bufAddr) { return cmSurface; } -int32_t IntelTNR7US::destroyCMSurface(CmSurface2DUP* surface) { +int32_t IntelC4mTNR::destroyCMSurface(CmSurface2DUP* surface) { return destroyCMSurface2DUP(surface); } +#endif } // namespace icamera diff --git a/modules/algowrapper/IntelTNR7US.h b/modules/algowrapper/IntelTNR7US.h index 5ec3d7ca..2db4d59b 100644 --- a/modules/algowrapper/IntelTNR7US.h +++ b/modules/algowrapper/IntelTNR7US.h @@ -29,6 +29,7 @@ extern "C" { #include "PlatformData.h" #include "TNRCommon.h" +#ifdef TNR7_CM /* the cm_rt.h has some build error with current clang build flags * use the ignored setting to ignore these errors, and use * push/pop to make the ignore only take effect on this file */ @@ -53,15 +54,14 @@ extern int32_t destroyCMSurface2DUP(CmSurface2DUP*& surface); extern int tnr7usParamUpdate(int gain, bool forceUpdate = false, int type = 0); extern int32_t getSurface2DInfo(uint32_t width, uint32_t height, CM_SURFACE_FORMAT format, uint32_t& pitch, uint32_t& physicalSize); - +#endif namespace icamera { -// IntelTNR7US object is for using Intel GPU tnr(tnr7ultraslim) feature. class IntelTNR7US { public: static IntelTNR7US* createIntelTNR(int cameraId); - ~IntelTNR7US(); - int init(int width, int height, TnrType type); + virtual ~IntelTNR7US() {} + virtual int init(int width, int height, TnrType type = TNR_INSTANCE0) = 0; /** * call tnr api to calc tnr result * @@ -70,17 +70,57 @@ class IntelTNR7US { * \param tnrParam: tnr parameters from ISP * \param fd: user output buffer file handle */ - int runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, - uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate, int fd = -1); + virtual int runTnrFrame(const void* inBufAddr, void* outBufAddr, uint32_t inBufSize, + uint32_t outBufSize, Tnr7Param* tnrParam, bool syncUpdate, + int fd = -1) = 0; Tnr7Param* allocTnr7ParamBuf(); - void* allocCamBuf(uint32_t bufSize, int id); - void freeAllBufs(); - int prepareSurface(void* bufAddr, int size); - int asyncParamUpdate(int gain, bool forceUpdate); - int getTnrBufferSize(int width, int height, uint32_t* size); + virtual void* allocCamBuf(uint32_t bufSize, int id) = 0; + virtual void freeAllBufs() = 0; + virtual 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: + explicit IntelTNR7US(int cameraId) + : mCameraId(cameraId), + mWidth(0), + mHeight(0), + mTnrType(TNR_INSTANCE_MAX), + mTnrParam(nullptr){}; + + protected: + int mCameraId; + int mWidth; + int mHeight; + TnrType mTnrType; + Tnr7Param* mTnrParam; + + DISALLOW_COPY_AND_ASSIGN(IntelTNR7US); +}; + +#ifdef TNR7_CM +class IntelC4mTNR : public IntelTNR7US { + public: + explicit IntelC4mTNR(int cameraId) : IntelTNR7US(cameraId) {} + virtual ~IntelC4mTNR(); + virtual int init(int width, int height, TnrType type = TNR_INSTANCE0); + /** + * 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, int fd = -1); + virtual void* allocCamBuf(uint32_t bufSize, int id); + virtual void freeAllBufs(); + virtual int prepareSurface(void* bufAddr, int size); + virtual int asyncParamUpdate(int gain, bool forceUpdate); + virtual int getTnrBufferSize(int width, int height, uint32_t* size); private: - explicit IntelTNR7US(int cameraId); /* tnr api use CmSurface2DUP object as data buffer, call this api to create * CmSurface2DUP object from user data buffer */ CmSurface2DUP* createCMSurface(void* bufAddr); @@ -89,17 +129,12 @@ class IntelTNR7US { CmSurface2DUP* getBufferCMSurface(void* bufAddr); /* call tnr7us API to update params */ void handleParamUpdate(int gain, bool forceUpdate); + DISALLOW_COPY_AND_ASSIGN(IntelC4mTNR); private: - int mCameraId; - int mWidth; - int mHeight; - TnrType mTnrType; // Tnr will create CMSurface for input buffers and cache them in the map std::unordered_map mCMSurfaceMap; - Tnr7Param* mTnrParam; std::unique_ptr mThread; - - DISALLOW_COPY_AND_ASSIGN(IntelTNR7US); }; +#endif } // namespace icamera diff --git a/src/3a/AiqCore.cpp b/src/3a/AiqCore.cpp index bc29bb46..7776e593 100644 --- a/src/3a/AiqCore.cpp +++ b/src/3a/AiqCore.cpp @@ -49,6 +49,7 @@ AiqCore::AiqCore(int cameraId) mLensShadingMapMode(LENS_SHADING_MAP_MODE_OFF), mLscGridRGGBLen(0), mLastEvShift(0.0f), + mAiqResults(nullptr), mAeAndAwbConverged(false), mRgbStatsBypassed(false), mAeBypassed(false), @@ -60,6 +61,8 @@ AiqCore::AiqCore(int cameraId) CLEAR(mFrameParams); CLEAR(mLastAeResult); + CLEAR(mLastAfResult); + CLEAR(mLastAwbResult); CLEAR(mGbceParams); CLEAR(mPaParams); @@ -78,7 +81,6 @@ AiqCore::AiqCore(int cameraId) std::fill(std::begin(mLscOffGrid), std::end(mLscOffGrid), 1.0f); mAiqParams = std::unique_ptr(new cca::cca_aiq_params); - mAiqResults = std::unique_ptr(new cca::cca_aiq_results); } AiqCore::~AiqCore() {} @@ -141,6 +143,13 @@ int AiqCore::deinit() { mAiqState = AIQ_NOT_INIT; + if (mAiqResults) { + IntelCca* intelCca = IntelCca::getInstance(mCameraId, mTuningMode); + CheckAndLogError(!intelCca, UNKNOWN_ERROR, "Failed to get intelCca instance"); + + intelCca->freeMem(mAiqResults); + } + return OK; } @@ -255,6 +264,16 @@ int AiqCore::updateParameter(const aiq_parameter_t& param) { mRgbStatsBypassed = true; } + if (!mAiqResults) { + IntelCca* intelCca = IntelCca::getInstance(mCameraId, mTuningMode); + CheckAndLogError(!intelCca, UNKNOWN_ERROR, "Failed to get intelCca instance"); + + mAiqResults = + static_cast(intelCca->allocMem(0, "aiqResults", 0, + sizeof(cca::cca_aiq_results))); + CheckAndLogError(!mAiqResults, NO_MEMORY, "allocMem failed"); + } + return OK; } @@ -374,7 +393,7 @@ int AiqCore::runAiq(long requestId, AiqResult* aiqResult) { { PERF_CAMERA_ATRACE_PARAM1_IMAGING("intelAiq->runAIQ", 1); - ia_err iaErr = intelCca->runAIQ(requestId, *mAiqParams.get(), mAiqResults.get(), + ia_err iaErr = intelCca->runAIQ(requestId, *mAiqParams.get(), mAiqResults, aiqResult->mAiqParam.makernoteMode); mAiqRunTime++; ret = AiqUtils::convertError(iaErr); @@ -383,6 +402,7 @@ int AiqCore::runAiq(long requestId, AiqResult* aiqResult) { // handle awb result if (aaaRunType & IMAGING_ALGO_AWB) { + mLastAwbResult = mAiqResults->awb_output; cca::cca_awb_results* newAwbResults = &mAiqResults->awb_output; if (!PlatformData::isIsysEnabled(mCameraId)) { @@ -399,6 +419,7 @@ int AiqCore::runAiq(long requestId, AiqResult* aiqResult) { // handle af result if (aaaRunType & IMAGING_ALGO_AF) { + mLastAfResult = mAiqResults->af_output; focusDistanceResult(&mAiqResults->af_output, &aiqResult->mAfDistanceDiopters, &aiqResult->mFocusRange); aiqResult->mAfResults = mAiqResults->af_output; @@ -425,6 +446,7 @@ int AiqCore::runAiq(long requestId, AiqResult* aiqResult) { if (aaaRunType & IMAGING_ALGO_SA) { AiqUtils::dumpSaResults(mAiqResults->sa_output); ret |= processSAResults(&mAiqResults->sa_output, aiqResult->mLensShadingMap); + aiqResult->mLscUpdate = mAiqResults->sa_output.lsc_update; } CheckAndLogError(ret != OK, ret, "run3A failed, ret: %d", ret); @@ -439,7 +461,7 @@ int AiqCore::runAiq(long requestId, AiqResult* aiqResult) { if (PlatformData::isStatsRunningRateSupport(mCameraId)) { bool bothConverged = (mLastAeResult.exposures[0].converged && - mAiqResults->awb_output.distance_from_convergence < EPSILON); + mLastAwbResult.distance_from_convergence < EPSILON); if (!mAeAndAwbConverged && bothConverged) { mAeRunRateInfo.reset(); mAwbRunRateInfo.reset(); @@ -705,8 +727,8 @@ bool AiqCore::bypassAf(const aiq_parameter_t& param) { if (param.afMode == AF_MODE_OFF || param.powerMode != CAMERA_LOW_POWER) return false; - bool converged = mAiqResults->af_output.status == ia_aiq_af_status_success && - mAiqResults->af_output.final_lens_position_reached; + bool converged = mLastAfResult.status == ia_aiq_af_status_success && + mLastAfResult.final_lens_position_reached; return skipAlgoRunning(&mAfRunRateInfo, IMAGING_ALGO_AF, converged); } @@ -718,7 +740,7 @@ bool AiqCore::bypassAwb(const aiq_parameter_t& param) { if (param.awbMode != AWB_MODE_AUTO || param.powerMode != CAMERA_LOW_POWER) return false; - bool converged = mAiqResults->awb_output.distance_from_convergence < EPSILON; + bool converged = mLastAwbResult.distance_from_convergence < EPSILON; return skipAlgoRunning(&mAwbRunRateInfo, IMAGING_ALGO_AWB, converged); } diff --git a/src/3a/AiqCore.h b/src/3a/AiqCore.h index 63b05a44..5f788a71 100644 --- a/src/3a/AiqCore.h +++ b/src/3a/AiqCore.h @@ -200,9 +200,11 @@ class AiqCore { float mLastEvShift; cca::cca_ae_results mLastAeResult; + cca::cca_af_results mLastAfResult; + cca::cca_awb_results mLastAwbResult; std::unique_ptr mAiqParams; - std::unique_ptr mAiqResults; + cca::cca_aiq_results* mAiqResults; bool mAeAndAwbConverged; bool mRgbStatsBypassed; diff --git a/src/3a/AiqEngine.cpp b/src/3a/AiqEngine.cpp index ecdc812b..08fdf042 100644 --- a/src/3a/AiqEngine.cpp +++ b/src/3a/AiqEngine.cpp @@ -334,7 +334,8 @@ AiqEngine::AiqState AiqEngine::prepareInputParam(AiqStatistics* aiqStats, AiqRes // update lens related parameters mLensManager->getLensInfo(aiqResult->mAiqParam); - mAiqCore->updateParameter(aiqResult->mAiqParam); + ret = mAiqCore->updateParameter(aiqResult->mAiqParam); + if (ret != OK) return AIQ_STATE_ERROR; if (aiqStats == nullptr) { LOG2("%s: run aiq without stats data", __func__); diff --git a/src/3a/AiqResult.cpp b/src/3a/AiqResult.cpp index 48a56bbe..01c0b122 100644 --- a/src/3a/AiqResult.cpp +++ b/src/3a/AiqResult.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-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. @@ -33,6 +33,7 @@ AiqResult::AiqResult(int cameraId) mSkip(false), mLensPosition(0), mSceneMode(SCENE_MODE_AUTO), + mLscUpdate(false), mFrameDuration(0), mRollingShutter(0) { CLEAR(mCustomControls); @@ -57,7 +58,7 @@ int AiqResult::init() { CLEAR(mAwbResults); CLEAR(mPaResults); CLEAR(mOutStats); - mOutStats.rgbs_grid.blocks_ptr = mOutStats.rgbs_blocks; + mOutStats.rgbs_grid[0].blocks_ptr = mOutStats.rgbs_blocks[0]; mAiqParam.reset(); @@ -74,37 +75,4 @@ int AiqResult::deinit() { return OK; } -AiqResult& AiqResult::operator=(const AiqResult& other) { - mCameraId = other.mCameraId; - mSequence = other.mSequence; - mFrameId = other.mFrameId; - mTimestamp = other.mTimestamp; - mTuningMode = other.mTuningMode; - mAfDistanceDiopters = other.mAfDistanceDiopters; - mSkip = other.mSkip; - mLensPosition = other.mLensPosition; - mSceneMode = other.mSceneMode; - mFocusRange = other.mFocusRange; - - mAeResults = other.mAeResults; - mAwbResults = other.mAwbResults; - mAfResults = other.mAfResults; - mGbceResults = other.mGbceResults; - mPaResults = other.mPaResults; - mOutStats = other.mOutStats; - mOutStats.rgbs_grid.blocks_ptr = mOutStats.rgbs_blocks; - - mCustomControls.count = other.mCustomControls.count; - for (int i = 0; i < mCustomControls.count; i++) { - mCustomControlsParams[i] = other.mCustomControlsParams[i]; - } - MEMCPY_S(mLensShadingMap, sizeof(mLensShadingMap), other.mLensShadingMap, - sizeof(other.mLensShadingMap)); - - mAiqParam = other.mAiqParam; - mFrameDuration = other.mFrameDuration; - mRollingShutter = other.mRollingShutter; - - return *this; -} } /* namespace icamera */ diff --git a/src/3a/AiqResult.h b/src/3a/AiqResult.h index 3fb75d9f..61068153 100644 --- a/src/3a/AiqResult.h +++ b/src/3a/AiqResult.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-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. @@ -41,8 +41,6 @@ class AiqResult { int init(); int deinit(); - AiqResult& operator=(const AiqResult& other); - public: int mCameraId; unsigned long long mTimestamp; @@ -61,6 +59,7 @@ class AiqResult { cca::cca_gbce_params mGbceResults; cca::cca_pa_params mPaResults; cca::cca_out_stats mOutStats; + bool mLscUpdate; ia_isp_custom_controls mCustomControls; diff --git a/src/3a/AiqUnit.cpp b/src/3a/AiqUnit.cpp index 175add6f..ce2e2808 100644 --- a/src/3a/AiqUnit.cpp +++ b/src/3a/AiqUnit.cpp @@ -234,7 +234,7 @@ int AiqUnit::initIntelCcaHandle(const std::vector& configModes) { bool hasLtm = PlatformData::isLtmEnabled(mCameraId); // HDR_FEATURE_S if (PlatformData::isEnableHDR(mCameraId) && - !CameraUtils::isMultiExposureCase(mCameraId, tuningMode)) { + !PlatformData::isMultiExposureCase(mCameraId, tuningMode)) { hasLtm = false; } // HDR_FEATURE_E diff --git a/src/3a/SensorManager.cpp b/src/3a/SensorManager.cpp index be82ee6f..99d89565 100644 --- a/src/3a/SensorManager.cpp +++ b/src/3a/SensorManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-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. @@ -195,8 +195,8 @@ int SensorManager::getCurrentExposureAppliedDelay() { uint32_t SensorManager::updateSensorExposure(SensorExpGroup sensorExposures, int64_t applyingSeq) { AutoMutex l(mLock); - int64_t effectSeq = - mLastSofSequence < 0 ? 0 : mLastSofSequence + PlatformData::getExposureLag(mCameraId); + int64_t effectSeq = mLastSofSequence < 0 ? PlatformData::getInitialSkipFrame(mCameraId) + : mLastSofSequence + PlatformData::getExposureLag(mCameraId); if (sensorExposures.empty()) { LOGW("%s: No exposure parameter", __func__); diff --git a/src/3a/intel3a/Intel3AParameter.cpp b/src/3a/intel3a/Intel3AParameter.cpp index e370b554..87b97bf8 100644 --- a/src/3a/intel3a/Intel3AParameter.cpp +++ b/src/3a/intel3a/Intel3AParameter.cpp @@ -325,7 +325,7 @@ void Intel3AParameter::updateAeParameter(const aiq_parameter_t& param) { mAeMode = param.aeMode; mAeParams.frame_use = AiqUtils::convertFrameUsageToIaFrameUsage(param.frameUsage); mAeParams.num_exposures = PlatformData::getExposureNum( - mCameraId, CameraUtils::isMultiExposureCase(mCameraId, param.tuningMode)); + mCameraId, PlatformData::isMultiExposureCase(mCameraId, param.tuningMode)); setAeManualLimits(param); @@ -379,7 +379,7 @@ void Intel3AParameter::updateAeParameter(const aiq_parameter_t& param) { mAeParams.manual_convergence_time = AiqUtils::convertSpeedModeToTime(param.aeConvergeSpeed); // HDR_FEATURE_S - if (CameraUtils::isMultiExposureCase(mCameraId, param.tuningMode)) { + if (PlatformData::isMultiExposureCase(mCameraId, param.tuningMode)) { mAeParams.manual_convergence_time = AiqUtils::convertSpeedModeToTimeForHDR(param.aeConvergeSpeed); } diff --git a/src/core/CameraDevice.cpp b/src/core/CameraDevice.cpp index 96cc31db..4ed6bd0a 100644 --- a/src/core/CameraDevice.cpp +++ b/src/core/CameraDevice.cpp @@ -79,6 +79,15 @@ CameraDevice::CameraDevice(int cameraId) } else { mGCM = nullptr; } + + const char *CAMERA_HAL_DQBUF_TIMEDOUT = "cameraDqbufTimedout"; + char *dqbufTimedoutStr = getenv(CAMERA_HAL_DQBUF_TIMEDOUT); + if (dqbufTimedoutStr == nullptr) + mDqbufTimedout = false; + else if (strncmp(dqbufTimedoutStr, "true", 4) || strncmp(dqbufTimedoutStr, "TRUE", 4)) + mDqbufTimedout = true; + else + mDqbufTimedout = false; } CameraDevice::~CameraDevice() { @@ -182,6 +191,7 @@ void CameraDevice::deinit() { void CameraDevice::callbackRegister(const camera_callback_ops_t* callback) { mCallback = const_cast(callback); + mParamGenerator->callbackRegister(mCallback); } StreamSource* CameraDevice::createBufferProducer() { @@ -784,7 +794,14 @@ int CameraDevice::dqbuf(int streamId, camera_buffer_t** ubuffer, Parameters* set LOG2("@%s, stream id:%d", mCameraId, __func__, streamId); int ret = mRequestThread->waitFrame(streamId, ubuffer); - while (ret == TIMED_OUT) ret = mRequestThread->waitFrame(streamId, ubuffer); + + if (mDqbufTimedout) { + if (ret == TIMED_OUT) + return ret; + } else { + while (ret == TIMED_OUT) + ret = mRequestThread->waitFrame(streamId, ubuffer); + } if (ret == NO_INIT) return ret; diff --git a/src/core/CameraStream.cpp b/src/core/CameraStream.cpp index 7407193a..b614047a 100644 --- a/src/core/CameraStream.cpp +++ b/src/core/CameraStream.cpp @@ -148,6 +148,11 @@ int CameraStream::onFrameAvailable(Port port, const shared_ptr& ca LOG2("@%s: mStreamId:%d, CameraBuffer:%p for port:%d", mCameraId, __func__, mStreamId, camBuffer.get(), port); + std::shared_ptr buf = camBuffer; + return doFrameAvailable(port, buf); +} + +int CameraStream::doFrameAvailable(Port port, const shared_ptr& camBuffer) { // Update the user buffer info before return back camBuffer->updateUserBuffer(); @@ -175,5 +180,4 @@ int CameraStream::onFrameAvailable(Port port, const shared_ptr& ca return OK; } - } // namespace icamera diff --git a/src/core/CameraStream.h b/src/core/CameraStream.h index d13dd212..aeb3b257 100644 --- a/src/core/CameraStream.h +++ b/src/core/CameraStream.h @@ -80,10 +80,15 @@ class CameraStream : public BufferConsumer, public EventSource { virtual void setBufferProducer(BufferProducer* producer); /** - * \brief The notify when polled or processed one frame buffer + * \brief receive one frame buffer as consumer */ virtual int onFrameAvailable(Port port, const std::shared_ptr& camBuffer); + /** + * \brief notify EVENT_FRAME_AVAILABLE event to its listener + */ + virtual int doFrameAvailable(Port port, const std::shared_ptr& camBuffer); + private: int mCameraId; int mStreamId; diff --git a/src/core/CsiMetaDevice.h b/src/core/CsiMetaDevice.h index dfaafb89..2ceb9bc9 100644 --- a/src/core/CsiMetaDevice.h +++ b/src/core/CsiMetaDevice.h @@ -126,6 +126,7 @@ class CsiMetaDevice : public EventSource { private: DISALLOW_COPY_AND_ASSIGN(CsiMetaDevice); + bool mDqbufTimedout; }; } /* namespace icamera */ diff --git a/src/core/IspParamAdaptor.cpp b/src/core/IspParamAdaptor.cpp index e68b8254..8fffdf47 100644 --- a/src/core/IspParamAdaptor.cpp +++ b/src/core/IspParamAdaptor.cpp @@ -47,6 +47,7 @@ IspParamAdaptor::IspParamAdaptor(int cameraId) mCameraId(cameraId), mTuningMode(TUNING_MODE_VIDEO), mIpuOutputFormat(V4L2_PIX_FMT_NV12), + mLastLscSequece(-1), mGraphConfig(nullptr), mIntelCca(nullptr), mGammaTmOffset(-1) { @@ -213,6 +214,7 @@ int IspParamAdaptor::configure(const stream_t& stream, ConfigMode configMode, Tu LOG2("%s, configMode: %x, PSys output format 0x%x", __func__, configMode, mIpuOutputFormat); mTuningMode = tuningMode; CLEAR(mLastPalDataForVideoPipe); + mLastLscSequece = -1; for (uint32_t i = 0; i < mPalRecords.size(); i++) { mPalRecords[i].offset = -1; } @@ -408,7 +410,8 @@ void IspParamAdaptor::updateKernelToggles(cca::cca_program_group* programGroup) * but currently a ring buffer is used in HAL, which caused logic mismatching issue. * So temporarily copy latest PAL data into PAL output buffer. */ -void IspParamAdaptor::updatePalDataForVideoPipe(ia_binary_data dest) { +void IspParamAdaptor::updatePalDataForVideoPipe(ia_binary_data dest, int64_t bufSeq, + int64_t settingSeq) { if (mLastPalDataForVideoPipe.data == nullptr || mLastPalDataForVideoPipe.size == 0) return; if (mPalRecords.empty()) return; @@ -444,6 +447,16 @@ void IspParamAdaptor::updatePalDataForVideoPipe(ia_binary_data dest) { headerSrc = header; } + if (ia_pal_uuid_isp_lsc_1_1 == header->uuid) { + if (isLscCopy(bufSeq, settingSeq)) { + LOG2("settingSeq %ld, copy LSC for buf %ld", settingSeq, bufSeq); + updateLscSeqMap(bufSeq); + } else { + LOG2("settingSeq %ld, not copy LSC for buf %ld", settingSeq, bufSeq); + continue; + } + } + if (!headerSrc) { LOGW("Failed to find PAL recorder header %d", mPalRecords[i].uuid); continue; @@ -472,6 +485,34 @@ void IspParamAdaptor::updateIspParameterMap(IspParameter* ispParam, int64_t data ispParam->mSequenceToDataId[settingSeq] = dataSeq; } +bool IspParamAdaptor::isLscCopy(int64_t bufSeq, int64_t settingSeq) { + AiqResult* aiqResults = const_cast( + AiqResultStorage::getInstance(mCameraId)->getAiqResult(settingSeq)); + if (aiqResults == nullptr) return true; + + if (aiqResults->mLscUpdate) { + mLastLscSequece = settingSeq; + LOG2("%s, LSC update %ld", __func__, settingSeq); + return false; + } else { + if (mSeqIdToLscSeqIdMap.find(bufSeq) != mSeqIdToLscSeqIdMap.end()) { + if (mLastLscSequece >= 0 && mSeqIdToLscSeqIdMap[bufSeq] == mLastLscSequece) { + return false; + } + } + } + + return true; +} + +void IspParamAdaptor::updateLscSeqMap(int64_t settingSeq) { + mSeqIdToLscSeqIdMap[settingSeq] = mLastLscSequece; + + if (mSeqIdToLscSeqIdMap.size() > ISP_PARAM_QUEUE_SIZE) { + mSeqIdToLscSeqIdMap.erase(mSeqIdToLscSeqIdMap.begin()); + } +} + /** * runIspAdapt * Convert the results of the 3A algorithms and parse with P2P. @@ -517,7 +558,7 @@ int IspParamAdaptor::runIspAdapt(const IspSettings* ispSettings, int64_t setting // Update some PAL data to latest PAL result if (it.first == VIDEO_STREAM_ID) { - updatePalDataForVideoPipe(binaryData); + updatePalDataForVideoPipe(binaryData, dataIt->first, settingSequence); } ia_isp_bxt_program_group* pgPtr = mGraphConfig->getProgramGroup(it.first); @@ -544,6 +585,7 @@ int IspParamAdaptor::runIspAdapt(const IspSettings* ispSettings, int64_t setting if (it.first == VIDEO_STREAM_ID) { mLastPalDataForVideoPipe = binaryData; updateResultFromAlgo(&binaryData, settingSequence); + updateLscSeqMap(settingSequence); } } } @@ -857,7 +899,7 @@ int IspParamAdaptor::runIspAdaptL(ia_isp_bxt_program_group* pgPtr, ia_isp_bxt_gd } LOG2("%s: set digital gain for ULL pipe: %f", __func__, inputParams->manual_digital_gain); - } else if (CameraUtils::isMultiExposureCase(mCameraId, mTuningMode) && + } else if (PlatformData::isMultiExposureCase(mCameraId, mTuningMode) && PlatformData::getSensorGainType(mCameraId) == ISP_DG_AND_SENSOR_DIRECT_AG) { inputParams->manual_digital_gain = aiqResults->mAeResults.exposures[0].exposure[0].digital_gain; diff --git a/src/core/IspParamAdaptor.h b/src/core/IspParamAdaptor.h index f16432fb..8de572e7 100644 --- a/src/core/IspParamAdaptor.h +++ b/src/core/IspParamAdaptor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2022 Intel Corporation. + * Copyright (C) 2015-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. @@ -92,7 +92,7 @@ class IspParamAdaptor { int initProgramGroupForAllStreams(ConfigMode configMode); void initInputParams(cca::cca_pal_input_params* params); - void updatePalDataForVideoPipe(ia_binary_data dest); + void updatePalDataForVideoPipe(ia_binary_data dest, int64_t bufSeq, int64_t settingSeq); struct IspParameter { /* @@ -130,6 +130,9 @@ class IspParamAdaptor { void updateResultFromAlgo(ia_binary_data* binaryData, int64_t sequence); uint32_t getRequestedStats(); + bool isLscCopy(int64_t bufSeq, int64_t settingSeq); + void updateLscSeqMap(int64_t settingSeq); + private: enum IspAdaptorState { ISP_ADAPTOR_NOT_INIT, @@ -148,6 +151,10 @@ class IspParamAdaptor { static const int ISP_PARAM_QUEUE_SIZE = MAX_SETTING_COUNT; std::map mStreamIdToIspParameterMap; // map from stream id to IspParameter ia_binary_data mLastPalDataForVideoPipe; + + int64_t mLastLscSequece; + std::map mSeqIdToLscSeqIdMap; + // Guard lock for ipu parameter Mutex mIpuParamLock; std::unordered_map mStreamIdToPalInputParamsMap; diff --git a/src/core/PSysProcessor.cpp b/src/core/PSysProcessor.cpp index 9c6d5eef..cea246cc 100644 --- a/src/core/PSysProcessor.cpp +++ b/src/core/PSysProcessor.cpp @@ -89,9 +89,14 @@ PSysProcessor::~PSysProcessor() { mProcessThread->join(); delete mProcessThread; - // Delete PSysDAG before Scheduler because ~PSysDAG() needs Scheduler + /* PipeExecutor is shared between Scheduler and PSysDAG, so need to delete Scheduler + * before delete PipeExecutor in PSysDAG. + */ + if (mScheduler) { + mPSysDAGs[mCurConfigMode]->unregisterNode(); + delete mScheduler; + } mPSysDAGs.clear(); - if (mScheduler) delete mScheduler; } int PSysProcessor::configure(const std::vector& configModes) { diff --git a/src/core/RequestThread.cpp b/src/core/RequestThread.cpp index 0a52ac49..4a2da72a 100644 --- a/src/core/RequestThread.cpp +++ b/src/core/RequestThread.cpp @@ -50,6 +50,20 @@ RequestThread::RequestThread(int cameraId, AiqUnitBase* a3AControl, ParameterGen // FILE_SOURCE_S mSofEnabled = mSofEnabled || PlatformData::isFileSourceEnabled(); // FILE_SOURCE_E + + const char *CAMERA_HAL_WAIT_FRAME_DURATION = "cameraFrameDuration"; + char *frameDurationStr = getenv(CAMERA_HAL_WAIT_FRAME_DURATION); + mWaitFrameDurationOverride = 0; + + if (frameDurationStr) { + mWaitFrameDurationOverride = atoi(frameDurationStr); // ms + } + + if (mWaitFrameDurationOverride > 0) { + LOGW("Frame duration is overriden to %d ms", mWaitFrameDurationOverride); + } else { + mWaitFrameDurationOverride = 0; // override is disabled + } } RequestThread::~RequestThread() {} @@ -194,7 +208,8 @@ int RequestThread::waitFrame(int streamId, camera_buffer_t** ubuffer) { if (!mActive) return NO_INIT; while (frameQueue.mFrameQueue.empty()) { int ret = frameQueue.mFrameAvailableSignal.waitRelative( - lock, kWaitFrameDuration * SLOWLY_MULTIPLIER); + lock, + mWaitFrameDurationOverride ? mWaitFrameDurationOverride * 1000000 : kWaitFrameDuration * SLOWLY_MULTIPLIER); if (!mActive) return NO_INIT; CheckWarning(ret == TIMED_OUT, ret, "@%s, time out happens, wait recovery", mCameraId, diff --git a/src/core/RequestThread.h b/src/core/RequestThread.h index a3c87c59..95f7ec1a 100644 --- a/src/core/RequestThread.h +++ b/src/core/RequestThread.h @@ -135,6 +135,7 @@ class RequestThread : public Thread, public EventSource, public EventListener { bool mBlockRequest; // Process the 2nd or 3th request after the 1st 3A event // to avoid unstable AWB at the beginning of stream on bool mSofEnabled; + int mWaitFrameDurationOverride; }; } // namespace icamera diff --git a/src/core/SofSource.cpp b/src/core/SofSource.cpp index ec8d89d2..823e8142 100644 --- a/src/core/SofSource.cpp +++ b/src/core/SofSource.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2022 Intel Corporation. + * Copyright (C) 2015-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. @@ -17,8 +17,12 @@ #include "SofSource.h" +#include #include +// VIRTUAL_CHANNEL_S +#include "linux/ipu-isys.h" +// VIRTUAL_CHANNEL_E #include "PlatformData.h" #include "V4l2DeviceFactory.h" #include "iutils/CameraLog.h" @@ -29,6 +33,10 @@ namespace icamera { SofSource::SofSource(int cameraId) : mPollThread(nullptr), mCameraId(cameraId), + // VIRTUAL_CHANNEL_S + mAggregatorSubDev(nullptr), + mFrameSyncId(-1), + // VIRTUAL_CHANNEL_E mIsysReceiverSubDev(nullptr), mExitPending(false) { LOG1("%s: SofSource is constructed", __func__); @@ -87,9 +95,29 @@ int SofSource::initDev() { The value of SOF event id is 0, 1, 2, ... (sequence -1) when virtual channel supported. */ int sequence = PlatformData::getVirtualChannelSequence(mCameraId); if (sequence > 0) { - id = sequence - 1; + mFrameSyncId = sequence - 1; } + + struct VcAggregator aggregator; + if (PlatformData::getVcAggregator(mCameraId, aggregator) == OK) { + std::string devName; + CameraUtils::getDeviceName(aggregator.mName.c_str(), devName, true); + if (!devName.empty()) { + LOG1("%s, found aggregator subdevice %s", __func__, devName); + mAggregatorSubDev = V4l2DeviceFactory::getSubDev(mCameraId, devName); + + struct v4l2_querymenu qm = {.id = V4L2_CID_IPU_QUERY_SUB_STREAM, }; + qm.index = aggregator.mIndex; + int ret = mAggregatorSubDev->QueryMenu(&qm); + if (ret == 0) { + #define SUB_STREAM_VC_ID(value) ((value) >> 56 & 0xFF) + mFrameSyncId = SUB_STREAM_VC_ID(qm.value); + } + } + } + if (mFrameSyncId >= 0) id = mFrameSyncId; // VIRTUAL_CHANNEL_E + int status = mIsysReceiverSubDev->SubscribeEvent(V4L2_EVENT_FRAME_SYNC, id); CheckAndLogError(status != OK, status, "Failed to subscribe sync event %d", id); LOG1("%s: Using SOF event id %d for sync", __func__, id); @@ -112,12 +140,7 @@ int SofSource::deinitDev() { #else int id = 0; // VIRTUAL_CHANNEL_S - /* The value of virtual channel sequence is 1, 2, 3, ... if virtual channel supported. - The value of SOF event id is 0, 1, 2, ... (sequence -1) when virtual channel supported. */ - int sequence = PlatformData::getVirtualChannelSequence(mCameraId); - if (sequence > 0) { - id = sequence - 1; - } + if (mFrameSyncId >= 0) id = mFrameSyncId; // VIRTUAL_CHANNEL_E status = mIsysReceiverSubDev->UnsubscribeEvent(V4L2_EVENT_FRAME_SYNC, id); if (status == OK) { diff --git a/src/core/SofSource.h b/src/core/SofSource.h index 262166a6..737b2905 100644 --- a/src/core/SofSource.h +++ b/src/core/SofSource.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-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. @@ -57,6 +57,11 @@ class SofSource : public EventSource { }; PollThread* mPollThread; int mCameraId; + // VIRTUAL_CHANNEL_S + V4L2Subdevice* mAggregatorSubDev; + int mFrameSyncId; + // VIRTUAL_CHANNEL_E + V4L2Subdevice* mIsysReceiverSubDev; bool mExitPending; bool mSofDisabled; diff --git a/src/core/psysprocessor/GPUExecutor.cpp b/src/core/psysprocessor/GPUExecutor.cpp index edab61e1..9f595856 100644 --- a/src/core/psysprocessor/GPUExecutor.cpp +++ b/src/core/psysprocessor/GPUExecutor.cpp @@ -124,11 +124,13 @@ int GPUExecutor::start() { const FrameInfo& frameInfo = mTerminalsDesc[term].frameDesc; mIntelTNR = std::unique_ptr(IntelTNR7US::createIntelTNR(mCameraId)); TnrType type = mStreamId == VIDEO_STREAM_ID ? TNR_INSTANCE0 : TNR_INSTANCE1; - ret = mIntelTNR->init(frameInfo.mWidth, frameInfo.mHeight, type); - if (ret) { - mIntelTNR = nullptr; - // when failed to init tnr, executor will run without tnr effect - LOGW("Executor:%s init tnr failed", mName.c_str()); + if (mIntelTNR) { + ret = mIntelTNR->init(frameInfo.mWidth, frameInfo.mHeight, type); + if (ret) { + mIntelTNR = nullptr; + // when failed to init tnr, executor will run without tnr effect + LOGW("Executor:%s init tnr failed", mName.c_str()); + } } } AutoMutex l(mBufferQueueLock); @@ -272,10 +274,13 @@ int GPUExecutor::getTotalGain(int64_t seq, float* totalGain) { bool GPUExecutor::isBypassStillTnr(int64_t seq) { if (mStreamId != STILL_TNR_STREAM_ID) return true; +#ifndef IPU_SYSVER_ipu6v5 float totalGain = 0.0f; int ret = getTotalGain(seq, &totalGain); CheckAndLogError(ret, true, "Failed to get total gain"); if (totalGain <= mStillTnrTriggerInfo.tnr7us_threshold_gain) return true; +#endif + return false; } @@ -441,15 +446,14 @@ int GPUExecutor::updateTnrISPConfig(Tnr7Param* pbuffer, uint32_t sequence) { ret |= PalOutput.getKernelPublicOutput(ia_pal_uuid_isp_tnr7_ims_1_1, (void*&)pIms); CheckAndLogError(ret != ia_err_none, UNKNOWN_ERROR, "Can't read isp tnr7 parameters"); -#ifdef TNR7_CM tnrBCParam* tnr7_bc = &(pbuffer->bc); tnrBlendParam* tnr7_blend = &(pbuffer->blend); tnrImsParam* tnr7_ims = &(pbuffer->ims); + + // common params for both c4m tnr and level0 tnr // tnr7 ims params - tnr7_ims->enable = pIms->enable; tnr7_ims->update_limit = pIms->update_limit; tnr7_ims->update_coeff = pIms->update_coeff; - tnr7_ims->gpu_mode = pIms->gpu_mode; for (int i = 0; i < sizeof(pIms->d_ml) / sizeof(int32_t); i++) { tnr7_ims->d_ml[i] = pIms->d_ml[i]; tnr7_ims->d_slopes[i] = pIms->d_slopes[i]; @@ -463,21 +467,17 @@ int GPUExecutor::updateTnrISPConfig(Tnr7Param* pbuffer, uint32_t sequence) { tnr7_ims->r_coeff = pIms->r_coeff; // tnr7 bc params - tnr7_bc->enable = pBc->enable; tnr7_bc->is_first_frame = pBc->is_first_frame; tnr7_bc->do_update = pBc->do_update; - tnr7_bc->gpu_mode = pBc->gpu_mode; tnr7_bc->tune_sensitivity = pBc->tune_sensitivity; for (int i = 0; i < sizeof(pBc->coeffs) / sizeof(int32_t); i++) { tnr7_bc->coeffs[i] = pBc->coeffs[i]; } - if (!icamera::PlatformData::useTnrGlobalProtection()) { tnr7_bc->global_protection = 0; } else { tnr7_bc->global_protection = pBc->global_protection; tnr7_bc->global_protection_inv_num_pixels = pBc->global_protection_inv_num_pixels; - tnr7_bc->global_protection_motion_level = pBc->global_protection_motion_level; } for (int i = 0; i < sizeof(pBc->global_protection_sensitivity_lut_values) / sizeof(int32_t); i++) { @@ -489,14 +489,24 @@ int GPUExecutor::updateTnrISPConfig(Tnr7Param* pbuffer, uint32_t sequence) { tnr7_bc->global_protection_sensitivity_lut_slopes[i] = pBc->global_protection_sensitivity_lut_slopes[i]; } + tnr7_blend->max_recursive_similarity = pBlend->max_recursive_similarity; - // tnr7 blend params +#ifdef TNR7_CM + tnr7_ims->enable = pIms->enable; + tnr7_ims->gpu_mode = pIms->gpu_mode; + + tnr7_bc->enable = pBc->enable; + tnr7_bc->gpu_mode = pBc->gpu_mode; + + if (icamera::PlatformData::useTnrGlobalProtection()) { + tnr7_bc->global_protection_motion_level = pBc->global_protection_motion_level; + } + // c4m tnr7 blend params tnr7_blend->enable = pBlend->enable; tnr7_blend->enable_main_output = pBlend->enable_main_output; tnr7_blend->enable_vision_output = pBlend->enable_vision_output; tnr7_blend->single_output_mode = pBlend->single_output_mode; tnr7_blend->spatial_weight_coeff = pBlend->spatial_weight_coeff; - tnr7_blend->max_recursive_similarity = pBlend->max_recursive_similarity; tnr7_blend->spatial_alpha = pBlend->spatial_alpha; tnr7_blend->max_recursive_similarity_vsn = pBlend->max_recursive_similarity_vsn; for (int i = 0; i < sizeof(pBlend->w_out_prev_LUT) / sizeof(int32_t); i++) { @@ -532,10 +542,12 @@ int GPUExecutor::runTnrFrame(const std::shared_ptr& inBuf, struct timespec beginTime = {}; if (mIntelTNR) { - if (Log::isLogTagEnabled(ST_GPU_TNR)) clock_gettime(CLOCK_MONOTONIC, &beginTime); + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { + clock_gettime(CLOCK_MONOTONIC, &beginTime); + } ret = updateTnrISPConfig(mTnr7usParam, sequence); - if (Log::isLogTagEnabled(ST_GPU_TNR)) { + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { struct timespec endTime = {}; clock_gettime(CLOCK_MONOTONIC, &endTime); uint64_t timeUsedUs = (endTime.tv_sec - beginTime.tv_sec) * 1000000 + @@ -554,6 +566,11 @@ int GPUExecutor::runTnrFrame(const std::shared_ptr& inBuf, bool paramSyncUpdate = (mStreamId == VIDEO_STREAM_ID) ? false : true; + // LEVEL0_ICBM_S + // no async param update in level0 tnr + paramSyncUpdate = true; + // LEVEL0_ICBM_E + if (!paramSyncUpdate && mIntelTNR) { // request update tnr parameters before wait float totalGain = 0.0f; @@ -612,7 +629,9 @@ int GPUExecutor::runTnrFrame(const std::shared_ptr& inBuf, dstFd = -1; } - if (Log::isLogTagEnabled(ST_GPU_TNR)) clock_gettime(CLOCK_MONOTONIC, &beginTime); + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { + clock_gettime(CLOCK_MONOTONIC, &beginTime); + } ret = mIntelTNR->runTnrFrame(inBuf->getBufferAddr(), dstBuf, inBuf->getBufferSize(), dstSize, mTnr7usParam, paramSyncUpdate, dstFd); if (ret == OK) { @@ -623,7 +642,7 @@ int GPUExecutor::runTnrFrame(const std::shared_ptr& inBuf, LOG2("Just copy source buffer if run TNR failed"); MEMCPY_S(outPtr, bufferSize, inBuf->getBufferAddr(), inBuf->getBufferSize()); } - if (Log::isLogTagEnabled(ST_GPU_TNR)) { + if (Log::isLogTagEnabled(ST_GPU_TNR, CAMERA_DEBUG_LOG_LEVEL2)) { struct timespec endTime; clock_gettime(CLOCK_MONOTONIC, &endTime); uint64_t timeUsedUs = (endTime.tv_sec - beginTime.tv_sec) * 1000000 + diff --git a/src/core/psysprocessor/GPUExecutor.h b/src/core/psysprocessor/GPUExecutor.h index 458e7ece..211e0f6d 100644 --- a/src/core/psysprocessor/GPUExecutor.h +++ b/src/core/psysprocessor/GPUExecutor.h @@ -25,7 +25,7 @@ #include "PipeLiteExecutor.h" #ifdef ENABLE_SANDBOXING #include "modules/sandboxing/client/IntelTNR7USClient.h" -#elif defined(TNR7_CM) +#else #include "modules/algowrapper/IntelTNR7US.h" #endif diff --git a/src/core/psysprocessor/PSysDAG.cpp b/src/core/psysprocessor/PSysDAG.cpp index 6476465e..d3effb00 100644 --- a/src/core/psysprocessor/PSysDAG.cpp +++ b/src/core/psysprocessor/PSysDAG.cpp @@ -72,10 +72,16 @@ void PSysDAG::setFrameInfo(const std::map& inputInfo, } } } +void PSysDAG::unregisterNode() { + if (!mScheduler) return; + + for (auto& executor : mExecutorsPool) { + mScheduler->unregisterNode(executor); + } +} void PSysDAG::releasePipeExecutors() { for (auto& executor : mExecutorsPool) { - if (mScheduler) mScheduler->unregisterNode(executor); delete executor; } mExecutorsPool.clear(); @@ -839,7 +845,7 @@ void PSysDAG::tuningReconfig(TuningMode newTuningMode) { } void PSysDAG::dumpExternalPortMap() { - if (!Log::isLogTagEnabled(GET_FILE_SHIFT(PSysDAG))) return; + if (!Log::isLogTagEnabled(GET_FILE_SHIFT(PSysDAG), CAMERA_DEBUG_LOG_LEVEL2)) return; for (auto& inputMap : mInputMaps) { if (inputMap.mExecutor) { diff --git a/src/core/psysprocessor/PSysDAG.h b/src/core/psysprocessor/PSysDAG.h index 172a841b..a9985068 100644 --- a/src/core/psysprocessor/PSysDAG.h +++ b/src/core/psysprocessor/PSysDAG.h @@ -86,6 +86,8 @@ class PSysDAG { int resume(); int pause(); + void unregisterNode(); + int registerInternalBufs(std::map& internalBufs); int registerUserOutputBufs(Port port, const std::shared_ptr& camBuffer); void stopProcessing(); diff --git a/src/core/psysprocessor/PipeLiteExecutor.cpp b/src/core/psysprocessor/PipeLiteExecutor.cpp index 56ff6f5f..54dd9f08 100644 --- a/src/core/psysprocessor/PipeLiteExecutor.cpp +++ b/src/core/psysprocessor/PipeLiteExecutor.cpp @@ -1128,7 +1128,7 @@ void PipeLiteExecutor::getTerminalBuffersFromExternal( } void PipeLiteExecutor::dumpPGs() const { - if (!Log::isLogTagEnabled(GET_FILE_SHIFT(PipeLiteExecutor))) return; + if (!Log::isLogTagEnabled(GET_FILE_SHIFT(PipeLiteExecutor), CAMERA_DEBUG_LOG_LEVEL3)) return; LOG3("============= dump PGs for executor %s =================", getName()); if (mIsInputEdge) { 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/fd/FaceDetection.cpp b/src/fd/FaceDetection.cpp index a18f330b..50e23977 100644 --- a/src/fd/FaceDetection.cpp +++ b/src/fd/FaceDetection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * 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. @@ -141,7 +141,7 @@ bool FaceDetection::faceRunningByCondition() { } void FaceDetection::printfFDRunRate() { - if (!Log::isLogTagEnabled(ST_FPS)) return; + if (!Log::isLogTagEnabled(ST_FPS, CAMERA_DEBUG_LOG_LEVEL2)) return; mRunCount++; if (mRunCount % FPS_FD_COUNT != 0) return; diff --git a/src/fd/facessd/FaceSSD.cpp b/src/fd/facessd/FaceSSD.cpp index 13c60ec1..87b35699 100644 --- a/src/fd/facessd/FaceSSD.cpp +++ b/src/fd/facessd/FaceSSD.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-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. @@ -35,52 +35,37 @@ FaceSSD::FaceSSD(int cameraId, unsigned int maxFaceNum, int32_t halStreamId, int int gfxFmt, int usage) : FaceDetection(cameraId, maxFaceNum, halStreamId, width, height) { CLEAR(mResult); - int ret = initFaceDetection(width, height, gfxFmt, usage); - CheckAndLogError(ret != OK, VOID_VALUE, "failed to init face detection, ret %d", ret); -} - -FaceSSD::~FaceSSD() { - LOG1(" @%s", mCameraId, __func__); - - if (!PlatformData::isFaceEngineSyncRunning(mCameraId)) { - requestExit(); - AutoMutex l(mRunBufQueueLock); - mRunCondition.notify_one(); - } - if (mBufferPool) { - mBufferPool->destroyBufferPool(); - } -} - -int FaceSSD::initFaceDetection(int width, int height, int gfxFmt, int usage) { - mBufferPool = std::unique_ptr(new camera3::Camera3BufferPool()); - // Create the buffer pool with DMA handle buffer - int ret = mBufferPool->createBufferPool(mCameraId, MAX_STORE_FACE_DATA_BUF_NUM, width, height, - gfxFmt, usage); - CheckAndLogError(ret != icamera::OK, NO_MEMORY, "[%p]@%s Failed to createBufferPool.", this, - __func__); mFaceDetector = cros::FaceDetector::Create(); - - if (!PlatformData::isFaceEngineSyncRunning(mCameraId)) { - /* start face engine pthread */ - ret = run("fdSSD" + std::to_string(mCameraId), PRIORITY_NORMAL); - CheckAndLogError(ret != OK, NO_INIT, "Camera thread failed to start, ret %d", ret); - } + CheckAndLogError(!mFaceDetector, VOID_VALUE, "mFaceDetector is nullptr"); mInitialized = true; - return OK; } -std::shared_ptr FaceSSD::acquireRunCCBuf() { - std::shared_ptr buf = mBufferPool->acquireBuffer(); - CheckAndLogError(buf == nullptr, nullptr, "@%s no available internal buffer", __func__); - - return buf; +FaceSSD::~FaceSSD() { + mFaceDetector = nullptr; } -void FaceSSD::returnRunBuf(std::shared_ptr gbmRunBuf) { - mBufferPool->returnBuffer(gbmRunBuf); +void FaceSSD::faceDetectResult(cros::FaceDetectResult ret, + std::vector faces) { + AutoMutex l(mFaceResultLock); + CLEAR(mResult); + + if (ret == cros::FaceDetectResult::kDetectOk) { + int faceCount = 0; + for (auto& face : faces) { + if (faceCount >= mMaxFaceNum) break; + mResult.faceSsdResults[faceCount] = face; + faceCount++; + LOG2("face result: box: %f,%f,%f,%f", face.bounding_box.x1, face.bounding_box.y1, + face.bounding_box.x2, face.bounding_box.y2); + } + mResult.faceNum = faceCount; + mResult.faceUpdated = true; + LOG2("@%s, faceNum:%d", __func__, mResult.faceNum); + } else { + LOGE("@%s, Faile to detect face", __func__); + } } void FaceSSD::runFaceDetectionBySync(const std::shared_ptr& ccBuf) { @@ -88,85 +73,33 @@ void FaceSSD::runFaceDetectionBySync(const std::shared_ptr face_detection_result = camera3::FaceDetectionResultCallbackManager::getInstance(). getFaceDetectionResult(mCameraId); - cros::FaceDetectResult ret = cros::FaceDetectResult::kDetectOk; - std::vector faces; - if (!face_detection_result) { - int input_stride = ccBuf->stride(); - cros::Size input_size = cros::Size(ccBuf->width(), ccBuf->height()); - const uint8_t* buffer_addr = static_cast(ccBuf->data()); - - ret = mFaceDetector->Detect(buffer_addr, input_stride, input_size, &faces); - LOG2("Run with a new cros::FaceDetector instance"); - } else { - faces = face_detection_result->faces; + if (face_detection_result) { LOG2("FrameNum:%zu, run with the cros::FaceDetector from stream manipulator.", face_detection_result->frame_number); + faceDetectResult(cros::FaceDetectResult::kDetectOk, face_detection_result->faces); + return; } - printfFDRunRate(); - LOG2("@%s: It takes need %ums", __func__, - (unsigned)((CameraUtils::systemTime() - startTime) / 1000000)); - - { - AutoMutex l(mFaceResultLock); - CLEAR(mResult); - if (ret == cros::FaceDetectResult::kDetectOk) { - int faceCount = 0; - for (auto& face : faces) { - if (faceCount >= mMaxFaceNum) break; - mResult.faceSsdResults[faceCount] = face; - faceCount++; - LOG2("@%s, bounding_box: %f,%f,%f,%f", __func__, - face.bounding_box.x1, - face.bounding_box.y1, - face.bounding_box.x2, - face.bounding_box.y2); - } - mResult.faceNum = faceCount; - mResult.faceUpdated = true; - LOG2("@%s, faceNum:%d", __func__, mResult.faceNum); - } else { - LOGE("@%s, Faile to detect face", __func__); - } - } + int input_stride = ccBuf->stride(); + cros::Size input_size = cros::Size(ccBuf->width(), ccBuf->height()); + const uint8_t* buffer_addr = static_cast(ccBuf->data()); + + // base::Unretained is safe since 'this' joins 'face thread' in the destructor. + mFaceDetector->DetectAsync(buffer_addr, input_stride, input_size, std::nullopt, + base::BindOnce(&FaceSSD::faceDetectResult, base::Unretained(this))); } void FaceSSD::runFaceDetectionByAsync(const std::shared_ptr& ccBuf) { LOG2("@%s", __func__); CheckAndLogError(mInitialized == false, VOID_VALUE, "@%s, mInitialized is false", __func__); - std::shared_ptr bufferTmp = acquireRunCCBuf(); - CheckAndLogError(!bufferTmp || !bufferTmp->data(), VOID_VALUE, "No avalible buffer"); - MEMCPY_S(bufferTmp->data(), bufferTmp->size(), ccBuf->data(), ccBuf->size()); - - AutoMutex l(mRunBufQueueLock); - mRunGoogleBufQueue.push(bufferTmp); - mRunCondition.notify_one(); -} - -bool FaceSSD::threadLoop() { - std::shared_ptr faceParams = nullptr; - - { - ConditionLock lock(mRunBufQueueLock); - if (mRunGoogleBufQueue.empty()) { - mRunCondition.wait_for(lock, - std::chrono::nanoseconds(kMaxDuration * SLOWLY_MULTIPLIER)); - return true; - } - faceParams = mRunGoogleBufQueue.front(); - mRunGoogleBufQueue.pop(); - } - CheckAndLogError(!faceParams, false, "@%s, faceParams buffer is nullptr", __func__); - - runFaceDetectionBySync(faceParams); - returnRunBuf(faceParams); - return true; + runFaceDetectionBySync(ccBuf); } int FaceSSD::getFaceNum() { diff --git a/src/fd/facessd/FaceSSD.h b/src/fd/facessd/FaceSSD.h index 5a649c47..6e4d16d7 100644 --- a/src/fd/facessd/FaceSSD.h +++ b/src/fd/facessd/FaceSSD.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-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. @@ -19,10 +19,7 @@ #include #include -#include -#include -#include "Camera3BufferPool.h" #include "FaceDetection.h" #include "IntelCCATypes.h" @@ -41,7 +38,6 @@ class FaceSSD : public FaceDetection { virtual void runFaceDetectionBySync(const std::shared_ptr& ccBuf); virtual void runFaceDetectionByAsync(const std::shared_ptr& ccBuf); - virtual bool threadLoop(); protected: virtual int getFaceNum(); @@ -49,18 +45,10 @@ class FaceSSD : public FaceDetection { virtual void getResultForApp(CVFaceDetectionAbstractResult* result); private: - int initFaceDetection(int width, int height, int gfxFmt, int usage); - std::shared_ptr acquireRunCCBuf(); - void returnRunBuf(std::shared_ptr gbmRunBuf); + void faceDetectResult(cros::FaceDetectResult ret, std::vector faces); - // Guard for running buffer queue of thread - std::queue> mRunGoogleBufQueue; - - std::unique_ptr mBufferPool; std::unique_ptr mFaceDetector; - FaceSSDResult mResult; - DISALLOW_COPY_AND_ASSIGN(FaceSSD); }; diff --git a/src/hal/hal_adaptor/CMakeLists.txt b/src/hal/hal_adaptor/CMakeLists.txt new file mode 100644 index 00000000..c761c3ab --- /dev/null +++ b/src/hal/hal_adaptor/CMakeLists.txt @@ -0,0 +1,132 @@ +# +# 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. +# + +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) +# ISP_CONTROL_S +set(ISP_CTRL_DIR ${ROOT_DIR}/src/isp_control) +# ISP_CONTROL_E + +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 + -D_FORTIFY_SOURCE=2 + -DDCHECK_ALWAYS_ON + -Wformat -Wformat-security + ) + +add_definitions(-D__STDC_FORMAT_MACROS + -DHAVE_PTHREADS + -DHAVE_LINUX_OS + ) + +set(HAL_ADAPTOR_LD_FLAGS "-fPIE -fPIC -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${HAL_ADAPTOR_LD_FLAGS}") + +set(HAL_ADAPTOR_SRCS + ${METADATA_DIR}/icamera_metadata_base.cpp + ${METADATA_DIR}/CameraMetadata.cpp + ${METADATA_DIR}/Parameters.cpp + ${METADATA_DIR}/ParameterHelper.cpp + ${IUTILS_DIR}/CameraLog.cpp + ${IUTILS_DIR}/LogSink.cpp + ${IUTILS_DIR}/ModuleTags.cpp + ${IUTILS_DIR}/Trace.cpp + ${IUTILS_DIR}/Utils.cpp + ${IUTILS_DIR}/ScopedAtrace.cpp + ${HAL_ADAPTOR_DIR}/HalAdaptor.cpp + CACHE INTERNAL "hal adaptor sources" +) + +# ISP_CONTROL_S +set(HAL_ADAPTOR_SRCS + ${HAL_ADAPTOR_SRCS} + ${ISP_CTRL_DIR}/IspControlUtils.cpp + CACHE INTERNAL "isp control sources" +) +# ISP_CONTROL_E + +add_library(hal_adaptor SHARED ${HAL_ADAPTOR_SRCS}) + +#---------------------------- Link settings ---------------------------- +set (THREADS_PREFER_PTHREAD_FLAG ON) +find_package (Threads REQUIRED) +target_link_libraries(hal_adaptor ${CMAKE_THREAD_LIBS_INIT}) +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) +if (SUPPORT_LIVE_TUNING) + install(FILES ${ROOT_DIR}/modules/livetune/LiveTuning.h DESTINATION include/hal_adaptor/api) +endif() + +# Install libraries +if (${CMAKE_VERSION} VERSION_LESS 3.11) + install(TARGETS hal_adaptor + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +else() + install(TARGETS hal_adaptor DESTINATION ${CMAKE_INSTALL_LIBDIR}) +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 + 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 new file mode 100644 index 00000000..71b71aaa --- /dev/null +++ b/src/hal/hal_adaptor/HalAdaptor.cpp @@ -0,0 +1,187 @@ +/* + * 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. + */ +#define LOG_TAG HalAdaptor + +#include "HalAdaptor.h" + +#include + +#include "iutils/CameraLog.h" +#include "iutils/Utils.h" +#include "iutils/Errors.h" + +extern "C" { +namespace icamera { + +static void* gCameraHalLib = nullptr; +static HalApiHandle gCameraHalAdaptor = {}; + +#define CheckFuncCall(function) \ + do { \ + if (((function) == nullptr)) { \ + LOGE("%s, function call is nullptr", __func__); \ + return -1; \ + } \ + } while (0) + +#define GET_FUNC_CALL(member, fnName) \ + do { \ + gCameraHalAdaptor.member = \ + (HalApiHandle::pFn##member)dlsym(gCameraHalLib, #fnName); \ + if (gCameraHalAdaptor.member == nullptr) { \ + LOGE("@%s: LOADING: " #fnName "failed: %s", __func__, dlerror()); \ + return; \ + } \ + LOG2("@%s: LOADING: " #fnName "= %x", __func__, gCameraHalAdaptor.member); \ + } while (0) + +static void load_camera_hal_library(const char* libName) { + CheckAndLogError(!libName, VOID_VALUE, "%s, invalid library name", __func__); + + gCameraHalLib = dlopen(libName, RTLD_NOW); + CheckAndLogError(!gCameraHalLib, VOID_VALUE, "%s, failed to open library: %s, error: %s", + __func__, libName, dlerror()); + + GET_FUNC_CALL(getNumberOfCameras, get_number_of_cameras); + GET_FUNC_CALL(getCameraInfo, get_camera_info); + GET_FUNC_CALL(cameraHalInit, camera_hal_init); + GET_FUNC_CALL(cameraHalDeinit, camera_hal_deinit); + GET_FUNC_CALL(cameraCallbackRegister, camera_callback_register); + GET_FUNC_CALL(cameraDeviceOpen, camera_device_open); + GET_FUNC_CALL(cameraDeviceClose, camera_device_close); + GET_FUNC_CALL(cameraDeviceConfigSensorInput, camera_device_config_sensor_input); + GET_FUNC_CALL(cameraDeviceConfigStreams, camera_device_config_streams); + GET_FUNC_CALL(cameraDeviceStart, camera_device_start); + GET_FUNC_CALL(cameraDeviceStop, camera_device_stop); + GET_FUNC_CALL(cameraDeviceAllocateMemory, camera_device_allocate_memory); + GET_FUNC_CALL(cameraStreamQbuf, camera_stream_qbuf); + GET_FUNC_CALL(cameraStreamDqbuf, camera_stream_dqbuf); + GET_FUNC_CALL(cameraSetParameters, camera_set_parameters); + GET_FUNC_CALL(cameraGetParameters, camera_get_parameters); + GET_FUNC_CALL(getHalFrameSize, get_frame_size); +} + +static void close_camera_hal_library() { + if (gCameraHalLib) { + dlclose(gCameraHalLib); + gCameraHalLib = nullptr; + } +} + +int get_number_of_cameras() { + CheckFuncCall(gCameraHalAdaptor.getNumberOfCameras); + return gCameraHalAdaptor.getNumberOfCameras(); +} + +int get_camera_info(int camera_id, camera_info_t& info) { + CheckFuncCall(gCameraHalAdaptor.getCameraInfo); + return gCameraHalAdaptor.getCameraInfo(camera_id, info); +} +int camera_hal_init() { + CheckFuncCall(gCameraHalAdaptor.cameraHalInit); + return gCameraHalAdaptor.cameraHalInit(); +} + +int camera_hal_deinit() { + CheckFuncCall(gCameraHalAdaptor.cameraHalDeinit); + return gCameraHalAdaptor.cameraHalDeinit(); +} + +void camera_callback_register(int camera_id, const camera_callback_ops_t* callback) { + if (gCameraHalAdaptor.cameraCallbackRegister) { + LOGE("%s, function call is nullptr", __func__); + return VOID_VALUE; + } + gCameraHalAdaptor.cameraCallbackRegister(camera_id, callback); +} + +int camera_device_open(int camera_id, int vc_num) { + CheckFuncCall(gCameraHalAdaptor.cameraDeviceOpen); + return gCameraHalAdaptor.cameraDeviceOpen(camera_id, vc_num); +} + +void camera_device_close(int camera_id) { + if (gCameraHalAdaptor.cameraDeviceClose) { + LOGE("%s, function call is nullptr", __func__); + return VOID_VALUE; + } + gCameraHalAdaptor.cameraDeviceClose(camera_id); +} + +int camera_device_config_sensor_input(int camera_id, const stream_t* input_config) { + CheckFuncCall(gCameraHalAdaptor.cameraDeviceConfigSensorInput); + return gCameraHalAdaptor.cameraDeviceConfigSensorInput(camera_id, input_config); +} + +int camera_device_config_streams(int camera_id, stream_config_t* stream_list) { + CheckFuncCall(gCameraHalAdaptor.cameraDeviceConfigStreams); + return gCameraHalAdaptor.cameraDeviceConfigStreams(camera_id, stream_list); +} + +int camera_device_start(int camera_id) { + CheckFuncCall(gCameraHalAdaptor.cameraDeviceStart); + return gCameraHalAdaptor.cameraDeviceStart(camera_id); +} + +int camera_device_stop(int camera_id) { + CheckFuncCall(gCameraHalAdaptor.cameraDeviceStop); + return gCameraHalAdaptor.cameraDeviceStop(camera_id); +} + +int camera_device_allocate_memory(int camera_id, camera_buffer_t* buffer) { + CheckFuncCall(gCameraHalAdaptor.cameraDeviceAllocateMemory); + return gCameraHalAdaptor.cameraDeviceAllocateMemory(camera_id, buffer); +} + +int camera_stream_qbuf(int camera_id, camera_buffer_t** buffer, int num_buffers, + const Parameters* settings) { + CheckFuncCall(gCameraHalAdaptor.cameraStreamQbuf); + return gCameraHalAdaptor.cameraStreamQbuf(camera_id, buffer, num_buffers, settings); +} + +int camera_stream_dqbuf(int camera_id, int stream_id, camera_buffer_t** buffer, + Parameters* settings) { + CheckFuncCall(gCameraHalAdaptor.cameraStreamDqbuf); + return gCameraHalAdaptor.cameraStreamDqbuf(camera_id, stream_id, buffer, settings); +} + +int camera_set_parameters(int camera_id, const Parameters& param) { + CheckFuncCall(gCameraHalAdaptor.cameraSetParameters); + return gCameraHalAdaptor.cameraSetParameters(camera_id, param); +} + +int camera_get_parameters(int camera_id, Parameters& param, int64_t sequence) { + CheckFuncCall(gCameraHalAdaptor.cameraGetParameters); + return gCameraHalAdaptor.cameraGetParameters(camera_id, param, sequence); +} + +int get_frame_size(int camera_id, int format, int width, int height, int field, int* bpp) { + CheckFuncCall(gCameraHalAdaptor.getHalFrameSize); + return gCameraHalAdaptor.getHalFrameSize(camera_id, format, width, height, field, bpp); +} + +__attribute__((constructor)) void initHalAdaptor() { + Log::setDebugLevel(); + load_camera_hal_library("/usr/lib/libcamhal.so"); +} + +__attribute__((destructor)) void deinitHalAdaptor() { + close_camera_hal_library(); + CLEAR(gCameraHalAdaptor); +} + +} // namespace icamera +} // extern "C" diff --git a/src/hal/hal_adaptor/HalAdaptor.h b/src/hal/hal_adaptor/HalAdaptor.h new file mode 100644 index 00000000..cca1dab0 --- /dev/null +++ b/src/hal/hal_adaptor/HalAdaptor.h @@ -0,0 +1,52 @@ +/* + * 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 "ICamera.h" + +extern "C" { +namespace icamera { + +struct HalApiHandle { +#define _DEF_HAL_FUNC(ret, name, ...) \ + typedef ret (*pFn##name)(__VA_ARGS__); \ + pFn##name name + + _DEF_HAL_FUNC(int, getNumberOfCameras); + _DEF_HAL_FUNC(int, getCameraInfo, int camera_id, camera_info_t& info); + _DEF_HAL_FUNC(int, cameraHalInit); + _DEF_HAL_FUNC(int, cameraHalDeinit); + _DEF_HAL_FUNC(void, cameraCallbackRegister, int camera_id, + const camera_callback_ops_t* callback); + _DEF_HAL_FUNC(int, cameraDeviceOpen, int camera_id, int vc_num); + _DEF_HAL_FUNC(void, cameraDeviceClose, int camera_id); + _DEF_HAL_FUNC(int, cameraDeviceConfigSensorInput, int camera_id, const stream_t* inputConfig); + _DEF_HAL_FUNC(int, cameraDeviceConfigStreams, int camera_id, stream_config_t* stream_list); + _DEF_HAL_FUNC(int, cameraDeviceStart, int camera_id); + _DEF_HAL_FUNC(int, cameraDeviceStop, int camera_id); + _DEF_HAL_FUNC(int, cameraDeviceAllocateMemory, int camera_id, camera_buffer_t* buffer); + _DEF_HAL_FUNC(int, cameraStreamQbuf, int camera_id, camera_buffer_t** buffer, + int num_buffers, const Parameters* settings); + _DEF_HAL_FUNC(int, cameraStreamDqbuf, int camera_id, int stream_id, camera_buffer_t** buffer, + Parameters* settings); + _DEF_HAL_FUNC(int, cameraSetParameters, int camera_id, const Parameters& param); + _DEF_HAL_FUNC(int, cameraGetParameters, int camera_id, Parameters& param, int64_t sequence); + _DEF_HAL_FUNC(int, getHalFrameSize, int camera_id, int format, int width, int height, + int field, int* bpp); +}; +} // namespace icamera +} // extern "C" + diff --git a/src/hal/hal_adaptor/hal_adaptor.pc.cmakein b/src/hal/hal_adaptor/hal_adaptor.pc.cmakein new file mode 100644 index 00000000..e77e7178 --- /dev/null +++ b/src/hal/hal_adaptor/hal_adaptor.pc.cmakein @@ -0,0 +1,11 @@ +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/ICBMThread.cpp b/src/icbm/ICBMThread.cpp index a1323a34..6d9ebb00 100644 --- a/src/icbm/ICBMThread.cpp +++ b/src/icbm/ICBMThread.cpp @@ -35,31 +35,30 @@ int ICBMThread::setup(ICBMInitInfo* initParams) { return OK; } -void ICBMThread::shutdown() { +void ICBMThread::shutdown(const ICBMReqInfo& request) { LOG1("%s, Shuting down...", __func__); - mIntelICBM->shutdown(); + mIntelICBM->shutdown(request); } int ICBMThread::processFrame(const camera_buffer_t& inBuffer, const camera_buffer_t& outBuffer, - ICBMReqInfo* param) { + ICBMReqInfo& request) { LOG2("%s, Processing frame", __func__); - ImageInfo iii = {}; - iii.width = inBuffer.s.width; - iii.height = inBuffer.s.height; - iii.size = inBuffer.s.size; - iii.stride = inBuffer.s.stride; - - ImageInfo iio = {}; - iio.width = outBuffer.s.width; - iio.height = outBuffer.s.height; - iio.size = outBuffer.s.size; - iio.stride = outBuffer.s.stride; + + request.inII.width = inBuffer.s.width; + request.inII.height = inBuffer.s.height; + request.inII.size = inBuffer.s.size; + request.inII.stride = inBuffer.s.stride; + + request.outII.width = outBuffer.s.width; + request.outII.height = outBuffer.s.height; + request.outII.size = outBuffer.s.size; + request.outII.stride = outBuffer.s.stride; #ifdef ENABLE_SANDBOXING - iii.gfxHandle = inBuffer.dmafd; - iio.gfxHandle = outBuffer.dmafd; + request.inII.gfxHandle = inBuffer.dmafd; + request.outII.gfxHandle = outBuffer.dmafd; - auto ret = mIntelICBM->processFrame(iii, iio, *param); + auto ret = mIntelICBM->processFrame(request); #else void* pInBuf = (inBuffer.s.memType == V4L2_MEMORY_DMABUF) ? CameraBuffer::mapDmaBufferAddr(inBuffer.dmafd, inBuffer.s.size) : @@ -69,9 +68,9 @@ int ICBMThread::processFrame(const camera_buffer_t& inBuffer, const camera_buffe CameraBuffer::mapDmaBufferAddr(outBuffer.dmafd, outBuffer.s.size) : outBuffer.addr; - iii.bufAddr = pInBuf; - iio.bufAddr = pOutBuf; - auto ret = mIntelICBM->processFrame(iii, iio, *param); + request.inII.bufAddr = pInBuf; + request.outII.bufAddr = pOutBuf; + auto ret = mIntelICBM->processFrame(request); if (inBuffer.s.memType == V4L2_MEMORY_DMABUF) { CameraBuffer::unmapDmaBufferAddr(pInBuf, inBuffer.s.size); diff --git a/src/icbm/ICBMThread.h b/src/icbm/ICBMThread.h index c71a86fe..42d99632 100644 --- a/src/icbm/ICBMThread.h +++ b/src/icbm/ICBMThread.h @@ -19,7 +19,6 @@ #include #include "ICBMTypes.h" -#include "IntelICBM.h" #include "core/CameraBuffer.h" #include "iutils/Utils.h" @@ -39,10 +38,10 @@ class ICBMThread { ~ICBMThread() {} int setup(ICBMInitInfo* initParams); - void shutdown(); + void shutdown(const ICBMReqInfo& request); int processFrame(const camera_buffer_t& inBuffer, const camera_buffer_t& outBuffer, - ICBMReqInfo* param); + ICBMReqInfo& request); private: std::unique_ptr mIntelICBM; diff --git a/src/icbm/ICBMTypes.h b/src/icbm/ICBMTypes.h index 046a110c..65928d65 100644 --- a/src/icbm/ICBMTypes.h +++ b/src/icbm/ICBMTypes.h @@ -21,33 +21,47 @@ namespace icamera { -constexpr static uint32_t UF_MODE_OFF = 0; -constexpr static uint32_t UF_MODE_ON = 1; - struct ImageInfo { - uint32_t gfxHandle; + int32_t gfxHandle; void* bufAddr; uint32_t width; uint32_t height; uint32_t stride; uint32_t size; + ImageInfo() : gfxHandle(-1), bufAddr(nullptr), width(0), height(0), stride(0), size(0) {} }; -struct ICBMReqInfo { - uint32_t usrFrmEnabled; +#define ICBM_REQUEST_MAX_SHIFT 15 +enum ICBMReqType { + REQUEST_NONE = 0, + USER_FRAMING = 1 << 0, + LEVEL0_TNR = 1 << 1, + REQUEST_MAX = 1 << ICBM_REQUEST_MAX_SHIFT }; struct ICBMInitInfo { + int cameraId; + uint32_t reqType; uint32_t height; uint32_t width; }; -struct ICBMRunInfo { +struct ICBMReqInfo { + int cameraId; + uint32_t reqType; ImageInfo inII; ImageInfo outII; - uint32_t inHandle; - uint32_t outHandle; - ICBMReqInfo icbmReqInfo; + int32_t inHandle; + int32_t outHandle; + int32_t paramHandle; + void* paramAddr; + ICBMReqInfo() + : cameraId(-1), + reqType(REQUEST_NONE), + inHandle(-1), + outHandle(-1), + paramHandle(-1), + paramAddr(nullptr) {} }; } // 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/icbm/MemoryChain.cpp b/src/icbm/MemoryChain.cpp new file mode 100644 index 00000000..3bc1ca57 --- /dev/null +++ b/src/icbm/MemoryChain.cpp @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#include "src/icbm/MemoryChain.h" + +namespace icamera { + +MemoryChainDescription::MemoryChainDescription(const ImageInfo& iii, const ImageInfo& iio) + : mInInfo(iii), + mOutInfo(iio) {} + +void MemoryChainDescription::linkIn(const char* featureName, const char* inPortName, + const char* outPortName) { + iaic_memory inMemory = createMemoryDesc(mInInfo); + iaic_memory outMemory = createMemoryDesc(mOutInfo); + + inMemory.p = mInInfo.bufAddr; + outMemory.p = mOutInfo.bufAddr; + + inMemory.feature_name = featureName; + inMemory.port_name = inPortName; + + outMemory.feature_name = featureName; + outMemory.port_name = outPortName; + + mInChain.push_back(inMemory); + mOutChain.push_back(outMemory); + + if (mInChain.size() > 1) mInChain[mInChain.size() - 2].next = &mInChain[mInChain.size() - 1]; + if (mOutChain.size() > 1) + mOutChain[mOutChain.size() - 2].next = &mOutChain[mOutChain.size() - 1]; +} + +MemoryIOPort MemoryChainDescription::getIOPort() { + if (mInChain.empty() || mOutChain.empty()) + return {nullptr, nullptr}; + else + return {&mInChain[0], &mOutChain[0]}; +} + +iaic_memory MemoryChainDescription::createMemoryDesc(const ImageInfo& ii) { + iaic_memory mem = {}; + + mem.has_gfx = false; + mem.size[0] = ii.size; + mem.size[1] = ii.width; + mem.size[2] = ii.height; + mem.size[3] = ii.stride; + + return mem; +} +} // namespace icamera diff --git a/src/icbm/MemoryChain.h b/src/icbm/MemoryChain.h new file mode 100644 index 00000000..27c83912 --- /dev/null +++ b/src/icbm/MemoryChain.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#include +#include + +#include "src/icbm/ICBMTypes.h" +#include "src/icbm/OPIC2Api.h" + +namespace icamera { +using MemoryChain = std::vector; +using MemoryIOPort = std::pair; + +class MemoryChainDescription { + public: + MemoryChainDescription(const ImageInfo& iii, const ImageInfo& iio); + ~MemoryChainDescription() = default; + MemoryChainDescription(MemoryChainDescription&& rhs) = default; + MemoryChainDescription& operator=(const MemoryChainDescription& rhs) = delete; + MemoryChainDescription(const MemoryChainDescription& rhs) = delete; + + void linkIn(const char* featureName, const char* inPortName, const char* outPortName); + MemoryIOPort getIOPort(); + + private: + ImageInfo mInInfo; + ImageInfo mOutInfo; + + MemoryChain mInChain; + MemoryChain mOutChain; + + iaic_memory createMemoryDesc(const ImageInfo& ii); +}; +} // namespace icamera diff --git a/src/icbm/OnePunchIC2.cpp b/src/icbm/OnePunchIC2.cpp index 0c946d59..21fbc400 100644 --- a/src/icbm/OnePunchIC2.cpp +++ b/src/icbm/OnePunchIC2.cpp @@ -19,94 +19,249 @@ #include "src/icbm/OnePunchIC2.h" #include +#include #include "iutils/CameraLog.h" #include "Utils.h" +#include "TNRCommon.h" namespace icamera { -IntelOPIC2::IntelOPIC2() { - mCtxSession = reinterpret_cast(this); +IntelOPIC2* IntelOPIC2::sInstance = nullptr; +std::mutex IntelOPIC2::sLock; + +static const std::unordered_map gFeatureStrMapping = { + {ICBMReqType::USER_FRAMING, "user_framing"}, + {ICBMReqType::LEVEL0_TNR, "tnr7us_l0"}, +}; + +IntelOPIC2* IntelOPIC2::getInstance() { + std::lock_guard lock(sLock); + if (!sInstance) { + sInstance = new IntelOPIC2(); + } + + return sInstance; } -#define UF_FEATURE_NAME "user_framing" +void IntelOPIC2::releaseInstance() { + std::lock_guard lock(sLock); + if (sInstance) delete sInstance; + sInstance = nullptr; +} + +IntelOPIC2::IntelOPIC2() { + mLockMap.clear(); + mSessionMap.clear(); + mFeatureMap.clear(); +} -int IntelOPIC2::setup(void* initParams) { - (void)initParams; - LOGI("$%s, Going to setup up IC2...", __func__); +int IntelOPIC2::setup(ICBMInitInfo* initParams) { + LOG1("@%s, Going to setup up IC2...", __func__); int ver[3]; ::iaic_query_version(&ver[0], &ver[1], &ver[2]); - LOGI("$%s, IC Version %d.%d.%d", __func__, ver[0], ver[1], ver[2]); + LOG1("@%s, IC Version %d.%d.%d", __func__, ver[0], ver[1], ver[2]); size_t featureLen; - std::string featureStr; + std::string supportedFeatures; ::iaic_query_features(nullptr, &featureLen); - featureStr.resize(featureLen); - ::iaic_query_features(featureStr.data(), &featureLen); - LOGI("$%s, IC supported features: %s", __func__, featureStr.c_str()); + supportedFeatures.resize(featureLen); + ::iaic_query_features(supportedFeatures.data(), &featureLen); + LOG1("@%s, IC supported features: %s", __func__, supportedFeatures.c_str()); - iaic_options option{}; - option.profiling = false; - option.blocked_init = false; - ::iaic_create_session(mCtxSession, UF_FEATURE_NAME, option); + LOG1("<%d>@%s type %d", initParams->cameraId, __func__, initParams->reqType); + int key = getIndexKey(initParams->cameraId, initParams->reqType); + CheckWarning((mSessionMap.find(key) != mSessionMap.end()), OK, + " @%s, request type: %d is already exist", initParams->cameraId, __func__, + initParams->reqType); - return OK; -} + const char* fratureStr = gFeatureStrMapping.at(static_cast(initParams->reqType)); + if (strstr(supportedFeatures.c_str(), fratureStr) == nullptr) { + LOG1("<%d>@%s type %d not supported", initParams->cameraId, __func__, initParams->reqType); + return 0; + } -void IntelOPIC2::shutdown() { - LOGI("$%s, Going to shutdown IC2...", __func__); + mLockMap[key] = std::unique_ptr(new std::mutex); + std::unique_lock lock(*mLockMap[key]); - std::lock_guard lock(mCritObject); - ::iaic_close_session(mCtxSession, UF_FEATURE_NAME); -} + mFeatureMap[key].clear(); + // we use the key value as the unique session id + mSessionMap[key] = static_cast(key); + if ((initParams->reqType & ICBMReqType::USER_FRAMING) && + (strstr(supportedFeatures.c_str(), fratureStr) != nullptr)) { + iaic_options option{}; + option.profiling = false; + option.blocked_init = false; + ::iaic_create_session(mSessionMap[key], fratureStr, option); + mFeatureMap[key].push_back(fratureStr); + } -int IntelOPIC2::processFrame(const ImageInfo& iii, const ImageInfo& iio, - const ICBMReqInfo& reqInfo) { - iaic_memory inMem, outMem; + fratureStr = gFeatureStrMapping.at(ICBMReqType::LEVEL0_TNR); + if ((initParams->reqType & ICBMReqType::LEVEL0_TNR) && + (strstr(supportedFeatures.c_str(), fratureStr) != nullptr)) { + iaic_options option{}; + option.profiling = true; + option.blocked_init = true; + ::iaic_create_session(mSessionMap[key], fratureStr, option); + mFeatureMap[key].push_back(fratureStr); + } - inMem = createMemoryDesc(iii); - outMem = createMemoryDesc(iio); + return OK; +} - std::string featureStr = buildFeatureStr(reqInfo); - outMem.feature_name = featureStr.c_str(); - outMem.port_name = "drain:drain"; - inMem.p = iii.bufAddr; - outMem.p = iio.bufAddr; +int IntelOPIC2::shutdown(const ICBMReqInfo& reqInfo) { + LOG1("<%d>@%s type %d", reqInfo.cameraId, __func__, reqInfo.reqType); + int key = getIndexKey(reqInfo.cameraId, reqInfo.reqType); - std::lock_guard lock(mCritObject); - bool res = ::iaic_execute(mCtxSession, inMem, outMem); - if (::iaic_get_status(mCtxSession, featureStr.c_str()) == iaic_session_status::opened) { - ::iaic_get_data(mCtxSession, outMem); + CheckAndLogError((mSessionMap.find(key) == mSessionMap.end()), NAME_NOT_FOUND, + " @%s, request type: %d is not exist", reqInfo.cameraId, __func__, + reqInfo.reqType); + + int ret = -1; + { + std::unique_lock lock(*mLockMap[key]); + for (auto& feature : mFeatureMap[key]) { + ::iaic_close_session(mSessionMap[key], feature); + } + mSessionMap.erase(key); + ret = mSessionMap.size(); } + mLockMap.erase(key); + return ret; +} + +int IntelOPIC2::processFrame(const ICBMReqInfo& reqInfo) { + int key = getIndexKey(reqInfo.cameraId, reqInfo.reqType); - CheckAndLogError(res != true, UNKNOWN_ERROR, "$%s, IC2 Internal Error on processing frame", + CheckAndLogError((mSessionMap.find(key) == mSessionMap.end()), BAD_VALUE, + " @%s, request type: %d is not exist", reqInfo.cameraId, __func__, + reqInfo.reqType); + auto mcd = createMemoryChain(reqInfo); + auto mem = mcd.getIOPort(); + if (mem.first == nullptr) return OK; + + std::unique_lock lock(*mLockMap[key]); + bool res = ::iaic_execute(mSessionMap[key], *mem.first, *mem.second); + CheckAndLogError(res != true, UNKNOWN_ERROR, "%s, IC2 Internal Error on processing frame", __func__); return OK; } -iaic_memory IntelOPIC2::createMemoryDesc(const ImageInfo& ii) { - iaic_memory mem = {}; +int IntelOPIC2::runTnrFrame(const ICBMReqInfo& reqInfo) { + LOG2("%s, ", __func__); + int key = getIndexKey(reqInfo.cameraId, reqInfo.reqType); + + CheckAndLogError((mSessionMap.find(key) == mSessionMap.end()), BAD_VALUE, + " @%s, request type: %d is not exist", reqInfo.cameraId, __func__, + reqInfo.reqType); + + const char* featureName = gFeatureStrMapping.at(ICBMReqType::LEVEL0_TNR); + iaic_memory inMem, outMem; + inMem.has_gfx = true; + inMem.size[0] = reqInfo.inII.size; + inMem.size[1] = reqInfo.inII.width; + inMem.size[2] = reqInfo.inII.height; + inMem.size[3] = reqInfo.inII.stride; + inMem.media_type = iaic_nv12; + inMem.r = reqInfo.inII.bufAddr; + inMem.feature_name = featureName; + inMem.port_name = "in:source"; + inMem.next = nullptr; + + outMem.size[0] = reqInfo.outII.size; + outMem.size[1] = reqInfo.outII.width; + outMem.size[2] = reqInfo.outII.height; + outMem.size[3] = reqInfo.outII.stride; + outMem = inMem; + outMem.port_name = "out:source"; + outMem.r = reqInfo.outII.bufAddr; + outMem.next = &inMem; + + Tnr7Param* tnrParam = static_cast(reqInfo.paramAddr); + LOG2("%s, is first %d", __func__, tnrParam->bc.is_first_frame); + std::unique_lock lock(*mLockMap[key]); + setData(mSessionMap[key], &tnrParam->bc.is_first_frame, sizeof(tnrParam->bc.is_first_frame), + featureName, "tnr7us/pal:is_first_frame"); + setData(mSessionMap[key], &tnrParam->bc.do_update, sizeof(tnrParam->bc.do_update), featureName, + "tnr7us/pal:do_update"); + setData(mSessionMap[key], &tnrParam->bc.tune_sensitivity, sizeof(tnrParam->bc.tune_sensitivity), + featureName, "tnr7us/pal:tune_sensitivity"); + setData(mSessionMap[key], &tnrParam->bc.coeffs, sizeof(tnrParam->bc.coeffs), featureName, + "tnr7us/pal:coeffs"); + setData(mSessionMap[key], &tnrParam->bc.global_protection, + sizeof(tnrParam->bc.global_protection), featureName, "tnr7us/pal:global_protection"); + setData(mSessionMap[key], &tnrParam->bc.global_protection_inv_num_pixels, + sizeof(tnrParam->bc.global_protection_inv_num_pixels), featureName, + "tnr7us/pal:global_protection_inv_num_pixels"); + setData(mSessionMap[key], &tnrParam->bc.global_protection_sensitivity_lut_values, + sizeof(tnrParam->bc.global_protection_sensitivity_lut_values), featureName, + "tnr7us/pal:global_protection_sensitivity_lut_values"); + setData(mSessionMap[key], &tnrParam->bc.global_protection_sensitivity_lut_slopes, + sizeof(tnrParam->bc.global_protection_sensitivity_lut_slopes), featureName, + "tnr7us/pal:global_protection_sensitivity_lut_slopes"); + // tnr7 imTnrSession, ms params + setData(mSessionMap[key], &tnrParam->ims.update_limit, sizeof(tnrParam->ims.update_limit), + featureName, "tnr7us/pal:update_limit"); + setData(mSessionMap[key], &tnrParam->ims.update_coeff, sizeof(tnrParam->ims.update_coeff), + featureName, "tnr7us/pal:update_coeff"); + setData(mSessionMap[key], &tnrParam->ims.d_ml, sizeof(tnrParam->ims.d_ml), featureName, + "tnr7us/pal:d_ml"); + setData(mSessionMap[key], &tnrParam->ims.d_slopes, sizeof(tnrParam->ims.d_slopes), featureName, + "tnr7us/pal:d_slopes"); + setData(mSessionMap[key], &tnrParam->ims.d_top, sizeof(tnrParam->ims.d_top), featureName, + "tnr7us/pal:d_top"); + setData(mSessionMap[key], &tnrParam->ims.outofbounds, sizeof(tnrParam->ims.outofbounds), + featureName, "tnr7us/pal:outofbounds"); + setData(mSessionMap[key], &tnrParam->ims.radial_start, sizeof(tnrParam->ims.radial_start), + featureName, "tnr7us/pal:radial_start"); + setData(mSessionMap[key], &tnrParam->ims.radial_coeff, sizeof(tnrParam->ims.radial_coeff), + featureName, "tnr7us/pal:radial_coeff"); + setData(mSessionMap[key], &tnrParam->ims.frame_center_x, sizeof(tnrParam->ims.frame_center_x), + featureName, "tnr7us/pal:frame_center_x"); + setData(mSessionMap[key], &tnrParam->ims.frame_center_y, sizeof(tnrParam->ims.frame_center_y), + featureName, "tnr7us/pal:frame_center_y"); + setData(mSessionMap[key], &tnrParam->ims.r_coeff, sizeof(tnrParam->ims.r_coeff), featureName, + "tnr7us/pal:r_coeff"); + // tnr7 bmTnrSession, lend params + setData(mSessionMap[key], &tnrParam->blend.max_recursive_similarity, + sizeof(tnrParam->blend.max_recursive_similarity), featureName, + "tnr7us/pal:max_recursive_similarity"); - mem.has_gfx = false; - mem.size[0] = ii.size; - mem.size[1] = ii.width; - mem.size[2] = ii.height; - mem.size[3] = ii.stride; + iaic_memory dummyOut; + dummyOut = inMem; + dummyOut.port_name = nullptr; + dummyOut.r = nullptr; - return mem; + return ::iaic_execute(mSessionMap[key], outMem, dummyOut); } -/* - Due to libintelic2.so's limitations, UF is the only feature supported now. -*/ -std::string IntelOPIC2::buildFeatureStr(const ICBMReqInfo& req) { - if (req.usrFrmEnabled == UF_MODE_ON) { - return std::string(UF_FEATURE_NAME); - } else { - return std::string(); +void IntelOPIC2::setData(iaic_session uid, void* p, size_t size, const char* featureName, + const char* portName) { + iaic_memory setting{}; + setting.has_gfx = false; + setting.feature_name = featureName; + + setting.port_name = portName; + setting.p = p; + setting.size[0] = size; + iaic_set_data(uid, setting); +} + +MemoryChainDescription IntelOPIC2::createMemoryChain(const ICBMReqInfo& reqInfo) { + MemoryChainDescription mCD(reqInfo.inII, reqInfo.outII); + + if (reqInfo.reqType & ICBMReqType::USER_FRAMING) { + mCD.linkIn(gFeatureStrMapping.at(ICBMReqType::USER_FRAMING), "source:source", + "drain:drain"); + } + + if (reqInfo.reqType & ICBMReqType::LEVEL0_TNR) { + mCD.linkIn(gFeatureStrMapping.at(ICBMReqType::LEVEL0_TNR), "in:source", "out:source"); } + + return mCD; } } // namespace icamera diff --git a/src/icbm/OnePunchIC2.h b/src/icbm/OnePunchIC2.h index b6e3065b..bae145e6 100644 --- a/src/icbm/OnePunchIC2.h +++ b/src/icbm/OnePunchIC2.h @@ -19,29 +19,65 @@ #include #include #include +#include #include "src/icbm/ICBMTypes.h" -#include "src/icbm/IntelICBM.h" #include "src/icbm/OPIC2Api.h" +#include "src/icbm/MemoryChain.h" namespace icamera { -class IntelOPIC2 : public IIntelICBM { +class IntelOPIC2 { public: - IntelOPIC2(); - ~IntelOPIC2() {} + static IntelOPIC2* getInstance(); + static void releaseInstance(); + + /** + * \brief create level0 session according to the cameraID and request type + * + * \return 0 if succeed. + */ + int setup(ICBMInitInfo* initParam); - int setup(void* initParam); - void shutdown(); + /** + * \brief shundown level0 session according to the cameraID and request type + * + * \return active session count(>=0) if succeed. <0 if failed + */ + int shutdown(const ICBMReqInfo& reqInfo); - int processFrame(const ImageInfo& iii, const ImageInfo& iio, const ICBMReqInfo& reqInfo); + int processFrame(const ICBMReqInfo& reqInfo); + + /** + * \brief process tnr frame + * + * \return 0 if succeed + */ + int runTnrFrame(const ICBMReqInfo& reqInfo); private: - iaic_session mCtxSession; - std::mutex mCritObject; + static IntelOPIC2* sInstance; + static std::mutex sLock; + + IntelOPIC2(); + ~IntelOPIC2(){}; + // lock for each session, key is from getIndexKey() + std::unordered_map> mLockMap; + // session map, key is from getIndexKey() + std::unordered_map mSessionMap; + // feature vector of each session + std::unordered_map> mFeatureMap; + + // transfer cameraId and type to index of the mSessionMap and mLockMap + int getIndexKey(int cameraId, uint32_t type) { + return (cameraId << ICBM_REQUEST_MAX_SHIFT) + type; + } + + static MemoryChainDescription createMemoryChain(const ICBMReqInfo& reqInfo); - static iaic_memory createMemoryDesc(const ImageInfo& param); - static std::string buildFeatureStr(const ICBMReqInfo& req); + // set parameters to the session before process + void setData(iaic_session uid, void* p, size_t size, const char* featureName, + const char* portName); }; } // namespace icamera diff --git a/src/isp_control/IspControlUtils.cpp b/src/isp_control/IspControlUtils.cpp index 66fb8b8d..691cf13f 100644 --- a/src/isp_control/IspControlUtils.cpp +++ b/src/isp_control/IspControlUtils.cpp @@ -72,7 +72,11 @@ uint32_t IspControlUtils::getTagById(uint32_t ctrlId) { return 0; } -#include "ia_types.h" +// This struct must be same with ia_record_header in ia_types.h +typedef struct { + unsigned int uuid; + unsigned int size; +} ia_header; void* IspControlUtils::findDataById(uint32_t ctrlId, void* fullData, uint32_t size) { CheckAndLogError(fullData == nullptr || size == 0, nullptr, "Invalid input parameters"); @@ -82,11 +86,11 @@ void* IspControlUtils::findDataById(uint32_t ctrlId, void* fullData, uint32_t si // Find the corresponding data from ISP output data. while (offset < size) { - ia_record_header* headerPtr = (ia_record_header*)(pData + offset); + ia_header* headerPtr = (ia_header*)(pData + offset); LOG2("ISP output UUID:%d, size:%d", headerPtr->uuid, headerPtr->size); if (headerPtr->uuid == 0 || headerPtr->size == 0) break; if (ctrlId == headerPtr->uuid) { - char* offsetPtr = pData + (offset + sizeof(ia_record_header)); + char* offsetPtr = pData + (offset + sizeof(ia_header)); return offsetPtr; } offset += headerPtr->size; diff --git a/src/iutils/CameraDump.cpp b/src/iutils/CameraDump.cpp index 7f2c49e7..17be9672 100644 --- a/src/iutils/CameraDump.cpp +++ b/src/iutils/CameraDump.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include @@ -42,6 +44,8 @@ using std::string; namespace icamera { +Thread* gDumpThread = nullptr; + int gDumpType = 0; int gDumpFormat = 0; uint32_t gDumpSkipNum = 0; @@ -83,9 +87,13 @@ void CameraDump::setDumpLevel(void) { } char* cameraDumpPath = getenv(PROP_CAMERA_HAL_DUMP_PATH); - snprintf(gDumpPath, sizeof(gDumpPath), "%s", "./"); + if (cameraDumpPath) { snprintf(gDumpPath, sizeof(gDumpPath), "%s", cameraDumpPath); + LOGI("User defined dump path %s", gDumpPath); + } else { + snprintf(gDumpPath, sizeof(gDumpPath), "%s", "./"); + LOGI("Default dump path %s", gDumpPath); } char* cameraDumpSkipNum = getenv(PROP_CAMERA_HAL_DUMP_SKIP_NUM); @@ -145,6 +153,15 @@ void CameraDump::setDumpLevel(void) { } } +void CameraDump::setDumpThread(void) { + if (!gDumpThread) { + // Default disable AIQDUMP when use dump thread + setenv("AIQDUMP", "disable", 1); + gDumpThread = new DumpThread(); + gDumpThread->run("DumpThread", PRIORITY_NORMAL); + } +} + bool CameraDump::isDumpTypeEnable(int dumpType) { return gDumpType & dumpType; } @@ -420,4 +437,89 @@ void CameraDump::dumpBinary(int cameraId, const void* data, int size, BinParam_t writeData(data, size, fileName.c_str()); } +namespace CameraDump { +DumpThread::DumpThread() {} +DumpThread::~DumpThread() {} + +#define FIFO_NAME "/tmp/cameraDump" +#define BUFFER_SIZE 4096 +bool DumpThread::threadLoop() { + int pipe_fd; + int res; + int open_mode = O_RDONLY; + int bytes_read = 0; + char buffer[BUFFER_SIZE + 1]; + char* equal = nullptr; + const char* PROP_CAMERA_HAL_DUMP = "cameraDump"; + const char* PROP_CAMERA_HAL_DUMP_FORMAT = "cameraDumpFormat"; + const char* PROP_CAMERA_HAL_DUMP_PATH = "cameraDumpPath"; + const char* PROP_CAMERA_HAL_DUMP_SKIP_NUM = "cameraDumpSkipNum"; + const char* PROP_CAMERA_HAL_DUMP_RANGE = "cameraDumpRange"; + const char* PROP_CAMERA_HAL_DUMP_FREQUENCY = "cameraDumpFrequency"; + const char* PROP_AIQDUMP = "AIQDUMP"; + + char fifo_name[BUFFER_SIZE + 1]; + + LOGI("DumpThread start"); + + memset(fifo_name, '\0', sizeof(fifo_name)); + snprintf(fifo_name, BUFFER_SIZE, "%s_%d", FIFO_NAME, getpid()); + if (access(fifo_name, F_OK) == -1) { + res = mkfifo(fifo_name, 0777); + if (res != 0) { + LOGI("Could not create fifo %s", fifo_name); + } + } + + memset(buffer, '\0', sizeof(buffer)); + + pipe_fd = open(fifo_name, open_mode); + LOGI("Process %d opened fd %d", getpid(), pipe_fd); + + if (pipe_fd != -1) { + do { + res = read(pipe_fd, buffer, BUFFER_SIZE); + bytes_read += res; + } while (0); + (void)close(pipe_fd); + } else { + return false; + } + + LOGI("Process %d finished, %s", getpid(), buffer); + equal = strchr(buffer, '='); + if (equal) { + *equal = '\0'; + } else { + return true; + } + + LOGI("%s, %d, %s", __func__, __LINE__, buffer); + if (!strncmp(PROP_CAMERA_HAL_DUMP, buffer, strlen(PROP_CAMERA_HAL_DUMP)) + && strlen(PROP_CAMERA_HAL_DUMP) == strlen(buffer)) { + setenv(PROP_CAMERA_HAL_DUMP, equal + 1, 1); + } else if (!strncmp(PROP_CAMERA_HAL_DUMP_FORMAT, buffer, + strlen(PROP_CAMERA_HAL_DUMP_FORMAT))) { + setenv(PROP_CAMERA_HAL_DUMP_FORMAT, equal + 1, 1); + } else if (!strncmp(PROP_CAMERA_HAL_DUMP_PATH, buffer, + strlen(PROP_CAMERA_HAL_DUMP_PATH))) { + setenv(PROP_CAMERA_HAL_DUMP_PATH, equal + 1, 1); + } else if (!strncmp(PROP_CAMERA_HAL_DUMP_SKIP_NUM, buffer, + strlen(PROP_CAMERA_HAL_DUMP_SKIP_NUM))) { + setenv(PROP_CAMERA_HAL_DUMP_SKIP_NUM, equal + 1, 1); + } else if (!strncmp(PROP_CAMERA_HAL_DUMP_RANGE, buffer, + strlen(PROP_CAMERA_HAL_DUMP_RANGE))) { + setenv(PROP_CAMERA_HAL_DUMP_RANGE, equal + 1, 1); + } else if (!strncmp(PROP_CAMERA_HAL_DUMP_FREQUENCY, buffer, + strlen(PROP_CAMERA_HAL_DUMP_FREQUENCY))) { + setenv(PROP_CAMERA_HAL_DUMP_FREQUENCY, equal + 1, 1); + } else if (!strncmp(PROP_AIQDUMP, buffer, strlen(PROP_AIQDUMP))) { + setenv(PROP_AIQDUMP, equal + 1, 1); + } + setDumpLevel(); + + return true; +} +} // namespace CameraDump + } // namespace icamera diff --git a/src/iutils/CameraDump.h b/src/iutils/CameraDump.h index cb8f583f..3e5f214f 100644 --- a/src/iutils/CameraDump.h +++ b/src/iutils/CameraDump.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-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. @@ -22,6 +22,7 @@ #include #include +#include "iutils/Thread.h" #include "CameraBuffer.h" #include "CameraTypes.h" @@ -142,6 +143,7 @@ namespace CameraDump { * File dump control functions. */ void setDumpLevel(void); +void setDumpThread(void); bool isDumpTypeEnable(int dumpType); bool isDumpFormatEnable(int dumpFormat); void writeData(const void* data, int size, const char* fileName); @@ -155,6 +157,15 @@ void dumpImage(int cameraId, const std::shared_ptr& camBuffer, * Dump any buffer to binary file */ void dumpBinary(int cameraId, const void* data, int size, BinParam_t* binParam); + +class DumpThread : public Thread { +public: + DumpThread(); + ~DumpThread(); + + bool threadLoop(); +}; + } // namespace CameraDump } // namespace icamera diff --git a/src/iutils/CameraLog.cpp b/src/iutils/CameraLog.cpp index 876a27b3..f704662a 100644 --- a/src/iutils/CameraLog.cpp +++ b/src/iutils/CameraLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2022 Intel Corporation. + * Copyright (C) 2015-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. @@ -36,6 +36,7 @@ #include "CameraLog.h" #include "Trace.h" #include "iutils/Utils.h" +#include "CameraDump.h" icamera::LogOutputSink* globalLogSink; extern const char* tagNames[]; @@ -276,6 +277,11 @@ void setDebugLevel(void) { LOG1("Debug level is 0x%x", gLogLevel); } + if (gLogLevel & CAMERA_DEBUG_LOG_DYNAMIC_DUMP) { + CameraDump::setDumpThread(); + LOGI("Dynamic dump is enabled."); + } + for (size_t i = 0; i < TAGS_MAX_NUM; ++i) { globalGroupsDescp[i].level = gLogLevel; } diff --git a/src/iutils/CameraLog.h b/src/iutils/CameraLog.h index 00ce1526..0bd69887 100644 --- a/src/iutils/CameraLog.h +++ b/src/iutils/CameraLog.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2022 Intel Corporation. + * Copyright (C) 2015-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. @@ -86,6 +86,8 @@ enum { CAMERA_DEBUG_LOG_CCA = 1 << 8, CAMERA_DEBUG_LOG_METADATA = 1 << 9, CAMERA_DEBUG_LOG_KERNEL_TOGGLE = 1 << 10, + // [12 - 15] bits + CAMERA_DEBUG_LOG_DYNAMIC_DUMP = 1 << 12, }; enum { @@ -128,7 +130,7 @@ namespace Log { void setDebugLevel(void); void print_log(bool enable, const char* module, const int level, const char* format, ...); bool isDebugLevelEnable(int level); -bool isLogTagEnabled(int tag, int level = 0); +bool isLogTagEnabled(int tag, int level); // DUMP_ENTITY_TOPOLOGY_S bool isDumpMediaTopo(void); // DUMP_ENTITY_TOPOLOGY_E diff --git a/src/iutils/ModuleTags.cpp b/src/iutils/ModuleTags.cpp index 5e68d370..bba451f5 100644 --- a/src/iutils/ModuleTags.cpp +++ b/src/iutils/ModuleTags.cpp @@ -83,7 +83,6 @@ const char* tagNames[] = { "Dvs", "EXIFMaker", "EXIFMetaData", - "EvcpManager", "ExifCreater", "FaceDetection", "FaceDetectionPVL", @@ -106,6 +105,7 @@ const char* tagNames[] = { "HAL_multi_streams_test", "HAL_rotation_test", "HAL_yuv", + "HalAdaptor", "HalV3Utils", "I3AControlFactory", "IA_CIPR_UTILS", @@ -128,14 +128,10 @@ const char* tagNames[] = { "IntelCca", "IntelCcaClient", "IntelCcaServer", - "IntelEVCPClient", - "IntelEVCPServer", - "IntelEvcp", "IntelFDServer", "IntelFaceDetection", "IntelFaceDetectionClient", "IntelGPUAlgoServer", - "IntelIC2", "IntelICBM", "IntelICBMClient", "IntelICBMServer", @@ -205,7 +201,6 @@ const char* tagNames[] = { "Thread", "Trace", "TunningParser", - "UltraManEvcp", "Utils", "V4l2DeviceFactory", "V4l2_device_cc", diff --git a/src/iutils/ModuleTags.h b/src/iutils/ModuleTags.h index 03f22512..e7aca700 100644 --- a/src/iutils/ModuleTags.h +++ b/src/iutils/ModuleTags.h @@ -91,29 +91,29 @@ enum ModuleTags { GENERATED_TAGS_Dvs = 61, GENERATED_TAGS_EXIFMaker = 62, GENERATED_TAGS_EXIFMetaData = 63, - GENERATED_TAGS_EvcpManager = 64, - GENERATED_TAGS_ExifCreater = 65, - GENERATED_TAGS_FaceDetection = 66, - GENERATED_TAGS_FaceDetectionPVL = 67, - GENERATED_TAGS_FaceDetectionResultCallbackManager = 68, - GENERATED_TAGS_FaceSSD = 69, - GENERATED_TAGS_FileSource = 70, - GENERATED_TAGS_GPUExecutor = 71, - GENERATED_TAGS_GenGfx = 72, - GENERATED_TAGS_GfxGen = 73, - GENERATED_TAGS_GraphConfig = 74, - GENERATED_TAGS_GraphConfigImpl = 75, - GENERATED_TAGS_GraphConfigImplClient = 76, - GENERATED_TAGS_GraphConfigManager = 77, - GENERATED_TAGS_GraphConfigPipe = 78, - GENERATED_TAGS_GraphConfigServer = 79, - GENERATED_TAGS_GraphUtils = 80, - GENERATED_TAGS_HAL_FACE_DETECTION_TEST = 81, - GENERATED_TAGS_HAL_basic = 82, - GENERATED_TAGS_HAL_jpeg = 83, - GENERATED_TAGS_HAL_multi_streams_test = 84, - GENERATED_TAGS_HAL_rotation_test = 85, - GENERATED_TAGS_HAL_yuv = 86, + GENERATED_TAGS_ExifCreater = 64, + GENERATED_TAGS_FaceDetection = 65, + GENERATED_TAGS_FaceDetectionPVL = 66, + GENERATED_TAGS_FaceDetectionResultCallbackManager = 67, + GENERATED_TAGS_FaceSSD = 68, + GENERATED_TAGS_FileSource = 69, + GENERATED_TAGS_GPUExecutor = 70, + GENERATED_TAGS_GenGfx = 71, + GENERATED_TAGS_GfxGen = 72, + GENERATED_TAGS_GraphConfig = 73, + GENERATED_TAGS_GraphConfigImpl = 74, + GENERATED_TAGS_GraphConfigImplClient = 75, + GENERATED_TAGS_GraphConfigManager = 76, + GENERATED_TAGS_GraphConfigPipe = 77, + GENERATED_TAGS_GraphConfigServer = 78, + GENERATED_TAGS_GraphUtils = 79, + GENERATED_TAGS_HAL_FACE_DETECTION_TEST = 80, + GENERATED_TAGS_HAL_basic = 81, + GENERATED_TAGS_HAL_jpeg = 82, + GENERATED_TAGS_HAL_multi_streams_test = 83, + GENERATED_TAGS_HAL_rotation_test = 84, + GENERATED_TAGS_HAL_yuv = 85, + GENERATED_TAGS_HalAdaptor = 86, GENERATED_TAGS_HalV3Utils = 87, GENERATED_TAGS_I3AControlFactory = 88, GENERATED_TAGS_IA_CIPR_UTILS = 89, @@ -136,99 +136,94 @@ enum ModuleTags { GENERATED_TAGS_IntelCca = 106, GENERATED_TAGS_IntelCcaClient = 107, GENERATED_TAGS_IntelCcaServer = 108, - GENERATED_TAGS_IntelEVCPClient = 109, - GENERATED_TAGS_IntelEVCPServer = 110, - GENERATED_TAGS_IntelEvcp = 111, - GENERATED_TAGS_IntelFDServer = 112, - GENERATED_TAGS_IntelFaceDetection = 113, - GENERATED_TAGS_IntelFaceDetectionClient = 114, - GENERATED_TAGS_IntelGPUAlgoServer = 115, - GENERATED_TAGS_IntelIC2 = 116, - GENERATED_TAGS_IntelICBM = 117, - GENERATED_TAGS_IntelICBMClient = 118, - GENERATED_TAGS_IntelICBMServer = 119, - GENERATED_TAGS_IntelPGParam = 120, - GENERATED_TAGS_IntelPGParamClient = 121, - GENERATED_TAGS_IntelPGParamS = 122, - GENERATED_TAGS_IntelTNR7US = 123, - GENERATED_TAGS_IntelTNR7USClient = 124, - GENERATED_TAGS_IntelTNRServer = 125, - GENERATED_TAGS_IspControlUtils = 126, - GENERATED_TAGS_IspParamAdaptor = 127, - GENERATED_TAGS_JpegEncoderCore = 128, - GENERATED_TAGS_JpegMaker = 129, - GENERATED_TAGS_LensHw = 130, - GENERATED_TAGS_LensManager = 131, - GENERATED_TAGS_LiveTuning = 132, - GENERATED_TAGS_Ltm = 133, - GENERATED_TAGS_MANUAL_POST_PROCESSING = 134, - GENERATED_TAGS_MakerNote = 135, - GENERATED_TAGS_MediaControl = 136, - GENERATED_TAGS_MetadataConvert = 137, - GENERATED_TAGS_MockCamera3HAL = 138, - GENERATED_TAGS_MockCameraHal = 139, - GENERATED_TAGS_MockSysCall = 140, - GENERATED_TAGS_MsgHandler = 141, - GENERATED_TAGS_OnePunchIC2 = 142, - GENERATED_TAGS_OpenSourceGFX = 143, - GENERATED_TAGS_PGCommon = 144, - GENERATED_TAGS_PGUtils = 145, - GENERATED_TAGS_PSysDAG = 146, - GENERATED_TAGS_PSysPipe = 147, - GENERATED_TAGS_PSysProcessor = 148, - GENERATED_TAGS_ParameterGenerator = 149, - GENERATED_TAGS_ParameterHelper = 150, - GENERATED_TAGS_ParameterResult = 151, - GENERATED_TAGS_Parameters = 152, - GENERATED_TAGS_ParserBase = 153, - GENERATED_TAGS_PipeExecutor = 154, - GENERATED_TAGS_PipeLiteExecutor = 155, - GENERATED_TAGS_PlatformData = 156, - GENERATED_TAGS_PnpDebugControl = 157, - GENERATED_TAGS_PolicyParser = 158, - GENERATED_TAGS_PostProcessor = 159, - GENERATED_TAGS_PostProcessorBase = 160, - GENERATED_TAGS_PostProcessorCore = 161, - GENERATED_TAGS_PrivacyControl = 162, - GENERATED_TAGS_PrivateStream = 163, - GENERATED_TAGS_ProcessorManager = 164, - GENERATED_TAGS_RequestManager = 165, - GENERATED_TAGS_RequestThread = 166, - GENERATED_TAGS_ResultProcessor = 167, - GENERATED_TAGS_SWJpegEncoder = 168, - GENERATED_TAGS_SWPostProcessor = 169, - GENERATED_TAGS_SchedPolicy = 170, - GENERATED_TAGS_Scheduler = 171, - GENERATED_TAGS_SensorHwCtrl = 172, - GENERATED_TAGS_SensorManager = 173, - GENERATED_TAGS_SensorOB = 174, - GENERATED_TAGS_ShareRefer = 175, - GENERATED_TAGS_SofSource = 176, - GENERATED_TAGS_StreamBuffer = 177, - GENERATED_TAGS_SwImageConverter = 178, - GENERATED_TAGS_SwImageProcessor = 179, - GENERATED_TAGS_SyncManager = 180, - GENERATED_TAGS_SysCall = 181, - GENERATED_TAGS_TCPServer = 182, - GENERATED_TAGS_Thread = 183, - GENERATED_TAGS_Trace = 184, - GENERATED_TAGS_TunningParser = 185, - GENERATED_TAGS_UltraManEvcp = 186, - GENERATED_TAGS_Utils = 187, - GENERATED_TAGS_V4l2DeviceFactory = 188, - GENERATED_TAGS_V4l2_device_cc = 189, - GENERATED_TAGS_V4l2_subdevice_cc = 190, - GENERATED_TAGS_V4l2_video_node_cc = 191, - GENERATED_TAGS_VendorTags = 192, - GENERATED_TAGS_camera_metadata_tests = 193, - GENERATED_TAGS_icamera_metadata_base = 194, - GENERATED_TAGS_metadata_test = 195, - ST_FPS = 196, - ST_GPU_TNR = 197, - ST_STATS = 198, + GENERATED_TAGS_IntelFDServer = 109, + GENERATED_TAGS_IntelFaceDetection = 110, + GENERATED_TAGS_IntelFaceDetectionClient = 111, + GENERATED_TAGS_IntelGPUAlgoServer = 112, + GENERATED_TAGS_IntelICBM = 113, + GENERATED_TAGS_IntelICBMClient = 114, + GENERATED_TAGS_IntelICBMServer = 115, + GENERATED_TAGS_IntelPGParam = 116, + GENERATED_TAGS_IntelPGParamClient = 117, + GENERATED_TAGS_IntelPGParamS = 118, + GENERATED_TAGS_IntelTNR7US = 119, + GENERATED_TAGS_IntelTNR7USClient = 120, + GENERATED_TAGS_IntelTNRServer = 121, + GENERATED_TAGS_IspControlUtils = 122, + GENERATED_TAGS_IspParamAdaptor = 123, + GENERATED_TAGS_JpegEncoderCore = 124, + GENERATED_TAGS_JpegMaker = 125, + GENERATED_TAGS_LensHw = 126, + GENERATED_TAGS_LensManager = 127, + GENERATED_TAGS_LiveTuning = 128, + GENERATED_TAGS_Ltm = 129, + GENERATED_TAGS_MANUAL_POST_PROCESSING = 130, + GENERATED_TAGS_MakerNote = 131, + GENERATED_TAGS_MediaControl = 132, + GENERATED_TAGS_MetadataConvert = 133, + GENERATED_TAGS_MockCamera3HAL = 134, + GENERATED_TAGS_MockCameraHal = 135, + GENERATED_TAGS_MockSysCall = 136, + GENERATED_TAGS_MsgHandler = 137, + GENERATED_TAGS_OnePunchIC2 = 138, + GENERATED_TAGS_OpenSourceGFX = 139, + GENERATED_TAGS_PGCommon = 140, + GENERATED_TAGS_PGUtils = 141, + GENERATED_TAGS_PSysDAG = 142, + GENERATED_TAGS_PSysPipe = 143, + GENERATED_TAGS_PSysProcessor = 144, + GENERATED_TAGS_ParameterGenerator = 145, + GENERATED_TAGS_ParameterHelper = 146, + GENERATED_TAGS_ParameterResult = 147, + GENERATED_TAGS_Parameters = 148, + GENERATED_TAGS_ParserBase = 149, + GENERATED_TAGS_PipeExecutor = 150, + GENERATED_TAGS_PipeLiteExecutor = 151, + GENERATED_TAGS_PlatformData = 152, + GENERATED_TAGS_PnpDebugControl = 153, + GENERATED_TAGS_PolicyParser = 154, + GENERATED_TAGS_PostProcessor = 155, + GENERATED_TAGS_PostProcessorBase = 156, + GENERATED_TAGS_PostProcessorCore = 157, + GENERATED_TAGS_PrivacyControl = 158, + GENERATED_TAGS_PrivateStream = 159, + GENERATED_TAGS_ProcessorManager = 160, + GENERATED_TAGS_RequestManager = 161, + GENERATED_TAGS_RequestThread = 162, + GENERATED_TAGS_ResultProcessor = 163, + GENERATED_TAGS_SWJpegEncoder = 164, + GENERATED_TAGS_SWPostProcessor = 165, + GENERATED_TAGS_SchedPolicy = 166, + GENERATED_TAGS_Scheduler = 167, + GENERATED_TAGS_SensorHwCtrl = 168, + GENERATED_TAGS_SensorManager = 169, + GENERATED_TAGS_SensorOB = 170, + GENERATED_TAGS_ShareRefer = 171, + GENERATED_TAGS_SofSource = 172, + GENERATED_TAGS_StreamBuffer = 173, + GENERATED_TAGS_SwImageConverter = 174, + GENERATED_TAGS_SwImageProcessor = 175, + GENERATED_TAGS_SyncManager = 176, + GENERATED_TAGS_SysCall = 177, + GENERATED_TAGS_TCPServer = 178, + GENERATED_TAGS_Thread = 179, + GENERATED_TAGS_Trace = 180, + GENERATED_TAGS_TunningParser = 181, + GENERATED_TAGS_Utils = 182, + GENERATED_TAGS_V4l2DeviceFactory = 183, + GENERATED_TAGS_V4l2_device_cc = 184, + GENERATED_TAGS_V4l2_subdevice_cc = 185, + GENERATED_TAGS_V4l2_video_node_cc = 186, + GENERATED_TAGS_VendorTags = 187, + GENERATED_TAGS_camera_metadata_tests = 188, + GENERATED_TAGS_icamera_metadata_base = 189, + GENERATED_TAGS_metadata_test = 190, + ST_FPS = 191, + ST_GPU_TNR = 192, + ST_STATS = 193, }; -#define TAGS_MAX_NUM 199 +#define TAGS_MAX_NUM 194 #endif // !!! DO NOT EDIT THIS FILE !!! diff --git a/src/iutils/Utils.cpp b/src/iutils/Utils.cpp index bac49883..e22bddab 100644 --- a/src/iutils/Utils.cpp +++ b/src/iutils/Utils.cpp @@ -30,8 +30,8 @@ #include #include -#include "PlatformData.h" #include "iutils/CameraLog.h" +#include "iutils/Errors.h" #include "linux/ipu-isys.h" #include "linux/media-bus-format.h" @@ -621,19 +621,6 @@ int CameraUtils::getInterlaceHeight(int field, int height) { return height; } -bool CameraUtils::isMultiExposureCase(int cameraId, TuningMode tuningMode) { - // HDR_FEATURE_S - if (tuningMode == TUNING_MODE_VIDEO_HDR || tuningMode == TUNING_MODE_VIDEO_HDR2 || - tuningMode == TUNING_MODE_VIDEO_HLC) { - return true; - } else if (PlatformData::getSensorAeEnable(cameraId)) { - return true; - } - // HDR_FEATURE_E - - return false; -} - bool CameraUtils::isUllPsysPipe(TuningMode tuningMode) { return (tuningMode == TUNING_MODE_VIDEO_ULL || tuningMode == TUNING_MODE_VIDEO_CUSTOM_AIC); } diff --git a/src/iutils/Utils.h b/src/iutils/Utils.h index 9ba656b4..37396bf6 100644 --- a/src/iutils/Utils.h +++ b/src/iutils/Utils.h @@ -276,8 +276,6 @@ void getSubDeviceName(const char* entityName, std::string& deviceNodeName); int getInterlaceHeight(int field, int height); -bool isMultiExposureCase(int cameraId, TuningMode tuningMode); - bool isUllPsysPipe(TuningMode tuningMode); ConfigMode getConfigModeByName(const char* ConfigName); diff --git a/src/metadata/ParameterGenerator.cpp b/src/metadata/ParameterGenerator.cpp index 5ee4e5d6..147e8b14 100644 --- a/src/metadata/ParameterGenerator.cpp +++ b/src/metadata/ParameterGenerator.cpp @@ -40,6 +40,7 @@ namespace icamera { ParameterGenerator::ParameterGenerator(int cameraId) : mCameraId(cameraId), + mCallback(nullptr), mTonemapMaxCurvePoints(0) { reset(); @@ -295,7 +296,6 @@ int ParameterGenerator::getRequestId(int64_t sequence, long& requestId) { int ParameterGenerator::generateParametersL(int64_t sequence, Parameters* params) { if (PlatformData::isEnableAIQ(mCameraId)) { updateWithAiqResultsL(sequence, params); - updateTonemapCurve(sequence, params); } return OK; } @@ -310,7 +310,7 @@ int ParameterGenerator::updateWithAiqResultsL(int64_t sequence, Parameters* para aiqResult->mAeResults.exposures[0].converged ? AE_STATE_CONVERGED : AE_STATE_NOT_CONVERGED; params->setAeState(aeState); - if (CameraUtils::isMultiExposureCase(mCameraId, aiqResult->mTuningMode) && + if (PlatformData::isMultiExposureCase(mCameraId, aiqResult->mTuningMode) && aiqResult->mAeResults.num_exposures > 1) { params->setExposureTime(aiqResult->mAeResults.exposures[1].exposure[0].exposure_time_us); } else { @@ -440,32 +440,6 @@ int ParameterGenerator::updateCcmL(Parameters* params, const AiqResult* aiqResul return OK; } -int ParameterGenerator::updateTonemapCurve(int64_t sequence, Parameters* params) { - if (!mTonemapMaxCurvePoints) return OK; - - const AiqResult* aiqResult = AiqResultStorage::getInstance(mCameraId)->getAiqResult(sequence); - CheckAndLogError((aiqResult == nullptr), UNKNOWN_ERROR, - "%s Aiq result of sequence %ld does not exist", __func__, sequence); - const cca::cca_gbce_params& gbceResults = aiqResult->mGbceResults; - - int multiplier = gbceResults.gamma_lut_size / mTonemapMaxCurvePoints; - for (int32_t i = 0; i < mTonemapMaxCurvePoints; i++) { - mTonemapCurveRed[i * 2 + 1] = gbceResults.r_gamma_lut[i * multiplier]; - mTonemapCurveBlue[i * 2 + 1] = gbceResults.g_gamma_lut[i * multiplier]; - mTonemapCurveGreen[i * 2 + 1] = gbceResults.b_gamma_lut[i * multiplier]; - } - - int count = mTonemapMaxCurvePoints * 2; - camera_tonemap_curves_t curves = {count, - count, - count, - mTonemapCurveRed.get(), - mTonemapCurveBlue.get(), - mTonemapCurveGreen.get()}; - params->setTonemapCurves(curves); - return OK; -} - int ParameterGenerator::updateCommonMetadata(Parameters* params, const AiqResult* aiqResult) { icamera_metadata_ro_entry entry; CLEAR(entry); @@ -483,12 +457,17 @@ int ParameterGenerator::updateCommonMetadata(Parameters* params, const AiqResult entry.data.i64 = &frameDuration; ParameterHelper::mergeTag(entry, params); + int32_t userRequestId = 0; + params->getUserRequestId(userRequestId); + camera_msg_data_t data = {CAMERA_METADATA_ENTRY, {}}; + data.data.metadata_entry.frameNumber = userRequestId; + bool callbackRgbs = false; params->getCallbackRgbs(&callbackRgbs); if (callbackRgbs) { - int32_t width = aiqResult->mOutStats.rgbs_grid.grid_width; - int32_t height = aiqResult->mOutStats.rgbs_grid.grid_height; + int32_t width = aiqResult->mOutStats.rgbs_grid[0].grid_width; + int32_t height = aiqResult->mOutStats.rgbs_grid[0].grid_height; int32_t gridSize[] = {width, height}; entry.tag = INTEL_VENDOR_CAMERA_RGBS_GRID_SIZE; entry.type = ICAMERA_TYPE_INT32; @@ -496,17 +475,17 @@ int ParameterGenerator::updateCommonMetadata(Parameters* params, const AiqResult entry.data.i32 = gridSize; ParameterHelper::mergeTag(entry, params); - uint8_t lscFlags = aiqResult->mOutStats.rgbs_grid.shading_correction; + uint8_t lscFlags = aiqResult->mOutStats.rgbs_grid[0].shading_correction; entry.tag = INTEL_VENDOR_CAMERA_SHADING_CORRECTION; entry.type = ICAMERA_TYPE_BYTE; entry.count = 1; entry.data.u8 = &lscFlags; ParameterHelper::mergeTag(entry, params); - if (Log::isLogTagEnabled(ST_STATS)) { + if (Log::isLogTagEnabled(ST_STATS, CAMERA_DEBUG_LOG_LEVEL2)) { const cca::cca_out_stats* outStats = &aiqResult->mOutStats; - const rgbs_grid_block* rgbsPtr = aiqResult->mOutStats.rgbs_blocks; - int size = outStats->rgbs_grid.grid_width * outStats->rgbs_grid.grid_height; + const rgbs_grid_block* rgbsPtr = aiqResult->mOutStats.rgbs_blocks[0]; + int size = outStats->rgbs_grid[0].grid_width * outStats->rgbs_grid[0].grid_height; int sumLuma = 0; for (int j = 0; j < size; j++) { @@ -516,15 +495,23 @@ int ParameterGenerator::updateCommonMetadata(Parameters* params, const AiqResult } LOG2(ST_STATS, "RGB stat %dx%d, sequence %lld, y_mean %d", - outStats->rgbs_grid.grid_width, outStats->rgbs_grid.grid_height, + outStats->rgbs_grid[0].grid_width, outStats->rgbs_grid[0].grid_height, aiqResult->mSequence, size > 0 ? sumLuma / size : 0); } - entry.tag = INTEL_VENDOR_CAMERA_RGBS_STATS_BLOCKS; - entry.type = ICAMERA_TYPE_BYTE; - entry.count = width * height * 5; - entry.data.u8 = reinterpret_cast(aiqResult->mOutStats.rgbs_blocks); - ParameterHelper::mergeTag(entry, params); + if (mCallback) { + data.data.metadata_entry.tag = INTEL_VENDOR_CAMERA_RGBS_STATS_BLOCKS; + data.data.metadata_entry.count = width * height * 5; + data.data.metadata_entry.data.u8 = + reinterpret_cast(aiqResult->mOutStats.rgbs_blocks[0]); + mCallback->notify(mCallback, data); + } else { + entry.tag = INTEL_VENDOR_CAMERA_RGBS_STATS_BLOCKS; + entry.type = ICAMERA_TYPE_BYTE; + entry.count = width * height * 5; + entry.data.u8 = reinterpret_cast(aiqResult->mOutStats.rgbs_blocks[0]); + ParameterHelper::mergeTag(entry, params); + } } if (aiqResult->mAiqParam.manualExpTimeUs <= 0 && aiqResult->mAiqParam.manualIso <= 0) { @@ -550,11 +537,53 @@ int ParameterGenerator::updateCommonMetadata(Parameters* params, const AiqResult tmCurve[i * 2] = static_cast(i) / (mTonemapMaxCurvePoints - 1); tmCurve[i * 2 + 1] = gbceResults.tone_map_lut[i * multiplier]; } - entry.tag = INTEL_VENDOR_CAMERA_TONE_MAP_CURVE; - entry.type = ICAMERA_TYPE_FLOAT; - entry.count = tmCurve.size(); - entry.data.f = tmCurve.data(); - ParameterHelper::mergeTag(entry, params); + + if (mCallback) { + data.data.metadata_entry.tag = INTEL_VENDOR_CAMERA_TONE_MAP_CURVE; + data.data.metadata_entry.count = tmCurve.size(); + data.data.metadata_entry.data.f = tmCurve.data(); + mCallback->notify(mCallback, data); + } else { + entry.tag = INTEL_VENDOR_CAMERA_TONE_MAP_CURVE; + entry.type = ICAMERA_TYPE_FLOAT; + entry.count = tmCurve.size(); + entry.data.f = tmCurve.data(); + ParameterHelper::mergeTag(entry, params); + } + } + + if (mTonemapMaxCurvePoints) { + const cca::cca_gbce_params& gbceResults = aiqResult->mGbceResults; + + int multiplier = gbceResults.gamma_lut_size / mTonemapMaxCurvePoints; + for (int32_t i = 0; i < mTonemapMaxCurvePoints; i++) { + mTonemapCurveRed[i * 2 + 1] = gbceResults.r_gamma_lut[i * multiplier]; + mTonemapCurveBlue[i * 2 + 1] = gbceResults.g_gamma_lut[i * multiplier]; + mTonemapCurveGreen[i * 2 + 1] = gbceResults.b_gamma_lut[i * multiplier]; + } + + int count = mTonemapMaxCurvePoints * 2; + camera_tonemap_curves_t curves = {count, count, count, mTonemapCurveRed.get(), + mTonemapCurveBlue.get(), mTonemapCurveGreen.get()}; + + if (mCallback) { + data.data.metadata_entry.tag = CAMERA_TONEMAP_CURVE_RED; + data.data.metadata_entry.count = count; + data.data.metadata_entry.data.f = mTonemapCurveRed.get(); + mCallback->notify(mCallback, data); + + data.data.metadata_entry.tag = CAMERA_TONEMAP_CURVE_BLUE; + data.data.metadata_entry.count = count; + data.data.metadata_entry.data.f = mTonemapCurveBlue.get(); + mCallback->notify(mCallback, data); + + data.data.metadata_entry.tag = CAMERA_TONEMAP_CURVE_GREEN; + data.data.metadata_entry.count = count; + data.data.metadata_entry.data.f = mTonemapCurveGreen.get(); + mCallback->notify(mCallback, data); + } else { + params->setTonemapCurves(curves); + } } return OK; diff --git a/src/metadata/ParameterGenerator.h b/src/metadata/ParameterGenerator.h index d8e23c68..bcacec5f 100644 --- a/src/metadata/ParameterGenerator.h +++ b/src/metadata/ParameterGenerator.h @@ -54,6 +54,9 @@ class ParameterGenerator { * \brief reset the parameters data. */ int reset(); + void callbackRegister(const camera_callback_ops_t* callback) { + mCallback = const_cast(callback); + } /** * \brief Save parameters with sequence id indicating the active frame. @@ -85,12 +88,12 @@ class ParameterGenerator { int updateWithAiqResultsL(int64_t sequence, Parameters* params); int updateAwbGainsL(Parameters* params, const cca::cca_awb_results& result); int updateCcmL(Parameters* params, const AiqResult* aiqResult); - int updateTonemapCurve(int64_t sequence, Parameters* params); int updateCommonMetadata(Parameters* params, const AiqResult* aiqResult); private: int mCameraId; + camera_callback_ops_t* mCallback; static const int kStorageSize = MAX_SETTING_COUNT; // Guard for ParameterGenerator public API. diff --git a/src/metadata/Parameters.cpp b/src/metadata/Parameters.cpp index f58e8a2e..8fae387f 100644 --- a/src/metadata/Parameters.cpp +++ b/src/metadata/Parameters.cpp @@ -21,7 +21,6 @@ #include "iutils/CameraDump.h" #include "iutils/Utils.h" -#include "PlatformData.h" #include "Parameters.h" #include "ParameterHelper.h" @@ -1696,7 +1695,6 @@ int Parameters::getSensorMountType(camera_mount_type_t& sensorMountType) const { // User can set envrionment and then call api to update the debug level. int Parameters::updateDebugLevel() { Log::setDebugLevel(); - CameraDump::setDumpLevel(); return OK; } @@ -2065,79 +2063,6 @@ int Parameters::getCallbackTmCurve(bool* enabled) const { return OK; } -// ENABLE_EVCP_S -int Parameters::setEvcpEccMode(uint8_t enabled) { - ParameterHelper::AutoWLock wl(mData); - return ParameterHelper::getMetadata(mData).update(INTEL_VENDOR_CAMERA_IC_ECC_MODE, &enabled, 1); -} -int Parameters::getEvcpEccMode(uint8_t* enabled) const { - ParameterHelper::AutoRLock rl(mData); - auto entry = ParameterHelper::getMetadataEntry(mData, INTEL_VENDOR_CAMERA_IC_ECC_MODE); - - if (entry.count != 1) { - return NAME_NOT_FOUND; - } - - *enabled = entry.data.u8[0]; - return OK; -} - -int Parameters::setEvcpBCMode(uint8_t mode) { - ParameterHelper::AutoWLock wl(mData); - return ParameterHelper::getMetadata(mData).update(INTEL_VENDOR_CAMERA_IC_BC_MODE, &mode, 1); -} -int Parameters::getEvcpBCMode(uint8_t* mode) const { - ParameterHelper::AutoRLock rl(mData); - auto entry = ParameterHelper::getMetadataEntry(mData, INTEL_VENDOR_CAMERA_IC_BC_MODE); - - if (entry.count != 1) { - return NAME_NOT_FOUND; - } - - *mode = entry.data.u8[0]; - - return OK; -} - -int Parameters::setEvcpBRParameters(int height, int width, int fd) { - ParameterHelper::AutoWLock wl(mData); - int32_t values[3] = {width, height, fd}; - return ParameterHelper::getMetadata(mData).update(INTEL_VENDOR_CAMERA_IC_BR_PARAMETERS, values, - 3); -} - -int Parameters::getEvcpBRParameters(int* height, int* width, int* fd) const { - ParameterHelper::AutoRLock rl(mData); - auto entry = ParameterHelper::getMetadataEntry(mData, INTEL_VENDOR_CAMERA_IC_BR_PARAMETERS); - - if (entry.count != 3) { - return NAME_NOT_FOUND; - } - - *height = entry.data.i32[0]; - *width = entry.data.i32[1]; - *fd = entry.data.i32[2]; - - return OK; -} - -int Parameters::setEvcpFFMode(uint8_t mode) { - ParameterHelper::AutoWLock wl(mData); - return ParameterHelper::getMetadata(mData).update(INTEL_VENDOR_CAMERA_IC_UF_MODE, &mode, 1); -} -int Parameters::getEvcpFFMode(uint8_t* mode) const { - ParameterHelper::AutoRLock rl(mData); - auto entry = ParameterHelper::getMetadataEntry(mData, INTEL_VENDOR_CAMERA_IC_UF_MODE); - - if (entry.count != 1) { - return NAME_NOT_FOUND; - } - - *mode = entry.data.u8[0]; - return OK; -} -// ENABLE_EVCP_E - int Parameters::setZoomRegion(const camera_zoom_region_t& region) { ParameterHelper::AutoWLock wl(mData); int32_t values[4] = {region.left, region.top, region.right, region.bottom}; diff --git a/src/platformdata/CameraParser.cpp b/src/platformdata/CameraParser.cpp index af6b5ea8..51e33eae 100644 --- a/src/platformdata/CameraParser.cpp +++ b/src/platformdata/CameraParser.cpp @@ -306,10 +306,6 @@ void CameraParser::handleCommon(CameraParser* profiles, const char* name, const cfg->supportHwJpegEncode = strcmp(atts[1], "true") == 0; } else if (strcmp(name, "maxIsysTimeoutValue") == 0) { cfg->maxIsysTimeoutValue = atoi(atts[1]); - // ENABLE_EVCP_S - } else if (strcmp(name, "useGpuEvcp") == 0) { - cfg->isGpuEvcpEnabled = strcmp(atts[1], "true") == 0; - // ENABLE_EVCP_E // LEVEL0_ICBM_S } else if (strcmp(name, "useGPUICBM") == 0) { cfg->isGPUICBMEnabled = strcmp(atts[1], "true") == 0; @@ -680,6 +676,18 @@ void CameraParser::handleSensor(CameraParser* profiles, const char* name, const pCurrentCam->mPLCEnable = strcmp(atts[1], "true") == 0; } else if (strcmp(name, "stillOnlyPipe") == 0) { pCurrentCam->mStillOnlyPipe = strcmp(atts[1], "true") == 0; + // VIRTUAL_CHANNEL_S + } else if (strcmp(name, "vcAggregator") == 0) { + int size = strlen(atts[1]); + char src[size + 1]; + MEMCPY_S(src, size, atts[1], size); + src[size] = '\0'; + char* savePtr = nullptr; + char* tablePtr = strtok_r(src, ",", &savePtr); + if (tablePtr) pCurrentCam->mVcAggregator.mName = tablePtr; + tablePtr = strtok_r(nullptr, ",", &savePtr); + if (tablePtr) pCurrentCam->mVcAggregator.mIndex = atoi(tablePtr); + // VIRTUAL_CHANNEL_E } else if (strcmp(name, "disableBLCByAGain") == 0) { int size = strlen(atts[1]); char src[size + 1]; diff --git a/src/platformdata/CameraTypes.h b/src/platformdata/CameraTypes.h index bf114f24..a50ce189 100644 --- a/src/platformdata/CameraTypes.h +++ b/src/platformdata/CameraTypes.h @@ -195,9 +195,6 @@ struct CommonConfig { bool supportIspTuningUpdate; bool supportHwJpegEncode; int maxIsysTimeoutValue; - // ENABLE_EVCP_S - bool isGpuEvcpEnabled; - // ENABLE_EVCP_E // LEVEL0_ICBM_S bool isGPUICBMEnabled; bool useLevel0Tnr; @@ -214,9 +211,6 @@ struct CommonConfig { supportIspTuningUpdate = false; supportHwJpegEncode = true; maxIsysTimeoutValue = 0; - // ENABLE_EVCP_S - isGpuEvcpEnabled = false; - // ENABLE_EVCP_E // LEVEL0_ICBM_S isGPUICBMEnabled = false; useLevel0Tnr = false; @@ -275,4 +269,11 @@ typedef enum { DISPERSED, } GraphSettingType; +// VIRTUAL_CHANNEL_S +struct VcAggregator { + VcAggregator() { mIndex = -1; } + int mIndex; + std::string mName; +}; +// VIRTUAL_CHANNEL_E } /* namespace icamera */ diff --git a/src/platformdata/PlatformData.cpp b/src/platformdata/PlatformData.cpp index d66c3718..d238af9d 100644 --- a/src/platformdata/PlatformData.cpp +++ b/src/platformdata/PlatformData.cpp @@ -455,6 +455,19 @@ int PlatformData::isUseFixedHDRExposureInfo(int cameraId) { } // HDR_FEATURE_E +bool PlatformData::isMultiExposureCase(int cameraId, TuningMode tuningMode) { + // HDR_FEATURE_S + if (tuningMode == TUNING_MODE_VIDEO_HDR || tuningMode == TUNING_MODE_VIDEO_HDR2 || + tuningMode == TUNING_MODE_VIDEO_HLC) { + return true; + } else if (getSensorAeEnable(cameraId)) { + return true; + } + // HDR_FEATURE_E + + return false; +} + int PlatformData::getSensorExposureType(int cameraId) { return getInstance()->mStaticCfg.mCameras[cameraId].mSensorExposureType; } @@ -1432,6 +1445,14 @@ int PlatformData::getVirtualChannelSequence(int cameraId) { return -1; } + +int PlatformData::getVcAggregator(int cameraId, struct VcAggregator& aggregator) { + if (getInstance()->mStaticCfg.mCameras[cameraId].mVcAggregator.mIndex >= 0) { + aggregator = getInstance()->mStaticCfg.mCameras[cameraId].mVcAggregator; + return OK; + } + return NO_ENTRY; +} // VIRTUAL_CHANNEL_E camera_resolution_t* PlatformData::getPslOutputForRotation(int width, int height, int cameraId) { @@ -1509,9 +1530,14 @@ camera_coordinate_system_t PlatformData::getActivePixelArray(int cameraId) { } string PlatformData::getCameraCfgPath() { - char* p = getenv("CAMERA_CFG_PATH"); + string cfgPath = string(CAMERA_DEFAULT_CFG_PATH); +#ifdef SUB_CONFIG_PATH + cfgPath += string(SUB_CONFIG_PATH); + cfgPath.append("/"); +#endif - return p ? string(p) : string(CAMERA_DEFAULT_CFG_PATH); + char* p = getenv("CAMERA_CFG_PATH"); + return p ? string(p) : cfgPath; } string PlatformData::getGraphDescFilePath() { @@ -1660,9 +1686,6 @@ int PlatformData::getMaxIsysTimeout() { bool PlatformData::isUsingGpuAlgo() { bool enabled = false; enabled |= isGpuTnrEnabled(); - // ENABLE_EVCP_S - enabled |= isGpuEvcpEnabled(); - // ENABLE_EVCP_E // LEVEL0_ICBM_S enabled |= isGPUICBMEnabled() || useLevel0Tnr(); // LEVEL0_ICBM_E @@ -1705,12 +1728,6 @@ bool PlatformData::getPLCEnable(int cameraId) { return getInstance()->mStaticCfg.mCameras[cameraId].mPLCEnable; } -// ENABLE_EVCP_S -bool PlatformData::isGpuEvcpEnabled() { - return getInstance()->mStaticCfg.mCommonConfig.isGpuEvcpEnabled; -} -// ENABLE_EVCP_E - bool PlatformData::isStillOnlyPipeEnabled(int cameraId) { return getInstance()->mStaticCfg.mCameras[cameraId].mStillOnlyPipe; } diff --git a/src/platformdata/PlatformData.h b/src/platformdata/PlatformData.h index 5d6fb50d..c2be0d49 100644 --- a/src/platformdata/PlatformData.h +++ b/src/platformdata/PlatformData.h @@ -215,6 +215,7 @@ class PlatformData { int mVCNum; int mVCSeq; int mVCGroupId; + VcAggregator mVcAggregator; // VIRTUAL_CHANNEL_E int mLensHwType; bool mEnablePdaf; @@ -670,6 +671,15 @@ class PlatformData { static int isUseFixedHDRExposureInfo(int cameraId); // HDR_FEATURE_E + /** + * Get if multi exposure cases or not + * + * \param cameraId: [0, MAX_CAMERA_NUMBER - 1] + * \param[in] TuningMode: tuningMode + * \return true if multi exposure case + */ + static bool isMultiExposureCase(int cameraId, TuningMode tuningMode); + /** * Get sensor exposure type * @@ -1349,6 +1359,15 @@ class PlatformData { * \return sequence if Virtual channel supported, otherwise return -1. */ static int getVirtualChannelSequence(int cameraId); + + /** + * Get aggregator info + * + * \param cameraId: [0, MAX_CAMERA_NUMBER - 1] + * \param aggregator: Struct VcAggregator + * \return OK if found, otherwise return NO_ENTRY. + */ + static int getVcAggregator(int cameraId, struct VcAggregator& aggregator); // VIRTUAL_CHANNEL_E /** @@ -1634,15 +1653,6 @@ class PlatformData { */ static bool getPLCEnable(int cameraId); - // ENABLE_EVCP_S - /** - * Check GPU EVCP is enabled or not - * - * \return true if EVCP is enabled. - */ - static bool isGpuEvcpEnabled(); - // ENABLE_EVCP_E - /** * Check support of still-only pipe is enabled or not *