1 /******************************************************************************
2  *
3  * Copyright (C) 2015 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 /*  File Name         : ih264d.h                                             */
23 /*                                                                           */
24 /*  Description       : This file contains all the necessary structure and   */
25 /*                      enumeration definitions needed for the Application   */
26 /*                      Program Interface(API) of the Ittiam H264 ASP       */
27 /*                      Decoder on Cortex A8 - Neon platform                 */
28 /*                                                                           */
29 /*  List of Functions : ih264d_api_function                              */
30 /*                                                                           */
31 /*  Issues / Problems : None                                                 */
32 /*                                                                           */
33 /*  Revision History  :                                                      */
34 /*                                                                           */
35 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
36 /*         26 08 2010   100239(RCY)     Draft                                */
37 /*                                                                           */
38 /*****************************************************************************/
39 
40 #ifndef _IH264D_H_
41 #define _IH264D_H_
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #include "iv.h"
47 #include "ivd.h"
48 
49 
50 /*****************************************************************************/
51 /* Constant Macros                                                           */
52 /*****************************************************************************/
53 
54 /*****************************************************************************/
55 /* Function Macros                                                           */
56 /*****************************************************************************/
57 #define IS_IVD_CONCEALMENT_APPLIED(x)       (x & (1 << IVD_APPLIEDCONCEALMENT))
58 #define IS_IVD_INSUFFICIENTDATA_ERROR(x)    (x & (1 << IVD_INSUFFICIENTDATA))
59 #define IS_IVD_CORRUPTEDDATA_ERROR(x)       (x & (1 << IVD_CORRUPTEDDATA))
60 #define IS_IVD_CORRUPTEDHEADER_ERROR(x)     (x & (1 << IVD_CORRUPTEDHEADER))
61 #define IS_IVD_UNSUPPORTEDINPUT_ERROR(x)    (x & (1 << IVD_UNSUPPORTEDINPUT))
62 #define IS_IVD_UNSUPPORTEDPARAM_ERROR(x)    (x & (1 << IVD_UNSUPPORTEDPARAM))
63 #define IS_IVD_FATAL_ERROR(x)               (x & (1 << IVD_FATALERROR))
64 #define IS_IVD_INVALID_BITSTREAM_ERROR(x)   (x & (1 << IVD_INVALID_BITSTREAM))
65 #define IS_IVD_INCOMPLETE_BITSTREAM_ERROR(x) (x & (1 << IVD_INCOMPLETE_BITSTREAM))
66 
67 
68 /*****************************************************************************/
69 /* API Function Prototype                                                    */
70 /*****************************************************************************/
71 IV_API_CALL_STATUS_T ih264d_api_function(iv_obj_t *ps_handle, void *pv_api_ip,void *pv_api_op);
72 
73 /*****************************************************************************/
74 /* Enums                                                                     */
75 /*****************************************************************************/
76 /* Codec Error codes for H264 ASP Decoder                                   */
77 
78 typedef enum {
79 
80     IH264D_VID_HDR_DEC_NUM_FRM_BUF_NOT_SUFFICIENT   = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 1,
81 
82 }IH264D_ERROR_CODES_T;
83 
84 /*****************************************************************************/
85 /* Extended Structures                                                       */
86 /*****************************************************************************/
87 
88 
89 /*****************************************************************************/
90 /*  Delete Codec                                                             */
91 /*****************************************************************************/
92 
93 
94 typedef struct {
95     ivd_delete_ip_t               s_ivd_delete_ip_t;
96 }ih264d_delete_ip_t;
97 
98 
99 typedef struct{
100     ivd_delete_op_t               s_ivd_delete_op_t;
101 }ih264d_delete_op_t;
102 
103 
104 /*****************************************************************************/
105 /*   Initialize decoder                                                      */
106 /*****************************************************************************/
107 
108 
109 typedef struct {
110     ivd_create_ip_t                         s_ivd_create_ip_t;
111 }ih264d_create_ip_t;
112 
113 
114 typedef struct{
115     ivd_create_op_t                         s_ivd_create_op_t;
116 }ih264d_create_op_t;
117 
118 
119 /*****************************************************************************/
120 /*   Video Decode                                                            */
121 /*****************************************************************************/
122 
123 
124 typedef struct {
125     ivd_video_decode_ip_t                   s_ivd_video_decode_ip_t;
126 }ih264d_video_decode_ip_t;
127 
128 
129 typedef struct{
130     ivd_video_decode_op_t                   s_ivd_video_decode_op_t;
131 }ih264d_video_decode_op_t;
132 
133 
134 /*****************************************************************************/
135 /*   Get Display Frame                                                       */
136 /*****************************************************************************/
137 
138 
139 typedef struct
140 {
141     ivd_get_display_frame_ip_t              s_ivd_get_display_frame_ip_t;
142 }ih264d_get_display_frame_ip_t;
143 
144 
145 typedef struct
146 {
147     ivd_get_display_frame_op_t              s_ivd_get_display_frame_op_t;
148 }ih264d_get_display_frame_op_t;
149 
150 /*****************************************************************************/
151 /*   Set Display Frame                                                       */
152 /*****************************************************************************/
153 
154 
155 typedef struct
156 {
157     ivd_set_display_frame_ip_t              s_ivd_set_display_frame_ip_t;
158 }ih264d_set_display_frame_ip_t;
159 
160 
161 typedef struct
162 {
163     ivd_set_display_frame_op_t              s_ivd_set_display_frame_op_t;
164 }ih264d_set_display_frame_op_t;
165 
166 /*****************************************************************************/
167 /*   Release Display Buffers                                                 */
168 /*****************************************************************************/
169 
170 
171 typedef struct
172 {
173     ivd_rel_display_frame_ip_t                  s_ivd_rel_display_frame_ip_t;
174 }ih264d_rel_display_frame_ip_t;
175 
176 
177 typedef struct
178 {
179     ivd_rel_display_frame_op_t                  s_ivd_rel_display_frame_op_t;
180 }ih264d_rel_display_frame_op_t;
181 
182 
183 typedef enum {
184     /** Set number of cores/threads to be used */
185     IH264D_CMD_CTL_SET_NUM_CORES         = IVD_CMD_CTL_CODEC_SUBCMD_START,
186 
187     /** Set processor details */
188     IH264D_CMD_CTL_SET_PROCESSOR         = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x001,
189 
190     /** Get display buffer dimensions */
191     IH264D_CMD_CTL_GET_BUFFER_DIMENSIONS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x100,
192 
193     /** Get VUI parameters */
194     IH264D_CMD_CTL_GET_VUI_PARAMS        = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x101,
195 
196     /** Enable/disable GPU, supported on select platforms */
197     IH264D_CMD_CTL_GPU_ENABLE_DISABLE    = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x200,
198 
199     /** Set degrade level */
200     IH264D_CMD_CTL_DEGRADE               = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x300
201 }IH264D_CMD_CTL_SUB_CMDS;
202 /*****************************************************************************/
203 /*   Video control  Flush                                                    */
204 /*****************************************************************************/
205 
206 
207 typedef struct{
208     ivd_ctl_flush_ip_t                      s_ivd_ctl_flush_ip_t;
209 }ih264d_ctl_flush_ip_t;
210 
211 
212 typedef struct{
213     ivd_ctl_flush_op_t                      s_ivd_ctl_flush_op_t;
214 }ih264d_ctl_flush_op_t;
215 
216 /*****************************************************************************/
217 /*   Video control reset                                                     */
218 /*****************************************************************************/
219 
220 
221 typedef struct{
222     ivd_ctl_reset_ip_t                      s_ivd_ctl_reset_ip_t;
223 }ih264d_ctl_reset_ip_t;
224 
225 
226 typedef struct{
227     ivd_ctl_reset_op_t                      s_ivd_ctl_reset_op_t;
228 }ih264d_ctl_reset_op_t;
229 
230 
231 /*****************************************************************************/
232 /*   Video control  Set Params                                               */
233 /*****************************************************************************/
234 
235 
236 typedef struct {
237     ivd_ctl_set_config_ip_t             s_ivd_ctl_set_config_ip_t;
238 }ih264d_ctl_set_config_ip_t;
239 
240 
241 typedef struct{
242     ivd_ctl_set_config_op_t             s_ivd_ctl_set_config_op_t;
243 }ih264d_ctl_set_config_op_t;
244 
245 /*****************************************************************************/
246 /*   Video control:Get Buf Info                                              */
247 /*****************************************************************************/
248 
249 
250 typedef struct{
251     ivd_ctl_getbufinfo_ip_t             s_ivd_ctl_getbufinfo_ip_t;
252 }ih264d_ctl_getbufinfo_ip_t;
253 
254 
255 
256 typedef struct{
257     ivd_ctl_getbufinfo_op_t             s_ivd_ctl_getbufinfo_op_t;
258 }ih264d_ctl_getbufinfo_op_t;
259 
260 
261 /*****************************************************************************/
262 /*   Video control:Getstatus Call                                            */
263 /*****************************************************************************/
264 
265 
266 typedef struct{
267     ivd_ctl_getstatus_ip_t                  s_ivd_ctl_getstatus_ip_t;
268 }ih264d_ctl_getstatus_ip_t;
269 
270 
271 
272 typedef struct{
273     ivd_ctl_getstatus_op_t                  s_ivd_ctl_getstatus_op_t;
274 }ih264d_ctl_getstatus_op_t;
275 
276 
277 /*****************************************************************************/
278 /*   Video control:Get Version Info                                          */
279 /*****************************************************************************/
280 
281 
282 typedef struct{
283     ivd_ctl_getversioninfo_ip_t         s_ivd_ctl_getversioninfo_ip_t;
284 }ih264d_ctl_getversioninfo_ip_t;
285 
286 
287 
288 typedef struct{
289     ivd_ctl_getversioninfo_op_t         s_ivd_ctl_getversioninfo_op_t;
290 }ih264d_ctl_getversioninfo_op_t;
291 
292 typedef struct{
293 
294     /**
295      * u4_size
296      */
297     UWORD32                                     u4_size;
298 
299     /**
300      * cmd
301      */
302     IVD_API_COMMAND_TYPE_T                      e_cmd;
303 
304     /**
305      * sub_cmd
306      */
307     IVD_CONTROL_API_COMMAND_TYPE_T              e_sub_cmd;
308 
309     /**
310      * Pictures that are are degraded
311      * 0 : No degrade
312      * 1 : Only on non-reference frames
313      * 2 : Use interval specified by u4_nondegrade_interval
314      * 3 : All non-key frames
315      * 4 : All frames
316      */
317     WORD32                                     i4_degrade_pics;
318 
319     /**
320      * Interval for pictures which are completely decoded without any degradation
321      */
322     WORD32                                     i4_nondegrade_interval;
323 
324     /**
325      * bit position (lsb is zero): Type of degradation
326      * 1 : Disable deblocking
327      * 2 : Faster inter prediction filters
328      * 3 : Fastest inter prediction filters
329      */
330     WORD32                                     i4_degrade_type;
331 
332 }ih264d_ctl_degrade_ip_t;
333 
334 typedef struct
335 {
336     /**
337      * u4_size
338      */
339     UWORD32                                     u4_size;
340 
341     /**
342      * error_code
343      */
344     UWORD32                                     u4_error_code;
345 }ih264d_ctl_degrade_op_t;
346 
347 typedef struct{
348     UWORD32                                     u4_size;
349     IVD_API_COMMAND_TYPE_T                      e_cmd;
350     IVD_CONTROL_API_COMMAND_TYPE_T              e_sub_cmd;
351     UWORD32                                     u4_disable_deblk_level;
352 }ih264d_ctl_disable_deblock_ip_t;
353 
354 typedef struct{
355     UWORD32                                     u4_size;
356     UWORD32                                     u4_error_code;
357 }ih264d_ctl_disable_deblock_op_t;
358 
359 
360 typedef struct{
361     UWORD32                                     u4_size;
362     IVD_API_COMMAND_TYPE_T                      e_cmd;
363     IVD_CONTROL_API_COMMAND_TYPE_T              e_sub_cmd;
364     UWORD32                                     u4_num_cores;
365 }ih264d_ctl_set_num_cores_ip_t;
366 
367 typedef struct{
368     UWORD32                                     u4_size;
369     UWORD32                                     u4_error_code;
370 }ih264d_ctl_set_num_cores_op_t;
371 
372 typedef struct
373 {
374      /**
375       * i4_size
376       */
377     UWORD32                                     u4_size;
378     /**
379      * cmd
380      */
381     IVD_API_COMMAND_TYPE_T                      e_cmd;
382     /**
383      * sub cmd
384      */
385     IVD_CONTROL_API_COMMAND_TYPE_T              e_sub_cmd;
386     /**
387      * Processor type
388      */
389     UWORD32                                     u4_arch;
390     /**
391      * SOC type
392      */
393     UWORD32                                     u4_soc;
394 
395     /**
396      * num_cores
397      */
398     UWORD32                                     u4_num_cores;
399 
400 }ih264d_ctl_set_processor_ip_t;
401 
402 typedef struct
403 {
404     /**
405      * i4_size
406      */
407     UWORD32                                     u4_size;
408     /**
409      * error_code
410      */
411     UWORD32                                     u4_error_code;
412 }ih264d_ctl_set_processor_op_t;
413 
414 typedef struct{
415     UWORD32                                     u4_size;
416     IVD_API_COMMAND_TYPE_T                      e_cmd;
417     IVD_CONTROL_API_COMMAND_TYPE_T              e_sub_cmd;
418 }ih264d_ctl_get_frame_dimensions_ip_t;
419 
420 
421 typedef struct{
422     UWORD32                                     u4_size;
423     UWORD32                                     u4_error_code;
424     UWORD32                                     u4_x_offset[3];
425     UWORD32                                     u4_y_offset[3];
426     UWORD32                                     u4_disp_wd[3];
427     UWORD32                                     u4_disp_ht[3];
428     UWORD32                                     u4_buffer_wd[3];
429     UWORD32                                     u4_buffer_ht[3];
430 }ih264d_ctl_get_frame_dimensions_op_t;
431 
432 #ifdef __cplusplus
433 } /* closing brace for extern "C" */
434 #endif
435 #endif /* _IH264D_H_ */
436