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 DETAIL_ENHANCER_H
17 #define DETAIL_ENHANCER_H
18 
19 #include "refbase.h"
20 #include "surface_buffer.h"
21 
22 #include "algorithm_types.h"
23 
24 namespace OHOS {
25 namespace Media {
26 namespace VideoProcessingEngine {
27 class DetailEnhancer {
28 public:
29     enum Level {
30         LEVEL_NONE = 0,
31         LEVEL_LOW,
32         LEVEL_MEDIUM,
33         LEVEL_HIGH,
34     };
35 
36     DetailEnhancer() = default;
37     virtual ~DetailEnhancer() = default;
38     DetailEnhancer(const DetailEnhancer&) = delete;
39     DetailEnhancer& operator=(const DetailEnhancer&) = delete;
40     DetailEnhancer(DetailEnhancer&&) = delete;
41     DetailEnhancer& operator=(DetailEnhancer&&) = delete;
42 
43     AlgoErrorCode Initialize();
44     AlgoErrorCode Deinitialize();
45     AlgoErrorCode SetParameter(const Level& level);
46     AlgoErrorCode GetParameter(Level& level);
47     AlgoErrorCode Process(const sptr<SurfaceBuffer>& sourceImage, sptr<SurfaceBuffer>& destinationImage);
48 
49 private:
50     mutable std::mutex lock_{};
51     // Guarded by lock_ begin
52     bool isInitialized_{false};
53     Level level_{LEVEL_LOW};
54     // Guarded by lock_ end
55 };
56 } // namespace VideoProcessingEngine
57 } // namespace Media
58 } // namespace OHOS
59 
60 #endif // DETAIL_ENHANCER_H
61