• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * geo_mapper.h - geometry mapper interface
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_INTERFACE_GEO_MAPPER_H
22 #define XCAM_INTERFACE_GEO_MAPPER_H
23 
24 #include <xcam_std.h>
25 #include <video_buffer.h>
26 #include <interface/data_types.h>
27 
28 namespace XCam {
29 
30 class GeoMapper
31 {
32 public:
33     GeoMapper ();
34     virtual ~GeoMapper ();
35     static SmartPtr<GeoMapper> create_ocl_geo_mapper ();
36     static SmartPtr<GeoMapper> create_soft_geo_mapper ();
37 
38     //2D table
39     virtual bool set_lookup_table (const PointFloat2 *data, uint32_t width, uint32_t height) = 0;
40     bool set_factors (float x, float y);
get_factors(float & x,float & y)41     void get_factors (float &x, float &y) const {
42         x = _factor_x;
43         y = _factor_y;
44     }
45     bool set_output_size (uint32_t width, uint32_t height);
get_output_size(uint32_t & width,uint32_t & height)46     void get_output_size (uint32_t &width, uint32_t &height) const {
47         width = _out_width;
48         height = _out_height;
49     }
50 
51     virtual XCamReturn remap (
52         const SmartPtr<VideoBuffer> &in,
53         SmartPtr<VideoBuffer> &out_buf) = 0;
54 
55 protected:
56     bool auto_calculate_factors (uint32_t lut_w, uint32_t lut_h);
57 
58 private:
59     uint32_t     _out_width, _out_height;
60     float        _factor_x, _factor_y;
61 };
62 
63 }
64 #endif //XCAM_INTERFACE_GEO_MAPPER_H
65