Path: blob/21.2-virgl/src/gallium/frontends/omx/vid_dec_common.h
4561 views
/**************************************************************************1*2* Copyright 2013 Advanced Micro Devices, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627#ifndef VID_DEC_COMMON_H28#define VID_DEC_COMMON_H2930#include "util/list.h"3132#include "vl/vl_compositor.h"33#include "vl/vl_rbsp.h"34#include "vl/vl_zscan.h"3536#include "bellagio/vid_dec_av1.h"3738#include <OMX_Core.h>39#include <OMX_Types.h>4041#if ENABLE_ST_OMX_BELLAGIO4243#include <bellagio/st_static_component_loader.h>44#include <bellagio/omx_base_filter.h>45#include <bellagio/omx_base_video_port.h>4647DERIVEDCLASS(vid_dec_PrivateType, omx_base_filter_PrivateType)48#define vid_dec_PrivateType_FIELDS omx_base_filter_PrivateType_FIELDS \49enum pipe_video_profile profile; \50struct vl_screen *screen; \51struct pipe_context *pipe; \52struct pipe_video_codec *codec; \53void (*Decode)(vid_dec_PrivateType *priv, struct vl_vlc *vlc, unsigned min_bits_left); \54void (*EndFrame)(vid_dec_PrivateType *priv); \55struct pipe_video_buffer *(*Flush)(vid_dec_PrivateType *priv, OMX_TICKS *timestamp); \56struct pipe_video_buffer *target, *shadow; \57union { \58struct { \59uint8_t intra_matrix[64]; \60uint8_t non_intra_matrix[64]; \61} mpeg12; \62struct { \63unsigned nal_ref_idc; \64bool IdrPicFlag; \65unsigned idr_pic_id; \66unsigned pic_order_cnt_lsb; \67unsigned pic_order_cnt_msb; \68unsigned delta_pic_order_cnt_bottom; \69unsigned delta_pic_order_cnt[2]; \70unsigned prevFrameNumOffset; \71struct pipe_h264_sps sps[32]; \72struct pipe_h264_pps pps[256]; \73struct list_head dpb_list; \74unsigned dpb_num; \75} h264; \76struct { \77unsigned temporal_id; \78unsigned level_idc; \79unsigned pic_width_in_luma_samples; \80unsigned pic_height_in_luma_samples; \81bool IdrPicFlag; \82int slice_prev_poc; \83void *ref_pic_set_list; \84void *rps; \85struct pipe_h265_sps sps[16]; \86struct pipe_h265_pps pps[64]; \87struct list_head dpb_list; \88unsigned dpb_num; \89} h265; \90struct dec_av1 av1; \91} codec_data; \92union { \93struct pipe_picture_desc base; \94struct pipe_mpeg12_picture_desc mpeg12; \95struct pipe_h264_picture_desc h264; \96struct pipe_h265_picture_desc h265; \97struct pipe_av1_picture_desc av1; \98} picture; \99unsigned num_in_buffers; \100OMX_BUFFERHEADERTYPE *in_buffers[2]; \101const void *inputs[2]; \102unsigned sizes[2]; \103OMX_TICKS timestamps[2]; \104OMX_TICKS timestamp; \105bool first_buf_in_frame; \106bool frame_finished; \107bool frame_started; \108unsigned bytes_left; \109const void *slice; \110bool disable_tunnel; \111struct vl_compositor compositor; \112struct vl_compositor_state cstate;113ENDCLASS(vid_dec_PrivateType)114115#else116117#include <tizprc_decls.h>118#include <tizport_decls.h>119120#include "util/list.h"121#include "util/u_hash_table.h"122123#include "pipe/p_video_state.h"124125typedef struct h264d_prc_class h264d_prc_class_t;126struct h264d_prc_class127{128/* Class */129const tiz_prc_class_t _;130/* NOTE: Class methods might be added in the future */131};132133typedef struct h264d_stream_info h264d_stream_info_t;134struct h264d_stream_info135{136unsigned int width;137unsigned int height;138};139140typedef struct h264d_prc vid_dec_PrivateType;141struct h264d_prc142{143/* Object */144const tiz_prc_t _;145OMX_BUFFERHEADERTYPE *in_buffers[2];146OMX_BUFFERHEADERTYPE *p_inhdr_;147OMX_BUFFERHEADERTYPE *p_outhdr_;148OMX_PARAM_PORTDEFINITIONTYPE out_port_def_;149const void *inputs[2];150unsigned sizes[2];151OMX_TICKS timestamps[2];152OMX_TICKS timestamp;153bool eos_;154bool in_port_disabled_;155bool out_port_disabled_;156struct vl_screen *screen;157struct pipe_context *pipe;158struct pipe_video_codec *codec;159struct pipe_video_buffer *target;160enum pipe_video_profile profile;161struct hash_table *video_buffer_map;162union {163struct {164unsigned nal_ref_idc;165bool IdrPicFlag;166unsigned idr_pic_id;167unsigned pic_order_cnt_lsb;168unsigned pic_order_cnt_msb;169unsigned delta_pic_order_cnt_bottom;170unsigned delta_pic_order_cnt[2];171unsigned prevFrameNumOffset;172struct pipe_h264_sps sps[32];173struct pipe_h264_pps pps[256];174struct list_head dpb_list;175unsigned dpb_num;176} h264;177} codec_data;178union {179struct pipe_picture_desc base;180struct pipe_h264_picture_desc h264;181} picture;182h264d_stream_info_t stream_info;183unsigned num_in_buffers;184bool first_buf_in_frame;185bool frame_finished;186bool frame_started;187unsigned bytes_left;188const void *slice;189bool disable_tunnel;190struct vl_compositor compositor;191struct vl_compositor_state cstate;192bool use_eglimage;193};194195#endif196197void vid_dec_NeedTarget(vid_dec_PrivateType* priv);198void vid_dec_FillOutput(vid_dec_PrivateType* priv, struct pipe_video_buffer* buf,199OMX_BUFFERHEADERTYPE* output);200#endif201202203