• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IMAGE_NATIVE_H
17 #define DETAIL_ENHANCER_IMAGE_NATIVE_H
18 
19 #include <atomic>
20 #include <functional>
21 #include <mutex>
22 
23 #include "image_processing_native_template.h"
24 #include "image_processing_types.h"
25 #include "pixelmap_native_impl.h"
26 
27 #include "detail_enhancer_image.h"
28 
29 namespace OHOS {
30 namespace Media {
31 namespace VideoProcessingEngine {
32 
33 class DetailEnhancerImageNative : public ImageProcessingNativeTemplate<DetailEnhancerImageNative> {
34 public:
35     DEFINE_WITH_DISALLOW_COPY_AND_MOVE(DetailEnhancerImageNative);
36 
37     ImageProcessing_ErrorCode InitializeInner() override;
38     ImageProcessing_ErrorCode DeinitializeInner() override;
39     ImageProcessing_ErrorCode SetParameter(const OHOS::Media::Format& parameter) override;
40     ImageProcessing_ErrorCode GetParameter(OHOS::Media::Format& parameter) override;
41     ImageProcessing_ErrorCode Process(const std::shared_ptr<OHOS::Media::PixelMap>& sourceImage,
42         std::shared_ptr<OHOS::Media::PixelMap>& destinationImage) override;
43 
44 private:
45     ImageProcessing_ErrorCode CheckParameter();
46     int LevelTransfer(int level, const std::unordered_map<int, int> levelMap) const;
47 
48     mutable std::mutex lock_{};
49     // Guarded by lock_ begin
50     std::atomic<bool> isInitialized_{false};
51     std::shared_ptr<DetailEnhancerImage> detailEnhancer_{};
52     // Guarded by lock_ end
53 };
54 } // namespace VideoProcessingEngine
55 } // namespace Media
56 } // namespace OHOS
57 
58 #endif // DETAIL_ENHANCER_IMAGE_NATIVE_H