summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/on2/h264dec/source/h264bsd_sei.h
blob: efe543a63797cc3e363332de693b09961dabdeea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*------------------------------------------------------------------------------

    Table of contents

    1. Include headers
    2. Module defines
    3. Data types
    4. Function prototypes

------------------------------------------------------------------------------*/

#ifndef H264SWDEC_SEI_H
#define H264SWDEC_SEI_H

/*------------------------------------------------------------------------------
    1. Include headers
------------------------------------------------------------------------------*/

#include "basetype.h"
#include "h264bsd_stream.h"
#include "h264bsd_slice_header.h"
#include "h264bsd_seq_param_set.h"
#include "h264bsd_vui.h"

/*------------------------------------------------------------------------------
    2. Module defines
------------------------------------------------------------------------------*/

#define MAX_PAN_SCAN_CNT 32
#define MAX_NUM_SPARE_PICS 16
#define MAX_NUM_CLOCK_TS 3
#define MAX_NUM_SUB_SEQ_LAYERS 256

/*------------------------------------------------------------------------------
    3. Data types
------------------------------------------------------------------------------*/

typedef struct
{
    u32 seqParameterSetId;
    u32 initialCpbRemovalDelay[MAX_CPB_CNT];
    u32 initialCpbRemovalDelayOffset[MAX_CPB_CNT];
} seiBufferingPeriod_t;

typedef struct
{
    u32 cpbRemovalDelay;
    u32 dpbOutputDelay;
    u32 picStruct;
    u32 clockTimeStampFlag[MAX_NUM_CLOCK_TS];
    u32 clockTimeStamp[MAX_NUM_CLOCK_TS];
    u32 ctType[MAX_NUM_CLOCK_TS];
    u32 nuitFieldBasedFlag[MAX_NUM_CLOCK_TS];
    u32 countingType[MAX_NUM_CLOCK_TS];
    u32 fullTimeStampFlag[MAX_NUM_CLOCK_TS];
    u32 discontinuityFlag[MAX_NUM_CLOCK_TS];
    u32 cntDroppedFlag[MAX_NUM_CLOCK_TS];
    u32 nFrames[MAX_NUM_CLOCK_TS];
    u32 secondsFlag[MAX_NUM_CLOCK_TS];
    u32 secondsValue[MAX_NUM_CLOCK_TS];
    u32 minutesFlag[MAX_NUM_CLOCK_TS];
    u32 minutesValue[MAX_NUM_CLOCK_TS];
    u32 hoursFlag[MAX_NUM_CLOCK_TS];
    u32 hoursValue[MAX_NUM_CLOCK_TS];
    i32 timeOffset[MAX_NUM_CLOCK_TS];
} seiPicTiming_t;

typedef struct
{
    u32 panScanRectId;
    u32 panScanRectCancelFlag;
    u32 panScanCnt;
    i32 panScanRectLeftOffset[MAX_PAN_SCAN_CNT];
    i32 panScanRectRightOffset[MAX_PAN_SCAN_CNT];
    i32 panScanRectTopOffset[MAX_PAN_SCAN_CNT];
    i32 panScanRectBottomOffset[MAX_PAN_SCAN_CNT];
    u32 panScanRectRepetitionPeriod;
} seiPanScanRect_t;

typedef struct
{
    u32 ituTT35CountryCode;
    u32 ituTT35CountryCodeExtensionByte;
    u8 *ituTT35PayloadByte;
    u32 numPayloadBytes;
} seiUserDataRegisteredItuTT35_t;

typedef struct
{
    u32 uuidIsoIec11578[4];
    u8 *userDataPayloadByte;
    u32 numPayloadBytes;
} seiUserDataUnregistered_t;

typedef struct
{
    u32 recoveryFrameCnt;
    u32 exactMatchFlag;
    u32 brokenLinkFlag;
    u32 changingSliceGroupIdc;
} seiRecoveryPoint_t;

typedef struct
{
    u32 originalIdrFlag;
    u32 originalFrameNum;
    decRefPicMarking_t decRefPicMarking;
} seiDecRefPicMarkingRepetition_t;

typedef struct
{
    u32 targetFrameNum;
    u32 spareFieldFlag;
    u32 targetBottomFieldFlag;
    u32 numSparePics;
    u32 deltaSpareFrameNum[MAX_NUM_SPARE_PICS];
    u32 spareBottomFieldFlag[MAX_NUM_SPARE_PICS];
    u32 spareAreaIdc[MAX_NUM_SPARE_PICS];
    u32 *spareUnitFlag[MAX_NUM_SPARE_PICS];
    u32 *zeroRunLength[MAX_NUM_SPARE_PICS];
} seiSparePic_t;

typedef struct
{
    u32 sceneInfoPresentFlag;
    u32 sceneId;
    u32 sceneTransitionType;
    u32 secondSceneId;
} seiSceneInfo_t;

typedef struct
{
    u32 subSeqLayerNum;
    u32 subSeqId;
    u32 firstRefPicFlag;
    u32 leadingNonRefPicFlag;
    u32 lastPicFlag;
    u32 subSeqFrameNumFlag;
    u32 subSeqFrameNum;
} seiSubSeqInfo_t;

typedef struct
{
    u32 numSubSeqLayers;
    u32 accurateStatisticsFlag[MAX_NUM_SUB_SEQ_LAYERS];
    u32 averageBitRate[MAX_NUM_SUB_SEQ_LAYERS];
    u32 averageFrameRate[MAX_NUM_SUB_SEQ_LAYERS];
} seiSubSeqLayerCharacteristics_t;

typedef struct
{
    u32 subSeqLayerNum;
    u32 subSeqId;
    u32 durationFlag;
    u32 subSeqDuration;
    u32 averageRateFlag;
    u32 accurateStatisticsFlag;
    u32 averageBitRate;
    u32 averageFrameRate;
    u32 numReferencedSubseqs;
    u32 refSubSeqLayerNum[MAX_NUM_SUB_SEQ_LAYERS];
    u32 refSubSeqId[MAX_NUM_SUB_SEQ_LAYERS];
    u32 refSubSeqDirection[MAX_NUM_SUB_SEQ_LAYERS];
} seiSubSeqCharacteristics_t;

typedef struct
{
    u32 fullFrameFreezeRepetitionPeriod;
} seiFullFrameFreeze_t;

typedef struct
{
    u32 snapShotId;
} seiFullFrameSnapshot_t;

typedef struct
{
    u32 progressiveRefinementId;
    u32 numRefinementSteps;
} seiProgressiveRefinementSegmentStart_t;

typedef struct
{
    u32 progressiveRefinementId;
} seiProgressiveRefinementSegmentEnd_t;

typedef struct
{
    u32 numSliceGroupsInSet;
    u32 sliceGroupId[MAX_NUM_SLICE_GROUPS];
    u32 exactSampleValueMatchFlag;
    u32 panScanRectFlag;
    u32 panScanRectId;
} seiMotionConstrainedSliceGroupSet_t;

typedef struct
{
    u8 *reservedSeiMessagePayloadByte;
    u32 numPayloadBytes;
} seiReservedSeiMessage_t;

typedef struct
{
    u32 payloadType;
    seiBufferingPeriod_t bufferingPeriod;
    seiPicTiming_t picTiming;
    seiPanScanRect_t panScanRect;
    seiUserDataRegisteredItuTT35_t userDataRegisteredItuTT35;
    seiUserDataUnregistered_t userDataUnregistered;
    seiRecoveryPoint_t recoveryPoint;
    seiDecRefPicMarkingRepetition_t decRefPicMarkingRepetition;
    seiSparePic_t sparePic;
    seiSceneInfo_t sceneInfo;
    seiSubSeqInfo_t subSeqInfo;
    seiSubSeqLayerCharacteristics_t subSeqLayerCharacteristics;
    seiSubSeqCharacteristics_t subSeqCharacteristics;
    seiFullFrameFreeze_t fullFrameFreeze;
    seiFullFrameSnapshot_t fullFrameSnapshot;
    seiProgressiveRefinementSegmentStart_t progressiveRefinementSegmentStart;
    seiProgressiveRefinementSegmentEnd_t progressiveRefinementSegmentEnd;
    seiMotionConstrainedSliceGroupSet_t motionConstrainedSliceGroupSet;
    seiReservedSeiMessage_t reservedSeiMessage;
} seiMessage_t;

/*------------------------------------------------------------------------------
    4. Function prototypes
------------------------------------------------------------------------------*/

u32 h264bsdDecodeSeiMessage(
  strmData_t *pStrmData,
  seqParamSet_t *pSeqParamSet,
  seiMessage_t *pSeiMessage,
  u32 numSliceGroups);

#endif /* #ifdef H264SWDEC_SEI_H */