Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/frontends/omx/vid_dec_h264_common.h
4561 views
1
/**************************************************************************
2
*
3
* Copyright 2013 Advanced Micro Devices, Inc.
4
* All Rights Reserved.
5
*
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:
13
*
14
* The above copyright notice and this permission notice (including the
15
* next paragraph) shall be included in all copies or substantial portions
16
* of the Software.
17
*
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.
25
*
26
**************************************************************************/
27
28
#ifndef VID_DEC_H264_COMMON_H
29
#define VID_DEC_H264_COMMON_H
30
31
#include "vid_dec_common.h"
32
33
#define OMX_VID_DEC_AVC_DEFAULT_FRAME_WIDTH 176
34
#define OMX_VID_DEC_AVC_DEFAULT_FRAME_HEIGHT 144
35
#define OMX_VID_DEC_AVC_DEFAULT_FRAME_RATE 15<<16
36
#define OMX_VID_DEC_AVC_ROLE "video_decoder.avc"
37
/* With libtizonia, port indexes must start at index 0 */
38
#define OMX_VID_DEC_AVC_INPUT_PORT_INDEX 0
39
#define OMX_VID_DEC_AVC_OUTPUT_PORT_INDEX 1
40
#define OMX_VID_DEC_AVC_INPUT_PORT_MIN_BUF_COUNT 8
41
#define OMX_VID_DEC_AVC_OUTPUT_PORT_MIN_BUF_COUNT 4
42
/* 38016 = (width * height) + ((width * height)/2) */
43
#define OMX_VID_DEC_AVC_PORT_MIN_INPUT_BUF_SIZE 38016
44
#define OMX_VID_DEC_AVC_PORT_MIN_OUTPUT_BUF_SIZE 345600
45
#define OMX_VID_DEC_AVC_PORT_NONCONTIGUOUS OMX_FALSE
46
#define OMX_VID_DEC_AVC_PORT_ALIGNMENT 0
47
#define OMX_VID_DEC_AVC_PORT_SUPPLIERPREF OMX_BufferSupplyInput
48
#define OMX_VID_DEC_AVC_TIMESTAMP_INVALID ((OMX_TICKS) -1)
49
50
#define DPB_MAX_SIZE 5
51
52
struct dpb_list {
53
struct list_head list;
54
struct pipe_video_buffer *buffer;
55
OMX_TICKS timestamp;
56
int poc;
57
};
58
59
static const uint8_t Default_4x4_Intra[16] = {
60
6, 13, 20, 28, 13, 20, 28, 32,
61
20, 28, 32, 37, 28, 32, 37, 42
62
};
63
64
static const uint8_t Default_4x4_Inter[16] = {
65
10, 14, 20, 24, 14, 20, 24, 27,
66
20, 24, 27, 30, 24, 27, 30, 34
67
};
68
69
static const uint8_t Default_8x8_Intra[64] = {
70
6, 10, 13, 16, 18, 23, 25, 27,
71
10, 11, 16, 18, 23, 25, 27, 29,
72
13, 16, 18, 23, 25, 27, 29, 31,
73
16, 18, 23, 25, 27, 29, 31, 33,
74
18, 23, 25, 27, 29, 31, 33, 36,
75
23, 25, 27, 29, 31, 33, 36, 38,
76
25, 27, 29, 31, 33, 36, 38, 40,
77
27, 29, 31, 33, 36, 38, 40, 42
78
};
79
80
static const uint8_t Default_8x8_Inter[64] = {
81
9, 13, 15, 17, 19, 21, 22, 24,
82
13, 13, 17, 19, 21, 22, 24, 25,
83
15, 17, 19, 21, 22, 24, 25, 27,
84
17, 19, 21, 22, 24, 25, 27, 28,
85
19, 21, 22, 24, 25, 27, 28, 30,
86
21, 22, 24, 25, 27, 28, 30, 32,
87
22, 24, 25, 27, 28, 30, 32, 33,
88
24, 25, 27, 28, 30, 32, 33, 35
89
};
90
91
struct pipe_video_buffer *vid_dec_h264_Flush(vid_dec_PrivateType *priv,
92
OMX_TICKS *timestamp);
93
void vid_dec_h264_EndFrame(vid_dec_PrivateType *priv);
94
void vid_dec_h264_Decode(vid_dec_PrivateType *priv, struct vl_vlc *vlc, unsigned min_bits_left);
95
void vid_dec_FreeInputPortPrivate(OMX_BUFFERHEADERTYPE *buf);
96
void vid_dec_FrameDecoded_common(vid_dec_PrivateType*priv, OMX_BUFFERHEADERTYPE* input,
97
OMX_BUFFERHEADERTYPE* output);
98
99
#endif
100
101