source: 3DVCSoftware/trunk/source/Lib/TLibCommon/NAL.h @ 254

Last change on this file since 254 was 210, checked in by tech, 12 years ago

Reintegrated /branches/HTM-5.0-dev0 rev. 207.

File size: 5.0 KB
RevLine 
[56]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-2012, 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#pragma once
35
36#include <vector>
37#include <sstream>
38#include "CommonDef.h"
39
40class TComOutputBitstream;
41
42/**
43 * Represents a single NALunit header and the associated RBSPayload
44 */
45struct NALUnit
46{
47  NalUnitType m_nalUnitType; ///< nal_unit_type
48#if NAL_REF_FLAG
49  Bool        m_nalRefFlag;  ///< nal_ref_flag
50#else
51  NalRefIdc   m_nalRefIDC;   ///< nal_ref_idc
52#endif
[210]53#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
[100]54  unsigned    m_layerId;
[77]55  unsigned    m_temporalId;  ///< temporal_id
56#else
[56]57  Int         m_viewId;      ///< view_id
58  Bool        m_isDepth;     ///< is_depth
59  unsigned    m_temporalId;  ///< temporal_id
60#if !H0388
61  bool        m_OutputFlag;  ///< output_flag
62#endif
[77]63#endif
[56]64
65  /** construct an NALunit structure with given header values. */
66#if H0388
67#if NAL_REF_FLAG
68  NALUnit(
69    NalUnitType nalUnitType,
70    Bool        nalRefFlag,
[210]71#if !VIDYO_VPS_INTEGRATION & !QC_MVHEVC_B0046   
[56]72    Int         viewId,
73    Bool        isDepth,
[77]74#else
75    unsigned    layerId,
76#endif
77    unsigned       temporalId = 0)
[56]78    :m_nalUnitType (nalUnitType)
79    ,m_nalRefFlag  (nalRefFlag)
[210]80#if !VIDYO_VPS_INTEGRATION & !QC_MVHEVC_B0046
[56]81    ,m_viewId      (viewId)
82    ,m_isDepth     (isDepth)
[77]83#else
84    ,m_layerId     (layerId)
85#endif
[56]86    ,m_temporalId  (temporalId)
87  {}
88#else
89  NALUnit(
90    NalUnitType  nalUnitType,
91    NalRefIdc    nalRefIDC,
92    Int          viewId,
93    Bool         isDepth,
94    unsigned temporalID = 0)
95  {
96    m_nalUnitType = nalUnitType;
97    m_nalRefIDC   = nalRefIDC;
[77]98#if !VIDYO_VPS_INTEGRATION
[56]99    m_viewId      = viewId;
100    m_isDepth     = isDepth;
[77]101#else
[100]102    m_layerId = layerId;
[77]103#endif
[56]104    m_temporalId  = temporalID;
105  }
106#endif
107#else
108  NALUnit(
109    NalUnitType  nalUnitType,
110    NalRefIdc    nalRefIDC,
[77]111#if !VIDYO_VPS_INTEGRATION   
[56]112    Int          viewId,
113    Bool         isDepth,
[77]114#else
115    unsigned         layerId,
116#endif
[56]117    unsigned     temporalID = 0,
118    bool         outputFlag = true)
119  {
120    m_nalUnitType = nalUnitType;
121    m_nalRefIDC   = nalRefIDC;
[77]122#if !VIDYO_VPS_INTEGRATION
[56]123    m_viewId      = viewId;
124    m_isDepth     = isDepth;
[77]125#else
[100]126    m_layerId = layerId;
[77]127#endif
[56]128    m_temporalId  = temporalID;
129    m_OutputFlag  = outputFlag;
130  }
131#endif
132
133  /** default constructor - no initialization; must be perfomed by user */
134  NALUnit() {}
135
136  /** returns true if the NALunit is a slice NALunit */
137  bool isSlice()
138  {
139    return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
140#if H0566_TLA
[210]141#if !QC_REM_IDV_B0046   
[56]142        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV
[210]143#endif
[56]144        || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA
145        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA
146#else
147        || m_nalUnitType == NAL_UNIT_CODED_SLICE_CDR
148#endif
149        || m_nalUnitType == NAL_UNIT_CODED_SLICE;
150  }
151};
152
153struct OutputNALUnit;
154
155/**
156 * A single NALunit, with complete payload in EBSP format.
157 */
158struct NALUnitEBSP : public NALUnit
159{
160  std::ostringstream m_nalUnitData;
161
162  /**
163   * convert the OutputNALUnit #nalu# into EBSP format by writing out
164   * the NALUnit header, then the rbsp_bytes including any
165   * emulation_prevention_three_byte symbols.
166   */
167  NALUnitEBSP(OutputNALUnit& nalu);
168};
169//! \}
170//! \}
Note: See TracBrowser for help on using the repository browser.