xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/algos/aeis/scaler_service.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * scaler_service.h
3  *
4  *  Copyright (c) 2021 Rockchip Electronics Co., Ltd.
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: Cody Xie <cody.xie@rock-chips.com>
19  */
20 #ifndef ALGOS_AEIS_SCALER_SERVICE_H
21 #define ALGOS_AEIS_SCALER_SERVICE_H
22 
23 #include <memory>
24 #include <vector>
25 
26 #include "task_service.h"
27 
28 namespace XCam {
29 
30 class DmaVideoBuffer;
31 
32 }  // namespace XCam
33 
34 using namespace XCam;
35 
36 namespace RkCam {
37 
38 class ImageProcessor;
39 
40 struct scaler_param {
41     uint32_t frame_id;
42     std::shared_ptr<DmaVideoBuffer> input_image;
43     std::vector<std::shared_ptr<DmaVideoBuffer>> scaled_images;
44 };
45 
46 class ScalerTask final : public ServiceTask<scaler_param> {
47  public:
48     ScalerTask() = delete;
49     explicit ScalerTask(std::unique_ptr<ImageProcessor> proc);
50     ~ScalerTask()                 = default;
51     ScalerTask(const ScalerTask&) = delete;
52     const ScalerTask& operator=(const ScalerTask&) = delete;
53 
54     TaskResult operator()(ServiceParam<scaler_param>& p);
55 
56  private:
57     std::unique_ptr<ImageProcessor> proc_;
58 };
59 
60 using ScalerService = TaskService<scaler_param>;
61 
62 }  // namespace RkCam
63 
64 #endif  // ALGOS_AEIS_EIS_ALGO_H
65