1 /* 2 * soft_blender.h - soft blender 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 <feng.yuan@intel.com> 19 */ 20 21 #ifndef XCAM_SOFT_BLENDER_H 22 #define XCAM_SOFT_BLENDER_H 23 24 #include <xcam_std.h> 25 #include <interface/blender.h> 26 #include <soft/soft_handler.h> 27 28 #define XCAM_SOFT_PYRAMID_MAX_LEVEL 4 29 #define XCAM_SOFT_PYRAMID_DEFAULT_LEVEL 3 30 31 namespace XCam { 32 33 namespace SoftBlenderPriv { 34 class BlenderPrivConfig; 35 }; 36 37 class SoftBlender 38 : public SoftHandler, public Blender 39 { 40 friend class SoftBlenderPriv::BlenderPrivConfig; 41 friend SmartPtr<SoftHandler> create_soft_blender (); 42 public: 43 struct BlenderParam : ImageHandler::Parameters { 44 SmartPtr<VideoBuffer> in1_buf; 45 BlenderParamBlenderParam46 BlenderParam ( 47 const SmartPtr<VideoBuffer> &in0, 48 const SmartPtr<VideoBuffer> &in1, 49 const SmartPtr<VideoBuffer> &out) 50 : Parameters (in0, out) 51 , in1_buf (in1) 52 {} 53 }; 54 55 enum BufIdx { 56 Idx0 = 0, 57 Idx1, 58 BufIdxCount, 59 }; 60 61 public: 62 ~SoftBlender (); 63 64 bool set_pyr_levels (uint32_t num); 65 66 //derived from SoftHandler 67 virtual XCamReturn terminate (); 68 69 void gauss_scale_done ( 70 const SmartPtr<Worker> &worker, const SmartPtr<Worker::Arguments> &args, const XCamReturn error); 71 void lap_done ( 72 const SmartPtr<Worker> &worker, const SmartPtr<Worker::Arguments> &args, const XCamReturn error); 73 void blend_task_done ( 74 const SmartPtr<Worker> &worker, const SmartPtr<Worker::Arguments> &args, const XCamReturn error); 75 void reconstruct_done ( 76 const SmartPtr<Worker> &worker, const SmartPtr<Worker::Arguments> &args, const XCamReturn error); 77 78 protected: 79 explicit SoftBlender (const char *name = "SoftBlender"); 80 81 //derived from Blender interface 82 XCamReturn blend ( 83 const SmartPtr<VideoBuffer> &in0, 84 const SmartPtr<VideoBuffer> &in1, 85 SmartPtr<VideoBuffer> &out_buf); 86 87 //derived from SoftHandler 88 XCamReturn configure_resource (const SmartPtr<Parameters> ¶m); 89 XCamReturn start_work (const SmartPtr<Parameters> ¶m); 90 91 private: 92 SmartPtr<SoftBlenderPriv::BlenderPrivConfig> _priv_config; 93 }; 94 95 extern SmartPtr<SoftHandler> create_soft_blender (); 96 } 97 98 #endif //XCAM_SOFT_BLENDER_H 99