1f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu/* 2f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * cl_wire_frame_handler.h - CL wire frame handler 3f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * 4f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * Copyright (c) 2016 Intel Corporation 5f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * 6f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * Licensed under the Apache License, Version 2.0 (the "License"); 7f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * you may not use this file except in compliance with the License. 8f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * You may obtain a copy of the License at 9f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * 10f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * http://www.apache.org/licenses/LICENSE-2.0 11f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * 12f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * Unless required by applicable law or agreed to in writing, software 13f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * distributed under the License is distributed on an "AS IS" BASIS, 14f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * See the License for the specific language governing permissions and 16f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * limitations under the License. 17f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * 18f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu * Author: Yinhang Liu <yinhangx.liu@intel.com> 19f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu */ 20f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 21f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu#ifndef XCAM_CL_WIRE_FRAME_H 22f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu#define XCAM_CL_WIRE_FRAME_H 23f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 247110f89ce125e8d4dedcd585fea7b44636403400Yinhang Liu#include "ocl/cl_image_handler.h" 25f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 26f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu#define XCAM_WIRE_FRAME_MAX_COUNT 160 27f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 28f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liunamespace XCam { 29f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 30f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liutypedef struct _CLWireFrame { 31f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t pos_x; 32f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t pos_y; 33f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t width; 34f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t height; 35f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu} CLWireFrame; 36f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 37be505049e0d0cd218324c728b840652ac54bd19fWind Yuanclass CLWireFrameImageHandler; 38be505049e0d0cd218324c728b840652ac54bd19fWind Yuan 39f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuclass CLWireFrameImageKernel 40f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu : public CLImageKernel 41f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu{ 42f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liupublic: 43be505049e0d0cd218324c728b840652ac54bd19fWind Yuan explicit CLWireFrameImageKernel ( 44be505049e0d0cd218324c728b840652ac54bd19fWind Yuan const SmartPtr<CLContext> &context, 45be505049e0d0cd218324c728b840652ac54bd19fWind Yuan const SmartPtr<CLWireFrameImageHandler> &handler, 46be505049e0d0cd218324c728b840652ac54bd19fWind Yuan const char *name); 47be505049e0d0cd218324c728b840652ac54bd19fWind Yuan ~CLWireFrameImageKernel (); 48f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 49f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprotected: 50f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu virtual XCamReturn prepare_arguments ( 51be505049e0d0cd218324c728b840652ac54bd19fWind Yuan CLArgList &args, CLWorkSize &work_size); 52f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 53f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprivate: 54be505049e0d0cd218324c728b840652ac54bd19fWind Yuan SmartPtr<CLWireFrameImageHandler> _handler; 55f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t _wire_frames_coords_num; 56f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t *_wire_frames_coords; 57f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu}; 58f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 59f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuclass CLWireFrameImageHandler 60f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu : public CLImageHandler 61f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu{ 62f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liupublic: 63be505049e0d0cd218324c728b840652ac54bd19fWind Yuan explicit CLWireFrameImageHandler (const SmartPtr<CLContext> &context, const char *name); 64f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool set_wire_frame_kernel (SmartPtr<CLWireFrameImageKernel> &kernel); 65f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool set_wire_frame_config (const XCamFDResult *config, double scaler_factor = 1.0); 66f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 67be505049e0d0cd218324c728b840652ac54bd19fWind Yuan bool check_wire_frames_validity (uint32_t image_width, uint32_t image_height); 68be505049e0d0cd218324c728b840652ac54bd19fWind Yuan uint32_t get_border_coordinates_num (); 69be505049e0d0cd218324c728b840652ac54bd19fWind Yuan bool get_border_coordinates (uint32_t *coords); 70be505049e0d0cd218324c728b840652ac54bd19fWind Yuan 71f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprotected: 726b5f71042b969ae41362e07660181a676685702bYinhang Liu virtual XCamReturn prepare_output_buf (SmartPtr<VideoBuffer> &input, SmartPtr<VideoBuffer> &output); 73f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 74f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprivate: 75f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu XCAM_DEAD_COPY (CLWireFrameImageHandler); 76f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu SmartPtr<CLWireFrameImageKernel> _wire_frame_kernel; 77be505049e0d0cd218324c728b840652ac54bd19fWind Yuan 78be505049e0d0cd218324c728b840652ac54bd19fWind Yuan uint32_t _wire_frames_num; 79be505049e0d0cd218324c728b840652ac54bd19fWind Yuan CLWireFrame _wire_frames [XCAM_WIRE_FRAME_MAX_COUNT]; 80f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu}; 81f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 82f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang LiuSmartPtr<CLImageHandler> 83be505049e0d0cd218324c728b840652ac54bd19fWind Yuancreate_cl_wire_frame_image_handler (const SmartPtr<CLContext> &context); 84f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 85f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu}; 86f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 87f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu#endif // XCAM_CL_WIRE_FRAME_H 88