1 /*
2  * Copyright (c) 2023 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 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 OHOS_HDI_CODEC_V2_0_CODECJPEGCORE_H
17 #define OHOS_HDI_CODEC_V2_0_CODECJPEGCORE_H
18 
19 #include "codec_jpeg_vdi.h"
20 #include "v2_0/icodec_image.h"
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace Codec {
25 namespace Image {
26 class CodecJpegCore {
27 public:
28     using GetCodecJpegHwi = ICodecJpegHwi*(*)();
29 
30     explicit CodecJpegCore() = default;
31 
32     ~CodecJpegCore();
33 
34     int32_t JpegInit();
35 
36     int32_t JpegDeInit();
37 
38     int32_t AllocateInBuffer(BufferHandle **buffer, uint32_t size);
39 
40     int32_t FreeInBuffer(BufferHandle *buffer);
41 
42     int32_t DoDecode(BufferHandle *buffer, BufferHandle *outBuffer, const V2_0::CodecJpegDecInfo *decInfo);
43 
44 private:
45     void AddVendorLib();
46 
47 private:
48     void *libHandle_ = nullptr;
49     GetCodecJpegHwi getCodecJpegHwi_ = nullptr;
50     ICodecJpegHwi *JpegHwi_ = nullptr;
51 };
52 } // Image
53 } // Codec
54 } // HDI
55 } // OHOS
56 
57 #endif // OHOS_HDI_CODEC_V2_0_CODECJPEGCORE_H
58