1 /**************************************************************************
3 * Copyright 2013 Advanced Micro Devices, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #ifndef VID_DEC_COMMON_H
29 #define VID_DEC_COMMON_H
31 #include "util/list.h"
33 #include "vl/vl_compositor.h"
34 #include "vl/vl_rbsp.h"
35 #include "vl/vl_zscan.h"
38 #include <OMX_Types.h>
40 #if ENABLE_ST_OMX_BELLAGIO
42 #include <bellagio/st_static_component_loader.h>
43 #include <bellagio/omx_base_filter.h>
44 #include <bellagio/omx_base_video_port.h>
46 DERIVEDCLASS(vid_dec_PrivateType
, omx_base_filter_PrivateType
)
47 #define vid_dec_PrivateType_FIELDS omx_base_filter_PrivateType_FIELDS \
48 enum pipe_video_profile profile; \
49 struct vl_screen *screen; \
50 struct pipe_context *pipe; \
51 struct pipe_video_codec *codec; \
52 void (*Decode)(vid_dec_PrivateType *priv, struct vl_vlc *vlc, unsigned min_bits_left); \
53 void (*EndFrame)(vid_dec_PrivateType *priv); \
54 struct pipe_video_buffer *(*Flush)(vid_dec_PrivateType *priv, OMX_TICKS *timestamp); \
55 struct pipe_video_buffer *target, *shadow; \
58 uint8_t intra_matrix[64]; \
59 uint8_t non_intra_matrix[64]; \
62 unsigned nal_ref_idc; \
64 unsigned idr_pic_id; \
65 unsigned pic_order_cnt_lsb; \
66 unsigned pic_order_cnt_msb; \
67 unsigned delta_pic_order_cnt_bottom; \
68 unsigned delta_pic_order_cnt[2]; \
69 unsigned prevFrameNumOffset; \
70 struct pipe_h264_sps sps[32]; \
71 struct pipe_h264_pps pps[256]; \
72 struct list_head dpb_list; \
76 unsigned temporal_id; \
78 unsigned pic_width_in_luma_samples; \
79 unsigned pic_height_in_luma_samples; \
82 void *ref_pic_set_list; \
84 struct pipe_h265_sps sps[16]; \
85 struct pipe_h265_pps pps[64]; \
86 struct list_head dpb_list; \
91 struct pipe_picture_desc base; \
92 struct pipe_mpeg12_picture_desc mpeg12; \
93 struct pipe_h264_picture_desc h264; \
94 struct pipe_h265_picture_desc h265; \
96 unsigned num_in_buffers; \
97 OMX_BUFFERHEADERTYPE *in_buffers[2]; \
98 const void *inputs[2]; \
100 OMX_TICKS timestamps[2]; \
101 OMX_TICKS timestamp; \
102 bool first_buf_in_frame; \
103 bool frame_finished; \
104 bool frame_started; \
105 unsigned bytes_left; \
107 bool disable_tunnel; \
108 struct vl_compositor compositor; \
109 struct vl_compositor_state cstate;
110 ENDCLASS(vid_dec_PrivateType
)
114 #include <tizprc_decls.h>
115 #include <tizport_decls.h>
117 #include "util/list.h"
118 #include "util/u_hash_table.h"
120 #include "pipe/p_video_state.h"
122 typedef struct h264d_prc_class h264d_prc_class_t
;
123 struct h264d_prc_class
126 const tiz_prc_class_t _
;
127 /* NOTE: Class methods might be added in the future */
130 typedef struct h264d_stream_info h264d_stream_info_t
;
131 struct h264d_stream_info
137 typedef struct h264d_prc vid_dec_PrivateType
;
142 OMX_BUFFERHEADERTYPE
*in_buffers
[2];
143 OMX_BUFFERHEADERTYPE
*p_inhdr_
;
144 OMX_BUFFERHEADERTYPE
*p_outhdr_
;
145 OMX_PARAM_PORTDEFINITIONTYPE out_port_def_
;
146 const void *inputs
[2];
148 OMX_TICKS timestamps
[2];
151 bool in_port_disabled_
;
152 bool out_port_disabled_
;
153 struct vl_screen
*screen
;
154 struct pipe_context
*pipe
;
155 struct pipe_video_codec
*codec
;
156 struct pipe_video_buffer
*target
;
157 enum pipe_video_profile profile
;
158 struct hash_table
*video_buffer_map
;
161 unsigned nal_ref_idc
;
164 unsigned pic_order_cnt_lsb
;
165 unsigned pic_order_cnt_msb
;
166 unsigned delta_pic_order_cnt_bottom
;
167 unsigned delta_pic_order_cnt
[2];
168 unsigned prevFrameNumOffset
;
169 struct pipe_h264_sps sps
[32];
170 struct pipe_h264_pps pps
[256];
171 struct list_head dpb_list
;
176 struct pipe_picture_desc base
;
177 struct pipe_h264_picture_desc h264
;
179 h264d_stream_info_t stream_info
;
180 unsigned num_in_buffers
;
181 bool first_buf_in_frame
;
187 struct vl_compositor compositor
;
188 struct vl_compositor_state cstate
;
194 void vid_dec_NeedTarget(vid_dec_PrivateType
* priv
);
195 void vid_dec_FillOutput(vid_dec_PrivateType
* priv
, struct pipe_video_buffer
* buf
,
196 OMX_BUFFERHEADERTYPE
* output
);