diff --git a/CMakeLists.txt b/CMakeLists.txt index a4f50689..cbd2c954 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,7 +251,8 @@ if (NOT CAL_BUILD) find_package(LIBDRM) if(LIBDRM_FOUND AND ("${LIBDRM_VERSION}" VERSION_GREATER_EQUAL 2.4.114)) include_directories(${LIBDRM_INCLUDE_DIRS}) - set(LIBCAMHAL_LINK_LIBS ${LIBCAMHAL_LINK_LIBS} ${LIBDRM_LIBS}) + link_directories(${LIBDRM_LIBRARY_DIRS}) + set(LIBCAMHAL_LINK_LIBS ${LIBCAMHAL_LINK_LIBS} ${LIBDRM_LIBRARIES}) add_definitions(-DLIBDRM_SUPPORT_MMAP_OFFSET) endif() endif() @@ -331,28 +332,32 @@ endif() # Link ia_imaging find_package(IA_IMAGING) set(TARGET_INCLUDE ${TARGET_INCLUDE} ${IA_IMAGING${TARGET_SUFFIX}_INCLUDE_DIRS}) - set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${IA_IMAGING${TARGET_SUFFIX}_LIBS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${IA_IMAGING${TARGET_SUFFIX}_LIBRARIES}) + link_directories(${IA_IMAGING${TARGET_SUFFIX}_LIBRARY_DIRS}) if(USE_PG_LITE_PIPE) find_package(LIBGCSS) set(TARGET_INCLUDE ${TARGET_INCLUDE} ${LIBGCSS${TARGET_SUFFIX}_INCLUDE_DIRS}) - set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBGCSS${TARGET_SUFFIX}_LIBS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBGCSS${TARGET_SUFFIX}_LIBRARIES}) + link_directories(${LIBGCSS${TARGET_SUFFIX}_LIBRARY_DIRS}) # Include libipu(4) headers find_package(LIBIPU) set(TARGET_INCLUDE ${TARGET_INCLUDE} ${LIBIPU${TARGET_SUFFIX}_INCLUDE_DIRS}) - set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBIPU${TARGET_SUFFIX}_LIBS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBIPU${TARGET_SUFFIX}_LIBRARIES}) + link_directories(${LIBIPU${TARGET_SUFFIX}_LIBRARY_DIRS}) else() # Link libiacss find_package(LIBIACSS) set(TARGET_INCLUDE ${TARGET_INCLUDE} ${LIBIACSS${TARGET_SUFFIX}_INCLUDE_DIRS}) - set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBIACSS${TARGET_SUFFIX}_LIBS}) + set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS} ${LIBIACSS${TARGET_SUFFIX}_LIBRARIES}) + link_directories(${LIBIACSS${TARGET_SUFFIX}_LIBRARY_DIRS}) endif() #--------------------------- Add libcamhal target --------------------------- if (BUILD_CAMHAL_PLUGIN) - set(CAMHAL_TARGET ${IPU_VER}) - set(CAMHAL_STATIC_TARGET ${IPU_VER}_static) + set(CAMHAL_TARGET camhal${IPU_VER}) + set(CAMHAL_STATIC_TARGET camhal${IPU_VER}_static) else() set(CAMHAL_TARGET camhal) set(CAMHAL_STATIC_TARGET camhal_static) @@ -386,6 +391,7 @@ else() set_target_properties(${CAMHAL_TARGET} PROPERTIES OUTPUT_NAME ${CAMHAL_TARGET}) endif() + #--------------------------- Install settings --------------------------- if (NOT CAL_BUILD) if (NOT BUILD_CAMHAL_PLUGIN) diff --git a/cmake/FindIA_IMAGING.cmake b/cmake/FindIA_IMAGING.cmake index 26cbce5e..1f3f6ec7 100644 --- a/cmake/FindIA_IMAGING.cmake +++ b/cmake/FindIA_IMAGING.cmake @@ -20,7 +20,6 @@ if(TARGET ia_aiq) endif() # Get include and lib paths for IA_IMAGING from pkgconfig -include(FindPackageHandleStandardArgs) find_package(PkgConfig) pkg_check_modules(IA_IMAGING${TARGET_SUFFIX} ia_imaging${TARGET_SUFFIX}) @@ -28,64 +27,37 @@ if(NOT IA_IMAGING${TARGET_SUFFIX}_FOUND) message(FATAL_ERROR "IA_IMAGING${TARGET_SUFFIX} not found") endif() -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${IA_IMAGING${TARGET_SUFFIX}_LIBRARY_DIRS}) - -# Libraries -find_library(IA_CCA${TARGET_SUFFIX}_LIB ia_cca${TARGET_SUFFIX}) -find_library(IA_AIQ${TARGET_SUFFIX}_LIB ia_aiq${TARGET_SUFFIX}) -find_library(IA_AIQB_PARSER${TARGET_SUFFIX}_LIB ia_aiqb_parser${TARGET_SUFFIX}) -find_library(IA_CMC_PARSER${TARGET_SUFFIX}_LIB ia_cmc_parser${TARGET_SUFFIX}) -find_library(IA_EXC${TARGET_SUFFIX}_LIB ia_exc${TARGET_SUFFIX}) -find_library(IA_MKN${TARGET_SUFFIX}_LIB ia_mkn${TARGET_SUFFIX}) -# SENSOR_EMD_DECODER -find_library(IA_EMD${TARGET_SUFFIX}_LIB ia_emd_decoder${TARGET_SUFFIX}) +set(IA_IMAGING${TARGET_SUFFIX}_LIBRARIES + ia_cca${TARGET_SUFFIX} + ia_aiq${TARGET_SUFFIX} + ia_aiqb_parser${TARGET_SUFFIX} + ia_cmc_parser${TARGET_SUFFIX} + ia_exc${TARGET_SUFFIX} + ia_mkn${TARGET_SUFFIX} + ia_emd_decoder${TARGET_SUFFIX} + ia_nvm${TARGET_SUFFIX} + ia_log${TARGET_SUFFIX} + ia_dvs${TARGET_SUFFIX} + ia_coordinate${TARGET_SUFFIX} + ia_ltm${TARGET_SUFFIX} + ia_dvs${TARGET_SUFFIX} + ia_isp_bxt${TARGET_SUFFIX} + broxton_ia_pal${TARGET_SUFFIX} # DOL_FEATURE_S -find_library(IA_BCOMP${TARGET_SUFFIX}_LIB ia_bcomp${TARGET_SUFFIX}) + ia_bcomp${TARGET_SUFFIX} # DOL_FEATURE_E -find_library(IA_NVM${TARGET_SUFFIX}_LIB ia_nvm${TARGET_SUFFIX}) -find_library(IA_LOG${TARGET_SUFFIX}_LIB ia_log${TARGET_SUFFIX}) -find_library(IA_DVS${TARGET_SUFFIX}_LIB ia_dvs${TARGET_SUFFIX}) -find_library(IA_COORDINATE${TARGET_SUFFIX}_LIB ia_coordinate${TARGET_SUFFIX}) -find_library(IA_LTM${TARGET_SUFFIX}_LIB ia_ltm${TARGET_SUFFIX}) -find_library(IA_DVS${TARGET_SUFFIX}_LIB ia_dvs${TARGET_SUFFIX}) -find_library(IA_ISP_BXT${TARGET_SUFFIX}_LIB ia_isp_bxt${TARGET_SUFFIX}) -find_library(BXT_IA_PAL${TARGET_SUFFIX}_LIB broxton_ia_pal${TARGET_SUFFIX}) - -set(IA_IMAGING${TARGET_SUFFIX}_LIBS - ${IA_CCA${TARGET_SUFFIX}_LIB} - ${IA_AIQ${TARGET_SUFFIX}_LIB} - ${IA_AIQB_PARSER${TARGET_SUFFIX}_LIB} - ${IA_CMC_PARSER${TARGET_SUFFIX}_LIB} - ${IA_EXC${TARGET_SUFFIX}_LIB} - ${IA_MKN${TARGET_SUFFIX}_LIB} - ${IA_EMD${TARGET_SUFFIX}_LIB} - ${IA_BCOMP${TARGET_SUFFIX}_LIB} - ${IA_NVM${TARGET_SUFFIX}_LIB} - ${IA_LOG${TARGET_SUFFIX}_LIB} - ${IA_DVS${TARGET_SUFFIX}_LIB} - ${IA_COORDINATE${TARGET_SUFFIX}_LIB} - ${IA_LTM${TARGET_SUFFIX}_LIB} - ${IA_DVS${TARGET_SUFFIX}_LIB} - ${IA_OB${TARGET_SUFFIX}_LIB} - ${IA_ISP_BXT${TARGET_SUFFIX}_LIB} - ${BXT_IA_PAL${TARGET_SUFFIX}_LIB} ) if (NOT ENABLE_SANDBOXING) - find_library(IA_LARD${TARGET_SUFFIX}_LIB ia_lard${TARGET_SUFFIX}) - set(IA_IMAGING${TARGET_SUFFIX}_LIBS ${IA_IMAGING${TARGET_SUFFIX}_LIBS} ${IA_LARD${TARGET_SUFFIX}_LIB}) + set(IA_IMAGING${TARGET_SUFFIX}_LIBRARIES + ${IA_IMAGING${TARGET_SUFFIX}_LIBRARIES} + ia_lard${TARGET_SUFFIX} + ) endif() #ENABLE_SANDBOXING if (USE_PG_LITE_PIPE) - find_library(IA_P2P${TARGET_SUFFIX}_LIB ia_p2p${TARGET_SUFFIX}) - set(IA_IMAGING${TARGET_SUFFIX}_LIBS ${IA_IMAGING${TARGET_SUFFIX}_LIBS} ${IA_P2P${TARGET_SUFFIX}_LIB}) -endif() - -# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if -# all listed variables are TRUE -find_package_handle_standard_args(IA_IMAGING${TARGET_SUFFIX} - REQUIRED_VARS IA_IMAGING${TARGET_SUFFIX}_INCLUDE_DIRS IA_IMAGING${TARGET_SUFFIX}_LIBS) - -if(NOT IA_IMAGING${TARGET_SUFFIX}_FOUND) - message(FATAL_ERROR "IA_IMAGING${TARGET_SUFFIX} not found") + set(IA_IMAGING${TARGET_SUFFIX}_LIBRARIES + ${IA_IMAGING${TARGET_SUFFIX}_LIBRARIES} + ia_p2p${TARGET_SUFFIX} + ) endif() diff --git a/cmake/FindLIBDRM.cmake b/cmake/FindLIBDRM.cmake index c71b9ae0..af66b3f7 100644 --- a/cmake/FindLIBDRM.cmake +++ b/cmake/FindLIBDRM.cmake @@ -15,25 +15,9 @@ # # Get include and lib paths for LIBDRM from pkgconfig -include(FindPackageHandleStandardArgs) find_package(PkgConfig) pkg_check_modules(LIBDRM libdrm) if(NOT LIBDRM_FOUND) message(SEND_ERROR "LIBDRM not found") endif() - -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBDRM_LIBRARY_DIRS}) - -# Libraries -find_library(DRM_LIB drm) -set(LIBDRM_LIBS ${DRM_LIB}) - -# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if -# all listed variables are TRUE -find_package_handle_standard_args(LIBDRM REQUIRED_VARS LIBDRM_INCLUDE_DIRS LIBDRM_LIBS) - -if(NOT LIBDRM_FOUND) - message(SEND_ERROR "LIBDRM not found") -endif() - diff --git a/cmake/FindLIBGCSS.cmake b/cmake/FindLIBGCSS.cmake index dd0ff799..e360f7c7 100644 --- a/cmake/FindLIBGCSS.cmake +++ b/cmake/FindLIBGCSS.cmake @@ -15,25 +15,9 @@ # # Get include and lib paths for LIBGCSS from pkgconfig -include(FindPackageHandleStandardArgs) find_package(PkgConfig) pkg_check_modules(LIBGCSS${TARGET_SUFFIX} libgcss${TARGET_SUFFIX}) if(NOT LIBGCSS${TARGET_SUFFIX}_FOUND) message(FATAL_ERROR "LIBGCSS${TARGET_SUFFIX} not found") endif() - -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBGCSS${TARGET_SUFFIX}_LIBRARY_DIRS}) - -# Libraries -find_library(GCSS${TARGET_SUFFIX}_LIB gcss${TARGET_SUFFIX}) -set(LIBGCSS${TARGET_SUFFIX}_LIBS ${GCSS${TARGET_SUFFIX}_LIB}) - -# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if -# all listed variables are TRUE -find_package_handle_standard_args(LIBGCSS${TARGET_SUFFIX} REQUIRED_VARS LIBGCSS${TARGET_SUFFIX}_INCLUDE_DIRS LIBGCSS${TARGET_SUFFIX}_LIBS) - -if(NOT LIBGCSS${TARGET_SUFFIX}_FOUND) - message(FATAL_ERROR "LIBGCSS${TARGET_SUFFIX} not found") -endif() - diff --git a/cmake/FindLIBIACSS.cmake b/cmake/FindLIBIACSS.cmake index c2485e14..9f8769d9 100644 --- a/cmake/FindLIBIACSS.cmake +++ b/cmake/FindLIBIACSS.cmake @@ -15,32 +15,9 @@ # # Get include and lib paths for LIBIACSS from pkgconfig -include(FindPackageHandleStandardArgs) find_package(PkgConfig) -pkg_check_modules(LIBIACSS libiacss) -if(NOT LIBIACSS_FOUND) - message(FATAL_ERROR "LIBIACSS not found") +pkg_check_modules(LIBIACSS${TARGET_SUFFIX} libiacss${TARGET_SUFFIX}) +if(NOT LIBIACSS${TARGET_SUFFIX}_FOUND) + message(FATAL_ERROR "LIBIACSS${TARGET_SUFFIX} not found") endif() - -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBIACSS_LIBRARY_DIRS}) - -# Libraries -find_library(GCSS_LIB gcss) -find_library(IA_CAMERA_LIB ia_camera) -find_library(IA_CIPF_LIB ia_cipf) -set(LIBIACSS_LIBS - ${GCSS_LIB} - ${IA_CAMERA_LIB} - ${IA_CIPF_LIB} - ) - -# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if -# all listed variables are TRUE -find_package_handle_standard_args(LIBIACSS - REQUIRED_VARS LIBIACSS_INCLUDE_DIRS LIBIACSS_LIBS) - -if(NOT LIBIACSS_FOUND) - message(FATAL_ERROR "LIBIACSS not found") -endif() - diff --git a/cmake/FindLIBIPU.cmake b/cmake/FindLIBIPU.cmake index 9f8d9fc6..17a6efe8 100644 --- a/cmake/FindLIBIPU.cmake +++ b/cmake/FindLIBIPU.cmake @@ -28,26 +28,9 @@ else() endif() # Get include and lib paths for LIBIPU from pkgconfig -include(FindPackageHandleStandardArgs) -# Include directory find_package(PkgConfig) pkg_check_modules(LIBIPU${TARGET_SUFFIX} ${libipu_ver}) if(NOT LIBIPU${TARGET_SUFFIX}_FOUND) message(FATAL_ERROR "LIBIPU${TARGET_SUFFIX} not found") endif() - -set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBIPU${TARGET_SUFFIX}_LIBRARY_DIRS}) - -# Libraries -find_library(IPU${TARGET_SUFFIX}_LIB NAMES ${libipu_ver}.a) -set(LIBIPU${TARGET_SUFFIX}_LIBS ${IPU${TARGET_SUFFIX}_LIB}) - -# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if -# all listed variables are TRUE -find_package_handle_standard_args(LIBIPU${TARGET_SUFFIX} - REQUIRED_VARS LIBIPU${TARGET_SUFFIX}_INCLUDE_DIRS LIBIPU${TARGET_SUFFIX}_LIBS) - -if(NOT LIBIPU${TARGET_SUFFIX}_FOUND) - message(FATAL_ERROR "LIBIPU${TARGET_SUFFIX} not found") -endif() diff --git a/config/linux/ipu6/gcss/graph_settings_hm11b1.xml b/config/linux/ipu6/gcss/graph_settings_hm11b1.xml index 97063548..289e0668 100644 --- a/config/linux/ipu6/gcss/graph_settings_hm11b1.xml +++ b/config/linux/ipu6/gcss/graph_settings_hm11b1.xml @@ -262,7 +262,7 @@ limitations under the License. - + @@ -1131,7 +1131,7 @@ limitations under the License. - + diff --git a/config/linux/ipu6/sensors/hm11b1-uf.xml b/config/linux/ipu6/sensors/hm11b1-uf.xml index 12d3038a..00df79a5 100644 --- a/config/linux/ipu6/sensors/hm11b1-uf.xml +++ b/config/linux/ipu6/sensors/hm11b1-uf.xml @@ -16,12 +16,12 @@ - + - - + + @@ -31,9 +31,11 @@ - + + + @@ -74,7 +76,7 @@ - + diff --git a/config/linux/ipu6ep/OV08A10_YHUT_ADL.aiqb b/config/linux/ipu6ep/OV08A10_YHUT_ADL.aiqb deleted file mode 100644 index aa833866..00000000 Binary files a/config/linux/ipu6ep/OV08A10_YHUT_ADL.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/OV2740_CJFLE23_ADL.aiqb b/config/linux/ipu6ep/OV2740_CJFLE23_ADL.aiqb deleted file mode 100644 index 31f0a507..00000000 Binary files a/config/linux/ipu6ep/OV2740_CJFLE23_ADL.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/ov01a1s.aiqb b/config/linux/ipu6ep/ov01a1s.aiqb deleted file mode 100644 index f175ecd9..00000000 Binary files a/config/linux/ipu6ep/ov01a1s.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/ov13b10.aiqb b/config/linux/ipu6ep/ov13b10.aiqb deleted file mode 100644 index b1428c69..00000000 Binary files a/config/linux/ipu6ep/ov13b10.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/ov8856.aiqb b/config/linux/ipu6ep/ov8856.aiqb deleted file mode 100644 index 97d8ff72..00000000 Binary files a/config/linux/ipu6ep/ov8856.aiqb and /dev/null differ diff --git a/config/linux/ipu6ep/sensors/imx390.xml b/config/linux/ipu6ep/sensors/imx390.xml index 2e104dfb..6544680f 100644 --- a/config/linux/ipu6ep/sensors/imx390.xml +++ b/config/linux/ipu6ep/sensors/imx390.xml @@ -666,7 +666,7 @@ - + @@ -1280,7 +1280,7 @@ - + @@ -1386,7 +1386,7 @@ - + diff --git a/config/linux/ipu6ep/sensors/ov01a10-uf.xml b/config/linux/ipu6ep/sensors/ov01a10-uf.xml index 9691ad6e..d0c84eae 100644 --- a/config/linux/ipu6ep/sensors/ov01a10-uf.xml +++ b/config/linux/ipu6ep/sensors/ov01a10-uf.xml @@ -36,6 +36,8 @@ + + diff --git a/config/linux/ipu6ep/sensors/ov8856-uf.xml b/config/linux/ipu6ep/sensors/ov8856-uf.xml index 92cc817c..9fc24c34 100644 --- a/config/linux/ipu6ep/sensors/ov8856-uf.xml +++ b/config/linux/ipu6ep/sensors/ov8856-uf.xml @@ -34,6 +34,8 @@ + + diff --git a/config/linux/ipu6ep/sensors/ov8856-wf.xml b/config/linux/ipu6ep/sensors/ov8856-wf.xml index 7c636c31..d0f836b7 100644 --- a/config/linux/ipu6ep/sensors/ov8856-wf.xml +++ b/config/linux/ipu6ep/sensors/ov8856-wf.xml @@ -34,6 +34,8 @@ + + diff --git a/config/linux/ipu6ep/AR0234_TGL_10bits.aiqb b/config/linux/ipu6epmtl/AR0234_TGL_10bits.aiqb similarity index 100% rename from config/linux/ipu6ep/AR0234_TGL_10bits.aiqb rename to config/linux/ipu6epmtl/AR0234_TGL_10bits.aiqb diff --git a/config/linux/ipu6ep/HI556_1BG502T3_ADL.aiqb b/config/linux/ipu6epmtl/HI556_1BG502T3_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/HI556_1BG502T3_ADL.aiqb rename to config/linux/ipu6epmtl/HI556_1BG502T3_ADL.aiqb diff --git a/config/linux/ipu6ep/HI556_CJFLE25_ADL.aiqb b/config/linux/ipu6epmtl/HI556_CJFLE25_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/HI556_CJFLE25_ADL.aiqb rename to config/linux/ipu6epmtl/HI556_CJFLE25_ADL.aiqb diff --git a/config/linux/ipu6ep/HM2170_1SG205N3_ADL.aiqb b/config/linux/ipu6epmtl/HM2170_1SG205N3_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/HM2170_1SG205N3_ADL.aiqb rename to config/linux/ipu6epmtl/HM2170_1SG205N3_ADL.aiqb diff --git a/config/linux/ipu6ep/HM2170_CJFME18_ADL.aiqb b/config/linux/ipu6epmtl/HM2170_CJFME18_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/HM2170_CJFME18_ADL.aiqb rename to config/linux/ipu6epmtl/HM2170_CJFME18_ADL.aiqb diff --git a/config/linux/ipu6ep/IMX390_HDR_ADL.aiqb b/config/linux/ipu6epmtl/IMX390_HDR_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/IMX390_HDR_ADL.aiqb rename to config/linux/ipu6epmtl/IMX390_HDR_ADL.aiqb diff --git a/config/linux/ipu6ep/OV02C10_1BG203N3_ADL.aiqb b/config/linux/ipu6epmtl/OV02C10_1BG203N3_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/OV02C10_1BG203N3_ADL.aiqb rename to config/linux/ipu6epmtl/OV02C10_1BG203N3_ADL.aiqb diff --git a/config/linux/ipu6ep/OV02C10_1SG204N3_ADL.aiqb b/config/linux/ipu6epmtl/OV02C10_1SG204N3_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/OV02C10_1SG204N3_ADL.aiqb rename to config/linux/ipu6epmtl/OV02C10_1SG204N3_ADL.aiqb diff --git a/config/linux/ipu6ep/OV02C10_CIFME14_ADL.aiqb b/config/linux/ipu6epmtl/OV02C10_CIFME14_ADL.aiqb similarity index 100% rename from config/linux/ipu6ep/OV02C10_CIFME14_ADL.aiqb rename to config/linux/ipu6epmtl/OV02C10_CIFME14_ADL.aiqb diff --git a/config/linux/ipu6epmtl/OV02E10_ASG202N3_MTL.aiqb b/config/linux/ipu6epmtl/OV02E10_ASG202N3_MTL.aiqb new file mode 100644 index 00000000..ce27ad9d Binary files /dev/null and b/config/linux/ipu6epmtl/OV02E10_ASG202N3_MTL.aiqb differ diff --git a/config/linux/ipu6epmtl/OV08X40_CJFME55_MTL.aiqb b/config/linux/ipu6epmtl/OV08X40_CJFME55_MTL.aiqb new file mode 100644 index 00000000..25b1b1e4 Binary files /dev/null and b/config/linux/ipu6epmtl/OV08X40_CJFME55_MTL.aiqb differ diff --git a/config/linux/ipu6epmtl/OV13B10_09B13_MTL_PDAF_DPC_T3.aiqb b/config/linux/ipu6epmtl/OV13B10_09B13_MTL_PDAF_DPC_T3.aiqb new file mode 100644 index 00000000..06c9b7ce Binary files /dev/null and b/config/linux/ipu6epmtl/OV13B10_09B13_MTL_PDAF_DPC_T3.aiqb differ diff --git a/config/linux/ipu6epmtl/hm2172_ASG205N3_MTL.aiqb b/config/linux/ipu6epmtl/hm2172_ASG205N3_MTL.aiqb new file mode 100644 index 00000000..5ad66da9 Binary files /dev/null and b/config/linux/ipu6epmtl/hm2172_ASG205N3_MTL.aiqb differ diff --git a/config/linux/ipu6epmtl/libcamhal_profile.xml b/config/linux/ipu6epmtl/libcamhal_profile.xml index e51ac861..6643e6b8 100644 --- a/config/linux/ipu6epmtl/libcamhal_profile.xml +++ b/config/linux/ipu6epmtl/libcamhal_profile.xml @@ -22,6 +22,7 @@ + imx390-1-0,imx390-2-0,imx390-3-0,imx390-4-0,imx390-5-4,imx390-6-4,ar0234-1-0,ar0234-2-4, + external_source,ar0234_usb,lt6911uxc,lt6911uxe-1-0,lt6911uxe-2-4"/> diff --git a/config/linux/ipu6ep/ov01a10.aiqb b/config/linux/ipu6epmtl/ov01a_1BG101N3_MTL.aiqb similarity index 56% rename from config/linux/ipu6ep/ov01a10.aiqb rename to config/linux/ipu6epmtl/ov01a_1BG101N3_MTL.aiqb index 479a608a..89634ca9 100644 Binary files a/config/linux/ipu6ep/ov01a10.aiqb and b/config/linux/ipu6epmtl/ov01a_1BG101N3_MTL.aiqb differ diff --git a/config/linux/ipu6epmtl/ov01a_CJFLE21_MTL.aiqb b/config/linux/ipu6epmtl/ov01a_CJFLE21_MTL.aiqb new file mode 100644 index 00000000..89634ca9 Binary files /dev/null and b/config/linux/ipu6epmtl/ov01a_CJFLE21_MTL.aiqb differ diff --git a/config/linux/ipu6epmtl/ov05c10_BBG501N3_MTL.aiqb b/config/linux/ipu6epmtl/ov05c10_BBG501N3_MTL.aiqb new file mode 100644 index 00000000..317a9890 Binary files /dev/null and b/config/linux/ipu6epmtl/ov05c10_BBG501N3_MTL.aiqb differ diff --git a/config/linux/ipu6epmtl/ov5675.aiqb b/config/linux/ipu6epmtl/ov5675.aiqb new file mode 100644 index 00000000..7eabfa0d Binary files /dev/null and b/config/linux/ipu6epmtl/ov5675.aiqb differ diff --git a/config/linux/ipu6epmtl/sensors/imx390-1.xml b/config/linux/ipu6epmtl/sensors/imx390-1.xml new file mode 100644 index 00000000..09edef51 --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/imx390-1.xml @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390-2.xml b/config/linux/ipu6epmtl/sensors/imx390-2.xml new file mode 100644 index 00000000..efff0306 --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/imx390-2.xml @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390-3.xml b/config/linux/ipu6epmtl/sensors/imx390-3.xml new file mode 100644 index 00000000..fc6e7b2a --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/imx390-3.xml @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390-4.xml b/config/linux/ipu6epmtl/sensors/imx390-4.xml new file mode 100644 index 00000000..3d88cc84 --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/imx390-4.xml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390-5.xml b/config/linux/ipu6epmtl/sensors/imx390-5.xml new file mode 100644 index 00000000..f144c1fd --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/imx390-5.xml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390-6.xml b/config/linux/ipu6epmtl/sensors/imx390-6.xml new file mode 100644 index 00000000..cecc7b02 --- /dev/null +++ b/config/linux/ipu6epmtl/sensors/imx390-6.xml @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/linux/ipu6epmtl/sensors/imx390.xml b/config/linux/ipu6epmtl/sensors/imx390.xml deleted file mode 100644 index e400a2be..00000000 --- a/config/linux/ipu6epmtl/sensors/imx390.xml +++ /dev/null @@ -1,1085 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/linux/ipu6epmtl/sensors/ov01a10-uf.xml b/config/linux/ipu6epmtl/sensors/ov01a10-uf.xml index a559a8a1..92cdadf0 100644 --- a/config/linux/ipu6epmtl/sensors/ov01a10-uf.xml +++ b/config/linux/ipu6epmtl/sensors/ov01a10-uf.xml @@ -36,6 +36,8 @@ + + @@ -212,6 +214,8 @@ + + diff --git a/include/api/AlgoTuning.h b/include/api/AlgoTuning.h new file mode 100644 index 00000000..76879d47 --- /dev/null +++ b/include/api/AlgoTuning.h @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2017-2018 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. + */ + +/*! + * \file AlgoTuning.h + * \brief Definitions of IQ tuning related parameters. + */ + +#pragma once + +/*! + * \brief Enumeration that indicates what results LTM algorithm outputs. + */ +typedef enum { + ltm_algo_optibright_gain_map = 0, + ltm_algo_coala_gain_map, + ltm_algo_lbce_gain_map, + ltm_algo_optibright_tone_map = (1 << 3), /*!< Optibright algorithm outputs local tone map. */ + ltm_algo_coala_tone_map, + ltm_algo_lbce_tone_map, + ltm_algo_tme, +} ia_ltm_algo_t; +#define SIZEOF_OPTIBRIGHT_TUNING_V100 28 +#define SIZEOF_OPTIBRIGHT_TUNING_V101 4 /* maskmid */ +#define SIZEOF_OPTIBRIGHT_TUNING_V102 4 /* hlc_mode */ +#define SIZEOF_OPTIBRIGHT_TUNING_V103 84 /* from max_isp_gain to wdr_gain_max */ +#define SIZEOF_OPTIBRIGHT_TUNING_V104 4 /* frame_delay_adaption */ +#define SIZEOF_OPTIBRIGHT_TUNING_V105 12 /* anti-aliasing */ +#define SIZEOF_OPTIBRIGHT_TUNING_V106 4 /* apply isp gain */ +/*! + * \brief OptiBright tuning data + */ +typedef struct { + /*!< GTM strength: low value - darker, high value - brighter */ + int32_t GTM_Str; + /*!< regularization (0.0.15): low value - less halos, high value - more mid tone contrast */ + int32_t GF_epspar; + /*!< localization (0.0.15): higher value result in better mid tone contrast */ + int32_t alpham1; + /*!< strength (0.0.15): 16384 - no effect, + more than 16384 - higher value makes dark area brighter and bright + area darker, + less than 16384 - lower value makes dark area darker and bright area + brighter. */ + int32_t alpham; + /*!< min threshold (0.0.15): higher value result in cutting LTM in dark part */ + int32_t maskmin; + /*!< max threshold (0.0.15): lower value result in cutting LTM in bright part */ + int32_t maskmax; + /*!< number of iteration */ + int32_t num_iteration; + /*!< mask mid point (0.0.15): defines the contrast center of the image. + regions darker than mid point after global tone mapping will be + brightened, and brighter regions will be darkened. typical value + is 16384 or less. */ + int32_t maskmid; + /*!< HLC mode: 0 - disable, 1 - enable */ + int32_t hlc_mode; + /*!< max isp gain applied in LTM, default is 32x. */ + int32_t max_isp_gain; + /*!< convergence speed [sec] (0.2.13), 0.15 [sec], 0.15 [sec] x 2^13 = 1229 */ + int32_t convergence_speed; + /*!< local motion trade-off (0.0.15): higher value result in more contrast and more halos on + * local motion, and vice versa. */ + int32_t lm_treatment; + /*!< GTM mode: 0 - logarithmic, 1 - logarithmic after gamma */ + int32_t GTM_mode; + /*!< pre-gamma before logarithmic global tone mapping. 40 is about gamma 0.7, 60 ~ 0.61, 80 ~ + * 0.54, 100 ~ 0.48 */ + int32_t pre_gamma; + /*!< lav to p scale, [1 10] */ + int32_t lav2p_scale; + /*!< max value of p (0.0.15): limit range of p in logarithmic global tone mapping. */ + int32_t p_max; + /*!< p mode: 0 - auto, 1 - manual, when p mode is manual, p_value is used instead of calculating + * p from GTM_Str. */ + int32_t p_mode; + /*!< p value used when p mode is on. */ + int32_t p_value; + /*!< filter size for local mean: 0 - 3x3, 1 - 5x5, 2 - 7x7 */ + int32_t filter_size; + /*!< max percentile for determine percentage of saturation (0.0.15), 0.005% saturation - (1.0 - + * 0.005) x 2^15 = 32604 (default) */ + int32_t max_percentile; + /*!< set log space average pixel value you want before gamma for low dynamic range scene + * (0.0.15), in wall or flat scene, brightness become specified here. */ + int32_t ldr_brightness; + /*!< value is divided by log space average, and the ratio is used for calculating dynamic range + * factor (0.015) */ + int32_t dr_mid; + /*!< max value for normalizing dynamic range factor (0.4.11) */ + int32_t dr_norm_max; + /*!< min value for normalizing dynamic range factor (0.4.11) */ + int32_t dr_norm_min; + /*!< convergence speed [sec] in slow state (0.2.13), 1.0 [sec] x 2^13 = 8192 */ + int32_t convergence_speed_slow; + /*!< sigma for convergence state transition (0.0.15), 0.15 x 2^15 = 4915 */ + int32_t convergence_sigma; + /*!< LTM gain extraction mode, 0 - gainext_max, 1 - gainext_logavg, in the future there is + * possibility to add new mode */ + int32_t gainext_mode; + /*!< WDR level LTM_noit increase ratio (0.2.13), 1.5x by default */ + int32_t wdr_scale_max; + /*!< WDR level LTM_noit decrease ratio (0.2.13), 1/8x by default */ + int32_t wdr_scale_min; + /*!< WDR level ldr_scale increase ratio (0.2.13), 2x by default */ + int32_t wdr_gain_max; + /*!< frame delay compensation mode, 0 - disable, 1 - enable a frame delay compensation */ + int32_t frame_delay_compensation; + /*!< anti-aliasing filter mode, 0 - disable, 1 - enable anti-aliasing filtering */ + int32_t anti_aliasing_en; + /*!< anti-aliasing sensitivity, smaller value keeps more small details untouched */ + int32_t anti_aliasing_sens; + /*!< anti-aliasing strength, larger value remove stronger aliasing */ + int32_t anti_aliasing_str; + /*!< flag for isp gain, 0 - do not apply isp gain in Optibright, 1 - apply */ + int32_t apply_isp_gain; +} optibright_tuning_t; +/*! + * \brief MPGC tuning data + */ +typedef struct { + /*!< local motion stability (0.0.15): higher value result in more filtering between frames but + * it has more delay, and vice versa. */ + int32_t lm_stability; + /*!< local motion sensitivity (0.0.15): higher value detect more local motion but it may + * increase false detection rate, and vice versa. */ + int32_t lm_sensitivity; + /*!< filter size for gain blur: 0 - 1x1 (turn off), 1 - 3x3, 2 - 5x5, 3 - 7x7, 4 - 9x9, 5 - + * 11x11, 6 - 13x13 */ + int32_t blur_size; + /*!< tf strength (0.0.15): high value - more filter, low value - less filter, 0 - turn off */ + int32_t tf_str; +} mpgc_tuning_t; +/*! + * \brief DRC SW tuning data + */ +typedef struct { + /*!< sigma for similarity computation in DRC FW block (0.0.15): high value - high sigma, low + * value - low sigma */ + int32_t blus_sim_sigma; +} drcsw_tuning_t; +/*! + * \brief Coala tuning data + */ +typedef struct { + /*!< shadows_val shadows adjustment slider. Lower - darken. Higher - brightnen. */ + int32_t shadows_val; + /*!< highlights_val highlights adjustment slider. Lower - darken. Higher - brightnen. */ + int32_t highlights_val; + /*!< brightness_slope overall brightness adjustment: "late gain" form. This value is the gain */ + int32_t brightness_slope; + /*!< brightness_sign 0 for darkening. 1 for brightening */ + int32_t brightness_sign; + /*!< brightness_knee knee point for late gain curve */ + int32_t brightness_knee; + /*!< brightness_th this value determined from where luma is saturated */ + int32_t brightness_th; + /*!< contrast_Qa contrast enhancement parameter for highlights\shadows */ + int32_t contrast_Qa; + /*!< contrast_Qb contrast enhancement parameter for mid tones */ + int32_t contrast_Qb; + /*!< reg_maxval regularization parameter max values (the larger, the result looks more like + * prior optimization result) */ + int32_t reg_maxval; + /*!< reg_minval regularization parameter min values (the larger, the result looks more like + * prior optimization result) */ + int32_t reg_minval; + /*!< reg_thval regularization parameter edge threshold value (the larger, the result looks more + * like prior optimization result) */ + int32_t reg_thval; + /*!< ub_high_th upper bound of optimization edge high threshold */ + int32_t ub_high_th; + /*!< ub_low_th upper bound of optimization edge low threshold */ + int32_t ub_low_th; + /*!< alpha_thetaGain2 theta parameter gain multiplication (for local tone mapping) */ + int32_t alpha_thetaGain2; + /*!< alpha_thetaGain1 theta parameter gain multiplication (for local tone mapping) */ + int32_t alpha_thetaGain1; + /*!< alpha_thetaBias theta parameter bias factor (for local tone mapping) */ + int32_t alpha_thetaBias; +} coala_tuning_t; +/*! + * \brief LBCE tuning data + */ +typedef struct { + /*!< Clipping limit for the histogram [0,1]. Higher value increases overall contrast */ + float clip_limit; + /*!< Maximum slope for the final curves [0,Inf] + * - Higher limit may allow better brightness in dark regions, but may also create artifacts */ + float max_slope; + /*!< Min/Max values for the shadow pivot point [0,1] + * - Controls the contrast in shadows */ + float shadow_min; + float shadow_max; + /*!< Min/Max values for the midtone pivot point [0,1] + * - Controls the contrast in midtones */ + float midtone_min; + float midtone_max; + /*!< Min/Max values for the highlight pivot point [0,1] + * - Controls the contrast highlights */ + float highlight_min; + float highlight_max; + /*!< Values at which pivots are calculated [0,1] + * - Control the brightness in respective tones (higher/lower = brighter/darker) */ + float pivot_shadow; + float pivot_midtone; + float pivot_highlight; + /*!< Defines which input statistics LBCE should use + * 0: RAW statistics, 1: rgbs statistics */ + uint32_t input_statistics; +} lbce_tuning_t; +#define SIZEOF_AGTM_TUNING_V100 16 +#define SIZEOF_AGTM_TUNING_V101 8 /* vmax_limit and gamma */ +#define SIZEOF_AGTM_TUNING_V102 12 /* gtm_bypass, ltm_bypass, and ltm_weight */ +#define SIZEOF_AGTM_TUNING_V103 12 /* AGTM temporal filtering */ +/*! + * \brief AGTM tuning data + */ +typedef struct { + float scale; /*!< adaptive gtm tuning param to control gtm strength */ + float max_percentile; /*!< adaptive gtm tuning param to control the index of max percentile */ + float min_percentile; /*!< adaptive gtm tuning param to control the index of min percentile */ + float sharpness_max; /*!< LTM param to control sharpening strength */ + float gamma; /*!< adaptive gtm tuning param to control GTM curve for HDR effect */ + float vmax_limit; /*!< adaptive gtm tuning param to control saturation */ + int32_t gtm_bypass; /*!< adaptive gtm tuning param to bypass GTM */ + int32_t ltm_bypass; /*!< LTM param to bypass LTM */ + float ltm_weight; /*!< LTM param to control ltm strength */ + float conv_sigma; /*!< Convergence weight for slow convergence */ + float conv_coef; /*!< temporal filter coefficient for AGTM */ + float conv_coef_slow; /*!< temporal filter coefficient for AGTM slow convergence */ +} agtm_tuning_t; +#define SIZEOF_DEFOG_TUNING_V100 12 +#define SIZEOF_DEFOG_TUNING_V101 4 /* bypass */ +#define SIZEOF_DEFOG_TUNING_V102 4 /* GCE/Defog temporal filtering */ +#define SIZEOF_DEFOG_TUNING_V103 4 /* GCE weight */ +#define SIZEOF_DEFOG_TUNING_V104 8 /* Defog enhance & GCE scale */ +/*! + * \brief Defog tuning data + */ +typedef struct { + int32_t defog_activaton; /*!< Defog activation through tuning: 0 - Defog off, 1 - Defog on */ + float strength_thres; /*!< Defog strength: low value - stronger effect of defogging , high value + - weaker effect of defogging */ + float darkness_thres; /*!< Dark effect: low value - stronger defog in dark regions, high value - + weaker defog in dark regions */ + int32_t bypass; /*!< GCE/Defog bypass: 0 - GCE/Defog on, 1 - GCE/Defog off */ + float conv_coef; /*!< GCE or Defog: temporal filter coefficient */ + float gce_weight; /*!< GCE weight: blending weight of reference and accumulated histogram of + input */ + int32_t defog_enhance; /*!< Defog emhamcememt for PAL */ + float gce_scale; /*!< GCE scale: scale applied to metric calculated from input HDR stat */ +} defog_tuning_t; +/*! + * \brief tuning data for LTM + */ +typedef struct { + ia_ltm_algo_t algo_mode; /*!< LTM algo: 0 - OptiBright, 1 - COALA, 2 - LBCE */ + uint32_t grid_density; /*!< LTM grid density. An abstract tuning parameter where minimum value + (1) means maximum PnP and maximum value (5) means maximum IQ. */ + optibright_tuning_t optibright_tuning; /*!< OptiBright tuning data */ + coala_tuning_t coala_tuning; /*!< Coala tuning data */ + lbce_tuning_t lbce_tuning; /*!< LBCE tuning data */ + mpgc_tuning_t mpgc_tuning; /*!< MPGC tuning data */ + drcsw_tuning_t drcsw_tuning; /*!< DRC SW tuning data */ + agtm_tuning_t agtm_tuning; /*!< AGTM tuning data */ + defog_tuning_t defog_tuning; /*!< Defog tuning data */ +} ltm_tuning_data; diff --git a/include/api/IspControl.h b/include/api/IspControl.h new file mode 100644 index 00000000..1a22a2de --- /dev/null +++ b/include/api/IspControl.h @@ -0,0 +1,548 @@ +/* + * Copyright (C) 2017-2018 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. + */ + +/** + * Warning this header is automatically generated. + * Any manual change here will be lost. + */ + +#pragma once + +#include + +namespace icamera { + +typedef enum { + camera_control_isp_ctrl_id_wb_gains = 34710, + camera_control_isp_ctrl_id_color_correction_matrix = 30009, + camera_control_isp_ctrl_id_advanced_color_correction_matrix = 51448, + camera_control_isp_ctrl_id_bxt_csc = 5291, + camera_control_isp_ctrl_id_bxt_demosaic = 55032, + camera_control_isp_ctrl_id_sc_iefd = 5151, + camera_control_isp_ctrl_id_see = 10947, + camera_control_isp_ctrl_id_bnlm = 40283, + camera_control_isp_ctrl_id_tnr5_21 = 20429, + camera_control_isp_ctrl_id_xnr_dss = 22233, + camera_control_isp_ctrl_id_gamma_tone_map = 5809, + camera_control_isp_ctrl_id_tnr5_22 = 15132, + camera_control_isp_ctrl_id_tnr5_25 = 41091, +} camera_control_isp_ctrl_id; + +/** + * \struct camera_control_isp_wb_gains_t + */ +struct camera_control_isp_wb_gains_t { + /*!< gr Gr gain.*/ + float gr; + /*!< r R gain.*/ + float r; + /*!< b B gain.*/ + float b; + /*!< gb Gb gain.*/ + float gb; +}; + +/** + * \struct camera_control_isp_color_correction_matrix_t + */ +struct camera_control_isp_color_correction_matrix_t { + /*!< ccm_gains[9] Color correction matrix from sensor RGB to sRGB/target color space. Row-major + * order.*/ + float ccm_gains[9]; + /*!< ccm_gains_media_format colorspace the ccm matrix was calibrated to*/ + int32_t ccm_gains_media_format; +}; + +/** + * \struct camera_control_isp_advanced_color_correction_matrix_t + */ +struct camera_control_isp_advanced_color_correction_matrix_t { + /*!< bypass bypass*/ + int32_t bypass; + /*!< number_of_sectors number of sectors (CCM matrices)*/ + int32_t number_of_sectors; + /*!< ccm_matrices[216] ccm matrices*/ + float ccm_matrices[216]; + /*!< hue_of_sectors[24] hue of input calibration vectors*/ + float hue_of_sectors[24]; + /*!< ccm_matrices_media_format colorspace the ccm matrices where calibrated to*/ + int32_t ccm_matrices_media_format; +}; + +/** + * \struct camera_control_isp_bxt_csc_t + */ +struct camera_control_isp_bxt_csc_t { + /*!< rgb2yuv_coef[9] Matrix for RGB to YUV conversion*/ + int32_t rgb2yuv_coef[9]; +}; + +/** + * \struct camera_control_isp_bxt_demosaic_t + */ +struct camera_control_isp_bxt_demosaic_t { + /*!< high_frequency_denoise_enable High frequency denoise enbale flag*/ + int32_t high_frequency_denoise_enable; + /*!< false_color_correction_enable False color correction enable flag*/ + int32_t false_color_correction_enable; + /*!< chroma_artifact_removal_enable Chroma artifact removal enable flag*/ + int32_t chroma_artifact_removal_enable; + /*!< sharpening_strength Sharpening strength*/ + int32_t sharpening_strength; + /*!< false_color_correction_gain False color correction gain*/ + int32_t false_color_correction_gain; + /*!< high_frequency_denoise_power High frequency denoise power*/ + int32_t high_frequency_denoise_power; + /*!< checkers_removal_w Checkers removal homogeneity weight*/ + int32_t checkers_removal_w; +}; + +/** + * \struct camera_control_isp_sc_iefd_t + */ +struct camera_control_isp_sc_iefd_t { + /*!< sharpening_power[2] base power of sharpening*/ + int32_t sharpening_power[2]; + /*!< sharp_power_edge shapening power for direct edge*/ + int32_t sharp_power_edge; + /*!< sharp_power_detail shapening power for non-direct edge*/ + int32_t sharp_power_detail; + /*!< unsharp_weight_edge unsharp weight for direct edge*/ + int32_t unsharp_weight_edge; + /*!< unsharp_weight_detail unsharp weight for non-direct edge*/ + int32_t unsharp_weight_detail; + /*!< denoise_power base power of denoise*/ + int32_t denoise_power; + /*!< radial_denoise_power base power of radial denoise*/ + int32_t radial_denoise_power; + /*!< shrpn_nega_lmt_txt Undershoot limit for texture*/ + int32_t shrpn_nega_lmt_txt; + /*!< shrpn_posi_lmt_txt Overshoot limit for texture*/ + int32_t shrpn_posi_lmt_txt; + /*!< shrpn_nega_lmt_dir Undershoot limit for edge*/ + int32_t shrpn_nega_lmt_dir; + /*!< shrpn_posi_lmt_dir Overshoot limit for edge*/ + int32_t shrpn_posi_lmt_dir; + /*!< cu_var_metric_th[4] */ + int32_t cu_var_metric_th[4]; + /*!< cu_ed2_metric_th[2] */ + int32_t cu_ed2_metric_th[2]; + /*!< cu_dir_metric_th[2] */ + int32_t cu_dir_metric_th[2]; + /*!< rad_enable Enable radial dependency flag*/ + int32_t rad_enable; + /*!< cu_nr_power[2] */ + int32_t cu_nr_power[2]; + /*!< unsharp_filter[15] Unsharp-mask filter coefficients*/ + int32_t unsharp_filter[15]; + /*!< dir_far_sharp_weight[2] Weight of wide kernel direct sharpening*/ + int32_t dir_far_sharp_weight[2]; + /*!< configunited_x[6] CU_ED x points*/ + int32_t configunited_x[6]; + /*!< configunited_y[6] CU_ED y points*/ + int32_t configunited_y[6]; + /*!< configunitradial_x[6] CU_RAD x points*/ + int32_t configunitradial_x[6]; + /*!< configunitradial_y[6] CU_RAD y points*/ + int32_t configunitradial_y[6]; + /*!< denoise_filter[6] Denoising filter coefficients*/ + int32_t denoise_filter[6]; + /*!< vssnlm_x0 Edge denoising LUT x0*/ + int32_t vssnlm_x0; + /*!< vssnlm_x1 Edge denoising LUT x1*/ + int32_t vssnlm_x1; + /*!< vssnlm_x2 Edge denoising LUT x2*/ + int32_t vssnlm_x2; + /*!< vssnlm_y1 Edge denoising LUT y0*/ + int32_t vssnlm_y1; + /*!< vssnlm_y2 Edge denoising LUT y1*/ + int32_t vssnlm_y2; + /*!< vssnlm_y3 Edge denoising LUT y2*/ + int32_t vssnlm_y3; +}; + +/** + * \struct camera_control_isp_see_t + */ +struct camera_control_isp_see_t { + /*!< bypass bypass*/ + int32_t bypass; + /*!< edge_max max edge value for clamping*/ + int32_t edge_max; + /*!< edge_thres threshold for coring*/ + int32_t edge_thres; + /*!< alpha overall edge enhance strength*/ + int32_t alpha; + /*!< alpha_shift */ + int32_t alpha_shift; + /*!< alpha_width */ + int32_t alpha_width; + /*!< alpha_bias */ + int32_t alpha_bias; +}; + +/** + * \struct camera_control_isp_bnlm_t + */ +struct camera_control_isp_bnlm_t { + /*!< nm_offset NR level for noise model adaptation*/ + int32_t nm_offset; + /*!< nm_th Threshold for noise model adaptation*/ + int32_t nm_th; + /*!< bypass bypass for the filter*/ + int32_t bypass; + /*!< detailix_x_range[2] detailIx noise model - noise input range - tunned automatically from + * data - set QNN fit range - [Q14.0] [0..16383]*/ + int32_t detailix_x_range[2]; + /*!< detailix_radgain detailIx Lens shading radial compensation power - [Q8.16], [0..256%]*/ + int32_t detailix_radgain; + /*!< detailix_coeffs[3] detailIx SAD noise model - NoiseModel=SQRT(C1*mu^2+C2*mu+C3)*/ + int32_t detailix_coeffs[3]; + /*!< sad_spatialrad[4] Neighbors spatial (radial) weight - filter radial bias - allowing + * reduction of effective filter size [Q3.5] [1:0.25:4]*/ + int32_t sad_spatialrad[4]; + /*!< sad_mu_x_range[2] detailIx noise model - noise input range - tunned automatically from data + * - set QNN fit range [Q14.0] [0..16383]*/ + int32_t sad_mu_x_range[2]; + /*!< sad_radgain SAD Lens shading radial compensation power - [Q8.16], [0..256%]*/ + int32_t sad_radgain; + /*!< sad_mu_coeffs[3] SAD noise model - NoiseModel=SQRT(C1*mu^2+C2*mu+C3)*/ + int32_t sad_mu_coeffs[3]; + /*!< detailth[3] detailTH - 3 THs classifying content(detail) type to {flat/weak + * texture/texture/edge} based on detailIx - [14.0] [0..16383]*/ + int32_t detailth[3]; + /*!< sad_detailixlutx[4] Continuos LUT aligning SAD from different detailIx levels to a common + * scale before appling exponent scaling - texture to flat & edge discrimination, X axis is + * currently fixed 0:8:1023 - [14.0] [0..16383]*/ + int32_t sad_detailixlutx[4]; + /*!< sad_detailixluty[4] Continuos LUT aligning SAD from different detailIx levels to a common + * scale before appling exponent scaling - texture to flat & edge discrimination - Yaxis is + * continuos description of (2^10-1)/QNN_o - [14.0] [0..16383]*/ + int32_t sad_detailixluty[4]; + /*!< numcandforavg[4] max num neighbors to average for smoothing per detail type - [4.0] + * [1..16]*/ + int32_t numcandforavg[4]; + /*!< blend_power[4] blend alpha(alpha0) - Increase central pixel effect to enhance detail + * preservation vs smoothing - [8.24], [0..256%]*/ + int32_t blend_power[4]; + /*!< blend_th[4] blend alpha(alpha0) - preserve details based on texture classification of the + * form alpha0>TH - [0:2^10-1]*/ + int32_t blend_th[4]; + /*!< blend_texturegain[4] blend alpha(alpha0) - define steepness of blent_th effect for + * preserve details - alphaRes=2^10-1; gainScale=255; outScale=0.01; curSlope = + * outScale*tan(pi/2*((fixGain/(gainScale-1))^2))*alphaRes/(alphaRes-curTH) - [0..256]*/ + int32_t blend_texturegain[4]; + /*!< blend_radgain blend radial weigh - [8.16], [0..256%]*/ + int32_t blend_radgain; + /*!< matchqualitycands[4] set max rank limit for alpha0 selected weights - [8.8] [0..14]*/ + int32_t matchqualitycands[4]; + /*!< wsumminth final regret factor on Sum(weight)%s: dst sequence = %ld, src sequence = %ld, needRunPipe = %d, needReuseInput = %d", + mCameraId, __func__, settingSequence, inputSequence, needRunPipe, holdOnInput); { AutoMutex l(mBufferQueueLock); @@ -1064,28 +1064,29 @@ void PSysProcessor::dispatchTask(CameraBufferPortMap& inBuf, CameraBufferPortMap EdgeNrSetting edgeNrSetting; CLEAR(edgeNrSetting); + auto* res = AiqResultStorage::getInstance(mCameraId)->getAiqResult(currentSequence); int ret = params.getHdrRatio(hdrRatio); - if (ret == OK) { - auto* res = AiqResultStorage::getInstance(mCameraId)->getAiqResult(currentSequence); - if (res != nullptr) { - auto exposure = res->mAeResults.exposures[0].exposure[0]; - float totalGain = exposure.analog_gain * exposure.digital_gain; - PlatformData::getEdgeNrSetting(mCameraId, totalGain, hdrRatio, mTuningMode, - edgeNrSetting); - mIspSettings.eeSetting.strength += edgeNrSetting.edgeStrength; - mIspSettings.nrSetting.strength += edgeNrSetting.nrStrength; - LOG2("edgeStrength %d, nrStrength %d", edgeNrSetting.edgeStrength, - edgeNrSetting.nrStrength); - - TuningMode stillMode = (mTuningMode == TUNING_MODE_VIDEO) ? - TUNING_MODE_STILL_CAPTURE : TUNING_MODE_VIDEO_ULL; - PlatformData::getEdgeNrSetting(mCameraId, totalGain, hdrRatio, stillMode, - edgeNrSetting); - mIspSettings.eeStillSetting.strength += edgeNrSetting.edgeStrength; - mIspSettings.nrStillSetting.strength += edgeNrSetting.nrStrength; - LOG2("Still edgeStrength %d, nrStrength %d", edgeNrSetting.edgeStrength, - edgeNrSetting.nrStrength); - } + if (ret == OK && res != nullptr) { + auto exposure = res->mAeResults.exposures[0].exposure[0]; + float totalGain = exposure.analog_gain * exposure.digital_gain; + PlatformData::getEdgeNrSetting(mCameraId, totalGain, hdrRatio, mTuningMode, + edgeNrSetting); + mIspSettings.eeSetting.strength += edgeNrSetting.edgeStrength; + mIspSettings.nrSetting.strength += edgeNrSetting.nrStrength; + // Limit NR strength range from EXTREME_STRENGTH_LEVEL1 to EXTREME_STRENGTH_LEVEL4 + mIspSettings.nrSetting.strength = CLIP(mIspSettings.nrSetting.strength, + EXTREME_STRENGTH_LEVEL1, EXTREME_STRENGTH_LEVEL4); + LOG2("edgeStrength %d, nrStrength %d", edgeNrSetting.edgeStrength, + edgeNrSetting.nrStrength); + + TuningMode stillMode = (mTuningMode == TUNING_MODE_VIDEO) ? + TUNING_MODE_STILL_CAPTURE : TUNING_MODE_VIDEO_ULL; + PlatformData::getEdgeNrSetting(mCameraId, totalGain, hdrRatio, stillMode, + edgeNrSetting); + mIspSettings.eeStillSetting.strength += edgeNrSetting.edgeStrength; + mIspSettings.nrStillSetting.strength += edgeNrSetting.nrStrength; + LOG2("Still edgeStrength %d, nrStrength %d", edgeNrSetting.edgeStrength, + edgeNrSetting.nrStrength); } bool hasStill = false; diff --git a/src/core/SofSource.cpp b/src/core/SofSource.cpp index 73518167..bd2b68f2 100644 --- a/src/core/SofSource.cpp +++ b/src/core/SofSource.cpp @@ -100,21 +100,9 @@ int SofSource::initDev() { 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.c_str()); - 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); - } - } + mFrameSyncId = aggregator.mVcId; } + if (mFrameSyncId >= 0) id = mFrameSyncId; // VIRTUAL_CHANNEL_E diff --git a/src/core/psysprocessor/PGCommon.cpp b/src/core/psysprocessor/PGCommon.cpp index 30a48e29..433f0859 100644 --- a/src/core/psysprocessor/PGCommon.cpp +++ b/src/core/psysprocessor/PGCommon.cpp @@ -884,7 +884,7 @@ int PGCommon::iterate(CameraBufferMap& inBufs, CameraBufferMap& outBufs, ia_bina if (!inBufs.empty()) { sequence = inBufs.begin()->second->getSequence(); } - LOG2("%s:%s ++", sequence, getName(), __func__); + LOG2("%s:%s ++", mCameraId, sequence, getName(), __func__); int ret = prepareTerminalBuffers(ipuParameters, inBufs, outBufs, sequence); CheckAndLogError((ret != OK), ret, "%s, prepareTerminalBuffers fail with %d", getName(), ret); @@ -932,7 +932,7 @@ int PGCommon::iterate(CameraBufferMap& inBufs, CameraBufferMap& outBufs, ia_bina } postTerminalBuffersDone(sequence); - LOG2("%s:%s -- ", sequence, getName(), __func__); + LOG2("%s:%s -- ", mCameraId, sequence, getName(), __func__); return ret; } @@ -1255,6 +1255,8 @@ int PGCommon::handleCmd(CIPR::Command** cmd, CIPR::PSysCommandConfig* cmdCfg) { cmdCfg->issueID = reinterpret_cast(cmd); eventCfg.commandIssueID = cmdCfg->issueID; + LOG3("@%s", mCameraId, __func__); + CIPR::Result ret = (*cmd)->setConfig(*cmdCfg); CheckAndLogError((ret != CIPR::Result::OK), UNKNOWN_ERROR, "%s, call CIPR::Command::setConfig fail", __func__); diff --git a/src/hal/CameraHal.cpp b/src/hal/CameraHal.cpp index acbeb064..00e4d15b 100644 --- a/src/hal/CameraHal.cpp +++ b/src/hal/CameraHal.cpp @@ -47,8 +47,12 @@ CameraHal::CameraHal() : mInitTimes(0), mState(HAL_UNINIT), mCameraOpenNum(0) { CLEAR(mCameraDevices); // VIRTUAL_CHANNEL_S - CLEAR(mTotalVirtualChannelCamNum); - CLEAR(mConfigTimes); + mCurrentGroupId = -1; + mVcNum = 0; + mConfigTimes = 0; + for (int i = 0; i < MAX_CAMERA_NUMBER; i++) { + mDeviceClosing[i] = false; + } // VIRTUAL_CHANNEL_E } @@ -70,12 +74,13 @@ int CameraHal::init() { CheckAndLogError(ret != OK, NO_INIT, "PlatformData init failed"); // VIRTUAL_CHANNEL_S - for (int i = 0; i < MAX_VC_GROUP_NUMBER; i++) { - mTotalVirtualChannelCamNum[i] = 0; - mConfigTimes[i] = 0; + mCurrentGroupId = -1; + mVcNum = 0; + mConfigTimes = 0; + for (int i = 0; i < MAX_CAMERA_NUMBER; i++) { + mDeviceClosing[i] = false; } // VIRTUAL_CHANNEL_E - mState = HAL_INIT; return OK; @@ -92,9 +97,11 @@ int CameraHal::deinit() { } // VIRTUAL_CHANNEL_S - for (int i = 0; i < MAX_VC_GROUP_NUMBER; i++) { - mTotalVirtualChannelCamNum[i] = 0; - mConfigTimes[i] = 0; + mVcNum = 0; + mCurrentGroupId = -1; + mConfigTimes = 0; + for (int i = 0; i < MAX_CAMERA_NUMBER; i++) { + mDeviceClosing[i] = false; } // VIRTUAL_CHANNEL_E @@ -127,18 +134,26 @@ int CameraHal::deviceOpen(int cameraId, int vcNum) { return INVALID_OPERATION; } - if (mCameraShm.CameraDeviceOpen(cameraId) != OK) return INVALID_OPERATION; - - mCameraDevices[cameraId] = new CameraDevice(cameraId); - // VIRTUAL_CHANNEL_S + CheckAndLogError(mCameraOpenNum && vcNum != mVcNum, INVALID_OPERATION, + "New vcNum %d dismatch the previous %d", vcNum, mVcNum); + camera_info_t info; CLEAR(info); PlatformData::getCameraInfo(cameraId, info); - int groupId = info.vc.group >= 0 ? info.vc.group : 0; - mTotalVirtualChannelCamNum[groupId] = vcNum; + if (info.vc.total_num) { + // Open as vc sensor + int groupId = info.vc.group >= 0 ? info.vc.group : 0; + CheckAndLogError(mCurrentGroupId >= 0 && groupId != mCurrentGroupId, INVALID_OPERATION, + "Open group %d fail because group %d already opened!", groupId, + mCurrentGroupId); + mCurrentGroupId = groupId; + } + mVcNum = vcNum; // VIRTUAL_CHANNEL_E + if (mCameraShm.CameraDeviceOpen(cameraId) != OK) return INVALID_OPERATION; + mCameraDevices[cameraId] = new CameraDevice(cameraId); // The check is to handle dual camera cases mCameraOpenNum = mCameraShm.cameraDeviceOpenNum(); CheckAndLogError(mCameraOpenNum == 0, INVALID_OPERATION, "camera open num couldn't be 0"); @@ -167,12 +182,32 @@ void CameraHal::deviceClose(int cameraId) { AutoMutex l(mLock); if (mCameraDevices[cameraId]) { - mCameraDevices[cameraId]->deinit(); - delete mCameraDevices[cameraId]; - mCameraDevices[cameraId] = nullptr; - + if (mVcNum <= 0) { + mCameraDevices[cameraId]->deinit(); + delete mCameraDevices[cameraId]; + mCameraDevices[cameraId] = nullptr; + mCameraOpenNum--; + } else if (!mDeviceClosing[cameraId]) { + // only deinit vc camera here + mCameraDevices[cameraId]->deinit(); + mCameraOpenNum--; + mDeviceClosing[cameraId] = true; + } mCameraShm.CameraDeviceClose(cameraId); } + // VIRTUAL_CHANNEL_S + // Destroy all closed vc cameras + if (mVcNum > 0 && mCameraOpenNum == 0) { + for (int i = 0; i < MAX_CAMERA_NUMBER; i++) { + if (mDeviceClosing[i]) { + delete mCameraDevices[i]; + mCameraDevices[i] = nullptr; + mDeviceClosing[i] = false; + } + } + mVcNum = 0; + } + // VIRTUAL_CHANNEL_E } void CameraHal::deviceCallbackRegister(int cameraId, const camera_callback_ops_t* callback) { @@ -215,15 +250,10 @@ int CameraHal::deviceConfigStreams(int cameraId, stream_config_t* streamList) { } // VIRTUAL_CHANNEL_S - camera_info_t info; - CLEAR(info); - PlatformData::getCameraInfo(cameraId, info); - int groupId = info.vc.group >= 0 ? info.vc.group : 0; - if (mTotalVirtualChannelCamNum[groupId] > 0) { - mConfigTimes[groupId]++; - LOG1(" @%s, mConfigTimes:%d, before signal", cameraId, __func__, - mConfigTimes[groupId]); - mVirtualChannelSignal[groupId].signal(); + if (mVcNum > 0) { + mConfigTimes++; + LOG1(" @%s, mConfigTimes:%d, before signal", cameraId, __func__, mConfigTimes); + mVirtualChannelSignal.signal(); } // VIRTUAL_CHANNEL_E @@ -238,22 +268,16 @@ int CameraHal::deviceStart(int cameraId) { checkCameraDevice(device, BAD_VALUE); // VIRTUAL_CHANNEL_S - camera_info_t info; - CLEAR(info); - PlatformData::getCameraInfo(cameraId, info); - int groupId = info.vc.group >= 0 ? info.vc.group : 0; - LOG1(" @%s, mConfigTimes:%d, mTotalVirtualChannelCamNum:%d", cameraId, __func__, - mConfigTimes[groupId], mTotalVirtualChannelCamNum[groupId]); - - if (mTotalVirtualChannelCamNum[groupId] > 0) { + if (mVcNum > 0) { + LOG1("@%s, mConfigTimes:%d, mVcNum:%d", cameraId, __func__, mConfigTimes, mVcNum); int timeoutCnt = 10; - while (mConfigTimes[groupId] < mTotalVirtualChannelCamNum[groupId]) { - mVirtualChannelSignal[groupId].waitRelative(lock, mWaitDuration * SLOWLY_MULTIPLIER); + while (mConfigTimes < mVcNum) { + mVirtualChannelSignal.waitRelative(lock, mWaitDuration * SLOWLY_MULTIPLIER); LOG1(" @%s, mConfigTimes:%d, timeoutCnt:%d", cameraId, __func__, - mConfigTimes[groupId], timeoutCnt); + mConfigTimes, timeoutCnt); --timeoutCnt; CheckAndLogError(!timeoutCnt, TIMED_OUT, " mConfigTimes:%d, wait time out", - cameraId, mConfigTimes[groupId]); + cameraId, mConfigTimes); } } // VIRTUAL_CHANNEL_E diff --git a/src/hal/CameraHal.h b/src/hal/CameraHal.h index 500cc04a..c208f481 100644 --- a/src/hal/CameraHal.h +++ b/src/hal/CameraHal.h @@ -74,9 +74,11 @@ class CameraHal { // Guard for CameraHal public API. Mutex mLock; // VIRTUAL_CHANNEL_S - int mTotalVirtualChannelCamNum[MAX_VC_GROUP_NUMBER]; - int mConfigTimes[MAX_VC_GROUP_NUMBER]; - Condition mVirtualChannelSignal[MAX_VC_GROUP_NUMBER]; + int mCurrentGroupId; + int mVcNum; + int mConfigTimes; + bool mDeviceClosing[MAX_CAMERA_NUMBER]; // deinited but not destroyed when close + Condition mVirtualChannelSignal; static const nsecs_t mWaitDuration = 500000000; // 500ms // VIRTUAL_CHANNEL_E diff --git a/src/platformdata/CameraParser.cpp b/src/platformdata/CameraParser.cpp index 6f4cabe8..ef41f752 100644 --- a/src/platformdata/CameraParser.cpp +++ b/src/platformdata/CameraParser.cpp @@ -772,7 +772,7 @@ void CameraParser::handleSensor(CameraParser* profiles, const char* name, const char* tablePtr = strtok_r(src, ",", &savePtr); if (tablePtr) pCurrentCam->mVcAggregator.mName = tablePtr; tablePtr = strtok_r(nullptr, ",", &savePtr); - if (tablePtr) pCurrentCam->mVcAggregator.mIndex = atoi(tablePtr); + if (tablePtr) pCurrentCam->mVcAggregator.mVcId = atoi(tablePtr); // VIRTUAL_CHANNEL_E } else if (strcmp(name, "disableBLCByAGain") == 0) { int size = strlen(atts[1]); @@ -1433,7 +1433,14 @@ void CameraParser::parseRouteElement(CameraParser* profiles, const char* name, c idx += 2; } - mc.routes.push_back(route); + auto it = mc.routings.find(route.entityName); + if (it != mc.routings.end()) { + it->second.push_back(route); + } else { + std::vector routes; + routes.push_back(route); + mc.routings.insert(std::pair>(route.entityName, routes)); + } } void CameraParser::parseVideoElement(CameraParser* profiles, const char* name, diff --git a/src/platformdata/CameraTypes.h b/src/platformdata/CameraTypes.h index 8b146fe3..809a5d60 100644 --- a/src/platformdata/CameraTypes.h +++ b/src/platformdata/CameraTypes.h @@ -286,8 +286,8 @@ typedef enum { // VIRTUAL_CHANNEL_S struct VcAggregator { - VcAggregator() { mIndex = -1; } - int mIndex; + VcAggregator() { mVcId = -1; } + int mVcId; std::string mName; }; // VIRTUAL_CHANNEL_E diff --git a/src/platformdata/PlatformData.cpp b/src/platformdata/PlatformData.cpp index 37db7486..365cd147 100644 --- a/src/platformdata/PlatformData.cpp +++ b/src/platformdata/PlatformData.cpp @@ -1667,7 +1667,7 @@ int PlatformData::getVirtualChannelSequence(int cameraId) { } int PlatformData::getVcAggregator(int cameraId, struct VcAggregator& aggregator) { - if (getInstance()->mStaticCfg.mCameras[cameraId].mVcAggregator.mIndex >= 0) { + if (getInstance()->mStaticCfg.mCameras[cameraId].mVcAggregator.mVcId >= 0) { aggregator = getInstance()->mStaticCfg.mCameras[cameraId].mVcAggregator; return OK; } diff --git a/src/v4l2/MediaControl.cpp b/src/v4l2/MediaControl.cpp index c50e75a8..de148fae 100644 --- a/src/v4l2/MediaControl.cpp +++ b/src/v4l2/MediaControl.cpp @@ -810,6 +810,9 @@ int MediaControl::setFormat(int cameraId, const McFormat* format, int targetWidt tmt.format = mbusfmt; tmt.pad = link->sink->index; tmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; + // VIRTUAL_CHANNEL_S + tmt.stream = format->stream; + // VIRTUAL_CHANNEL_E subDev->SetFormat(tmt); } } @@ -872,17 +875,25 @@ int MediaControl::mediaCtlSetup(int cameraId, MediaCtlConf* mc, int width, int h int ret = OK; // VIRTUAL_CHANNEL_S /* Set routing */ - for (auto& route : mc->routes) { - LOG1(" route entity:%s, sinkPad:%d, srcPad:%d, sinkStream:%d, srcStream:%d, flag:%d", - cameraId, route.entityName.c_str(), route.sinkPad, route.srcPad, route.sinkStream, - route.srcStream, route.flag); - + for (auto& routing : mc->routings) { + LOG1(" route entity:%s:", cameraId, routing.first.c_str()); + int num = routing.second.size(); + v4l2_subdev_route* routes = new v4l2_subdev_route[num]; + CheckAndLogError(!routes, NO_MEMORY, "Failed to alloc routes"); + for (int i = 0; i < num; i++) { + const McRoute& route = routing.second[i]; + v4l2_subdev_route r = {route.sinkPad, route.sinkStream, route.srcPad, route.srcStream, + route.flag}; + LOG1(" sinkPad:%d, srcPad:%d, sinkStream:%d, srcStream:%d, flag:%d", r.sink_pad, + r.source_pad, r.sink_stream, r.source_stream, route.flag); + + routes[i] = r; + } string subDeviceNodeName; - CameraUtils::getSubDeviceName(route.entityName.c_str(), subDeviceNodeName); + CameraUtils::getSubDeviceName(routing.first.c_str(), subDeviceNodeName); V4L2Subdevice* subDev = V4l2DeviceFactory::getSubDev(cameraId, subDeviceNodeName); - v4l2_subdev_route r = {route.sinkPad, route.sinkStream, route.srcPad, route.srcStream, - route.flag}; - ret = subDev->SetRouting(&r, 1); + ret = subDev->SetRouting(routes, num); + delete[] routes; CheckAndLogError(ret != 0, ret, "setRouting fail, ret:%d", ret); } // VIRTUAL_CHANNEL_E @@ -954,13 +965,25 @@ void MediaControl::mediaCtlClear(int cameraId, MediaCtlConf* mc) { // VIRTUAL_CHANNEL_S /* Clear routing */ - for (auto& route : mc->routes) { + for (auto& routing : mc->routings) { + LOG1(" route entity:%s:", cameraId, routing.first.c_str()); + int num = routing.second.size(); + v4l2_subdev_route* routes = new v4l2_subdev_route[num]; + CheckAndLogError(!routes, VOID_VALUE, "Failed to alloc routes"); + for (int i = 0; i < num; i++) { + const McRoute& route = routing.second[i]; + LOG1(" sinkPad:%d, srcPad:%d, sinkStream:%d, srcStream:%d, flag:%d", route.sinkPad, + route.srcPad, route.sinkStream, route.srcStream, route.flag); + v4l2_subdev_route r = {route.sinkPad, route.sinkStream, route.srcPad, route.srcStream, + route.flag & ~V4L2_SUBDEV_ROUTE_FL_ACTIVE}; + routes[i] = r; + } + string subDeviceNodeName; - CameraUtils::getSubDeviceName(route.entityName.c_str(), subDeviceNodeName); + CameraUtils::getSubDeviceName(routing.first.c_str(), subDeviceNodeName); V4L2Subdevice* subDev = V4l2DeviceFactory::getSubDev(cameraId, subDeviceNodeName); - v4l2_subdev_route r = {route.sinkPad, route.sinkStream, route.srcPad, route.srcStream, - route.flag & ~V4L2_SUBDEV_ROUTE_FL_ACTIVE}; - int ret = subDev->SetRouting(&r, 1); + int ret = subDev->SetRouting(routes, num); + delete[] routes; CheckAndLogError(ret != 0, VOID_VALUE, "Clear routing fail, ret:%d", ret); } // VIRTUAL_CHANNEL_E @@ -993,18 +1016,29 @@ int MediaControl::getPrivacyDeviceName(std::string* name) { } // PRIVACY_MODE_E +bool MediaControl::isMediaSourceEntity(const MediaEntity* entity) { + if (nullptr == entity) return false; + auto n_pads = entity->info.pads; + + for (auto i = 0; i < n_pads; ++i) { + // If any sink pad in an entity, it's not the source entity + if (entity->pads[i].flags & MEDIA_PAD_FL_SINK) return false; + } + + return true; +} + bool MediaControl::checkHasSource(const MediaEntity* sink, const std::string& source) { for (unsigned int i = 0; i < sink->numLinks; ++i) { if (sink->links[i].sink->entity == sink) { // links[i] is the link to sink entity // pre is the link's source entity MediaEntity* pre = sink->links[i].source->entity; - if (pre->info.type == MEDIA_ENT_T_V4L2_SUBDEV_SENSOR || - pre->info.type == MEDIA_ENT_T_V4L2_SUBDEV) { - // if pre is sensor, return compare name result + if (isMediaSourceEntity(pre)) { + // if pre is pure source, return compare name result if (strncmp(source.c_str(), pre->info.name, source.length()) == 0) return true; } else { - // if pre is not sensor, search recursively + // if pre is not pure source, search recursively if (checkHasSource(pre, source)) return true; } } diff --git a/src/v4l2/MediaControl.h b/src/v4l2/MediaControl.h index 39174c5f..4ba0251f 100644 --- a/src/v4l2/MediaControl.h +++ b/src/v4l2/MediaControl.h @@ -174,7 +174,7 @@ struct McVideoNode { struct MediaCtlConf { std::vector ctls; std::vector links; - std::vector routes; + std::map> routings; std::vector formats; std::vector outputs; std::vector videoNodes; @@ -296,6 +296,7 @@ class MediaControl { // VIRTUAL_CHANNEL_E int getLensName(std::string* lensName); + bool isMediaSourceEntity(const MediaEntity* entity); bool checkAvailableSensor(const std::string& sensorEntityName); bool checkAvailableSensor(const std::string& sensorEntityName, const std::string& sinkEntityName);