1 /*
2  * Copyright (C) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef IMAGE_EFFECT_VPE_HELPER_H
17 #define IMAGE_EFFECT_VPE_HELPER_H
18 
19 #include "surface_buffer.h"
20 
21 namespace OHOS {
22 namespace Media {
23 namespace Effect {
24 class VpeHelper {
25 public:
26     ~VpeHelper();
27 
28     VpeHelper(const VpeHelper &) = delete;
29 
30     VpeHelper operator = (const VpeHelper &) = delete;
31 
32     static int32_t ColorSpaceConverterCreate(int32_t *instance);
33     static int32_t ColorSpaceConverterComposeImage(int32_t instance, sptr<SurfaceBuffer> &inputSdrImage,
34         sptr<SurfaceBuffer> &inputGainmap, sptr<SurfaceBuffer> &outputHdrImage, bool legacy);
35     static int32_t ColorSpaceConverterDecomposeImage(int32_t instance, sptr<SurfaceBuffer> &inputImage,
36         sptr<SurfaceBuffer> &outputSdrImage, sptr<SurfaceBuffer> &outputGainmap);
37     static int32_t ColorSpaceConverterProcessImage(int32_t instance, sptr<SurfaceBuffer> &inputImage,
38         sptr<SurfaceBuffer> &outputSdrImage);
39     static int32_t ColorSpaceConverterDestroy(int32_t *instance);
40 
41     static int32_t MetadataGeneratorCreate(int32_t *instance);
42     static int32_t MetadataGeneratorProcessImage(int32_t instance, sptr<SurfaceBuffer> &inputImage);
43     static int32_t MetadataGeneratorDestroy(int32_t *instance);
44 
45 private:
46     VpeHelper();
47     static VpeHelper &GetInstance();
48     void LoadVpeSo();
49     void UnloadVpeSo();
50 
51     class Impl;
52     std::shared_ptr<Impl> impl_;
53 
54     void *vpeHandle_ = nullptr;
55 };
56 } // namespace Effect
57 } // namespace Media
58 } // namespace OHOS
59 #endif // IMAGE_EFFECT_VPE_HELPER_H
60