Home | History | Annotate | Download | only in ocl
      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: Wind Yuan <feng.yuan (at) intel.com>
     19  */
     20 
     21 #ifndef XCAM_CL_3A_IMAGE_PROCESSOR_H
     22 #define XCAM_CL_3A_IMAGE_PROCESSOR_H
     23 
     24 #include <xcam_std.h>
     25 #include <base/xcam_3a_types.h>
     26 #include <ocl/cl_image_processor.h>
     27 #include <stats_callback_interface.h>
     28 
     29 namespace XCam {
     30 
     31 class CLCscImageHandler;
     32 class CLEeImageHandler;
     33 class CLBayerBasicImageHandler;
     34 class CLBayerPipeImageHandler;
     35 class CLYuvPipeImageHandler;
     36 class CLTonemappingImageHandler;
     37 class CLNewTonemappingImageHandler;
     38 
     39 #define ENABLE_YEENR_HANDLER 0
     40 
     41 class CL3aImageProcessor
     42     : public CLImageProcessor
     43 {
     44 public:
     45     enum OutSampleType {
     46         OutSampleYuv,
     47         OutSampleRGB,
     48         OutSampleBayer,
     49     };
     50 
     51     enum PipelineProfile {
     52         BasicPipelineProfile    = 0,
     53         AdvancedPipelineProfile,
     54         ExtremePipelineProfile,
     55     };
     56 
     57     enum CaptureStage {
     58         BasicbayerStage,
     59         TonemappingStage,
     60     };
     61 
     62     enum CLTonemappingMode {
     63         WDRdisabled  = 0,
     64         Gaussian,
     65         Haleq,
     66     };
     67 
     68 public:
     69     explicit CL3aImageProcessor ();
     70     virtual ~CL3aImageProcessor ();
     71 
     72     bool set_profile (PipelineProfile value);
     73     void set_stats_callback (const SmartPtr<StatsCallback> &callback);
     74 
     75     bool set_output_format (uint32_t fourcc);
     76     bool set_capture_stage (CaptureStage capture_stage);
     77     bool set_3a_stats_bits (uint32_t bits);
     78 
     79     virtual bool set_denoise (uint32_t mode);
     80     virtual bool set_gamma (bool enable);
     81     virtual bool set_macc (bool enable);
     82     virtual bool set_tnr (uint32_t mode, uint8_t level);
     83     virtual bool set_tonemapping (CLTonemappingMode wdr_mode);
     84 
     85     PipelineProfile get_profile () const {
     86         return _pipeline_profile;
     87     }
     88 
     89 protected:
     90 
     91     //derive from ImageProcessor
     92     virtual bool can_process_result (SmartPtr<X3aResult> &result);
     93     virtual XCamReturn apply_3a_results (X3aResultList &results);
     94     virtual XCamReturn apply_3a_result (SmartPtr<X3aResult> &result);
     95 
     96 private:
     97     virtual XCamReturn create_handlers ();
     98 
     99     bool post_config ();
    100     XCAM_DEAD_COPY (CL3aImageProcessor);
    101 
    102 private:
    103     uint32_t                            _output_fourcc;
    104     uint32_t                            _3a_stats_bits;
    105     PipelineProfile                     _pipeline_profile;
    106     CaptureStage                        _capture_stage;
    107     CLTonemappingMode                   _wdr_mode;
    108     SmartPtr<StatsCallback>             _stats_callback;
    109     SmartPtr<CLCscImageHandler>         _csc;
    110     SmartPtr<CLTonemappingImageHandler> _tonemapping;
    111     SmartPtr<CLNewTonemappingImageHandler> _newtonemapping;
    112 #if ENABLE_YEENR_HANDLER
    113     SmartPtr<CLEeImageHandler>          _ee;
    114 #endif
    115 
    116     // simple 3a bayer pipeline
    117     SmartPtr<CLBayerBasicImageHandler>  _bayer_basic_pipe;
    118     SmartPtr<CLBayerPipeImageHandler>   _bayer_pipe;
    119     SmartPtr<CLYuvPipeImageHandler>     _yuv_pipe;
    120 
    121     uint32_t                            _tnr_mode;
    122     bool                                _enable_gamma;
    123     bool                                _enable_macc;
    124     uint32_t                            _snr_mode; // spatial nr mode
    125 };
    126 
    127 };
    128 #endif //XCAM_CL_3A_IMAGE_PROCESSOR_H
    129