1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*------------------------------------------------------------------------------
18
19    Table of contents
20
21    1. Include headers
22    2. Module defines
23    3. Data types
24    4. Function prototypes
25
26------------------------------------------------------------------------------*/
27
28#ifndef H264SWDEC_VUI_H
29#define H264SWDEC_VUI_H
30
31/*------------------------------------------------------------------------------
32    1. Include headers
33------------------------------------------------------------------------------*/
34
35#include "basetype.h"
36#include "h264bsd_stream.h"
37
38/*------------------------------------------------------------------------------
39    2. Module defines
40------------------------------------------------------------------------------*/
41
42#define MAX_CPB_CNT 32
43
44/*------------------------------------------------------------------------------
45    3. Data types
46------------------------------------------------------------------------------*/
47
48/* enumerated sample aspect ratios, ASPECT_RATIO_M_N means M:N */
49enum
50{
51    ASPECT_RATIO_UNSPECIFIED = 0,
52    ASPECT_RATIO_1_1,
53    ASPECT_RATIO_12_11,
54    ASPECT_RATIO_10_11,
55    ASPECT_RATIO_16_11,
56    ASPECT_RATIO_40_33,
57    ASPECT_RATIO_24_11,
58    ASPECT_RATIO_20_11,
59    ASPECT_RATIO_32_11,
60    ASPECT_RATIO_80_33,
61    ASPECT_RATIO_18_11,
62    ASPECT_RATIO_15_11,
63    ASPECT_RATIO_64_33,
64    ASPECT_RATIO_160_99,
65    ASPECT_RATIO_EXTENDED_SAR = 255
66};
67
68/* structure to store Hypothetical Reference Decoder (HRD) parameters */
69typedef struct
70{
71    u32 cpbCnt;
72    u32 bitRateScale;
73    u32 cpbSizeScale;
74    u32 bitRateValue[MAX_CPB_CNT];
75    u32 cpbSizeValue[MAX_CPB_CNT];
76    u32 cbrFlag[MAX_CPB_CNT];
77    u32 initialCpbRemovalDelayLength;
78    u32 cpbRemovalDelayLength;
79    u32 dpbOutputDelayLength;
80    u32 timeOffsetLength;
81} hrdParameters_t;
82
83/* storage for VUI parameters */
84typedef struct
85{
86    u32 aspectRatioPresentFlag;
87    u32 aspectRatioIdc;
88    u32 sarWidth;
89    u32 sarHeight;
90    u32 overscanInfoPresentFlag;
91    u32 overscanAppropriateFlag;
92    u32 videoSignalTypePresentFlag;
93    u32 videoFormat;
94    u32 videoFullRangeFlag;
95    u32 colourDescriptionPresentFlag;
96    u32 colourPrimaries;
97    u32 transferCharacteristics;
98    u32 matrixCoefficients;
99    u32 chromaLocInfoPresentFlag;
100    u32 chromaSampleLocTypeTopField;
101    u32 chromaSampleLocTypeBottomField;
102    u32 timingInfoPresentFlag;
103    u32 numUnitsInTick;
104    u32 timeScale;
105    u32 fixedFrameRateFlag;
106    u32 nalHrdParametersPresentFlag;
107    hrdParameters_t nalHrdParameters;
108    u32 vclHrdParametersPresentFlag;
109    hrdParameters_t vclHrdParameters;
110    u32 lowDelayHrdFlag;
111    u32 picStructPresentFlag;
112    u32 bitstreamRestrictionFlag;
113    u32 motionVectorsOverPicBoundariesFlag;
114    u32 maxBytesPerPicDenom;
115    u32 maxBitsPerMbDenom;
116    u32 log2MaxMvLengthHorizontal;
117    u32 log2MaxMvLengthVertical;
118    u32 numReorderFrames;
119    u32 maxDecFrameBuffering;
120} vuiParameters_t;
121
122/*------------------------------------------------------------------------------
123    4. Function prototypes
124------------------------------------------------------------------------------*/
125
126u32 h264bsdDecodeVuiParameters(strmData_t *pStrmData,
127    vuiParameters_t *pVuiParameters);
128
129#endif /* #ifdef H264SWDEC_VUI_H */
130
131