• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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_COLORSPACE_PROCESSPR_H
17 #define IMAGE_EFFECT_COLORSPACE_PROCESSPR_H
18 
19 #include <securec.h>
20 #include "surface_buffer.h"
21 #include "error_code.h"
22 #include "effect_buffer.h"
23 #include "effect_memory.h"
24 #include "image_effect_marco_define.h"
25 
26 namespace OHOS {
27 namespace Media {
28 namespace VideoProcessingEngine {
29 class ColorSpaceConverter;
30 }
31 namespace Effect {
32 using namespace OHOS::Media::VideoProcessingEngine;
33 class ColorSpaceProcessor {
34 public:
35     IMAGE_EFFECT_EXPORT ColorSpaceProcessor();
36     IMAGE_EFFECT_EXPORT ~ColorSpaceProcessor();
37 
38     IMAGE_EFFECT_EXPORT
39     ErrorCode ComposeHdrImage(const EffectBuffer *inputSdr, const SurfaceBuffer *inputGainmap, EffectBuffer *outputHdr);
40 
41     IMAGE_EFFECT_EXPORT
42     ErrorCode DecomposeHdrImage(const EffectBuffer *inputHdr, std::shared_ptr<EffectBuffer> &outputSdr,
43         SurfaceBuffer **outputGainmap);
44 
45     IMAGE_EFFECT_EXPORT
46     ErrorCode ProcessHdrImage(const EffectBuffer *inputHdr, std::shared_ptr<EffectBuffer> &outputSdr);
47     IMAGE_EFFECT_EXPORT std::shared_ptr<MemoryData> GetMemoryData(SurfaceBuffer *sb);
48 
49     IMAGE_EFFECT_EXPORT static ErrorCode ApplyColorSpace(EffectBuffer *effectBuffer, EffectColorSpace targetColorSpace);
50 
51 private:
52     std::shared_ptr<ColorSpaceConverter> converter = nullptr;
53     std::vector<std::shared_ptr<MemoryData>> memoryDataArray_;
54 };
55 } // namespace Effect
56 } // namespace Media
57 } // namespace OHOS
58 #endif // IMAGE_EFFECT_COLORSPACE_PROCESSPR_H