1 /*
2  * soft_geo_mapper.h - soft geometry map 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_GEO_MAP_H
22 #define XCAM_SOFT_GEO_MAP_H
23 
24 #include <xcam_std.h>
25 #include <interface/geo_mapper.h>
26 #include <soft/soft_handler.h>
27 #include <soft/soft_image.h>
28 
29 namespace XCam {
30 
31 namespace XCamSoftTasks {
32 class GeoMapTask;
33 };
34 
35 class SoftGeoMapper
36     : public SoftHandler, public GeoMapper
37 {
38 public:
39     SoftGeoMapper (const char *name = "SoftGeoMap");
40     ~SoftGeoMapper ();
41 
42     bool set_lookup_table (const PointFloat2 *data, uint32_t width, uint32_t height);
43 
44     //derived from SoftHandler
45     virtual XCamReturn terminate ();
46 
47     void remap_task_done (
48         const SmartPtr<Worker> &worker, const SmartPtr<Worker::Arguments> &args, const XCamReturn error);
49 
50 protected:
51     //derived from interface
52     XCamReturn remap (
53         const SmartPtr<VideoBuffer> &in,
54         SmartPtr<VideoBuffer> &out_buf);
55 
56     //derived from SoftHandler
57     XCamReturn configure_resource (const SmartPtr<Parameters> &param);
58     XCamReturn start_work (const SmartPtr<Parameters> &param);
59 
60 private:
61     XCamReturn start_remap_task (const SmartPtr<ImageHandler::Parameters> &param);
62 
63 private:
64     SmartPtr<XCamSoftTasks::GeoMapTask>   _map_task;
65     SmartPtr<Float2Image>                 _lookup_table;
66 };
67 
68 extern SmartPtr<SoftHandler> create_soft_geo_mapper ();
69 }
70 
71 #endif //XCAM_SOFT_GEO_MAP_H
72