cl_wire_frame_handler.h revision f9f030ff5f2a829ff611752f57ebf639bd8077f7
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 24f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu#include "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 37f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuclass CLWireFrameImageKernel 38f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu : public CLImageKernel 39f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu{ 40f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liupublic: 41f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu explicit CLWireFrameImageKernel (SmartPtr<CLContext> &context, const char *name); 42f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool set_wire_frame_config (const XCamFDResult *config, double scaler_factor); 43f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 44f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprotected: 45f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu virtual XCamReturn prepare_arguments ( 46f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu SmartPtr<DrmBoBuffer> &input, SmartPtr<DrmBoBuffer> &output, 47f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu CLArgument args[], uint32_t &arg_count, 48f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu CLWorkSize &work_size); 49f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu virtual XCamReturn post_execute (SmartPtr<DrmBoBuffer> &output); 50f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 51f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprivate: 52f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool check_wire_frames_validity (uint32_t image_width, uint32_t image_height); 53f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t get_border_coordinates_num (); 54f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool get_border_coordinates (uint32_t *coords); 55f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu XCAM_DEAD_COPY (CLWireFrameImageKernel); 56f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 57f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprivate: 58f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t _wire_frames_num; 59f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t _wire_frames_coords_num; 60f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu uint32_t *_wire_frames_coords; 61f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu CLWireFrame _wire_frames [XCAM_WIRE_FRAME_MAX_COUNT]; 62f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu SmartPtr<CLImage> _image_out_uv; 63f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu SmartPtr<CLBuffer> _wire_frames_coords_buf; 64f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu}; 65f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 66f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuclass CLWireFrameImageHandler 67f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu : public CLImageHandler 68f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu{ 69f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liupublic: 70f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu explicit CLWireFrameImageHandler (const char *name); 71f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool set_wire_frame_kernel (SmartPtr<CLWireFrameImageKernel> &kernel); 72f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu bool set_wire_frame_config (const XCamFDResult *config, double scaler_factor = 1.0); 73f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 74f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprotected: 75f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu virtual XCamReturn prepare_output_buf (SmartPtr<DrmBoBuffer> &input, SmartPtr<DrmBoBuffer> &output); 76f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 77f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liuprivate: 78f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu XCAM_DEAD_COPY (CLWireFrameImageHandler); 79f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu SmartPtr<CLWireFrameImageKernel> _wire_frame_kernel; 80f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu}; 81f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 82f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang LiuSmartPtr<CLImageHandler> 83f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liucreate_cl_wire_frame_image_handler (SmartPtr<CLContext> &context); 84f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 85f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu}; 86f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu 87f9f030ff5f2a829ff611752f57ebf639bd8077f7Yinhang Liu#endif // XCAM_CL_WIRE_FRAME_H 88