source: SHVCSoftware/branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h @ 1263

Last change on this file since 1263 was 798, checked in by qualcomm, 11 years ago

JCTVC-P0041: Signalling and decoding of POC (Several macros)

The following macros describe the code each contains:

  1. POC_RESET_IDC_SIGNALLING - signalling of POC-related syntax elements
  2. POC_RESET_IDC_ENCODER - support for POC reset at encoder
  3. POC_RESET_IDC_DECODER - support for POC reset at decoder

In addition two bugfixes, under macros ALIGN_IRAP_BUGFIX and UNAVAILABLE_PIC_BUGFIX are also submitted.

From: Adarsh K. Ramasubramonian <aramasub@…>

  • Property svn:eol-style set to native
File size: 14.6 KB
RevLine 
[313]1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
[595]6 * Copyright (c) 2010-2014, ITU/ISO/IEC
[313]7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     TDecTop.h
35    \brief    decoder class (header)
36*/
37
38#ifndef __TDECTOP__
39#define __TDECTOP__
40
41#include "TLibCommon/CommonDef.h"
42#include "TLibCommon/TComList.h"
43#include "TLibCommon/TComPicYuv.h"
44#include "TLibCommon/TComPic.h"
45#include "TLibCommon/TComTrQuant.h"
46#include "TLibCommon/SEI.h"
[677]47#if Q0048_CGS_3D_ASYMLUT
48#include "TLibCommon/TCom3DAsymLUT.h"
49#endif
[313]50
51#include "TDecGop.h"
52#include "TDecEntropy.h"
53#include "TDecSbac.h"
54#include "TDecCAVLC.h"
55#include "SEIread.h"
56
57struct InputNALUnit;
58
59//! \ingroup TLibDecoder
60//! \{
61
62// ====================================================================================================================
63// Class definition
64// ====================================================================================================================
65
[694]66#if Q0074_SEI_COLOR_MAPPING
67class TDecColorMapping
68{
[698]69  Int   m_colorMapId;
70  Bool  m_colorMapCancelFlag;
71  Bool  m_colorMapPersistenceFlag;
72  Bool  m_colorMap_video_signal_type_present_flag;
73  Bool  m_colorMap_video_full_range_flag;
74  Int   m_colorMap_primaries;
75  Int   m_colorMap_transfer_characteristics;
76  Int   m_colorMap_matrix_coeffs;
77  Int   m_colorMapModelId;
[694]78
79  Int   m_colour_map_coded_data_bit_depth;
80  Int   m_colour_map_target_bit_depth;
81
82  Int   m_num_input_pivots[3];
83  Int*  m_coded_input_pivot_value[3];
84  Int*  m_target_input_pivot_value[3];
85 
86  Bool  m_matrix_flag;
87  Int   m_log2_matrix_denom;
88  Int   m_matrix_coef[3][3];
89
90  Int   m_num_output_pivots[3];
91  Int*  m_coded_output_pivot_value[3];
92  Int*  m_target_output_pivot_value[3];
93
94  Bool  m_lut1d_computed[3];
95  Int*  m_lut1d_input[3];
96  Int*  m_lut1d_output[3];
97  TComPicYuv* m_pcColorMappingPic[2];
98
99public:
100  TDecColorMapping();
101  ~TDecColorMapping();
102
103  Bool        getColorMappingFlag()                     { return(!m_colorMapCancelFlag);};
104
105  Void        setColorMapping( SEIMessages m_SEIs );
106  Void        setColorMapping( Int bitDepthY, Int bitDepthC );
107  TComPicYuv* getColorMapping( TComPicYuv* pPicYuvRec, Int iTop=0, Int curlayerId=0 );
108};// END CLASS DEFINITION TDecColorMapping
109#endif
110
[313]111/// decoder class
112class TDecTop
113{
114private:
115  Int                     m_iMaxRefPicNum;
116 
[442]117  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
[313]118  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
119  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
120
121  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
122  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
123  TComSlice*              m_apcSlicePilot;
[442]124
[313]125  SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
126
127  // functional classes
128  TComPrediction          m_cPrediction;
[677]129#if Q0048_CGS_3D_ASYMLUT
130  TCom3DAsymLUT           m_c3DAsymLUTPPS;
131  TComPicYuv*             m_pColorMappedPic;
132#endif
[313]133  TComTrQuant             m_cTrQuant;
134  TDecGop                 m_cGopDecoder;
135  TDecSlice               m_cSliceDecoder;
136  TDecCu                  m_cCuDecoder;
137  TDecEntropy             m_cEntropyDecoder;
138  TDecCavlc               m_cCavlcDecoder;
139  TDecSbac                m_cSbacDecoder;
140  TDecBinCABAC            m_cBinCABAC;
141  SEIReader               m_seiReader;
142  TComLoopFilter          m_cLoopFilter;
143  TComSampleAdaptiveOffset m_cSAO;
144
145  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
146  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
147  TComPic*                m_pcPic;
148  UInt                    m_uiSliceIdx;
149#if !SVC_EXTENSION
150  Int                     m_prevPOC;
151#endif
152  Bool                    m_bFirstSliceInPicture;
153#if !SVC_EXTENSION
154  Bool                    m_bFirstSliceInSequence;
155#endif
[442]156  Bool                    m_prevSliceSkipped;
157  Int                     m_skippedPOC;
[652]158#if SETTING_NO_OUT_PIC_PRIOR 
159  Bool                    m_bFirstSliceInBitstream;
160  Int                     m_lastPOCNoOutputPriorPics;
161  Bool                    m_isNoOutputPriorPics;
162  Bool                    m_craNoRaslOutputFlag;    //value of variable NoRaslOutputFlag of the last CRA pic
163#endif
[747]164#if Q0177_EOS_CHECKS
165  Bool                    m_isLastNALWasEos;
166#endif
[313]167
168#if SVC_EXTENSION
169  static UInt             m_prevPOC;        // POC of the previous slice
170  static UInt             m_uiPrevLayerId;  // LayerId of the previous slice
171  static Bool             m_bFirstSliceInSequence;
172  UInt                    m_layerId;     
173  UInt                    m_numLayer;
174  TDecTop**               m_ppcTDecTop;
175#if AVC_BASE
176  fstream*                m_pBLReconFile;
[711]177#if !REPN_FORMAT_IN_VPS
[313]178  Int                     m_iBLSourceWidth;
[711]179  Int                     m_iBLSourceHeight;
[313]180#endif
[711]181#endif
[588]182#if VPS_EXTN_DIRECT_REF_LAYERS
[313]183  Int                     m_numDirectRefLayers;
184  Int                     m_refLayerId[MAX_VPS_LAYER_ID_PLUS1];
185  Int                     m_numSamplePredRefLayers;
186  Int                     m_samplePredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
187  Int                     m_numMotionPredRefLayers;
188  Int                     m_motionPredRefLayerId[MAX_VPS_LAYER_ID_PLUS1];
189  Bool                    m_samplePredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
190  Bool                    m_motionPredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
191#endif
[442]192  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
[313]193#endif
[540]194#if OUTPUT_LAYER_SET_INDEX
195  CommonDecoderParams*    m_commonDecoderParams;
196#endif
[313]197#if AVC_SYNTAX || SYNTAX_OUTPUT
198  fstream*               m_pBLSyntaxFile;
199#endif
200
[652]201#if NO_CLRAS_OUTPUT_FLAG 
[666]202  Bool                    m_noClrasOutputFlag;
[540]203  Bool                    m_layerInitializedFlag;
204  Bool                    m_firstPicInLayerDecodedFlag;
205#endif
[798]206#if POC_RESET_IDC_DECODER
207  Int                     m_parseIdc;
208  Int                     m_lastPocPeriodId;
209  Int                     m_prevPicOrderCnt;
210#endif
[588]211#if RESOLUTION_BASED_DPB
[652]212  Int                     m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
213                                           // When new VPS is activated, this should be re-initialized to -1
[588]214#endif
[313]215public:
[694]216#if Q0074_SEI_COLOR_MAPPING
217  TDecColorMapping* m_ColorMapping;
218#endif
219
[313]220  TDecTop();
221  virtual ~TDecTop();
222 
223  Void  create  ();
224  Void  destroy ();
225
226  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
227
228  Void  init();
229#if SVC_EXTENSION
230  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
231#else
232  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
233#endif
234 
235  Void  deletePicBuffer();
236
[652]237 
238  TComSPS* getActiveSPS() { return m_parameterSetManagerDecoder.getActiveSPS(); }
239
240
[313]241  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
[652]242#if SETTING_NO_OUT_PIC_PRIOR 
243  Void  checkNoOutputPriorPics (TComList<TComPic*>*& rpcListPic);
244  Bool  getNoOutputPriorPicsFlag ()         { return m_isNoOutputPriorPics; }
245  Void  setNoOutputPriorPicsFlag (Bool val) { m_isNoOutputPriorPics = val; }
246#endif
247
[313]248#if SVC_EXTENSION
[442]249#if EARLY_REF_PIC_MARKING
250  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
251#endif
[798]252#if POC_RESET_IDC_DECODER
253  Int getParseIdc() { return m_parseIdc;}
254  Void        setParseIdc(Int x) { m_parseIdc = x;}
255  Void        markAllPicsAsNoCurrAu();
256
257  Int   getLastPocPeriodId() { return m_lastPocPeriodId; }
258  Void  setLastPocPeriodId(Int x)    { m_lastPocPeriodId = x; }
259
260  Int   getPrevPicOrderCnt() { return m_prevPicOrderCnt; }
261  Void  setPrevPicOrderCnt(Int const x) { m_prevPicOrderCnt = x; }
262#endif
[313]263  UInt      getLayerId            () { return m_layerId;              }
264  Void      setLayerId            (UInt layer) { m_layerId = layer; }
265  UInt      getNumLayer           () { return m_numLayer;             }
266  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
267  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
268  Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
269  TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
270#if VPS_EXTN_DIRECT_REF_LAYERS
271  TDecTop*  getRefLayerDec(UInt refLayerIdc);
272  Int       getNumDirectRefLayers           ()                              { return m_numDirectRefLayers;      }
273  Void      setNumDirectRefLayers           (Int num)                       { m_numDirectRefLayers = num;       }
274
275  Int       getRefLayerId                   (Int i)                         { return m_refLayerId[i];           }
276  Void      setRefLayerId                   (Int i, Int refLayerId)         { m_refLayerId[i] = refLayerId;     }
277
278  Int       getNumSamplePredRefLayers       ()                              { return m_numSamplePredRefLayers;  }
279  Void      setNumSamplePredRefLayers       (Int num)                       { m_numSamplePredRefLayers = num;   }
280
281  Int       getSamplePredRefLayerId         (Int i)                         { return m_samplePredRefLayerId[i];       }
282  Void      setSamplePredRefLayerId         (Int i, Int refLayerId)         { m_samplePredRefLayerId[i] = refLayerId; }
283
284  Int       getNumMotionPredRefLayers       ()                              { return m_numMotionPredRefLayers;  }
285  Void      setNumMotionPredRefLayers       (Int num)                       { m_numMotionPredRefLayers = num;   }
286
287  Int       getMotionPredRefLayerId         (Int i)                         { return m_motionPredRefLayerId[i];       }
288  Void      setMotionPredRefLayerId         (Int i, Int refLayerId)         { m_motionPredRefLayerId[i] = refLayerId; }
289
290  Bool      getSamplePredEnabledFlag        (Int i)                         { return m_samplePredEnabledFlag[i];  }
291  Void      setSamplePredEnabledFlag        (Int i,Bool flag)               { m_samplePredEnabledFlag[i] = flag;  }
292
293  Bool      getMotionPredEnabledFlag        (Int i)                         { return m_motionPredEnabledFlag[i];  }
294  Void      setMotionPredEnabledFlag        (Int i,Bool flag)               { m_motionPredEnabledFlag[i] = flag;  }
295
296  TDecTop*  getSamplePredRefLayerDec        ( UInt layerId );
297  TDecTop*  getMotionPredRefLayerDec        ( UInt layerId );
298
299  Void      setRefLayerParams( TComVPS* vps );
300#endif
301#if AVC_BASE
302  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
303  fstream*  getBLReconFile() { return m_pBLReconFile; }
[711]304#if !REPN_FORMAT_IN_VPS
[313]305  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
306  Int       getBLWidth() { return  m_iBLSourceWidth; }
307  Int       getBLHeight() { return  m_iBLSourceHeight; }
308#endif
[711]309#endif
[442]310#if REPN_FORMAT_IN_VPS
311  Void      xInitILRP(TComSlice *slice);
312#else
313  Void      xInitILRP(TComSPS *pcSPS);
[313]314#endif
[595]315#if OUTPUT_LAYER_SET_INDEX
316  CommonDecoderParams*    getCommonDecoderParams() { return m_commonDecoderParams; }
317  Void                    setCommonDecoderParams(CommonDecoderParams* x) { m_commonDecoderParams = x; }
318  Void      checkValueOfTargetOutputLayerSetIdx(TComVPS *vps);
[442]319#endif
[595]320#if SCALINGLIST_INFERRING
321  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
322#endif
323#if RESOLUTION_BASED_DPB
324  Void setSubDpbIdx(Int idx)    { m_subDpbIdx = idx; }
325  Int  getSubDpbIdx()           { return m_subDpbIdx; }
326  Void assignSubDpbs(TComVPS *vps);
327#endif
328#endif //SVC_EXTENSION
[313]329#if AVC_SYNTAX || SYNTAX_OUTPUT
330  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
331  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
332#endif
333protected:
334  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
335  Void  xCreateLostPicture (Int iLostPOC);
336
337  Void      xActivateParameterSets();
338#if SVC_EXTENSION
[442]339#if POC_RESET_FLAG
340  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
341#else
[313]342  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
[442]343#endif
[313]344#else
345  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
346#endif
347  Void      xDecodeVPS();
348  Void      xDecodeSPS();
[677]349  Void      xDecodePPS(
350#if Q0048_CGS_3D_ASYMLUT
351    TCom3DAsymLUT * pc3DAsymLUT
352#endif
353    );
[313]354  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
355
[540]356#if NO_CLRAS_OUTPUT_FLAG
[666]357  Int  getNoClrasOutputFlag()                { return m_noClrasOutputFlag;}
358  Void setNoClrasOutputFlag(Bool x)          { m_noClrasOutputFlag = x;   }
[540]359  Int  getLayerInitializedFlag()             { return m_layerInitializedFlag;}
360  Void setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
361  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
362  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
363#endif
[677]364#if Q0048_CGS_3D_ASYMLUT
365  Void initAsymLut(TComSlice *pcSlice);
366#endif
[313]367};// END CLASS DEFINITION TDecTop
368
369
370//! \}
371
372#endif // __TDECTOP__
373
Note: See TracBrowser for help on using the repository browser.