1 /******************************************************************************
2  *
3  * Copyright (C) 2018 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /**
22 *******************************************************************************
23 * @file
24 *  app.h
25 *
26 * @brief
27 *  This file contains all the necessary structure and enumeration definitions
28 *  needed for the Application
29 *
30 * @author
31 *  ittiam
32 *
33 * @remarks
34 *  none
35 *
36 *******************************************************************************
37 */
38 
39 #ifndef _APP_H_
40 #define _APP_H_
41 
42 /*****************************************************************************/
43 /* Function Macros                                                           */
44 /*****************************************************************************/
45 #define MAX(a, b) ((a) > (b)) ? (a) : (b)
46 #define MIN(a, b) ((a) < (b)) ? (a) : (b)
47 
48 #define STR_LEN 512
49 
50 /*****************************************************************************/
51 /* Enums                                                                     */
52 /*****************************************************************************/
53 typedef enum
54 {
55     INVALID,
56     HELP,
57     VERSION,
58     INPUT_YUV,
59     OUTPUT,
60     STAT_FILE,
61     STAT_FILE_BLK,
62     SAVE_RECON,
63     RECON_YUV,
64     NUM_FRAMES_TO_ENCODE,
65     START_FRM_OFFSET,
66     LOG_DUMP_LEVEL,
67     PERF_MODE,
68     ENABLE_CSV_DUMP,
69     CSV_FILE_PATH,
70     ENABLE_LOOPBACK,
71     ENABLE_LOGO,
72     RES_CHNG_INTRVL,
73     SRC_WIDTH,
74     SRC_HEIGHT,
75     SRC_FRAME_RATE_NUM,
76     SRC_FRAME_RATE_DENOM,
77     SRC_INTERLACED,
78     INPUT_CHROMA_FORMAT,
79     INPUT_BIT_DEPTH,
80     TOPFIELD_FIRST,
81     NUM_RESOLUTIONS,
82     MRES_SINGLE_OUT,
83     START_RES_ID,
84     MBR_QUALITY_SETTING,
85     TGT_WIDTH,
86     TGT_HEIGHT,
87     CODEC_LEVEL,
88     NUM_BITRATES,
89     TGT_BITRATE,
90     FRAME_QP,
91     OUTPUT_BIT_DEPTH,
92     ENABLE_TEMPORAL_SCALABILITY,
93     MAX_CLOSED_GOP_PERIOD,
94     MIN_CLOSED_GOP_PERIOD,
95     MAX_CRA_OPEN_GOP_PERIOD,
96     MAX_I_OPEN_GOP_PERIOD,
97     MAX_TEMPORAL_LAYERS,
98     QUALITY_PRESET,
99     DEBLOCKING_TYPE,
100     USE_DEFAULT_SC_MTX,
101     ENABLE_ENTROPY_SYNC,
102     MAX_TR_TREE_DEPTH_I,
103     MAX_TR_TREE_DEPTH_NI,
104     MAX_SEARCH_RANGE_HORZ,
105     MAX_SEARCH_RANGE_VERT,
106     VISUAL_QUALITY_ENHANCEMENTS_TOGGLER,
107     ARCH_TYPE,
108     NUM_CORES,
109     ENABLE_THREAD_AFFINITY,
110     RATE_CONTROL_MODE,
111     CU_LEVEL_RC,
112     PASS,
113     MAX_VBV_BUFFER_SIZE,
114     PEAK_BITRATE,
115     RATE_FACTOR,
116     VBR_MAX_PEAK_RATE_DUR,
117     MAX_FRAME_QP,
118     MIN_FRAME_QP,
119     ENABLE_LOOK_AHEAD,
120     RC_LOOK_AHEAD_PICS,
121     ENABLE_WEIGHTED_PREDICTION,
122     CODEC_TYPE,
123     CODEC_PROFILE,
124     CODEC_TIER,
125     AUD_ENABLE_FLAGS,
126     INTEROP_FLAGS,
127     SPS_AT_CDR_ENABLE,
128     SEI_VUI_INFO_CFG,
129     VUI_ENABLE,
130     SEI_ENABLE_FLAGS,
131     SEI_PAYLOAD_ENABLE_FLAGS,
132     SEI_PAYLOAD_PATH,
133     FORCE_IDR_LOCS_ENABLE,
134     FORCE_IDR_LOCS_FILENAME,
135     SEI_BUFFER_PERIOD_FLAGS,
136     SEI_PIC_TIMING_FLAGS,
137     SEI_RECOVERY_POINT_FLAGS,
138     SEI_HASH_FLAGS,
139     SEI_MASTERING_DISP_COLOUR_VOL_FLAGS,
140     DISPLAY_PRIMARIES_X,
141     DISPLAY_PRIMARIES_Y,
142     WHITE_POINT_X,
143     WHITE_POINT_Y,
144     MAX_DISPLAY_MASTERING_LUMINANCE,
145     MIN_DISPLAY_MASTERING_LUMINANCE,
146     SEI_CLL_INFO_ENABLE,
147     SEI_MAX_CLL,
148     SEI_AVG_CLL,
149     TILES_ENABLED_FLAG,
150     UNIFORM_SPACING_FLAG,
151     NUM_TILE_COLS,
152     NUM_TILE_ROWS,
153     COLUMN_WIDTH_ARRAY,
154     ROW_HEIGHT_ARRAY,
155     SLICE_SEGMENT_MODE,
156     SLICE_SEGMENT_ARGUMENT,
157     ASPECT_RATIO_INFO_PRESENT_FLAG,
158     ASPECT_RATIO_IDC,
159     SAR_WIDTH,
160     SAR_HEIGHT,
161     OVERSCAN_INFO_PRESENT_FLAG,
162     OVERSCAN_APPROPRIATE_FLAG,
163     VIDEO_SIGNAL_TYPE_PRESENT_FLAG,
164     VIDEO_FORMAT,
165     VIDEO_FULL_RANGE_FLAG,
166     COLOUR_DESCRIPTION_PRESENT_FLAG,
167     COLOUR_PRIMARIES,
168     TRANSFER_CHARACTERISTICS,
169     MATRIX_COEFFICIENTS,
170     CHROMA_LOC_INFO_PRESENT_FLAG,
171     CHROMA_SAMPLE_LOC_TYPE_TOP_FIELD,
172     CHROMA_SAMPLE_LOC_TYPE_BOTTOM_FIELD,
173     TIMING_INFO_PRESENT_FLAG,
174     VUI_HRD_PARAMETERS_PRESENT_FLAG,
175     NAL_HRD_PARAMETERS_PRESENT_FLAG,
176     CONFIG,
177     GRPINFO
178 } ARGUMENT_T;
179 
180 /*****************************************************************************/
181 /*  Structure definitions                                                    */
182 /*****************************************************************************/
183 
184 typedef struct
185 {
186     void *ihevceHdl;
187 
188     char au1_in_file[STR_LEN]; /*!< input yuv file name
189                                     */
190     char au1_out_file[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES]
191                      [STR_LEN]; /*!< output bitstream filename
192                                     */
193     char au1_recon_file[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES]
194                        [STR_LEN]; /*!< Recon yuv filename
195                                     */
196     char au1_stat_file[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES]
197                       [STR_LEN]; /*!< stat filename from pass1
198                                     */
199     char au1_stat_blk_file[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES]
200                           [STR_LEN]; /*!< stat filename from pass1
201                                     */
202     char au1_csv_file[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES][STR_LEN];
203 
204     ihevce_static_cfg_params_t s_static_cfg_prms;
205 
206     char ai1_sei_payload_path[STR_LEN];
207 
208 } appl_ctxt_t;
209 
210 typedef struct
211 {
212     /** App context pointer */
213     appl_ctxt_t s_app_ctxt;
214 } main_ctxt_t;
215 
216 typedef struct
217 {
218     char argument_shortname[25];
219     char argument_name[128];
220     ARGUMENT_T argument;
221     char description[512];
222 } argument_t;
223 
224 /*****************************************************************************/
225 /*  Function Declarations                                                    */
226 /*****************************************************************************/
227 void codec_exit(CHAR *pc_err_message);
228 
229 #endif /* _APP_H_ */
230