• 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 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_IMAGE_V2_1_COMMAND_PARSER
17 #define OHOS_HDI_CODEC_IMAGE_V2_1_COMMAND_PARSER
18 
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS::VDI::HEIF {
23 enum ImageMirror {
24     HORIZONTAL,
25     VERTICAL,
26     NONE
27 };
28 
29 enum class ImageRotation {
30     ANTI_CLOCKWISE_90,
31     ANTI_CLOCKWISE_180,
32     ANTI_CLOCKWISE_270,
33     NONE
34 };
35 
36 enum class SampleSize {
37     SAMPLE_SIZE_1 = 1,
38     SAMPLE_SIZE_2 = 2,
39     SAMPLE_SIZE_4 = 4,
40     SAMPLE_SIZE_8 = 8,
41     SAMPLE_SIZE_16 = 16,
42 };
43 
44 enum class UserPixelFormat {
45     NV12 = 0,
46     NV21,
47     NV12_10BIT,
48     NV21_10BIT,
49     RGBA8888,
50     BGRA8888,
51     RGB565,
52     RGBA1010102,
53     NONE
54 };
55 
56 enum class ColorSpace {
57     BT_601_P,
58     BT_601_N,
59     P3,
60     BT_709,
61     BT_2020
62 };
63 
64 struct CommandOpt {
65     // common
66     bool isGetHelpInfoOnly = false;
67     bool isEncoder = true;
68     // for encoder
69     std::string primaryImgPath = "";
70     std::string auxiliaryImgPath = "";
71     std::string thumbnailImgPath = "";
72     std::string gainMapPath = "";
73     std::string exifDataPath = "";
74     std::string userDataPath = "";
75     std::string iccProfilePath = "";
76     std::string it35Path = "";
77     std::string outputPath = "/storage/media/100/local/files/heif_edit_dump";
78     ImageMirror mirrorInfo = ImageMirror::NONE;
79     ImageRotation rotateInfo = ImageRotation::NONE;
80     // for decoder
81     std::string inputPath = "";
82     SampleSize sampleSize = SampleSize::SAMPLE_SIZE_1;
83     UserPixelFormat pixelFmt = UserPixelFormat::NV12;
84     bool isLimitedRange = true;
85     ColorSpace colorSpace = ColorSpace::BT_601_P;
86 
87     void Print() const;
88     void PrintEncoderParam() const;
89     void PrintDecoderParam() const;
90 };
91 
92 CommandOpt Parse(int argc, char *argv[]);
93 void ShowUsage();
94 } // OHOS::VDI::HEIF
95 #endif // OHOS_HDI_CODEC_IMAGE_V2_1_COMMAND_PARSER