├── .gitignore ├── .gitmodules ├── AUTHORS ├── Android.mk ├── COPYING ├── ChangeLog ├── LICENSE ├── METADATA ├── Makefile.am ├── NEWS ├── NOTICE ├── README.md ├── autogen.sh ├── capi ├── Makefile.am ├── context_priv.cpp ├── context_priv.h ├── ctxs │ ├── context_cl.cpp │ ├── context_cl.h │ ├── context_stitch.cpp │ ├── context_stitch.h │ └── stitch_params.h ├── xcam_handle.cpp └── xcam_handle.h ├── code_style.sh ├── configure.ac ├── doc ├── Doxyfile ├── Makefile.am ├── xcam_360_video_stitching_2_cams.png ├── xcam_360_video_stitching_3_cams.png ├── xcam_cl_pipeline_20170407.png ├── xcam_dataflow_20160930.png ├── xcam_footer.html ├── xcam_framework_20181017.png ├── xcam_framework_20190329.png └── yocto │ └── libxcam_sample.bb ├── m4 ├── .gitignore └── xcam-utils.m4 ├── modules ├── Makefile.am ├── dnn │ ├── Makefile.am │ ├── feathernet │ │ ├── Feather_pytorch_2_onnx.py │ │ ├── README-template.md │ │ ├── README.md │ │ ├── cfgs │ │ │ ├── FeatherNetA-32.yaml │ │ │ ├── FeatherNetB-32-ir.yaml │ │ │ ├── FeatherNetB-32.yaml │ │ │ ├── MobileLiteNet54-32.yaml │ │ │ ├── MobileLiteNet54-se-64.yaml │ │ │ ├── fishnet150-32.yaml │ │ │ ├── mobilenetv2.yaml │ │ │ └── shufflenetv2_1.yaml │ │ ├── checkpoints │ │ │ └── pre-trainedModels │ │ │ │ └── readme.md │ │ ├── data │ │ │ ├── fileList.ipynb │ │ │ ├── fileList.py │ │ │ ├── ir_final_train.txt │ │ │ ├── ir_final_train_tmp.txt │ │ │ ├── label_ir_train.txt │ │ │ ├── our_filelist │ │ │ │ ├── 2depth_train.txt │ │ │ │ ├── 2ir_train.txt │ │ │ │ ├── 2label_train.txt │ │ │ │ └── 2rgb_train.txt │ │ │ ├── train_list.txt │ │ │ ├── val_private_list.txt │ │ │ └── val_public_list.txt │ │ ├── env.yml │ │ ├── license_related.md │ │ ├── losses.py │ │ ├── main.py │ │ ├── model_onnx2IR.py │ │ ├── models │ │ │ ├── FeatherNet.py │ │ │ ├── MobileLiteNet.py │ │ │ └── __init__.py │ │ ├── read_data.py │ │ ├── roc.py │ │ ├── tools │ │ │ ├── __init__.py │ │ │ ├── benchmark │ │ │ │ ├── __init__.py │ │ │ │ ├── compute_flops.py │ │ │ │ ├── compute_madd.py │ │ │ │ ├── compute_memory.py │ │ │ │ ├── compute_speed.py │ │ │ │ ├── model_hook.py │ │ │ │ ├── reporter.py │ │ │ │ ├── stat_tree.py │ │ │ │ └── statistics.py │ │ │ └── gluon2pytorch.py │ │ └── utils │ │ │ ├── __init__.py │ │ │ ├── data_aug.py │ │ │ └── profile.py │ └── inference │ │ ├── Makefile.am │ │ ├── dnn_inference_engine.cpp │ │ ├── dnn_inference_engine.h │ │ ├── dnn_inference_utils.cpp │ │ ├── dnn_inference_utils.h │ │ ├── dnn_object_detection.cpp │ │ ├── dnn_object_detection.h │ │ ├── dnn_semantic_segmentation.cpp │ │ ├── dnn_semantic_segmentation.h │ │ ├── dnn_super_resolution.cpp │ │ └── dnn_super_resolution.h ├── gles │ ├── Makefile.am │ ├── egl │ │ ├── egl_base.cpp │ │ ├── egl_base.h │ │ ├── egl_utils.cpp │ │ └── egl_utils.h │ ├── gl_blender.cpp │ ├── gl_blender.h │ ├── gl_buffer.cpp │ ├── gl_buffer.h │ ├── gl_command.cpp │ ├── gl_command.h │ ├── gl_compute_program.cpp │ ├── gl_compute_program.h │ ├── gl_copy_handler.cpp │ ├── gl_copy_handler.h │ ├── gl_dma_buffer_handler.cpp │ ├── gl_dma_buffer_handler.h │ ├── gl_fastmap_blender.cpp │ ├── gl_fastmap_blender.h │ ├── gl_geomap_handler.cpp │ ├── gl_geomap_handler.h │ ├── gl_image_handler.cpp │ ├── gl_image_handler.h │ ├── gl_image_shader.cpp │ ├── gl_image_shader.h │ ├── gl_program.cpp │ ├── gl_program.h │ ├── gl_shader.cpp │ ├── gl_shader.h │ ├── gl_stitcher.cpp │ ├── gl_stitcher.h │ ├── gl_sync.cpp │ ├── gl_sync.h │ ├── gl_texture.cpp │ ├── gl_texture.h │ ├── gl_utils.cpp │ ├── gl_utils.h │ ├── gl_video_buffer.cpp │ ├── gl_video_buffer.h │ ├── gles_std.cpp │ └── gles_std.h ├── isp │ ├── Makefile.am │ ├── aiq3a_utils.cpp │ ├── aiq3a_utils.h │ ├── aiq_handler.cpp │ ├── aiq_handler.h │ ├── atomisp_device.cpp │ ├── atomisp_device.h │ ├── hybrid_analyzer.cpp │ ├── hybrid_analyzer.h │ ├── hybrid_analyzer_loader.cpp │ ├── hybrid_analyzer_loader.h │ ├── iq │ │ ├── x3a_analyze_tuner.cpp │ │ ├── x3a_analyze_tuner.h │ │ ├── x3a_ciq_bnr_ee_tuning_handler.cpp │ │ ├── x3a_ciq_bnr_ee_tuning_handler.h │ │ ├── x3a_ciq_tnr_tuning_handler.cpp │ │ ├── x3a_ciq_tnr_tuning_handler.h │ │ ├── x3a_ciq_tuning_handler.cpp │ │ ├── x3a_ciq_tuning_handler.h │ │ ├── x3a_ciq_wavelet_tuning_handler.cpp │ │ └── x3a_ciq_wavelet_tuning_handler.h │ ├── isp_config_translator.cpp │ ├── isp_config_translator.h │ ├── isp_controller.cpp │ ├── isp_controller.h │ ├── isp_image_processor.cpp │ ├── isp_image_processor.h │ ├── isp_poll_thread.cpp │ ├── isp_poll_thread.h │ ├── libtbd.c │ ├── libtbd.h │ ├── sensor_descriptor.cpp │ ├── sensor_descriptor.h │ ├── x3a_analyzer_aiq.cpp │ ├── x3a_analyzer_aiq.h │ ├── x3a_isp_config.cpp │ ├── x3a_isp_config.h │ ├── x3a_statistics_queue.cpp │ ├── x3a_statistics_queue.h │ ├── xcam_cpf_reader.c │ └── xcam_cpf_reader.h ├── ocl │ ├── Makefile.am │ ├── cl_3a_image_processor.cpp │ ├── cl_3a_image_processor.h │ ├── cl_3a_stats_context.cpp │ ├── cl_3a_stats_context.h │ ├── cl_3d_denoise_handler.cpp │ ├── cl_3d_denoise_handler.h │ ├── cl_argument.cpp │ ├── cl_argument.h │ ├── cl_bayer_basic_handler.cpp │ ├── cl_bayer_basic_handler.h │ ├── cl_bayer_pipe_handler.cpp │ ├── cl_bayer_pipe_handler.h │ ├── cl_blender.cpp │ ├── cl_blender.h │ ├── cl_context.cpp │ ├── cl_context.h │ ├── cl_csc_handler.cpp │ ├── cl_csc_handler.h │ ├── cl_csc_image_processor.cpp │ ├── cl_csc_image_processor.h │ ├── cl_defog_dcp_handler.cpp │ ├── cl_defog_dcp_handler.h │ ├── cl_demo_handler.cpp │ ├── cl_demo_handler.h │ ├── cl_device.cpp │ ├── cl_device.h │ ├── cl_error.cpp │ ├── cl_error.h │ ├── cl_event.cpp │ ├── cl_event.h │ ├── cl_fisheye_handler.cpp │ ├── cl_fisheye_handler.h │ ├── cl_gauss_handler.cpp │ ├── cl_gauss_handler.h │ ├── cl_geo_map_handler.cpp │ ├── cl_geo_map_handler.h │ ├── cl_image_360_stitch.cpp │ ├── cl_image_360_stitch.h │ ├── cl_image_bo_buffer.cpp │ ├── cl_image_bo_buffer.h │ ├── cl_image_handler.cpp │ ├── cl_image_handler.h │ ├── cl_image_processor.cpp │ ├── cl_image_processor.h │ ├── cl_image_scaler.cpp │ ├── cl_image_scaler.h │ ├── cl_image_warp_handler.cpp │ ├── cl_image_warp_handler.h │ ├── cl_kernel.cpp │ ├── cl_kernel.h │ ├── cl_memory.cpp │ ├── cl_memory.h │ ├── cl_multi_image_handler.cpp │ ├── cl_multi_image_handler.h │ ├── cl_newtonemapping_handler.cpp │ ├── cl_newtonemapping_handler.h │ ├── cl_newwavelet_denoise_handler.cpp │ ├── cl_newwavelet_denoise_handler.h │ ├── cl_post_image_processor.cpp │ ├── cl_post_image_processor.h │ ├── cl_pyramid_blender.cpp │ ├── cl_pyramid_blender.h │ ├── cl_retinex_handler.cpp │ ├── cl_retinex_handler.h │ ├── cl_rgb_pipe_handler.cpp │ ├── cl_rgb_pipe_handler.h │ ├── cl_tnr_handler.cpp │ ├── cl_tnr_handler.h │ ├── cl_tonemapping_handler.cpp │ ├── cl_tonemapping_handler.h │ ├── cl_utils.cpp │ ├── cl_utils.h │ ├── cl_video_buffer.cpp │ ├── cl_video_buffer.h │ ├── cl_video_stabilizer.cpp │ ├── cl_video_stabilizer.h │ ├── cl_wavelet_denoise_handler.cpp │ ├── cl_wavelet_denoise_handler.h │ ├── cl_wire_frame_handler.cpp │ ├── cl_wire_frame_handler.h │ ├── cl_yuv_pipe_handler.cpp │ ├── cl_yuv_pipe_handler.h │ ├── priority_buffer_queue.cpp │ └── priority_buffer_queue.h ├── ocv │ ├── Makefile.am │ ├── cv_capi_feature_match.cpp │ ├── cv_capi_feature_match.h │ ├── cv_edgetaper.cpp │ ├── cv_edgetaper.h │ ├── cv_feature_match.cpp │ ├── cv_feature_match.h │ ├── cv_feature_match_cluster.cpp │ ├── cv_feature_match_cluster.h │ ├── cv_image_deblurring.cpp │ ├── cv_image_deblurring.h │ ├── cv_image_process_helper.cpp │ ├── cv_image_process_helper.h │ ├── cv_image_sharp.cpp │ ├── cv_image_sharp.h │ ├── cv_std.h │ ├── cv_utils.cpp │ ├── cv_utils.h │ ├── cv_wiener_filter.cpp │ └── cv_wiener_filter.h ├── render │ ├── Makefile.am │ ├── render_osg_camera_manipulator.cpp │ ├── render_osg_camera_manipulator.h │ ├── render_osg_model.cpp │ ├── render_osg_model.h │ ├── render_osg_shader.h │ ├── render_osg_viewer.cpp │ └── render_osg_viewer.h ├── soft │ ├── Makefile.am │ ├── soft_blender.cpp │ ├── soft_blender.h │ ├── soft_blender_tasks_priv.cpp │ ├── soft_blender_tasks_priv.h │ ├── soft_copy_task.cpp │ ├── soft_copy_task.h │ ├── soft_geo_mapper.cpp │ ├── soft_geo_mapper.h │ ├── soft_geo_tasks_priv.cpp │ ├── soft_geo_tasks_priv.h │ ├── soft_handler.cpp │ ├── soft_handler.h │ ├── soft_image.h │ ├── soft_stitcher.cpp │ ├── soft_stitcher.h │ ├── soft_video_buf_allocator.cpp │ ├── soft_video_buf_allocator.h │ ├── soft_worker.cpp │ └── soft_worker.h └── vulkan │ ├── Makefile.am │ ├── vk_blender.cpp │ ├── vk_blender.h │ ├── vk_cmdbuf.cpp │ ├── vk_cmdbuf.h │ ├── vk_copy_handler.cpp │ ├── vk_copy_handler.h │ ├── vk_descriptor.cpp │ ├── vk_descriptor.h │ ├── vk_device.cpp │ ├── vk_device.h │ ├── vk_geomap_handler.cpp │ ├── vk_geomap_handler.h │ ├── vk_handler.cpp │ ├── vk_handler.h │ ├── vk_instance.cpp │ ├── vk_instance.h │ ├── vk_memory.cpp │ ├── vk_memory.h │ ├── vk_pipeline.cpp │ ├── vk_pipeline.h │ ├── vk_shader.cpp │ ├── vk_shader.h │ ├── vk_stitcher.cpp │ ├── vk_stitcher.h │ ├── vk_sync.cpp │ ├── vk_sync.h │ ├── vk_video_buf_allocator.cpp │ ├── vk_video_buf_allocator.h │ ├── vk_worker.cpp │ ├── vk_worker.h │ ├── vulkan_common.cpp │ ├── vulkan_common.h │ └── vulkan_std.h ├── pkgconfig ├── Makefile.am └── libxcam.pc.in ├── plugins ├── 3a │ ├── Makefile.am │ ├── aiq │ │ ├── Makefile.am │ │ └── aiq_wrapper.cpp │ └── hybrid │ │ ├── Makefile.am │ │ └── sample.cpp ├── Makefile.am └── smart │ ├── Makefile.am │ ├── dvs │ ├── Makefile.am │ ├── libdvs │ │ ├── .gitignore │ │ ├── Makefile.am │ │ ├── libdvs.cpp │ │ ├── libdvs.h │ │ ├── stabilizer.cpp │ │ ├── stabilizer.h │ │ └── test-image-stabilization.cpp │ └── xcam_plugin_dvs.cpp │ └── sample │ ├── Makefile.am │ └── sample_smart_analysis.cpp ├── shaders ├── Makefile.am ├── cl │ ├── kernel_3d_denoise.cl │ ├── kernel_3d_denoise_slm.cl │ ├── kernel_bayer_basic.cl │ ├── kernel_bayer_pipe.cl │ ├── kernel_bi_filter.cl │ ├── kernel_csc.cl │ ├── kernel_defog_dcp.cl │ ├── kernel_demo.cl │ ├── kernel_fisheye.cl │ ├── kernel_gauss.cl │ ├── kernel_gauss_lap_pyramid.cl │ ├── kernel_geo_map.cl │ ├── kernel_image_scaler.cl │ ├── kernel_image_warp.cl │ ├── kernel_min_filter.cl │ ├── kernel_newtonemapping.cl │ ├── kernel_retinex.cl │ ├── kernel_rgb_pipe.cl │ ├── kernel_tnr.cl │ ├── kernel_tonemapping.cl │ ├── kernel_wavelet_coeff.cl │ ├── kernel_wavelet_denoise.cl │ ├── kernel_wavelet_haar.cl │ ├── kernel_wire_frame.cl │ └── kernel_yuv_pipe.cl ├── clx │ ├── .gitignore │ └── Makefile.am ├── glsl │ ├── shader_blend_pyr.comp.sl │ ├── shader_blend_pyr_yuv420.comp.sl │ ├── shader_copy.comp.sl │ ├── shader_copy_ssbo_to_tex.comp.sl │ ├── shader_copy_tex_to_ssbo.comp.sl │ ├── shader_fastmap_blend_uv_nv12.comp.sl │ ├── shader_fastmap_blend_uv_yuv420.comp.sl │ ├── shader_fastmap_blend_y.comp.sl │ ├── shader_gauss_scale_pyr.comp.sl │ ├── shader_gauss_scale_pyr_yuv420.comp.sl │ ├── shader_geomap.comp.sl │ ├── shader_geomap_fastmap_uv_nv12.comp.sl │ ├── shader_geomap_fastmap_uv_yuv420.comp.sl │ ├── shader_geomap_fastmap_y.comp.sl │ ├── shader_geomap_yuv420.comp.sl │ ├── shader_lap_trans_pyr.comp.sl │ ├── shader_lap_trans_pyr_yuv420.comp.sl │ ├── shader_reconstruct_pyr.comp.sl │ └── shader_reconstruct_pyr_yuv420.comp.sl ├── glslx │ ├── .gitignore │ └── Makefile.am └── spv │ ├── shader_blend_pyr.comp │ ├── shader_blend_pyr.comp.spv │ ├── shader_copy.comp │ ├── shader_copy.comp.spv │ ├── shader_gauss_scale_pyr.comp │ ├── shader_gauss_scale_pyr.comp.spv │ ├── shader_geomap.comp │ ├── shader_geomap.comp.spv │ ├── shader_lap_trans_pyr.comp │ ├── shader_lap_trans_pyr.comp.spv │ ├── shader_reconstruct_pyr.comp │ └── shader_reconstruct_pyr.comp.spv ├── tests ├── .gitignore ├── Makefile.am ├── camera_calibration_CamC3C8K.json ├── camera_calibration_CamC6C8K.json ├── test-binary-kernel.cpp ├── test-cl-image.cpp ├── test-device-manager.cpp ├── test-dnn-inference.cpp ├── test-gles-handler.cpp ├── test-image-blend.cpp ├── test-image-deblurring.cpp ├── test-image-stitching.cpp ├── test-pipe-manager.cpp ├── test-poll-thread.cpp ├── test-render-surround-view.cpp ├── test-soft-image.cpp ├── test-surround-view.cpp ├── test-video-stabilization.cpp ├── test-vk-handler.cpp ├── test-xcamsrc-camera.sh ├── test_common.h ├── test_inline.h ├── test_stream.h └── test_sv_params.h ├── tools ├── add-quotation-marks.sh ├── convert-binary-to-text.sh └── pre-commit-code-style.sh ├── wrapper ├── Makefile.am └── gstreamer │ ├── Makefile.am │ ├── gst_xcam_utils.h │ ├── gstxcambuffermeta.cpp │ ├── gstxcambuffermeta.h │ ├── gstxcambufferpool.cpp │ ├── gstxcambufferpool.h │ ├── gstxcamfilter.cpp │ ├── gstxcamfilter.h │ ├── gstxcamsrc.cpp │ ├── gstxcamsrc.h │ ├── interface │ ├── Makefile.am │ ├── gstxcaminterface.c │ └── gstxcaminterface.h │ ├── main_dev_manager.cpp │ ├── main_dev_manager.h │ ├── main_pipe_manager.cpp │ └── main_pipe_manager.h └── xcore ├── Makefile.am ├── analyzer_loader.cpp ├── analyzer_loader.h ├── base ├── xcam_3a_description.h ├── xcam_3a_result.h ├── xcam_3a_stats.h ├── xcam_3a_types.h ├── xcam_buffer.h ├── xcam_common.h ├── xcam_defs.h ├── xcam_params.h ├── xcam_smart_description.h └── xcam_smart_result.h ├── buffer_pool.cpp ├── buffer_pool.h ├── calibration_parser.cpp ├── calibration_parser.h ├── device_manager.cpp ├── device_manager.h ├── dma_video_buffer.cpp ├── dma_video_buffer.h ├── drm_bo_buffer.cpp ├── drm_bo_buffer.h ├── drm_display.cpp ├── drm_display.h ├── drm_v4l2_buffer.cpp ├── drm_v4l2_buffer.h ├── dynamic_analyzer.cpp ├── dynamic_analyzer.h ├── dynamic_analyzer_loader.cpp ├── dynamic_analyzer_loader.h ├── external_video_buffer_priv.cpp ├── fake_poll_thread.cpp ├── fake_poll_thread.h ├── fake_v4l2_device.h ├── file.cpp ├── file.h ├── fisheye_dewarp.cpp ├── fisheye_dewarp.h ├── fisheye_image_file.cpp ├── fisheye_image_file.h ├── handler_interface.cpp ├── handler_interface.h ├── image_file.cpp ├── image_file.h ├── image_handler.cpp ├── image_handler.h ├── image_processor.cpp ├── image_processor.h ├── image_projector.cpp ├── image_projector.h ├── interface ├── blender.cpp ├── blender.h ├── data_types.h ├── feature_match.cpp ├── feature_match.h ├── geo_mapper.cpp ├── geo_mapper.h ├── stitcher.cpp └── stitcher.h ├── meta_data.h ├── pipe_manager.cpp ├── pipe_manager.h ├── poll_thread.cpp ├── poll_thread.h ├── safe_list.h ├── smart_analysis_handler.cpp ├── smart_analysis_handler.h ├── smart_analyzer.cpp ├── smart_analyzer.h ├── smart_analyzer_loader.cpp ├── smart_analyzer_loader.h ├── smart_buffer_priv.cpp ├── smartptr.h ├── stats_callback_interface.h ├── swapped_buffer.cpp ├── swapped_buffer.h ├── thread_pool.cpp ├── thread_pool.h ├── uvc_device.cpp ├── uvc_device.h ├── v4l2_buffer_proxy.cpp ├── v4l2_buffer_proxy.h ├── v4l2_device.cpp ├── v4l2_device.h ├── vec_mat.h ├── video_buffer.cpp ├── video_buffer.h ├── worker.cpp ├── worker.h ├── x3a_analyzer.cpp ├── x3a_analyzer.h ├── x3a_analyzer_manager.cpp ├── x3a_analyzer_manager.h ├── x3a_analyzer_simple.cpp ├── x3a_analyzer_simple.h ├── x3a_event.h ├── x3a_image_process_center.cpp ├── x3a_image_process_center.h ├── x3a_result.cpp ├── x3a_result.h ├── x3a_result_factory.cpp ├── x3a_result_factory.h ├── x3a_stats_pool.cpp ├── x3a_stats_pool.h ├── xcam_analyzer.cpp ├── xcam_analyzer.h ├── xcam_buffer.cpp ├── xcam_common.cpp ├── xcam_mutex.h ├── xcam_obj_debug.h ├── xcam_std.h ├── xcam_thread.cpp ├── xcam_thread.h ├── xcam_utils.cpp └── xcam_utils.h /.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | Makefile 5 | 6 | # http://www.gnu.org/software/autoconf 7 | 8 | config.* 9 | /libtool 10 | /ltmain.sh 11 | /autom4te.cache 12 | /aclocal.m4 13 | /compile 14 | /configure 15 | /depcomp 16 | /install-sh 17 | /missing 18 | /stamp-h1 19 | /pkgconfig/*.pc 20 | .deps 21 | .libs 22 | .dirstamp 23 | 24 | # Object files 25 | *.o 26 | *.lo 27 | 28 | # Static libraries 29 | *.la 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ext/atomisp"] 2 | path = ext/atomisp 3 | url = https://github.com/windyuan/atomisp_headers.git 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | This project is maintained by Intel corporation 2 | 3 | Maintainers: 4 | Wei Zong 5 | 6 | Contributors: (orders by first name) 7 | Ali Mansouri 8 | Andrey Parfenov 9 | Fei Wang 10 | Jia Meng 11 | John Ye 12 | Juan Zhao 13 | Junkai Wu 14 | Sameer Kibey 15 | Shincy Tu 16 | Wind Yuan 17 | Yan Zhang 18 | Yao Wang 19 | Yinhang Liu 20 | -------------------------------------------------------------------------------- /METADATA: -------------------------------------------------------------------------------- 1 | name: "LibXCam" 2 | description: 3 | "libXCam is a project for extended camera and computer " 4 | "vision features. This library can work on GPU, CPU and " 5 | "other HW platforms to improve image/video quality. " 6 | "OpenCL as one of the common parallel computing languages " 7 | "is used to improve performance in different platforms. " 8 | "Other shading language supports are in roadmap." 9 | 10 | third_party { 11 | url { 12 | type: GIT 13 | value: "https://github.com/intel/libxcam.git" 14 | } 15 | version: "1.0.0" 16 | last_upgrade_date { year: 2017 month: 9 day: 11 } 17 | license_type: "Apache-2.0" 18 | } 19 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_CAPI 2 | CAPI_DIR = capi 3 | endif 4 | 5 | SUBDIRS = xcore shaders modules plugins \ 6 | wrapper $(CAPI_DIR) tests pkgconfig 7 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/NEWS -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | All files in xcore, tests directory are Apache 2.0 License. 2 | All header files in ext/atomisp are from Linux kernel user api headers 3 | All header files in ext/ia_imaging are Apache 2.0 License 4 | All dynamic libraries in ext/ia_imaging are provided by Intel Corporation 5 | 6 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | pre_commit_hook=".git/hooks/pre-commit" 4 | if test ! -L $pre_commit_hook; 5 | then 6 | rm -rf $pre_commit_hook 7 | ln -s ../../tools/pre-commit-code-style.sh $pre_commit_hook 8 | echo "link $pre_commit_hook to code style check" 9 | fi 10 | 11 | echo "Generating configure files" 12 | autoreconf -i 13 | # Run twice to get around a "ltmain.sh" bug 14 | autoreconf --install --force 15 | 16 | srcdir=`dirname "$0"` 17 | test -z "$srcdir" && srcdir=. 18 | 19 | if test -z "$NOCONFIGURE"; then 20 | $srcdir/configure "$@" 21 | fi 22 | -------------------------------------------------------------------------------- /capi/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libxcam_capi.la 2 | 3 | XCAMCAPI_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | -I$(top_srcdir)/xcore \ 6 | -I$(top_srcdir)/modules \ 7 | $(NULL) 8 | 9 | XCAMCAPI_LIBS = \ 10 | $(top_builddir)/xcore/libxcam_core.la \ 11 | $(top_builddir)/modules/soft/libxcam_soft.la \ 12 | $(NULL) 13 | 14 | if HAVE_LIBCL 15 | XCAMCAPI_CXXFLAGS += $(LIBCL_CFLAGS) 16 | XCAMCAPI_LIBS += \ 17 | $(LIBCL_LIBS) -ldl \ 18 | $(top_builddir)/modules/ocl/libxcam_ocl.la \ 19 | $(NULL) 20 | endif 21 | 22 | if HAVE_GLES 23 | XCAMCAPI_LIBS += $(top_builddir)/modules/gles/libxcam_gles.la 24 | endif 25 | 26 | if HAVE_VULKAN 27 | XCAMCAPI_LIBS += $(top_builddir)/modules/vulkan/libxcam_vulkan.la 28 | endif 29 | 30 | if HAVE_LIBDRM 31 | XCAMCAPI_CXXFLAGS += $(LIBDRM_CFLAGS) 32 | XCAMCAPI_LIBS += \ 33 | -ldrm_intel \ 34 | $(LIBDRM_LIBS) \ 35 | $(NULL) 36 | endif 37 | 38 | xcam_ocl_sources = \ 39 | xcam_handle.cpp \ 40 | context_priv.cpp \ 41 | ctxs/context_stitch.cpp \ 42 | $(NULL) 43 | 44 | if HAVE_LIBCL 45 | xcam_ocl_sources += ctxs/context_cl.cpp 46 | endif 47 | 48 | libxcam_capi_la_SOURCES = \ 49 | $(xcam_ocl_sources) \ 50 | $(NULL) 51 | 52 | libxcam_capi_la_CXXFLAGS = \ 53 | $(XCAMCAPI_CXXFLAGS) \ 54 | $(NULL) 55 | 56 | libxcam_capi_la_LIBADD = \ 57 | $(XCAMCAPI_LIBS) \ 58 | $(NULL) 59 | 60 | libxcam_capi_la_LDFLAGS = \ 61 | $(XCAM_LT_LDFLAGS) \ 62 | $(NULL) 63 | 64 | libxcam_capiincludedir = $(includedir)/xcam/capi 65 | 66 | nobase_libxcam_capiinclude_HEADERS = \ 67 | xcam_handle.h \ 68 | $(NULL) 69 | 70 | libxcam_capi_la_LIBTOOLFLAGS = --tag=disable-static 71 | -------------------------------------------------------------------------------- /code_style.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git status -s | grep -E "\.cpp$|\.h$" | cut -c4- | xargs astyle --indent=spaces=4 --convert-tabs --pad-oper --suffix=none 4 | -------------------------------------------------------------------------------- /doc/xcam_360_video_stitching_2_cams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/doc/xcam_360_video_stitching_2_cams.png -------------------------------------------------------------------------------- /doc/xcam_360_video_stitching_3_cams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/doc/xcam_360_video_stitching_3_cams.png -------------------------------------------------------------------------------- /doc/xcam_cl_pipeline_20170407.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/doc/xcam_cl_pipeline_20170407.png -------------------------------------------------------------------------------- /doc/xcam_dataflow_20160930.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/doc/xcam_dataflow_20160930.png -------------------------------------------------------------------------------- /doc/xcam_footer.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/xcam_framework_20181017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/doc/xcam_framework_20181017.png -------------------------------------------------------------------------------- /doc/xcam_framework_20190329.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/libxcam/eacfb5aa8373f50848d82d59bd8f81c51bf23f7b/doc/xcam_framework_20190329.png -------------------------------------------------------------------------------- /doc/yocto/libxcam_sample.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Libxcam" 2 | DESCRIPTION = "Libxcam: Extended camera features and cross platform computer vision project" 3 | HOMEPAGE = "https://github.com/intel/libxcam/wiki" 4 | LICENSE = "Apache-2.0" 5 | 6 | PR = "r0" 7 | S = "${WORKDIR}/git" 8 | 9 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=a739187a9544e0731270d11a8f5be792" 10 | 11 | SRC_URI = "git://github.com/intel/libxcam.git;branch=master" 12 | SRCREV = "${AUTOREV}" 13 | 14 | DEPENDS = "glib-2.0 libdrm beignet opencv gstreamer1.0 gstreamer1.0-plugins-base" 15 | 16 | inherit autotools pkgconfig 17 | 18 | EXTRA_OECONF = "--enable-gst --enable-drm --enable-libcl --enable-smartlib --enable-opencv" 19 | 20 | CFLAGS += "-fPIE -fPIC" 21 | CFLAGS += "-O2 -D_FORTIFY_SOURCE=2" 22 | CFLAGS += "-Wall -Wno-unused-parameter" 23 | CFLAGS += "-fstack-protector" 24 | 25 | LDFLAGS += "-z noexecstack" 26 | LDFLAGS += "-z relro -z now" 27 | 28 | PACKAGES += "${PN}-test" 29 | 30 | FILES_${PN} += "${libdir}/libxcam_core.so.*" 31 | FILES_${PN} += "${libdir}/libxcam_ocl.so.*" 32 | FILES_${PN} += "${libdir}/gstreamer-1.0/libgstxcamfilter.*" 33 | 34 | FILES_${PN}-dev += "${includedir}/xcam/*" 35 | FILES_${PN}-dev += "${libdir}/pkgconfig/libxcam.pc" 36 | FILES_${PN}-dev += "${libdir}/libxcam_core.so" 37 | FILES_${PN}-dev += "${libdir}/libxcam_core.la" 38 | FILES_${PN}-dev += "${libdir}/libxcam_core.a" 39 | FILES_${PN}-dev += "${libdir}/libxcam_ocl.so" 40 | FILES_${PN}-dev += "${libdir}/libxcam_ocl.la" 41 | 42 | FILES_${PN}-test = "${bindir}/test-*" 43 | 44 | FILES_${PN}-dbg += "${libdir}/gstreamer-1.0/.debug/*" 45 | FILES_${PN}-dbg += "${libdir}/.debug/" 46 | FILES_${PN}-dbg += "${bindir}/.debug/" 47 | 48 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | libtool.m4 4 | lt~obsolete.m4 5 | ltoptions.m4 6 | ltsugar.m4 7 | ltversion.m4 8 | -------------------------------------------------------------------------------- /modules/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_OPENCV 2 | OCV_DIR = ocv 3 | endif 4 | 5 | if HAVE_LIBCL 6 | OCL_DIR = ocl 7 | endif 8 | 9 | if HAVE_GLES 10 | GLES_DIR = gles 11 | endif 12 | 13 | if HAVE_VULKAN 14 | VULKAN_DIR = vulkan 15 | endif 16 | 17 | if ENABLE_RENDER 18 | RENDER_DIR = render 19 | endif 20 | 21 | if ENABLE_IA_AIQ 22 | ISP_DIR = isp 23 | endif 24 | 25 | if ENABLE_DNN 26 | DNN_DIR = dnn 27 | endif 28 | 29 | SUBDIRS = $(OCV_DIR) soft $(OCL_DIR) $(GLES_DIR) $(VULKAN_DIR) $(RENDER_DIR) $(ISP_DIR) $(DNN_DIR) 30 | -------------------------------------------------------------------------------- /modules/dnn/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_DNN 2 | INFERENCE_DIR = inference 3 | endif 4 | 5 | SUBDIRS = $(INFERENCE_DIR) 6 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/Feather_pytorch_2_onnx.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.insert(0,'.') 3 | sys.path.insert(0,'..') 4 | import torch 5 | from models import FeatherNet 6 | if __name__=='__main__': 7 | name = 'FeatherNetB' 8 | net = FeatherNet.mobilelitenetB() 9 | #print(net) 10 | model_path = './checkpoints/mobilelitenetB_bs32/_47_best.pth.tar' 11 | checkpoint = torch.load(model_path,map_location = 'cpu') 12 | print('load model:',model_path) 13 | model_dict = {} 14 | state_dict = net.state_dict() 15 | #print(checkpoint) 16 | for (k,v) in checkpoint['state_dict'].items(): 17 | print(k) 18 | if k[7:] in state_dict: 19 | model_dict[k[7:]] = v 20 | state_dict.update(model_dict) 21 | net.load_state_dict(state_dict) 22 | #net.load_state_dict(checkpoint['state_dict']) 23 | net.eval() 24 | dummy_input = torch.randn([1,3,224,224]) 25 | torch.onnx.export(net,dummy_input,'feathernetB.onnx',verbose=True) 26 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/FeatherNetA-32.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: FeatherNetA 3 | workers: 1 4 | batch_size: 32 5 | epochs: 200 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/FeatherNetA_bs32 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/FeatherNetB-32-ir.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: FeatherNetB 3 | workers: 1 4 | batch_size: 32 5 | epochs: 150 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/FeatherNetB_bs32-ir 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/FeatherNetB-32.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: FeatherNetB 3 | workers: 1 4 | batch_size: 32 5 | epochs: 150 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/feathernetB_bs32 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/MobileLiteNet54-32.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: MobileLiteNet54 3 | workers: 1 4 | batch_size: 32 5 | epochs: 200 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/MobileLiteNet54_bs32 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/MobileLiteNet54-se-64.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: MobileLiteNet54_se 3 | workers: 1 4 | batch_size: 64 5 | epochs: 200 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/MobileLiteNet54-se_bs64 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/fishnet150-32.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: fishnet150 3 | workers: 1 4 | batch_size: 32 5 | 6 | epochs: 100 7 | policy: "step" 8 | base_lr: 0.01 9 | momentum: 0.9 10 | weight_decay: 0.0001 11 | 12 | print_freq: 10 13 | save_path: checkpoints/fishnet150_bs32_5train 14 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/mobilenetv2.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: moilenetv2 3 | workers: 1 4 | batch_size: 32 5 | epochs: 200 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/mobilenetv2_bs32 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/cfgs/shufflenetv2_1.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | arch: shufflenetv2_1 3 | workers: 1 4 | batch_size: 128 5 | epochs: 200 6 | policy: "step" 7 | base_lr: 0.01 8 | momentum: 0.9 9 | weight_decay: 0.0001 10 | print_freq: 10 11 | save_path: checkpoints/shufflenetv2_1_bs128 12 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/checkpoints/pre-trainedModels/readme.md: -------------------------------------------------------------------------------- 1 | Download [fishnet150](https://pan.baidu.com/s/1uOEFsBHIdqpDLrbfCZJGUg) pretrained model from [FishNet150](https://github.com/kevin-ssy/FishNet)(Model trained without tricks ) 2 | 3 | Download [mobilenetv2](https://drive.google.com/open?id=1jlto6HRVD3ipNkAl1lNhDbkBp7HylaqR) pretrained model from [MobileNet V2](https://github.com/tonylins/pytorch-mobilenet-v2) 4 | 5 | place pre-trained models here 6 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/env.yml: -------------------------------------------------------------------------------- 1 | channels: 2 | - menpo 3 | - pytorch 4 | - defaults 5 | dependencies: 6 | - python=3.6.8=h0371630_0 7 | - pytorch=1.0.1=py3.6_cuda10.0.130_cudnn7.4.2_2 8 | - torchvision=0.2.2=py_3 9 | - cudatoolkit=10.0.130=0 10 | - numpy=1.16.2=py36h7e9f1db_0 11 | - opencv3=3.1.0=py36_0 12 | - scikit-learn=0.20.2=py36hd81dba3_0 13 | - pandas=0.24.1=py36he6710b0_0 14 | - matplotlib=2.2.2=py36hb69df0a_2 15 | - pip: 16 | - pyyaml==3.13 17 | 18 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/license_related.md: -------------------------------------------------------------------------------- 1 | All the code we contributed are under apache license. We don't have any license conflict. 2 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/model_onnx2IR.py: -------------------------------------------------------------------------------- 1 | onnx formate to openVINO IR formate 2 | reference :https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html -------------------------------------------------------------------------------- /modules/dnn/feathernet/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .net_factory import * 2 | from torchvision.models import * 3 | from .mobilenetv2 import * 4 | from .FeatherNet import * 5 | from .MobileLiteNet import * -------------------------------------------------------------------------------- /modules/dnn/feathernet/roc.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | from scipy import interpolate 4 | 5 | import matplotlib.pyplot as plt 6 | 7 | from sklearn.metrics import roc_curve 8 | from sklearn.metrics import roc_auc_score 9 | 10 | 11 | def cal_metric(target, predicted,show = False): 12 | fpr, tpr, thresholds = roc_curve(target, predicted) 13 | _tpr = (tpr) 14 | _fpr = (fpr) 15 | tpr = tpr.reshape((tpr.shape[0],1)) 16 | fpr = fpr.reshape((fpr.shape[0],1)) 17 | scale = np.arange(0, 1, 0.00000001) 18 | function = interpolate.interp1d(_fpr, _tpr) 19 | y = function(scale) 20 | znew = abs(scale + y -1) 21 | eer = scale[np.argmin(znew)] 22 | FPRs = {"TPR@FPR=10E-2": 0.01, "TPR@FPR=10E-3": 0.001, "TPR@FPR=10E-4": 0.0001} 23 | TPRs = {"TPR@FPR=10E-2": 0.01, "TPR@FPR=10E-3": 0.001, "TPR@FPR=10E-4": 0.0001} 24 | for i, (key, value) in enumerate(FPRs.items()): 25 | index = np.argwhere(scale == value) 26 | score = y[index] 27 | TPRs[key] = float(np.squeeze(score)) 28 | auc = roc_auc_score(target, predicted) 29 | if show: 30 | plt.plot(scale, y) 31 | plt.show() 32 | return eer,TPRs, auc,{'x':scale, 'y':y} 33 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/tools/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | # @Time : 2018/8/20 下午12:53 4 | # @Author : yuchangqian 5 | # @Contact : changqian_yu@163.com 6 | # @File : __init__.py.py 7 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/tools/benchmark/__init__.py: -------------------------------------------------------------------------------- 1 | from .compute_speed import compute_speed 2 | from .compute_memory import compute_memory 3 | from .compute_madd import compute_madd 4 | from .compute_flops import compute_flops 5 | from .stat_tree import StatTree, StatNode 6 | from .model_hook import ModelHook 7 | from .reporter import report_format 8 | from .statistics import stat, ModelStat 9 | 10 | __all__ = ['report_format', 'StatTree', 'StatNode', 'compute_speed', 11 | 'compute_madd', 'compute_flops', 'ModelHook', 'stat', 'ModelStat', 12 | '__main__', 13 | 'compute_memory'] -------------------------------------------------------------------------------- /modules/dnn/feathernet/tools/benchmark/compute_speed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import time 4 | 5 | import torch 6 | import logging 7 | 8 | 9 | 10 | logging.basicConfig(level=logging.INFO) 11 | logger = logging.getLogger(__name__) 12 | 13 | def compute_speed(model, input_size, device, iteration): 14 | # device = torch.device("cpu") 15 | torch.cuda.set_device(device) 16 | torch.backends.cudnn.benchmark = True 17 | 18 | 19 | model = model.module.to(device) 20 | model.eval() 21 | 22 | input = torch.randn(*input_size, device=device) 23 | input.to(device) 24 | 25 | for _ in range(10): 26 | model(input.float()) 27 | 28 | logger.info('=========Speed Testing=========') 29 | torch.cuda.synchronize() 30 | torch.cuda.synchronize() 31 | t_start = time.time() 32 | for _ in range(iteration): 33 | model(input) 34 | torch.cuda.synchronize() 35 | torch.cuda.synchronize() 36 | elapsed_time = time.time() - t_start 37 | logger.info( 38 | 'Elapsed time: [%.2f s / %d iter]' % (elapsed_time, iteration)) 39 | logger.info('Speed Time: %.2f ms / iter FPS: %.2f' % ( 40 | elapsed_time / iteration * 1000, iteration / elapsed_time)) 41 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/tools/gluon2pytorch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | # @Time : 2018/8/4 下午11:32 4 | # @Author : yuchangqian 5 | # @Contact : changqian_yu@163.com 6 | # @File : gluon2pytorch.py 7 | 8 | import os 9 | import mxnet as mx 10 | from gluoncv.model_zoo import get_model 11 | import torch 12 | 13 | import argparse 14 | 15 | parser = argparse.ArgumentParser() 16 | parser.add_argument('-m', '--model', type=str) 17 | parser.add_argument('-p', '--model_path', default='/unsullied/sharefs/yuchangqian/Storage/model_zoo', type=str) 18 | 19 | args = parser.parse_args() 20 | gluon_model_path = os.path.join(args.model_path, 'gluon_model') 21 | gluon_model_file = os.path.join(gluon_model_path, args.model+'.params') 22 | if not os.path.exists(gluon_model_file): 23 | gluon_model = get_model(args.model, pretrained=True, root=gluon_model_path) 24 | gluon_model_files = os.listdir(gluon_model_path) 25 | for file in gluon_model_files: 26 | if '-' in file: 27 | new_name = file.split('-')[0] + '.params' 28 | os.rename(os.path.join(gluon_model_path, file), os.path.join(gluon_model_path, new_name)) 29 | gluon_model_params = mx.nd.load(gluon_model_file) 30 | 31 | pytorch_model_params = {} 32 | 33 | print('Convert Gluon Model to PyTorch Model ...') 34 | for key, value in gluon_model_params.items(): 35 | if 'gamma' in key: 36 | key = key.replace('gamma', 'weight') 37 | elif 'beta' in key: 38 | key = key.replace('beta', 'bias') 39 | 40 | tensor = torch.from_numpy(value.asnumpy()) 41 | tensor.require_grad = True 42 | pytorch_model_params[key] = tensor 43 | 44 | pytorch_model_path = os.path.join(args.model_path, 'pytorch_model') 45 | torch.save(pytorch_model_params, os.path.join(pytorch_model_path, args.model+'.pth')) 46 | print('Finished!') 47 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .profile import * 2 | -------------------------------------------------------------------------------- /modules/dnn/feathernet/utils/data_aug.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | class ColorAugmentation(object): 5 | def __init__(self): 6 | self.eig_vec = torch.Tensor([ 7 | [0.4009, 0.7192, -0.5675], 8 | [-0.8140, -0.0045, -0.5808], 9 | [0.4203, -0.6948, -0.5836], 10 | ]) 11 | self.eig_val = torch.Tensor([[0.2175, 0.0188, 0.0045]]) 12 | 13 | def __call__(self, tensor): 14 | assert tensor.size(0) == 3 15 | alpha = torch.normal(mean=torch.zeros_like(self.eig_val)) * 0.1 16 | quatity = torch.mm(self.eig_val * alpha, self.eig_vec) 17 | tensor = tensor + quatity.view(3, 1, 1) 18 | return tensor -------------------------------------------------------------------------------- /modules/dnn/inference/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libxcam_dnn.la 2 | 3 | XCAM_DNN_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | $(LIBOPENVINO_CFLAGS) \ 6 | -I$(top_srcdir)/xcore \ 7 | -I$(top_srcdir)/modules \ 8 | $(NULL) 9 | 10 | XCAM_DNN_LIBS = \ 11 | $(top_builddir)/xcore/libxcam_core.la \ 12 | $(LIBOPENVINO_LIBS) \ 13 | $(NULL) 14 | 15 | if HAVE_OPENCV 16 | XCAM_DNN_CXXFLAGS += $(OPENCV_CFLAGS) 17 | XCAM_DNN_LIBS += $(top_builddir)/modules/ocv/libxcam_ocv.la 18 | endif 19 | 20 | xcam_dnn_sources = \ 21 | dnn_inference_engine.cpp \ 22 | dnn_object_detection.cpp \ 23 | dnn_super_resolution.cpp \ 24 | dnn_semantic_segmentation.cpp \ 25 | dnn_inference_utils.cpp \ 26 | $(NULL) 27 | 28 | libxcam_dnn_la_SOURCES = \ 29 | $(xcam_dnn_sources) \ 30 | $(NULL) 31 | 32 | libxcam_dnn_la_CXXFLAGS = \ 33 | $(XCAM_DNN_CXXFLAGS) \ 34 | $(NULL) 35 | 36 | libxcam_dnn_la_LIBADD = \ 37 | $(XCAM_DNN_LIBS) \ 38 | $(NULL) 39 | 40 | libxcam_dnn_la_LDFLAGS = \ 41 | $(XCAM_LT_LDFLAGS) \ 42 | $(NULL) 43 | 44 | libxcam_dnnincludedir = $(includedir)/xcam/dnn 45 | 46 | nobase_libxcam_dnninclude_HEADERS = \ 47 | dnn_inference_engine.h \ 48 | dnn_object_detection.h \ 49 | dnn_super_resolution.h \ 50 | dnn_semantic_segmentation.h \ 51 | dnn_inference_utils.h \ 52 | $(NULL) 53 | 54 | libxcam_dnn_la_LIBTOOLFLAGS = --tag=disable-static 55 | -------------------------------------------------------------------------------- /modules/dnn/inference/dnn_inference_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dnn_inference_utils.h - dnn inference utils header file 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | * Author: Ali Mansouri 20 | */ 21 | 22 | #ifndef XCAM_DNN_INFERENCE_UTILS_H 23 | #define XCAM_DNN_INFERENCE_UTILS_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "dnn_inference_engine.h" 30 | 31 | namespace XCamDNN { 32 | 33 | int32_t convert_dim (const ov::Dimension& dim); 34 | 35 | XCamReturn 36 | draw_bounding_boxes ( 37 | uint8_t *data, uint32_t width, uint32_t height, XCam::DnnInferImageFormatType format, 38 | std::vector rectangles, std::vector classes, int32_t thickness = 3); 39 | 40 | XCamReturn 41 | label_pixels (const std::string name, std::vector> map); 42 | 43 | XCamReturn 44 | save_bmp_file (const std::string name, 45 | void* data, 46 | XCam::DnnInferImageFormatType format, 47 | XCam::DnnInferPrecisionType precision, 48 | uint32_t width, 49 | uint32_t height); 50 | 51 | //std::shared_ptr 52 | uint8_t* 53 | convert_NV12_to_BGR (XCam::SmartPtr& nv12, float x_ratio, float y_ratio); 54 | 55 | uint8_t* 56 | resize_BGR (XCam::SmartPtr& bgr, float x_ratio, float y_ratio); 57 | 58 | } // namespace XCamDNN 59 | 60 | #endif //XCAM_DNN_INFERENCE_UTILS_H 61 | -------------------------------------------------------------------------------- /modules/dnn/inference/dnn_object_detection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dnn_object_detection.h - object detection 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | * Author: Ali Mansouri 20 | */ 21 | 22 | #ifndef XCAM_DNN_OBJECT_DETECTION_H 23 | #define XCAM_DNN_OBJECT_DETECTION_H 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | #include 30 | #include 31 | #include "dnn_inference_engine.h" 32 | 33 | namespace XCam { 34 | 35 | class DnnObjectDetection 36 | : public DnnInferenceEngine 37 | { 38 | public: 39 | explicit DnnObjectDetection (DnnInferConfig& config); 40 | virtual ~DnnObjectDetection (); 41 | 42 | virtual XCamReturn set_model_input_info (DnnInferInputOutputInfo& info); 43 | virtual XCamReturn get_model_input_info (DnnInferInputOutputInfo& info); 44 | 45 | virtual XCamReturn set_model_output_info (DnnInferInputOutputInfo& info); 46 | virtual XCamReturn get_model_output_info (DnnInferInputOutputInfo& info); 47 | 48 | XCamReturn get_bounding_boxes (const std::vector result_ptr, 49 | const uint32_t idx, 50 | std::vector &boxes, 51 | std::vector &classes); 52 | 53 | protected: 54 | virtual XCamReturn set_output_layer_type (const char* type); 55 | }; 56 | 57 | } // namespace XCam 58 | 59 | #endif // XCAM_DNN_OBJECT_DETECTION_H 60 | 61 | -------------------------------------------------------------------------------- /modules/dnn/inference/dnn_semantic_segmentation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dnn_semantic_segmentation.h - semantic segmentation 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | * Author: Ali Mansouri 20 | */ 21 | 22 | #ifndef XCAM_DNN_SEMANTIC_SEGMENTATION_H 23 | #define XCAM_DNN_SEMANTIC_SEGMENTATION_H 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | #include 30 | #include "dnn_inference_engine.h" 31 | 32 | namespace XCam { 33 | 34 | class DnnSemanticSegmentation 35 | : public DnnInferenceEngine 36 | { 37 | public: 38 | explicit DnnSemanticSegmentation (DnnInferConfig& config); 39 | virtual ~DnnSemanticSegmentation (); 40 | 41 | virtual XCamReturn set_model_input_info (DnnInferInputOutputInfo& info); 42 | virtual XCamReturn get_model_input_info (DnnInferInputOutputInfo& info); 43 | 44 | virtual XCamReturn set_model_output_info (DnnInferInputOutputInfo& info); 45 | virtual XCamReturn get_model_output_info (DnnInferInputOutputInfo& info); 46 | 47 | XCamReturn get_segmentation_map (const std::vector result_ptr, 48 | const uint32_t idx, 49 | std::vector>& out_classes); 50 | 51 | protected: 52 | virtual XCamReturn set_output_layer_type (const char* type); 53 | }; 54 | 55 | } // namespace XCam 56 | 57 | #endif //XCAM_DNN_SEMANTIC_SEGMENTATION_H 58 | -------------------------------------------------------------------------------- /modules/dnn/inference/dnn_super_resolution.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dnn_super_resolution.h - super resolution 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_DNN_SUPER_RESOLUTION_H 22 | #define XCAM_DNN_SUPER_RESOLUTION_H 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include "dnn_inference_engine.h" 30 | 31 | namespace XCam { 32 | 33 | class DnnSuperResolution 34 | : public DnnInferenceEngine 35 | { 36 | public: 37 | explicit DnnSuperResolution (DnnInferConfig& config); 38 | virtual ~DnnSuperResolution (); 39 | 40 | virtual XCamReturn set_model_input_info (DnnInferInputOutputInfo& info); 41 | virtual XCamReturn get_model_input_info (DnnInferInputOutputInfo& info); 42 | 43 | virtual XCamReturn set_model_output_info (DnnInferInputOutputInfo& info); 44 | virtual XCamReturn get_model_output_info (DnnInferInputOutputInfo& info); 45 | 46 | protected: 47 | virtual XCamReturn set_output_layer_type (const char* type); 48 | }; 49 | 50 | } // namespace XCam 51 | 52 | #endif // XCAM_DNN_SUPER_RESOLUTION_H 53 | 54 | -------------------------------------------------------------------------------- /modules/gles/egl/egl_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * egl_utils.h - EGL utilities 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_EGL_UTILS_H 22 | #define XCAM_EGL_UTILS_H 23 | 24 | #define EGL_EGLEXT_PROTOTYPES 25 | #include 26 | #include 27 | 28 | #define GL_GLEXT_PROTOTYPES 29 | #include 30 | 31 | #include 32 | 33 | namespace XCam { 34 | namespace EGL { 35 | 36 | inline EGLint get_error () 37 | { 38 | return eglGetError (); 39 | } 40 | 41 | const char *error_string (EGLint flag); 42 | 43 | } 44 | } 45 | #endif // XCAM_EGL_UTILS_H 46 | -------------------------------------------------------------------------------- /modules/gles/gl_compute_program.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_compute_program.h - GL compute program class 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_COMPUTE_PROGRAM_H 22 | #define XCAM_GL_COMPUTE_PROGRAM_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | struct GLGroupsSize { 29 | GLint x, y, z; 30 | GLGroupsSize () : x (0), y (0), z (0) {} 31 | }; 32 | 33 | class GLComputeProgram 34 | : public GLProgram 35 | { 36 | public: 37 | static SmartPtr create_compute_program (const char *name = NULL); 38 | ~GLComputeProgram (); 39 | 40 | bool set_groups_size (const GLGroupsSize &size); 41 | void set_barrier (bool barrier, GLbitfield barrier_bit = GL_SHADER_STORAGE_BARRIER_BIT) { 42 | _barrier = barrier; 43 | _barrier_bit = barrier_bit; 44 | } 45 | 46 | virtual XCamReturn work (); 47 | 48 | private: 49 | explicit GLComputeProgram (GLuint id, const char *name); 50 | 51 | XCamReturn dispatch (); 52 | XCamReturn barrier (GLbitfield barrier_bit); 53 | 54 | bool get_max_groups_size (GLGroupsSize &size); 55 | bool check_groups_size (const GLGroupsSize &size); 56 | 57 | private: 58 | XCAM_DEAD_COPY (GLComputeProgram); 59 | 60 | private: 61 | bool _barrier; 62 | GLbitfield _barrier_bit; 63 | GLGroupsSize _groups_size; 64 | static GLGroupsSize _max_groups_size; 65 | }; 66 | 67 | } 68 | 69 | #endif // XCAM_GL_COMPUTE_PROGRAM_H 70 | -------------------------------------------------------------------------------- /modules/gles/gl_copy_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_copy_handler.h - gl copy handler class 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_COPY_HANDER_H 22 | #define XCAM_GL_COPY_HANDER_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class GLCopyHandler 31 | : public GLImageHandler 32 | { 33 | public: 34 | GLCopyHandler (const char *name = "GLCopyHandler"); 35 | ~GLCopyHandler () {} 36 | 37 | bool set_copy_area (uint32_t idx, const Rect &in_area, const Rect &out_area); 38 | uint32_t get_index () { 39 | return _index; 40 | } 41 | 42 | XCamReturn copy (const SmartPtr &in_buf, SmartPtr &out_buf); 43 | virtual XCamReturn terminate (); 44 | 45 | protected: 46 | virtual XCamReturn configure_resource (const SmartPtr ¶m); 47 | virtual XCamReturn start_work (const SmartPtr ¶m); 48 | 49 | private: 50 | XCamReturn fix_parameters (const SmartPtr ¶m); 51 | 52 | private: 53 | uint32_t _index; 54 | Rect _in_area; 55 | Rect _out_area; 56 | SmartPtr _copy_shader; 57 | }; 58 | 59 | } 60 | #endif // XCAM_GL_COPY_HANDER_H 61 | -------------------------------------------------------------------------------- /modules/gles/gl_dma_buffer_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_dma_buffer_handler.h - gl DMA buffer handler class 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_GL_DMA_BUFFER_HANDER_H 22 | #define XCAM_GL_DMA_BUFFER_HANDER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace XCam { 32 | 33 | namespace GLDmaBufferPriv { 34 | class Impl; 35 | } 36 | 37 | enum ShaderID { 38 | CopyTex2SSBO = 0, 39 | CopySSBO2Tex, 40 | }; 41 | 42 | class GLDmaBufferHandler 43 | : public GLImageHandler 44 | { 45 | friend class GLDmaBufferPriv::Impl; 46 | 47 | public: 48 | GLDmaBufferHandler (const char *name = "GLDmaBufferHandler"); 49 | ~GLDmaBufferHandler (); 50 | 51 | XCamReturn set_opt_type (const uint32_t type); 52 | 53 | virtual XCamReturn terminate (); 54 | 55 | XCamReturn read_dma_buffer (const SmartPtr &dma_buf, SmartPtr &out_buf); 56 | XCamReturn write_dma_buffer (const SmartPtr &in_buf, SmartPtr &dma_buf); 57 | 58 | protected: 59 | virtual XCamReturn configure_resource (const SmartPtr ¶m); 60 | virtual XCamReturn start_work (const SmartPtr ¶m); 61 | 62 | private: 63 | uint32_t _opt_type; 64 | SmartPtr _impl; 65 | }; 66 | 67 | } 68 | #endif // XCAM_GL_DMA_BUFFER_HANDER_H 69 | -------------------------------------------------------------------------------- /modules/gles/gl_fastmap_blender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_fastmap_blender.h - gl fastmap blender class 3 | * 4 | * Copyright (c) 2020 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_FASTMAP_BLENDER_H 22 | #define XCAM_GL_FASTMAP_BLENDER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | namespace GLFastmapBlendPriv { 30 | class Impl; 31 | } 32 | 33 | class GLFastmapBlender 34 | : public GLImageHandler 35 | { 36 | public: 37 | explicit GLFastmapBlender (const char *name = "GLFastmapBlender"); 38 | ~GLFastmapBlender (); 39 | 40 | bool set_fastmappers ( 41 | const SmartPtr &left_mapper, const SmartPtr &right_mapper); 42 | bool set_blender (const SmartPtr &blender); 43 | 44 | virtual XCamReturn terminate (); 45 | 46 | protected: 47 | virtual XCamReturn configure_resource (const SmartPtr ¶m); 48 | virtual XCamReturn start_work (const SmartPtr ¶m); 49 | 50 | private: 51 | SmartPtr _left_mapper; 52 | SmartPtr _right_mapper; 53 | SmartPtr _blender; 54 | 55 | SmartPtr _impl; 56 | }; 57 | 58 | } 59 | 60 | #endif // XCAM_GL_FASTMAP_BLENDER_H 61 | -------------------------------------------------------------------------------- /modules/gles/gl_image_handler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_image_handler.cpp - GL image handler implementation 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #include "gl_image_handler.h" 22 | #include "gl_video_buffer.h" 23 | 24 | namespace XCam { 25 | 26 | GLImageHandler::GLImageHandler (const char* name) 27 | : ImageHandler (name) 28 | { 29 | } 30 | 31 | GLImageHandler::~GLImageHandler () 32 | { 33 | } 34 | 35 | SmartPtr 36 | GLImageHandler::create_allocator () 37 | { 38 | return new GLVideoBufferPool; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /modules/gles/gl_image_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_image_handler.h - GL image handler class 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_IMAGE_HANDLER_H 22 | #define XCAM_GL_IMAGE_HANDLER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class GLImageHandler 30 | : public ImageHandler 31 | { 32 | public: 33 | explicit GLImageHandler (const char* name); 34 | ~GLImageHandler (); 35 | 36 | private: 37 | SmartPtr create_allocator (); 38 | 39 | private: 40 | XCAM_DEAD_COPY (GLImageHandler); 41 | 42 | private: 43 | }; 44 | 45 | } 46 | 47 | #endif // XCAM_GL_IMAGE_HANDLER_H 48 | -------------------------------------------------------------------------------- /modules/gles/gl_program.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_program.h - GL Program 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_GL_PROGRAM_H 22 | #define XCAM_GL_PROGRAM_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class GLProgram 31 | { 32 | public: 33 | typedef std::map> ShaderList; 34 | enum State { 35 | StateIntiated = 0, 36 | StateLinked = 2, 37 | StateInUse = 3, 38 | }; 39 | 40 | virtual ~GLProgram (); 41 | static SmartPtr create_program (const char *name = NULL); 42 | GLuint get_program_id () const { 43 | return _program_id; 44 | } 45 | const char *get_name () { 46 | return _name; 47 | } 48 | 49 | XCamReturn link_shader (const GLShaderInfo &info); 50 | XCamReturn link_shaders (const GLShaderInfoList &infos); 51 | 52 | XCamReturn use (); 53 | XCamReturn disuse (); 54 | 55 | virtual XCamReturn work (); 56 | 57 | protected: 58 | explicit GLProgram (GLuint id, const char *name); 59 | 60 | private: 61 | XCamReturn attach_shader (const SmartPtr &shader); 62 | XCamReturn detach_shader (const SmartPtr &shader); 63 | XCamReturn clear_shaders (); 64 | XCamReturn link (); 65 | 66 | private: 67 | XCAM_DEAD_COPY (GLProgram); 68 | 69 | private: 70 | ShaderList _shaders; 71 | GLuint _program_id; 72 | State _state; 73 | char _name [XCAM_GL_NAME_LENGTH]; 74 | }; 75 | 76 | } 77 | 78 | #endif //XCAM_GL_PROGRAM_H 79 | -------------------------------------------------------------------------------- /modules/gles/gl_shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_shader.h - GL shader 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_GL_SHADER_H 22 | #define XCAM_GL_SHADER_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | XCAM_BEGIN_DECLARE 31 | 32 | typedef struct _GLShaderInfo { 33 | GLenum type; 34 | const GLchar *name; 35 | const GLchar *src; 36 | GLint len; 37 | } GLShaderInfo; 38 | 39 | XCAM_END_DECLARE 40 | 41 | typedef std::list GLShaderInfoList; 42 | 43 | class GLShader 44 | { 45 | public: 46 | ~GLShader (); 47 | static SmartPtr compile_shader (const GLShaderInfo &info); 48 | 49 | #if 0 50 | static SmartPtr create_binary_shader ( 51 | GLenum format, const uint8_t *binary, uint32_t length, const char *name = NULL); 52 | #endif 53 | 54 | GLuint get_shader_id () const { 55 | return _shader_id; 56 | } 57 | const char *get_name () const { 58 | return _name; 59 | } 60 | GLenum get_type () const { 61 | return _shader_type; 62 | } 63 | 64 | private: 65 | explicit GLShader (GLuint id, GLenum type, const char *name); 66 | 67 | private: 68 | XCAM_DEAD_COPY (GLShader); 69 | 70 | private: 71 | GLenum _shader_type; 72 | GLuint _shader_id; 73 | char _name [XCAM_GL_NAME_LENGTH]; 74 | }; 75 | 76 | } 77 | 78 | #endif //XCAM_GL_SHADER_H 79 | -------------------------------------------------------------------------------- /modules/gles/gl_stitcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_stitcher.h - GL stitcher class 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_STITCHER_H 22 | #define XCAM_GL_STITCHER_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | namespace GLStitcherPriv { 31 | class StitcherImpl; 32 | }; 33 | 34 | class GLStitcher 35 | : public GLImageHandler 36 | , public Stitcher 37 | { 38 | friend class GLStitcherPriv::StitcherImpl; 39 | 40 | public: 41 | struct StitcherParam 42 | : ImageHandler::Parameters 43 | { 44 | SmartPtr in_bufs[XCAM_STITCH_MAX_CAMERAS]; 45 | SmartPtr in_dmabufs[XCAM_STITCH_MAX_CAMERAS]; 46 | SmartPtr out_dmabuf; 47 | bool enable_dmabuf; 48 | 49 | StitcherParam () 50 | : Parameters (NULL, NULL) 51 | { 52 | enable_dmabuf = false; 53 | } 54 | }; 55 | 56 | public: 57 | explicit GLStitcher (const char *name = "GLStitcher"); 58 | ~GLStitcher (); 59 | 60 | virtual XCamReturn terminate (); 61 | 62 | protected: 63 | virtual XCamReturn stitch_buffers (const VideoBufferList &in_bufs, SmartPtr &out_buf); 64 | 65 | virtual XCamReturn configure_resource (const SmartPtr ¶m); 66 | virtual XCamReturn start_work (const SmartPtr ¶m); 67 | 68 | private: 69 | SmartPtr _impl; 70 | }; 71 | 72 | } 73 | 74 | #endif // XCAM_GL_STITCHER_H 75 | -------------------------------------------------------------------------------- /modules/gles/gl_sync.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_sync.cpp - GL sync implementation 3 | * 4 | * Copyright (c) 2020 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #include "gl_sync.h" 22 | 23 | namespace XCam { 24 | 25 | XCamReturn 26 | GLSync::flush () 27 | { 28 | glFlush (); 29 | 30 | GLenum error = gl_error (); 31 | XCAM_FAIL_RETURN ( 32 | ERROR, error == GL_NO_ERROR, XCAM_RETURN_ERROR_GLES, 33 | "GLSync flush failed, error flag: %s", gl_error_string (error)); 34 | 35 | return XCAM_RETURN_NO_ERROR; 36 | } 37 | 38 | XCamReturn 39 | GLSync::finish () 40 | { 41 | glFinish (); 42 | 43 | GLenum error = gl_error (); 44 | XCAM_FAIL_RETURN ( 45 | ERROR, error == GL_NO_ERROR, XCAM_RETURN_ERROR_GLES, 46 | "GLSync finish failed, error flag: %s", gl_error_string (error)); 47 | 48 | return XCAM_RETURN_NO_ERROR; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /modules/gles/gl_sync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_sync.h - GL sync class 3 | * 4 | * Copyright (c) 2020 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_SYNC_H 22 | #define XCAM_GL_SYNC_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class GLSync 29 | { 30 | public: 31 | static XCamReturn flush (); 32 | static XCamReturn finish (); 33 | }; 34 | 35 | } 36 | 37 | #endif // XCAM_GL_SYNC_H -------------------------------------------------------------------------------- /modules/gles/gl_utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_utils.h - GL utilities implementation 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #include "gl_utils.h" 22 | #include "xcam_utils.h" 23 | 24 | namespace XCam { 25 | 26 | SmartPtr get_glbuffer (const SmartPtr &buf) 27 | { 28 | SmartPtr gl_video_buf = buf.dynamic_cast_ptr (); 29 | XCAM_FAIL_RETURN ( 30 | ERROR, gl_video_buf.ptr (), NULL, 31 | "convert VideoBuffer to GLVideoBuffer failed"); 32 | 33 | SmartPtr gl_buf = gl_video_buf->get_gl_buffer (); 34 | XCAM_ASSERT (gl_buf.ptr ()); 35 | XCAM_FAIL_RETURN ( 36 | ERROR, gl_buf.ptr (), NULL, 37 | "get GLBuffer from GLVideoBuffer failed"); 38 | 39 | return gl_buf; 40 | } 41 | 42 | void dump_buf (const SmartPtr &buf, const char *name) 43 | { 44 | char file_name[256]; 45 | XCAM_ASSERT (name); 46 | XCAM_ASSERT (buf.ptr ()); 47 | 48 | const GLBufferDesc &desc = buf->get_buffer_desc (); 49 | snprintf ( 50 | file_name, 256, "%s-%dx%d.%s", 51 | name, desc.width, desc.height, xcam_fourcc_to_string (desc.format)); 52 | 53 | uint8_t *mem = (uint8_t *)buf->map_range (); 54 | dump_data_buf (mem, desc.size, file_name); 55 | buf->unmap (); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /modules/gles/gl_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_utils.h - GL utilities class 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_UTILS_H 22 | #define XCAM_GL_UTILS_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | SmartPtr get_glbuffer (const SmartPtr &buf); 29 | void dump_buf (const SmartPtr &buf, const char *name); 30 | 31 | } 32 | 33 | #endif // XCAM_GL_UTILS_H -------------------------------------------------------------------------------- /modules/gles/gl_video_buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gl_video_buffer.h - GL video buffer class 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_GL_VIDEO_BUFFER_H 22 | #define XCAM_GL_VIDEO_BUFFER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class GLVideoBuffer 30 | : public BufferProxy 31 | { 32 | friend class GLVideoBufferPool; 33 | 34 | public: 35 | virtual ~GLVideoBuffer () {} 36 | SmartPtr get_gl_buffer (); 37 | 38 | protected: 39 | explicit GLVideoBuffer (const VideoBufferInfo &info, const SmartPtr &data); 40 | }; 41 | 42 | class GLVideoBufferPool 43 | : public BufferPool 44 | { 45 | public: 46 | explicit GLVideoBufferPool (); 47 | explicit GLVideoBufferPool (const VideoBufferInfo &info, GLenum target = GL_SHADER_STORAGE_BUFFER); 48 | virtual ~GLVideoBufferPool (); 49 | 50 | void set_binding_target (GLenum target) { 51 | _target = target; 52 | } 53 | 54 | private: 55 | virtual SmartPtr allocate_data (const VideoBufferInfo &info, const void* in_data = NULL); 56 | virtual SmartPtr create_buffer_from_data (SmartPtr &data); 57 | 58 | private: 59 | GLenum _target; 60 | }; 61 | 62 | }; 63 | #endif // XCAM_GL_VIDEO_BUFFER_H 64 | 65 | -------------------------------------------------------------------------------- /modules/gles/gles_std.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * gles_std.cpp - GLES std 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "gles_std.h" 22 | 23 | namespace XCam { 24 | 25 | const char * 26 | gl_error_string (GLenum flag) 27 | { 28 | static char str[XCAM_GL_NAME_LENGTH] = {'\0'}; 29 | 30 | switch (flag) 31 | { 32 | case GL_NO_ERROR: 33 | snprintf (str, sizeof (str), "0x%04x:%s", flag, "GL_NO_ERROR"); 34 | break; 35 | case GL_INVALID_ENUM: 36 | snprintf (str, sizeof (str), "0x%04x:%s", flag, "GL_INVALID_ENUM"); 37 | break; 38 | case GL_INVALID_VALUE: 39 | snprintf (str, sizeof (str), "0x%04x:%s", flag, "GL_INVALID_VALUE"); 40 | break; 41 | case GL_INVALID_OPERATION: 42 | snprintf (str, sizeof (str), "0x%04x:%s", flag, "GL_INVALID_OPERATION"); 43 | break; 44 | case GL_INVALID_FRAMEBUFFER_OPERATION: 45 | snprintf (str, sizeof (str), "0x%04x:%s", flag, "GL_INVALID_FRAMEBUFFER_OPERATION"); 46 | break; 47 | case GL_OUT_OF_MEMORY: 48 | snprintf (str, sizeof (str), "0x%04x:%s", flag, "GL_OUT_OF_MEMORY"); 49 | break; 50 | default: 51 | snprintf (str, sizeof (str), "unknown flag:0x%04x", flag); 52 | XCAM_LOG_ERROR ("%s", str); 53 | } 54 | 55 | return str; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /modules/gles/gles_std.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gles_std.h - GLES std 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_GLES_STD_H 22 | #define XCAM_GLES_STD_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #if HAVE_GLES_32 29 | #include 30 | #else 31 | #include 32 | #endif 33 | 34 | #define XCAM_GL_NAME_LENGTH 64 35 | #define XCAM_GL_RESERVED_BUF_COUNT 4 36 | 37 | namespace XCam { 38 | 39 | inline GLenum gl_error () 40 | { 41 | return glGetError (); 42 | } 43 | 44 | const char *gl_error_string (GLenum flag); 45 | 46 | } 47 | 48 | #endif // XCAM_GLES_STD_H 49 | -------------------------------------------------------------------------------- /modules/isp/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libxcam_isp.la 2 | 3 | XCAMISP_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | $(IA_IMAGING_CFLAGS) \ 6 | -I$(top_srcdir)/xcore \ 7 | -I$(top_srcdir)/modules/isp \ 8 | $(NULL) 9 | 10 | XCAMISP_LIBS = \ 11 | $(IA_IMAGING_LIBS) \ 12 | $(top_builddir)/xcore/libxcam_core.la \ 13 | $(NULL) 14 | 15 | if USE_LOCAL_ATOMISP 16 | XCAMISP_CXXFLAGS += \ 17 | -I$(top_srcdir)/ext/atomisp \ 18 | $(NULL) 19 | endif 20 | 21 | if HAVE_LIBDRM 22 | XCAMISP_CXXFLAGS += $(LIBDRM_CFLAGS) 23 | XCAMISP_LIBS += \ 24 | -ldrm_intel \ 25 | $(LIBDRM_LIBS) \ 26 | $(NULL) 27 | endif 28 | 29 | xcam_isp_sources = \ 30 | aiq3a_utils.cpp \ 31 | atomisp_device.cpp \ 32 | isp_poll_thread.cpp \ 33 | isp_image_processor.cpp \ 34 | isp_controller.cpp \ 35 | isp_config_translator.cpp \ 36 | x3a_isp_config.cpp \ 37 | sensor_descriptor.cpp \ 38 | iq/x3a_analyze_tuner.cpp \ 39 | iq/x3a_ciq_tuning_handler.cpp \ 40 | iq/x3a_ciq_tnr_tuning_handler.cpp \ 41 | iq/x3a_ciq_bnr_ee_tuning_handler.cpp \ 42 | iq/x3a_ciq_wavelet_tuning_handler.cpp \ 43 | x3a_statistics_queue.cpp \ 44 | aiq_handler.cpp \ 45 | hybrid_analyzer.cpp \ 46 | hybrid_analyzer_loader.cpp \ 47 | x3a_analyzer_aiq.cpp \ 48 | libtbd.c \ 49 | xcam_cpf_reader.c \ 50 | $(NULL) 51 | 52 | libxcam_isp_la_SOURCES = \ 53 | $(xcam_isp_sources) \ 54 | $(NULL) 55 | 56 | libxcam_isp_la_CXXFLAGS = \ 57 | $(XCAMISP_CXXFLAGS) \ 58 | $(NULL) 59 | 60 | libxcam_isp_la_CFLAGS = $(libxcam_isp_la_CXXFLAGS) 61 | 62 | libxcam_isp_la_LIBADD = \ 63 | $(XCAMISP_LIBS) \ 64 | $(NULL) 65 | 66 | libxcam_isp_la_LDFLAGS = \ 67 | $(XCAM_LT_LDFLAGS) \ 68 | $(NULL) 69 | 70 | libxcam_isp_la_LIBTOOLFLAGS = --tag=disable-static 71 | -------------------------------------------------------------------------------- /modules/isp/aiq3a_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aiq3a_utils.h - aiq 3a utility: 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Author: Shincy Tu 20 | */ 21 | 22 | #ifndef XCAM_AIQ_UTILS_H 23 | #define XCAM_AIQ_UTILS_H 24 | 25 | 26 | #include 27 | #include "x3a_result.h" 28 | 29 | #include 30 | #include 31 | 32 | namespace XCam { 33 | bool translate_3a_stats (XCam3AStats *from, struct atomisp_3a_statistics *to); 34 | uint32_t translate_3a_results_to_xcam (XCam::X3aResultList &list, 35 | XCam3aResultHead *results[], uint32_t max_count); 36 | 37 | void free_3a_result (XCam3aResultHead *result); 38 | } 39 | 40 | #endif //XCAM_AIQ_UTILS_H 41 | -------------------------------------------------------------------------------- /modules/isp/atomisp_device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * atomisp_device.h - atomisp device 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_ATOMISP_DEVICE_H 22 | #define XCAM_ATOMISP_DEVICE_H 23 | 24 | #include 25 | #include "v4l2_device.h" 26 | #if HAVE_LIBDRM 27 | #include "drm_display.h" 28 | #endif 29 | 30 | namespace XCam { 31 | 32 | #if HAVE_LIBDRM 33 | class DrmDisplay; 34 | #endif 35 | 36 | class AtomispDevice 37 | : public V4l2Device 38 | { 39 | friend class DrmV4l2Buffer; 40 | 41 | public: 42 | explicit AtomispDevice (const char *name = NULL); 43 | ~AtomispDevice (); 44 | 45 | #if HAVE_LIBDRM 46 | void set_drm_display(SmartPtr &drm_disp) { 47 | _drm_disp = drm_disp; 48 | }; 49 | #endif 50 | 51 | protected: 52 | virtual XCamReturn pre_set_format (struct v4l2_format &format); 53 | virtual XCamReturn allocate_buffer ( 54 | SmartPtr &buf, 55 | const struct v4l2_format &format, 56 | const uint32_t index); 57 | 58 | private: 59 | XCAM_DEAD_COPY (AtomispDevice); 60 | 61 | #if HAVE_LIBDRM 62 | private: 63 | SmartPtr _drm_disp; 64 | #endif 65 | }; 66 | 67 | }; 68 | 69 | #endif //XCAM_ATOMISP_DEVICE_H 70 | -------------------------------------------------------------------------------- /modules/isp/hybrid_analyzer_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hybrid_analyzer_loader.h - hybrid analyzer loader 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Zong Wei 20 | */ 21 | 22 | #ifndef XCAM_HYBRID_ANALYZER_LOADER_H 23 | #define XCAM_HYBRID_ANALYZER_LOADER_H 24 | 25 | #include 26 | #include 27 | #include "dynamic_analyzer_loader.h" 28 | #include "isp_controller.h" 29 | 30 | namespace XCam { 31 | class IspController; 32 | class X3aAnalyzer; 33 | 34 | class HybridAnalyzerLoader 35 | : public AnalyzerLoader 36 | { 37 | public: 38 | HybridAnalyzerLoader (const char *lib_path, const char *symbol = XCAM_3A_LIB_DESCRIPTION); 39 | virtual ~HybridAnalyzerLoader (); 40 | 41 | virtual bool set_cpf_path (const char *cpf_path); 42 | virtual bool set_isp_controller (SmartPtr &isp); 43 | virtual SmartPtr load_analyzer (SmartPtr &self); 44 | 45 | protected: 46 | virtual void *load_symbol (void* handle); 47 | 48 | private: 49 | XCAM_DEAD_COPY(HybridAnalyzerLoader); 50 | 51 | private: 52 | const char *_cpf_path; 53 | SmartPtr _isp; 54 | }; 55 | 56 | }; 57 | 58 | #endif // XCAM_HYBRID_ANALYZER_LOADER_H -------------------------------------------------------------------------------- /modules/isp/iq/x3a_ciq_bnr_ee_tuning_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x3a_ciq_bnr_tuning_handler.h - x3a Common IQ bayer NR EE tuning handler 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wangfei 19 | */ 20 | 21 | #ifndef XCAM_3A_CIQ_BNR_EE_TUNING_HANDLER_H 22 | #define XCAM_3A_CIQ_BNR_EE_TUNING_HANDLER_H 23 | 24 | #include "xcam_utils.h" 25 | 26 | namespace XCam { 27 | 28 | class X3aCiqBnrEeTuningHandler 29 | : public X3aCiqTuningHandler 30 | { 31 | public: 32 | explicit X3aCiqBnrEeTuningHandler (); 33 | virtual ~X3aCiqBnrEeTuningHandler (); 34 | 35 | virtual XCamReturn analyze (X3aResultList &output); 36 | 37 | private: 38 | XCAM_DEAD_COPY (X3aCiqBnrEeTuningHandler); 39 | 40 | }; 41 | 42 | }; 43 | 44 | #endif // XCAM_3A_CIQ_BNR_EE_TUNING_HANDLER_H 45 | -------------------------------------------------------------------------------- /modules/isp/iq/x3a_ciq_tnr_tuning_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x3a_ciq_tnr_tuning_handler.h - x3a Common IQ TNR tuning handler 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_3A_CIQ_TNR_TUNING_HANDLER_H 22 | #define XCAM_3A_CIQ_TNR_TUNING_HANDLER_H 23 | 24 | #include "xcam_utils.h" 25 | 26 | namespace XCam { 27 | 28 | class X3aCiqTnrTuningHandler 29 | : public X3aCiqTuningHandler 30 | { 31 | public: 32 | explicit X3aCiqTnrTuningHandler (); 33 | virtual ~X3aCiqTnrTuningHandler (); 34 | 35 | virtual XCamReturn analyze (X3aResultList &output); 36 | 37 | private: 38 | XCAM_DEAD_COPY (X3aCiqTnrTuningHandler); 39 | 40 | }; 41 | 42 | }; 43 | 44 | #endif // XCAM_3A_CIQ_TNR_TUNING_HANDLER_H 45 | -------------------------------------------------------------------------------- /modules/isp/iq/x3a_ciq_wavelet_tuning_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x3a_ciq_wavelet_tuning_handler.h - x3a Common IQ Wavelet denoise tuning handler 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_3A_CIQ_WAVELET_TUNING_HANDLER_H 22 | #define XCAM_3A_CIQ_WAVELET_TUNING_HANDLER_H 23 | 24 | #include "xcam_utils.h" 25 | 26 | namespace XCam { 27 | 28 | class X3aCiqWaveletTuningHandler 29 | : public X3aCiqTuningHandler 30 | { 31 | public: 32 | explicit X3aCiqWaveletTuningHandler (); 33 | virtual ~X3aCiqWaveletTuningHandler (); 34 | 35 | virtual XCamReturn analyze (X3aResultList &output); 36 | 37 | private: 38 | XCAM_DEAD_COPY (X3aCiqWaveletTuningHandler); 39 | 40 | }; 41 | 42 | }; 43 | 44 | #endif // XCAM_3A_CIQ_WAVELET_TUNING_HANDLER_H 45 | -------------------------------------------------------------------------------- /modules/isp/isp_controller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * isp_controller.h - isp controller 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | #ifndef XCAM_ISP_CONTROLLER_H 21 | #define XCAM_ISP_CONTROLLER_H 22 | 23 | #include 24 | #include "x3a_isp_config.h" 25 | 26 | namespace XCam { 27 | 28 | class V4l2Device; 29 | class X3aIspStatistics; 30 | class X3aIspConfig; 31 | 32 | class IspController { 33 | public: 34 | explicit IspController (SmartPtr & device); 35 | ~IspController (); 36 | 37 | void init_sensor_mode_data (struct atomisp_sensor_mode_data *sensor_mode_data); 38 | XCamReturn get_sensor_mode_data (struct atomisp_sensor_mode_data &sensor_mode_data); 39 | XCamReturn get_isp_parameter (struct atomisp_parm ¶meters); 40 | 41 | XCamReturn get_3a_statistics (SmartPtr &stats); 42 | XCamReturn set_3a_config (X3aIspConfig *config); 43 | XCamReturn set_3a_exposure (X3aIspExposureResult *res); 44 | XCamReturn set_3a_exposure (const struct atomisp_exposure &exposure); 45 | XCamReturn set_3a_focus (const XCam3aResultFocus &focus); 46 | 47 | private: 48 | 49 | XCAM_DEAD_COPY (IspController); 50 | 51 | private: 52 | SmartPtr _device; 53 | }; 54 | 55 | }; 56 | 57 | #endif //XCAM_ISP_CONTROLLER_H 58 | -------------------------------------------------------------------------------- /modules/isp/isp_poll_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * isp_poll_thread.h - isp poll thread for event and buffer 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Author: Yinhang Liu 20 | */ 21 | 22 | #ifndef XCAM_ISP_POLL_THREAD_H 23 | #define XCAM_ISP_POLL_THREAD_H 24 | 25 | #include "poll_thread.h" 26 | #include "isp_controller.h" 27 | 28 | namespace XCam { 29 | 30 | class IspPollThread 31 | : public PollThread 32 | { 33 | public: 34 | explicit IspPollThread (); 35 | virtual ~IspPollThread (); 36 | 37 | bool set_isp_controller (SmartPtr &isp); 38 | 39 | virtual XCamReturn start(); 40 | virtual XCamReturn stop (); 41 | 42 | protected: 43 | virtual XCamReturn handle_events (struct v4l2_event &event); 44 | 45 | private: 46 | virtual XCamReturn init_3a_stats_pool (); 47 | virtual XCamReturn capture_3a_stats (SmartPtr &stats); 48 | 49 | private: 50 | XCAM_DEAD_COPY (IspPollThread); 51 | 52 | private: 53 | SmartPtr _3a_stats_pool; 54 | SmartPtr _isp_controller; 55 | }; 56 | 57 | }; 58 | 59 | #endif // XCAM_ISP_POLL_THREAD_H 60 | -------------------------------------------------------------------------------- /modules/isp/sensor_descriptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sensor_descriptor.h - sensor descriptor 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_SENSOR_DESCRIPTOR_H 22 | #define XCAM_SENSOR_DESCRIPTOR_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class SensorDescriptor { 30 | public: 31 | explicit SensorDescriptor (); 32 | virtual ~SensorDescriptor (); 33 | 34 | void set_sensor_data (struct atomisp_sensor_mode_data &data); 35 | virtual bool is_ready (); 36 | 37 | // Input: exposure_time 38 | // Output: coarse_time, fine_time 39 | virtual bool exposure_time_to_integration ( 40 | int32_t exposure_time, uint32_t &coarse_time, uint32_t &fine_time); 41 | // Input: coarse_time, fine_time 42 | // Output: exposure_time 43 | virtual bool exposure_integration_to_time ( 44 | uint32_t coarse_time, uint32_t fine_time, int32_t &exposure_time); 45 | 46 | // Input : analog_gain, digital_gain 47 | // Output: analog_code, digital_code 48 | virtual bool exposure_gain_to_code ( 49 | double analog_gain, double digital_gain, 50 | int32_t &analog_code, int32_t &digital_code); 51 | 52 | // Input : analog_code, digital_code 53 | // Output : analog_gain, digital_gain 54 | virtual bool exposure_code_to_gain ( 55 | int32_t analog_code, int32_t digital_code, 56 | double &analog_gain, double &digital_gain); 57 | 58 | private: 59 | XCAM_DEAD_COPY (SensorDescriptor); 60 | 61 | private: 62 | struct atomisp_sensor_mode_data _sensor_data; 63 | }; 64 | 65 | }; 66 | #endif //XCAM_SENSOR_DESCRIPTOR_H 67 | -------------------------------------------------------------------------------- /modules/ocl/cl_argument.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_argument.cpp - CL kernel Argument 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "cl_argument.h" 22 | 23 | namespace XCam { 24 | 25 | 26 | CLWorkSize::CLWorkSize () 27 | : dim (XCAM_DEFAULT_IMAGE_DIM) 28 | { 29 | xcam_mem_clear (global); 30 | xcam_mem_clear (local); 31 | } 32 | 33 | CLArgument::CLArgument (uint32_t size) 34 | : _arg_adress (NULL) 35 | , _arg_size (size) 36 | { 37 | } 38 | 39 | CLArgument::~CLArgument () 40 | { 41 | } 42 | 43 | void 44 | CLArgument::get_value (void *&adress, uint32_t &size) 45 | { 46 | adress = _arg_adress; 47 | size = _arg_size; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /modules/ocl/cl_csc_image_processor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_3a_image_processor.cpp - CL 3A image processor 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: wangfei 19 | */ 20 | #include "cl_csc_image_processor.h" 21 | #include "cl_context.h" 22 | #include "cl_csc_handler.h" 23 | 24 | 25 | namespace XCam { 26 | 27 | CLCscImageProcessor::CLCscImageProcessor () 28 | : CLImageProcessor ("CLCscImageProcessor") 29 | { 30 | XCAM_LOG_DEBUG ("CLCscImageProcessor constructed"); 31 | } 32 | 33 | CLCscImageProcessor::~CLCscImageProcessor () 34 | { 35 | XCAM_LOG_DEBUG ("CLCscImageProcessor destructed"); 36 | } 37 | 38 | XCamReturn 39 | CLCscImageProcessor::create_handlers () 40 | { 41 | SmartPtr image_handler; 42 | SmartPtr context = get_cl_context (); 43 | 44 | XCAM_ASSERT (context.ptr ()); 45 | 46 | /* color space conversion */ 47 | image_handler = create_cl_csc_image_handler (context, CL_CSC_TYPE_YUYVTORGBA); 48 | _csc = image_handler.dynamic_cast_ptr (); 49 | XCAM_FAIL_RETURN ( 50 | WARNING, 51 | _csc .ptr (), 52 | XCAM_RETURN_ERROR_CL, 53 | "CLCscImageProcessor create csc handler failed"); 54 | 55 | image_handler->set_pool_type (CLImageHandler::CLVideoPoolType); 56 | add_handler (image_handler); 57 | 58 | return XCAM_RETURN_NO_ERROR; 59 | } 60 | 61 | }; 62 | -------------------------------------------------------------------------------- /modules/ocl/cl_csc_image_processor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_3a_image_processor.h - CL 3A image processor 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: wangfei 19 | */ 20 | 21 | #ifndef XCAM_CL_CSC_IMAGE_PROCESSOR_H 22 | #define XCAM_CL_CSC_IMAGE_PROCESSOR_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class CLCscImageHandler; 31 | 32 | class CLCscImageProcessor 33 | : public CLImageProcessor 34 | { 35 | 36 | public: 37 | explicit CLCscImageProcessor (); 38 | virtual ~CLCscImageProcessor (); 39 | 40 | private: 41 | virtual XCamReturn create_handlers (); 42 | XCAM_DEAD_COPY (CLCscImageProcessor); 43 | 44 | private: 45 | SmartPtr _csc; 46 | }; 47 | 48 | }; 49 | #endif //XCAM_CL_CSC_IMAGE_PROCESSOR_H 50 | -------------------------------------------------------------------------------- /modules/ocl/cl_demo_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_demo_handler.h - CL demo handler 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_CL_DEMO_HANLDER_H 22 | #define XCAM_CL_DEMO_HANLDER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class CLDemoImageHandler 30 | : public CLImageHandler 31 | { 32 | public: 33 | explicit CLDemoImageHandler (const SmartPtr &context); 34 | void set_copy_kernel (SmartPtr &kernel) { 35 | _copy_kernel = kernel; 36 | add_kernel (kernel); 37 | } 38 | 39 | protected: 40 | virtual XCamReturn prepare_output_buf (SmartPtr &input, SmartPtr &output); 41 | virtual XCamReturn prepare_parameters (SmartPtr &input, SmartPtr &output); 42 | 43 | private: 44 | SmartPtr _copy_kernel; 45 | }; 46 | 47 | SmartPtr 48 | create_cl_demo_image_handler (const SmartPtr &context); 49 | 50 | SmartPtr 51 | create_cl_binary_demo_image_handler (const SmartPtr &context, const uint8_t *binary, size_t size); 52 | 53 | }; 54 | 55 | #endif //XCAM_CL_DEMO_HANLDER_H 56 | -------------------------------------------------------------------------------- /modules/ocl/cl_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_error.h - CL errors 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_CL_ERROR_H 22 | #define XCAM_CL_ERROR_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | const char *error_string (cl_int code); 30 | 31 | } 32 | 33 | #endif // XCAM_CL_ERROR_H 34 | -------------------------------------------------------------------------------- /modules/ocl/cl_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_event.h - CL event 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_CL_EVENT_H 22 | #define XCAM_CL_EVENT_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class CLEvent; 31 | 32 | typedef std::list> CLEventList; 33 | 34 | class CLEvent { 35 | public: 36 | explicit CLEvent (cl_event event_id = NULL); 37 | ~CLEvent (); 38 | void set_event_id (cl_event event_id) { 39 | _event_id = event_id; 40 | } 41 | cl_event &get_event_id () { 42 | return _event_id; 43 | } 44 | 45 | XCamReturn wait (); 46 | 47 | bool get_cl_event_info ( 48 | cl_event_info param_name, size_t param_size, 49 | void *param, size_t *param_size_ret = NULL); 50 | 51 | private: 52 | 53 | XCAM_DEAD_COPY (CLEvent); 54 | 55 | public: 56 | static SmartPtr NullEvent; 57 | static CLEventList EmptyList; 58 | 59 | private: 60 | cl_event _event_id; 61 | }; 62 | 63 | XCamReturn 64 | cl_events_wait (CLEventList &event_list); 65 | }; 66 | 67 | #endif //XCAM_CL_EVENT_H -------------------------------------------------------------------------------- /modules/ocl/cl_multi_image_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_multi_image_handler.h - CL multi-image handler 3 | * 4 | * Copyright (c) 2016 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_CL_MULTI_IMAGE_HANDLER_H 22 | #define XCAM_CL_MULTI_IMAGE_HANDLER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class CLMultiImageHandler 30 | : public CLImageHandler 31 | { 32 | public: 33 | typedef std::list > HandlerList; 34 | 35 | public: 36 | explicit CLMultiImageHandler (const SmartPtr &context, const char *name); 37 | virtual ~CLMultiImageHandler (); 38 | bool add_image_handler (SmartPtr &handler); 39 | 40 | protected: 41 | virtual XCamReturn prepare_parameters (SmartPtr &input, SmartPtr &output); 42 | virtual XCamReturn execute_kernels (); 43 | virtual XCamReturn execute_done (SmartPtr &output); 44 | 45 | virtual XCamReturn sub_handler_execute_done (SmartPtr &handler); 46 | 47 | XCamReturn ensure_handler_parameters ( 48 | const SmartPtr &handler, SmartPtr &input, SmartPtr &output); 49 | 50 | private: 51 | XCAM_DEAD_COPY (CLMultiImageHandler); 52 | 53 | protected: 54 | HandlerList _handler_list; 55 | }; 56 | 57 | }; 58 | 59 | #endif // XCAM_CL_MULTI_IMAGE_HANDLER_H -------------------------------------------------------------------------------- /modules/ocl/cl_rgb_pipe_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_rgb_pipe_handler.h - CL rgb pipe handler 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Shincy Tu 19 | * Author: Wei Zong 20 | * Author: Wangfei 21 | */ 22 | 23 | #ifndef XCAM_CL_RGB_PIPE_HANLDER_H 24 | #define XCAM_CL_RGB_PIPE_HANLDER_H 25 | 26 | #include 27 | #include 28 | 29 | namespace XCam { 30 | 31 | typedef struct { 32 | float thr_r; 33 | float thr_g; 34 | float thr_b; 35 | float gain; 36 | } CLRgbPipeTnrConfig; 37 | 38 | class CLRgbPipeImageKernel 39 | : public CLImageKernel 40 | { 41 | public: 42 | explicit CLRgbPipeImageKernel (const SmartPtr &context); 43 | }; 44 | 45 | class CLRgbPipeImageHandler 46 | : public CLImageHandler 47 | { 48 | typedef std::list> CLImagePtrList; 49 | public: 50 | explicit CLRgbPipeImageHandler (const SmartPtr &context, const char *name); 51 | bool set_rgb_pipe_kernel (SmartPtr &kernel); 52 | bool set_tnr_config (const XCam3aResultTemporalNoiseReduction& config); 53 | 54 | protected: 55 | virtual XCamReturn prepare_parameters ( 56 | SmartPtr &input, SmartPtr &output); 57 | 58 | private: 59 | SmartPtr _rgb_pipe_kernel; 60 | CLRgbPipeTnrConfig _tnr_config; 61 | CLImagePtrList _image_in_list; 62 | }; 63 | 64 | SmartPtr 65 | create_cl_rgb_pipe_image_handler (const SmartPtr &context); 66 | 67 | }; 68 | 69 | #endif //XCAM_CL_RGB_PIPE_HANLDER_H 70 | -------------------------------------------------------------------------------- /modules/ocl/priority_buffer_queue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * priority_buffer_queue.cpp - priority buffer queue 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "priority_buffer_queue.h" 22 | 23 | #define XCAM_PRIORITY_BUFFER_FIXED_DELAY 8 24 | 25 | namespace XCam { 26 | 27 | bool 28 | PriorityBuffer::priority_greater_than (const PriorityBuffer& buf) const 29 | { 30 | int32_t result = 31 | ((int32_t)(buf.seq_num - this->seq_num) * XCAM_PRIORITY_BUFFER_FIXED_DELAY + 32 | (int32_t)(buf.rank - this->rank)); 33 | if (result == 0) { 34 | return (int32_t)(buf.seq_num - this->seq_num) > 0; 35 | } 36 | return result > 0; 37 | } 38 | 39 | 40 | bool 41 | PriorityBufferQueue::push_priority_buf (const SmartPtr &buf) 42 | { 43 | XCAM_ASSERT (buf.ptr ()); 44 | SmartLock lock (_mutex); 45 | 46 | ObjList::iterator iter = _obj_list.begin (); 47 | 48 | for (; iter != _obj_list.end (); ++iter) { 49 | SmartPtr ¤t = *iter; 50 | XCAM_ASSERT (current.ptr ()); 51 | if (buf->priority_greater_than (*current.ptr())) 52 | break; 53 | } 54 | 55 | _obj_list.insert (iter, buf); 56 | _new_obj_cond.signal (); 57 | return true; 58 | } 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /modules/ocl/priority_buffer_queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * priority_buffer_queue.h - priority buffer queue 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_PRIORITY_BUFFER_QUEUE_H 22 | #define XCAM_PRIORITY_BUFFER_QUEUE_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | struct PriorityBuffer 31 | { 32 | SmartPtr data; 33 | SmartPtr handler; 34 | uint32_t rank; 35 | uint32_t seq_num; 36 | 37 | public: 38 | PriorityBuffer () 39 | : rank (0) 40 | , seq_num (0) 41 | {} 42 | 43 | void set_seq_num (const uint32_t value) { 44 | seq_num = value; 45 | } 46 | uint32_t get_seq_num () const { 47 | return seq_num; 48 | } 49 | 50 | // when change to next rank 51 | void down_rank () { 52 | ++rank; 53 | } 54 | 55 | bool priority_greater_than (const PriorityBuffer& buf) const; 56 | }; 57 | 58 | class PriorityBufferQueue 59 | : public SafeList 60 | { 61 | public: 62 | 63 | PriorityBufferQueue () {} 64 | ~PriorityBufferQueue () {} 65 | 66 | bool push_priority_buf (const SmartPtr &buf); 67 | 68 | private: 69 | XCAM_DEAD_COPY (PriorityBufferQueue); 70 | }; 71 | 72 | }; 73 | 74 | #endif //XCAM_PRIORITY_BUFFER_QUEUE_H 75 | -------------------------------------------------------------------------------- /modules/ocv/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libxcam_ocv.la 2 | 3 | xcam_ocv_sources = \ 4 | cv_utils.cpp \ 5 | cv_image_process_helper.cpp \ 6 | cv_image_sharp.cpp \ 7 | cv_edgetaper.cpp \ 8 | cv_wiener_filter.cpp \ 9 | cv_image_deblurring.cpp \ 10 | cv_feature_match.cpp \ 11 | cv_feature_match_cluster.cpp \ 12 | cv_capi_feature_match.cpp \ 13 | $(NULL) 14 | 15 | libxcam_ocv_la_SOURCES = \ 16 | $(xcam_ocv_sources) \ 17 | $(NULL) 18 | 19 | libxcam_ocv_la_CXXFLAGS = \ 20 | $(XCAM_CXXFLAGS) \ 21 | $(OPENCV_CFLAGS) \ 22 | -I$(top_srcdir)/xcore \ 23 | -I$(top_srcdir)/modules \ 24 | $(NULL) 25 | 26 | libxcam_ocv_la_LIBADD = \ 27 | $(OPENCV_LIBS) \ 28 | $(top_builddir)/xcore/libxcam_core.la \ 29 | $(NULL) -------------------------------------------------------------------------------- /modules/ocv/cv_edgetaper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_edgetaper.h - used in deblurring to remove ringing artifacts 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Andrey Parfenov 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef XCAM_CV_EDGETAPER_H 23 | #define XCAM_CV_EDGETAPER_H 24 | 25 | #include "cv_std.h" 26 | 27 | namespace XCam { 28 | 29 | class CVEdgetaper 30 | { 31 | public: 32 | explicit CVEdgetaper () {} 33 | void edgetaper (const cv::Mat &image, const cv::Mat &psf, cv::Mat &output); 34 | 35 | private: 36 | void create_weights (const cv::Mat &image, const cv::Mat &psf, cv::Mat &coefficients); 37 | 38 | XCAM_DEAD_COPY (CVEdgetaper); 39 | }; 40 | 41 | } 42 | 43 | #endif // XCAM_CV_EDGETAPER_H 44 | -------------------------------------------------------------------------------- /modules/ocv/cv_feature_match_cluster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_feature_match_cluster.h - optical flow feature match selected by clustering 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wu Junkai 19 | */ 20 | 21 | #ifndef XCAM_CV_FEATURE_MATCH_CLUSTER_H 22 | #define XCAM_CV_FEATURE_MATCH_CLUSTER_H 23 | 24 | #include "cv_feature_match.h" 25 | 26 | namespace XCam { 27 | 28 | class CVFeatureMatchCluster 29 | : public CVFeatureMatch 30 | { 31 | public: 32 | explicit CVFeatureMatchCluster (); 33 | 34 | virtual void feature_match ( 35 | const SmartPtr &left_buf, const SmartPtr &right_buf); 36 | 37 | private: 38 | virtual void detect_and_match (cv::Mat &img_left, cv::Mat &img_right); 39 | virtual void calc_of_match ( 40 | cv::Mat &image0, cv::Mat &image1, std::vector &corner0, 41 | std::vector &corner1, std::vector &status, std::vector &error); 42 | 43 | bool calc_mean_offset ( 44 | std::vector &corner0, std::vector &corner1, std::vector &status, 45 | std::vector &error, float &mean_offset_x, float &mean_offset_y, 46 | cv::Mat &debug_img, cv::Size &img0_size, cv::Size &img1_size); 47 | 48 | private: 49 | XCAM_DEAD_COPY (CVFeatureMatchCluster); 50 | 51 | }; 52 | 53 | } 54 | 55 | #endif // XCAM_CV_FEATURE_MATCH_CLUSTER_H 56 | -------------------------------------------------------------------------------- /modules/ocv/cv_image_process_helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_image_process_helper.h - OpenCV image processing helpers functions 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Andrey Parfenov 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef XCAM_CV_IMAGE_PROCESS_HELPER_H 23 | #define XCAM_CV_IMAGE_PROCESS_HELPER_H 24 | 25 | #include 26 | #include "cv_std.h" 27 | 28 | namespace XCam { 29 | 30 | class CVImageProcessHelper 31 | { 32 | public: 33 | explicit CVImageProcessHelper () {} 34 | 35 | void compute_dft (const cv::Mat &image, cv::Mat &result); 36 | void compute_idft (cv::Mat *input, cv::Mat &result); 37 | void apply_constraints (cv::Mat &image, float threshold_min_value = 0.0f, float threshold_max_value = 255.0f, float min_value = 0.0f, float max_value = 255.0f); 38 | float get_snr (const cv::Mat &noisy, const cv::Mat &noiseless); 39 | cv::Mat erosion (const cv::Mat &image, int erosion_size, int erosion_type); 40 | void normalize_weights (cv::Mat &weights); 41 | 42 | XCAM_DEAD_COPY (CVImageProcessHelper); 43 | }; 44 | 45 | } 46 | 47 | #endif // XCAM_CV_IMAGE_PROCESS_HELPER_H 48 | -------------------------------------------------------------------------------- /modules/ocv/cv_image_sharp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_image_sharp.cpp - image sharp 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Andrey Parfenov 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #include "cv_image_sharp.h" 23 | 24 | namespace XCam { 25 | 26 | cv::Mat 27 | CVImageSharp::sharp_image_gray (const cv::Mat &image, float sigmar) 28 | { 29 | cv::Mat temp_image; 30 | image.convertTo (temp_image, CV_32FC1); 31 | cv::Mat bilateral_image; 32 | cv::bilateralFilter (temp_image, bilateral_image, 5, sigmar, 2); 33 | 34 | cv::Mat sharp_filter = (cv::Mat_(3, 3) << -1, -1, -1, -1, 8, -1, -1, -1, -1); 35 | cv::Mat filtered_image; 36 | cv::filter2D (bilateral_image, filtered_image, -1, sharp_filter); 37 | cv::normalize (filtered_image, filtered_image, 0, 255.0f, cv::NORM_MINMAX); 38 | cv::Mat sharpened = temp_image + filtered_image; 39 | cv::normalize (sharpened, sharpened, 0, 255.0f, cv::NORM_MINMAX); 40 | return sharpened.clone (); 41 | } 42 | 43 | float 44 | CVImageSharp::measure_sharp (const cv::Mat &image) 45 | { 46 | cv::Mat dst; 47 | cv::Laplacian (image, dst, -1, 3, 1, 0, cv::BORDER_CONSTANT); 48 | dst.convertTo (dst, CV_8UC1); 49 | float sum = cv::sum (dst)[0]; 50 | sum /= (image.rows * image.cols); 51 | return sum; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /modules/ocv/cv_image_sharp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_sharp.h - sharp image 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Andrey Parfenov 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef XCAM_CV_IMAGE_SHARP_H 23 | #define XCAM_CV_IMAGE_SHARP_H 24 | 25 | #include 26 | #include "cv_std.h" 27 | 28 | namespace XCam { 29 | 30 | class CVImageSharp 31 | { 32 | public: 33 | explicit CVImageSharp () {} 34 | 35 | float measure_sharp (const cv::Mat &image); 36 | cv::Mat sharp_image_gray (const cv::Mat &image, float sigmar); 37 | 38 | XCAM_DEAD_COPY (CVImageSharp); 39 | }; 40 | 41 | } 42 | 43 | #endif // XCAM_CV_IMAGE_SHARP_H 44 | -------------------------------------------------------------------------------- /modules/ocv/cv_std.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_std.h - OpenCV std 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_CV_STD_H 22 | #define XCAM_CV_STD_H 23 | 24 | #include 25 | #include 26 | 27 | #endif // XCAM_CV_STD_H 28 | -------------------------------------------------------------------------------- /modules/ocv/cv_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_utils.h - OpenCV Utilities 3 | * 4 | * Copyright (c) 2019 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_CV_UTILS_H 22 | #define XCAM_CV_UTILS_H 23 | 24 | #include 25 | #include 26 | #include "cv_std.h" 27 | 28 | namespace XCam { 29 | 30 | bool convert_to_mat (const SmartPtr &buffer, cv::Mat &img); 31 | bool convert_range_to_mat (const SmartPtr &buffer, const Rect &range, cv::Mat &img); 32 | 33 | void write_image ( 34 | const SmartPtr &buf, const char *img_name, const char *frame_str, const char *idx_str); 35 | void write_image ( 36 | const SmartPtr &buf, const Rect &draw_rect, 37 | const char *img_name, const char *frame_str, const char *idx_str); 38 | 39 | } 40 | 41 | #endif // XCAM_CV_UTILS_H 42 | -------------------------------------------------------------------------------- /modules/ocv/cv_wiener_filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cv_wiener_filter.h - wierner filter for non-blind deblurring 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Andrey Parfenov 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef XCAM_CV_WIENER_FILTER_H 23 | #define XCAM_CV_WIENER_FILTER_H 24 | 25 | #include 26 | #include "cv_std.h" 27 | #include "cv_image_process_helper.h" 28 | 29 | namespace XCam { 30 | 31 | class CVWienerFilter 32 | { 33 | public: 34 | explicit CVWienerFilter (); 35 | 36 | void wiener_filter (const cv::Mat &blurred_image, const cv::Mat &known, cv::Mat &unknown, float noise_power); 37 | 38 | private: 39 | 40 | XCAM_DEAD_COPY (CVWienerFilter); 41 | 42 | SmartPtr _helpers; 43 | }; 44 | 45 | } 46 | 47 | #endif // XCAM_CV_WIENER_FILTER_H 48 | -------------------------------------------------------------------------------- /modules/render/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libxcam_render.la 2 | 3 | XCAM_RENDER_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | $(LIBOSG_CFLAGS) \ 6 | -I$(top_srcdir)/xcore \ 7 | -I$(top_srcdir)/modules \ 8 | $(NULL) 9 | 10 | XCAM_RENDER_LIBS = \ 11 | -losgGA \ 12 | -losgDB \ 13 | -losgUtil \ 14 | -losgFX \ 15 | -losgText \ 16 | -losgViewer \ 17 | -losg \ 18 | $(top_builddir)/xcore/libxcam_core.la \ 19 | $(NULL) 20 | 21 | xcam_render_sources = \ 22 | render_osg_camera_manipulator.cpp \ 23 | render_osg_model.cpp \ 24 | render_osg_viewer.cpp \ 25 | $(NULL) 26 | 27 | libxcam_render_la_SOURCES = \ 28 | $(xcam_render_sources) \ 29 | $(NULL) 30 | 31 | libxcam_render_la_CXXFLAGS = \ 32 | $(XCAM_RENDER_CXXFLAGS) \ 33 | $(NULL) 34 | 35 | libxcam_render_la_LIBADD = \ 36 | $(XCAM_RENDER_LIBS) \ 37 | $(NULL) 38 | 39 | libxcam_render_la_LDFLAGS = \ 40 | $(XCAM_LT_LDFLAGS) \ 41 | $(NULL) 42 | 43 | libxcam_renderincludedir = $(includedir)/xcam/render 44 | 45 | nobase_libxcam_renderinclude_HEADERS = \ 46 | render_osg_camera_manipulator.h \ 47 | render_osg_model.h \ 48 | render_osg_viewer.h \ 49 | render_osg_shader.h \ 50 | $(NULL) 51 | 52 | libxcam_render_la_LIBTOOLFLAGS = --tag=disable-static 53 | -------------------------------------------------------------------------------- /modules/render/render_osg_viewer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * render_osg_viewer.h - renders a single view on to a single scene 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_OSG_RENDER_VIEWER_H 22 | #define XCAM_OSG_RENDER_VIEWER_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace XCam { 34 | 35 | class RenderOsgModel; 36 | 37 | class RenderOsgViewer 38 | : public Thread 39 | { 40 | public: 41 | 42 | explicit RenderOsgViewer (); 43 | 44 | virtual ~RenderOsgViewer (); 45 | 46 | osgViewer::Viewer *get_viewer () { 47 | return _viewer; 48 | } 49 | 50 | void set_camera_manipulator (osg::ref_ptr &manipulator); 51 | 52 | void add_model (SmartPtr &model); 53 | void validate_model_groups (); 54 | 55 | bool start_render (); 56 | bool stop_render (); 57 | 58 | protected: 59 | virtual bool loop (); 60 | 61 | private: 62 | XCAM_DEAD_COPY (RenderOsgViewer); 63 | XCamReturn initialize (); 64 | 65 | private: 66 | osg::ref_ptr _viewer; 67 | SmartPtr _model_groups; 68 | bool _initialized; 69 | }; 70 | 71 | } // namespace XCam 72 | 73 | #endif // XCAM_OSG_RENDER_VIEWER_H 74 | -------------------------------------------------------------------------------- /modules/soft/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libxcam_soft.la 2 | 3 | XCAMSOFT_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | -I$(top_srcdir)/xcore \ 6 | -I$(top_srcdir)/modules \ 7 | $(NULL) 8 | 9 | XCAMSOFT_LIBS = \ 10 | $(top_builddir)/xcore/libxcam_core.la \ 11 | $(NULL) 12 | 13 | if ENABLE_AVX512 14 | XCAMSOFT_CXXFLAGS += \ 15 | -mavx -mavx2 -mavx512f -mavx512cd -mavx512vl -mavx512bw -mavx512dq -msse3 -msse4.1 -msse4.2 -msse4a -mfma\ 16 | $(NULL) 17 | endif 18 | 19 | if HAVE_OPENCV 20 | XCAMSOFT_CXXFLAGS += $(OPENCV_CFLAGS) 21 | XCAMSOFT_LIBS += $(top_builddir)/modules/ocv/libxcam_ocv.la 22 | endif 23 | 24 | xcam_soft_sources = \ 25 | soft_handler.cpp \ 26 | soft_video_buf_allocator.cpp \ 27 | soft_worker.cpp \ 28 | soft_blender_tasks_priv.cpp \ 29 | soft_blender.cpp \ 30 | soft_geo_mapper.cpp \ 31 | soft_geo_tasks_priv.cpp \ 32 | soft_copy_task.cpp \ 33 | soft_stitcher.cpp \ 34 | $(NULL) 35 | 36 | libxcam_soft_la_SOURCES = \ 37 | $(xcam_soft_sources) \ 38 | $(NULL) 39 | 40 | libxcam_soft_la_CXXFLAGS = \ 41 | $(XCAMSOFT_CXXFLAGS) \ 42 | $(NULL) 43 | 44 | libxcam_soft_la_LIBADD = \ 45 | $(XCAMSOFT_LIBS) \ 46 | $(NULL) 47 | 48 | libxcam_soft_la_LDFLAGS = \ 49 | $(XCAM_LT_LDFLAGS) \ 50 | $(NULL) 51 | 52 | libxcam_softincludedir = $(includedir)/xcam/soft 53 | 54 | nobase_libxcam_softinclude_HEADERS = \ 55 | soft_handler.h \ 56 | soft_video_buf_allocator.h \ 57 | soft_worker.h \ 58 | soft_image.h \ 59 | soft_blender.h \ 60 | soft_geo_mapper.h \ 61 | soft_copy_task.h \ 62 | soft_stitcher.h \ 63 | $(NULL) 64 | 65 | noinst_HEADERS = \ 66 | soft_blender_tasks_priv.h \ 67 | soft_geo_tasks_priv.h \ 68 | $(NULL) 69 | 70 | libxcam_soft_la_LIBTOOLFLAGS = --tag=disable-static 71 | -------------------------------------------------------------------------------- /modules/soft/soft_copy_task.h: -------------------------------------------------------------------------------- 1 | /* 2 | * soft_copy_task.h - soft copy class 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_SOFT_COPY_TASK_H 22 | #define XCAM_SOFT_COPY_TASK_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace XCam { 31 | 32 | namespace XCamSoftTasks { 33 | 34 | class CopyTask 35 | : public SoftWorker 36 | { 37 | public: 38 | struct Args : SoftArgs { 39 | SmartPtr in_luma, out_luma; 40 | SmartPtr in_uv, out_uv; 41 | SmartPtr in_u, in_v, out_u, out_v; 42 | 43 | Args (const SmartPtr ¶m) 44 | : SoftArgs (param) 45 | {} 46 | }; 47 | 48 | public: 49 | explicit CopyTask (const SmartPtr &cb) 50 | : SoftWorker ("CopyTask", cb) 51 | {} 52 | 53 | private: 54 | virtual XCamReturn work_range (const SmartPtr &args, const WorkRange &range); 55 | }; 56 | 57 | } 58 | 59 | } 60 | 61 | #endif // XCAM_SOFT_COPY_TASK_H -------------------------------------------------------------------------------- /modules/soft/soft_video_buf_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * soft_video_buf_allocator.h - soft video buffer allocator class 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_SOFT_VIDEO_BUF_ALLOCATOR_H 22 | #define XCAM_SOFT_VIDEO_BUF_ALLOCATOR_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class SoftVideoBufAllocator 30 | : public BufferPool 31 | { 32 | public: 33 | explicit SoftVideoBufAllocator (); 34 | explicit SoftVideoBufAllocator (const VideoBufferInfo &info); 35 | virtual ~SoftVideoBufAllocator (); 36 | 37 | private: 38 | //derive from BufferPool 39 | virtual SmartPtr allocate_data (const VideoBufferInfo &buffer_info, const void* in_data = NULL); 40 | }; 41 | 42 | #if 0 43 | class AllocatorPool { 44 | public: 45 | explicit AllocatorPool (); 46 | virtual ~AllocatorPool (); 47 | 48 | SmartPtr allocate_video_buf (const VideoBufferInfo &info); 49 | 50 | private: 51 | SafeList _pools; 52 | }; 53 | #endif 54 | 55 | } 56 | 57 | #endif //XCAM_SOFT_VIDEO_BUF_ALLOCATOR_H 58 | -------------------------------------------------------------------------------- /modules/vulkan/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libxcam_vulkan.la 2 | 3 | XCAM_VK_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | $(LIBVULKAN_CFLAGS) \ 6 | -I$(top_srcdir)/xcore \ 7 | -I$(top_srcdir)/modules \ 8 | -I$(top_srcdir)/shaders/spv \ 9 | $(NULL) 10 | 11 | XCAM_VK_LIBS = \ 12 | $(LIBVULKAN_LIBS) \ 13 | $(top_builddir)/xcore/libxcam_core.la \ 14 | $(NULL) 15 | 16 | if HAVE_OPENCV 17 | XCAM_VK_LIBS += $(top_builddir)/modules/ocv/libxcam_ocv.la 18 | endif 19 | 20 | xcam_vulkan_sources = \ 21 | vk_cmdbuf.cpp \ 22 | vk_descriptor.cpp \ 23 | vk_device.cpp \ 24 | vk_handler.cpp \ 25 | vk_instance.cpp \ 26 | vk_memory.cpp \ 27 | vk_pipeline.cpp \ 28 | vk_shader.cpp \ 29 | vk_sync.cpp \ 30 | vk_video_buf_allocator.cpp \ 31 | vk_worker.cpp \ 32 | vulkan_common.cpp \ 33 | vk_copy_handler.cpp \ 34 | vk_geomap_handler.cpp \ 35 | vk_blender.cpp \ 36 | vk_stitcher.cpp \ 37 | $(NULL) 38 | 39 | libxcam_vulkan_la_SOURCES = \ 40 | $(xcam_vulkan_sources) \ 41 | $(NULL) 42 | 43 | libxcam_vulkan_la_CXXFLAGS = \ 44 | $(XCAM_VK_CXXFLAGS) \ 45 | $(NULL) 46 | 47 | libxcam_vulkan_la_LIBADD = \ 48 | $(XCAM_VK_LIBS) \ 49 | $(NULL) 50 | 51 | libxcam_vulkan_la_LDFLAGS = \ 52 | $(XCAM_LT_LDFLAGS) \ 53 | $(NULL) 54 | 55 | libxcam_vulkanincludedir = $(includedir)/xcam/vulkan 56 | 57 | nobase_libxcam_vulkaninclude_HEADERS = \ 58 | vk_cmdbuf.h \ 59 | vk_descriptor.h \ 60 | vk_device.h \ 61 | vk_handler.h \ 62 | vk_instance.h \ 63 | vk_memory.h \ 64 | vk_pipeline.h \ 65 | vk_shader.h \ 66 | vk_sync.h \ 67 | vk_video_buf_allocator.h \ 68 | vk_worker.h \ 69 | vulkan_common.h \ 70 | vk_copy_handler.h \ 71 | vk_geomap_handler.h \ 72 | vk_blender.h \ 73 | vk_stitcher.h \ 74 | $(NULL) 75 | 76 | libxcam_vulkan_la_LIBTOOLFLAGS = --tag=disable-static 77 | -------------------------------------------------------------------------------- /modules/vulkan/vk_handler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_handler.cpp - vulkan image handler class 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "vk_handler.h" 22 | #include "vk_device.h" 23 | #include "vk_video_buf_allocator.h" 24 | 25 | namespace XCam { 26 | 27 | VKHandler::VKHandler (const SmartPtr &dev, const char* name) 28 | : ImageHandler (name) 29 | , _device (dev) 30 | { 31 | } 32 | 33 | VKHandler::~VKHandler () 34 | { 35 | } 36 | 37 | 38 | XCamReturn 39 | VKHandler::finish () 40 | { 41 | if (_device.ptr ()) 42 | _device->compute_queue_wait_idle (); 43 | 44 | return XCAM_RETURN_NO_ERROR; 45 | } 46 | 47 | XCamReturn 48 | VKHandler::terminate () 49 | { 50 | finish (); 51 | return ImageHandler::terminate (); 52 | } 53 | 54 | SmartPtr 55 | VKHandler::create_allocator () 56 | { 57 | return new VKVideoBufAllocator (_device); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /modules/vulkan/vk_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_handler.h - vulkan image handler class 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_VK_HANDLER_H 22 | #define XCAM_VK_HANDLER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class VKDevice; 30 | 31 | class VKHandler 32 | : public ImageHandler 33 | { 34 | public: 35 | explicit VKHandler (const SmartPtr &dev, const char* name = "vk-handler"); 36 | ~VKHandler (); 37 | const SmartPtr &get_vk_device () const { 38 | return _device; 39 | } 40 | 41 | // derive from ImageHandler 42 | virtual XCamReturn finish (); 43 | virtual XCamReturn terminate (); 44 | 45 | protected: 46 | SmartPtr create_allocator (); 47 | 48 | private: 49 | XCAM_DEAD_COPY (VKHandler); 50 | 51 | protected: 52 | SmartPtr _device; 53 | }; 54 | 55 | } 56 | 57 | #endif //XCAM_VK_HANDLER_H 58 | -------------------------------------------------------------------------------- /modules/vulkan/vk_shader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_shader.cpp - vulkan shader module 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "vk_shader.h" 22 | #include "vk_device.h" 23 | #include "file.h" 24 | 25 | namespace XCam { 26 | 27 | VKShader::VKShader (SmartPtr dev, VkShaderModule id, const char *name) 28 | : _device (dev) 29 | , _shader_id (id) 30 | , _shader_stage (VK_SHADER_STAGE_COMPUTE_BIT) 31 | { 32 | XCAM_IS_VALID_VK_ID (id); 33 | xcam_mem_clear (_name); 34 | if (name) 35 | strncpy (_name, name, XCAM_VK_NAME_LENGTH - 1); 36 | strncpy (_func_name, "main", XCAM_VK_NAME_LENGTH - 1); 37 | } 38 | 39 | VKShader::~VKShader () 40 | { 41 | if (XCAM_IS_VALID_VK_ID (_shader_id)) 42 | _device->destroy_shader_id (_shader_id); 43 | } 44 | 45 | void 46 | VKShader::set_func_name (const char *name) 47 | { 48 | XCAM_ASSERT (name); 49 | strncpy (_func_name, name, XCAM_VK_NAME_LENGTH - 1); 50 | } 51 | 52 | void 53 | VKShader::set_name (const char *name) 54 | { 55 | XCAM_ASSERT (name); 56 | strncpy (_name, name, XCAM_VK_NAME_LENGTH - 1); 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /modules/vulkan/vk_shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_shader.h - Vulkan shader module 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_VK_SHADER_H 22 | #define XCAM_VK_SHADER_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class VKDevice; 29 | 30 | class VKShader 31 | { 32 | friend class VKDevice; 33 | public: 34 | ~VKShader (); 35 | 36 | VkShaderModule get_shader_id () const { 37 | return _shader_id; 38 | } 39 | VkShaderStageFlagBits get_shader_stage_flags () const { 40 | return _shader_stage; 41 | } 42 | void set_func_name (const char *name); 43 | void set_name (const char *name); 44 | const char *get_func_name () const { 45 | return _func_name; 46 | } 47 | const char *get_name () const { 48 | return _name; 49 | } 50 | 51 | private: 52 | explicit VKShader (SmartPtr dev, VkShaderModule id, const char *name = "null"); 53 | 54 | private: 55 | XCAM_DEAD_COPY (VKShader); 56 | 57 | private: 58 | //static ShaderTable _shader_cache; 59 | //static Mutex _cache_mutex; 60 | SmartPtr _device; 61 | VkShaderModule _shader_id; 62 | VkShaderStageFlagBits _shader_stage; 63 | char _func_name [XCAM_VK_NAME_LENGTH]; 64 | char _name [XCAM_VK_NAME_LENGTH]; 65 | }; 66 | 67 | typedef std::vector> ShaderVec; 68 | 69 | } 70 | 71 | #endif //XCAM_VK_SHADER_H 72 | -------------------------------------------------------------------------------- /modules/vulkan/vk_sync.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_sync.cpp - Vulkan sync 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "vk_sync.h" 22 | #include "vk_device.h" 23 | 24 | namespace XCam { 25 | 26 | VKFence::~VKFence () 27 | { 28 | if (_dev.ptr () && XCAM_IS_VALID_VK_ID (_fence_id)) 29 | _dev->destroy_fence (_fence_id); 30 | } 31 | 32 | VKFence::VKFence (const SmartPtr dev, VkFence id) 33 | : _fence_id (id) 34 | , _dev (dev) 35 | { 36 | } 37 | 38 | XCamReturn 39 | VKFence::reset () 40 | { 41 | XCAM_ASSERT (_dev.ptr ()); 42 | XCAM_ASSERT (XCAM_IS_VALID_VK_ID (_fence_id)); 43 | 44 | return _dev->reset_fence (_fence_id); 45 | } 46 | 47 | XCamReturn 48 | VKFence::wait (uint64_t timeout) 49 | { 50 | XCAM_ASSERT (_dev.ptr ()); 51 | XCAM_ASSERT (XCAM_IS_VALID_VK_ID (_fence_id)); 52 | return _dev->wait_for_fence (_fence_id, timeout); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /modules/vulkan/vk_sync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_sync.h - Vulkan sync 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_VK_SYNC_H 22 | #define XCAM_VK_SYNC_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class VKDevice; 29 | 30 | class VKFence 31 | { 32 | friend class VKDevice; 33 | public: 34 | virtual ~VKFence (); 35 | 36 | XCamReturn reset (); 37 | XCamReturn wait (uint64_t timeout = UINT64_MAX); 38 | 39 | VkFence get_fence_id () const { 40 | return _fence_id; 41 | } 42 | 43 | protected: 44 | explicit VKFence (const SmartPtr dev, VkFence id); 45 | 46 | private: 47 | XCAM_DEAD_COPY (VKFence); 48 | 49 | protected: 50 | VkFence _fence_id; 51 | SmartPtr _dev; 52 | }; 53 | 54 | } 55 | 56 | #endif //XCAM_VK_SYNC_H 57 | -------------------------------------------------------------------------------- /modules/vulkan/vk_video_buf_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vk_video_buf_allocator.h - vulkan video buffer allocator class 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_VK_VIDEO_BUF_ALLOCATOR_H 22 | #define XCAM_VK_VIDEO_BUF_ALLOCATOR_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class VKDevice; 29 | class VKBuffer; 30 | 31 | class VKVideoBufAllocator 32 | : public BufferPool 33 | { 34 | public: 35 | explicit VKVideoBufAllocator (const SmartPtr dev); 36 | virtual ~VKVideoBufAllocator (); 37 | 38 | private: 39 | //derive from BufferPool 40 | virtual SmartPtr allocate_data (const VideoBufferInfo &buffer_info, const void* in_data = NULL); 41 | virtual SmartPtr create_buffer_from_data (SmartPtr &data); 42 | 43 | private: 44 | SmartPtr _dev; 45 | }; 46 | 47 | class VKVideoBuffer 48 | : public BufferProxy 49 | { 50 | public: 51 | explicit VKVideoBuffer (const VideoBufferInfo &info, const SmartPtr &data); 52 | SmartPtr get_vk_buf (); 53 | }; 54 | 55 | } 56 | 57 | #endif //XCAM_VK_VIDEO_BUF_ALLOCATOR_H 58 | 59 | -------------------------------------------------------------------------------- /modules/vulkan/vulkan_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vulkan_common.h - vulkan common 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_VK_COMMON_H 22 | #define XCAM_VK_COMMON_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | const char* vk_error_str(VkResult id); 30 | const std::string xcam_default_shader_path (); 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /modules/vulkan/vulkan_std.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vulkan_std.h - vulkan common 3 | * 4 | * Copyright (c) 2018 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_VK_STD_H 22 | #define XCAM_VK_STD_H 23 | 24 | #include 25 | #include 26 | 27 | #define XCAM_VK_CHECK_RETURN(LEVEL, vk_exp, failed_value, format, ...) \ 28 | do { \ 29 | VkResult err = vk_exp; \ 30 | XCAM_FAIL_RETURN (LEVEL, err == VK_SUCCESS, failed_value, \ 31 | format ", vk_error(%d:%s)", ## __VA_ARGS__, \ 32 | (int)err, vk_error_str(err)); \ 33 | } while (0) 34 | 35 | 36 | #define XCAM_VK_NAME_LENGTH 256 37 | 38 | #define XCAM_IS_VALID_VK_ID(id) (VK_NULL_HANDLE != (id)) 39 | 40 | #define XCAM_VK_SHADER_PATH "XCAM_VK_SHADER_PATH" 41 | #define XCAM_DEFAULT_VK_SHADER_PATH xcam_default_shader_path() 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /pkgconfig/Makefile.am: -------------------------------------------------------------------------------- 1 | pcverfiles = libxcam.pc 2 | 3 | all-local: $(pcverfiles) 4 | 5 | pkgconfigdir = $(libdir)/pkgconfig 6 | pkgconfig_DATA = $(pcverfiles) 7 | 8 | CLEANFILES = $(pcverfiles) 9 | pcinfiles = libxcam.pc.in 10 | 11 | DISTCLEANFILES = $(pcinfiles:.in=) 12 | EXTRA_DIST = $(pcinfiles) 13 | -------------------------------------------------------------------------------- /pkgconfig/libxcam.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libxcam 7 | Description: extended camera features 8 | Requires: 9 | Version: @XCAM_VERSION@ 10 | Libs: -L${libdir} @XCAM_PKG_EXPORT_LIBS@ 11 | Cflags: -I${includedir}/xcam -I${includedir} 12 | 13 | -------------------------------------------------------------------------------- /plugins/3a/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_LIBCL 2 | HYBRID_DIR = hybrid 3 | endif 4 | 5 | SUBDIRS = aiq $(HYBRID_DIR) 6 | -------------------------------------------------------------------------------- /plugins/3a/aiq/Makefile.am: -------------------------------------------------------------------------------- 1 | plugin_LTLIBRARIES = libxcam_3a_aiq.la 2 | 3 | XCAM_AIQ_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | -I$(top_srcdir)/xcore \ 6 | -I$(top_srcdir)/modules/isp \ 7 | -I$(top_srcdir)/plugins/3a/aiq \ 8 | $(NULL) 9 | 10 | XCAM_AIQ_LIBS = \ 11 | $(top_builddir)/xcore/libxcam_core.la \ 12 | $(top_builddir)/modules/isp/libxcam_isp.la \ 13 | $(NULL) 14 | 15 | if HAVE_LIBDRM 16 | XCAM_AIQ_CXXFLAGS += $(LIBDRM_CFLAGS) 17 | XCAM_AIQ_LIBS += $(LIBDRM_LIBS) 18 | endif 19 | 20 | if USE_LOCAL_ATOMISP 21 | XCAM_AIQ_CXXFLAGS += \ 22 | -I$(top_srcdir)/ext/atomisp \ 23 | $(NULL) 24 | endif 25 | 26 | plugindir="$(libdir)/xcam/plugins/3a" 27 | 28 | libxcam_3a_aiq_la_SOURCES = \ 29 | aiq_wrapper.cpp \ 30 | $(NULL) 31 | 32 | libxcam_3a_aiq_la_CXXFLAGS = \ 33 | $(XCAM_AIQ_CXXFLAGS) \ 34 | $(NULL) 35 | 36 | libxcam_3a_aiq_la_LIBADD = \ 37 | $(XCAM_AIQ_LIBS) \ 38 | $(NULL) 39 | 40 | libxcam_3a_aiq_la_LDFLAGS = \ 41 | -module -avoid-version \ 42 | $(NULL) 43 | 44 | libxcam_3a_aiq_la_LIBTOOLFLAGS = --tag=disable-static 45 | -------------------------------------------------------------------------------- /plugins/3a/hybrid/Makefile.am: -------------------------------------------------------------------------------- 1 | plugin_LTLIBRARIES = libxcam_3a_hybrid.la 2 | 3 | XCAM_HYBRID_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | -I$(top_srcdir)/xcore \ 6 | -I$(top_srcdir)/plugins/3a/hybrid \ 7 | $(NULL) 8 | 9 | XCAM_HYBRID_LIBS = \ 10 | $(top_builddir)/xcore/libxcam_core.la \ 11 | $(NULL) 12 | 13 | plugindir="$(libdir)/xcam/plugins/3a" 14 | 15 | libxcam_3a_hybrid_la_SOURCES = \ 16 | sample.cpp \ 17 | $(NULL) 18 | 19 | libxcam_3a_hybrid_la_CXXFLAGS = \ 20 | $(XCAM_HYBRID_CXXFLAGS) \ 21 | $(NULL) 22 | 23 | libxcam_3a_hybrid_la_LIBADD = \ 24 | $(XCAM_HYBRID_LIBS) \ 25 | $(NULL) 26 | 27 | libxcam_3a_hybrid_la_LDFLAGS = \ 28 | -module -avoid-version \ 29 | $(NULL) 30 | 31 | libxcam_3a_hybrid_la_LIBTOOLFLAGS = --tag=disable-static 32 | -------------------------------------------------------------------------------- /plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_3ALIB 2 | X3ALIB_DIR = 3a 3 | endif 4 | 5 | if ENABLE_SMART_LIB 6 | SMARTLIB_DIR = smart 7 | endif 8 | 9 | SUBDIRS = $(X3ALIB_DIR) $(SMARTLIB_DIR) 10 | -------------------------------------------------------------------------------- /plugins/smart/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_DVS 2 | if HAVE_LIBCL 3 | DVS_DIR = dvs 4 | endif 5 | endif 6 | 7 | if ENABLE_IA_AIQ 8 | SAMPLE_DIR = sample 9 | endif 10 | 11 | SUBDIRS = $(DVS_DIR) $(SAMPLE_DIR) -------------------------------------------------------------------------------- /plugins/smart/dvs/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = libdvs 2 | 3 | noinst_LTLIBRARIES = libxcam_plugin_dvs.la 4 | 5 | XCAM_PLUGIN_DVS_CXXFLAGS = \ 6 | $(XCAM_CXXFLAGS) \ 7 | -I$(top_srcdir)/xcore \ 8 | -I$(top_srcdir)/modules \ 9 | -I$(top_srcdir)/plugins/smart/dvs/libdvs \ 10 | $(NULL) 11 | 12 | XCAM_PLUGIN_DVS_LIBS = \ 13 | $(OPENCV_LIBS) \ 14 | $(top_builddir)/xcore/libxcam_core.la \ 15 | $(top_builddir)/modules/ocl/libxcam_ocl.la \ 16 | $(top_builddir)/plugins/smart/dvs/libdvs/libxcam_dvs.la \ 17 | $(NULL) 18 | 19 | if HAVE_LIBDRM 20 | XCAM_PLUGIN_DVS_CXXFLAGS += $(LIBDRM_CFLAGS) 21 | XCAM_PLUGIN_DVS_LIBS += $(LIBDRM_LIBS) 22 | endif 23 | 24 | plugindir="$(libdir)/xcam/plugins/smart" 25 | 26 | libxcam_plugin_dvs_la_SOURCES = \ 27 | xcam_plugin_dvs.cpp \ 28 | $(NULL) 29 | 30 | libxcam_plugin_dvs_la_CXXFLAGS = \ 31 | $(XCAM_PLUGIN_DVS_CXXFLAGS) \ 32 | $(NULL) 33 | 34 | libxcam_plugin_dvs_la_LIBADD = \ 35 | $(XCAM_PLUGIN_DVS_LIBS) \ 36 | $(NULL) 37 | 38 | libxcam_plugin_dvs_la_LDFLAGS = \ 39 | -module -avoid-version \ 40 | $(NULL) 41 | 42 | libxcam_plugin_dvs_la_LIBTOOLFLAGS = --tag=disable-static 43 | -------------------------------------------------------------------------------- /plugins/smart/dvs/libdvs/.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | test_image_stabilization 3 | -------------------------------------------------------------------------------- /plugins/smart/dvs/libdvs/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libxcam_dvs.la 2 | 3 | libxcam_dvs_la_SOURCES = \ 4 | libdvs.cpp \ 5 | stabilizer.cpp \ 6 | $(NULL) 7 | 8 | libxcam_dvs_la_CXXFLAGS = \ 9 | $(XCAM_CXXFLAGS) \ 10 | $(OPENCV_CFLAGS) \ 11 | -I$(top_srcdir)/xcore \ 12 | $(NULL) 13 | 14 | libxcam_dvs_la_LIBADD = \ 15 | $(top_builddir)/xcore/libxcam_core.la \ 16 | $(NULL) 17 | 18 | noinst_PROGRAMS = test_image_stabilization 19 | 20 | test_image_stabilization_SOURCES = \ 21 | test-image-stabilization.cpp \ 22 | $(NULL) 23 | 24 | test_image_stabilization_CXXFLAGS = \ 25 | $(XCAM_CXXFLAGS) \ 26 | -I$(top_srcdir)/xcore \ 27 | $(NULL) 28 | 29 | test_image_stabilization_LDADD = \ 30 | libxcam_dvs.la \ 31 | $(OPENCV_LIBS) \ 32 | $(NULL) 33 | -------------------------------------------------------------------------------- /plugins/smart/sample/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libxcam_sample_smart.la 2 | 3 | XCAM_SAMPLE_CXXFLAGS = \ 4 | $(XCAM_CXXFLAGS) \ 5 | -I$(top_srcdir)/xcore \ 6 | -I$(top_srcdir)/modules/isp \ 7 | -I$(top_srcdir)/plugins/smart \ 8 | $(NULL) 9 | 10 | XCAM_SAMPLE_LIBS = \ 11 | $(top_builddir)/xcore/libxcam_core.la \ 12 | $(NULL) 13 | 14 | if USE_LOCAL_ATOMISP 15 | XCAM_SAMPLE_CXXFLAGS += \ 16 | -I$(top_srcdir)/ext/atomisp \ 17 | $(NULL) 18 | endif 19 | 20 | plugindir="$(libdir)/xcam/plugins/smart" 21 | 22 | libxcam_sample_smart_la_SOURCES = \ 23 | sample_smart_analysis.cpp \ 24 | $(NULL) 25 | 26 | libxcam_sample_smart_la_CXXFLAGS = \ 27 | $(XCAM_SAMPLE_CXXFLAGS) \ 28 | $(NULL) 29 | 30 | libxcam_sample_smart_la_LIBADD = \ 31 | $(XCAM_SAMPLE_LIBS) \ 32 | $(NULL) 33 | 34 | libxcam_sample_smart_la_LDFLAGS = \ 35 | -module -avoid-version \ 36 | $(NULL) 37 | 38 | libxcam_sample_smart_la_LIBTOOLFLAGS = --tag=disable-static 39 | -------------------------------------------------------------------------------- /shaders/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_LIBCL 2 | CLX_DIR = clx 3 | endif 4 | 5 | if HAVE_GLES 6 | GLSLX_DIR = glslx 7 | endif 8 | 9 | SUBDIRS = $(CLX_DIR) $(GLSLX_DIR) 10 | -------------------------------------------------------------------------------- /shaders/cl/kernel_demo.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * function: kernel_demo 3 | * sample code of default kernel arguments 4 | * input: image2d_t as read only 5 | * output: image2d_t as write only 6 | */ 7 | 8 | __kernel void kernel_demo (__read_only image2d_t input, __write_only image2d_t output) 9 | { 10 | int x = get_global_id (0); 11 | int y = get_global_id (1); 12 | sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST; 13 | 14 | int2 pos = (int2)(x, y); 15 | uint4 pixel = read_imageui(input, sampler, pos); 16 | write_imageui(output, pos, pixel); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /shaders/cl/kernel_image_scaler.cl: -------------------------------------------------------------------------------- 1 | /** 2 | * \brief Image scaling kernel function. 3 | * \param[in] input Input image object. 4 | * \param[out] output scaled output image object. 5 | * \param[in] output_width: output width 6 | * \param[in] output_height: output height 7 | * \param[in] vertical_offset: vertical offset from y to uv 8 | */ 9 | __kernel void kernel_image_scaler (__read_only image2d_t input, 10 | __write_only image2d_t output, 11 | const uint output_width, 12 | const uint output_height) 13 | { 14 | int x = get_global_id(0); 15 | int y = get_global_id(1); 16 | 17 | const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR; 18 | 19 | float2 normCoor = convert_float2((int2)(x, y)) / (float2)(output_width, output_height); 20 | float4 scaled_pixel = read_imagef(input, sampler, normCoor); 21 | write_imagef(output, (int2)(x, y), scaled_pixel); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /shaders/cl/kernel_wire_frame.cl: -------------------------------------------------------------------------------- 1 | /* 2 | * function: kernel_wire_frame 3 | * 4 | * output_y: Y channel image2d_t as write only 5 | * output_uv: uv channel image2d_t as write only 6 | * wire_frames_coords: coordinates of wire frames 7 | * coords_num: number of coordinates to be processed 8 | */ 9 | 10 | __kernel void kernel_wire_frame ( 11 | __write_only image2d_t output_y, __write_only image2d_t output_uv, 12 | __global uint2 *wire_frames_coords, uint coords_num, 13 | float border_y, float border_u, float border_v) 14 | { 15 | if (coords_num == 0) { 16 | return; 17 | } 18 | 19 | int gid = get_global_id (0); 20 | if (gid >= coords_num) { 21 | return; 22 | } 23 | 24 | uint2 coord = wire_frames_coords [gid]; 25 | 26 | write_imagef (output_y, (int2)(coord.x / 2, coord.y), (float4)(border_y)); 27 | if (coord.y % 2 == 0) { 28 | write_imagef (output_uv, (int2)(coord.x / 2, coord.y / 2), (float4)(border_u, border_v, 0.0f, 0.0f)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /shaders/clx/.gitignore: -------------------------------------------------------------------------------- 1 | *.clx 2 | -------------------------------------------------------------------------------- /shaders/clx/Makefile.am: -------------------------------------------------------------------------------- 1 | clx_sources = \ 2 | kernel_csc.clx \ 3 | kernel_demo.clx \ 4 | kernel_defog_dcp.clx \ 5 | kernel_min_filter.clx \ 6 | kernel_bi_filter.clx \ 7 | kernel_tnr.clx \ 8 | kernel_bayer_pipe.clx \ 9 | kernel_bayer_basic.clx \ 10 | kernel_fisheye.clx \ 11 | kernel_rgb_pipe.clx \ 12 | kernel_yuv_pipe.clx \ 13 | kernel_tonemapping.clx \ 14 | kernel_newtonemapping.clx \ 15 | kernel_image_scaler.clx \ 16 | kernel_retinex.clx \ 17 | kernel_gauss.clx \ 18 | kernel_gauss_lap_pyramid.clx \ 19 | kernel_geo_map.clx \ 20 | kernel_wavelet_denoise.clx \ 21 | kernel_wavelet_haar.clx \ 22 | kernel_wavelet_coeff.clx \ 23 | kernel_wire_frame.clx \ 24 | kernel_3d_denoise.clx \ 25 | kernel_3d_denoise_slm.clx \ 26 | kernel_image_warp.clx \ 27 | $(NULL) 28 | 29 | add_quotation_marks_sh = \ 30 | $(top_srcdir)/tools/add-quotation-marks.sh 31 | 32 | cl_dir = $(top_srcdir)/shaders/cl 33 | 34 | all-local: $(clx_sources) 35 | 36 | $(clx_sources): %.clx: $(cl_dir)/%.cl 37 | @$(add_quotation_marks_sh) $< $@ 38 | 39 | CLEANFILES = $(clx_sources) 40 | -------------------------------------------------------------------------------- /shaders/glsl/shader_copy.comp.sl: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | layout (local_size_x = 8, local_size_y = 8) in; 4 | 5 | layout (binding = 0) readonly buffer InBuf { 6 | uvec4 data[]; 7 | } in_buf; 8 | 9 | layout (binding = 1) writeonly buffer OutBuf { 10 | uvec4 data[]; 11 | } out_buf; 12 | 13 | uniform uint in_img_width; 14 | uniform uint in_x_offset; 15 | 16 | uniform uint out_img_width; 17 | uniform uint out_x_offset; 18 | 19 | uniform uint copy_width; 20 | 21 | void main () 22 | { 23 | uvec2 g_id = gl_GlobalInvocationID.xy; 24 | g_id.x = min (g_id.x, copy_width - 1u); 25 | 26 | out_buf.data[g_id.y * out_img_width + out_x_offset + g_id.x] = 27 | in_buf.data[g_id.y * in_img_width + in_x_offset + g_id.x]; 28 | } 29 | -------------------------------------------------------------------------------- /shaders/glsl/shader_copy_ssbo_to_tex.comp.sl: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | layout (local_size_x = 1, local_size_y = 1) in; 4 | 5 | layout (binding = 0) readonly buffer InBuf { 6 | uint data[]; 7 | } in_buf; 8 | 9 | layout (binding = 1, rgba8) writeonly uniform highp image2D out_texture; 10 | 11 | uniform uint in_img_width; 12 | 13 | void main () 14 | { 15 | uvec2 g_id = gl_GlobalInvocationID.xy; 16 | 17 | vec4 tex = unpackUnorm4x8 (in_buf.data[g_id.y * in_img_width + g_id.x]); 18 | 19 | imageStore (out_texture, ivec2(4u * g_id.x, g_id.y), tex.rrrr); 20 | imageStore (out_texture, ivec2(4u * g_id.x + 1u, g_id.y), tex.gggg); 21 | imageStore (out_texture, ivec2(4u * g_id.x + 2u, g_id.y), tex.bbbb); 22 | imageStore (out_texture, ivec2(4u * g_id.x + 3u, g_id.y), tex.aaaa); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /shaders/glsl/shader_copy_tex_to_ssbo.comp.sl: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | layout (local_size_x = 1, local_size_y = 1) in; 4 | 5 | layout (binding = 0) uniform sampler2D in_texture; 6 | layout (binding = 1) writeonly buffer OutBuf { 7 | uint data[]; 8 | } out_buf; 9 | 10 | uniform uint out_img_width; 11 | 12 | void main () 13 | { 14 | uvec2 g_id = gl_GlobalInvocationID.xy; 15 | 16 | vec4 out1 = texelFetch (in_texture, ivec2(4u * g_id.x, g_id.y), 0); 17 | vec4 out2 = texelFetch (in_texture, ivec2(4u * g_id.x + 1u, g_id.y), 0); 18 | vec4 out3 = texelFetch (in_texture, ivec2(4u * g_id.x + 2u, g_id.y), 0); 19 | vec4 out4 = texelFetch (in_texture, ivec2(4u * g_id.x + 3u, g_id.y), 0); 20 | 21 | vec4 out_pixels = vec4 (out1.r, out2.r, out3.r, out4.r); 22 | 23 | out_buf.data[g_id.y * out_img_width + g_id.x] = packUnorm4x8 (out_pixels); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /shaders/glslx/.gitignore: -------------------------------------------------------------------------------- 1 | *.slx 2 | -------------------------------------------------------------------------------- /shaders/glslx/Makefile.am: -------------------------------------------------------------------------------- 1 | glslx_sources = \ 2 | shader_copy.comp.slx \ 3 | shader_geomap.comp.slx \ 4 | shader_gauss_scale_pyr.comp.slx \ 5 | shader_lap_trans_pyr.comp.slx \ 6 | shader_blend_pyr.comp.slx \ 7 | shader_reconstruct_pyr.comp.slx \ 8 | shader_geomap_yuv420.comp.slx \ 9 | shader_gauss_scale_pyr_yuv420.comp.slx \ 10 | shader_lap_trans_pyr_yuv420.comp.slx \ 11 | shader_blend_pyr_yuv420.comp.slx \ 12 | shader_reconstruct_pyr_yuv420.comp.slx \ 13 | shader_geomap_fastmap_y.comp.slx \ 14 | shader_geomap_fastmap_uv_nv12.comp.slx \ 15 | shader_geomap_fastmap_uv_yuv420.comp.slx \ 16 | shader_fastmap_blend_y.comp.slx \ 17 | shader_fastmap_blend_uv_nv12.comp.slx \ 18 | shader_fastmap_blend_uv_yuv420.comp.slx \ 19 | shader_copy_tex_to_ssbo.comp.slx \ 20 | shader_copy_ssbo_to_tex.comp.slx \ 21 | $(NULL) 22 | 23 | add_quotation_marks_sh = \ 24 | $(top_srcdir)/tools/add-quotation-marks.sh 25 | 26 | glsl_dir = $(top_srcdir)/shaders/glsl 27 | 28 | all-local: $(glslx_sources) 29 | 30 | $(glslx_sources): %.slx: $(glsl_dir)/%.sl 31 | @$(add_quotation_marks_sh) $< $@ 32 | 33 | CLEANFILES = $(glslx_sources) 34 | -------------------------------------------------------------------------------- /shaders/spv/shader_copy.comp: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | layout (local_size_x = 8, local_size_y = 8) in; 4 | 5 | layout (binding = 0) readonly buffer InBuf { 6 | uvec4 data[]; 7 | } in_buf; 8 | 9 | layout (binding = 1) writeonly buffer OutBuf { 10 | uvec4 data[]; 11 | } out_buf; 12 | 13 | layout (push_constant) uniform PushConsts { 14 | uint in_img_width; 15 | uint in_x_offset; 16 | uint out_img_width; 17 | uint out_x_offset; 18 | uint copy_width; 19 | } prop; 20 | 21 | void main () 22 | { 23 | uvec2 g_id = gl_GlobalInvocationID.xy; 24 | g_id.x = min (g_id.x, prop.copy_width - 1u); 25 | 26 | out_buf.data[g_id.y * prop.out_img_width + prop.out_x_offset + g_id.x] = 27 | in_buf.data[g_id.y * prop.in_img_width + prop.in_x_offset + g_id.x]; 28 | } 29 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | test-binary-kernel 2 | test-cl-image 3 | test-device-manager 4 | test-image-blend 5 | test-image-deblurring 6 | test-image-stitching 7 | test-pipe-manager 8 | test-video-stabilization 9 | test-soft-image 10 | test-gles-handler 11 | test-render-surround-view 12 | test-surround-view 13 | test-vk-handler 14 | test-dnn-inference 15 | -------------------------------------------------------------------------------- /tests/camera_calibration_CamC3C8K.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": "", 3 | "sn": "", 4 | "model": 2, 5 | "rig": [ 6 | 0.0, 7 | 0.0, 8 | 0.0 9 | ], 10 | "cameras": { 11 | "camera":[ 12 | { 13 | "type": 25, 14 | "radius": 2040.0, 15 | "cx": 1900.0, 16 | "cy": 1410.0, 17 | "yaw": 0.0, 18 | "pitch": 0.0, 19 | "roll": 92.3, 20 | "w": 3840, 21 | "h": 2880, 22 | "fov": 200.0, 23 | "t": [ 24 | 0.0, 25 | 0.0, 26 | 0.0 27 | ] 28 | }, 29 | { 30 | "type": 25, 31 | "radius": 1984.0, 32 | "cx": 1920.0, 33 | "cy": 1440.0, 34 | "yaw": 0.0, 35 | "pitch": 0.0, 36 | "roll": 90.2, 37 | "w": 3840, 38 | "h": 2880, 39 | "fov": 200.0, 40 | "t": [ 41 | 0.0, 42 | 0.0, 43 | 0.0 44 | ] 45 | }, 46 | { 47 | "type": 25, 48 | "radius": 1984.0, 49 | "cx": 1860.0, 50 | "cy": 1480.0, 51 | "yaw": 0.0, 52 | "pitch": 0.0, 53 | "roll": 89.3, 54 | "w": 3840, 55 | "h": 2880, 56 | "fov": 200.0, 57 | "t": [ 58 | 0.0, 59 | 0.0, 60 | 0.0 61 | ] 62 | }, 63 | { 64 | "type": 25, 65 | "radius": 1984.0, 66 | "cx": 1944.0, 67 | "cy": 1460.0, 68 | "yaw": 0.0, 69 | "pitch": 0.0, 70 | "roll": 90.8, 71 | "w": 3840, 72 | "h": 2880, 73 | "fov": 200.0, 74 | "t": [ 75 | 0.0, 76 | 0.0, 77 | 0.0 78 | ] 79 | }, 80 | { 81 | "type": 25, 82 | "radius": 1984.0, 83 | "cx": 1910.0, 84 | "cy": 1420.0, 85 | "yaw": 0.0, 86 | "pitch": 0.0, 87 | "roll": 90.5, 88 | "w": 3840, 89 | "h": 2880, 90 | "fov": 200.0, 91 | "t": [ 92 | 0.0, 93 | 0.0, 94 | 0.0 95 | ] 96 | }, 97 | { 98 | "type": 25, 99 | "radius": 1984.0, 100 | "cx": 1928.0, 101 | "cy": 1440.0, 102 | "yaw": 0.0, 103 | "pitch": 0.0, 104 | "roll": 89.7, 105 | "w": 3840, 106 | "h": 2880, 107 | "fov": 200.0, 108 | "t": [ 109 | 0.0, 110 | 0.0, 111 | 0.0 112 | ] 113 | } 114 | ] 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /tests/camera_calibration_CamC6C8K.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": "", 3 | "sn": "", 4 | "model": 3, 5 | "rig": [ 6 | 0.0, 7 | 0.0, 8 | 0.0 9 | ], 10 | "cameras": { 11 | "camera":[ 12 | { 13 | "type": 25, 14 | "radius": 2040.0, 15 | "cx": 1960.0, 16 | "cy": 1460.0, 17 | "yaw": 0.0, 18 | "pitch": 0.0, 19 | "roll": 89.4, 20 | "w": 3840, 21 | "h": 2880, 22 | "fov": 200.0, 23 | "t": [ 24 | 0.0, 25 | 0.0, 26 | 0.0 27 | ] 28 | }, 29 | { 30 | "type": 25, 31 | "radius": 2040.0, 32 | "cx": 1930.0, 33 | "cy": 1450.0, 34 | "yaw": 0.0, 35 | "pitch": 0.0, 36 | "roll": 90.2, 37 | "w": 3840, 38 | "h": 2880, 39 | "fov": 200.0, 40 | "t": [ 41 | 0.0, 42 | 0.0, 43 | 0.0 44 | ] 45 | }, 46 | { 47 | "type": 25, 48 | "radius": 2040.0, 49 | "cx": 1965.0, 50 | "cy": 1465.0, 51 | "yaw": 0.0, 52 | "pitch": 0.0, 53 | "roll": 90.5, 54 | "w": 3840, 55 | "h": 2880, 56 | "fov": 200.0, 57 | "t": [ 58 | 0.0, 59 | 0.0, 60 | 0.0 61 | ] 62 | }, 63 | { 64 | "type": 25, 65 | "radius": 2040.0, 66 | "cx": 1940.0, 67 | "cy": 1425.0, 68 | "yaw": 0.0, 69 | "pitch": 0.0, 70 | "roll": 89.7, 71 | "w": 3840, 72 | "h": 2880, 73 | "fov": 200.0, 74 | "t": [ 75 | 0.0, 76 | 0.0, 77 | 0.0 78 | ] 79 | }, 80 | { 81 | "type": 25, 82 | "radius": 2040.0, 83 | "cx": 1940.0, 84 | "cy": 1420.0, 85 | "yaw": 0.0, 86 | "pitch": 0.0, 87 | "roll": 91.4, 88 | "w": 3840, 89 | "h": 2880, 90 | "fov": 200.0, 91 | "t": [ 92 | 0.0, 93 | 0.0, 94 | 0.0 95 | ] 96 | }, 97 | { 98 | "type": 25, 99 | "radius": 2040.0, 100 | "cx": 1945.0, 101 | "cy": 1380.0, 102 | "yaw": 0.0, 103 | "pitch": 0.0, 104 | "roll": 91.4, 105 | "w": 3840, 106 | "h": 2880, 107 | "fov": 200.0, 108 | "t": [ 109 | 0.0, 110 | 0.0, 111 | 0.0 112 | ] 113 | } 114 | ] 115 | } 116 | } 117 | 118 | -------------------------------------------------------------------------------- /tests/test-xcamsrc-camera.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gst-launch-1.0 xcamsrc sensor-id=3 capture-mode=1 io-mode=4 ! video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 ! queue ! vaapiencode_h264 ! fakesink 4 | -------------------------------------------------------------------------------- /tests/test_inline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * test_inline.h - test inline header 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Yinhang Liu 20 | */ 21 | 22 | #ifndef XCAM_TEST_INLINE_H 23 | #define XCAM_TEST_INLINE_H 24 | 25 | #include 26 | 27 | using namespace XCam; 28 | 29 | inline static void 30 | ensure_gpu_buffer_done (SmartPtr buf) 31 | { 32 | const VideoBufferInfo info = buf->get_video_info (); 33 | VideoBufferPlanarInfo planar; 34 | uint8_t *memory = NULL; 35 | 36 | memory = buf->map (); 37 | for (uint32_t index = 0; index < info.components; index++) { 38 | info.get_planar_info (planar, index); 39 | uint32_t line_bytes = planar.width * planar.pixel_bytes; 40 | 41 | for (uint32_t i = 0; i < planar.height; i++) { 42 | int mem_idx = info.offsets [index] + i * info.strides [index] + line_bytes - 1; 43 | if (memory[mem_idx] == 1) { 44 | memory[mem_idx] = 1; 45 | } 46 | } 47 | } 48 | buf->unmap (); 49 | } 50 | 51 | #endif // XCAM_TEST_INLINE_H 52 | -------------------------------------------------------------------------------- /tools/add-quotation-marks.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Add double quotation marks on source file 3 | # Usage: add-quotation-marks.sh 4 | 5 | SRC_FILE=$1 6 | DST_FILE=$2 7 | 8 | if [ $# -ne 2 ]; then 9 | echo "Usage: $0 " 10 | exit 1 11 | fi 12 | 13 | gawk ' 14 | BEGIN { FS = "" } 15 | { 16 | if ($0~/^[\t " "]*[\/]+/ || $0~/^[\t " "]*[\*]/) 17 | print $0 18 | else 19 | { 20 | if ($0~/^[ ]*$/) 21 | print 22 | else 23 | { 24 | $0 = gensub (/\\$/, "\\\\\\\\", "g") 25 | $0 = gensub (/"/, "\\\\\\\"", "g") 26 | $0 = gensub (/%/, "\\\\%", "g") 27 | $0 = gensub (/\\n/, "\\\\\\\\n", "g") 28 | $0 = gensub (/\\t/, "\\\\\\\\t", "g") 29 | $0 = gensub (/^#/, "\\\\n#", "g") 30 | 31 | print "\""$0"\\n\"" 32 | } 33 | } 34 | } 35 | ' $SRC_FILE > $DST_FILE.tmp 36 | 37 | ret=$? 38 | if [ $ret != 0 ]; then 39 | rm -rf $DST_FILE.tmp 40 | echo "Add double quotation marks on $SRC_FILE failed" 41 | exit 1 42 | fi 43 | 44 | mv $DST_FILE.tmp $DST_FILE 45 | 46 | echo "Add double quotation marks on $SRC_FILE done" 47 | -------------------------------------------------------------------------------- /tools/convert-binary-to-text.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Convert binary to binary-text. 3 | # Command line: 4 | # convert-binary-to-text.sh xxx.cl.bin xxx.clx.bin 5 | # 6 | # Usage of binary-text file (if needed): 7 | # 1. generate binary file, related script: libxcam/tests/test-binary-kernel 8 | # $ test-binary-kernel --src-kernel kernel_demo.cl --bin-kernel kernel_demo.cl.bin --kernel-name kernel_demo 9 | # 10 | # 2. generate binary-text file, related script: libxcam/tools/convert-binary-to-text.sh 11 | # $ convert-binary-to-text.sh kernel_demo.cl.bin kernel_demo.clx.bin 12 | # 13 | # 3. include binary-text file when create image handler, please refer to demo handler: 14 | # SmartPtr create_cl_binary_demo_image_handler (SmartPtr &context) 15 | 16 | 17 | BINARY_FILE=$1 18 | TEXT_FILE=$2 19 | 20 | if [ $# -ne 2 ]; then 21 | echo "Usage: $0 " 22 | exit 1 23 | fi 24 | 25 | od -A n -t x1 -v $BINARY_FILE | \ 26 | gawk ' 27 | BEGIN { print "{" } 28 | { 29 | printf " " 30 | for (i = 1; i < NF; i++) 31 | { printf " 0x" $i "," } 32 | print " 0x" $i "," 33 | } 34 | END { print "};" } 35 | ' > $TEXT_FILE.tmp 36 | 37 | ret=$? 38 | if [ $ret != 0 ]; then 39 | echo "Convert $BINARY_FILE to $TEXT_FILE faild" 40 | rm -f $TEXT_FILE.tmp 41 | exit 1 42 | fi 43 | 44 | mv $TEXT_FILE.tmp $TEXT_FILE 45 | 46 | echo "Convert $BINARY_FILE to $TEXT_FILE done" 47 | -------------------------------------------------------------------------------- /tools/pre-commit-code-style.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # checking code style before commit 3 | 4 | ASTYLE=astyle 5 | ASTYLE_PARAMS="--indent=spaces=4 --convert-tabs --pad-oper --suffix=none" 6 | 7 | DOS2UNIX=dos2unix 8 | DOS2UNIX_PARAMS="-ascii --safe --keepdate --quiet" 9 | 10 | command -v $ASTYLE > /dev/null 2>&1 || echo "warning: $ASTYLE is not installed" 11 | command -v $DOS2UNIX > /dev/null 2>&1 || echo "warning: $DOS2UNIX is not installed" 12 | 13 | echo "---- checking code style (dos2unix / astyle)----" 14 | for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR | grep -E "\.c$|\.cpp$|\.h$|\.cl$|\.hpp$" ` ; do 15 | $DOS2UNIX ${DOS2UNIX_PARAMS} ${file} 16 | $ASTYLE ${ASTYLE_PARAMS} ${file} 17 | ret=$? 18 | if [ $ret != 0 ] ; then 19 | echo "code style failed on $file" 20 | exit 1 21 | fi 22 | git add $file 23 | done 24 | echo "---- checking code style done----" 25 | -------------------------------------------------------------------------------- /wrapper/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_GST 2 | GST_DIR = gstreamer 3 | endif 4 | 5 | SUBDIRS = $(GST_DIR) 6 | -------------------------------------------------------------------------------- /wrapper/gstreamer/gst_xcam_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gst_xcam_utils.h - gst xcam utilities 3 | * 4 | * Copyright (c) 2016 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef GST_XCAM_UTILS_H 22 | #define GST_XCAM_UTILS_H 23 | 24 | #include "dma_video_buffer.h" 25 | 26 | class DmaGstBuffer 27 | : public XCam::DmaVideoBuffer 28 | { 29 | public: 30 | DmaGstBuffer (const XCam::VideoBufferInfo &info, int dma_fd, GstBuffer *gst_buf) 31 | : XCam::DmaVideoBuffer (info, dma_fd) 32 | , _gst_buf (gst_buf) 33 | { 34 | gst_buffer_ref (_gst_buf); 35 | } 36 | 37 | ~DmaGstBuffer () { 38 | gst_buffer_unref (_gst_buf); 39 | } 40 | 41 | private: 42 | XCAM_DEAD_COPY (DmaGstBuffer); 43 | 44 | private: 45 | GstBuffer *_gst_buf; 46 | }; 47 | 48 | #endif // GST_XCAM_UTILS_H 49 | -------------------------------------------------------------------------------- /wrapper/gstreamer/gstxcambuffermeta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gstxcambuffermeta.h - gst xcam buffer meta data 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef GST_XCAM_BUFFER_META_H 22 | #define GST_XCAM_BUFFER_META_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | XCAM_BEGIN_DECLARE 30 | 31 | #define GST_XCAM_META_TAG_XCAM "xcam" 32 | #define GST_XCAM_META_TAG_BUF "buf" 33 | 34 | #define GST_XCAM_BUFFER_META_API_TYPE \ 35 | (gst_xcam_buffer_meta_api_get_type ()) 36 | 37 | #define gst_buffer_get_xcam_buffer_meta(b) \ 38 | ((GstXCamBufferMeta*)gst_buffer_get_meta ((b), GST_XCAM_BUFFER_META_API_TYPE)) 39 | 40 | typedef struct _GstXCamBufferMeta { 41 | GstMeta meta_base; 42 | XCam::SmartPtr buffer; 43 | } GstXCamBufferMeta; 44 | 45 | GType 46 | gst_xcam_buffer_meta_api_get_type (void); 47 | 48 | GstXCamBufferMeta * 49 | gst_buffer_add_xcam_buffer_meta ( 50 | GstBuffer *buffer, 51 | const XCam::SmartPtr &data); 52 | 53 | XCAM_END_DECLARE 54 | 55 | #endif //GST_XCAM_BUFFER_META_H 56 | -------------------------------------------------------------------------------- /wrapper/gstreamer/gstxcambufferpool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gstxcambufferpool.h - buffer pool 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: John Ye 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef GST_XCAM_BUFFER_POOL_H 23 | #define GST_XCAM_BUFFER_POOL_H 24 | 25 | #include 26 | #include "main_dev_manager.h" 27 | #include "gstxcamsrc.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GST_TYPE_XCAM_BUFFER_POOL \ 32 | (gst_xcam_buffer_pool_get_type()) 33 | #define GST_XCAM_BUFFER_POOL(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_XCAM_BUFFER_POOL,GstXCamBufferPool)) 35 | 36 | typedef struct _GstXCamBufferPool GstXCamBufferPool; 37 | typedef struct _GstXCamBufferPoolClass GstXCamBufferPoolClass; 38 | 39 | struct _GstXCamBufferPool 40 | { 41 | GstBufferPool parent; 42 | GstAllocator *allocator; 43 | GstXCamSrc *src; 44 | gboolean need_video_meta; 45 | XCam::SmartPtr device_manager; 46 | }; 47 | 48 | struct _GstXCamBufferPoolClass 49 | { 50 | GstBufferPoolClass parent_class; 51 | }; 52 | 53 | GType gst_xcam_buffer_pool_get_type (void); 54 | 55 | GstBufferPool * 56 | gst_xcam_buffer_pool_new (GstXCamSrc *xcamsrc, GstCaps *caps, XCam::SmartPtr &device_manager); 57 | 58 | G_END_DECLS 59 | 60 | #endif // GST_XCAM_BUFFER_POOL_H 61 | -------------------------------------------------------------------------------- /wrapper/gstreamer/interface/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libgstxcaminterface.la 2 | 3 | libgstxcaminterface_la_SOURCES = gstxcaminterface.c 4 | 5 | libgstxcaminterface_la_CFLAGS = \ 6 | $(XCAM_CFLAGS) \ 7 | $(GST_CFLAGS) \ 8 | -I$(top_srcdir)/xcore \ 9 | -I$(top_srcdir)/xcore/base \ 10 | $(NULL) 11 | 12 | libgstxcaminterface_la_LIBADD = \ 13 | $(GST_LIBS) \ 14 | $(top_builddir)/xcore/libxcam_core.la \ 15 | $(NULL) 16 | 17 | libgstxcaminterfaceincludedir = \ 18 | $(includedir)/gstreamer-1.0/gst \ 19 | $(NULL) 20 | 21 | libgstxcaminterfaceinclude_HEADERS = \ 22 | gstxcaminterface.h \ 23 | $(NULL) 24 | -------------------------------------------------------------------------------- /wrapper/gstreamer/main_dev_manager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * main_dev_manager.cpp - main device manager 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: John Ye 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #include "main_dev_manager.h" 23 | 24 | using namespace XCam; 25 | 26 | namespace GstXCam { 27 | 28 | MainDeviceManager::MainDeviceManager() 29 | { 30 | } 31 | 32 | MainDeviceManager::~MainDeviceManager() 33 | { 34 | } 35 | 36 | void 37 | MainDeviceManager::handle_message (const SmartPtr &msg) 38 | { 39 | XCAM_UNUSED (msg); 40 | } 41 | 42 | void 43 | MainDeviceManager::handle_buffer (const SmartPtr &buf) 44 | { 45 | XCAM_ASSERT (buf.ptr ()); 46 | _ready_buffers.push (buf); 47 | } 48 | 49 | SmartPtr 50 | MainDeviceManager::dequeue_buffer () 51 | { 52 | SmartPtr ret; 53 | ret = _ready_buffers.pop (-1); 54 | return ret; 55 | } 56 | 57 | void 58 | MainDeviceManager::pause_dequeue () 59 | { 60 | return _ready_buffers.pause_pop (); 61 | } 62 | 63 | void 64 | MainDeviceManager::resume_dequeue () 65 | { 66 | return _ready_buffers.resume_pop (); 67 | } 68 | 69 | }; 70 | -------------------------------------------------------------------------------- /wrapper/gstreamer/main_pipe_manager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * main_pipe_manager.cpp -main pipe manager 3 | * 4 | * Copyright (c) 2016 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #include "main_pipe_manager.h" 22 | 23 | using namespace XCam; 24 | 25 | namespace GstXCam { 26 | 27 | void 28 | MainPipeManager::post_buffer (const SmartPtr &buf) 29 | { 30 | XCAM_ASSERT (buf.ptr ()); 31 | _ready_buffers.push (buf); 32 | } 33 | 34 | SmartPtr 35 | MainPipeManager::dequeue_buffer (const int32_t timeout) 36 | { 37 | SmartPtr ret; 38 | ret = _ready_buffers.pop (timeout); 39 | return ret; 40 | } 41 | 42 | void 43 | MainPipeManager::pause_dequeue () 44 | { 45 | return _ready_buffers.pause_pop (); 46 | } 47 | 48 | void 49 | MainPipeManager::resume_dequeue () 50 | { 51 | return _ready_buffers.resume_pop (); 52 | } 53 | 54 | }; 55 | -------------------------------------------------------------------------------- /wrapper/gstreamer/main_pipe_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * main_pipe_manager.h -main pipe manager 3 | * 4 | * Copyright (c) 2016 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAMFILTER_MAIN_PIPE_MANAGER_H 22 | #define XCAMFILTER_MAIN_PIPE_MANAGER_H 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace GstXCam { 34 | 35 | class MainPipeManager 36 | : public XCam::PipeManager 37 | { 38 | public: 39 | MainPipeManager () {}; 40 | ~MainPipeManager () {}; 41 | 42 | XCam::SmartPtr dequeue_buffer (const int32_t timeout); 43 | void pause_dequeue (); 44 | void resume_dequeue (); 45 | 46 | void set_image_processor (XCam::SmartPtr &processor) { 47 | _image_processor = processor; 48 | } 49 | 50 | XCam::SmartPtr &get_image_processor () { 51 | return _image_processor; 52 | } 53 | 54 | protected: 55 | virtual void post_buffer (const XCam::SmartPtr &buf); 56 | 57 | private: 58 | XCam::SafeList _ready_buffers; 59 | XCam::SmartPtr _image_processor; 60 | }; 61 | 62 | }; 63 | 64 | #endif // XCAMFILTER_MAIN_PIPE_MANAGER_H 65 | -------------------------------------------------------------------------------- /xcore/analyzer_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * analyzer_loader.h - analyzer loader 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_ANALYZER_LOADER_H 22 | #define XCAM_ANALYZER_LOADER_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class AnalyzerLoader 29 | { 30 | public: 31 | AnalyzerLoader (const char *lib_path, const char *symbol); 32 | virtual ~AnalyzerLoader (); 33 | 34 | protected: 35 | void *load_library (const char *lib_path); 36 | void *get_symbol (void* handle); 37 | virtual void *load_symbol (void* handle) = 0; 38 | bool close_handle (); 39 | const char * get_lib_path () const { 40 | return _path; 41 | } 42 | 43 | private: 44 | void *open_handle (const char *lib_path); 45 | 46 | XCAM_DEAD_COPY(AnalyzerLoader); 47 | 48 | private: 49 | void *_handle; 50 | char *_symbol; 51 | char *_path; 52 | }; 53 | 54 | }; 55 | 56 | #endif //XCAM_ANALYZER_LOADER_H 57 | -------------------------------------------------------------------------------- /xcore/base/xcam_3a_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcam_3a_stats.h - 3a stats standard version 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef C_XCAM_3A_STATS_H 22 | #define C_XCAM_3A_STATS_H 23 | 24 | #include 25 | 26 | XCAM_BEGIN_DECLARE 27 | 28 | typedef struct _XCam3AStatsInfo { 29 | uint32_t width; 30 | uint32_t height; 31 | uint32_t aligned_width; 32 | uint32_t aligned_height; 33 | uint32_t grid_pixel_size; // in pixel 34 | uint32_t bit_depth; 35 | uint32_t histogram_bins; 36 | 37 | uint32_t reserved[2]; 38 | } XCam3AStatsInfo; 39 | 40 | typedef struct _XCamHistogram { 41 | uint32_t r; 42 | uint32_t gr; 43 | uint32_t gb; 44 | uint32_t b; 45 | } XCamHistogram; 46 | 47 | typedef struct _XCamGridStat { 48 | /* ae */ 49 | uint32_t avg_y; 50 | 51 | /* awb */ 52 | uint32_t avg_r; 53 | uint32_t avg_gr; 54 | uint32_t avg_gb; 55 | uint32_t avg_b; 56 | uint32_t valid_wb_count; 57 | 58 | /* af */ 59 | uint32_t f_value1; 60 | uint32_t f_value2; 61 | } XCamGridStat; 62 | 63 | typedef struct _XCam3AStats { 64 | XCam3AStatsInfo info; 65 | XCamHistogram *hist_rgb; 66 | uint32_t *hist_y; 67 | XCamGridStat stats[0]; 68 | } XCam3AStats; 69 | 70 | XCAM_END_DECLARE 71 | 72 | #endif //C_XCAM_3A_STATS_H 73 | -------------------------------------------------------------------------------- /xcore/base/xcam_smart_result.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcam_smart_result.h - smart result(meta data) 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef C_XCAM_SMART_RESULT_H 22 | #define C_XCAM_SMART_RESULT_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | XCAM_BEGIN_DECLARE 30 | 31 | typedef struct _XCamFaceInfo { 32 | uint32_t id; 33 | uint32_t pos_x; 34 | uint32_t pos_y; 35 | uint32_t width; 36 | uint32_t height; 37 | uint32_t factor; 38 | uint32_t landmark[128]; 39 | } XCamFaceInfo; 40 | 41 | /* 42 | * Face detection result 43 | * head.type = XCAM_3A_RESULT_FACE_DETECTION; 44 | * head.process_type = XCAM_IMAGE_PROCESS_POST; 45 | * head.destroy = free fd result. 46 | */ 47 | 48 | typedef struct _XCamFDResult { 49 | XCam3aResultHead head; 50 | uint32_t face_num; 51 | XCamFaceInfo faces[0]; 52 | } XCamFDResult; 53 | 54 | /* 55 | * Digital Video Stabilizer result 56 | * head.type = XCAM_3A_RESULT_DVS; 57 | * head.process_type = XCAM_IMAGE_PROCESS_POST; 58 | * head.destroy = free dvs result. 59 | */ 60 | 61 | typedef struct _XCamDVSResult { 62 | XCam3aResultHead head; 63 | int frame_id; 64 | int frame_width; 65 | int frame_height; 66 | double proj_mat[9]; 67 | } XCamDVSResult; 68 | 69 | XCAM_END_DECLARE 70 | 71 | #endif //C_XCAM_SMART_RESULT_H 72 | 73 | -------------------------------------------------------------------------------- /xcore/calibration_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * calibration_parser.h - parse fisheye calibration file 3 | * 4 | * Copyright (c) 2016-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Junkai Wu 19 | * Author: Zong Wei 20 | */ 21 | 22 | #ifndef XCAM_CALIBRATION_PARSER_H 23 | #define XCAM_CALIBRATION_PARSER_H 24 | 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class CalibrationParser 31 | { 32 | public: 33 | explicit CalibrationParser (); 34 | 35 | XCamReturn parse_intrinsic_param (char *file_body, IntrinsicParameter &intrinsic_param); 36 | XCamReturn parse_extrinsic_param (char *file_body, ExtrinsicParameter &extrinsic_param); 37 | 38 | //file generated by Scaramuzza's approach 39 | XCamReturn parse_intrinsic_file (const char *file_path, IntrinsicParameter &intrinsic_param); 40 | XCamReturn parse_extrinsic_file (const char *file_path, ExtrinsicParameter &extrinsic_param); 41 | 42 | XCamReturn parse_calib_file (const char *file_path, std::vector &calib_info, int32_t camera_count); 43 | XCamReturn parse_calib_param (char *file_body, std::vector &calib_info, int32_t camera_count); 44 | 45 | #if HAVE_JSON 46 | //file generated by OpenCV fisheye camera calibration 47 | XCamReturn parse_fisheye_camera_param (const char *file_path, FisheyeInfo *fisheye_info, int32_t camera_count); 48 | #endif 49 | 50 | private: 51 | XCAM_DEAD_COPY (CalibrationParser); 52 | }; 53 | 54 | } 55 | 56 | #endif // XCAM_CALIBRATION_PARSER_H 57 | -------------------------------------------------------------------------------- /xcore/dma_video_buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dma_video_buffer.h - dma video buffer 3 | * 4 | * Copyright (c) 2016 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | #ifndef XCAM_DMA_VIDEO_BUFFER_H 21 | #define XCAM_DMA_VIDEO_BUFFER_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class DmaVideoBuffer 30 | : public VideoBuffer 31 | { 32 | public: 33 | DmaVideoBuffer (const VideoBufferInfo &info, int dma_fd, bool need_close_fd = false); 34 | 35 | virtual ~DmaVideoBuffer (); 36 | 37 | virtual uint8_t *map (); 38 | virtual bool unmap (); 39 | virtual int get_fd (); 40 | 41 | private: 42 | 43 | XCAM_DEAD_COPY (DmaVideoBuffer); 44 | 45 | private: 46 | int _dma_fd; 47 | bool _need_close_fd; 48 | }; 49 | 50 | SmartPtr append_to_dmabuf (XCamVideoBuffer *buf); 51 | 52 | } 53 | 54 | #endif //XCAM_DMA_VIDEO_BUFFER_H 55 | -------------------------------------------------------------------------------- /xcore/drm_v4l2_buffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * drm_v4l2_buffer.cpp - drm buffer 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Author: John Ye 20 | */ 21 | 22 | #include "drm_v4l2_buffer.h" 23 | 24 | namespace XCam { 25 | 26 | DrmV4l2Buffer::~DrmV4l2Buffer () 27 | { 28 | XCAM_ASSERT (_display.ptr()); 29 | int handle = _display->get_drm_handle (); 30 | if (handle > 0) { 31 | struct drm_mode_destroy_dumb gem; 32 | xcam_mem_clear (gem); 33 | gem.handle = _gem_handle; 34 | xcam_device_ioctl (handle, DRM_IOCTL_MODE_DESTROY_DUMB, &gem); 35 | } 36 | } 37 | 38 | }; 39 | -------------------------------------------------------------------------------- /xcore/drm_v4l2_buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * drm_v4l2_buffer.h - drm v4l2 buffer 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Author: John Ye 20 | */ 21 | 22 | #ifndef XCAM_DRM_V4L2_BUFFER_H 23 | #define XCAM_DRM_V4L2_BUFFER_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace XCam { 30 | 31 | class AtomispDevice; 32 | 33 | class DrmV4l2Buffer 34 | : public V4l2Buffer 35 | { 36 | public: 37 | explicit DrmV4l2Buffer ( 38 | uint32_t gem_handle, 39 | const struct v4l2_buffer &buf, 40 | const struct v4l2_format &format, 41 | SmartPtr &display 42 | ) 43 | : V4l2Buffer (buf, format) 44 | , _gem_handle (gem_handle) 45 | , _display (display) 46 | {} 47 | ~DrmV4l2Buffer (); 48 | 49 | private: 50 | XCAM_DEAD_COPY (DrmV4l2Buffer); 51 | 52 | private: 53 | uint32_t _gem_handle; 54 | SmartPtr _display; 55 | }; 56 | 57 | }; 58 | 59 | #endif // XCAM_DRM_V4L2_BUFFER_H 60 | -------------------------------------------------------------------------------- /xcore/dynamic_analyzer_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dynamic_analyzer_loader.h - dynamic analyzer loader 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | * Zong Wei 20 | */ 21 | 22 | #ifndef XCAM_DYNAMIC_ANALYZER_LOADER_H 23 | #define XCAM_DYNAMIC_ANALYZER_LOADER_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace XCam { 30 | class X3aAnalyzer; 31 | 32 | class DynamicAnalyzerLoader 33 | : public AnalyzerLoader 34 | { 35 | public: 36 | DynamicAnalyzerLoader (const char *lib_path, const char *symbol = XCAM_3A_LIB_DESCRIPTION); 37 | virtual ~DynamicAnalyzerLoader (); 38 | 39 | virtual SmartPtr load_analyzer (SmartPtr &self); 40 | 41 | protected: 42 | virtual void *load_symbol (void* handle); 43 | 44 | private: 45 | XCAM_DEAD_COPY(DynamicAnalyzerLoader); 46 | }; 47 | 48 | }; 49 | 50 | #endif // XCAM_DYNAMIC_ANALYZER_LOADER_H -------------------------------------------------------------------------------- /xcore/fake_poll_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fake_poll_thread.h - poll thread for raw image 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Jia Meng 19 | */ 20 | 21 | #ifndef XCAM_FAKE_POLL_THREAD_H 22 | #define XCAM_FAKE_POLL_THREAD_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class FakePollThread 30 | : public PollThread 31 | { 32 | public: 33 | explicit FakePollThread (const char *raw_path); 34 | ~FakePollThread (); 35 | 36 | virtual XCamReturn start(); 37 | virtual XCamReturn stop (); 38 | 39 | protected: 40 | virtual XCamReturn poll_buffer_loop (); 41 | 42 | private: 43 | XCAM_DEAD_COPY (FakePollThread); 44 | 45 | virtual XCamReturn init_3a_stats_pool () { 46 | return XCAM_RETURN_ERROR_UNKNOWN; 47 | } 48 | XCamReturn init_buffer_pool (); 49 | XCamReturn read_buf (SmartPtr &buf); 50 | 51 | private: 52 | char *_raw_path; 53 | FILE *_raw; 54 | SmartPtr _buf_pool; 55 | }; 56 | 57 | }; 58 | 59 | #endif //XCAM_FAKE_POLL_THREAD_H 60 | -------------------------------------------------------------------------------- /xcore/fake_v4l2_device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fake_v4l2_device.h - fake v4l2 device 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Jia Meng 19 | */ 20 | 21 | #ifndef XCAM_FAKE_V4L2_DEVICE_H 22 | #define XCAM_FAKE_V4L2_DEVICE_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class FakeV4l2Device 29 | : public V4l2Device 30 | { 31 | public: 32 | FakeV4l2Device () 33 | : V4l2Device ("/dev/null") 34 | {} 35 | 36 | int io_control (uint32_t cmd, void *arg) 37 | { 38 | XCAM_UNUSED (arg); 39 | 40 | int ret = 0; 41 | switch (cmd) { 42 | case VIDIOC_ENUM_FMT: 43 | ret = -1; 44 | break; 45 | default: 46 | break; 47 | } 48 | return ret; 49 | } 50 | }; 51 | 52 | }; 53 | #endif // XCAM_FAKE_V4L2_DEVICE_H 54 | -------------------------------------------------------------------------------- /xcore/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * file.h - File class 3 | * 4 | * Copyright (c) 2016-2020 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef XCAM_FILE_H 23 | #define XCAM_FILE_H 24 | 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class File { 30 | public: 31 | File (); 32 | explicit File (const char *name, const char *option); 33 | virtual ~File (); 34 | 35 | bool is_valid () const { 36 | return (_fp ? true : false); 37 | } 38 | bool end_of_file (); 39 | 40 | XCamReturn get_file_size (size_t &size); 41 | const char *get_file_name () const { 42 | return _file_name; 43 | } 44 | 45 | XCamReturn open (const char *name, const char *option); 46 | XCamReturn close (); 47 | XCamReturn rewind (); 48 | 49 | XCamReturn read_file (void *buf, size_t size); 50 | XCamReturn write_file (const void *buf, size_t size); 51 | 52 | private: 53 | XCAM_DEAD_COPY (File); 54 | 55 | protected: 56 | FILE *_fp; 57 | 58 | private: 59 | char *_file_name; 60 | size_t _file_size; 61 | }; 62 | 63 | } 64 | 65 | #endif // XCAM_FILE_H -------------------------------------------------------------------------------- /xcore/fisheye_image_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fisheye_image_file.h - Fisheye image file class 3 | * 4 | * Copyright (c) 2020 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | */ 20 | 21 | #ifndef XCAM_FISHEYE_IMAGE_FILE_H 22 | #define XCAM_FISHEYE_IMAGE_FILE_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class FisheyeImageFile 31 | : public ImageFile 32 | { 33 | public: 34 | FisheyeImageFile (); 35 | virtual ~FisheyeImageFile (); 36 | 37 | virtual XCamReturn read_buf (const SmartPtr &buf); 38 | 39 | bool set_fisheye_num (uint32_t num); 40 | void set_img_size (uint32_t width, uint32_t height); 41 | 42 | void set_center (float cx, float cy, uint32_t idx = 0); 43 | void set_roi_radius (uint32_t roi_radius, uint32_t idx = 0); 44 | 45 | private: 46 | XCAM_DEAD_COPY (FisheyeImageFile); 47 | 48 | bool gen_roi_pos (uint32_t idx); 49 | XCamReturn read_roi (const SmartPtr &buf, uint32_t idx); 50 | 51 | enum { FISHEYE_MAX_NUM = 2 }; 52 | 53 | private: 54 | uint32_t _fisheye_num; 55 | uint32_t _img_w; 56 | uint32_t _img_h; 57 | 58 | float _cx[FISHEYE_MAX_NUM]; 59 | float _cy[FISHEYE_MAX_NUM]; 60 | uint32_t _roi_radius[FISHEYE_MAX_NUM]; 61 | 62 | uint32_t *_x_min[FISHEYE_MAX_NUM]; 63 | uint32_t *_x_max[FISHEYE_MAX_NUM]; 64 | 65 | bool _update_roi_pos[FISHEYE_MAX_NUM]; 66 | }; 67 | 68 | } 69 | 70 | #endif // XCAM_FISHEYE_IMAGE_FILE_H 71 | -------------------------------------------------------------------------------- /xcore/image_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * image_file.h - Image file class 3 | * 4 | * Copyright (c) 2016-2020 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Yinhang Liu 19 | * Author: Wind Yuan 20 | */ 21 | 22 | #ifndef XCAM_IMAGE_FILE_H 23 | #define XCAM_IMAGE_FILE_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace XCam { 30 | 31 | class ImageFile 32 | : public File 33 | { 34 | public: 35 | ImageFile (); 36 | explicit ImageFile (const char *name, const char *option); 37 | virtual ~ImageFile (); 38 | 39 | virtual XCamReturn read_buf (const SmartPtr &buf); 40 | XCamReturn write_buf (const SmartPtr &buf); 41 | 42 | private: 43 | XCAM_DEAD_COPY (ImageFile); 44 | }; 45 | 46 | } 47 | 48 | #endif // XCAM_IMAGE_FILE_H 49 | -------------------------------------------------------------------------------- /xcore/meta_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * meta_data.h - meta data struct 3 | * 4 | * Copyright (c) 2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_META_DATA_H 22 | #define XCAM_META_DATA_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | struct MetaBase 30 | { 31 | MetaBase () {} 32 | virtual ~MetaBase() {}; 33 | private: 34 | XCAM_DEAD_COPY (MetaBase); 35 | }; 36 | 37 | struct MetaData 38 | : MetaBase 39 | { 40 | int64_t timestamp; // in microseconds 41 | 42 | MetaData () { 43 | timestamp = 0; 44 | }; 45 | virtual ~MetaData () {}; 46 | private: 47 | XCAM_DEAD_COPY (MetaData); 48 | }; 49 | 50 | struct DevicePose 51 | : MetaData 52 | { 53 | double orientation[4]; 54 | double translation[3]; 55 | uint32_t confidence; 56 | 57 | DevicePose () 58 | { 59 | xcam_mem_clear (orientation); 60 | xcam_mem_clear (translation); 61 | confidence = 1; 62 | } 63 | }; 64 | 65 | typedef std::list> MetaBaseList; 66 | typedef std::list> MetaDataList; 67 | typedef std::list> DevicePoseList; 68 | 69 | }; 70 | 71 | #endif //XCAM_META_DATA_H 72 | -------------------------------------------------------------------------------- /xcore/smart_analyzer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * smart_analyzer.h - smart analyzer 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | #ifndef XCAM_SMART_ANALYZER_H 21 | #define XCAM_SMART_ANALYZER_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class VideoBuffer; 31 | 32 | class SmartAnalyzer 33 | : public XAnalyzer 34 | { 35 | public: 36 | SmartAnalyzer (const char *name = "SmartAnalyzer"); 37 | ~SmartAnalyzer (); 38 | 39 | XCamReturn add_handler (SmartPtr handler); 40 | XCamReturn update_params (XCamSmartAnalysisParam ¶ms); 41 | void post_smart_results (X3aResultList &results, int64_t timestamp); 42 | 43 | protected: 44 | virtual XCamReturn create_handlers (); 45 | virtual XCamReturn release_handlers (); 46 | virtual XCamReturn internal_init (uint32_t width, uint32_t height, double framerate); 47 | virtual XCamReturn internal_deinit (); 48 | virtual XCamReturn configure (); 49 | virtual XCamReturn analyze (const SmartPtr &buffer); 50 | 51 | private: 52 | XCAM_DEAD_COPY (SmartAnalyzer); 53 | 54 | private: 55 | SmartHandlerList _handlers; 56 | X3aResultList _results; 57 | 58 | XCAM_OBJ_PROFILING_DEFINES; 59 | 60 | }; 61 | 62 | } 63 | 64 | #endif //XCAM_SMART_ANALYZER_H 65 | -------------------------------------------------------------------------------- /xcore/smart_analyzer_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * smart_analyzer_loader.h - smart analyzer loader 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Zong Wei 19 | */ 20 | 21 | #ifndef XCAM_SMART_ANALYZER_LOADER_H 22 | #define XCAM_SMART_ANALYZER_LOADER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace XCam { 31 | 32 | class SmartAnalyzer; 33 | class SmartAnalysisHandler; 34 | class SmartAnalyzerLoader; 35 | 36 | typedef std::list> AnalyzerLoaderList; 37 | 38 | class SmartAnalyzerLoader 39 | : public AnalyzerLoader 40 | { 41 | 42 | public: 43 | SmartAnalyzerLoader (const char *lib_path, const char *name = NULL, const char *symbol = XCAM_SMART_ANALYSIS_LIB_DESCRIPTION); 44 | virtual ~SmartAnalyzerLoader (); 45 | 46 | static SmartHandlerList load_smart_handlers (const char *dir_path); 47 | 48 | protected: 49 | static AnalyzerLoaderList create_analyzer_loader (const char *dir_path); 50 | SmartPtr load_smart_handler (SmartPtr &self); 51 | 52 | protected: 53 | virtual void *load_symbol (void* handle); 54 | 55 | private: 56 | XCAM_DEAD_COPY (SmartAnalyzerLoader); 57 | 58 | private: 59 | char *_name; 60 | }; 61 | 62 | }; 63 | #endif //XCAM_SMART_ANALYZER_LOADER_H 64 | -------------------------------------------------------------------------------- /xcore/stats_callback_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * stats_callback_interface.h - statistics callback interface 3 | * 4 | * Copyright (c) 2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_STATS_CALLBACK_H 22 | #define XCAM_STATS_CALLBACK_H 23 | 24 | #include 25 | #include 26 | 27 | 28 | namespace XCam { 29 | 30 | class X3aStats; 31 | class VideoBuffer; 32 | 33 | class StatsCallback { 34 | public: 35 | StatsCallback () {} 36 | virtual ~StatsCallback() {} 37 | virtual XCamReturn x3a_stats_ready (const SmartPtr &stats) { 38 | XCAM_UNUSED (stats); 39 | return XCAM_RETURN_NO_ERROR; 40 | } 41 | virtual XCamReturn dvs_stats_ready () { 42 | return XCAM_RETURN_NO_ERROR; 43 | } 44 | virtual XCamReturn scaled_image_ready (const SmartPtr &buffer) = 0; 45 | 46 | private: 47 | XCAM_DEAD_COPY (StatsCallback); 48 | }; 49 | 50 | } 51 | #endif //XCAM_STATS_CALLBACK_H 52 | -------------------------------------------------------------------------------- /xcore/uvc_device.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * uvc_device.cpp - uvc device 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Sameer Kibey 19 | */ 20 | 21 | #include "uvc_device.h" 22 | #include "v4l2_buffer_proxy.h" 23 | #include 24 | 25 | namespace XCam { 26 | 27 | UVCDevice::UVCDevice (const char *name) 28 | : V4l2Device (name) 29 | { 30 | } 31 | 32 | UVCDevice::~UVCDevice () 33 | { 34 | } 35 | 36 | XCamReturn 37 | UVCDevice::allocate_buffer ( 38 | SmartPtr &buf, 39 | const struct v4l2_format &format, 40 | const uint32_t index) 41 | { 42 | #if HAVE_LIBDRM 43 | if (!_drm_disp.ptr()) { 44 | _drm_disp = DrmDisplay::instance (); 45 | } 46 | 47 | if (get_mem_type () == V4L2_MEMORY_DMABUF && _drm_disp.ptr () != NULL) { 48 | buf = _drm_disp->create_drm_buf (format, index, get_capture_buf_type ()); 49 | if (!buf.ptr()) { 50 | XCAM_LOG_WARNING ("uvc device(%s) allocate buffer failed", XCAM_STR (get_device_name())); 51 | return XCAM_RETURN_ERROR_MEM; 52 | } 53 | return XCAM_RETURN_NO_ERROR; 54 | } 55 | #endif 56 | 57 | return V4l2Device::allocate_buffer (buf, format, index); 58 | } 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /xcore/uvc_device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * uvc_device.h - uvc device 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Sameer Kibey 19 | */ 20 | 21 | #ifndef XCAM_UVC_DEVICE_H 22 | #define XCAM_UVC_DEVICE_H 23 | 24 | #include 25 | #include 26 | #if HAVE_LIBDRM 27 | #include 28 | #endif 29 | 30 | namespace XCam { 31 | 32 | #if HAVE_LIBDRM 33 | class DrmDisplay; 34 | #endif 35 | 36 | class UVCDevice 37 | : public V4l2Device 38 | { 39 | friend class DrmV4l2Buffer; 40 | 41 | public: 42 | explicit UVCDevice (const char *name = NULL); 43 | ~UVCDevice (); 44 | 45 | #if HAVE_LIBDRM 46 | void set_drm_display(SmartPtr &drm_disp) { 47 | _drm_disp = drm_disp; 48 | }; 49 | #endif 50 | 51 | protected: 52 | virtual XCamReturn allocate_buffer ( 53 | SmartPtr &buf, 54 | const struct v4l2_format &format, 55 | const uint32_t index); 56 | 57 | private: 58 | XCAM_DEAD_COPY (UVCDevice); 59 | 60 | #if HAVE_LIBDRM 61 | private: 62 | SmartPtr _drm_disp; 63 | #endif 64 | }; 65 | 66 | }; 67 | 68 | #endif //XCAM_UVC_DEVICE_H 69 | -------------------------------------------------------------------------------- /xcore/x3a_analyzer_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x3a_analyzer_manager.h - analyzer manager 3 | * 4 | * Copyright (c) 2014-2015 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_3A_ANALYZER_MANAGER_H 22 | #define XCAM_3A_ANALYZER_MANAGER_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace XCam { 29 | 30 | class DynamicAnalyzerLoader; 31 | 32 | class X3aAnalyzerManager 33 | { 34 | protected: 35 | explicit X3aAnalyzerManager (); 36 | public: 37 | virtual ~X3aAnalyzerManager (); 38 | 39 | static SmartPtr instance(); 40 | 41 | virtual SmartPtr create_analyzer(); 42 | 43 | private: 44 | SmartPtr find_analyzer (); 45 | SmartPtr load_analyzer_from_binary (const char *path); 46 | 47 | private: 48 | XCAM_DEAD_COPY (X3aAnalyzerManager); 49 | 50 | private: 51 | static SmartPtr _instance; 52 | static Mutex _mutex; 53 | 54 | SmartPtr _loader; 55 | }; 56 | }; 57 | #endif //XCAM_3A_ANALYZER_MANAGER_H 58 | -------------------------------------------------------------------------------- /xcore/x3a_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x3a_event.h - event 3 | * 4 | * Copyright (c) 2014 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_3A_EVENT_H 22 | #define XCAM_3A_EVENT_H 23 | 24 | #include 25 | 26 | namespace XCam { 27 | 28 | class X3aEvent 29 | //:public ObjectLife 30 | { 31 | public: 32 | enum Type { 33 | TYPE_ISP_STATISTICS, 34 | TYPE_ISP_FRAME_SYNC, 35 | }; 36 | 37 | protected: 38 | explicit X3aEvent (X3aEvent::Type type, uint64_t timestamp) 39 | : _timestamp (timestamp) 40 | , _type (type) 41 | {} 42 | virtual ~X3aEvent() {} 43 | 44 | public: 45 | uint64_t get_timestamp () const { 46 | return _timestamp; 47 | } 48 | Type get_type () const { 49 | return _type; 50 | } 51 | 52 | private: 53 | XCAM_DEAD_COPY (X3aEvent); 54 | 55 | protected: 56 | uint64_t _timestamp; 57 | X3aEvent::Type _type; 58 | }; 59 | 60 | }; 61 | 62 | #endif //XCAM_3A_EVENT_H 63 | 64 | -------------------------------------------------------------------------------- /xcore/x3a_result.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * x3a_result.cpp - 3A calculation result 3 | * 4 | * Copyright (c) 2014 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #include "x3a_result.h" 22 | 23 | namespace XCam { 24 | 25 | void 26 | x3a_list_remove_result (X3aResultList &list, uint32_t type) 27 | { 28 | for (X3aResultList::iterator i = list.begin (); i != list.end ();) { 29 | SmartPtr &result = *i; 30 | XCAM_ASSERT (result.ptr ()); 31 | if (result->get_type () == type) { 32 | list.erase (i++); 33 | continue; 34 | } 35 | ++i; 36 | } 37 | } 38 | 39 | }; 40 | -------------------------------------------------------------------------------- /xcore/xcam_std.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcam_std.h - xcam std 3 | * 4 | * Copyright (c) 2014-2017 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_STD_H 22 | #define XCAM_STD_H 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | extern "C" { 31 | #include 32 | } 33 | #include 34 | #include 35 | #include 36 | 37 | namespace XCam { 38 | 39 | static const int64_t InvalidTimestamp = INT64_C(-1); 40 | 41 | enum NV12PlaneIdx { 42 | NV12PlaneYIdx = 0, 43 | NV12PlaneUVIdx, 44 | NV12PlaneMax 45 | }; 46 | 47 | enum YUV420PlaneIdx { 48 | YUV420PlaneYIdx = 0, 49 | YUV420PlaneUIdx, 50 | YUV420PlaneVIdx, 51 | YUV420PlaneMax 52 | }; 53 | 54 | }; 55 | 56 | #endif //XCAM_STD_H -------------------------------------------------------------------------------- /xcore/xcam_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcam_thread.h - Thread 3 | * 4 | * Copyright (c) 2014 Intel Corporation 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Wind Yuan 19 | */ 20 | 21 | #ifndef XCAM_THREAD_H 22 | #define XCAM_THREAD_H 23 | 24 | #include 25 | #include 26 | 27 | namespace XCam { 28 | 29 | class Thread { 30 | public: 31 | Thread (const char *name = NULL); 32 | virtual ~Thread (); 33 | 34 | bool start (); 35 | virtual bool emit_stop (); 36 | bool stop (); 37 | bool is_running (); 38 | const char *get_name () const { 39 | return _name; 40 | } 41 | 42 | protected: 43 | // return true to start loop, else the thread stopped 44 | virtual bool started (); 45 | virtual void stopped (); 46 | // return true to continue; false to stop 47 | virtual bool loop () = 0; 48 | private: 49 | XCAM_DEAD_COPY (Thread); 50 | 51 | 52 | private: 53 | static int thread_func (void *user_data); 54 | 55 | private: 56 | char *_name; 57 | pthread_t _thread_id; 58 | XCam::Mutex _mutex; 59 | XCam::Cond _exit_cond; 60 | bool _started; 61 | bool _stopped; 62 | }; 63 | 64 | }; 65 | 66 | #endif //XCAM_THREAD_H 67 | --------------------------------------------------------------------------------