source: 3DVCSoftware/branches/HTM-10.0-dev0/source/Lib/TLibDecoder/TDecTop.h @ 854

Last change on this file since 854 was 854, checked in by tech, 10 years ago

Integrated following MV-HEVC HLS 7 items:

H_MV_HLS7_GEN Stub for further integrations (not tested)
H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27
Output layer sets, various

(VPS/P0300/alt output layer flag) #27 Change alt output layer flag to be signalled within the loop of output layer sets, from JCTVC-P0300-v2. Decision: Adopt.
(VPS/P0156/Num of output_layer_flag) #10 Proposal 3: The output_layer_flag[ i ][ j ] is signalled for j equal to 0 to NumLayersInIdList[ lsIdx ] inclusive. It was remarked that we might be able to just assume that the top layer is always output; however, this was not entirely clear , so the safe thing to do may be to also send the flag for this layer.
(VPS/P0295/Default output layer sets) #5 Discussion from (P0110). Decision: Three-state approach (text in P0295, decoder shall allow 3 to be present and shall treat 3 the same as the value 2).

H_MV_HLS_7_HRD_P0156_7 (HRD/P0156/MaxSubLayersInLayerSetMinus1) #7 Proposal 1: signal, in the VPS extension, the DPB parameters for an output layer set for sub-DPBs only up to the maximum temporal sub-layers in the corresponding layer set
H_MV_HLS_7_VPS_P0048_14
(VPS/P0048/profile_ref_minus1 rem) #14 Remove profile_ref_minus1 from the VPS extension, from JCTVC-P0048
H_MV_HLS_7_VPS_P0076_15 (VPS/P0076/video signal info move) #15 Move video signal information syntax structure earlier in the VPS VUI.
H_MV_HLS_7_SPS_P0155_16_32
(SPS/P0155/sps_sub_layer_ordering_info) #16, #32 Not signal the sps_max_num_reorder_pics[], sps_max_latency_increase_plus1[], and sps_max_dec_pic_buffering_minus1[] syntax elements in the SPS when nuh_layer_id > 0.
H_MV_HLS_7_GEN_P0166_PPS_EXTENSION (GEN/P0166/pps_extension) #17 Add PPS extension type flags for conditional presence of syntax extensions per extension type, aligned with the SPS extension type flags, from JCTVC-P0166. Further align the SPS extension type flags syntax between RExt and MV-HEVC/SHVC
H_MV_HLS_7_FIX_SET_DPB_SIZE
Fix derivation dpb size parameters
H_MV_HLS_7_RESERVED_FLAGS Added flags

(SPS/P0312/SHVC reserved flag) The flag will be used for the syntax vert_phase_position_enable_flag in SHVC draft
(VPS/O0215/SHVC reserved flag): this flag will be used for the syntax cross_layer_phase_alignment_flag in SHVC draft.
(VPS VUI/O0199,P0312/SHVC reserved flags) the 3 reserved bits will be used for the syntaxes single_layer_for_non_irap_flag, higher_layer_irap_skip_flag and vert_phase_position_not_in_use_flag in SHVC draft.

H_MV_FIX_VPS_LAYER_ID_NOT_EQUAL_ZERO Discard VPS with nuh_layer_Id > 0
H_MV_HLS_7_MISC_P0130_EOS
(MISC/P0130/EOS NAL layer id) #19 Require that end of bitstream NAL unit shall have nuh_layer_id equal to 0, from JCTVC-P0130. Decoders shall allow an end of bitstream NAL unit with nuh_layer_id > 0 to be present, and shall ignore the NAL unit.
H_MV_HLS_7_MISC_P0182_13 (MISC/P0182/BL PS Compatibility flag) #13 Define the flag (in VPS VUI) with the proposed semantics, without specifying an associated extraction process. Editors to select the position in the VPS VUI.
H_MV_HLS_7_MISC_P0068_21
(MISC/P0068/all irap idr flag) #21 Add flag in VUI to indicate that all IRAP pictures are IDRs and that all layer pictures in an AU are IDR aligned, from JCTVC-P0068 proposal 1.
H_MV_HLS_7_FIX_INFER_CROSS_LAYER_IRAP_ALIGNED_FLAG Fix inference of cross_layer_irap_aligned_flag
H_MV_HLS_7_MISC_P0079_18
(MISC/P0079/NumActiveRefLayerPics) #18 Modification of derivation of variable NumActiveRefLayerPics.

  • Property svn:eol-style set to native
File size: 11.1 KB
Line 
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 *
6* Copyright (c) 2010-2014, ITU/ISO/IEC
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"
47
48#include "TDecGop.h"
49#include "TDecEntropy.h"
50#include "TDecSbac.h"
51#include "TDecCAVLC.h"
52#include "SEIread.h"
53
54struct InputNALUnit;
55
56//! \ingroup TLibDecoder
57//! \{
58
59// ====================================================================================================================
60// Class definition
61// ====================================================================================================================
62
63#if H_MV
64class TAppDecTop;
65#endif
66#if H_3D
67class CamParsCollector
68{
69public:
70  CamParsCollector  ();
71  ~CamParsCollector ();
72
73#if FIX_CAM_PARS_COLLECTOR
74  Void  init        ( FILE* pCodedScaleOffsetFile, TComVPS* vps );
75#else
76  Void  init        ( FILE* pCodedScaleOffsetFile );
77#endif
78
79  Void  uninit      ();
80  Void  setSlice    ( TComSlice* pcSlice );
81
82  Bool  isInitialized() const     { return m_bInitialized; }
83  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
84
85#if H_3D_IV_MERGE
86  Void  copyCamParamForSlice( TComSlice* pcSlice );
87#endif
88
89#if MTK_DDD_G0063
90  Int getCodedScale( Int iBaseView, Int iCureView){ return m_aaiCodedScale[ iBaseView ][ iCureView ];}
91  Int getCodedOffset( Int iBaseView, Int iCureView){ return m_aaiCodedOffset[ iBaseView ][ iCureView ];}
92  UInt getCamParsCodedPrecision(){ return m_vps->getCamParPrecision(); }
93#endif
94
95private:
96#if FIX_CAM_PARS_COLLECTOR
97  Void xResetReceivedIdc( Bool overWriteFlag ); 
98#else
99  Bool  xIsComplete ();
100#endif
101  Void  xOutput     ( Int iPOC );
102
103private:
104  Bool    m_bInitialized;
105  FILE*   m_pCodedScaleOffsetFile;
106
107  Int**   m_aaiCodedOffset;
108  Int**   m_aaiCodedScale;
109 
110#if !FIX_CAM_PARS_COLLECTOR
111  Int*    m_aiViewId; 
112#else
113  TComVPS* m_vps; 
114  Int**    m_receivedIdc; 
115  Int      m_uiMaxViewIndex; 
116  Int      m_lastPoc; 
117  Int      m_firstReceivedPoc; 
118#endif
119
120 
121#if !FIX_CAM_PARS_COLLECTOR
122  Bool*   m_bViewReceived;
123  UInt    m_uiCamParsCodedPrecision;
124#endif
125  Bool    m_bCamParsVaryOverTime;
126#if !FIX_CAM_PARS_COLLECTOR
127  Int     m_iLastViewIndex;
128  Int     m_iLastPOC;
129  UInt    m_uiMaxViewIndex;
130#endif
131
132
133  UInt    m_uiBitDepthForLUT;
134  UInt    m_iLog2Precision;
135  UInt    m_uiInputBitDepth;
136
137  // look-up tables
138  Double****   m_adBaseViewShiftLUT;       ///< Disparity LUT
139  Int****      m_aiBaseViewShiftLUT;       ///< Disparity LUT
140  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
141  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
142  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
143  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
144  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
145
146};
147
148template <class T>
149Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
150{
151  if( rpt )
152  {
153    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
154    {
155      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
156      {
157        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
158        {
159          delete[] rpt[ uiK ][ uiL ][ uiM ];
160        }
161        delete[] rpt[ uiK ][ uiL ];
162      }
163      delete[] rpt[ uiK ];
164    }
165    delete[] rpt;
166  }
167  rpt = NULL;
168};
169
170
171template <class T>
172Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
173{
174  if( rpt )
175  {
176    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
177    {
178      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
179      {
180        delete[] rpt[ uiK ][ uiL ];
181      }
182      delete[] rpt[ uiK ];
183    }
184    delete[] rpt;
185  }
186  rpt = NULL;
187};
188
189
190template <class T>
191Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
192{
193  if( rpt )
194  {
195    for( UInt uiK = 0; uiK < uiSize; uiK++ )
196    {
197      delete[] rpt[ uiK ];
198    }
199    delete[] rpt;
200  }
201  rpt = NULL;
202};
203
204#endif //H_3D
205/// decoder class
206class TDecTop
207{
208private:
209  Int                     m_iMaxRefPicNum;
210 
211  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
212  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
213  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
214
215  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
216#if H_MV
217  Bool*                    m_layerInitilizedFlag; // initialization Layers
218  static ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
219#else
220  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
221#endif
222  TComSlice*              m_apcSlicePilot;
223 
224  SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
225
226  // functional classes
227  TComPrediction          m_cPrediction;
228  TComTrQuant             m_cTrQuant;
229  TDecGop                 m_cGopDecoder;
230  TDecSlice               m_cSliceDecoder;
231  TDecCu                  m_cCuDecoder;
232  TDecEntropy             m_cEntropyDecoder;
233  TDecCavlc               m_cCavlcDecoder;
234  TDecSbac                m_cSbacDecoder;
235  TDecBinCABAC            m_cBinCABAC;
236  SEIReader               m_seiReader;
237  TComLoopFilter          m_cLoopFilter;
238  TComSampleAdaptiveOffset m_cSAO;
239
240  Bool isSkipPictureForBLA(Int& iPOCLastDisplay);
241  Bool isRandomAccessSkipPicture(Int& iSkipFrame,  Int& iPOCLastDisplay);
242  TComPic*                m_pcPic;
243  UInt                    m_uiSliceIdx;
244  Int                     m_prevPOC;
245  Bool                    m_bFirstSliceInPicture;
246  Bool                    m_bFirstSliceInSequence;
247  Bool                    m_prevSliceSkipped;
248  Int                     m_skippedPOC;
249
250#if H_MV
251  // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 
252  Int                     m_layerId;
253  Int                     m_viewId;
254  TComPicLists*           m_ivPicLists;
255  std::vector<TComPic*>   m_refPicSetInterLayer0; 
256  std::vector<TComPic*>   m_refPicSetInterLayer1; 
257#if H_3D
258  Int                     m_viewIndex; 
259  Bool                    m_isDepth;
260  CamParsCollector*       m_pcCamParsCollector;
261#endif
262#endif
263
264public:
265  TDecTop();
266  virtual ~TDecTop();
267 
268  Void  create  ();
269  Void  destroy ();
270
271  void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); }
272
273  Void  init();
274#if H_MV 
275  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer, Bool& sliceSkippedFlag );
276  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
277#else 
278  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
279#endif
280 
281  Void  deletePicBuffer();
282
283#if H_MV
284  Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic,  std::vector<Int>& targetDecLayerIdSet); 
285#else
286  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
287#endif
288 
289#if H_MV   
290  TComPic*                getPic                ( Int poc );
291  TComList<TComPic*>*     getListPic            ()               { return &m_cListPic;  } 
292  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
293  Void                    setLayerInitilizedFlags( Bool* val )    { m_layerInitilizedFlag = val; }
294  TComVPS*                getPrefetchedVPS      ()               { return m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); }; //Assuming that currently only one VPS is present.
295  Int                     getCurrPoc            ()               { return m_apcSlicePilot->getPOC(); }
296  Void                    setLayerId            ( Int layer)     { m_layerId = layer;   }
297  Int                     getLayerId            ()               { return m_layerId;    }
298  Void                    setViewId             ( Int viewId  )  { m_viewId  = viewId;  }
299  Int                     getViewId             ()               { return m_viewId;     } 
300#if H_3D   
301  Void                    setViewIndex          ( Int viewIndex  )  { m_viewIndex  = viewIndex;  }
302  Int                     getViewIndex          ()               { return m_viewIndex;     } 
303  Void                    setIsDepth            ( Bool isDepth ) { m_isDepth = isDepth; }
304  Bool                    getIsDepth            ()               { return m_isDepth;    }
305  Void                    setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
306#endif
307#endif
308protected:
309  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
310  Void  xCreateLostPicture (Int iLostPOC);
311
312  Void      xActivateParameterSets();
313#if H_MV 
314  TComPic*  xGetPic( Int layerId, Int poc ); 
315  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ); 
316  Void      xResetPocInPicBuffer();
317  Void      xCeckNoClrasOutput();
318
319  Bool      xAllRefLayersInitilized();
320#else
321  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
322#endif
323  Void      xDecodeVPS();
324  Void      xDecodeSPS();
325  Void      xDecodePPS();
326  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
327
328};// END CLASS DEFINITION TDecTop
329
330
331//! \}
332
333#endif // __TDECTOP__
334
Note: See TracBrowser for help on using the repository browser.