[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 | |
---|
| 40 | class TComOutputBitstream; |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | * Represents a single NALunit header and the associated RBSPayload |
---|
| 44 | */ |
---|
| 45 | struct NALUnit |
---|
| 46 | { |
---|
| 47 | NalUnitType m_nalUnitType; ///< nal_unit_type |
---|
| 48 | Bool m_nalRefFlag; ///< nal_ref_flag |
---|
[210] | 49 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[100] | 50 | unsigned m_layerId; |
---|
[77] | 51 | unsigned m_temporalId; ///< temporal_id |
---|
| 52 | #else |
---|
[56] | 53 | Int m_viewId; ///< view_id |
---|
| 54 | Bool m_isDepth; ///< is_depth |
---|
| 55 | unsigned m_temporalId; ///< temporal_id |
---|
| 56 | #endif |
---|
| 57 | |
---|
| 58 | /** construct an NALunit structure with given header values. */ |
---|
| 59 | NALUnit( |
---|
| 60 | NalUnitType nalUnitType, |
---|
| 61 | Bool nalRefFlag, |
---|
[210] | 62 | #if !VIDYO_VPS_INTEGRATION & !QC_MVHEVC_B0046 |
---|
[56] | 63 | Int viewId, |
---|
| 64 | Bool isDepth, |
---|
[77] | 65 | #else |
---|
| 66 | unsigned layerId, |
---|
| 67 | #endif |
---|
| 68 | unsigned temporalId = 0) |
---|
[56] | 69 | :m_nalUnitType (nalUnitType) |
---|
| 70 | ,m_nalRefFlag (nalRefFlag) |
---|
[210] | 71 | #if !VIDYO_VPS_INTEGRATION & !QC_MVHEVC_B0046 |
---|
[56] | 72 | ,m_viewId (viewId) |
---|
| 73 | ,m_isDepth (isDepth) |
---|
[77] | 74 | #else |
---|
| 75 | ,m_layerId (layerId) |
---|
| 76 | #endif |
---|
[56] | 77 | ,m_temporalId (temporalId) |
---|
| 78 | {} |
---|
| 79 | |
---|
| 80 | /** default constructor - no initialization; must be perfomed by user */ |
---|
| 81 | NALUnit() {} |
---|
| 82 | |
---|
| 83 | /** returns true if the NALunit is a slice NALunit */ |
---|
| 84 | bool isSlice() |
---|
| 85 | { |
---|
| 86 | return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR |
---|
[210] | 87 | #if !QC_REM_IDV_B0046 |
---|
[56] | 88 | || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV |
---|
[210] | 89 | #endif |
---|
[56] | 90 | || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA |
---|
| 91 | || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA |
---|
| 92 | || m_nalUnitType == NAL_UNIT_CODED_SLICE; |
---|
| 93 | } |
---|
| 94 | }; |
---|
| 95 | |
---|
| 96 | struct OutputNALUnit; |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * A single NALunit, with complete payload in EBSP format. |
---|
| 100 | */ |
---|
| 101 | struct NALUnitEBSP : public NALUnit |
---|
| 102 | { |
---|
| 103 | std::ostringstream m_nalUnitData; |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | * convert the OutputNALUnit #nalu# into EBSP format by writing out |
---|
| 107 | * the NALUnit header, then the rbsp_bytes including any |
---|
| 108 | * emulation_prevention_three_byte symbols. |
---|
| 109 | */ |
---|
| 110 | NALUnitEBSP(OutputNALUnit& nalu); |
---|
| 111 | }; |
---|
| 112 | //! \} |
---|
| 113 | //! \} |
---|