Home | History | Annotate | Download | only in source
      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_SEI_H
     29 #define H264SWDEC_SEI_H
     30 
     31 /*------------------------------------------------------------------------------
     32     1. Include headers
     33 ------------------------------------------------------------------------------*/
     34 
     35 #include "basetype.h"
     36 #include "h264bsd_stream.h"
     37 #include "h264bsd_slice_header.h"
     38 #include "h264bsd_seq_param_set.h"
     39 #include "h264bsd_vui.h"
     40 
     41 /*------------------------------------------------------------------------------
     42     2. Module defines
     43 ------------------------------------------------------------------------------*/
     44 
     45 #define MAX_PAN_SCAN_CNT 32
     46 #define MAX_NUM_SPARE_PICS 16
     47 #define MAX_NUM_CLOCK_TS 3
     48 #define MAX_NUM_SUB_SEQ_LAYERS 256
     49 
     50 /*------------------------------------------------------------------------------
     51     3. Data types
     52 ------------------------------------------------------------------------------*/
     53 
     54 typedef struct
     55 {
     56     u32 seqParameterSetId;
     57     u32 initialCpbRemovalDelay[MAX_CPB_CNT];
     58     u32 initialCpbRemovalDelayOffset[MAX_CPB_CNT];
     59 } seiBufferingPeriod_t;
     60 
     61 typedef struct
     62 {
     63     u32 cpbRemovalDelay;
     64     u32 dpbOutputDelay;
     65     u32 picStruct;
     66     u32 clockTimeStampFlag[MAX_NUM_CLOCK_TS];
     67     u32 clockTimeStamp[MAX_NUM_CLOCK_TS];
     68     u32 ctType[MAX_NUM_CLOCK_TS];
     69     u32 nuitFieldBasedFlag[MAX_NUM_CLOCK_TS];
     70     u32 countingType[MAX_NUM_CLOCK_TS];
     71     u32 fullTimeStampFlag[MAX_NUM_CLOCK_TS];
     72     u32 discontinuityFlag[MAX_NUM_CLOCK_TS];
     73     u32 cntDroppedFlag[MAX_NUM_CLOCK_TS];
     74     u32 nFrames[MAX_NUM_CLOCK_TS];
     75     u32 secondsFlag[MAX_NUM_CLOCK_TS];
     76     u32 secondsValue[MAX_NUM_CLOCK_TS];
     77     u32 minutesFlag[MAX_NUM_CLOCK_TS];
     78     u32 minutesValue[MAX_NUM_CLOCK_TS];
     79     u32 hoursFlag[MAX_NUM_CLOCK_TS];
     80     u32 hoursValue[MAX_NUM_CLOCK_TS];
     81     i32 timeOffset[MAX_NUM_CLOCK_TS];
     82 } seiPicTiming_t;
     83 
     84 typedef struct
     85 {
     86     u32 panScanRectId;
     87     u32 panScanRectCancelFlag;
     88     u32 panScanCnt;
     89     i32 panScanRectLeftOffset[MAX_PAN_SCAN_CNT];
     90     i32 panScanRectRightOffset[MAX_PAN_SCAN_CNT];
     91     i32 panScanRectTopOffset[MAX_PAN_SCAN_CNT];
     92     i32 panScanRectBottomOffset[MAX_PAN_SCAN_CNT];
     93     u32 panScanRectRepetitionPeriod;
     94 } seiPanScanRect_t;
     95 
     96 typedef struct
     97 {
     98     u32 ituTT35CountryCode;
     99     u32 ituTT35CountryCodeExtensionByte;
    100     u8 *ituTT35PayloadByte;
    101     u32 numPayloadBytes;
    102 } seiUserDataRegisteredItuTT35_t;
    103 
    104 typedef struct
    105 {
    106     u32 uuidIsoIec11578[4];
    107     u8 *userDataPayloadByte;
    108     u32 numPayloadBytes;
    109 } seiUserDataUnregistered_t;
    110 
    111 typedef struct
    112 {
    113     u32 recoveryFrameCnt;
    114     u32 exactMatchFlag;
    115     u32 brokenLinkFlag;
    116     u32 changingSliceGroupIdc;
    117 } seiRecoveryPoint_t;
    118 
    119 typedef struct
    120 {
    121     u32 originalIdrFlag;
    122     u32 originalFrameNum;
    123     decRefPicMarking_t decRefPicMarking;
    124 } seiDecRefPicMarkingRepetition_t;
    125 
    126 typedef struct
    127 {
    128     u32 targetFrameNum;
    129     u32 spareFieldFlag;
    130     u32 targetBottomFieldFlag;
    131     u32 numSparePics;
    132     u32 deltaSpareFrameNum[MAX_NUM_SPARE_PICS];
    133     u32 spareBottomFieldFlag[MAX_NUM_SPARE_PICS];
    134     u32 spareAreaIdc[MAX_NUM_SPARE_PICS];
    135     u32 *spareUnitFlag[MAX_NUM_SPARE_PICS];
    136     u32 *zeroRunLength[MAX_NUM_SPARE_PICS];
    137 } seiSparePic_t;
    138 
    139 typedef struct
    140 {
    141     u32 sceneInfoPresentFlag;
    142     u32 sceneId;
    143     u32 sceneTransitionType;
    144     u32 secondSceneId;
    145 } seiSceneInfo_t;
    146 
    147 typedef struct
    148 {
    149     u32 subSeqLayerNum;
    150     u32 subSeqId;
    151     u32 firstRefPicFlag;
    152     u32 leadingNonRefPicFlag;
    153     u32 lastPicFlag;
    154     u32 subSeqFrameNumFlag;
    155     u32 subSeqFrameNum;
    156 } seiSubSeqInfo_t;
    157 
    158 typedef struct
    159 {
    160     u32 numSubSeqLayers;
    161     u32 accurateStatisticsFlag[MAX_NUM_SUB_SEQ_LAYERS];
    162     u32 averageBitRate[MAX_NUM_SUB_SEQ_LAYERS];
    163     u32 averageFrameRate[MAX_NUM_SUB_SEQ_LAYERS];
    164 } seiSubSeqLayerCharacteristics_t;
    165 
    166 typedef struct
    167 {
    168     u32 subSeqLayerNum;
    169     u32 subSeqId;
    170     u32 durationFlag;
    171     u32 subSeqDuration;
    172     u32 averageRateFlag;
    173     u32 accurateStatisticsFlag;
    174     u32 averageBitRate;
    175     u32 averageFrameRate;
    176     u32 numReferencedSubseqs;
    177     u32 refSubSeqLayerNum[MAX_NUM_SUB_SEQ_LAYERS];
    178     u32 refSubSeqId[MAX_NUM_SUB_SEQ_LAYERS];
    179     u32 refSubSeqDirection[MAX_NUM_SUB_SEQ_LAYERS];
    180 } seiSubSeqCharacteristics_t;
    181 
    182 typedef struct
    183 {
    184     u32 fullFrameFreezeRepetitionPeriod;
    185 } seiFullFrameFreeze_t;
    186 
    187 typedef struct
    188 {
    189     u32 snapShotId;
    190 } seiFullFrameSnapshot_t;
    191 
    192 typedef struct
    193 {
    194     u32 progressiveRefinementId;
    195     u32 numRefinementSteps;
    196 } seiProgressiveRefinementSegmentStart_t;
    197 
    198 typedef struct
    199 {
    200     u32 progressiveRefinementId;
    201 } seiProgressiveRefinementSegmentEnd_t;
    202 
    203 typedef struct
    204 {
    205     u32 numSliceGroupsInSet;
    206     u32 sliceGroupId[MAX_NUM_SLICE_GROUPS];
    207     u32 exactSampleValueMatchFlag;
    208     u32 panScanRectFlag;
    209     u32 panScanRectId;
    210 } seiMotionConstrainedSliceGroupSet_t;
    211 
    212 typedef struct
    213 {
    214     u8 *reservedSeiMessagePayloadByte;
    215     u32 numPayloadBytes;
    216 } seiReservedSeiMessage_t;
    217 
    218 typedef struct
    219 {
    220     u32 payloadType;
    221     seiBufferingPeriod_t bufferingPeriod;
    222     seiPicTiming_t picTiming;
    223     seiPanScanRect_t panScanRect;
    224     seiUserDataRegisteredItuTT35_t userDataRegisteredItuTT35;
    225     seiUserDataUnregistered_t userDataUnregistered;
    226     seiRecoveryPoint_t recoveryPoint;
    227     seiDecRefPicMarkingRepetition_t decRefPicMarkingRepetition;
    228     seiSparePic_t sparePic;
    229     seiSceneInfo_t sceneInfo;
    230     seiSubSeqInfo_t subSeqInfo;
    231     seiSubSeqLayerCharacteristics_t subSeqLayerCharacteristics;
    232     seiSubSeqCharacteristics_t subSeqCharacteristics;
    233     seiFullFrameFreeze_t fullFrameFreeze;
    234     seiFullFrameSnapshot_t fullFrameSnapshot;
    235     seiProgressiveRefinementSegmentStart_t progressiveRefinementSegmentStart;
    236     seiProgressiveRefinementSegmentEnd_t progressiveRefinementSegmentEnd;
    237     seiMotionConstrainedSliceGroupSet_t motionConstrainedSliceGroupSet;
    238     seiReservedSeiMessage_t reservedSeiMessage;
    239 } seiMessage_t;
    240 
    241 /*------------------------------------------------------------------------------
    242     4. Function prototypes
    243 ------------------------------------------------------------------------------*/
    244 
    245 u32 h264bsdDecodeSeiMessage(
    246   strmData_t *pStrmData,
    247   seqParamSet_t *pSeqParamSet,
    248   seiMessage_t *pSeiMessage,
    249   u32 numSliceGroups);
    250 
    251 #endif /* #ifdef H264SWDEC_SEI_H */
    252 
    253