• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * soft_stitcher.h - soft stitcher 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_STITCHER_H
22 #define XCAM_SOFT_STITCHER_H
23 
24 #include <xcam_std.h>
25 #include <interface/stitcher.h>
26 #include <soft/soft_handler.h>
27 
28 namespace XCam {
29 
30 namespace SoftSitcherPriv {
31 class StitcherImpl;
32 class CbGeoMap;
33 class CbBlender;
34 class CbCopyTask;
35 };
36 
37 class SoftStitcher
38     : public SoftHandler
39     , public Stitcher
40 {
41     friend class SoftSitcherPriv::StitcherImpl;
42     friend class SoftSitcherPriv::CbGeoMap;
43     friend class SoftSitcherPriv::CbBlender;
44     friend class SoftSitcherPriv::CbCopyTask;
45 
46 public:
47     struct StitcherParam
48         : ImageHandler::Parameters
49     {
50         uint32_t in_buf_num;
51         SmartPtr<VideoBuffer> in_bufs[XCAM_STITCH_MAX_CAMERAS];
52 
StitcherParamStitcherParam53         StitcherParam ()
54             : Parameters (NULL, NULL)
55             , in_buf_num (0)
56         {}
57     };
58 
59 public:
60     explicit SoftStitcher (const char *name = "SoftStitcher");
61     ~SoftStitcher ();
62 
63     //derived from SoftHandler
64     virtual XCamReturn terminate ();
65 
66 protected:
67     // interface derive from Stitcher
68     XCamReturn stitch_buffers (const VideoBufferList &in_bufs, SmartPtr<VideoBuffer> &out_buf);
69 
70     //derived from SoftHandler
71     XCamReturn configure_resource (const SmartPtr<Parameters> &param);
72     XCamReturn start_work (const SmartPtr<Parameters> &param);
73 
74 private:
75     // handler done, call back functions
76     XCamReturn start_task_count (
77         const SmartPtr<SoftStitcher::StitcherParam> &param);
78     void dewarp_done (
79         const SmartPtr<ImageHandler> &handler,
80         const SmartPtr<ImageHandler::Parameters> &param, const XCamReturn error);
81     void blender_done (
82         const SmartPtr<ImageHandler> &handler,
83         const SmartPtr<ImageHandler::Parameters> &param, const XCamReturn error);
84     void copy_task_done (
85         const SmartPtr<Worker> &worker,
86         const SmartPtr<Worker::Arguments> &base, const XCamReturn error);
87 
88 private:
89     SmartPtr<SoftSitcherPriv::StitcherImpl> _impl;
90 };
91 
92 }
93 
94 #endif //XCAM_SOFT_STITCHER_H
95