Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibDecoder
- Timestamp:
- 1 Sep 2013, 22:47:26 (11 years ago)
- Location:
- trunk/source/Lib/TLibDecoder
- Files:
-
- 2 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/AnnexBread.cpp
r56 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 31 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 32 */ 33 34 /** 35 \file AnnexBread.cpp 36 \brief reading functions for Annex B byte streams 37 */ 38 33 39 34 40 #include <stdint.h> … … 111 117 */ 112 118 /* NB, (unsigned)x > 2 implies n!=0 && n!=1 */ 113 while (bs.eofBeforeNBytes(24/8) || bs.peekBytes(24/8) > 1) // since 0x000002 tile marker may exist in the bitstream119 while (bs.eofBeforeNBytes(24/8) || bs.peekBytes(24/8) > 2) 114 120 { 115 121 nalUnit.push_back(bs.readByte()); … … 147 153 * otherwise true. 148 154 */ 149 bool155 Bool 150 156 byteStreamNALUnit( 151 157 InputByteStream& bs, … … 153 159 AnnexBStats& stats) 154 160 { 155 bool eof = false;161 Bool eof = false; 156 162 try 157 163 { … … 162 168 eof = true; 163 169 } 164 stats.m_numBytesInNALUnit = unsigned(nalUnit.size());170 stats.m_numBytesInNALUnit = UInt(nalUnit.size()); 165 171 return eof; 166 172 } -
trunk/source/Lib/TLibDecoder/AnnexBread.h
r56 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 32 32 */ 33 33 34 /** 35 \file AnnexBread.h 36 \brief reading functions for Annex B byte streams 37 */ 38 34 39 #pragma once 35 40 … … 37 42 #include <istream> 38 43 #include <vector> 44 45 #include "../TLibCommon/TypeDef.h" 39 46 40 47 //! \ingroup TLibDecoder … … 75 82 * n bytes. 76 83 */ 77 bool eofBeforeNBytes(unsignedn)84 Bool eofBeforeNBytes(UInt n) 78 85 { 79 86 assert(n <= 4); … … 84 91 try 85 92 { 86 for ( unsignedi = 0; i < n; i++)93 for (UInt i = 0; i < n; i++) 87 94 { 88 95 m_FutureBytes = (m_FutureBytes << 8) | m_Input.get(); … … 109 116 * 110 117 */ 111 uint32_t peekBytes( unsignedn)118 uint32_t peekBytes(UInt n) 112 119 { 113 120 eofBeforeNBytes(n); … … 139 146 * the return value. 140 147 */ 141 uint32_t readBytes( unsignedn)148 uint32_t readBytes(UInt n) 142 149 { 143 150 uint32_t val = 0; 144 for ( unsignedi = 0; i < n; i++)151 for (UInt i = 0; i < n; i++) 145 152 val = (val << 8) | readByte(); 146 153 return val; … … 148 155 149 156 private: 150 unsignedm_NumFutureBytes; /* number of valid bytes in m_FutureBytes */157 UInt m_NumFutureBytes; /* number of valid bytes in m_FutureBytes */ 151 158 uint32_t m_FutureBytes; /* bytes that have been peeked */ 152 159 std::istream& m_Input; /* Input stream to read from */ … … 158 165 struct AnnexBStats 159 166 { 160 unsignedm_numLeadingZero8BitsBytes;161 unsignedm_numZeroByteBytes;162 unsignedm_numStartCodePrefixBytes;163 unsignedm_numBytesInNALUnit;164 unsignedm_numTrailingZero8BitsBytes;167 UInt m_numLeadingZero8BitsBytes; 168 UInt m_numZeroByteBytes; 169 UInt m_numStartCodePrefixBytes; 170 UInt m_numBytesInNALUnit; 171 UInt m_numTrailingZero8BitsBytes; 165 172 166 173 AnnexBStats& operator+=(const AnnexBStats& rhs) … … 175 182 }; 176 183 177 bool byteStreamNALUnit(InputByteStream& bs, std::vector<uint8_t>& nalUnit, AnnexBStats& stats);184 Bool byteStreamNALUnit(InputByteStream& bs, std::vector<uint8_t>& nalUnit, AnnexBStats& stats); 178 185 179 186 //! \} -
trunk/source/Lib/TLibDecoder/NALread.cpp
r296 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 32 32 */ 33 33 34 /** 35 \file NALread.cpp 36 \brief reading funtionality for NAL units 37 */ 38 39 34 40 #include <vector> 35 41 #include <algorithm> … … 44 50 //! \ingroup TLibDecoder 45 51 //! \{ 46 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream * pcBitstream)52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit) 47 53 { 48 unsignedzeroCount = 0;54 UInt zeroCount = 0; 49 55 vector<uint8_t>::iterator it_read, it_write; 50 56 51 UInt *auiStoredTileMarkerLocation = new UInt[MAX_MARKER_PER_NALU];52 // Remove tile markers and note the bitstream location53 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++ 57 UInt pos = 0; 58 bitstream->clearEmulationPreventionByteLocation(); 59 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++, pos++) 54 60 { 55 Bool bTileMarkerFound = false; 56 if ( ( it_read - nalUnitBuf.begin() ) < ( nalUnitBuf.size() - 2 ) ) 57 { 58 if ( (*(it_read) == 0x00) && (*(it_read+1) == 0x00) && (*(it_read+2) == 0x02) ) // tile marker detected 59 { 60 it_read += 2; 61 UInt uiDistance = (UInt) (it_write - nalUnitBuf.begin()); 62 UInt uiCount = pcBitstream->getTileMarkerLocationCount(); 63 bTileMarkerFound = true; 64 pcBitstream->setTileMarkerLocation( uiCount, uiDistance ); 65 auiStoredTileMarkerLocation[uiCount] = uiDistance; 66 pcBitstream->setTileMarkerLocationCount( uiCount + 1 ); 67 68 } 69 } 70 71 if (!bTileMarkerFound) 72 { 73 *it_write = *it_read; 74 it_write++; 75 } 76 } 77 nalUnitBuf.resize(it_write - nalUnitBuf.begin()); 78 79 for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++) 80 { 61 assert(zeroCount < 2 || *it_read >= 0x03); 81 62 if (zeroCount == 2 && *it_read == 0x03) 82 63 { 83 // update tile marker location 84 UInt uiDistance = (UInt) (it_read - nalUnitBuf.begin()); 85 for (UInt uiIdx=0; uiIdx<pcBitstream->getTileMarkerLocationCount(); uiIdx++) 86 { 87 if (auiStoredTileMarkerLocation[ uiIdx ] >= uiDistance) 88 { 89 pcBitstream->setTileMarkerLocation( uiIdx, pcBitstream->getTileMarkerLocation( uiIdx )-1 ); 90 } 91 } 64 bitstream->pushEmulationPreventionByteLocation( pos ); 65 pos++; 92 66 it_read++; 93 67 zeroCount = 0; 68 if (it_read == nalUnitBuf.end()) 69 { 70 break; 71 } 94 72 } 95 73 zeroCount = (*it_read == 0x00) ? zeroCount+1 : 0; 96 74 *it_write = *it_read; 97 75 } 76 assert(zeroCount == 0); 77 78 if (isVclNalUnit) 79 { 80 // Remove cabac_zero_word from payload if present 81 Int n = 0; 82 83 while (it_write[-1] == 0x00) 84 { 85 it_write--; 86 n++; 87 } 88 89 if (n > 0) 90 { 91 printf("\nDetected %d instances of cabac_zero_word", n/2); 92 } 93 } 98 94 99 95 nalUnitBuf.resize(it_write - nalUnitBuf.begin()); 100 delete [] auiStoredTileMarkerLocation;101 96 } 102 97 98 Void readNalUnitHeader(InputNALUnit& nalu) 99 { 100 TComInputBitstream& bs = *nalu.m_Bitstream; 101 102 Bool forbidden_zero_bit = bs.read(1); // forbidden_zero_bit 103 assert(forbidden_zero_bit == 0); 104 nalu.m_nalUnitType = (NalUnitType) bs.read(6); // nal_unit_type 105 #if H_MV 106 nalu.m_layerId = bs.read(6); // layerId 107 #else 108 nalu.m_reservedZero6Bits = bs.read(6); // nuh_reserved_zero_6bits 109 assert(nalu.m_reservedZero6Bits == 0); 110 #endif 111 nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1 112 113 if ( nalu.m_temporalId ) 114 { 115 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP 116 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL 117 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP 118 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL 119 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP 120 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA 121 && nalu.m_nalUnitType != NAL_UNIT_VPS 122 && nalu.m_nalUnitType != NAL_UNIT_SPS 123 && nalu.m_nalUnitType != NAL_UNIT_EOS 124 && nalu.m_nalUnitType != NAL_UNIT_EOB ); 125 } 126 else 127 { 128 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R 129 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N 130 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R 131 && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_N ); 132 } 133 } 103 134 /** 104 135 * create a NALunit structure with given header values and storage for … … 109 140 /* perform anti-emulation prevention */ 110 141 TComInputBitstream *pcBitstream = new TComInputBitstream(NULL); 111 convertPayloadToRBSP(nalUnitBuf, pcBitstream );112 142 convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0); 143 113 144 nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf); 114 // copy the tile marker location information 115 nalu.m_Bitstream->setTileMarkerLocationCount( pcBitstream->getTileMarkerLocationCount() ); 116 for (UInt uiIdx=0; uiIdx < nalu.m_Bitstream->getTileMarkerLocationCount(); uiIdx++) 117 { 118 nalu.m_Bitstream->setTileMarkerLocation( uiIdx, pcBitstream->getTileMarkerLocation(uiIdx) ); 119 } 145 nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation()); 120 146 delete pcBitstream; 121 TComInputBitstream& bs = *nalu.m_Bitstream; 122 123 bool forbidden_zero_bit = bs.read(1); 124 assert(forbidden_zero_bit == 0); 125 126 nalu.m_nalRefFlag = (bs.read(1) != 0 ); 127 nalu.m_nalUnitType = (NalUnitType) bs.read(6); 128 129 #if QC_MVHEVC_B0046 130 //nalu.m_layerId = bs.read(6); 131 nalu.m_layerId = bs.read(5); 132 nalu.m_temporalId = bs.read(3) - 1; 133 #else 134 nalu.m_temporalId = bs.read(3); 135 // unsigned reserved_one_5bits = bs.read(5); 136 // assert(reserved_one_5bits == 1); 137 #if VIDYO_VPS_INTEGRATION 138 nalu.m_layerId = bs.read(5) - 1; 139 #else 140 nalu.m_viewId = bs.read(4)-1; 141 nalu.m_isDepth = bs.read(1); 142 #endif 143 if ( nalu.m_temporalId ) 144 { 145 #if QC_REM_IDV_B0046 146 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR); 147 #else 148 assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDV ); 149 #endif 150 } 151 #endif 147 readNalUnitHeader(nalu); 152 148 } 153 149 //! \} -
trunk/source/Lib/TLibDecoder/NALread.h
r56 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 32 32 */ 33 33 34 /** 35 \file NALread.h 36 \brief reading funtionality for NAL units 37 */ 38 34 39 #pragma once 35 40 … … 47 52 struct InputNALUnit : public NALUnit 48 53 { 54 InputNALUnit() : m_Bitstream(0) {}; 55 ~InputNALUnit() { delete m_Bitstream; } 56 49 57 TComInputBitstream* m_Bitstream; 50 58 }; -
trunk/source/Lib/TLibDecoder/SEIread.cpp
r56 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 32 32 */ 33 33 34 /** 35 \file SEIread.cpp 36 \brief reading functionality for SEI messages 37 */ 38 39 #include "TLibCommon/CommonDef.h" 34 40 #include "TLibCommon/TComBitStream.h" 35 41 #include "TLibCommon/SEI.h" 42 #include "TLibCommon/TComSlice.h" 43 #include "SyntaxElementParser.h" 36 44 #include "SEIread.h" 37 45 … … 39 47 //! \{ 40 48 41 static void parseSEIuserDataUnregistered(TComInputBitstream& bs, SEIuserDataUnregistered &sei, unsigned payloadSize); 42 static void parseSEIpictureDigest(TComInputBitstream& bs, SEIpictureDigest& sei, unsigned payloadSize); 49 #if ENC_DEC_TRACE 50 Void xTraceSEIHeader() 51 { 52 fprintf( g_hTrace, "=========== SEI message ===========\n"); 53 } 54 55 Void xTraceSEIMessageType(SEI::PayloadType payloadType) 56 { 57 switch (payloadType) 58 { 59 case SEI::DECODED_PICTURE_HASH: 60 fprintf( g_hTrace, "=========== Decoded picture hash SEI message ===========\n"); 61 break; 62 case SEI::USER_DATA_UNREGISTERED: 63 fprintf( g_hTrace, "=========== User Data Unregistered SEI message ===========\n"); 64 break; 65 case SEI::ACTIVE_PARAMETER_SETS: 66 fprintf( g_hTrace, "=========== Active Parameter sets SEI message ===========\n"); 67 break; 68 case SEI::BUFFERING_PERIOD: 69 fprintf( g_hTrace, "=========== Buffering period SEI message ===========\n"); 70 break; 71 case SEI::PICTURE_TIMING: 72 fprintf( g_hTrace, "=========== Picture timing SEI message ===========\n"); 73 break; 74 case SEI::RECOVERY_POINT: 75 fprintf( g_hTrace, "=========== Recovery point SEI message ===========\n"); 76 break; 77 case SEI::FRAME_PACKING: 78 fprintf( g_hTrace, "=========== Frame Packing Arrangement SEI message ===========\n"); 79 break; 80 case SEI::DISPLAY_ORIENTATION: 81 fprintf( g_hTrace, "=========== Display Orientation SEI message ===========\n"); 82 break; 83 case SEI::TEMPORAL_LEVEL0_INDEX: 84 fprintf( g_hTrace, "=========== Temporal Level Zero Index SEI message ===========\n"); 85 break; 86 case SEI::REGION_REFRESH_INFO: 87 fprintf( g_hTrace, "=========== Gradual Decoding Refresh Information SEI message ===========\n"); 88 break; 89 case SEI::DECODING_UNIT_INFO: 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 break; 92 case SEI::TONE_MAPPING_INFO: 93 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 94 break; 95 case SEI::SOP_DESCRIPTION: 96 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 97 break; 98 case SEI::SCALABLE_NESTING: 99 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 100 break; 101 default: 102 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); 103 break; 104 } 105 } 106 #endif 43 107 44 108 /** 45 109 * unmarshal a single SEI message from bitstream bs 46 110 */ 47 void parseSEImessage(TComInputBitstream& bs, SEImessages& seis) 48 { 49 unsigned payloadType = 0; 50 for (unsigned char byte = 0xff; 0xff == byte; ) 51 { 52 payloadType += byte = bs.read(8); 53 } 54 55 unsigned payloadSize = 0; 56 for (unsigned char byte = 0xff; 0xff == byte; ) 57 { 58 payloadSize += byte = bs.read(8); 59 } 60 61 switch (payloadType) 62 { 63 case SEI::USER_DATA_UNREGISTERED: 64 seis.user_data_unregistered = new SEIuserDataUnregistered; 65 parseSEIuserDataUnregistered(bs, *seis.user_data_unregistered, payloadSize); 66 break; 67 case SEI::PICTURE_DIGEST: 68 seis.picture_digest = new SEIpictureDigest; 69 parseSEIpictureDigest(bs, *seis.picture_digest, payloadSize); 70 break; 71 default: 72 assert(!"Unhandled SEI message"); 73 } 111 void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) 112 { 113 setBitstream(bs); 114 115 assert(!m_pcBitstream->getNumBitsUntilByteAligned()); 116 do 117 { 118 xReadSEImessage(seis, nalUnitType, sps); 119 /* SEI messages are an integer number of bytes, something has failed 120 * in the parsing if bitstream not byte-aligned */ 121 assert(!m_pcBitstream->getNumBitsUntilByteAligned()); 122 } while (m_pcBitstream->getNumBitsLeft() > 8); 123 124 UInt rbspTrailingBits; 125 READ_CODE(8, rbspTrailingBits, "rbsp_trailing_bits"); 126 assert(rbspTrailingBits == 0x80); 127 } 128 129 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) 130 { 131 #if ENC_DEC_TRACE 132 xTraceSEIHeader(); 133 #endif 134 Int payloadType = 0; 135 UInt val = 0; 136 137 do 138 { 139 READ_CODE (8, val, "payload_type"); 140 payloadType += val; 141 } while (val==0xFF); 142 143 UInt payloadSize = 0; 144 do 145 { 146 READ_CODE (8, val, "payload_size"); 147 payloadSize += val; 148 } while (val==0xFF); 149 150 #if ENC_DEC_TRACE 151 xTraceSEIMessageType((SEI::PayloadType)payloadType); 152 #endif 153 154 /* extract the payload for this single SEI message. 155 * This allows greater safety in erroneous parsing of an SEI message 156 * from affecting subsequent messages. 157 * After parsing the payload, bs needs to be restored as the primary 158 * bitstream. 159 */ 160 TComInputBitstream *bs = getBitstream(); 161 setBitstream(bs->extractSubstream(payloadSize * 8)); 162 163 SEI *sei = NULL; 164 165 if(nalUnitType == NAL_UNIT_PREFIX_SEI) 166 { 167 switch (payloadType) 168 { 169 case SEI::USER_DATA_UNREGISTERED: 170 sei = new SEIuserDataUnregistered; 171 xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); 172 break; 173 case SEI::ACTIVE_PARAMETER_SETS: 174 sei = new SEIActiveParameterSets; 175 xParseSEIActiveParameterSets((SEIActiveParameterSets&) *sei, payloadSize); 176 break; 177 case SEI::DECODING_UNIT_INFO: 178 if (!sps) 179 { 180 printf ("Warning: Found Decoding unit SEI message, but no active SPS is available. Ignoring."); 181 } 182 else 183 { 184 sei = new SEIDecodingUnitInfo; 185 xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps); 186 } 187 break; 188 case SEI::BUFFERING_PERIOD: 189 if (!sps) 190 { 191 printf ("Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring."); 192 } 193 else 194 { 195 sei = new SEIBufferingPeriod; 196 xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps); 197 } 198 break; 199 case SEI::PICTURE_TIMING: 200 if (!sps) 201 { 202 printf ("Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring."); 203 } 204 else 205 { 206 sei = new SEIPictureTiming; 207 xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps); 208 } 209 break; 210 case SEI::RECOVERY_POINT: 211 sei = new SEIRecoveryPoint; 212 xParseSEIRecoveryPoint((SEIRecoveryPoint&) *sei, payloadSize); 213 break; 214 case SEI::FRAME_PACKING: 215 sei = new SEIFramePacking; 216 xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize); 217 break; 218 case SEI::DISPLAY_ORIENTATION: 219 sei = new SEIDisplayOrientation; 220 xParseSEIDisplayOrientation((SEIDisplayOrientation&) *sei, payloadSize); 221 break; 222 case SEI::TEMPORAL_LEVEL0_INDEX: 223 sei = new SEITemporalLevel0Index; 224 xParseSEITemporalLevel0Index((SEITemporalLevel0Index&) *sei, payloadSize); 225 break; 226 case SEI::REGION_REFRESH_INFO: 227 sei = new SEIGradualDecodingRefreshInfo; 228 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 229 break; 230 case SEI::TONE_MAPPING_INFO: 231 sei = new SEIToneMappingInfo; 232 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 233 break; 234 case SEI::SOP_DESCRIPTION: 235 sei = new SEISOPDescription; 236 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 237 break; 238 case SEI::SCALABLE_NESTING: 239 sei = new SEIScalableNesting; 240 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 241 break; 242 default: 243 for (UInt i = 0; i < payloadSize; i++) 244 { 245 UInt seiByte; 246 READ_CODE (8, seiByte, "unknown prefix SEI payload byte"); 247 } 248 printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType); 249 } 250 } 251 else 252 { 253 switch (payloadType) 254 { 255 case SEI::USER_DATA_UNREGISTERED: 256 sei = new SEIuserDataUnregistered; 257 xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); 258 break; 259 case SEI::DECODED_PICTURE_HASH: 260 sei = new SEIDecodedPictureHash; 261 xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize); 262 break; 263 default: 264 for (UInt i = 0; i < payloadSize; i++) 265 { 266 UInt seiByte; 267 READ_CODE (8, seiByte, "unknown suffix SEI payload byte"); 268 } 269 printf ("Unknown suffix SEI message (payloadType = %d) was found!\n", payloadType); 270 } 271 } 272 if (sei != NULL) 273 { 274 seis.push_back(sei); 275 } 276 277 /* By definition the underlying bitstream terminates in a byte-aligned manner. 278 * 1. Extract all bar the last MIN(bitsremaining,nine) bits as reserved_payload_extension_data 279 * 2. Examine the final 8 bits to determine the payload_bit_equal_to_one marker 280 * 3. Extract the remainingreserved_payload_extension_data bits. 281 * 282 * If there are fewer than 9 bits available, extract them. 283 */ 284 Int payloadBitsRemaining = getBitstream()->getNumBitsLeft(); 285 if (payloadBitsRemaining) /* more_data_in_payload() */ 286 { 287 for (; payloadBitsRemaining > 9; payloadBitsRemaining--) 288 { 289 UInt reservedPayloadExtensionData; 290 READ_CODE (1, reservedPayloadExtensionData, "reserved_payload_extension_data"); 291 } 292 293 /* 2 */ 294 Int finalBits = getBitstream()->peekBits(payloadBitsRemaining); 295 Int finalPayloadBits = 0; 296 for (Int mask = 0xff; finalBits & (mask >> finalPayloadBits); finalPayloadBits++) 297 { 298 continue; 299 } 300 301 /* 3 */ 302 for (; payloadBitsRemaining > 9 - finalPayloadBits; payloadBitsRemaining--) 303 { 304 UInt reservedPayloadExtensionData; 305 READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data"); 306 } 307 308 UInt dummy; 309 READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--; 310 while (payloadBitsRemaining) 311 { 312 READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--; 313 } 314 } 315 316 /* restore primary bitstream for sei_message */ 317 delete getBitstream(); 318 setBitstream(bs); 74 319 } 75 320 … … 78 323 * of payloasSize bytes into sei. 79 324 */ 80 static void parseSEIuserDataUnregistered(TComInputBitstream& bs, SEIuserDataUnregistered &sei, unsignedpayloadSize)325 Void SEIReader::xParseSEIuserDataUnregistered(SEIuserDataUnregistered &sei, UInt payloadSize) 81 326 { 82 327 assert(payloadSize >= 16); 83 for (unsigned i = 0; i < 16; i++) 84 { 85 sei.uuid_iso_iec_11578[i] = bs.read(8); 328 UInt val; 329 330 for (UInt i = 0; i < 16; i++) 331 { 332 READ_CODE (8, val, "uuid_iso_iec_11578"); 333 sei.uuid_iso_iec_11578[i] = val; 86 334 } 87 335 … … 93 341 } 94 342 95 sei.userData = new unsigned char[sei.userDataLength]; 96 for (unsigned i = 0; i < sei.userDataLength; i++) 97 { 98 sei.userData[i] = bs.read(8); 343 sei.userData = new UChar[sei.userDataLength]; 344 for (UInt i = 0; i < sei.userDataLength; i++) 345 { 346 READ_CODE (8, val, "user_data" ); 347 sei.userData[i] = val; 99 348 } 100 349 } 101 350 102 351 /** 103 * parse bitstream bs and unpack a picture_digestSEI message352 * parse bitstream bs and unpack a decoded picture hash SEI message 104 353 * of payloadSize bytes into sei. 105 354 */ 106 static void parseSEIpictureDigest(TComInputBitstream& bs, SEIpictureDigest& sei, unsigned payloadSize) 107 { 108 assert(payloadSize >= 17); 109 sei.method = static_cast<SEIpictureDigest::Method>(bs.read(8)); 110 assert(SEIpictureDigest::MD5 == sei.method); 111 for (unsigned i = 0; i < 16; i++) 112 { 113 sei.digest[i] = bs.read(8); 114 } 115 } 116 355 Void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, UInt /*payloadSize*/) 356 { 357 UInt val; 358 READ_CODE (8, val, "hash_type"); 359 sei.method = static_cast<SEIDecodedPictureHash::Method>(val); 360 for(Int yuvIdx = 0; yuvIdx < 3; yuvIdx++) 361 { 362 if(SEIDecodedPictureHash::MD5 == sei.method) 363 { 364 for (UInt i = 0; i < 16; i++) 365 { 366 READ_CODE(8, val, "picture_md5"); 367 sei.digest[yuvIdx][i] = val; 368 } 369 } 370 else if(SEIDecodedPictureHash::CRC == sei.method) 371 { 372 READ_CODE(16, val, "picture_crc"); 373 sei.digest[yuvIdx][0] = val >> 8 & 0xFF; 374 sei.digest[yuvIdx][1] = val & 0xFF; 375 } 376 else if(SEIDecodedPictureHash::CHECKSUM == sei.method) 377 { 378 READ_CODE(32, val, "picture_checksum"); 379 sei.digest[yuvIdx][0] = (val>>24) & 0xff; 380 sei.digest[yuvIdx][1] = (val>>16) & 0xff; 381 sei.digest[yuvIdx][2] = (val>>8) & 0xff; 382 sei.digest[yuvIdx][3] = val & 0xff; 383 } 384 } 385 } 386 Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt /*payloadSize*/) 387 { 388 UInt val; 389 READ_CODE(4, val, "active_vps_id"); sei.activeVPSId = val; 390 READ_FLAG( val, "full_random_access_flag"); sei.m_fullRandomAccessFlag = val ? true : false; 391 READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false; 392 READ_UVLC( val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val; 393 394 sei.activeSeqParamSetId.resize(sei.numSpsIdsMinus1 + 1); 395 for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++) 396 { 397 READ_UVLC(val, "active_seq_param_set_id"); sei.activeSeqParamSetId[i] = val; 398 } 399 400 UInt uibits = m_pcBitstream->getNumBitsUntilByteAligned(); 401 402 while(uibits--) 403 { 404 READ_FLAG(val, "alignment_bit"); 405 } 406 } 407 408 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt /*payloadSize*/, TComSPS *sps) 409 { 410 UInt val; 411 READ_UVLC(val, "decoding_unit_idx"); 412 sei.m_decodingUnitIdx = val; 413 414 TComVUI *vui = sps->getVuiParameters(); 415 if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) 416 { 417 READ_CODE( ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay"); 418 sei.m_duSptCpbRemovalDelay = val; 419 } 420 else 421 { 422 sei.m_duSptCpbRemovalDelay = 0; 423 } 424 READ_FLAG( val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = val ? true : false; 425 if(sei.m_dpbOutputDuDelayPresentFlag) 426 { 427 READ_CODE(vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); 428 sei.m_picSptDpbOutputDuDelay = val; 429 } 430 xParseByteAlign(); 431 } 432 433 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt /*payloadSize*/, TComSPS *sps) 434 { 435 Int i, nalOrVcl; 436 UInt code; 437 438 TComVUI *pVUI = sps->getVuiParameters(); 439 TComHRD *pHRD = pVUI->getHrdParameters(); 440 441 READ_UVLC( code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code; 442 if( !pHRD->getSubPicCpbParamsPresentFlag() ) 443 { 444 READ_FLAG( code, "rap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; 445 } 446 //read splicing flag and cpb_removal_delay_delta 447 READ_FLAG( code, "concatenation_flag"); 448 sei.m_concatenationFlag = code; 449 READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); 450 sei.m_auCpbRemovalDelayDelta = code + 1; 451 if( sei.m_rapCpbParamsPresentFlag ) 452 { 453 READ_CODE( pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" ); sei.m_cpbDelayOffset = code; 454 READ_CODE( pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; 455 } 456 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 457 { 458 if( ( ( nalOrVcl == 0 ) && ( pHRD->getNalHrdParametersPresentFlag() ) ) || 459 ( ( nalOrVcl == 1 ) && ( pHRD->getVclHrdParametersPresentFlag() ) ) ) 460 { 461 for( i = 0; i < ( pHRD->getCpbCntMinus1( 0 ) + 1 ); i ++ ) 462 { 463 READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_cpb_removal_delay" ); 464 sei.m_initialCpbRemovalDelay[i][nalOrVcl] = code; 465 READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_cpb_removal_delay_offset" ); 466 sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl] = code; 467 if( pHRD->getSubPicCpbParamsPresentFlag() || sei.m_rapCpbParamsPresentFlag ) 468 { 469 READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_alt_cpb_removal_delay" ); 470 sei.m_initialAltCpbRemovalDelay[i][nalOrVcl] = code; 471 READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_alt_cpb_removal_delay_offset" ); 472 sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl] = code; 473 } 474 } 475 } 476 } 477 xParseByteAlign(); 478 } 479 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt /*payloadSize*/, TComSPS *sps) 480 { 481 Int i; 482 UInt code; 483 484 TComVUI *vui = sps->getVuiParameters(); 485 TComHRD *hrd = vui->getHrdParameters(); 486 487 if( vui->getFrameFieldInfoPresentFlag() ) 488 { 489 READ_CODE( 4, code, "pic_struct" ); sei.m_picStruct = code; 490 READ_CODE( 2, code, "source_scan_type" ); sei.m_sourceScanType = code; 491 READ_FLAG( code, "duplicate_flag" ); sei.m_duplicateFlag = ( code == 1 ? true : false ); 492 } 493 494 if( hrd->getCpbDpbDelaysPresentFlag()) 495 { 496 READ_CODE( ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); 497 sei.m_auCpbRemovalDelay = code + 1; 498 READ_CODE( ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), code, "pic_dpb_output_delay" ); 499 sei.m_picDpbOutputDelay = code; 500 501 if(hrd->getSubPicCpbParamsPresentFlag()) 502 { 503 READ_CODE(hrd->getDpbOutputDelayDuLengthMinus1()+1, code, "pic_dpb_output_du_delay" ); 504 sei.m_picDpbOutputDuDelay = code; 505 } 506 if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) 507 { 508 READ_UVLC( code, "num_decoding_units_minus1"); 509 sei.m_numDecodingUnitsMinus1 = code; 510 READ_FLAG( code, "du_common_cpb_removal_delay_flag" ); 511 sei.m_duCommonCpbRemovalDelayFlag = code; 512 if( sei.m_duCommonCpbRemovalDelayFlag ) 513 { 514 READ_CODE( ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_common_cpb_removal_delay_minus1" ); 515 sei.m_duCommonCpbRemovalDelayMinus1 = code; 516 } 517 if( sei.m_numNalusInDuMinus1 != NULL ) 518 { 519 delete sei.m_numNalusInDuMinus1; 520 } 521 sei.m_numNalusInDuMinus1 = new UInt[ ( sei.m_numDecodingUnitsMinus1 + 1 ) ]; 522 if( sei.m_duCpbRemovalDelayMinus1 != NULL ) 523 { 524 delete sei.m_duCpbRemovalDelayMinus1; 525 } 526 sei.m_duCpbRemovalDelayMinus1 = new UInt[ ( sei.m_numDecodingUnitsMinus1 + 1 ) ]; 527 528 for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ ) 529 { 530 READ_UVLC( code, "num_nalus_in_du_minus1"); 531 sei.m_numNalusInDuMinus1[ i ] = code; 532 if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) ) 533 { 534 READ_CODE( ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_cpb_removal_delay_minus1" ); 535 sei.m_duCpbRemovalDelayMinus1[ i ] = code; 536 } 537 } 538 } 539 } 540 xParseByteAlign(); 541 } 542 Void SEIReader::xParseSEIRecoveryPoint(SEIRecoveryPoint& sei, UInt /*payloadSize*/) 543 { 544 Int iCode; 545 UInt uiCode; 546 READ_SVLC( iCode, "recovery_poc_cnt" ); sei.m_recoveryPocCnt = iCode; 547 READ_FLAG( uiCode, "exact_matching_flag" ); sei.m_exactMatchingFlag = uiCode; 548 READ_FLAG( uiCode, "broken_link_flag" ); sei.m_brokenLinkFlag = uiCode; 549 xParseByteAlign(); 550 } 551 Void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, UInt /*payloadSize*/) 552 { 553 UInt val; 554 READ_UVLC( val, "frame_packing_arrangement_id" ); sei.m_arrangementId = val; 555 READ_FLAG( val, "frame_packing_arrangement_cancel_flag" ); sei.m_arrangementCancelFlag = val; 556 557 if ( !sei.m_arrangementCancelFlag ) 558 { 559 READ_CODE( 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val; 560 assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) ); 561 READ_FLAG( val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val; 562 563 READ_CODE( 6, val, "content_interpretation_type" ); sei.m_contentInterpretationType = val; 564 READ_FLAG( val, "spatial_flipping_flag" ); sei.m_spatialFlippingFlag = val; 565 READ_FLAG( val, "frame0_flipped_flag" ); sei.m_frame0FlippedFlag = val; 566 READ_FLAG( val, "field_views_flag" ); sei.m_fieldViewsFlag = val; 567 READ_FLAG( val, "current_frame_is_frame0_flag" ); sei.m_currentFrameIsFrame0Flag = val; 568 READ_FLAG( val, "frame0_self_contained_flag" ); sei.m_frame0SelfContainedFlag = val; 569 READ_FLAG( val, "frame1_self_contained_flag" ); sei.m_frame1SelfContainedFlag = val; 570 571 if ( sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5) 572 { 573 READ_CODE( 4, val, "frame0_grid_position_x" ); sei.m_frame0GridPositionX = val; 574 READ_CODE( 4, val, "frame0_grid_position_y" ); sei.m_frame0GridPositionY = val; 575 READ_CODE( 4, val, "frame1_grid_position_x" ); sei.m_frame1GridPositionX = val; 576 READ_CODE( 4, val, "frame1_grid_position_y" ); sei.m_frame1GridPositionY = val; 577 } 578 579 READ_CODE( 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val; 580 READ_FLAG( val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = val ? true : false; 581 } 582 READ_FLAG( val, "upsampled_aspect_ratio" ); sei.m_upsampledAspectRatio = val; 583 584 xParseByteAlign(); 585 } 586 587 Void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, UInt /*payloadSize*/) 588 { 589 UInt val; 590 READ_FLAG( val, "display_orientation_cancel_flag" ); sei.cancelFlag = val; 591 if( !sei.cancelFlag ) 592 { 593 READ_FLAG( val, "hor_flip" ); sei.horFlip = val; 594 READ_FLAG( val, "ver_flip" ); sei.verFlip = val; 595 READ_CODE( 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val; 596 READ_FLAG( val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val; 597 } 598 xParseByteAlign(); 599 } 600 601 Void SEIReader::xParseSEITemporalLevel0Index(SEITemporalLevel0Index& sei, UInt /*payloadSize*/) 602 { 603 UInt val; 604 READ_CODE ( 8, val, "tl0_idx" ); sei.tl0Idx = val; 605 READ_CODE ( 8, val, "rap_idx" ); sei.rapIdx = val; 606 xParseByteAlign(); 607 } 608 609 Void SEIReader::xParseSEIGradualDecodingRefreshInfo(SEIGradualDecodingRefreshInfo& sei, UInt /*payloadSize*/) 610 { 611 UInt val; 612 READ_FLAG( val, "gdr_foreground_flag" ); sei.m_gdrForegroundFlag = val ? 1 : 0; 613 xParseByteAlign(); 614 } 615 616 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 617 { 618 Int i; 619 UInt val; 620 READ_UVLC( val, "tone_map_id" ); sei.m_toneMapId = val; 621 READ_FLAG( val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val; 622 623 if ( !sei.m_toneMapCancelFlag ) 624 { 625 READ_FLAG( val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val; 626 READ_CODE( 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val; 627 READ_CODE( 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val; 628 READ_UVLC( val, "model_id" ); sei.m_modelId = val; 629 switch(sei.m_modelId) 630 { 631 case 0: 632 { 633 READ_CODE( 32, val, "min_value" ); sei.m_minValue = val; 634 READ_CODE( 32, val, "max_value" ); sei.m_maxValue = val; 635 break; 636 } 637 case 1: 638 { 639 READ_CODE( 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val; 640 READ_CODE( 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val; 641 break; 642 } 643 case 2: 644 { 645 UInt num = 1u << sei.m_targetBitDepth; 646 sei.m_startOfCodedInterval.resize(num+1); 647 for(i = 0; i < num; i++) 648 { 649 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" ); 650 sei.m_startOfCodedInterval[i] = val; 651 } 652 sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth; 653 break; 654 } 655 case 3: 656 { 657 READ_CODE( 16, val, "num_pivots" ); sei.m_numPivots = val; 658 sei.m_codedPivotValue.resize(sei.m_numPivots); 659 sei.m_targetPivotValue.resize(sei.m_numPivots); 660 for(i = 0; i < sei.m_numPivots; i++ ) 661 { 662 READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" ); 663 sei.m_codedPivotValue[i] = val; 664 READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value" ); 665 sei.m_targetPivotValue[i] = val; 666 } 667 break; 668 } 669 case 4: 670 { 671 READ_CODE( 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedValue = val; 672 if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO 673 { 674 READ_CODE( 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val; 675 } 676 READ_FLAG( val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val; 677 READ_CODE( 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val; 678 READ_CODE( 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val; 679 READ_CODE( 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val; 680 READ_CODE( 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val; 681 READ_CODE( 16, val, "nominal_black_level_luma_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val; 682 READ_CODE( 16, val, "nominal_white_level_luma_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val; 683 READ_CODE( 16, val, "extended_white_level_luma_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val; 684 break; 685 } 686 default: 687 { 688 assert(!"Undefined SEIToneMapModelId"); 689 break; 690 } 691 }//switch model id 692 }// if(!sei.m_toneMapCancelFlag) 693 694 xParseByteAlign(); 695 } 696 697 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 698 { 699 Int iCode; 700 UInt uiCode; 701 702 READ_UVLC( uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode; 703 READ_UVLC( uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode; 704 for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) 705 { 706 READ_CODE( 6, uiCode, "sop_desc_vcl_nalu_type" ); sei.m_sopDescVclNaluType[i] = uiCode; 707 READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id" ); sei.m_sopDescTemporalId[i] = uiCode; 708 if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) 709 { 710 READ_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); sei.m_sopDescStRpsIdx[i] = uiCode; 711 } 712 if (i > 0) 713 { 714 READ_SVLC( iCode, "sop_desc_poc_delta" ); sei.m_sopDescPocDelta[i] = iCode; 715 } 716 } 717 718 xParseByteAlign(); 719 } 720 721 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) 722 { 723 UInt uiCode; 724 SEIMessages seis; 725 726 READ_FLAG( uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode; 727 READ_FLAG( uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode; 728 if (sei.m_nestingOpFlag) 729 { 730 READ_FLAG( uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode; 731 READ_UVLC( uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode; 732 for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++) 733 { 734 READ_CODE( 3, uiCode, "nesting_max_temporal_id_plus1" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode; 735 READ_UVLC( uiCode, "nesting_op_idx" ); sei.m_nestingOpIdx[i] = uiCode; 736 } 737 } 738 else 739 { 740 READ_FLAG( uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode; 741 if (!sei.m_allLayersFlag) 742 { 743 READ_CODE( 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode; 744 READ_UVLC( uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode; 745 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 746 { 747 READ_CODE( 6, uiCode, "nesting_layer_id" ); sei.m_nestingLayerId[i] = uiCode; 748 } 749 } 750 } 751 752 // byte alignment 753 while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 754 { 755 UInt code; 756 READ_FLAG( code, "nesting_zero_bit" ); 757 } 758 759 sei.m_callerOwnsSEIs = false; 760 761 // read nested SEI messages 762 do { 763 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); 764 } while (m_pcBitstream->getNumBitsLeft() > 8); 765 766 } 767 768 Void SEIReader::xParseByteAlign() 769 { 770 UInt code; 771 if( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 772 { 773 READ_FLAG( code, "bit_equal_to_one" ); assert( code == 1 ); 774 } 775 while( m_pcBitstream->getNumBitsRead() % 8 != 0 ) 776 { 777 READ_FLAG( code, "bit_equal_to_zero" ); assert( code == 0 ); 778 } 779 } 117 780 //! \} -
trunk/source/Lib/TLibDecoder/SEIread.h
r56 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 32 32 */ 33 33 34 /** 35 \file SEIread.h 36 \brief reading funtionality for SEI messages 37 */ 38 39 #ifndef __SEIREAD__ 40 #define __SEIREAD__ 41 42 #if _MSC_VER > 1000 34 43 #pragma once 44 #endif // _MSC_VER > 1000 35 45 36 46 //! \ingroup TLibDecoder 37 47 //! \{ 38 48 49 #include "TLibCommon/SEI.h" 39 50 class TComInputBitstream; 40 class SEImessages;41 51 42 void parseSEImessage(TComInputBitstream& bs, SEImessages& seis); 52 53 class SEIReader: public SyntaxElementParser 54 { 55 public: 56 SEIReader() {}; 57 virtual ~SEIReader() {}; 58 Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 59 protected: 60 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 61 Void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, UInt payloadSize); 62 Void xParseSEIActiveParameterSets (SEIActiveParameterSets &sei, UInt payloadSize); 63 Void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps); 64 Void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, UInt payloadSize); 65 Void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps); 66 Void xParseSEIPictureTiming (SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps); 67 Void xParseSEIRecoveryPoint (SEIRecoveryPoint& sei, UInt payloadSize); 68 Void xParseSEIFramePacking (SEIFramePacking& sei, UInt payloadSize); 69 Void xParseSEIDisplayOrientation (SEIDisplayOrientation &sei, UInt payloadSize); 70 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 73 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 74 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 75 Void xParseByteAlign(); 76 }; 77 43 78 44 79 //! \} 80 81 #endif -
trunk/source/Lib/TLibDecoder/TDecBinCoder.h
r296 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 54 54 virtual Void start () = 0; 55 55 virtual Void finish () = 0; 56 virtual Void flush () = 0;57 56 58 57 virtual Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ) = 0; … … 61 60 virtual Void decodeBinTrm ( UInt& ruiBin ) = 0; 62 61 63 virtual Void resetBac () = 0;64 virtual Void decodeNumSubseqIPCM( Int& numSubseqIPCM ) = 0;65 virtual Void decodePCMAlignBits() = 0;66 62 virtual Void xReadPCMCode ( UInt uiLength, UInt& ruiCode) = 0; 67 63 … … 70 66 virtual Void copyState ( TDecBinIf* pcTDecBinIf ) = 0; 71 67 virtual TDecBinCABAC* getTDecBinCABAC () { return 0; } 72 #if !OL_FLUSH_ALIGN73 virtual Int getBitsReadAhead() { return 0; }74 #endif75 68 }; 76 69 -
trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
r296 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 37 37 38 38 #include "TDecBinCoderCABAC.h" 39 #include "../TLibCommon/TComRom.h" 39 40 40 41 //! \ingroup TLibDecoder … … 65 66 TDecBinCABAC::start() 66 67 { 67 #if OL_FLUSH_ALIGN68 68 assert( m_pcTComBitstream->getNumBitsUntilByteAligned() == 0 ); 69 #endif70 71 69 m_uiRange = 510; 72 70 m_bitsNeeded = -8; 73 m_uiValue = m_pcTComBitstream->readByte() << 8; 74 #if !OL_FLUSH_ALIGN 75 m_uiLastByte = m_pcTComBitstream->readByte(); 76 m_uiValue |= m_uiLastByte; 77 #else 71 m_uiValue = (m_pcTComBitstream->readByte() << 8); 78 72 m_uiValue |= m_pcTComBitstream->readByte(); 79 #endif80 73 } 81 74 … … 83 76 TDecBinCABAC::finish() 84 77 { 85 } 86 87 Void 88 TDecBinCABAC::flush() 89 { 90 #if OL_FLUSH_ALIGN 91 while (m_pcTComBitstream->getNumBitsLeft() > 0 && m_pcTComBitstream->getNumBitsUntilByteAligned() != 0) 92 { 93 UInt uiBits; 94 m_pcTComBitstream->read ( 1, uiBits ); 95 } 96 start(); 97 #else 98 m_uiRange = 510; 99 Int iExtra = 16+m_bitsNeeded+1; // m_bitsNeeded is -ve: iExtra is many bits to read to make up 16. 100 UInt uiExtraBits; 101 m_pcTComBitstream->read(iExtra, uiExtraBits); 102 m_uiValue = (m_uiLastByte << iExtra) | uiExtraBits; 103 m_uiValue &= 0xffff; 104 m_uiLastByte = m_uiValue; 105 m_uiLastByte &= 0xff; 106 m_bitsNeeded = -8; 107 #endif // OL_FLUSH_ALIGN 78 UInt lastByte; 79 80 m_pcTComBitstream->peekPreviousByte( lastByte ); 81 // Check for proper stop/alignment pattern 82 assert( ((lastByte << (8 + m_bitsNeeded)) & 0xff) == 0x80 ); 108 83 } 109 84 … … 120 95 m_uiValue = pcTDecBinCABAC->m_uiValue; 121 96 m_bitsNeeded= pcTDecBinCABAC->m_bitsNeeded; 122 #if !OL_FLUSH_ALIGN123 m_uiLastByte= pcTDecBinCABAC->m_uiLastByte;124 #endif125 97 } 126 98 … … 150 122 { 151 123 m_bitsNeeded = -8; 152 #if !OL_FLUSH_ALIGN153 m_uiLastByte = m_pcTComBitstream->readByte();154 m_uiValue += m_uiLastByte;155 #else156 124 m_uiValue += m_pcTComBitstream->readByte(); 157 #endif158 125 } 159 126 } … … 171 138 if ( m_bitsNeeded >= 0 ) 172 139 { 173 #if !OL_FLUSH_ALIGN174 m_uiLastByte = m_pcTComBitstream->readByte();175 m_uiValue += m_uiLastByte << m_bitsNeeded;176 #else177 140 m_uiValue += m_pcTComBitstream->readByte() << m_bitsNeeded; 178 #endif179 141 m_bitsNeeded -= 8; 180 142 } … … 190 152 { 191 153 m_bitsNeeded = -8; 192 #if !OL_FLUSH_ALIGN193 m_uiLastByte = m_pcTComBitstream->readByte();194 m_uiValue += m_uiLastByte;195 #else196 154 m_uiValue += m_pcTComBitstream->readByte(); 197 #endif198 155 } 199 156 … … 213 170 while ( numBins > 8 ) 214 171 { 215 #if !OL_FLUSH_ALIGN216 m_uiLastByte = m_pcTComBitstream->readByte();217 m_uiValue = ( m_uiValue << 8 ) + ( m_uiLastByte << ( 8 + m_bitsNeeded ) );218 #else219 172 m_uiValue = ( m_uiValue << 8 ) + ( m_pcTComBitstream->readByte() << ( 8 + m_bitsNeeded ) ); 220 #endif221 173 222 174 UInt scaledRange = m_uiRange << 15; … … 239 191 if ( m_bitsNeeded >= 0 ) 240 192 { 241 #if !OL_FLUSH_ALIGN242 m_uiLastByte = m_pcTComBitstream->readByte();243 m_uiValue += m_uiLastByte << m_bitsNeeded;244 #else245 193 m_uiValue += m_pcTComBitstream->readByte() << m_bitsNeeded; 246 #endif247 194 m_bitsNeeded -= 8; 248 195 } … … 283 230 { 284 231 m_bitsNeeded = -8; 285 #if !OL_FLUSH_ALIGN286 m_uiLastByte = m_pcTComBitstream->readByte();287 m_uiValue += m_uiLastByte;288 #else289 232 m_uiValue += m_pcTComBitstream->readByte(); 290 #endif291 233 } 292 234 } 293 235 } 294 }295 296 /** Reset BAC register values.297 * \returns Void298 */299 Void TDecBinCABAC::resetBac()300 {301 m_uiRange = 510;302 m_bitsNeeded = -8;303 m_uiValue = m_pcTComBitstream->read( 16 );304 }305 306 /** Decode subsequent_pcm_num.307 * \param numSubseqIPCM308 * \returns Void309 */310 Void TDecBinCABAC::decodeNumSubseqIPCM( Int& numSubseqIPCM )311 {312 UInt bit = 0;313 314 numSubseqIPCM = 0;315 316 do317 {318 m_uiValue += m_uiValue;319 if ( ++m_bitsNeeded >= 0 )320 {321 m_bitsNeeded = -8;322 #if !OL_FLUSH_ALIGN323 m_uiLastByte = m_pcTComBitstream->readByte();324 m_uiValue += m_uiLastByte;325 #else326 m_uiValue += m_pcTComBitstream->readByte();327 #endif328 }329 bit = ((m_uiValue&128)>>7);330 numSubseqIPCM++;331 }332 while( bit && (numSubseqIPCM < 3 ));333 334 if( bit && (numSubseqIPCM == 3 ))335 {336 numSubseqIPCM++;337 }338 339 numSubseqIPCM --;340 }341 342 /** Decode PCM alignment zero bits.343 * \returns Void344 */345 Void TDecBinCABAC::decodePCMAlignBits()346 {347 Int iNum = m_pcTComBitstream->getNumBitsUntilByteAligned();348 349 UInt uiBit = 0;350 m_pcTComBitstream->read( iNum, uiBit );351 236 } 352 237 -
trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
r296 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 56 56 Void start (); 57 57 Void finish (); 58 Void flush ();59 58 60 59 Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ); … … 63 62 Void decodeBinTrm ( UInt& ruiBin ); 64 63 65 Void resetBac ();66 Void decodeNumSubseqIPCM( Int& numSubseqIPCM ) ;67 Void decodePCMAlignBits();68 64 Void xReadPCMCode ( UInt uiLength, UInt& ruiCode ); 69 65 70 66 Void copyState ( TDecBinIf* pcTDecBinIf ); 71 67 TDecBinCABAC* getTDecBinCABAC() { return this; } 72 #if !OL_FLUSH_ALIGN73 Int getBitsReadAhead() { return -m_bitsNeeded; }74 #endif75 68 76 69 private: … … 78 71 UInt m_uiRange; 79 72 UInt m_uiValue; 80 #if !OL_FLUSH_ALIGN81 UInt m_uiLastByte;82 #endif83 73 Int m_bitsNeeded; 84 74 }; -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r443 r608 1 1 /* The copyright in this software is being made available under the BSD 2 3 4 5 6 * Copyright (c) 2010-2012, ITU/ISO/IEC7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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-2013, 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 33 34 34 /** \file TDecCAVLC.cpp 35 35 \brief CAVLC decoder class 36 36 */ 37 37 … … 45 45 #if ENC_DEC_TRACE 46 46 47 #define READ_CODE(length, code, name) xReadCodeTr ( length, code, name )48 #define READ_UVLC( code, name) xReadUvlcTr ( code, name )49 #define READ_SVLC( code, name) xReadSvlcTr ( code, name )50 #define READ_FLAG( code, name) xReadFlagTr ( code, name )51 52 47 Void xTraceSPSHeader (TComSPS *pSPS) 53 48 { 49 #if H_MV_ENC_DEC_TRAC 50 if ( g_disableHLSTrace ) 51 { 52 return; 53 } 54 // To avoid mismatches 55 fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" ); 56 #else 54 57 fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() ); 58 #endif 55 59 } 56 60 57 61 Void xTracePPSHeader (TComPPS *pPPS) 58 62 { 63 #if H_MV_ENC_DEC_TRAC 64 if ( g_disableHLSTrace ) 65 { 66 return; 67 } 68 fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n" ); 69 #else 59 70 fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() ); 60 } 61 62 Void xTraceAPSHeader (TComAPS *pAPS) 63 { 64 fprintf( g_hTrace, "=========== Adaptation Parameter Set ===========\n"); 71 #endif 65 72 } 66 73 67 74 Void xTraceSliceHeader (TComSlice *pSlice) 68 75 { 76 #if H_MV_ENC_DEC_TRAC 77 if ( g_disableHLSTrace ) 78 { 79 return; 80 } 81 #endif 69 82 fprintf( g_hTrace, "=========== Slice ===========\n"); 70 83 } 71 84 72 73 Void TDecCavlc::xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName) 74 { 75 xReadCode (length, rValue); 76 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 77 fprintf( g_hTrace, "%-40s u(%d) : %d\n", pSymbolName, length, rValue ); 78 fflush ( g_hTrace ); 79 } 80 81 Void TDecCavlc::xReadUvlcTr (UInt& rValue, const Char *pSymbolName) 82 { 83 xReadUvlc (rValue); 84 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 85 fprintf( g_hTrace, "%-40s u(v) : %d\n", pSymbolName, rValue ); 86 fflush ( g_hTrace ); 87 } 88 89 Void TDecCavlc::xReadSvlcTr (Int& rValue, const Char *pSymbolName) 90 { 91 xReadSvlc(rValue); 92 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 93 fprintf( g_hTrace, "%-40s s(v) : %d\n", pSymbolName, rValue ); 94 fflush ( g_hTrace ); 95 } 96 97 Void TDecCavlc::xReadFlagTr (UInt& rValue, const Char *pSymbolName) 98 { 99 xReadFlag(rValue); 100 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 101 fprintf( g_hTrace, "%-40s u(1) : %d\n", pSymbolName, rValue ); 102 fflush ( g_hTrace ); 103 } 104 105 #else 106 107 #define READ_CODE(length, code, name) xReadCode ( length, code ) 108 #define READ_UVLC( code, name) xReadUvlc ( code ) 109 #define READ_SVLC( code, name) xReadSvlc ( code ) 110 #define READ_FLAG( code, name) xReadFlag ( code ) 111 112 #endif 113 114 85 #endif 115 86 116 87 // ==================================================================================================================== … … 120 91 TDecCavlc::TDecCavlc() 121 92 { 122 m_iSliceGranularity = 0; 123 124 m_aaiTempScale = new Int* [ MAX_VIEW_NUM ]; 125 m_aaiTempOffset = new Int* [ MAX_VIEW_NUM ]; 126 m_aaiTempPdmScaleNomDelta = new Int* [ MAX_VIEW_NUM ]; 127 m_aaiTempPdmOffset = new Int* [ MAX_VIEW_NUM ]; 128 for( UInt uiVId = 0; uiVId < MAX_VIEW_NUM; uiVId++ ) 129 { 130 m_aaiTempScale [ uiVId ] = new Int [ MAX_VIEW_NUM ]; 131 m_aaiTempOffset [ uiVId ] = new Int [ MAX_VIEW_NUM ]; 132 m_aaiTempPdmScaleNomDelta [ uiVId ] = new Int [ MAX_VIEW_NUM ]; 133 m_aaiTempPdmOffset [ uiVId ] = new Int [ MAX_VIEW_NUM ]; 134 } 93 #if H_3D 94 m_aaiTempScale = new Int* [ MAX_NUM_LAYERS ]; 95 m_aaiTempOffset = new Int* [ MAX_NUM_LAYERS ]; 96 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) 97 { 98 m_aaiTempScale [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; 99 m_aaiTempOffset [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; 100 } 101 #endif 135 102 } 136 103 137 104 TDecCavlc::~TDecCavlc() 138 105 { 139 for( UInt uiVId = 0; uiVId < MAX_VIEW_NUM; uiVId++ ) 106 #if H_3D 107 for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) 140 108 { 141 109 delete [] m_aaiTempScale [ uiVId ]; 142 110 delete [] m_aaiTempOffset [ uiVId ]; 143 delete [] m_aaiTempPdmScaleNomDelta [ uiVId ];144 delete [] m_aaiTempPdmOffset [ uiVId ];145 111 } 146 112 delete [] m_aaiTempScale; 147 113 delete [] m_aaiTempOffset; 148 delete [] m_aaiTempPdmScaleNomDelta; 149 delete [] m_aaiTempPdmOffset; 114 #endif 150 115 } 151 116 … … 154 119 // ==================================================================================================================== 155 120 156 /**157 * unmarshal a sequence of SEI messages from bitstream.158 */159 void TDecCavlc::parseSEI(SEImessages& seis)160 {161 assert(!m_pcBitstream->getNumBitsUntilByteAligned());162 do163 {164 parseSEImessage(*m_pcBitstream, seis);165 /* SEI messages are an integer number of bytes, something has failed166 * in the parsing if bitstream not byte-aligned */167 assert(!m_pcBitstream->getNumBitsUntilByteAligned());168 } while (0x80 != m_pcBitstream->peekBits(8));169 assert(m_pcBitstream->getNumBitsLeft() == 8); /* rsbp_trailing_bits */170 }171 121 void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) 172 122 { 173 123 UInt code; 174 124 UInt interRPSPred; 175 READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred); 125 if (idx > 0) 126 { 127 READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred); 128 } 129 else 130 { 131 interRPSPred = false; 132 rps->setInterRPSPrediction(false); 133 } 134 176 135 if (interRPSPred) 177 136 { 178 137 UInt bit; 179 READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 138 if(idx == sps->getRPSList()->getNumberOfReferencePictureSets()) 139 { 140 READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 141 } 142 else 143 { 144 code = 0; 145 } 146 assert(code <= idx-1); // delta_idx_minus1 shall not be larger than idx-1, otherwise we will predict from a negative row position that does not exist. When idx equals 0 there is no legal value and interRPSPred must be zero. See J0185-r2 180 147 Int rIdx = idx - 1 - code; 181 assert (rIdx <= idx && rIdx >= 0);148 assert (rIdx <= idx-1 && rIdx >= 0); // Made assert tighter; if rIdx = idx then prediction is done from itself. rIdx must belong to range 0, idx-1, inclusive, see J0185-r2 182 149 TComReferencePictureSet* rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx); 183 150 Int k = 0, k0 = 0, k1 = 0; 184 151 READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign 185 152 READ_UVLC(code, "abs_delta_rps_minus1"); // absolute delta RPS minus 1 186 Int deltaRPS = (1 - (bit<<1)) * (code + 1); // delta_RPS153 Int deltaRPS = (1 - 2 * bit) * (code + 1); // delta_RPS 187 154 for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) 188 155 { … … 200 167 rps->setUsed(k, (refIdc == 1)); 201 168 202 if (deltaPOC < 0) { 169 if (deltaPOC < 0) 170 { 203 171 k0++; 204 172 } … … 247 215 } 248 216 249 Void TDecCavlc::parse APS(TComAPS* aps)217 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 250 218 { 251 219 #if ENC_DEC_TRACE 252 xTraceAPSHeader(aps); 253 #endif 254 255 UInt uiCode; 256 READ_UVLC(uiCode, "aps_id"); aps->setAPSID(uiCode); 257 READ_FLAG(uiCode, "aps_scaling_list_data_present_flag"); aps->setScalingListEnabled( (uiCode==1)?true:false ); 258 READ_FLAG(uiCode, "aps_deblocking_filter_flag"); aps->setLoopFilterOffsetInAPS( (uiCode==1)?true:false ); 259 if(aps->getScalingListEnabled()) 260 { 261 parseScalingList( aps->getScalingList() ); 262 } 263 if(aps->getLoopFilterOffsetInAPS()) 264 { 265 xParseDblParam( aps ); 266 } 267 #if !LGE_SAO_MIGRATION_D0091 268 READ_FLAG(uiCode, "aps_sao_interleaving_flag"); aps->setSaoInterleavingFlag( (uiCode==1)?true:false ); 269 if(!aps->getSaoInterleavingFlag()) 270 { 271 READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag"); aps->setSaoEnabled( (uiCode==1)?true:false ); 272 if(aps->getSaoEnabled()) 273 { 274 aps->getSaoParam()->bSaoFlag[0] = true; 275 xParseSaoParam( aps->getSaoParam() ); 276 } 277 } 278 #endif 279 READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag"); aps->setAlfEnabled( (uiCode==1)?true:false ); 280 if(aps->getAlfEnabled()) 281 { 282 xParseAlfParam( aps->getAlfParam()); 283 } 284 READ_FLAG( uiCode, "aps_extension_flag"); 220 xTracePPSHeader (pcPPS); 221 #endif 222 UInt uiCode; 223 224 Int iCode; 225 226 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); 227 assert(uiCode <= 63); 228 pcPPS->setPPSId (uiCode); 229 230 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); 231 assert(uiCode <= 15); 232 pcPPS->setSPSId (uiCode); 233 234 READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); 235 READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 236 237 READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); 238 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 239 240 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 241 242 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); 243 assert(uiCode <= 14); 244 pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); 245 246 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); 247 assert(uiCode <= 14); 248 pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 249 250 READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); 251 READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); 252 READ_FLAG( uiCode, "transform_skip_enabled_flag" ); 253 pcPPS->setUseTransformSkip ( uiCode ? true : false ); 254 255 READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); 256 if( pcPPS->getUseDQP() ) 257 { 258 READ_UVLC( uiCode, "diff_cu_qp_delta_depth" ); 259 pcPPS->setMaxCuDQPDepth( uiCode ); 260 } 261 else 262 { 263 pcPPS->setMaxCuDQPDepth( 0 ); 264 } 265 READ_SVLC( iCode, "pps_cb_qp_offset"); 266 pcPPS->setChromaCbQpOffset(iCode); 267 assert( pcPPS->getChromaCbQpOffset() >= -12 ); 268 assert( pcPPS->getChromaCbQpOffset() <= 12 ); 269 270 READ_SVLC( iCode, "pps_cr_qp_offset"); 271 pcPPS->setChromaCrQpOffset(iCode); 272 assert( pcPPS->getChromaCrQpOffset() >= -12 ); 273 assert( pcPPS->getChromaCrQpOffset() <= 12 ); 274 275 READ_FLAG( uiCode, "pps_slice_chroma_qp_offsets_present_flag" ); 276 pcPPS->setSliceChromaQpFlag( uiCode ? true : false ); 277 278 READ_FLAG( uiCode, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 279 pcPPS->setUseWP( uiCode==1 ); 280 READ_FLAG( uiCode, "weighted_bipred_flag" ); // Use of Bi-Directional Weighting Prediction (B_SLICE) 281 pcPPS->setWPBiPred( uiCode==1 ); 282 283 READ_FLAG( uiCode, "transquant_bypass_enable_flag"); 284 pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); 285 READ_FLAG( uiCode, "tiles_enabled_flag" ); pcPPS->setTilesEnabledFlag ( uiCode == 1 ); 286 READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" ); pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 ); 287 288 if( pcPPS->getTilesEnabledFlag() ) 289 { 290 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumColumnsMinus1( uiCode ); 291 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumRowsMinus1( uiCode ); 292 READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setUniformSpacingFlag( uiCode ); 293 294 if( !pcPPS->getUniformSpacingFlag()) 295 { 296 UInt* columnWidth = (UInt*)malloc(pcPPS->getNumColumnsMinus1()*sizeof(UInt)); 297 for(UInt i=0; i<pcPPS->getNumColumnsMinus1(); i++) 298 { 299 READ_UVLC( uiCode, "column_width_minus1" ); 300 columnWidth[i] = uiCode+1; 301 } 302 pcPPS->setColumnWidth(columnWidth); 303 free(columnWidth); 304 305 UInt* rowHeight = (UInt*)malloc(pcPPS->getNumRowsMinus1()*sizeof(UInt)); 306 for(UInt i=0; i<pcPPS->getNumRowsMinus1(); i++) 307 { 308 READ_UVLC( uiCode, "row_height_minus1" ); 309 rowHeight[i] = uiCode + 1; 310 } 311 pcPPS->setRowHeight(rowHeight); 312 free(rowHeight); 313 } 314 315 if(pcPPS->getNumColumnsMinus1() !=0 || pcPPS->getNumRowsMinus1() !=0) 316 { 317 READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false ); 318 } 319 } 320 READ_FLAG( uiCode, "loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false ); 321 READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false ); 322 if(pcPPS->getDeblockingFilterControlPresentFlag()) 323 { 324 READ_FLAG( uiCode, "deblocking_filter_override_enabled_flag" ); pcPPS->setDeblockingFilterOverrideEnabledFlag( uiCode ? true : false ); 325 READ_FLAG( uiCode, "pps_disable_deblocking_filter_flag" ); pcPPS->setPicDisableDeblockingFilterFlag(uiCode ? true : false ); 326 if(!pcPPS->getPicDisableDeblockingFilterFlag()) 327 { 328 READ_SVLC ( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode ); 329 READ_SVLC ( iCode, "pps_tc_offset_div2" ); pcPPS->setDeblockingFilterTcOffsetDiv2( iCode ); 330 } 331 } 332 READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); 333 if(pcPPS->getScalingListPresentFlag ()) 334 { 335 parseScalingList( pcPPS->getScalingList() ); 336 } 337 338 READ_FLAG( uiCode, "lists_modification_present_flag"); 339 pcPPS->setListsModificationPresentFlag(uiCode); 340 341 READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); 342 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 343 344 READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); 345 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); 346 347 READ_FLAG( uiCode, "pps_extension_flag"); 285 348 if (uiCode) 286 349 { 287 350 while ( xMoreRbspData() ) 288 351 { 289 READ_FLAG( uiCode, "aps_extension_data_flag"); 290 } 291 } 292 293 } 294 295 Void TDecCavlc::xParseDblParam ( TComAPS* aps ) 296 { 297 UInt uiSymbol; 298 Int iSymbol; 299 300 parseDFFlag(uiSymbol, "loop_filter_disable"); 301 aps->setLoopFilterDisable(uiSymbol?true:false); 302 303 if (!aps->getLoopFilterDisable()) 304 { 305 parseDFSvlc(iSymbol, "beta_offset_div2"); 306 aps->setLoopFilterBetaOffset(iSymbol); 307 parseDFSvlc(iSymbol, "tc_offset_div2"); 308 aps->setLoopFilterTcOffset(iSymbol); 309 } 310 } 311 #if !LGE_SAO_MIGRATION_D0091 312 /** parse SAO parameters 313 * \param pSaoParam 314 */ 315 Void TDecCavlc::xParseSaoParam(SAOParam* pSaoParam) 316 { 317 UInt uiSymbol; 318 319 int i,j, compIdx; 320 int numCuInWidth; 321 int numCuInHeight; 322 Bool repeatedRow[3]; 323 if (pSaoParam->bSaoFlag[0]) 324 { 325 READ_FLAG (uiSymbol, "sao_cb_enable_flag"); pSaoParam->bSaoFlag[1] = uiSymbol? true:false; 326 READ_FLAG (uiSymbol, "sao_cr_enable_flag"); pSaoParam->bSaoFlag[2] = uiSymbol? true:false; 327 READ_UVLC (uiSymbol, "sao_num_lcu_in_width_minus1"); pSaoParam->numCuInWidth = uiSymbol + 1; 328 READ_UVLC (uiSymbol, "sao_num_lcu_in_height_minus1"); pSaoParam->numCuInHeight = uiSymbol + 1; 329 numCuInWidth = pSaoParam->numCuInWidth; 330 numCuInHeight = pSaoParam->numCuInHeight; 331 332 READ_FLAG (uiSymbol, "sao_one_luma_unit_flag"); pSaoParam->oneUnitFlag[0] = uiSymbol? true:false; 333 if (pSaoParam->oneUnitFlag[0] ) 334 xParseSaoOffset(&(pSaoParam->saoLcuParam[0][0])); 335 336 if (pSaoParam->bSaoFlag[1]) 337 { 338 READ_FLAG (uiSymbol, "sao_one_cb_unit_flag"); pSaoParam->oneUnitFlag[1] = uiSymbol? true:false; 339 if (pSaoParam->oneUnitFlag[1] ) 340 xParseSaoOffset(&(pSaoParam->saoLcuParam[1][0])); 341 } 342 if (pSaoParam->bSaoFlag[2]) 343 { 344 READ_FLAG (uiSymbol, "sao_one_cr_unit_flag"); pSaoParam->oneUnitFlag[2] = uiSymbol? true:false; 345 if (pSaoParam->oneUnitFlag[2] ) 346 xParseSaoOffset(&(pSaoParam->saoLcuParam[2][0])); 347 } 348 for (j=0;j<numCuInHeight;j++) 349 { 350 for (compIdx=0;compIdx<3;compIdx++) 351 { 352 repeatedRow[compIdx] = 0; 353 } 354 for (i=0;i<numCuInWidth;i++) 355 { 356 for (compIdx=0; compIdx<3; compIdx++) 357 { 358 if (pSaoParam->bSaoFlag[compIdx] && !pSaoParam->oneUnitFlag[compIdx]) 352 READ_FLAG( uiCode, "pps_extension_data_flag"); 353 } 354 } 355 } 356 357 Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) 358 { 359 #if ENC_DEC_TRACE 360 fprintf( g_hTrace, "----------- vui_parameters -----------\n"); 361 #endif 362 UInt uiCode; 363 364 READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode); 365 if (pcVUI->getAspectRatioInfoPresentFlag()) 366 { 367 READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode); 368 if (pcVUI->getAspectRatioIdc() == 255) 369 { 370 READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); 371 READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); 372 } 373 } 374 375 READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode); 376 if (pcVUI->getOverscanInfoPresentFlag()) 377 { 378 READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode); 379 } 380 381 READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); 382 if (pcVUI->getVideoSignalTypePresentFlag()) 383 { 384 READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode); 385 READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode); 386 READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode); 387 if (pcVUI->getColourDescriptionPresentFlag()) 388 { 389 READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); 390 READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); 391 READ_CODE(8, uiCode, "matrix_coefficients"); pcVUI->setMatrixCoefficients(uiCode); 392 } 393 } 394 395 READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode); 396 if (pcVUI->getChromaLocInfoPresentFlag()) 397 { 398 READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode); 399 READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode); 400 } 401 402 READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode); 403 404 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 405 406 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); 407 408 READ_FLAG( uiCode, "default_display_window_flag"); 409 if (uiCode != 0) 410 { 411 Window &defDisp = pcVUI->getDefaultDisplayWindow(); 412 READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); 413 READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); 414 READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 415 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 416 } 417 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 418 READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); 419 if(timingInfo->getTimingInfoPresentFlag()) 420 { 421 READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); 422 READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode); 423 READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); 424 if(timingInfo->getPocProportionalToTimingFlag()) 425 { 426 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 427 } 428 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 429 if( pcVUI->getHrdParametersPresentFlag() ) 430 { 431 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 432 } 433 } 434 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); 435 if (pcVUI->getBitstreamRestrictionFlag()) 436 { 437 READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); 438 #if H_MV 439 if ( pcSPS->getLayerId() > 0 ) 440 { 441 READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 ); 442 } 443 #endif 444 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); 445 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); 446 READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); 447 assert(uiCode < 4096); 448 READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); 449 READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); 450 READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); 451 READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); 452 } 453 } 454 455 Void TDecCavlc::parseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) 456 { 457 UInt uiCode; 458 if( commonInfPresentFlag ) 459 { 460 READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); 461 READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); 462 if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) 463 { 464 READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); 465 if( hrd->getSubPicCpbParamsPresentFlag() ) 466 { 467 READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); 468 READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 469 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 470 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); 471 } 472 READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); 473 READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); 474 if( hrd->getSubPicCpbParamsPresentFlag() ) 475 { 476 READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); 477 } 478 READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); 479 READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); 480 READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); 481 } 482 } 483 Int i, j, nalOrVcl; 484 for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) 485 { 486 READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); 487 if( !hrd->getFixedPicRateFlag( i ) ) 488 { 489 READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); 490 } 491 else 492 { 493 hrd->setFixedPicRateWithinCvsFlag( i, true ); 494 } 495 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 496 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 497 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 498 { 499 READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); 500 } 501 else 502 { 503 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); 504 } 505 if (!hrd->getLowDelayHrdFlag( i )) 506 { 507 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 508 } 509 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 510 { 511 if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || 512 ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) 513 { 514 for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) 515 { 516 READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 517 READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 518 if( hrd->getSubPicCpbParamsPresentFlag() ) 359 519 { 360 if (j>0 && i==0) 361 { 362 READ_FLAG (uiSymbol, "sao_repeat_row_flag"); repeatedRow[compIdx] = uiSymbol? true:false; 363 } 364 xParseSaoUnit (i,j, compIdx, pSaoParam, repeatedRow[compIdx]); 520 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 521 READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 365 522 } 366 } 367 } 368 } 369 } 370 } 371 /** copy SAO parameter 372 * \param dst 373 * \param src 374 */ 375 inline Void copySaoOneLcuParam(SaoLcuParam* dst, SaoLcuParam* src) 376 { 377 Int i; 378 dst->partIdx = src->partIdx; 379 dst->typeIdx = src->typeIdx; 380 if (dst->typeIdx != -1) 381 { 382 if (dst->typeIdx == SAO_BO) 383 { 384 dst->bandPosition = src->bandPosition ; 385 } 386 else 387 { 388 dst->bandPosition = 0; 389 } 390 dst->length = src->length; 391 for (i=0;i<dst->length;i++) 392 { 393 dst->offset[i] = src->offset[i]; 394 } 395 } 396 else 397 { 398 dst->length = 0; 399 for (i=0;i<SAO_BO_LEN;i++) 400 { 401 dst->offset[i] = 0; 402 } 403 } 404 } 405 /** parse SAO offset 406 * \param saoLcuParam SAO LCU parameters 407 */ 408 Void TDecCavlc::xParseSaoOffset(SaoLcuParam* saoLcuParam) 409 { 410 UInt uiSymbol; 411 Int iSymbol; 412 static Int typeLength[MAX_NUM_SAO_TYPE] = { 413 SAO_EO_LEN, 414 SAO_EO_LEN, 415 SAO_EO_LEN, 416 SAO_EO_LEN, 417 SAO_BO_LEN 418 }; 419 420 READ_UVLC (uiSymbol, "sao_type_idx"); saoLcuParam->typeIdx = (Int)uiSymbol - 1; 421 if (uiSymbol) 422 { 423 saoLcuParam->length = typeLength[saoLcuParam->typeIdx]; 424 if( saoLcuParam->typeIdx == SAO_BO ) 425 { 426 READ_CODE( 5, uiSymbol, "sao_band_position"); saoLcuParam->bandPosition = uiSymbol; 427 for(Int i=0; i< saoLcuParam->length; i++) 428 { 429 READ_SVLC (iSymbol, "sao_offset"); saoLcuParam->offset[i] = iSymbol; 430 } 431 } 432 else if( saoLcuParam->typeIdx < 4 ) 433 { 434 READ_UVLC (uiSymbol, "sao_offset"); saoLcuParam->offset[0] = uiSymbol; 435 READ_UVLC (uiSymbol, "sao_offset"); saoLcuParam->offset[1] = uiSymbol; 436 READ_UVLC (uiSymbol, "sao_offset"); saoLcuParam->offset[2] = -(Int)uiSymbol; 437 READ_UVLC (uiSymbol, "sao_offset"); saoLcuParam->offset[3] = -(Int)uiSymbol; 438 } 439 } 440 else 441 { 442 saoLcuParam->length = 0; 443 } 444 } 445 446 /** parse SAO unit 447 * \param rx x-axis location 448 * \param ry y-axis location 449 * \param compIdx color component index 450 * \param saoParam SAO parameters 451 * \param repeatedRow repeat row flag 452 */ 453 void TDecCavlc::xParseSaoUnit(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow ) 454 { 455 int addr, addrUp, addrLeft; 456 int numCuInWidth = saoParam->numCuInWidth; 457 SaoLcuParam* saoOneLcu; 458 SaoLcuParam* saoOneLcuUp; 459 SaoLcuParam* saoOneLcuLeft; 460 UInt uiSymbol; 461 Int iSymbol; 462 Int runLeft; 463 UInt maxValue; 464 465 addr = rx + ry*numCuInWidth; 466 addrLeft = (addr%numCuInWidth == 0) ? -1 : addr - 1; 467 addrUp = (addr<numCuInWidth) ? -1 : addr - numCuInWidth; 468 469 saoOneLcu = &(saoParam->saoLcuParam[compIdx][addr]); 470 if (!repeatedRow) 471 { 472 runLeft = (addrLeft>=0 ) ? saoParam->saoLcuParam[compIdx][addrLeft].run : -1; 473 if (rx == 0 || runLeft==0) 474 { 475 saoOneLcu->mergeLeftFlag = 0; 476 if (ry == 0) 477 { 478 maxValue = numCuInWidth-rx-1; 479 UInt length = 0; 480 UInt val = 0; 481 if (maxValue) 482 { 483 for(UInt i=0; i<32; i++) 523 READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); 524 } 525 } 526 } 527 } 528 } 529 530 #if H_3D 531 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) 532 #else 533 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 534 #endif 535 { 536 #if ENC_DEC_TRACE 537 xTraceSPSHeader (pcSPS); 538 #endif 539 540 UInt uiCode; 541 READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); 542 #if H_MV 543 if ( pcSPS->getLayerId() == 0 ) 544 { 545 #endif 546 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 547 assert(uiCode <= 6); 548 549 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 550 if ( pcSPS->getMaxTLayers() == 1 ) 551 { 552 // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 553 assert( uiCode == 1 ); 554 } 555 556 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); 557 #if H_MV 558 } 559 #endif 560 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 561 assert(uiCode <= 15); 562 563 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 564 assert(uiCode <= 3); 565 // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream 566 assert (uiCode == 1); 567 if( uiCode == 3 ) 568 { 569 READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); 570 } 571 572 READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); 573 READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); 574 READ_FLAG( uiCode, "conformance_window_flag"); 575 if (uiCode != 0) 576 { 577 Window &conf = pcSPS->getConformanceWindow(); 578 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 579 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 580 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 581 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 582 } 583 584 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 585 assert(uiCode <= 6); 586 pcSPS->setBitDepthY( uiCode + 8 ); 587 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 588 589 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 590 assert(uiCode <= 6); 591 pcSPS->setBitDepthC( uiCode + 8 ); 592 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 593 594 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 595 assert(uiCode <= 12); 596 597 UInt subLayerOrderingInfoPresentFlag; 598 READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); 599 600 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 601 { 602 #if H_MV 603 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); 604 #else 605 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 606 #endif 607 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 608 #if H_MV 609 READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); 610 #else 611 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 612 #endif 613 pcSPS->setNumReorderPics(uiCode, i); 614 #if H_MV 615 READ_UVLC ( uiCode, "sps_max_latency_increase[i]"); 616 #else 617 READ_UVLC ( uiCode, "sps_max_latency_increase"); 618 #endif 619 pcSPS->setMaxLatencyIncrease( uiCode, i ); 620 621 if (!subLayerOrderingInfoPresentFlag) 622 { 623 for (i++; i <= pcSPS->getMaxTLayers()-1; i++) 624 { 625 pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); 626 pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); 627 pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); 628 } 629 break; 630 } 631 } 632 633 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 634 Int log2MinCUSize = uiCode + 3; 635 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 636 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 637 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 638 Int maxCUDepthDelta = uiCode; 639 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 640 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 641 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 642 643 READ_UVLC( uiCode, "log2_diff_max_min_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); 644 pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); 645 646 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 647 READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); 648 649 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 650 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 651 652 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 if(pcSPS->getScalingListFlag()) 654 { 655 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); 656 if(pcSPS->getScalingListPresentFlag ()) 657 { 658 parseScalingList( pcSPS->getScalingList() ); 659 } 660 } 661 READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); 662 READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); 663 664 READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); 665 if( pcSPS->getUsePCM() ) 666 { 667 READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepthLuma ( 1 + uiCode ); 668 READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepthChroma ( 1 + uiCode ); 669 READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); 670 READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); 671 READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); 672 } 673 674 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 675 assert(uiCode <= 64); 676 pcSPS->createRPSList(uiCode); 677 678 TComRPSList* rpsList = pcSPS->getRPSList(); 679 TComReferencePictureSet* rps; 680 681 for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) 682 { 683 rps = rpsList->getReferencePictureSet(i); 684 parseShortTermRefPicSet(pcSPS,rps,i); 685 } 686 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 687 if (pcSPS->getLongTermRefsPresent()) 688 { 689 READ_UVLC( uiCode, "num_long_term_ref_pic_sps" ); 690 pcSPS->setNumLongTermRefPicSPS(uiCode); 691 for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) 692 { 693 READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" ); 694 pcSPS->setLtRefPicPocLsbSps(k, uiCode); 695 READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]"); 696 pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); 697 } 698 } 699 READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); 700 701 READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); 702 703 READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); 704 705 if (pcSPS->getVuiParametersPresentFlag()) 706 { 707 parseVUI(pcSPS->getVuiParameters(), pcSPS); 708 } 709 710 READ_FLAG( uiCode, "sps_extension_flag"); 711 if (uiCode) 712 { 713 #if !H_MV 714 while ( xMoreRbspData() ) 715 { 716 READ_FLAG( uiCode, "sps_extension_data_flag"); 717 } 718 #else 719 READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); 720 //// sps_extension_vui_parameters( ) 721 if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() ) 722 { 723 READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode ); 724 for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ ) 725 { 726 READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode ); 727 if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 ) 728 { 729 READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 ); 730 if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 484 731 { 485 if(maxValue&0x1) 486 { 487 length = i+1; 488 } 489 maxValue = (maxValue >> 1); 732 READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode ); 490 733 } 491 if(length) 734 } 735 } 736 } 737 738 #if H_3D_QTLPC 739 if( depthFlag ) 740 { 741 READ_FLAG( uiCode, "use_qtl_flag" ); 742 pcSPS->setUseQTL( uiCode ); 743 READ_FLAG( uiCode, "use_pc_flag" ); 744 pcSPS->setUsePC( uiCode ); 745 } 746 #endif 747 //// sps_extension_vui_parameters( ) END 748 READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" ); 749 READ_FLAG( uiCode, "sps_extension2_flag"); 750 if ( uiCode ) 751 { 752 #if !H_3D 753 while ( xMoreRbspData() ) 754 { 755 READ_FLAG( uiCode, "sps_extension_data_flag"); 756 } 757 #else 758 759 UInt uiCamParPrecision = 0; 760 Bool bCamParSlice = false; 761 if ( !depthFlag ) 762 { 763 READ_UVLC( uiCamParPrecision, "cp_precision" ); 764 READ_FLAG( uiCode, "cp_in_slice_header_flag" ); bCamParSlice = ( uiCode == 1 ); 765 if( !bCamParSlice ) 766 { 767 for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ ) 492 768 { 493 READ_CODE(length, val, "sao_run_diff"); 769 Int iCode; 770 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ viewIndex ] = iCode; 771 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset [ uiBaseIndex ][ viewIndex ] = iCode; 772 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ]; 773 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ]; 494 774 } 495 775 } 496 uiSymbol = val; 497 saoOneLcu->runDiff = uiSymbol; 498 xParseSaoOffset(saoOneLcu); 499 saoOneLcu->run = saoOneLcu->runDiff; 500 } 501 else 502 { 503 saoOneLcuUp = &(saoParam->saoLcuParam[compIdx][addrUp]); 504 READ_SVLC (iSymbol , "sao_run_diff" ); saoOneLcu->runDiff = iSymbol; 505 READ_FLAG (uiSymbol, "sao_merge_up_flag"); saoOneLcu->mergeUpFlag = uiSymbol? true:false; 506 if (!saoOneLcu->mergeUpFlag) 507 { 508 xParseSaoOffset(saoOneLcu); 776 } 777 pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 778 READ_FLAG( uiCode, "sps_extension3_flag"); 779 if ( uiCode ) 780 { 781 while ( xMoreRbspData() ) 782 { 783 READ_FLAG( uiCode, "sps_extension_data_flag"); 784 } 785 } 786 #endif // !H_3D 787 } 788 #endif // !H_MV 789 } 790 } 791 792 Void TDecCavlc::parseVPS(TComVPS* pcVPS) 793 { 794 UInt uiCode; 795 796 READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 797 READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); 798 #if H_MV 799 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); 800 #else 801 READ_CODE( 6, uiCode, "vps_reserved_zero_6bits" ); assert(uiCode == 0); 802 #endif 803 READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); 804 READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); 805 assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); 806 #if H_MV 807 READ_CODE( 16, uiCode, "vps_extension_offset" ); 808 #else 809 READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); 810 #endif 811 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 812 UInt subLayerOrderingInfoPresentFlag; 813 READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 814 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 815 { 816 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 817 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 818 READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 819 820 if (!subLayerOrderingInfoPresentFlag) 821 { 822 for (i++; i <= pcVPS->getMaxTLayers()-1; i++) 823 { 824 pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i); 825 pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i); 826 pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i); 827 } 828 break; 829 } 830 } 831 832 assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); 833 #if H_MV 834 assert( pcVPS->getVpsMaxLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 ); 835 READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setVpsMaxLayerId( uiCode ); 836 837 READ_UVLC( uiCode, "vps_max_num_layer_sets_minus1" ); pcVPS->setVpsNumLayerSetsMinus1( uiCode ); 838 for( UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx ++ ) 839 { 840 for( UInt i = 0; i <= pcVPS->getVpsMaxLayerId(); i ++ ) 841 #else 842 assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); 843 READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); 844 READ_UVLC( uiCode, "vps_max_op_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); 845 for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) 846 { 847 // Operation point set 848 for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) 849 #endif 850 { 851 READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); 852 } 853 } 854 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 855 READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); 856 if(timingInfo->getTimingInfoPresentFlag()) 857 { 858 READ_CODE( 32, uiCode, "vps_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); 859 READ_CODE( 32, uiCode, "vps_time_scale"); timingInfo->setTimeScale (uiCode); 860 READ_FLAG( uiCode, "vps_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); 861 if(timingInfo->getPocProportionalToTimingFlag()) 862 { 863 READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 864 } 865 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); 866 867 if( pcVPS->getNumHrdParameters() > 0 ) 868 { 869 pcVPS->createHrdParamBuffer(); 870 } 871 for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) 872 { 873 READ_UVLC( uiCode, "hrd_op_set_idx" ); pcVPS->setHrdOpSetIdx( uiCode, i ); 874 if( i > 0 ) 875 { 876 READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); 877 } 878 parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 879 } 880 } 881 READ_FLAG( uiCode, "vps_extension_flag" ); 882 if (uiCode) 883 { 884 #if H_MV 885 m_pcBitstream->readOutTrailingBits(); 886 887 READ_FLAG( uiCode, "avc_base_layer_flag" ); pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false ); 888 READ_FLAG( uiCode, "splitting_flag" ); pcVPS->setSplittingFlag( uiCode == 1 ? true : false ); 889 890 for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ ) 891 { 892 READ_FLAG( uiCode, "scalability_mask[i]" ); pcVPS->setScalabilityMask( sIdx, uiCode == 1 ? true : false ); 893 } 894 895 for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ ) 896 { 897 READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); pcVPS->setDimensionIdLen( sIdx, uiCode + 1 ); 898 } 899 900 if ( pcVPS->getSplittingFlag() ) 901 { 902 pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() ); 903 } 904 905 READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false ); 906 907 for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ ) 908 { 909 if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) ) 910 { 911 READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); pcVPS->setLayerIdInNuh( i, uiCode ); 912 } 913 else 914 { 915 pcVPS->setLayerIdInNuh( i, i );; 916 } 917 918 pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i ); 919 920 for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ ) 921 { 922 if ( !pcVPS->getSplittingFlag() ) 923 { 924 READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" ); pcVPS->setDimensionId( i, j, uiCode ); 509 925 } 510 926 else 511 927 { 512 saoOneLcuUp = &(saoParam->saoLcuParam[compIdx][addrUp]); 513 copySaoOneLcuParam(saoOneLcu, saoOneLcuUp); 514 } 515 saoOneLcu->run = saoOneLcu->runDiff + saoOneLcuUp->run; 516 } 517 } 518 else 519 { 520 saoOneLcuLeft = &(saoParam->saoLcuParam[compIdx][addrLeft]); 521 copySaoOneLcuParam(saoOneLcu, saoOneLcuLeft); 522 saoOneLcu->mergeLeftFlag = 1; 523 saoOneLcu->run = saoOneLcuLeft->run-1; 524 } 525 } 526 else 527 { 528 if (ry > 0) 529 { 530 saoOneLcuUp = &(saoParam->saoLcuParam[compIdx][addrUp]); 531 copySaoOneLcuParam(saoOneLcu, saoOneLcuUp); 532 saoOneLcu->mergeLeftFlag = 0; 533 saoOneLcu->run = saoOneLcuUp->run; 534 } 535 } 536 } 537 #endif 538 539 Void TDecCavlc::xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS, Int firstLCUAddr, Bool acrossSlice, Int numLCUInWidth, Int numLCUInHeight) 540 { 541 Int numLCU; 542 UInt uiSymbol; 543 Bool isEnabled[NUM_ALF_COMPONENT]; 544 Bool isUniParam[NUM_ALF_COMPONENT]; 545 546 isEnabled[ALF_Y] = true; 547 READ_FLAG(uiSymbol, "alf_cb_enable_flag"); isEnabled[ALF_Cb] = ((uiSymbol ==1)?true:false); 548 READ_FLAG(uiSymbol, "alf_cr_enable_flag"); isEnabled[ALF_Cr] = ((uiSymbol ==1)?true:false); 549 READ_FLAG(uiSymbol, "alf_one_luma_unit_per_slice_flag"); isUniParam[ALF_Y] = ((uiSymbol ==1)?true:false); 550 551 isUniParam[ALF_Cb] = true; 552 if (isEnabled[ALF_Cb]) 553 { 554 READ_FLAG(uiSymbol, "alf_one_cb_unit_per_slice_flag"); isUniParam[ALF_Cb] = ((uiSymbol ==1)?true:false); 555 } 556 557 isUniParam[ALF_Cr] = true; 558 if (isEnabled[ALF_Cr]) 559 { 560 READ_FLAG(uiSymbol, "alf_one_cr_unit_per_slice_flag"); isUniParam[ALF_Cr] = ((uiSymbol ==1)?true:false); 561 } 562 563 if(bSentInAPS) 564 { 565 READ_UVLC(uiSymbol, "alf_num_lcu_in_width_minus1"); numLCUInWidth = uiSymbol+1; 566 READ_UVLC(uiSymbol, "alf_num_lcu_in_height_minus1"); numLCUInHeight = uiSymbol+1; 567 numLCU = numLCUInWidth*numLCUInHeight; 568 } 569 else //sent in slice header 570 { 571 READ_UVLC(uiSymbol, "alf_num_lcu_in_slice_minus1"); numLCU = uiSymbol+1; 572 } 573 574 assert(pAlfParamSet != NULL); 575 576 pAlfParamSet->create(numLCUInWidth, numLCUInHeight, numLCU); 577 for(Int compIdx = 0; compIdx < NUM_ALF_COMPONENT; compIdx++) 578 { 579 pAlfParamSet->isEnabled[compIdx] = isEnabled[compIdx]; 580 pAlfParamSet->isUniParam[compIdx]= isUniParam[compIdx]; 581 } 582 583 parseAlfParamSet(pAlfParamSet, firstLCUAddr, acrossSlice); 584 } 585 586 587 Void TDecCavlc::parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice) 588 { 589 Int numLCUInWidth = pAlfParamSet->numLCUInWidth; 590 Int numLCU = pAlfParamSet->numLCU; 591 592 static Bool isRepeatedRow [NUM_ALF_COMPONENT]; 593 static Int numStoredFilters[NUM_ALF_COMPONENT]; 594 static Int* run [NUM_ALF_COMPONENT]; 595 596 for(Int compIdx =0; compIdx < NUM_ALF_COMPONENT; compIdx++) 597 { 598 isRepeatedRow[compIdx] = false; 599 numStoredFilters[compIdx] = 0; 600 601 run[compIdx] = new Int[numLCU+1]; 602 run[compIdx][0] = -1; 603 } 604 605 UInt uiSymbol; 606 Int iSymbol, ry, rx, addrUp; 607 608 for(Int i=0; i< numLCU; i++) 609 { 610 rx = (i+ firstLCUAddr)% numLCUInWidth; 611 ry = (i+ firstLCUAddr)/ numLCUInWidth; 612 613 for(Int compIdx =0; compIdx < NUM_ALF_COMPONENT; compIdx++) 614 { 615 AlfUnitParam& alfUnitParam = pAlfParamSet->alfUnitParam[compIdx][i]; 616 617 if(pAlfParamSet->isEnabled[compIdx]) 618 { 619 if(!pAlfParamSet->isUniParam[compIdx]) 620 { 621 addrUp = i-numLCUInWidth; 622 if(rx ==0 && addrUp >=0) 928 pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j) ); 929 } 930 } 931 } 932 933 934 for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ ) 935 { 936 for( Int j = 0; j < i; j++ ) 937 { 938 READ_FLAG( uiCode, "direct_dependency_flag[i][j]" ); pcVPS->setDirectDependencyFlag( i, j, uiCode ); 939 } 940 } 941 942 for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ ) 943 { 944 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); pcVPS->setMaxTidIlRefPicPlus1( i , uiCode ); 945 } 946 947 READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); pcVPS->setVpsNumberLayerSetsMinus1 ( uiCode ); 948 READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1" ); pcVPS->setVpsNumProfileTierLevelMinus1( uiCode ); 949 950 for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ ) 951 { 952 READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 ); 953 if( !pcVPS->getVpsProfilePresentFlag( i ) ) 954 { 955 READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode ); 956 } 957 parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1); 958 if( !pcVPS->getVpsProfilePresentFlag( i ) ) 959 { 960 TComPTL temp = *pcVPS->getPTL( i ); 961 *pcVPS->getPTL( i ) = *pcVPS->getPTL( pcVPS->getProfileRefMinus1( i ) + 1 ); 962 pcVPS->getPTL( i )->copyLevelFrom( &temp ); 963 } 964 } 965 966 Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1; 967 968 READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); pcVPS->setMoreOutputLayerSetsThanDefaultFlag( uiCode == 1 ); 969 970 if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ) 971 { 972 READ_CODE( 10, uiCode, "num_add_output_layer_sets_minus1" ); pcVPS->setNumAddOutputLayerSetsMinus1( uiCode ); 973 numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1); 974 } 975 976 if( numOutputLayerSets > 1) 977 { 978 READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag( uiCode == 1); 979 } 980 981 for( Int i = 1; i < numOutputLayerSets; i++ ) 982 { 983 if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) ) 984 { 985 READ_UVLC( uiCode, "output_layer_set_idx_minus1[i]" ); pcVPS->setOutputLayerSetIdxMinus1( i, uiCode ); 986 for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ ) 987 { 988 READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 ); 989 } 990 } 991 if ( pcVPS->getProfileLevelTierIdxLen() > 0 ) 992 { 993 READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" ); pcVPS->setProfileLevelTierIdx( i , uiCode ); 994 } 995 } 996 997 READ_FLAG( uiCode , "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag( uiCode == 1 ); 998 READ_UVLC( uiCode, "direct_dep_type_len_minus2"); pcVPS->setDirectDepTypeLenMinus2 ( uiCode ); 999 1000 for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ ) 1001 { 1002 for( Int j = 0; j < i; j++ ) 1003 { 1004 if (pcVPS->getDirectDependencyFlag( i, j) ) 1005 { 1006 READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode); 1007 } 1008 } 1009 } 1010 1011 READ_FLAG ( uiCode, "vps_shvc_reserved_zero_flag" ); 1012 1013 #if H_3D 1014 READ_FLAG( uiCode, "vps_extension2_flag" ); 1015 if (uiCode) 1016 { 1017 m_pcBitstream->readOutTrailingBits(); 1018 1019 for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ ) 1020 { 1021 1022 #if H_3D_ARP 1023 pcVPS->setUseAdvRP ( i, 0 ); 1024 pcVPS->setARPStepNum( i, 1 ); 1025 #endif 1026 if ( i != 0 ) 1027 { 1028 if( !( pcVPS->getDepthId( i ) == 1 ) ) 623 1029 { 624 READ_FLAG(uiSymbol, "alf_repeat_row _flag"); isRepeatedRow[compIdx] = ((uiSymbol ==1)?true:false); 625 } 626 627 if(isRepeatedRow[compIdx]) 628 { 629 alfUnitParam.mergeType = ALF_MERGE_UP; 630 assert(addrUp >=0); 631 run[compIdx][i] = run[compIdx][addrUp]; 1030 #if H_3D_IV_MERGE 1031 READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false ); 1032 #endif 1033 #if H_3D_ARP 1034 READ_FLAG( uiCode, "iv_res_pred_flag[i]" ); pcVPS->setUseAdvRP ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 ); 1035 1036 #endif 1037 #if H_3D_NBDV_REF 1038 READ_FLAG( uiCode, "depth_refinement_flag[i]"); pcVPS->setDepthRefinementFlag ( i, uiCode == 1 ? true : false ); 1039 #endif 1040 #if H_3D_VSP 1041 READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false ); 1042 #endif 632 1043 } 633 1044 else 634 1045 { 635 if(rx == 0 || run[compIdx][i] < 0) 636 { 637 if(addrUp < 0) 1046 1047 READ_FLAG( uiCode, "vps_depth_modes_flag[i]" ); pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false ); 1048 // READ_FLAG( uiCode, "lim_qt_pred_flag[i]"); pcVPS->setLimQtPreFlag ( i, uiCode == 1 ? true : false ); 1049 #if H_3D_DIM_DLT 1050 if( pcVPS->getVpsDepthModesFlag( i ) ) 1051 { 1052 READ_FLAG( uiCode, "dlt_flag[i]" ); pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false ); 1053 } 1054 if( pcVPS->getUseDLTFlag( i ) ) 1055 { 1056 // decode mapping 1057 UInt uiNumDepthValues; 1058 // parse number of values in DLT 1059 READ_UVLC(uiNumDepthValues, "num_depth_values_in_dlt[i]"); 1060 1061 // parse actual DLT values 1062 Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int)); 1063 for(Int d=0; d<uiNumDepthValues; d++) 638 1064 { 639 //alf_run_diff u(v) 640 parseAlfFixedLengthRun(uiSymbol, rx, numLCUInWidth); 641 run[compIdx][i] = uiSymbol; 1065 READ_UVLC(uiCode, "dlt_depth_value[i][d]"); 1066 aiIdx2DepthValue[d] = (Int)uiCode; 642 1067 } 643 else 644 { 645 //alf_run_diff s(v) 646 READ_SVLC(iSymbol, "alf_run_diff"); 647 run[compIdx][i] = run[compIdx][addrUp] + iSymbol; 648 assert(run[compIdx][i] >= 0); 649 } 650 651 if(ry > 0 && (addrUp >=0 || alfAcrossSlice)) 652 { 653 //alf_merge_up_flag 654 READ_FLAG(uiSymbol, "alf_merge_up_flag"); alfUnitParam.mergeType = ((uiSymbol ==1)?ALF_MERGE_UP:ALF_MERGE_DISABLED); 655 } 656 else 657 { 658 alfUnitParam.mergeType = ALF_MERGE_DISABLED; 659 } 660 661 if(alfUnitParam.mergeType != ALF_MERGE_UP) 662 { 663 //alf_lcu_enable_flag 664 READ_FLAG(uiSymbol, "alf_lcu_enable_flag"); alfUnitParam.isEnabled = ((uiSymbol ==1)?true:false); 665 666 if(alfUnitParam.isEnabled) 667 { 668 if(numStoredFilters[compIdx] > 0) 669 { 670 //alf_new_filter_set_flag 671 READ_FLAG(uiSymbol, "alf_new_filter_set_flag"); alfUnitParam.isNewFilt = ((uiSymbol ==1)?true:false); 672 673 if(!alfUnitParam.isNewFilt) 674 { 675 //alf_stored_filter_set_idx 676 parseAlfStoredFilterIdx(uiSymbol, numStoredFilters[compIdx]); 677 678 alfUnitParam.storedFiltIdx = uiSymbol; 679 680 assert( alfUnitParam.storedFiltIdx < numStoredFilters[compIdx]); 681 } 682 } 683 else 684 { 685 alfUnitParam.isNewFilt = true; 686 } 687 688 if(alfUnitParam.isNewFilt) 689 { 690 alfUnitParam.alfFiltParam = new ALFParam(compIdx); 691 xParseAlfParam(alfUnitParam.alfFiltParam); 692 alfUnitParam.alfFiltParam->alf_flag = 1; 693 694 numStoredFilters[compIdx]++; 695 } 696 } 697 698 } 1068 1069 pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); 1070 1071 // clean memory 1072 free(aiIdx2DepthValue); 699 1073 } 700 else 701 { 702 alfUnitParam.mergeType = ALF_MERGE_LEFT; 703 } 704 705 run[compIdx][i+1] = run[compIdx][i] -1; 1074 #endif 1075 #if LGE_INTER_SDC_E0156 1076 READ_FLAG( uiCode, "depth_inter_SDC_flag" ); pcVPS->setInterSDCFlag( i, uiCode ? true : false ); 1077 #endif 706 1078 } 707 708 } 709 else // uni-param 710 { 711 if(i == 0) 712 { 713 alfUnitParam.mergeType = ALF_MERGE_DISABLED; 714 715 //alf_lcu_enable_flag 716 READ_FLAG(uiSymbol, "alf_lcu_enable_flag"); alfUnitParam.isEnabled = ((uiSymbol ==1)?true:false); 717 if(alfUnitParam.isEnabled) 718 { 719 alfUnitParam.isNewFilt = true; 720 alfUnitParam.alfFiltParam = new ALFParam(compIdx); 721 xParseAlfParam(alfUnitParam.alfFiltParam); 722 alfUnitParam.alfFiltParam->alf_flag = 1; 723 } 724 } 725 else 726 { 727 alfUnitParam.mergeType = ALF_MERGE_FIRST; 728 } 729 730 } 731 } 732 else 733 { 734 alfUnitParam.mergeType = ALF_MERGE_DISABLED; 735 alfUnitParam.isEnabled = false; 736 } 737 } 738 } 739 740 for(Int compIdx =0; compIdx < NUM_ALF_COMPONENT; compIdx++) 741 { 742 delete[] run[compIdx]; 743 } 744 } 745 746 747 Void TDecCavlc::parseAlfFixedLengthRun( UInt& idx, UInt rx, UInt numLCUInWidth ) 748 { 749 assert(numLCUInWidth > rx); 750 751 UInt length = 0; 752 UInt maxNumRun = numLCUInWidth - rx - 1; 753 754 for(UInt i=0; i<32; i++) 755 { 756 if(maxNumRun&0x1) 757 { 758 length = i+1; 759 } 760 maxNumRun = (maxNumRun >> 1); 761 } 762 763 idx = 0; 764 if(length) 765 { 766 READ_CODE( length, idx, "alf_run_diff" ); 767 } 768 else 769 { 770 idx = 0; 771 } 772 } 773 774 775 Void TDecCavlc::parseAlfStoredFilterIdx( UInt& idx, UInt numFilterSetsInBuffer ) 776 { 777 assert(numFilterSetsInBuffer > 0); 778 779 UInt length = 0; 780 UInt maxValue = numFilterSetsInBuffer - 1; 781 782 for(UInt i=0; i<32; i++) 783 { 784 if(maxValue&0x1) 785 { 786 length = i+1; 787 } 788 maxValue = (maxValue >> 1); 789 } 790 791 idx = 0; 792 if(length) 793 { 794 READ_CODE( length, idx, "alf_stored_filter_set_idx" ); 795 } 796 else 797 { 798 idx = 0; 799 } 800 } 801 802 803 Void TDecCavlc::xParseAlfParam(ALFParam* pAlfParam) 804 { 805 UInt uiSymbol; 806 Int iSymbol; 807 Int sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE] = {ALF_FILTER_LEN}; 808 809 switch(pAlfParam->componentID) 810 { 811 case ALF_Cb: 812 case ALF_Cr: 813 { 814 pAlfParam->filter_shape = ALF_CROSS9x7_SQUARE3x3; 815 pAlfParam->num_coeff = sqrFiltLengthTab[pAlfParam->filter_shape]; 816 pAlfParam->filters_per_group = 1; 817 for(Int pos=0; pos< pAlfParam->num_coeff; pos++) 818 { 819 READ_SVLC(iSymbol, "alf_filt_coeff"); 820 pAlfParam->coeffmulti[0][pos] = iSymbol; 821 } 822 } 823 break; 824 case ALF_Y: 825 { 826 pAlfParam->filters_per_group = 0; 827 memset (pAlfParam->filterPattern, 0 , sizeof(Int)*NO_VAR_BINS); 828 pAlfParam->filter_shape = 0; 829 pAlfParam->num_coeff = sqrFiltLengthTab[pAlfParam->filter_shape]; 830 831 // filters_per_fr 832 READ_UVLC (uiSymbol, "alf_no_filters_minus1"); 833 pAlfParam->filters_per_group = uiSymbol + 1; 834 835 if(uiSymbol == 1) // filters_per_group == 2 836 { 837 READ_UVLC (uiSymbol, "alf_start_second_filter"); 838 pAlfParam->startSecondFilter = uiSymbol; 839 pAlfParam->filterPattern [uiSymbol] = 1; 840 } 841 else if (uiSymbol > 1) // filters_per_group > 2 842 { 843 pAlfParam->filters_per_group = 1; 844 Int numMergeFlags = 16; 845 for (Int i=1; i<numMergeFlags; i++) 846 { 847 READ_FLAG (uiSymbol, "alf_filter_pattern"); 848 pAlfParam->filterPattern[i] = uiSymbol; 849 pAlfParam->filters_per_group += uiSymbol; 850 } 851 } 852 853 if (pAlfParam->filters_per_group > 1) 854 { 855 READ_FLAG (uiSymbol, "alf_pred_method"); 856 pAlfParam->predMethod = uiSymbol; 857 } 858 for(Int idx = 0; idx < pAlfParam->filters_per_group; ++idx) 859 { 860 READ_FLAG (uiSymbol,"alf_nb_pred_luma"); 861 pAlfParam->nbSPred[idx] = uiSymbol; 862 } 863 864 Int minScanVal = MIN_SCAN_POS_CROSS; 865 866 // Determine maxScanVal 867 Int maxScanVal = 0; 868 Int *pDepthInt = pDepthIntTabShapes[pAlfParam->filter_shape]; 869 for(Int idx = 0; idx < pAlfParam->num_coeff; idx++) 870 { 871 maxScanVal = max(maxScanVal, pDepthInt[idx]); 872 } 873 874 // Golomb parameters 875 if( pAlfParam->filters_per_group > 1 ) 876 { 877 READ_UVLC (uiSymbol, "alf_min_kstart_minus1"); 878 pAlfParam->minKStart = 1 + uiSymbol; 879 880 Int kMin = pAlfParam->minKStart; 881 882 for(Int scanPos = minScanVal; scanPos < maxScanVal; scanPos++) 883 { 884 READ_FLAG (uiSymbol, "alf_golomb_index_bit"); 885 pAlfParam->kMinTab[scanPos] = kMin + uiSymbol; 886 kMin = pAlfParam->kMinTab[scanPos]; 887 } 888 } 889 890 Int scanPos; 891 for(Int idx = 0; idx < pAlfParam->filters_per_group; ++idx) 892 { 893 for(Int i = 0; i < pAlfParam->num_coeff; i++) 894 { 895 scanPos = pDepthInt[i] - 1; 896 Int k = (pAlfParam->filters_per_group == 1) ? kTableTabShapes[ALF_CROSS9x7_SQUARE3x3][i] : pAlfParam->kMinTab[scanPos]; 897 pAlfParam->coeffmulti[idx][i] = xGolombDecode(k); 898 } 899 } 900 } 901 break; 902 default: 903 { 904 printf("Not a legal component ID for ALF\n"); 905 assert(0); 906 exit(-1); 907 } 908 } 909 } 910 911 Int TDecCavlc::xGolombDecode(Int k) 912 { 913 UInt uiSymbol; 914 Int q = -1; 915 Int nr = 0; 916 Int a; 917 918 uiSymbol = 1; 919 while (uiSymbol) 920 { 921 xReadFlag(uiSymbol); 922 q++; 923 } 924 for(a = 0; a < k; ++a) // read out the sequential log2(M) bits 925 { 926 xReadFlag(uiSymbol); 927 if(uiSymbol) 928 nr += 1 << a; 929 } 930 nr += q << k; 931 if(nr != 0) 932 { 933 xReadFlag(uiSymbol); 934 nr = (uiSymbol)? nr: -nr; 935 } 936 #if ENC_DEC_TRACE 937 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 938 fprintf( g_hTrace, "%-40s ge(v) : %d\n", "alf_coeff_luma", nr ); 939 #endif 940 return nr; 941 } 942 943 Void TDecCavlc::parsePPS(TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet) 944 { 945 #if ENC_DEC_TRACE 946 xTracePPSHeader (pcPPS); 947 #endif 948 UInt uiCode; 949 950 Int iCode; 951 952 READ_UVLC( uiCode, "pic_parameter_set_id"); pcPPS->setPPSId (uiCode); 953 READ_UVLC( uiCode, "seq_parameter_set_id"); pcPPS->setSPSId (uiCode); 954 955 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 956 if( pcPPS->getSignHideFlag() ) 957 { 958 READ_CODE( 4, uiCode, "sign_hiding_threshold"); pcPPS->setTSIG(uiCode); 959 } 960 961 #if CABAC_INIT_FLAG 962 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 963 #endif 964 // entropy_coding_mode_flag 965 // We code the entropy_coding_mode_flag, it's needed for tests. 966 READ_FLAG( uiCode, "entropy_coding_mode_flag" ); pcPPS->setEntropyCodingMode( uiCode ? true : false ); 967 if (pcPPS->getEntropyCodingMode()) 968 { 969 } 970 971 // num_ref_idx_l0_default_active_minus1 972 // num_ref_idx_l1_default_active_minus1 973 READ_SVLC(iCode, "pic_init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); 974 READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); 975 READ_FLAG( uiCode, "enable_temporal_mvp_flag" ); pcPPS->setEnableTMVPFlag( uiCode ? true : false ); 976 READ_CODE( 2, uiCode, "slice_granularity" ); pcPPS->setSliceGranularity(uiCode); 977 978 // alf_param() ? 979 980 READ_UVLC( uiCode, "max_cu_qp_delta_depth"); 981 if(uiCode == 0) 982 { 983 pcPPS->setUseDQP (false); 984 pcPPS->setMaxCuDQPDepth( 0 ); 985 } 986 else 987 { 988 pcPPS->setUseDQP (true); 989 pcPPS->setMaxCuDQPDepth(uiCode - 1); 990 } 991 992 READ_SVLC( iCode, "chroma_qp_offset"); 993 pcPPS->setChromaQpOffset(iCode); 994 995 READ_SVLC( iCode, "chroma_qp_offset_2nd"); 996 pcPPS->setChromaQpOffset2nd(iCode); 997 998 READ_FLAG( uiCode, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 999 pcPPS->setUseWP( uiCode==1 ); 1000 READ_CODE( 2, uiCode, "weighted_bipred_idc" ); // Use of Bi-Directional Weighting Prediction (B_SLICE) 1001 pcPPS->setWPBiPredIdc( uiCode ); 1002 //printf("TDecCavlc::parsePPS():\tm_bUseWeightPred=%d\tm_uiBiPredIdc=%d\n", pcPPS->getUseWP(), pcPPS->getWPBiPredIdc()); 1003 1004 READ_FLAG( uiCode, "output_flag_present_flag" ); 1005 pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 1006 1007 if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==1) 1008 { 1009 READ_FLAG ( uiCode, "tile_info_present_flag" ); 1010 pcPPS->setColumnRowInfoPresent(uiCode); 1011 READ_FLAG ( uiCode, "tile_control_present_flag" ); 1012 pcPPS->setTileBehaviorControlPresentFlag(uiCode); 1013 if( pcPPS->getColumnRowInfoPresent() == 1 ) 1014 { 1015 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); 1016 pcPPS->setNumColumnsMinus1( uiCode ); 1017 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); 1018 pcPPS->setNumRowsMinus1( uiCode ); 1019 READ_FLAG ( uiCode, "uniform_spacing_flag" ); 1020 pcPPS->setUniformSpacingIdr( uiCode ); 1021 1022 if( pcPPS->getUniformSpacingIdr() == 0 ) 1023 { 1024 UInt* columnWidth = (UInt*)malloc(pcPPS->getNumColumnsMinus1()*sizeof(UInt)); 1025 for(UInt i=0; i<pcPPS->getNumColumnsMinus1(); i++) 1026 { 1027 READ_UVLC( uiCode, "column_width" ); 1028 columnWidth[i] = uiCode; 1029 } 1030 pcPPS->setColumnWidth(columnWidth); 1031 free(columnWidth); 1032 1033 UInt* rowHeight = (UInt*)malloc(pcPPS->getNumRowsMinus1()*sizeof(UInt)); 1034 for(UInt i=0; i<pcPPS->getNumRowsMinus1(); i++) 1035 { 1036 READ_UVLC( uiCode, "row_height" ); 1037 rowHeight[i] = uiCode; 1038 } 1039 pcPPS->setRowHeight(rowHeight); 1040 free(rowHeight); 1041 } 1042 } 1043 1044 1045 if(pcPPS->getTileBehaviorControlPresentFlag() == 1) 1046 { 1047 Int iNumColTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumColumnsMinus1()); 1048 Int iNumRowTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumRowsMinus1()); 1049 pcPPS->setLFCrossTileBoundaryFlag(true); //default 1050 1051 if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0) 1052 { 1053 READ_FLAG ( uiCode, "loop_filter_across_tile_flag" ); 1054 pcPPS->setLFCrossTileBoundaryFlag( (uiCode == 1)?true:false ); 1055 } 1056 } 1057 } 1058 else if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==2) 1059 { 1060 READ_UVLC( uiCode, "num_substreams_minus1" ); pcPPS->setNumSubstreams(uiCode+1); 1061 } 1062 1063 READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); 1064 pcPPS->setDeblockingFilterControlPresent( uiCode ? true : false); 1065 READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); 1066 assert(uiCode == LOG2_PARALLEL_MERGE_LEVEL_MINUS2); 1067 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 1068 1069 READ_FLAG( uiCode, "pps_extension_flag"); 1070 if (uiCode) 1071 { 1079 } 1080 } 1081 READ_FLAG( uiCode, "iv_mv_scaling_flag"); pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); 1082 } 1083 #endif 1084 pcVPS->checkVPSExtensionSyntax(); 1085 1086 pcVPS->setRefLayers(); 1087 1088 #else 1072 1089 while ( xMoreRbspData() ) 1073 1090 { 1074 READ_FLAG( uiCode, "pps_extension_data_flag"); 1075 } 1076 } 1077 } 1078 #if QC_MVHEVC_B0046 1079 Void TDecCavlc::parseVPS(TComVPS* pcVPS) 1080 { 1081 UInt uiCode; 1082 READ_CODE( 4, uiCode, "video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 1083 READ_FLAG( uiCode, "temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); 1084 READ_CODE( 2, uiCode, "vps_reserved_zero_2bits" ); assert( !uiCode ); 1085 READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); 1086 READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); 1087 READ_CODE( 12, uiCode, "vps_extension_offset" ); assert( !uiCode ); 1088 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 1089 { 1090 READ_UVLC( uiCode, "max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 1091 READ_UVLC( uiCode, "num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 1092 READ_UVLC( uiCode, "max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 1093 } 1094 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHRDParameters(uiCode); 1095 assert(pcVPS->getNumHRDParameters()==0); 1096 for ( UInt i = 0; i < pcVPS->getNumHRDParameters(); i ++) 1097 { 1098 // if( i > 0 ) 1099 //{ 1100 // READ_UVLC (0, "op_num_layer_id_values_minus1[ opIdx ]"); 1101 // for( i = 0; i <= op_num_layer_id_values_minus1[ opIdx ]; i++ ) 1102 // READ_UVLC(0, 6, "op_layer_id[ opIdx ][ i ]"); 1103 //} 1104 //hrd_parameters( i = = 0, vps_max_sub_layers_minus1 ); 1105 } 1106 1107 READ_CODE( 1, uiCode, "bit_equal_to_one" ); assert( uiCode ); 1108 //vps_extension_byte_alignment_reserved_one_bit 1109 xReadVPSAlignOne(); 1110 READ_CODE( 8, uiCode, "num_additional_layer_operation_points" ); pcVPS->setNumAddiLayerOperationPoints( uiCode ); 1111 READ_CODE( 8, uiCode, "num_additional_profile_level_sets" ); pcVPS->setNumAddiProLevelSets( uiCode); 1112 1113 1114 for(UInt i=0; i <= pcVPS->getMaxLayers()-1; i++) 1115 { 1116 READ_CODE( 4, uiCode, "num_types_zero_4bits[i]" ); assert( !uiCode ); 1117 READ_CODE( 4, uiCode, "type_zero_4bits[i]" ); assert( !uiCode ); 1118 READ_CODE( 8, uiCode, "view_id[i]" ); pcVPS->setViewId(uiCode, i); 1119 // WRITE_SVLC( pcVPS->getViewOrderIdx(i), "view_order_idx[i]" ); 1120 if(i) 1121 { 1122 READ_CODE( 6, uiCode, "num_direct_ref_layers[ i ]" ); pcVPS->setNumDirectRefLayer(uiCode, i); 1123 for (UInt j = 0; j< pcVPS->getNumDirectRefLayer(i); j++) 1124 { 1125 READ_CODE( 6, uiCode, "ref_layer_id[i][j]" ); pcVPS->setDirectRefLayerId (uiCode, i, j); 1126 } 1127 } 1128 } 1129 for( UInt i=1; i<=pcVPS->getNumAddiProLevelSets(); i++) 1130 { 1131 //profile_tier_level 1132 } 1133 for( UInt i=1; i<= pcVPS->getNumAddiLayerOperationPoints(); i++) 1134 { 1135 if(pcVPS->getMaxLayers() == 3) 1136 { 1137 pcVPS->setNumOpLayerIdMinus1((i < pcVPS->getNumAddiLayerOperationPoints() ? 1: 2), (i-1)); 1138 } 1139 else if( i==1 ) 1140 { 1141 assert(pcVPS->getNumAddiLayerOperationPoints()==1); 1142 pcVPS->setNumOpLayerIdMinus1(pcVPS->getMaxLayers()-1, (i-1)); 1143 } 1144 READ_UVLC( uiCode, "op_num_layer_id_values_minus1[ opIdx ]" ); pcVPS->setNumOpLayerIdMinus1(uiCode, i-1); 1145 for(UInt j = 0; j <= pcVPS->getNumOpLayerIdMinus1(i-1); j++ ) 1146 { 1147 READ_UVLC( uiCode, "op_layer_id[ opIdx ][ i ]" ); pcVPS->setNumOpLayerId(uiCode, i-1, j); 1148 } 1149 if (pcVPS->getNumAddiProLevelSets()) 1150 { 1151 //profile_level_idx[ i ] 1152 } 1153 } 1091 READ_FLAG( uiCode, "vps_extension_data_flag"); 1092 } 1093 #endif 1094 } 1095 1096 #if H_3D 1097 pcVPS->initViewIndex(); 1098 #endif 1154 1099 return; 1155 1100 } 1156 #else 1157 #if VIDYO_VPS_INTEGRATION 1158 Void TDecCavlc::parseVPS(TComVPS* pcVPS) 1101 1102 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) 1159 1103 { 1160 1104 UInt uiCode; 1161 1105 Int iCode; 1162 1163 READ_CODE( 3, uiCode, "max_temporal_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); 1164 READ_CODE( 5, uiCode, "max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); 1165 READ_FLAG( uiCode, "temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); 1166 READ_UVLC( uiCode, "video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 1167 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 1168 { 1169 READ_UVLC( uiCode, "max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 1170 READ_UVLC( uiCode, "num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 1171 READ_UVLC( uiCode, "max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 1172 } 1173 1174 READ_CODE( 1, uiCode, "bit_equal_to_one" ); assert( uiCode ); 1175 1176 if( pcVPS->getMaxLayers() - 1 > 0 ) 1177 { 1178 READ_UVLC( uiCode, "extension_type" ); pcVPS->setExtensionType( uiCode ); 1179 1180 pcVPS->setViewOrderIdx( 0, 0 ); 1181 pcVPS->setViewId( 0, 0 ); 1182 pcVPS->setDepthFlag( 0, 0 ); 1183 for(UInt i = 1; i <= pcVPS->getMaxLayers()-1; i++) 1184 { 1185 READ_FLAG( uiCode, "dependent_flag[i]" ); pcVPS->setDependentFlag( uiCode ? true:false, i); 1186 if( pcVPS->getDependentFlag(i) ) 1187 { 1188 READ_UVLC( uiCode, "delta_reference_layer_id_minus1[i]" ); pcVPS->setDependentLayer( i - uiCode + 1, i ); 1189 if( pcVPS->getExtensionType() == VPS_EXTENSION_TYPE_MULTI_VIEW ) 1190 { 1191 READ_UVLC( uiCode, "view_id[i]" ); pcVPS->setViewId( uiCode, i ); 1192 READ_FLAG( uiCode, "depth_flag[i]" ); pcVPS->setDepthFlag( uiCode ? true:false, i ); 1193 READ_SVLC( iCode, "view_order_idx[i]" ); pcVPS->setViewOrderIdx( iCode, i ); 1194 } 1195 1196 } 1197 } 1198 #if INTER_VIEW_VECTOR_SCALING_C0115 1199 READ_FLAG( uiCode, "inter_view_vector_scaling_flag" ); pcVPS->setIVScalingFlag( uiCode ? true:false); 1200 #endif 1201 } 1202 1203 READ_FLAG( uiCode, "vps_extension_flag" ); assert(!uiCode); 1204 //future extensions go here.. 1205 1206 return; 1207 } 1208 1209 #endif 1210 #endif 1211 #if HHI_MPI || H3D_QTL 1212 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Bool bIsDepth) 1213 #else 1214 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 1215 #endif 1216 { 1217 #if ENC_DEC_TRACE 1218 xTraceSPSHeader (pcSPS); 1219 #endif 1220 1221 UInt uiCode; 1222 #if !QC_MVHEVC_B0046 1223 Int iCode; 1224 #endif 1225 READ_CODE( 8, uiCode, "profile_idc" ); pcSPS->setProfileIdc( uiCode ); 1226 READ_CODE( 8, uiCode, "reserved_zero_8bits" ); 1227 READ_CODE( 8, uiCode, "level_idc" ); pcSPS->setLevelIdc( uiCode ); 1228 READ_UVLC( uiCode, "seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 1229 #if VIDYO_VPS_INTEGRATION 1230 READ_UVLC( uiCode, "video_parameter_set_id" ); pcSPS->setVPSId( uiCode ); 1231 #endif 1232 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 1233 READ_CODE( 3, uiCode, "max_temporal_layers_minus1" ); pcSPS->setMaxTLayers( uiCode+1 ); 1234 READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); 1235 READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); 1236 READ_FLAG( uiCode, "pic_cropping_flag"); pcSPS->setPicCroppingFlag ( uiCode ? true : false ); 1237 if (uiCode != 0) 1238 { 1239 READ_UVLC( uiCode, "pic_crop_left_offset" ); pcSPS->setPicCropLeftOffset( uiCode ); 1240 READ_UVLC( uiCode, "pic_crop_right_offset" ); pcSPS->setPicCropRightOffset( uiCode ); 1241 READ_UVLC( uiCode, "pic_crop_top_offset" ); pcSPS->setPicCropTopOffset( uiCode ); 1242 READ_UVLC( uiCode, "pic_crop_bottom_offset" ); pcSPS->setPicCropBottomOffset( uiCode ); 1243 } 1244 1245 #if FULL_NBIT 1246 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 1247 g_uiBitDepth = 8 + uiCode; 1248 g_uiBitIncrement = 0; 1249 pcSPS->setBitDepth(g_uiBitDepth); 1250 pcSPS->setBitIncrement(g_uiBitIncrement); 1251 #else 1252 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 1253 g_uiBitDepth = 8; 1254 g_uiBitIncrement = uiCode; 1255 pcSPS->setBitDepth(g_uiBitDepth); 1256 pcSPS->setBitIncrement(g_uiBitIncrement); 1257 #endif 1258 1259 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1260 g_iDeltaDCsQuantOffset = g_uiBitIncrement - 2; 1261 #endif 1262 1263 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 1264 1265 g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); 1266 1267 #if IBDI_NOCLIP_RANGE 1268 g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; 1269 #else 1270 g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); 1271 #endif 1272 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 1273 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 1274 1275 READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); 1276 1277 if( pcSPS->getUsePCM() ) 1278 { 1279 READ_CODE( 4, uiCode, "pcm_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepthLuma ( 1 + uiCode ); 1280 READ_CODE( 4, uiCode, "pcm_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepthChroma ( 1 + uiCode ); 1281 } 1282 1283 #if LOSSLESS_CODING 1284 READ_FLAG( uiCode, "qpprime_y_zero_transquant_bypass_flag" ); pcSPS->setUseLossless ( uiCode ? true : false ); 1285 #endif 1286 1287 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 1288 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 1289 { 1290 READ_UVLC ( uiCode, "max_dec_pic_buffering"); 1291 pcSPS->setMaxDecPicBuffering( uiCode, i); 1292 READ_UVLC ( uiCode, "num_reorder_pics" ); 1293 pcSPS->setNumReorderPics(uiCode, i); 1294 READ_UVLC ( uiCode, "max_latency_increase"); 1295 pcSPS->setMaxLatencyIncrease( uiCode, i ); 1296 } 1297 1298 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag" ); 1299 pcSPS->setRestrictedRefPicListsFlag( uiCode ); 1300 if( pcSPS->getRestrictedRefPicListsFlag() ) 1301 { 1302 READ_FLAG( uiCode, "lists_modification_present_flag" ); 1303 pcSPS->setListsModificationPresentFlag(uiCode); 1304 } 1305 else 1306 { 1307 pcSPS->setListsModificationPresentFlag(true); 1308 } 1309 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 1310 UInt log2MinCUSize = uiCode + 3; 1311 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 1312 UInt uiMaxCUDepthCorrect = uiCode; 1313 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 1314 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 1315 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 1316 1317 READ_UVLC( uiCode, "log2_diff_max_min_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); 1318 pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); 1319 1320 if(log2MinCUSize == 3) 1321 { 1322 xReadFlag( uiCode ); pcSPS->setDisInter4x4( uiCode ? true : false ); 1323 } 1324 1325 if( pcSPS->getUsePCM() ) 1326 { 1327 READ_UVLC( uiCode, "log2_min_pcm_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); 1328 READ_UVLC( uiCode, "log2_diff_max_min_pcm_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); 1329 } 1330 1331 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 1332 READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); 1333 g_uiAddCUDepth = 0; 1334 while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth ) ) ) 1335 { 1336 g_uiAddCUDepth++; 1337 } 1338 pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth ); 1339 g_uiMaxCUDepth = uiMaxCUDepthCorrect+g_uiAddCUDepth; 1340 // BB: these parameters may be removed completly and replaced by the fixed values 1341 pcSPS->setMinTrDepth( 0 ); 1342 pcSPS->setMaxTrDepth( 1 ); 1343 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 1344 READ_FLAG( uiCode, "chroma_pred_from_luma_enabled_flag" ); pcSPS->setUseLMChroma ( uiCode ? true : false ); 1345 READ_FLAG( uiCode, "deblocking_filter_in_aps_enabled_flag" ); pcSPS->setUseDF ( uiCode ? true : false ); 1346 READ_FLAG( uiCode, "loop_filter_across_slice_flag" ); pcSPS->setLFCrossSliceBoundaryFlag( uiCode ? true : false); 1347 READ_FLAG( uiCode, "asymmetric_motion_partitions_enabled_flag" ); pcSPS->setUseAMP( uiCode ); 1348 READ_FLAG( uiCode, "non_square_quadtree_enabled_flag" ); pcSPS->setUseNSQT( uiCode ); 1349 READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); 1350 READ_FLAG( uiCode, "adaptive_loop_filter_enabled_flag" ); pcSPS->setUseALF ( uiCode ? true : false ); 1351 if(pcSPS->getUseALF()) 1352 { 1353 READ_FLAG( uiCode, "alf_coef_in_slice_flag" ); pcSPS->setUseALFCoefInSlice ( uiCode ? true : false ); 1354 } 1355 if( pcSPS->getUsePCM() ) 1356 { 1357 READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); 1358 } 1359 1360 READ_FLAG( uiCode, "temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 1361 1362 1363 TComRPSList* rpsList = pcSPS->getRPSList(); 1364 TComReferencePictureSet* rps; 1365 1366 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 1367 rpsList->create(uiCode); 1368 1369 for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) 1370 { 1371 rps = rpsList->getReferencePictureSet(i); 1372 parseShortTermRefPicSet(pcSPS,rps,i); 1373 } 1374 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 1375 1376 // AMVP mode for each depth (AM_NONE or AM_EXPL) 1377 for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++) 1378 { 1379 xReadFlag( uiCode ); 1380 pcSPS->setAMVPMode( i, (AMVP_MODE)uiCode ); 1381 } 1382 1383 READ_CODE(2, uiCode, "tiles_or_entropy_coding_sync_idc"); pcSPS->setTilesOrEntropyCodingSyncIdc(uiCode); 1384 1385 if(pcSPS->getTilesOrEntropyCodingSyncIdc() == 1) 1386 { 1387 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); 1388 pcSPS->setNumColumnsMinus1( uiCode ); 1389 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); 1390 pcSPS->setNumRowsMinus1( uiCode ); 1391 READ_FLAG ( uiCode, "uniform_spacing_flag" ); 1392 pcSPS->setUniformSpacingIdr( uiCode ); 1393 if( pcSPS->getUniformSpacingIdr() == 0 ) 1394 { 1395 UInt* columnWidth = (UInt*)malloc(pcSPS->getNumColumnsMinus1()*sizeof(UInt)); 1396 for(UInt i=0; i<pcSPS->getNumColumnsMinus1(); i++) 1397 { 1398 READ_UVLC( uiCode, "column_width" ); 1399 columnWidth[i] = uiCode; 1400 } 1401 pcSPS->setColumnWidth(columnWidth); 1402 free(columnWidth); 1403 1404 UInt* rowHeight = (UInt*)malloc(pcSPS->getNumRowsMinus1()*sizeof(UInt)); 1405 for(UInt i=0; i<pcSPS->getNumRowsMinus1(); i++) 1406 { 1407 READ_UVLC( uiCode, "row_height" ); 1408 rowHeight[i] = uiCode; 1409 } 1410 pcSPS->setRowHeight(rowHeight); 1411 free(rowHeight); 1412 } 1413 pcSPS->setLFCrossTileBoundaryFlag(true); //default 1414 1415 if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0) 1416 { 1417 READ_FLAG ( uiCode, "loop_filter_across_tile_flag" ); 1418 pcSPS->setLFCrossTileBoundaryFlag( (uiCode==1)?true:false); 1419 } 1420 } 1421 READ_FLAG( uiCode, "sps_extension_flag"); 1422 #if !QC_MVHEVC_B0046 1423 if(uiCode) 1424 { 1425 READ_FLAG( uiCode, "interview_refs_present_flag"); 1426 if(uiCode) 1427 { 1428 READ_UVLC( uiCode, "num_usable_interview_refs_minus1" ); 1429 pcSPS->setNumberOfUsableInterViewRefs( uiCode + 1 ); 1430 1431 Int prev = 0; 1432 for( Int j = 0 ; j < pcSPS->getNumberOfUsableInterViewRefs(); j++ ) 1433 { 1434 READ_UVLC(uiCode, "delta_usable_interview_ref_minus1"); 1435 pcSPS->setUsableInterViewRef( j, (prev - uiCode - 1) ); 1436 prev = pcSPS->getUsableInterViewRef( j ); 1437 } 1438 } 1439 1440 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1441 READ_FLAG( uiCode, "enable_dmm_flag" ); 1442 pcSPS->setUseDMM( uiCode ); 1443 #endif 1444 1445 #if HHI_MPI 1446 if( bIsDepth ) 1447 { 1448 READ_FLAG( uiCode, "use_mvi_flag" ); 1449 pcSPS->setUseMVI( uiCode ); 1450 } 1451 #endif 1452 #if H3D_QTL 1453 if( bIsDepth ) 1454 { 1455 READ_FLAG( uiCode, "use_qtlpc_flag" ); 1456 pcSPS->setUseQTLPC( uiCode ); 1457 } 1458 #endif 1459 1460 #if RWTH_SDC_DLT_B0036 1461 if( bIsDepth ) 1462 { 1463 READ_FLAG( uiCode, "use_dlt_flag" ); 1464 pcSPS->setUseDLT( uiCode ); 1465 if( pcSPS->getUseDLT() ) 1466 { 1467 // decode mapping 1468 UInt uiNumDepthValues; 1469 // parse number of values in DLT 1470 xReadUvlc( uiNumDepthValues ); 1471 1472 // parse actual DLT values 1473 UInt* auiIdx2DepthValue = (UInt*) calloc(uiNumDepthValues, sizeof(UInt)); 1474 for(UInt d=0; d<uiNumDepthValues; d++) 1475 { 1476 xReadUvlc( uiCode ); 1477 auiIdx2DepthValue[d] = uiCode; 1478 } 1479 1480 pcSPS->setDepthLUTs(auiIdx2DepthValue, uiNumDepthValues); 1481 1482 // clean memory 1483 free(auiIdx2DepthValue); 1484 } 1485 else 1486 pcSPS->setDepthLUTs(); 1487 } 1488 #endif 1489 1490 READ_FLAG( uiCode, "base_view_flag" ); 1491 if( uiCode ) 1492 { // baseview SPS -> set standard values 1493 pcSPS->initMultiviewSPS ( 0 ); 1494 #if DEPTH_MAP_GENERATION 1495 pcSPS->setPredDepthMapGeneration( 0, false ); 1496 #endif 1497 #if H3D_IVRP 1498 #if QC_ARP_D0177 1499 pcSPS->setUseAdvRP ( 0 ); 1500 pcSPS->setARPStepNum( 1 ); 1501 #else 1502 pcSPS->setMultiviewResPredMode ( 0 ); 1503 #endif 1504 #endif 1505 1506 } 1507 else 1508 { 1509 READ_FLAG( uiCode, "depth_flag" ); 1510 if( uiCode ) 1511 { 1512 #if FCO_FIX_SPS_CHANGE 1513 UInt uiViewId, uiCamParPrecision; 1514 Int iVOI; 1515 Bool bCamParSlice; 1516 READ_UVLC( uiCode, "view_id" ); 1517 READ_SVLC( iCode, "view_order_idx" ); 1518 uiViewId = uiCode; 1519 iVOI = iCode; 1520 1521 if ( uiViewId == 0 ) 1522 { 1523 pcSPS->initMultiviewSPSDepth ( uiViewId, iVOI ); 1524 } 1525 else 1526 { 1527 READ_UVLC( uiCamParPrecision, "camera_parameter_precision" ); 1528 READ_FLAG( uiCode, "camera_parameter_in_slice_header" ); bCamParSlice = ( uiCode == 1 ); 1529 if( !bCamParSlice ) 1530 { 1531 for( UInt uiBaseId = 0; uiBaseId < uiViewId; uiBaseId++ ) 1532 { 1533 READ_SVLC( iCode, "coded_scale" ); m_aaiTempScale [ uiBaseId ][ uiViewId ] = iCode; 1534 READ_SVLC( iCode, "coded_offset" ); m_aaiTempOffset[ uiBaseId ][ uiViewId ] = iCode; 1535 READ_SVLC( iCode, "inverse_coded_scale_plus_coded_scale" ); m_aaiTempScale [ uiViewId ][ uiBaseId ] = iCode - m_aaiTempScale [ uiBaseId ][ uiViewId ]; 1536 READ_SVLC( iCode, "inverse_coded_offset_plus_coded_offset" ); m_aaiTempOffset[ uiViewId ][ uiBaseId ] = iCode - m_aaiTempOffset[ uiBaseId ][ uiViewId ]; 1537 } 1538 } 1539 pcSPS->initMultiviewSPSDepth( uiViewId, iVOI, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 1540 1541 } 1542 #else 1543 READ_UVLC( uiCode, "view_id" ); 1544 READ_SVLC( iCode, "view_order_idx" ); 1545 pcSPS->initMultiviewSPSDepth ( uiCode, iCode ); 1546 #endif 1547 #if DEPTH_MAP_GENERATION 1548 #if FCO_FIX_SPS_CHANGE 1549 pcSPS->setPredDepthMapGeneration( uiViewId, true ); 1550 #else 1551 pcSPS->setPredDepthMapGeneration( uiCode, true ); 1552 #endif 1553 #endif 1554 #if H3D_IVRP 1555 #if QC_ARP_D0177 1556 pcSPS->setUseAdvRP ( 0 ); 1557 pcSPS->setARPStepNum( 1 ); 1558 #else 1559 pcSPS->setMultiviewResPredMode ( 0 ); 1560 #endif 1561 #endif 1562 1563 } 1564 else 1565 { 1566 UInt uiViewId, uiCamParPrecision; 1567 Int iVOI; 1568 Bool bCamParSlice; 1569 READ_UVLC( uiViewId, "view_id" ); uiViewId++; 1570 READ_SVLC( iVOI, "view_order_idx" ); 1571 READ_UVLC( uiCamParPrecision, "camera_parameter_precision" ); 1572 READ_FLAG( uiCode, "camera_parameter_in_slice_header" ); bCamParSlice = ( uiCode == 1 ); 1573 if( !bCamParSlice ) 1574 { 1575 for( UInt uiBaseId = 0; uiBaseId < uiViewId; uiBaseId++ ) 1576 { 1577 READ_SVLC( iCode, "coded_scale" ); m_aaiTempScale [ uiBaseId ][ uiViewId ] = iCode; 1578 READ_SVLC( iCode, "coded_offset" ); m_aaiTempOffset[ uiBaseId ][ uiViewId ] = iCode; 1579 READ_SVLC( iCode, "inverse_coded_scale_plus_coded_scale" ); m_aaiTempScale [ uiViewId ][ uiBaseId ] = iCode - m_aaiTempScale [ uiBaseId ][ uiViewId ]; 1580 READ_SVLC( iCode, "inverse_coded_offset_plus_coded_offset" ); m_aaiTempOffset[ uiViewId ][ uiBaseId ] = iCode - m_aaiTempOffset[ uiBaseId ][ uiViewId ]; 1581 } 1582 } 1583 pcSPS->initMultiviewSPS( uiViewId, iVOI, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 1584 1585 #if DEPTH_MAP_GENERATION 1586 UInt uiPredDepthMapGeneration = 0, uiPdmPrecision = 0; 1587 #if H3D_IVMP 1588 UInt uiMultiviewMvPredMode = 0; 1589 #endif 1590 #if H3D_IVRP & !QC_ARP_D0177 1591 UInt uiMultiviewResPredMode = 0; 1592 #endif 1593 READ_UVLC( uiPredDepthMapGeneration, "Pdm_generation" ); 1594 if( uiPredDepthMapGeneration ) 1595 { 1596 READ_UVLC( uiPdmPrecision, "Pdm_precision" ); 1597 for( UInt uiBaseId = 0; uiBaseId < uiViewId; uiBaseId++ ) 1598 { 1599 READ_SVLC( iCode, "Pdm_scale_nom_delta" ); m_aaiTempPdmScaleNomDelta[ uiViewId ][ uiBaseId ] = iCode; 1600 READ_SVLC( iCode, "Pdm_offset" ); m_aaiTempPdmOffset [ uiViewId ][ uiBaseId ] = iCode; 1601 } 1602 #if H3D_IVMP 1603 READ_UVLC( uiMultiviewMvPredMode, "multi_view_mv_pred_mode" ); 1604 #endif 1605 #if H3D_IVRP & !QC_ARP_D0177 1606 READ_FLAG( uiMultiviewResPredMode, "multi_view_residual_pred_mode" ); 1607 #endif 1608 } 1609 #if H3D_IVMP 1610 pcSPS->setPredDepthMapGeneration( uiViewId, false, uiPredDepthMapGeneration, uiMultiviewMvPredMode, uiPdmPrecision, m_aaiTempPdmScaleNomDelta, m_aaiTempPdmOffset ); 1611 #else 1612 pcSPS->setPredDepthMapGeneration( uiViewId, false, uiPredDepthMapGeneration, 0, uiPdmPrecision, m_aaiTempPdmScaleNomDelta, m_aaiTempPdmOffset ); 1613 #endif 1614 #endif 1615 #if H3D_IVRP 1616 #if QC_ARP_D0177 1617 READ_FLAG( uiCode , "advanced_residual_pred_flag" ); pcSPS->setUseAdvRP( uiCode ); 1618 if( pcSPS->getUseAdvRP() ) 1619 pcSPS->setARPStepNum( QC_ARP_WFNR ); 1620 else 1621 pcSPS->setARPStepNum( 1 ); 1622 #else 1623 pcSPS->setMultiviewResPredMode ( uiMultiviewResPredMode ); 1624 #endif 1625 #endif 1626 1627 } 1628 1629 #if MTK_D0156 1630 1631 pcSPS->setUseVSPCompensation( false ); 1632 pcSPS->setUseDVPRefine( false ); 1633 1634 //Comments: Currently, BVSP and DoNBDV are not used for depth coding 1635 #if MERL_VSP_COMPENSATION_C0152 1636 READ_FLAG( uiCode, "view_synthesis_pred_flag" );pcSPS->setUseVSPCompensation( uiCode ? true : false ); 1637 #endif 1638 READ_FLAG( uiCode, "dv_refine_flag" ); pcSPS->setUseDVPRefine( uiCode ? true : false ); 1639 #endif 1640 } 1641 READ_FLAG( uiCode, "sps_extension2_flag"); 1642 if (uiCode) 1643 { 1644 while ( xMoreRbspData() ) 1645 { 1646 READ_FLAG( uiCode, "sps_extension2_data_flag"); 1647 } 1648 } 1649 } 1650 #endif 1651 } 1652 1653 Void TDecCavlc::readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ) 1654 { 1655 xReadCode ( uiBitsUsed, uiTileIdx ); 1656 } 1657 1658 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 1659 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) 1660 #else 1661 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) 1662 #endif 1663 { 1664 UInt uiCode; 1665 Int iCode; 1666 1106 1667 1107 #if ENC_DEC_TRACE 1668 1108 xTraceSliceHeader(rpcSlice); 1669 1109 #endif 1670 Int numCUs = ((rpcSlice->getSPS()->getPicWidthInLumaSamples()+rpcSlice->getSPS()->getMaxCUWidth()-1)/rpcSlice->getSPS()->getMaxCUWidth())*((rpcSlice->getSPS()->getPicHeightInLumaSamples()+rpcSlice->getSPS()->getMaxCUHeight()-1)/rpcSlice->getSPS()->getMaxCUHeight());1671 Int maxParts = (1<<(rpcSlice->getSPS()->getMaxCUDepth()<<1));1672 Int numParts = (1<<(rpcSlice->getPPS()->getSliceGranularity()<<1));1673 UInt lCUAddress = 0;1674 Int reqBitsOuter = 0;1675 while(numCUs>(1<<reqBitsOuter))1676 {1677 reqBitsOuter++;1678 }1679 Int reqBitsInner = 0;1680 while((numParts)>(1<<reqBitsInner))1681 {1682 reqBitsInner++;1683 }1684 1685 READ_FLAG( uiCode, "first_slice_in_pic_flag" );1686 UInt address;1687 UInt innerAddress = 0;1688 1689 #if LGE_ILLUCOMP_B00451690 // IC flag is on only first_slice_in_pic1691 if (uiCode)1692 {1693 UInt uiCodeTmp = 0;1694 if ( rpcSlice->getSPS()->getViewId()1695 #if !LGE_ILLUCOMP_DEPTH_C00461696 && !rpcSlice->getSPS()->isDepth()1697 #endif1698 )1699 {1700 READ_FLAG (uiCodeTmp, "applying IC flag");1701 }1702 rpcSlice->setApplyIC(uiCodeTmp);1703 #if SHARP_ILLUCOMP_PARSE_D00601704 if (rpcSlice->getApplyIC())1705 {1706 READ_FLAG (uiCodeTmp, "ic_skip_mergeidx0");1707 rpcSlice->setIcSkipParseFlag(uiCodeTmp);1708 }1709 #endif1710 }1711 #endif1712 1713 if(!uiCode)1714 {1715 READ_CODE( reqBitsOuter+reqBitsInner, address, "slice_address" );1716 lCUAddress = address >> reqBitsInner;1717 innerAddress = address - (lCUAddress<<reqBitsInner);1718 }1719 //set uiCode to equal slice start address (or entropy slice start address)1720 uiCode=(maxParts*lCUAddress)+(innerAddress*(maxParts>>(rpcSlice->getPPS()->getSliceGranularity()<<1)));1721 1722 rpcSlice->setEntropySliceCurStartCUAddr( uiCode );1723 rpcSlice->setEntropySliceCurEndCUAddr(numCUs*maxParts);1724 1725 // slice_type1726 READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode);1727 // lightweight_slice_flag1728 READ_FLAG( uiCode, "entropy_slice_flag" );1729 Bool bEntropySlice = uiCode ? true : false;1730 1731 if (bEntropySlice)1732 {1733 rpcSlice->setNextSlice ( false );1734 rpcSlice->setNextEntropySlice ( true );1735 }1736 else1737 {1738 rpcSlice->setNextSlice ( true );1739 rpcSlice->setNextEntropySlice ( false );1740 1741 uiCode=(maxParts*lCUAddress)+(innerAddress*(maxParts>>(rpcSlice->getPPS()->getSliceGranularity()<<1)));1742 rpcSlice->setSliceCurStartCUAddr(uiCode);1743 rpcSlice->setSliceCurEndCUAddr(numCUs*maxParts);1744 }1745 1110 TComPPS* pps = NULL; 1746 1111 TComSPS* sps = NULL; 1747 1748 if (!bEntropySlice) 1749 { 1750 READ_UVLC ( uiCode, "pic_parameter_set_id" ); rpcSlice->setPPSId(uiCode); 1751 pps = parameterSetManager->getPrefetchedPPS(uiCode); 1752 sps = parameterSetManager->getPrefetchedSPS(pps->getSPSId()); 1753 rpcSlice->setSPS(sps); 1754 rpcSlice->setPPS(pps); 1112 #if H_MV 1113 TComVPS* vps = NULL; 1114 #endif 1115 1116 UInt firstSliceSegmentInPic; 1117 READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); 1118 if( rpcSlice->getRapPicFlag()) 1119 { 1120 READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored 1121 } 1122 READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); rpcSlice->setPPSId(uiCode); 1123 pps = parameterSetManager->getPrefetchedPPS(uiCode); 1124 //!KS: need to add error handling code here, if PPS is not available 1125 assert(pps!=0); 1126 sps = parameterSetManager->getPrefetchedSPS(pps->getSPSId()); 1127 //!KS: need to add error handling code here, if SPS is not available 1128 assert(sps!=0); 1129 #if H_MV 1130 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 1131 assert(vps!=0); 1132 rpcSlice->setVPS(vps); 1133 rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerIdInVps() ) ); 1134 #if H_3D 1135 rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerIdInVps() ) ); 1136 rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerIdInVps() ) == 1 ); 1137 #endif 1138 #endif 1139 rpcSlice->setSPS(sps); 1140 rpcSlice->setPPS(pps); 1141 if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) 1142 { 1143 READ_FLAG( uiCode, "dependent_slice_segment_flag" ); rpcSlice->setDependentSliceSegmentFlag(uiCode ? true : false); 1144 } 1145 else 1146 { 1147 rpcSlice->setDependentSliceSegmentFlag(false); 1148 } 1149 Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); 1150 Int maxParts = (1<<(sps->getMaxCUDepth()<<1)); 1151 UInt sliceSegmentAddress = 0; 1152 Int bitsSliceSegmentAddress = 0; 1153 while(numCTUs>(1<<bitsSliceSegmentAddress)) 1154 { 1155 bitsSliceSegmentAddress++; 1156 } 1157 1158 if(!firstSliceSegmentInPic) 1159 { 1160 READ_CODE( bitsSliceSegmentAddress, sliceSegmentAddress, "slice_segment_address" ); 1161 } 1162 //set uiCode to equal slice start address (or dependent slice start address) 1163 Int startCuAddress = maxParts*sliceSegmentAddress; 1164 rpcSlice->setSliceSegmentCurStartCUAddr( startCuAddress ); 1165 rpcSlice->setSliceSegmentCurEndCUAddr(numCTUs*maxParts); 1166 1167 if (rpcSlice->getDependentSliceSegmentFlag()) 1168 { 1169 rpcSlice->setNextSlice ( false ); 1170 rpcSlice->setNextSliceSegment ( true ); 1171 } 1172 else 1173 { 1174 rpcSlice->setNextSlice ( true ); 1175 rpcSlice->setNextSliceSegment ( false ); 1176 1177 rpcSlice->setSliceCurStartCUAddr(startCuAddress); 1178 rpcSlice->setSliceCurEndCUAddr(numCTUs*maxParts); 1179 } 1180 1181 if(!rpcSlice->getDependentSliceSegmentFlag()) 1182 { 1183 #if H_MV 1184 if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 ) 1185 { 1186 READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 ); 1187 } 1188 1189 for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1190 #else 1191 for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1192 #endif 1193 { 1194 READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored 1195 } 1196 1197 READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode); 1755 1198 if( pps->getOutputFlagPresentFlag() ) 1756 1199 { 1757 READ_FLAG( uiCode, "pic_output_flag" ); 1758 rpcSlice->setPicOutputFlag( uiCode ? true : false ); 1200 READ_FLAG( uiCode, "pic_output_flag" ); rpcSlice->setPicOutputFlag( uiCode ? true : false ); 1759 1201 } 1760 1202 else … … 1762 1204 rpcSlice->setPicOutputFlag( true ); 1763 1205 } 1764 #if QC_REM_IDV_B0046 1765 #if !QC_MVHEVC_B0046 1766 if(rpcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR && rpcSlice->getSPS()->getViewId() == 0) 1767 #else 1768 if(rpcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR && rpcSlice->getViewId() == 0) 1769 #endif 1770 #else 1771 if(rpcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR) 1772 #endif 1773 { 1774 READ_UVLC( uiCode, "idr_pic_id" ); //ignored 1775 READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored 1206 // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present 1207 assert (sps->getChromaFormatIdc() == 1 ); 1208 // if( separate_colour_plane_flag == 1 ) 1209 // colour_plane_id u(2) 1210 1211 if( rpcSlice->getIdrPicFlag() ) 1212 { 1776 1213 rpcSlice->setPOC(0); 1777 1214 TComReferencePictureSet* rps = rpcSlice->getLocalRPS(); … … 1781 1218 rps->setNumberOfPictures(0); 1782 1219 rpcSlice->setRPS(rps); 1220 #if H_MV 1221 rpcSlice->setEnableTMVPFlag(false); 1222 #endif 1783 1223 } 1784 1224 else … … 1803 1243 iPOCmsb = iPrevPOCmsb; 1804 1244 } 1805 rpcSlice->setPOC( iPOCmsb+iPOClsb ); 1806 #if QC_REM_IDV_B0046 1807 #if !QC_MVHEVC_B0046 1808 if( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR && rpcSlice->getSPS()->getViewId() && rpcSlice->getPOC() == 0 ) 1809 #else 1810 if( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR && rpcSlice->getViewId() && rpcSlice->getPOC() == 0 ) 1811 #endif 1812 #else 1813 if( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV && rpcSlice->getPOC() == 0 ) 1814 #endif 1815 { 1816 TComReferencePictureSet* rps = rpcSlice->getLocalRPS(); 1245 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1246 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1247 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1248 { 1249 // For BLA picture types, POCmsb is set to 0. 1250 iPOCmsb = 0; 1251 } 1252 rpcSlice->setPOC (iPOCmsb+iPOClsb); 1253 1254 TComReferencePictureSet* rps; 1255 rps = rpcSlice->getLocalRPS(); 1256 rpcSlice->setRPS(rps); 1257 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1258 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1259 { 1260 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1261 } 1262 else // use reference to short-term reference picture set in PPS 1263 { 1264 Int numBits = 0; 1265 while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) 1266 { 1267 numBits++; 1268 } 1269 if (numBits > 0) 1270 { 1271 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 1272 } 1273 else 1274 { 1275 uiCode = 0; 1276 } 1277 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 1278 } 1279 if(sps->getLongTermRefsPresent()) 1280 { 1281 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 1282 UInt numOfLtrp = 0; 1283 UInt numLtrpInSPS = 0; 1284 if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) 1285 { 1286 READ_UVLC( uiCode, "num_long_term_sps"); 1287 numLtrpInSPS = uiCode; 1288 numOfLtrp += numLtrpInSPS; 1289 rps->setNumberOfLongtermPictures(numOfLtrp); 1290 } 1291 Int bitsForLtrpInSPS = 0; 1292 while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 1293 { 1294 bitsForLtrpInSPS++; 1295 } 1296 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 1297 numOfLtrp += uiCode; 1298 rps->setNumberOfLongtermPictures(numOfLtrp); 1299 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1300 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1301 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1302 { 1303 Int pocLsbLt; 1304 if (k < numLtrpInSPS) 1305 { 1306 uiCode = 0; 1307 if (bitsForLtrpInSPS > 0) 1308 { 1309 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 1310 } 1311 Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); 1312 1313 pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); 1314 rps->setUsed(j,usedByCurrFromSPS); 1315 } 1316 else 1317 { 1318 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 1319 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 1320 } 1321 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 1322 Bool mSBPresentFlag = uiCode ? true : false; 1323 if(mSBPresentFlag) 1324 { 1325 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1326 Bool deltaFlag = false; 1327 // First LTRP || First LTRP from SH 1328 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 1329 { 1330 deltaFlag = true; 1331 } 1332 if(deltaFlag) 1333 { 1334 deltaPocMSBCycleLT = uiCode; 1335 } 1336 else 1337 { 1338 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 1339 } 1340 1341 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 1342 - iPOClsb + pocLsbLt; 1343 rps->setPOC (j, pocLTCurr); 1344 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); 1345 rps->setCheckLTMSBPresent(j,true); 1346 } 1347 else 1348 { 1349 rps->setPOC (j, pocLsbLt); 1350 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 1351 rps->setCheckLTMSBPresent(j,false); 1352 } 1353 prevDeltaMSB = deltaPocMSBCycleLT; 1354 } 1355 offset += rps->getNumberOfLongtermPictures(); 1356 rps->setNumberOfPictures(offset); 1357 } 1358 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1359 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1360 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1361 { 1362 // In the case of BLA picture types, rps data is read from slice header but ignored 1363 rps = rpcSlice->getLocalRPS(); 1817 1364 rps->setNumberOfNegativePictures(0); 1818 1365 rps->setNumberOfPositivePictures(0); … … 1821 1368 rpcSlice->setRPS(rps); 1822 1369 } 1370 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 1371 { 1372 READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); 1373 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 1374 } 1823 1375 else 1824 1376 { 1825 TComReferencePictureSet* rps; 1826 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1827 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1828 { 1829 rps = rpcSlice->getLocalRPS(); 1830 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1831 rpcSlice->setRPS(rps); 1832 } 1833 else // use reference to short-term reference picture set in PPS 1834 { 1835 READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1836 rps = rpcSlice->getRPS(); 1837 } 1838 if(sps->getLongTermRefsPresent()) 1839 { 1840 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 1841 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 1842 Int prev = 0; 1843 Int prevMsb=0; 1844 Int prevDeltaPocLt=0; 1845 for(Int j=rps->getNumberOfLongtermPictures()+offset-1 ; j > offset-1; j--) 1846 { 1847 READ_UVLC(uiCode,"delta_poc_lsb_lt"); 1848 prev += uiCode; 1849 1850 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 1851 Int decDeltaPOCMsbPresent=uiCode; 1852 1853 if(decDeltaPOCMsbPresent==1) 1854 { 1855 READ_UVLC(uiCode, "delta_poc_msb_cycle_lt_minus1"); 1856 if( (j==(rps->getNumberOfLongtermPictures()+offset-1)) || (prev!=prevDeltaPocLt) ) 1857 { 1858 prevMsb=(1+uiCode); 1859 } 1860 else 1861 { 1862 prevMsb+=(1+uiCode); 1863 } 1864 Int decMaxPocLsb = 1<<rpcSlice->getSPS()->getBitsForPOC(); 1865 rps->setPOC(j,rpcSlice->getPOC()-prev-(prevMsb)*decMaxPocLsb); 1866 rps->setDeltaPOC(j,-(Int)(prev+(prevMsb)*decMaxPocLsb)); 1867 } 1868 else 1869 { 1870 rps->setPOC(j,rpcSlice->getPOC()-prev); 1871 rps->setDeltaPOC(j,-(Int)prev); 1872 } 1873 prevDeltaPocLt=prev; 1874 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 1875 } 1876 offset += rps->getNumberOfLongtermPictures(); 1877 rps->setNumberOfPictures(offset); 1878 } 1879 } 1880 } 1881 1882 if(sps->getUseSAO() || sps->getUseALF() || sps->getScalingListFlag() || sps->getUseDF()) 1883 { 1884 //!!!KS: order is different in WD5! 1885 if (sps->getUseALF()) 1886 { 1887 READ_FLAG(uiCode, "slice_adaptive_loop_filter_flag"); 1888 rpcSlice->setAlfEnabledFlag((Bool)uiCode); 1889 } 1890 if (sps->getUseSAO()) 1891 { 1892 #if LGE_SAO_MIGRATION_D0091 1893 READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 1894 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 1895 #else 1896 READ_FLAG(uiCode, "slice_sao_interleaving_flag"); rpcSlice->setSaoInterleavingFlag(uiCode); 1897 READ_FLAG(uiCode, "slice_sample_adaptive_offset_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 1898 if (rpcSlice->getSaoEnabledFlag() && rpcSlice->getSaoInterleavingFlag()) 1899 { 1900 READ_FLAG(uiCode, "sao_cb_enable_flag"); rpcSlice->setSaoEnabledFlagCb((Bool)uiCode); 1901 READ_FLAG(uiCode, "sao_cr_enable_flag"); rpcSlice->setSaoEnabledFlagCr((Bool)uiCode); 1902 } 1903 else 1904 { 1905 rpcSlice->setSaoEnabledFlagCb(0); 1906 rpcSlice->setSaoEnabledFlagCr(0); 1907 } 1908 #endif 1909 } 1910 READ_UVLC ( uiCode, "aps_id" ); rpcSlice->setAPSId(uiCode); 1377 rpcSlice->setEnableTMVPFlag(false); 1378 } 1379 } 1380 #if H_MV 1381 Int layerIdInVps = rpcSlice->getLayerIdInVps(); 1382 if( rpcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 ) 1383 { 1384 READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 ); 1385 if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 ) 1386 { 1387 if( !vps->getMaxOneActiveRefLayerFlag()) 1388 { 1389 READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode ); 1390 } 1391 for( Int i = 0; i < rpcSlice->getNumActiveRefLayerPics(); i++ ) 1392 { 1393 READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( i, uiCode ); 1394 } 1395 } 1396 } 1397 1398 rpcSlice->setActiveMotionPredRefLayers( ); 1399 1400 if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0 && rpcSlice->getNumActiveRefLayerPics() > 0 ) 1401 { 1402 READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" ); rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode == 1 ); 1403 } 1404 1405 #endif 1406 if(sps->getUseSAO()) 1407 { 1408 READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 1409 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 1410 } 1411 1412 if (rpcSlice->getIdrPicFlag()) 1413 { 1414 rpcSlice->setEnableTMVPFlag(false); 1911 1415 } 1912 1416 if (!rpcSlice->isIntra()) 1913 1417 { 1418 1914 1419 READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); 1915 1420 if (uiCode) 1916 1421 { 1917 READ_ CODE (3,uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 );1422 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); 1918 1423 if (rpcSlice->isInterB()) 1919 1424 { 1920 READ_ CODE (3,uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 );1425 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); 1921 1426 } 1922 1427 else … … 1927 1432 else 1928 1433 { 1929 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, 0); 1930 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 1931 } 1932 } 1434 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); 1435 if (rpcSlice->isInterB()) 1436 { 1437 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); 1438 } 1439 else 1440 { 1441 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); 1442 } 1443 } 1444 } 1445 // } 1933 1446 TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); 1934 if( !rpcSlice->isIntra() ) 1935 { 1936 #if QC_MVHEVC_B0046 1937 if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() ) 1938 #else 1939 if( !rpcSlice->getSPS()->getListsModificationPresentFlag() ) 1940 #endif 1447 if(!rpcSlice->isIntra()) 1448 { 1449 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 1941 1450 { 1942 1451 refPicListModification->setRefPicListModificationFlagL0( 0 ); … … 1946 1455 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); 1947 1456 } 1948 1457 1949 1458 if(refPicListModification->getRefPicListModificationFlagL0()) 1950 { 1459 { 1951 1460 uiCode = 0; 1952 1461 Int i = 0; 1953 Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc();1954 if ( NumPocTotalCurr> 1 )1462 Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); 1463 if ( numRpsCurrTempList0 > 1 ) 1955 1464 { 1956 1465 Int length = 1; 1957 NumPocTotalCurr--;1958 while ( NumPocTotalCurr>>= 1)1466 numRpsCurrTempList0 --; 1467 while ( numRpsCurrTempList0 >>= 1) 1959 1468 { 1960 1469 length ++; … … 1981 1490 if(rpcSlice->isInterB()) 1982 1491 { 1983 #if QC_MVHEVC_B0046 1984 if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() ) 1985 #else 1986 if( !rpcSlice->getSPS()->getListsModificationPresentFlag() ) 1987 #endif 1492 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 1988 1493 { 1989 1494 refPicListModification->setRefPicListModificationFlagL1( 0 ); … … 1997 1502 uiCode = 0; 1998 1503 Int i = 0; 1999 Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc();2000 if ( NumPocTotalCurr> 1 )1504 Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); 1505 if ( numRpsCurrTempList1 > 1 ) 2001 1506 { 2002 1507 Int length = 1; 2003 NumPocTotalCurr--;2004 while ( NumPocTotalCurr>>= 1)1508 numRpsCurrTempList1 --; 1509 while ( numRpsCurrTempList1 >>= 1) 2005 1510 { 2006 1511 length ++; … … 2025 1530 refPicListModification->setRefPicListModificationFlagL1(0); 2026 1531 } 2027 } 2028 else 2029 { 2030 // initialize from previous slice 2031 pps = rpcSlice->getPPS(); 2032 sps = rpcSlice->getSPS(); 2033 } 2034 // ref_pic_list_combination( ) 2035 //!!!KS: ref_pic_list_combination() should be conditioned on entropy_slice_flag 2036 if (rpcSlice->isInterB()) 2037 { 2038 READ_FLAG( uiCode, "ref_pic_list_combination_flag" ); rpcSlice->setRefPicListCombinationFlag( uiCode ? 1 : 0 ); 2039 if(uiCode) 2040 { 2041 READ_UVLC( uiCode, "num_ref_idx_lc_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 ); 2042 2043 #if QC_MVHEVC_B0046 2044 if( rpcSlice->getViewId() && rpcSlice->getSPS()->getListsModificationPresentFlag() ) 1532 if (rpcSlice->isInterB()) 1533 { 1534 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 1535 } 1536 1537 rpcSlice->setCabacInitFlag( false ); // default 1538 if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) 1539 { 1540 READ_FLAG(uiCode, "cabac_init_flag"); 1541 rpcSlice->setCabacInitFlag( uiCode ? true : false ); 1542 } 1543 1544 if ( rpcSlice->getEnableTMVPFlag() ) 1545 { 1546 #if H_MV 1547 if( rpcSlice->getLayerId() > 0 && rpcSlice->getNumActiveMotionPredRefLayers() > 0 ) 1548 { 1549 READ_FLAG( uiCode, "alt_collocated_indication_flag" ); rpcSlice->setAltCollocatedIndicationFlag( uiCode == 1 ); 1550 } 1551 1552 if( rpcSlice->getAltCollocatedIndicationFlag() && rpcSlice->getNumActiveMotionPredRefLayers() > 1 ) 1553 { 1554 READ_UVLC( uiCode, "collocated_ref_layer_idx" ); rpcSlice->setCollocatedRefLayerIdx( uiCode ); 1555 } 1556 else 1557 { 1558 #endif 1559 if ( rpcSlice->getSliceType() == B_SLICE ) 1560 { 1561 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 1562 rpcSlice->setColFromL0Flag(uiCode); 1563 } 1564 else 1565 { 1566 rpcSlice->setColFromL0Flag( 1 ); 1567 } 1568 1569 if ( rpcSlice->getSliceType() != I_SLICE && 1570 ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| 1571 (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) 1572 { 1573 READ_UVLC( uiCode, "collocated_ref_idx" ); 1574 rpcSlice->setColRefIdx(uiCode); 1575 } 1576 else 1577 { 1578 rpcSlice->setColRefIdx(0); 1579 } 1580 #if H_MV 1581 } 1582 #endif 1583 } 1584 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) 1585 { 1586 xParsePredWeightTable(rpcSlice); 1587 rpcSlice->initWpScaling(); 1588 } 1589 #if H_3D_IC 1590 else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) ) 1591 { 1592 UInt uiCodeTmp = 0; 1593 1594 READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" ); 1595 rpcSlice->setApplyIC( uiCodeTmp ); 1596 1597 if ( uiCodeTmp ) 1598 { 1599 READ_FLAG ( uiCodeTmp, "ic_skip_mergeidx0" ); 1600 rpcSlice->setIcSkipParseFlag( uiCodeTmp ); 1601 } 1602 } 1603 #endif 1604 if (!rpcSlice->isIntra()) 1605 { 1606 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 1607 #if H_3D_IV_MERGE 1608 Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ; 1609 rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode); 2045 1610 #else 2046 if(rpcSlice->getSPS()->getListsModificationPresentFlag() ) 2047 #endif 2048 { 2049 READ_FLAG( uiCode, "ref_pic_list_modification_flag_lc" ); rpcSlice->setRefPicListModificationFlagLC( uiCode ? 1 : 0 ); 2050 if(uiCode) 2051 { 2052 for (UInt i=0;i<rpcSlice->getNumRefIdx(REF_PIC_LIST_C);i++) 2053 { 2054 READ_FLAG( uiCode, "pic_from_list_0_flag" ); 2055 rpcSlice->setListIdFromIdxOfLC(i, uiCode); 2056 if (((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_0) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_0 ) == 1)) || ((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_1) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_1 ) == 1)) ) 2057 { 2058 uiCode = 0; 2059 } 2060 else 2061 { 2062 READ_UVLC( uiCode, "ref_idx_list_curr" ); 2063 } 2064 rpcSlice->setRefIdxFromIdxOfLC(i, uiCode); 2065 rpcSlice->setRefIdxOfLC((RefPicList)rpcSlice->getListIdFromIdxOfLC(i), rpcSlice->getRefIdxFromIdxOfLC(i), i); 2066 } 2067 } 2068 } 2069 else 2070 { 2071 rpcSlice->setRefPicListModificationFlagLC(false); 2072 } 2073 } 2074 else 2075 { 2076 rpcSlice->setRefPicListModificationFlagLC(false); 2077 rpcSlice->setNumRefIdx(REF_PIC_LIST_C, 0); 2078 } 2079 } 2080 else 2081 { 2082 rpcSlice->setRefPicListCombinationFlag(false); 2083 } 2084 2085 if (rpcSlice->isInterB()) 2086 { 2087 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 2088 } 2089 2090 #if CABAC_INIT_FLAG 2091 rpcSlice->setCabacInitFlag( false ); // default 2092 if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) 2093 { 2094 READ_FLAG(uiCode, "cabac_init_flag"); 2095 rpcSlice->setCabacInitFlag( uiCode ? true : false ); 2096 } 2097 #else 2098 if(pps->getEntropyCodingMode() && !rpcSlice->isIntra()) 2099 { 2100 READ_UVLC(uiCode, "cabac_init_idc"); 2101 rpcSlice->setCABACinitIDC(uiCode); 2102 } 2103 else if (pps->getEntropyCodingMode() && rpcSlice->isIntra()) 2104 { 2105 rpcSlice->setCABACinitIDC(0); 2106 } 2107 #endif 2108 2109 if(!bEntropySlice) 2110 { 2111 READ_SVLC( iCode, "slice_qp_delta" ); 1611 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 1612 #endif 1613 } 1614 1615 READ_SVLC( iCode, "slice_qp_delta" ); 2112 1616 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 2113 1617 … … 2115 1619 assert( rpcSlice->getSliceQp() <= 51 ); 2116 1620 2117 if (rpcSlice->getPPS()->getDeblockingFilterControlPresent()) 2118 { 2119 if ( rpcSlice->getSPS()->getUseDF() ) 2120 { 2121 READ_FLAG ( uiCode, "inherit_dbl_param_from_APS_flag" ); rpcSlice->setInheritDblParamFromAPS(uiCode ? 1 : 0); 2122 } else 2123 { 2124 rpcSlice->setInheritDblParamFromAPS(0); 2125 } 2126 if(!rpcSlice->getInheritDblParamFromAPS()) 2127 { 2128 READ_FLAG ( uiCode, "disable_deblocking_filter_flag" ); rpcSlice->setLoopFilterDisable(uiCode ? 1 : 0); 2129 if(!rpcSlice->getLoopFilterDisable()) 2130 { 2131 READ_SVLC( iCode, "beta_offset_div2" ); rpcSlice->setLoopFilterBetaOffset(iCode); 2132 READ_SVLC( iCode, "tc_offset_div2" ); rpcSlice->setLoopFilterTcOffset(iCode); 2133 } 2134 } 2135 } 2136 if ( rpcSlice->getSliceType() == B_SLICE ) 2137 { 2138 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 2139 rpcSlice->setColDir(uiCode); 2140 } 2141 2142 #if COLLOCATED_REF_IDX 2143 if ( rpcSlice->getSliceType() != I_SLICE && 2144 ((rpcSlice->getColDir()==0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)|| 2145 (rpcSlice->getColDir() ==1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1)>1))) 2146 { 2147 READ_UVLC( uiCode, "collocated_ref_idx" ); 2148 rpcSlice->setColRefIdx(uiCode); 2149 } 2150 #endif 2151 2152 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPredIdc() && rpcSlice->getSliceType()==B_SLICE) ) 2153 { 2154 xParsePredWeightTable(rpcSlice); 2155 rpcSlice->initWpScaling(); 2156 } 2157 } 2158 2159 if (!bEntropySlice) 2160 { 2161 if( rpcSlice->getSPS()->hasCamParInSliceHeader() ) 2162 { 2163 UInt uiViewId = rpcSlice->getSPS()->getViewId(); 2164 for( UInt uiBaseId = 0; uiBaseId < uiViewId; uiBaseId++ ) 2165 { 2166 READ_SVLC( iCode, "coded_scale" ); m_aaiTempScale [ uiBaseId ][ uiViewId ] = iCode; 2167 READ_SVLC( iCode, "coded_offset" ); m_aaiTempOffset[ uiBaseId ][ uiViewId ] = iCode; 2168 READ_SVLC( iCode, "inverse_coded_scale_plus_coded_scale" ); m_aaiTempScale [ uiViewId ][ uiBaseId ] = iCode - m_aaiTempScale [ uiBaseId ][ uiViewId ]; 2169 READ_SVLC( iCode, "inverse_coded_offset_plus_coded_offset" ); m_aaiTempOffset[ uiViewId ][ uiBaseId ] = iCode - m_aaiTempOffset[ uiBaseId ][ uiViewId ]; 2170 } 2171 rpcSlice->initMultiviewSlice( m_aaiTempScale, m_aaiTempOffset ); 2172 } 2173 } 2174 2175 #if ( HHI_MPI || H3D_IVMP ) 2176 #if ( HHI_MPI && H3D_IVMP ) 2177 const int iExtraMergeCandidates = ( sps->getUseMVI() || sps->getMultiviewMvPredMode() ) ? 1 : 0; 2178 #elif HHI_MPI 2179 const int iExtraMergeCandidates = sps->getUseMVI() ? 1 : 0; 2180 #elif MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 2181 const int iExtraMergeCandidates = ( (isDepth || sps->getMultiviewMvPredMode()) ) ? 1 : 0; 2182 #else 2183 const int iExtraMergeCandidates = sps->getMultiviewMvPredMode() ? 1 : 0; 2184 #endif 2185 READ_UVLC( uiCode, "5_minus_max_num_merge_cand"); 2186 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS + iExtraMergeCandidates - uiCode); 2187 assert(rpcSlice->getMaxNumMergeCand()==(MRG_MAX_NUM_CANDS_SIGNALED+iExtraMergeCandidates)); 2188 #else 2189 READ_UVLC( uiCode, "5_minus_max_num_merge_cand"); 2190 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 2191 assert(rpcSlice->getMaxNumMergeCand()==MRG_MAX_NUM_CANDS_SIGNALED); 2192 #endif 2193 2194 if (!bEntropySlice) 2195 { 2196 if(sps->getUseALF() && rpcSlice->getAlfEnabledFlag()) 2197 { 2198 UInt uiNumLCUsInWidth = sps->getPicWidthInLumaSamples() / g_uiMaxCUWidth; 2199 UInt uiNumLCUsInHeight = sps->getPicHeightInLumaSamples() / g_uiMaxCUHeight; 2200 2201 uiNumLCUsInWidth += ( sps->getPicWidthInLumaSamples() % g_uiMaxCUWidth ) ? 1 : 0; 2202 uiNumLCUsInHeight += ( sps->getPicHeightInLumaSamples() % g_uiMaxCUHeight ) ? 1 : 0; 2203 2204 Int uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight; 2205 if(sps->getUseALFCoefInSlice()) 2206 { 2207 alfParamSet.releaseALFParam(); 2208 alfParamSet.init(); 2209 Bool isAcrossSlice = sps->getLFCrossSliceBoundaryFlag(); 2210 Int numSUinLCU = 1<< (g_uiMaxCUDepth << 1); 2211 Int firstLCUAddr = rpcSlice->getSliceCurStartCUAddr() / numSUinLCU; 2212 xParseAlfParam(&alfParamSet, false, firstLCUAddr, isAcrossSlice, uiNumLCUsInWidth, uiNumLCUsInHeight); 2213 } 2214 2215 if(!sps->getUseALFCoefInSlice()) 2216 { 2217 xParseAlfCuControlParam(alfCUCtrl, uiNumCUsInFrame); 2218 } 2219 2220 } 1621 if (rpcSlice->getPPS()->getSliceChromaQpFlag()) 1622 { 1623 READ_SVLC( iCode, "slice_qp_delta_cb" ); 1624 rpcSlice->setSliceQpDeltaCb( iCode ); 1625 assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); 1626 assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); 1627 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); 1628 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); 1629 1630 READ_SVLC( iCode, "slice_qp_delta_cr" ); 1631 rpcSlice->setSliceQpDeltaCr( iCode ); 1632 assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); 1633 assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); 1634 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); 1635 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); 1636 } 1637 1638 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 1639 { 1640 if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) 1641 { 1642 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 1643 } 1644 else 1645 { 1646 rpcSlice->setDeblockingFilterOverrideFlag(0); 1647 } 1648 if(rpcSlice->getDeblockingFilterOverrideFlag()) 1649 { 1650 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); 1651 if(!rpcSlice->getDeblockingFilterDisable()) 1652 { 1653 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1654 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 1655 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 1656 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1657 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 1658 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 1659 } 1660 } 1661 else 1662 { 1663 rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); 1664 rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 1665 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 1666 } 1667 } 1668 else 1669 { 1670 rpcSlice->setDeblockingFilterDisable ( false ); 1671 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 1672 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); 1673 } 1674 1675 Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); 1676 Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); 1677 1678 if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 1679 { 1680 READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); 1681 } 1682 else 1683 { 1684 uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; 1685 } 1686 rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 1687 2221 1688 } 2222 1689 2223 //!!!KS: The following syntax is not aligned with the working draft, TRACE support needs to be added 2224 rpcSlice->setTileMarkerFlag ( 0 ); // default 2225 if (!bEntropySlice) 2226 { 2227 xReadCode(1, uiCode); // read flag indicating if tile markers transmitted 2228 rpcSlice->setTileMarkerFlag( uiCode ); 2229 } 2230 2231 Int tilesOrEntropyCodingSyncIdc = rpcSlice->getSPS()->getTilesOrEntropyCodingSyncIdc(); 2232 UInt *entryPointOffset = NULL; 2233 UInt numEntryPointOffsets, offsetLenMinus1; 2234 2235 rpcSlice->setNumEntryPointOffsets ( 0 ); // default 2236 2237 if (tilesOrEntropyCodingSyncIdc>0) 1690 UInt *entryPointOffset = NULL; 1691 UInt numEntryPointOffsets, offsetLenMinus1; 1692 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 2238 1693 { 2239 1694 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); … … 2245 1700 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 2246 1701 { 2247 Int bitsRead = m_pcBitstream->getNumBitsRead(); 2248 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset"); 2249 entryPointOffset[ idx ] = uiCode; 2250 if ( idx == 0 && tilesOrEntropyCodingSyncIdc == 2 ) 2251 { 2252 // Subtract distance from NALU header start to provide WPP 0-th substream the correct size. 2253 entryPointOffset[ idx ] -= ( bitsRead + numEntryPointOffsets*(offsetLenMinus1+1) ) >> 3; 2254 } 2255 } 2256 } 2257 2258 if ( tilesOrEntropyCodingSyncIdc == 1 ) // tiles 2259 { 2260 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 2261 2262 UInt prevPos = 0; 2263 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 2264 { 2265 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 2266 prevPos += entryPointOffset[ idx ]; 2267 } 2268 } 2269 else if ( tilesOrEntropyCodingSyncIdc == 2 ) // wavefront 2270 { 2271 Int numSubstreams = pps->getNumSubstreams(); 2272 rpcSlice->allocSubstreamSizes(numSubstreams); 2273 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 2274 for (Int idx=0; idx<numSubstreams-1; idx++) 2275 { 2276 if ( idx < numEntryPointOffsets ) 2277 { 2278 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 2279 } 2280 else 2281 { 2282 pSubstreamSizes[ idx ] = 0; 2283 } 2284 } 2285 } 2286 2287 if (entryPointOffset) 2288 { 2289 delete [] entryPointOffset; 2290 } 2291 2292 if (!bEntropySlice) 2293 { 2294 // Reading location information 2295 2296 // read out trailing bits 2297 m_pcBitstream->readOutTrailingBits(); 2298 } 1702 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 1703 entryPointOffset[ idx ] = uiCode + 1; 1704 } 1705 } 1706 else 1707 { 1708 rpcSlice->setNumEntryPointOffsets ( 0 ); 1709 } 1710 1711 if(pps->getSliceHeaderExtensionPresentFlag()) 1712 { 1713 READ_UVLC(uiCode,"slice_header_extension_length"); 1714 #if H_3D 1715 if( rpcSlice->getSPS()->hasCamParInSliceHeader() ) 1716 { 1717 UInt uiViewIndex = rpcSlice->getViewIndex(); 1718 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 1719 { 1720 READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode; 1721 READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode; 1722 READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ]; 1723 READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ]; 1724 } 1725 rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset ); 1726 } 1727 1728 READ_FLAG(uiCode,"slice_segment_header_extension2_flag"); 1729 if ( uiCode ) 1730 { 1731 READ_UVLC(uiCode,"slice_header_extension2_length"); 1732 for(Int i=0; i<uiCode; i++) 1733 { 1734 UInt ignore; 1735 READ_CODE(8,ignore,"slice_header_extension2_data_byte"); 1736 } 1737 } 1738 } 1739 #else 1740 for(Int i=0; i<uiCode; i++) 1741 { 1742 UInt ignore; 1743 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1744 } 1745 } 1746 #endif 1747 m_pcBitstream->readByteAlignment(); 1748 1749 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1750 { 1751 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1752 1753 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 1754 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1755 { 1756 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 1757 { 1758 endOfSliceHeaderLocation++; 1759 } 1760 } 1761 1762 Int curEntryPointOffset = 0; 1763 Int prevEntryPointOffset = 0; 1764 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1765 { 1766 curEntryPointOffset += entryPointOffset[ idx ]; 1767 1768 Int emulationPreventionByteCount = 0; 1769 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1770 { 1771 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1772 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1773 { 1774 emulationPreventionByteCount++; 1775 } 1776 } 1777 1778 entryPointOffset[ idx ] -= emulationPreventionByteCount; 1779 prevEntryPointOffset = curEntryPointOffset; 1780 } 1781 1782 if ( pps->getTilesEnabledFlag() ) 1783 { 1784 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 1785 1786 UInt prevPos = 0; 1787 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 1788 { 1789 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 1790 prevPos += entryPointOffset[ idx ]; 1791 } 1792 } 1793 else if ( pps->getEntropyCodingSyncEnabledFlag() ) 1794 { 1795 Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; 1796 rpcSlice->allocSubstreamSizes(numSubstreams); 1797 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 1798 for (Int idx=0; idx<numSubstreams-1; idx++) 1799 { 1800 if ( idx < numEntryPointOffsets ) 1801 { 1802 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 1803 } 1804 else 1805 { 1806 pSubstreamSizes[ idx ] = 0; 1807 } 1808 } 1809 } 1810 1811 if (entryPointOffset) 1812 { 1813 delete [] entryPointOffset; 1814 } 1815 } 1816 2299 1817 return; 2300 1818 } 2301 2302 Void TDecCavlc::xParseAlfCuControlParam(AlfCUCtrlInfo& cAlfParam, Int iNumCUsInPic) 2303 { 2304 UInt uiSymbol; 2305 Int iSymbol; 2306 2307 READ_FLAG (uiSymbol, "alf_cu_control_flag"); 2308 cAlfParam.cu_control_flag = uiSymbol; 2309 if (cAlfParam.cu_control_flag) 2310 { 2311 READ_UVLC (uiSymbol, "alf_cu_control_max_depth"); 2312 cAlfParam.alf_max_depth = uiSymbol; 2313 2314 READ_SVLC (iSymbol, "alf_length_cu_control_info"); 2315 cAlfParam.num_alf_cu_flag = (UInt)(iSymbol + iNumCUsInPic); 2316 2317 cAlfParam.alf_cu_flag.resize(cAlfParam.num_alf_cu_flag); 2318 2319 for(UInt i=0; i< cAlfParam.num_alf_cu_flag; i++) 2320 { 2321 READ_FLAG (cAlfParam.alf_cu_flag[i], "alf_cu_flag"); 2322 } 2323 } 2324 } 2325 2326 #if !CABAC_INIT_FLAG 2327 Void TDecCavlc::resetEntropy (TComSlice* pcSlice) 2328 { 2329 } 2330 #endif 1819 1820 Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) 1821 { 1822 UInt uiCode; 1823 if(profilePresentFlag) 1824 { 1825 parseProfileTier(rpcPTL->getGeneralPTL()); 1826 } 1827 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); 1828 1829 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1830 { 1831 #if !H_MV 1832 if(profilePresentFlag) 1833 { 1834 #endif 1835 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); 1836 #if H_MV 1837 rpcPTL->setSubLayerProfilePresentFlag( i, profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ); 1838 #else 1839 } 1840 #endif 1841 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); 1842 } 1843 1844 if (maxNumSubLayersMinus1 > 0) 1845 { 1846 for (Int i = maxNumSubLayersMinus1; i < 8; i++) 1847 { 1848 READ_CODE(2, uiCode, "reserved_zero_2bits"); 1849 assert(uiCode == 0); 1850 } 1851 } 1852 1853 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1854 { 1855 if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) 1856 { 1857 parseProfileTier(rpcPTL->getSubLayerPTL(i)); 1858 } 1859 if(rpcPTL->getSubLayerLevelPresentFlag(i)) 1860 { 1861 READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(uiCode); 1862 } 1863 } 1864 } 1865 1866 Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl) 1867 { 1868 UInt uiCode; 1869 READ_CODE(2 , uiCode, "XXX_profile_space[]"); ptl->setProfileSpace(uiCode); 1870 READ_FLAG( uiCode, "XXX_tier_flag[]" ); ptl->setTierFlag (uiCode ? 1 : 0); 1871 READ_CODE(5 , uiCode, "XXX_profile_idc[]" ); ptl->setProfileIdc (uiCode); 1872 for(Int j = 0; j < 32; j++) 1873 { 1874 READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 1875 } 1876 READ_FLAG(uiCode, "general_progressive_source_flag"); 1877 ptl->setProgressiveSourceFlag(uiCode ? true : false); 1878 1879 READ_FLAG(uiCode, "general_interlaced_source_flag"); 1880 ptl->setInterlacedSourceFlag(uiCode ? true : false); 1881 1882 READ_FLAG(uiCode, "general_non_packed_constraint_flag"); 1883 ptl->setNonPackedConstraintFlag(uiCode ? true : false); 1884 1885 READ_FLAG(uiCode, "general_frame_only_constraint_flag"); 1886 ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); 1887 1888 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]"); 1889 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); 1890 READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); 1891 } 2331 1892 2332 1893 Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) … … 2344 1905 } 2345 1906 2346 Void TDecCavlc::parseSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1907 Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2347 1908 { 2348 1909 assert(0); 2349 1910 } 2350 1911 2351 #if LGE_ILLUCOMP_B0045 2352 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1912 Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2353 1913 { 2354 1914 assert(0); 2355 1915 } 2356 #endif 2357 2358 #if H3D_IVMP 2359 Void TDecCavlc::parseMVPIdx( Int& riMVPIdx, Int iAMVPCands ) 2360 #else 2361 Void TDecCavlc::parseMVPIdx( Int& riMVPIdx ) 2362 #endif 1916 1917 Void TDecCavlc::parseMVPIdx( Int& /*riMVPIdx*/ ) 2363 1918 { 2364 1919 assert(0); 2365 1920 } 2366 1921 2367 Void TDecCavlc::parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1922 Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2368 1923 { 2369 1924 assert(0); 2370 1925 } 2371 1926 2372 Void TDecCavlc::parsePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1927 Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2373 1928 { 2374 1929 assert(0); 2375 1930 } 2376 1931 2377 Void TDecCavlc::parsePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1932 Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2378 1933 { 2379 1934 assert(0); … … 2381 1936 2382 1937 /** Parse I_PCM information. 2383 2384 2385 2386 2387 2388 2389 2390 Void TDecCavlc::parseIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1938 * \param pcCU pointer to CU 1939 * \param uiAbsPartIdx CU index 1940 * \param uiDepth CU depth 1941 * \returns Void 1942 * 1943 * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. 1944 */ 1945 Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2391 1946 { 2392 1947 assert(0); 2393 1948 } 2394 1949 2395 Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1950 Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2396 1951 { 2397 1952 assert(0); 2398 1953 } 2399 1954 2400 Void TDecCavlc::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)1955 Void TDecCavlc::parseIntraDirChroma( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 2401 1956 { 2402 1957 assert(0); 2403 1958 } 2404 1959 2405 Void TDecCavlc::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth)1960 Void TDecCavlc::parseInterDir( TComDataCU* /*pcCU*/, UInt& /*ruiInterDir*/, UInt /*uiAbsPartIdx*/ ) 2406 1961 { 2407 1962 assert(0); 2408 1963 } 2409 1964 2410 Void TDecCavlc::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList)1965 Void TDecCavlc::parseRefFrmIdx( TComDataCU* /*pcCU*/, Int& /*riRefFrmIdx*/, RefPicList /*eRefList*/ ) 2411 1966 { 2412 1967 assert(0); 2413 1968 } 2414 1969 2415 Void TDecCavlc::parseMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList)1970 Void TDecCavlc::parseMvd( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiPartIdx*/, UInt /*uiDepth*/, RefPicList /*eRefList*/ ) 2416 1971 { 2417 1972 assert(0); … … 2422 1977 Int qp; 2423 1978 Int iDQp; 2424 1979 2425 1980 xReadSvlc( iDQp ); 2426 1981 … … 2428 1983 qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; 2429 1984 2430 UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>( 8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ;1985 UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1) ; 2431 1986 UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; 2432 1987 … … 2434 1989 } 2435 1990 2436 Void TDecCavlc::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType)1991 Void TDecCavlc::parseCoeffNxN( TComDataCU* /*pcCU*/, TCoeff* /*pcCoef*/, UInt /*uiAbsPartIdx*/, UInt /*uiWidth*/, UInt /*uiHeight*/, UInt /*uiDepth*/, TextType /*eTType*/ ) 2437 1992 { 2438 1993 assert(0); 2439 1994 } 2440 1995 2441 Void TDecCavlc::parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize)1996 Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ ) 2442 1997 { 2443 1998 assert(0); 2444 1999 } 2445 2000 2446 Void TDecCavlc::parseQtCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth)2001 Void TDecCavlc::parseQtCbf( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, TextType /*eType*/, UInt /*uiTrDepth*/, UInt /*uiDepth*/ ) 2447 2002 { 2448 2003 assert(0); 2449 2004 } 2450 2005 2451 Void TDecCavlc::parseQtRootCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf)2006 Void TDecCavlc::parseQtRootCbf( UInt /*uiAbsPartIdx*/, UInt& /*uiQtRootCbf*/ ) 2452 2007 { 2453 2008 assert(0); 2454 2009 } 2455 2010 2456 2457 Void TDecCavlc::parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) 2011 Void TDecCavlc::parseTransformSkipFlags (TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*width*/, UInt /*height*/, UInt /*uiDepth*/, TextType /*eTType*/) 2458 2012 { 2459 2013 assert(0); 2460 2014 } 2461 2015 2462 Void TDecCavlc::parseMerge Index ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth)2016 Void TDecCavlc::parseMergeFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiPUIdx*/ ) 2463 2017 { 2464 2018 assert(0); 2465 2019 } 2466 2020 2467 #if H3D_IVRP 2468 Void 2469 TDecCavlc::parseResPredFlag( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) 2021 Void TDecCavlc::parseMergeIndex ( TComDataCU* /*pcCU*/, UInt& /*ruiMergeIndex*/ ) 2470 2022 { 2471 2023 assert(0); 2472 2024 } 2473 #endif 2474 #if QC_ARP_D01772025 2026 #if H_3D_ARP 2475 2027 Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2476 2028 { 2477 assert( false );2478 }2479 #endif2480 #if RWTH_SDC_DLT_B00362481 #if !PKU_QC_DEPTH_INTRA_UNI_D01952482 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )2483 {2484 2029 assert(0); 2485 2030 } 2486 Void TDecCavlc::parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2031 #endif 2032 #if H_3D_IC 2033 Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2487 2034 { 2488 2035 assert(0); 2489 2036 } 2490 2037 #endif 2491 Void TDecCavlc::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) 2038 #if LGE_INTER_SDC_E0156 2039 Void TDecCavlc::parseInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2492 2040 { 2493 2041 assert(0); 2494 2042 } 2495 #endif 2496 2043 2044 Void TDecCavlc::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) 2045 { 2046 assert(0); 2047 } 2048 #endif 2497 2049 // ==================================================================================================================== 2498 2050 // Protected member functions 2499 2051 // ==================================================================================================================== 2500 2052 2501 Void TDecCavlc::xReadCode (UInt uiLength, UInt& ruiCode)2502 {2503 assert ( uiLength > 0 );2504 m_pcBitstream->read (uiLength, ruiCode);2505 }2506 2507 Void TDecCavlc::xReadUvlc( UInt& ruiVal)2508 {2509 UInt uiVal = 0;2510 UInt uiCode = 0;2511 UInt uiLength;2512 m_pcBitstream->read( 1, uiCode );2513 2514 if( 0 == uiCode )2515 {2516 uiLength = 0;2517 2518 while( ! ( uiCode & 1 ))2519 {2520 m_pcBitstream->read( 1, uiCode );2521 uiLength++;2522 }2523 2524 m_pcBitstream->read( uiLength, uiVal );2525 2526 uiVal += (1 << uiLength)-1;2527 }2528 2529 ruiVal = uiVal;2530 }2531 2532 Void TDecCavlc::xReadSvlc( Int& riVal)2533 {2534 UInt uiBits = 0;2535 m_pcBitstream->read( 1, uiBits );2536 if( 0 == uiBits )2537 {2538 UInt uiLength = 0;2539 2540 while( ! ( uiBits & 1 ))2541 {2542 m_pcBitstream->read( 1, uiBits );2543 uiLength++;2544 }2545 2546 m_pcBitstream->read( uiLength, uiBits );2547 2548 uiBits += (1 << uiLength);2549 riVal = ( uiBits & 1) ? -(Int)(uiBits>>1) : (Int)(uiBits>>1);2550 }2551 else2552 {2553 riVal = 0;2554 }2555 }2556 2557 Void TDecCavlc::xReadFlag (UInt& ruiCode)2558 {2559 m_pcBitstream->read( 1, ruiCode );2560 }2561 2562 #if QC_MVHEVC_B00462563 /** Parse VPS alignment one bits.2564 * \returns Void2565 */2566 Void TDecCavlc::xReadVPSAlignOne( )2567 {2568 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();2569 2570 if(uiNumberOfBits)2571 {2572 UInt uiBits;2573 UInt uiSymbol;2574 2575 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)2576 {2577 xReadFlag( uiSymbol );2578 2579 if(!uiSymbol)2580 {2581 printf("\nWarning! vps_extension_byte_alignment_reserved_one_bit include a non-zero value.\n");2582 }2583 }2584 }2585 }2586 #endif2587 /** Parse PCM alignment zero bits.2588 * \returns Void2589 */2590 Void TDecCavlc::xReadPCMAlignZero( )2591 {2592 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();2593 2594 if(uiNumberOfBits)2595 {2596 UInt uiBits;2597 UInt uiSymbol;2598 2599 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)2600 {2601 xReadFlag( uiSymbol );2602 2603 if(uiSymbol)2604 {2605 printf("\nWarning! pcm_align_zero include a non-zero value.\n");2606 }2607 }2608 }2609 }2610 2611 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )2612 {2613 if (uiMaxSymbol == 0)2614 {2615 ruiSymbol = 0;2616 return;2617 }2618 2619 xReadFlag( ruiSymbol );2620 2621 if (ruiSymbol == 0 || uiMaxSymbol == 1)2622 {2623 return;2624 }2625 2626 UInt uiSymbol = 0;2627 UInt uiCont;2628 2629 do2630 {2631 xReadFlag( uiCont );2632 uiSymbol++;2633 }2634 while( uiCont && (uiSymbol < uiMaxSymbol-1) );2635 2636 if( uiCont && (uiSymbol == uiMaxSymbol-1) )2637 {2638 uiSymbol++;2639 }2640 2641 ruiSymbol = uiSymbol;2642 }2643 2644 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )2645 {2646 UInt uiSymbol ;2647 UInt uiCount = 0;2648 do2649 {2650 xReadFlag( uiSymbol );2651 uiCount++;2652 }2653 while( uiSymbol && (uiCount != 13));2654 2655 ruiSymbol = uiCount-1;2656 2657 if( uiSymbol )2658 {2659 xReadEpExGolomb( uiSymbol, 0 );2660 ruiSymbol += uiSymbol+1;2661 }2662 2663 return;2664 }2665 2666 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )2667 {2668 UInt uiSymbol = 0;2669 UInt uiBit = 1;2670 2671 2672 while( uiBit )2673 {2674 xReadFlag( uiBit );2675 uiSymbol += uiBit << uiCount++;2676 }2677 2678 uiCount--;2679 while( uiCount-- )2680 {2681 xReadFlag( uiBit );2682 uiSymbol += uiBit << uiCount;2683 }2684 2685 ruiSymbol = uiSymbol;2686 2687 return;2688 }2689 2690 UInt TDecCavlc::xGetBit()2691 {2692 UInt ruiCode;2693 m_pcBitstream->read( 1, ruiCode );2694 return ruiCode;2695 }2696 2697 2698 2053 /** parse explicit wp tables 2699 2700 2701 2054 * \param TComSlice* pcSlice 2055 * \returns Void 2056 */ 2702 2057 Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice ) 2703 2058 { 2704 2059 wpScalingParam *wp; 2705 2060 Bool bChroma = true; // color always present in HEVC ? 2706 TComPPS* pps = pcSlice->getPPS();2707 2061 SliceType eSliceType = pcSlice->getSliceType(); 2708 2062 Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); 2709 2063 UInt uiLog2WeightDenomLuma, uiLog2WeightDenomChroma; 2710 UInt uiMode = 0; 2711 2712 if ( (eSliceType==P_SLICE && pps->getUseWP()) || (eSliceType==B_SLICE && pps->getWPBiPredIdc()==1 && pcSlice->getRefPicListCombinationFlag()==0) ) 2713 uiMode = 1; // explicit 2714 else if ( eSliceType==B_SLICE && pps->getWPBiPredIdc()==2 ) 2715 uiMode = 2; // implicit 2716 else if (eSliceType==B_SLICE && pps->getWPBiPredIdc()==1 && pcSlice->getRefPicListCombinationFlag()) 2717 uiMode = 3; // combined explicit 2718 2719 if ( uiMode == 1 ) // explicit 2720 { 2721 printf("\nTDecCavlc::xParsePredWeightTable(poc=%d) explicit...\n", pcSlice->getPOC()); 2722 Int iDeltaDenom; 2723 // decode delta_luma_log2_weight_denom : 2724 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 2725 if( bChroma ) 2726 { 2727 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 2728 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 2729 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 2730 } 2731 2732 for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) 2733 { 2734 RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 2735 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2736 { 2737 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2738 2739 wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma; 2740 wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; 2741 wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; 2742 2743 UInt uiCode; 2744 READ_FLAG( uiCode, "luma_weight_lX_flag" ); // u(1): luma_weight_l0_flag 2745 wp[0].bPresentFlag = ( uiCode == 1 ); 2746 if ( wp[0].bPresentFlag ) 2747 { 2748 Int iDeltaWeight; 2749 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 2750 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 2751 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 2752 } 2753 else 2754 { 2755 wp[0].iWeight = (1 << wp[0].uiLog2WeightDenom); 2756 wp[0].iOffset = 0; 2757 } 2758 if ( bChroma ) 2759 { 2760 READ_FLAG( uiCode, "chroma_weight_lX_flag" ); // u(1): chroma_weight_l0_flag 2761 wp[1].bPresentFlag = ( uiCode == 1 ); 2762 wp[2].bPresentFlag = ( uiCode == 1 ); 2763 if ( wp[1].bPresentFlag ) 2764 { 2765 for ( Int j=1 ; j<3 ; j++ ) 2766 { 2767 Int iDeltaWeight; 2768 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 2769 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 2770 2771 Int iDeltaChroma; 2772 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 2773 wp[j].iOffset = iDeltaChroma - ( ( (g_uiIBDI_MAX>>1)*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) + (g_uiIBDI_MAX>>1); 2774 } 2775 } 2776 else 2777 { 2778 for ( Int j=1 ; j<3 ; j++ ) 2779 { 2780 wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); 2781 wp[j].iOffset = 0; 2782 } 2783 } 2784 } 2785 } 2786 2787 for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 2788 { 2789 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2790 2791 wp[0].bPresentFlag = false; 2792 wp[1].bPresentFlag = false; 2793 wp[2].bPresentFlag = false; 2794 } 2795 } 2796 } 2797 else if ( uiMode == 2 ) // implicit 2798 { 2799 printf("\nTDecCavlc::xParsePredWeightTable(poc=%d) implicit...\n", pcSlice->getPOC()); 2800 } 2801 else if ( uiMode == 3 ) // combined explicit 2802 { 2803 printf("\nTDecCavlc::xParsePredWeightTable(poc=%d) combined explicit...\n", pcSlice->getPOC()); 2804 Int iDeltaDenom; 2805 // decode delta_luma_log2_weight_denom : 2806 READ_UVLC ( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 2807 if( bChroma ) 2808 { 2809 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // ue(v): delta_chroma_log2_weight_denom 2810 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 2811 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 2812 } 2813 2814 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(REF_PIC_LIST_C) ; iRefIdx++ ) 2815 { 2816 pcSlice->getWpScalingLC(iRefIdx, wp); 2064 UInt uiTotalSignalledWeightFlags = 0; 2065 2066 Int iDeltaDenom; 2067 // decode delta_luma_log2_weight_denom : 2068 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 2069 assert( uiLog2WeightDenomLuma <= 7 ); 2070 if( bChroma ) 2071 { 2072 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 2073 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 2074 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 2075 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 2076 } 2077 2078 for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) 2079 { 2080 RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 2081 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2082 { 2083 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2817 2084 2818 2085 wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma; … … 2821 2088 2822 2089 UInt uiCode; 2823 READ_FLAG( uiCode, "luma_weight_l c_flag" ); // u(1): luma_weight_lc_flag2090 READ_FLAG( uiCode, "luma_weight_lX_flag" ); // u(1): luma_weight_l0_flag 2824 2091 wp[0].bPresentFlag = ( uiCode == 1 ); 2092 uiTotalSignalledWeightFlags += wp[0].bPresentFlag; 2093 } 2094 if ( bChroma ) 2095 { 2096 UInt uiCode; 2097 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2098 { 2099 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2100 READ_FLAG( uiCode, "chroma_weight_lX_flag" ); // u(1): chroma_weight_l0_flag 2101 wp[1].bPresentFlag = ( uiCode == 1 ); 2102 wp[2].bPresentFlag = ( uiCode == 1 ); 2103 uiTotalSignalledWeightFlags += 2*wp[1].bPresentFlag; 2104 } 2105 } 2106 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2107 { 2108 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2825 2109 if ( wp[0].bPresentFlag ) 2826 2110 { 2827 2111 Int iDeltaWeight; 2828 READ_SVLC( iDeltaWeight, "delta_luma_weight_lc" ); // se(v): delta_luma_weight_lc 2112 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 2113 assert( iDeltaWeight >= -128 ); 2114 assert( iDeltaWeight <= 127 ); 2829 2115 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 2830 READ_SVLC( wp[0].iOffset, "luma_offset_lc" ); // se(v): luma_offset_lc 2116 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 2117 assert( wp[0].iOffset >= -128 ); 2118 assert( wp[0].iOffset <= 127 ); 2831 2119 } 2832 2120 else … … 2837 2125 if ( bChroma ) 2838 2126 { 2839 READ_FLAG( uiCode, "chroma_weight_lc_flag" ); // u(1): chroma_weight_lc_flag2840 wp[1].bPresentFlag = ( uiCode == 1 );2841 wp[2].bPresentFlag = ( uiCode == 1 );2842 2127 if ( wp[1].bPresentFlag ) 2843 2128 { … … 2845 2130 { 2846 2131 Int iDeltaWeight; 2847 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lc" ); // se(v): delta_chroma_weight_lc 2132 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 2133 assert( iDeltaWeight >= -128 ); 2134 assert( iDeltaWeight <= 127 ); 2848 2135 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 2849 2136 2850 2137 Int iDeltaChroma; 2851 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lc" ); // se(v): delta_chroma_offset_lc 2852 wp[j].iOffset = iDeltaChroma - ( ( (g_uiIBDI_MAX>>1)*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) + (g_uiIBDI_MAX>>1); 2138 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 2139 assert( iDeltaChroma >= -512 ); 2140 assert( iDeltaChroma <= 511 ); 2141 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 2142 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); 2853 2143 } 2854 2144 } … … 2864 2154 } 2865 2155 2866 for ( Int iRefIdx=pcSlice->getNumRefIdx( REF_PIC_LIST_C) ; iRefIdx<2*MAX_NUM_REF ; iRefIdx++ )2867 { 2868 pcSlice->getWpScaling LC(iRefIdx, wp);2156 for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 2157 { 2158 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2869 2159 2870 2160 wp[0].bPresentFlag = false; … … 2873 2163 } 2874 2164 } 2875 else 2876 { 2877 printf("\n wrong weight pred table syntax \n "); 2878 assert(0); 2879 } 2165 assert(uiTotalSignalledWeightFlags<=24); 2880 2166 } 2881 2167 2882 2168 /** decode quantization matrix 2883 2884 2169 * \param scalingList quantization matrix information 2170 */ 2885 2171 Void TDecCavlc::parseScalingList(TComScalingList* scalingList) 2886 2172 { 2887 2173 UInt code, sizeId, listId; 2888 2174 Bool scalingListPredModeFlag; 2889 READ_FLAG( code, "scaling_list_present_flag" ); 2890 scalingList->setScalingListPresentFlag ( (code==1)?true:false ); 2891 if(scalingList->getScalingListPresentFlag() == false) 2892 { 2893 //for each size 2894 for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 2895 { 2896 for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) 2897 { 2898 READ_FLAG( code, "scaling_list_pred_mode_flag"); 2899 scalingListPredModeFlag = (code) ? true : false; 2900 if(!scalingListPredModeFlag) //Copy Mode 2901 { 2902 READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); 2903 scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code+1))); 2904 if( sizeId > SCALING_LIST_8x8 ) 2905 { 2906 scalingList->setScalingListDC(sizeId,listId,scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))); 2907 } 2908 scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); 2909 2910 } 2911 else //DPCM Mode 2912 { 2913 xDecodeScalingList(scalingList, sizeId, listId); 2914 } 2175 //for each size 2176 for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 2177 { 2178 for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) 2179 { 2180 READ_FLAG( code, "scaling_list_pred_mode_flag"); 2181 scalingListPredModeFlag = (code) ? true : false; 2182 if(!scalingListPredModeFlag) //Copy Mode 2183 { 2184 READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); 2185 scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); 2186 if( sizeId > SCALING_LIST_8x8 ) 2187 { 2188 scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); 2189 } 2190 scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); 2191 2192 } 2193 else //DPCM Mode 2194 { 2195 xDecodeScalingList(scalingList, sizeId, listId); 2915 2196 } 2916 2197 } … … 2920 2201 } 2921 2202 /** decode DPCM 2922 2923 2924 2925 2203 * \param scalingList quantization matrix information 2204 * \param sizeId size index 2205 * \param listId list index 2206 */ 2926 2207 Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId) 2927 2208 { … … 2930 2211 Int scalingListDcCoefMinus8 = 0; 2931 2212 Int nextCoef = SCALING_LIST_START_VALUE; 2932 UInt* scan = g_auiFrameScanXY [ (sizeId == 0)? 1 : 2 ]; 2933 Bool stopNow = false; 2213 UInt* scan = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] : g_sigLastScanCG32x32; 2934 2214 Int *dst = scalingList->getScalingListAddress(sizeId, listId); 2935 2215 2936 scalingList->setUseDefaultScalingMatrixFlag(sizeId,listId,false);2937 2216 if( sizeId > SCALING_LIST_8x8 ) 2938 2217 { 2939 2218 READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8"); 2940 2219 scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8); 2941 if(scalingListDcCoefMinus8 == -8) 2942 { 2943 scalingList->processDefaultMarix(sizeId,listId); 2944 } 2945 } 2946 2947 if( !scalingList->getUseDefaultScalingMatrixFlag(sizeId,listId)) 2948 { 2949 for(i = 0; i < coefNum && !stopNow ; i++) 2950 { 2951 READ_SVLC( data, "scaling_list_delta_coef"); 2952 nextCoef = (nextCoef + data + 256 ) % 256; 2953 if(sizeId < SCALING_LIST_16x16) 2954 { 2955 if( i == 0 && nextCoef == 0 ) 2956 { 2957 scalingList->processDefaultMarix(sizeId,listId); 2958 stopNow = true; 2959 } 2960 } 2961 if(!stopNow) 2962 { 2963 dst[scan[i]] = nextCoef; 2964 } 2965 } 2966 } 2967 } 2968 2969 Void TDecCavlc::parseDFFlag(UInt& ruiVal, const Char *pSymbolName) 2970 { 2971 READ_FLAG(ruiVal, pSymbolName); 2972 } 2973 Void TDecCavlc::parseDFSvlc(Int& riVal, const Char *pSymbolName) 2974 { 2975 READ_SVLC(riVal, pSymbolName); 2220 nextCoef = scalingList->getScalingListDC(sizeId,listId); 2221 } 2222 2223 for(i = 0; i < coefNum; i++) 2224 { 2225 READ_SVLC( data, "scaling_list_delta_coef"); 2226 nextCoef = (nextCoef + data + 256 ) % 256; 2227 dst[scan[i]] = nextCoef; 2228 } 2976 2229 } 2977 2230 … … 3006 2259 3007 2260 //! \} 2261 -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 44 44 45 45 #include "TDecEntropy.h" 46 #include "SyntaxElementParser.h" 46 47 47 48 //! \ingroup TLibDecoder … … 52 53 // ==================================================================================================================== 53 54 54 class SEImessages;55 56 55 /// CAVLC decoder class 57 class TDecCavlc : public TDecEntropyIf56 class TDecCavlc : public SyntaxElementParser, public TDecEntropyIf 58 57 { 59 58 public: … … 62 61 63 62 protected: 64 Void xReadCode (UInt uiLength, UInt& ruiCode); 65 Void xReadUvlc (UInt& ruiVal); 66 Void xReadSvlc (Int& riVal); 67 Void xReadFlag (UInt& ruiCode); 68 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); 69 Void xReadExGolombLevel ( UInt& ruiSymbol ); 70 Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol ); 71 #if ENC_DEC_TRACE 72 Void xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName); 73 Void xReadUvlcTr ( UInt& rValue, const Char *pSymbolName); 74 Void xReadSvlcTr ( Int& rValue, const Char *pSymbolName); 75 Void xReadFlagTr ( UInt& rValue, const Char *pSymbolName); 76 #endif 77 #if QC_MVHEVC_B0046 78 Void xReadVPSAlignOne (); 79 #endif 80 Void xReadPCMAlignZero (); 81 82 UInt xGetBit (); 63 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 83 64 84 void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 85 private: 86 TComInputBitstream* m_pcBitstream; 87 Int m_iSliceGranularity; //!< slice granularity 88 65 #if H_3D 89 66 Int** m_aaiTempScale; 90 67 Int** m_aaiTempOffset; 91 Int** m_aaiTempPdmScaleNomDelta; 92 Int** m_aaiTempPdmOffset; 93 68 #endif 94 69 public: 95 70 96 71 /// rest entropy coder by intial QP and IDC in CABAC 97 #if !CABAC_INIT_FLAG 98 Void resetEntropy (Int iQp, Int iID) { printf("Not supported yet\n"); assert(0); exit(1);} 99 Void resetEntropy ( TComSlice* pcSlice ); 100 #else 101 Void resetEntropy ( TComSlice* pcSlice ) { assert(0); }; 102 #endif 72 Void resetEntropy ( TComSlice* /*pcSlice*/ ) { assert(0); }; 103 73 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; } 104 /// set slice granularity105 Void setSliceGranularity(Int iSliceGranularity) {m_iSliceGranularity = iSliceGranularity;}106 107 /// get slice granularity108 Int getSliceGranularity() {return m_iSliceGranularity; }109 74 Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ); 110 75 Void parseQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ); 111 Void parseQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ); 112 113 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 76 Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf ); 114 77 Void parseVPS ( TComVPS* pcVPS ); 115 #endif 116 #if HHI_MPI || H3D_QTL 117 Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ); 78 #if H_3D 79 Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ); 118 80 #else 119 81 Void parseSPS ( TComSPS* pcSPS ); 120 82 #endif 121 Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet); 122 Void parseSEI(SEImessages&); 123 Void parseAPS ( TComAPS* pAPS ); 124 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 125 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth); 126 #else 127 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet); 128 #endif 83 Void parsePPS ( TComPPS* pcPPS); 84 Void parseVUI ( TComVUI* pcVUI, TComSPS* pcSPS ); 85 Void parseSEI ( SEIMessages& ); 86 Void parsePTL ( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ); 87 Void parseProfileTier (ProfileTierLevel *ptl); 88 Void parseHrdParameters (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh); 89 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager); 129 90 Void parseTerminatingBit ( UInt& ruiBit ); 130 91 131 #if H3D_IVMP132 Void parseMVPIdx ( Int& riMVPIdx, Int iAMVPCands );133 #else134 92 Void parseMVPIdx ( Int& riMVPIdx ); 135 #endif136 93 137 94 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 138 #if LGE_ILLUCOMP_B0045 95 Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 96 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 97 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); 98 #if H_3D_ARP 99 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 100 #endif 101 #if H_3D_IC 139 102 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 140 103 #endif 141 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 142 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); 143 #if H3D_IVRP 144 Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); 145 #endif 146 #if QC_ARP_D0177 147 Void parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx,UInt uiDepth ); 104 #if LGE_INTER_SDC_E0156 105 Void parseInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 106 Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 148 107 #endif 149 108 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 155 114 Void parseIntraDirChroma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 156 115 157 Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx , UInt uiDepth);158 Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth,RefPicList eRefList );116 Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ); 117 Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ); 159 118 Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartAddr,UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ); 160 119 161 120 Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 162 121 Void parseCoeffNxN ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ); 163 122 Void parseTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType); 123 164 124 Void parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth); 165 125 166 Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ); 167 Void updateContextTables ( SliceType eSliceType, Int iQp ) { return; } 168 Void decodeFlush() {}; 126 Void updateContextTables ( SliceType /*eSliceType*/, Int /*iQp*/ ) { return; } 169 127 170 128 Void xParsePredWeightTable ( TComSlice* pcSlice ); 171 129 Void parseScalingList ( TComScalingList* scalingList ); 172 130 Void xDecodeScalingList ( TComScalingList *scalingList, UInt sizeId, UInt listId); 173 Void parseDFFlag ( UInt& ruiVal, const Char *pSymbolName );174 Void parseDFSvlc ( Int& riVal, const Char *pSymbolName );175 #if RWTH_SDC_DLT_B0036176 #if !PKU_QC_DEPTH_INTRA_UNI_D0195177 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );178 Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );179 #endif180 Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );181 #endif182 131 protected: 183 Void xParseDblParam ( TComAPS* aps );184 #if !LGE_SAO_MIGRATION_D0091185 Void xParseSaoParam ( SAOParam* pSaoParam );186 Void xParseSaoOffset (SaoLcuParam* saoLcuParam);187 Void xParseSaoUnit (Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow );188 #endif189 Void xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS = true, Int firstLCUAddr = 0, Bool acrossSlice = true, Int numLCUInWidth= -1, Int numLCUInHeight= -1);190 Void parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice);191 Void parseAlfFixedLengthRun(UInt& idx, UInt rx, UInt numLCUInWidth);192 Void parseAlfStoredFilterIdx(UInt& idx, UInt numFilterSetsInBuffer);193 Void xParseAlfParam ( ALFParam* pAlfParam );194 Void xParseAlfCuControlParam(AlfCUCtrlInfo& cAlfParam, Int iNumCUsInPic);195 Int xGolombDecode ( Int k );196 132 Bool xMoreRbspData(); 197 133 }; -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 38 38 #include "TDecCu.h" 39 39 40 #if RWTH_SDC_DLT_B003641 #define GetDepthValue2Idx(val) (pcCU->getSlice()->getSPS()->depthValue2idx(val))42 #define GetIdx2DepthValue(val) (pcCU->getSlice()->getSPS()->idx2DepthValue(val))43 #endif44 45 40 //! \ingroup TLibDecoder 46 41 //! \{ … … 54 49 m_ppcYuvResi = NULL; 55 50 m_ppcYuvReco = NULL; 56 #if H3D_IVRP & !QC_ARP_D017757 m_ppcYuvResPred = NULL;58 #endif59 51 m_ppcCU = NULL; 60 52 } … … 82 74 m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; 83 75 m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; 84 #if H3D_IVRP & !QC_ARP_D017785 m_ppcYuvResPred = new TComYuv* [m_uiMaxDepth-1];86 #endif87 76 m_ppcCU = new TComDataCU*[m_uiMaxDepth-1]; 88 77 … … 96 85 m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); 97 86 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); 98 #if H3D_IVRP & !QC_ARP_D017799 m_ppcYuvResPred[ui] = new TComYuv; m_ppcYuvResPred[ui]->create( uiWidth, uiHeight );100 #endif101 87 m_ppcCU [ui] = new TComDataCU; m_ppcCU [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) ); 102 88 } … … 111 97 // initialize conversion matrix from partition index to pel 112 98 initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth ); 113 initMotionReferIdx ( uiMaxWidth, uiMaxHeight, m_uiMaxDepth );114 99 } 115 100 … … 120 105 m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; 121 106 m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; 122 #if H3D_IVRP & !QC_ARP_D0177123 m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL;124 #endif125 107 m_ppcCU [ui]->destroy(); delete m_ppcCU [ui]; m_ppcCU [ui] = NULL; 126 108 } … … 128 110 delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; 129 111 delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; 130 #if H3D_IVRP & !QC_ARP_D0177131 delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL;132 #endif133 112 delete [] m_ppcCU ; m_ppcCU = NULL; 134 113 } … … 148 127 } 149 128 150 pcCU->setNumSucIPCM(0);151 152 129 // start from the top level CU 153 130 xDecodeCU( pcCU, 0, 0, ruiIsLast); … … 158 135 Void TDecCu::decompressCU( TComDataCU* pcCU ) 159 136 { 160 xDecompressCU( pcCU, pcCU,0, 0 );137 xDecompressCU( pcCU, 0, 0 ); 161 138 } 162 139 … … 171 148 * \returns Bool 172 149 */ 173 Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) { 150 Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) 151 { 174 152 UInt uiIsLast; 175 153 TComPic* pcPic = pcCU->getPic(); … … 178 156 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 179 157 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 180 UInt uiGranularityWidth = g_uiMaxCUWidth >>(pcSlice->getPPS()->getSliceGranularity());158 UInt uiGranularityWidth = g_uiMaxCUWidth; 181 159 UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 182 160 UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 183 161 184 #if HHI_MPI185 const UInt uiCUWidth = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUWidth>>uiDepth : pcCU->getWidth (uiAbsPartIdx);186 const UInt uiCUHeight = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUHeight>>uiDepth : pcCU->getHeight(uiAbsPartIdx);187 if(((uiPosX+uiCUWidth)%uiGranularityWidth==0||(uiPosX+uiCUWidth==uiWidth))188 &&((uiPosY+uiCUHeight)%uiGranularityWidth==0||(uiPosY+uiCUHeight==uiHeight)))189 #else190 162 if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth)) 191 163 &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight))) 192 #endif193 164 { 194 165 m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast ); … … 201 172 if(uiIsLast) 202 173 { 203 if(pcSlice->isNext EntropySlice()&&!pcSlice->isNextSlice())204 { 205 pcSlice->set EntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);174 if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice()) 175 { 176 pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); 206 177 } 207 178 else 208 179 { 209 180 pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); 210 pcSlice->set EntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);181 pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts); 211 182 } 212 183 } … … 233 204 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 234 205 UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; 235 206 #if H_MV_ENC_DEC_TRAC 207 DTRACE_CU_S("=========== coding_quadtree ===========\n") 208 DTRACE_CU("x0", uiLPelX) 209 DTRACE_CU("x1", uiTPelY) 210 DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth) 211 DTRACE_CU("cqtDepth" , uiDepth) 212 #endif 236 213 TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); 237 Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->get EntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr();214 Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr(); 238 215 if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 239 216 { 240 if(pcCU->getNumSucIPCM() == 0) 241 { 242 #if HHI_MPI 243 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) 244 #endif 245 m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); 246 } 247 else 248 { 249 pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); 250 } 217 m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); 251 218 } 252 219 else … … 269 236 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; 270 237 271 Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->get EntropySliceCurStartCUAddr();238 Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr(); 272 239 if ( bSubInSlice ) 273 240 { 274 if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )241 if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) 275 242 { 276 243 xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); … … 281 248 } 282 249 } 283 if(ruiIsLast)284 {285 break;286 }287 250 288 251 uiIdx += uiQNumParts; … … 293 256 { 294 257 UInt uiQPSrcPartIdx; 295 if ( pcPic->getCU( pcCU->getAddr() )->get EntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() )258 if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() ) 296 259 { 297 uiQPSrcPartIdx = pcSlice->get EntropySliceCurStartCUAddr() % pcPic->getNumPartInCU();260 uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU(); 298 261 } 299 262 else … … 307 270 } 308 271 272 #if H_MV_ENC_DEC_TRAC 273 DTRACE_CU_S("=========== coding_unit ===========\n") 274 #endif 275 309 276 if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) 310 277 { … … 312 279 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 313 280 } 314 #if QC_CU_NBDV_D0181 315 DisInfo DvInfo; 316 DvInfo.bDV = false; 317 if(!pcCU->getSlice()->isIntra()) 318 { 319 #if QC_ARP_D0177 320 if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getUseAdvRP()) && pcCU->getSlice()->getViewId()) 281 #if H_3D_NBDV 282 DisInfo DvInfo; 283 DvInfo.bDV = false; 284 DvInfo.m_acNBDV.setZero(); 285 DvInfo.m_aVIdxCan = 0; 286 #if H_3D_NBDV_REF 287 DvInfo.m_acDoNBDV.setZero(); 288 #endif 289 290 291 if(!pcCU->getSlice()->isIntra()) 292 { 293 #if H_3D_ARP && H_3D_IV_MERGE 294 if( pcCU->getSlice()->getVPS()->getUseAdvRP( pcCU->getSlice()->getLayerId() ) || pcCU->getSlice()->getVPS()->getIvMvPredFlag( pcCU->getSlice()->getLayerId() )) 295 #else 296 #if H_3D_ARP 297 if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) ) 321 298 #else 322 if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getMultiviewResPredMode()) && pcCU->getSlice()->getViewId()) 323 #endif 324 { 325 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); 326 m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); 327 PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); 328 UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); 329 UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); 330 m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) ); 331 m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) ); 332 m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 333 #if MERL_VSP_C0152 334 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false, true); 335 #else 336 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false); 337 #endif 338 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); 339 m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 340 m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp ); 341 m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp ); 342 } 343 if(DvInfo.bDV==false) 344 { 345 DvInfo.iN=1; 346 #if !SEC_DEFAULT_DV_D0112 347 DvInfo.m_acMvCand[0].setHor(0); 348 DvInfo.m_acMvCand[0].setVer(0); 349 DvInfo.m_aVIdxCan[0] = 0; 350 #endif 351 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); 352 } 353 } 354 #endif 299 #if H_3D_IV_MERGE 300 if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) ) 301 #else 302 if (0) 303 #endif 304 #endif 305 #endif 306 { 307 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); 308 m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); 309 PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); 310 UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); 311 UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); 312 m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) ); 313 m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) ); 314 m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 315 #if H_3D_NBDV_REF 316 if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() )) //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done. 317 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true); 318 else 319 #endif 320 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo); 321 322 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); 323 m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 324 m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp ); 325 m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp ); 326 } 327 } 328 #endif 329 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 330 { 331 m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); 332 } 333 355 334 // decode CU mode and the partition size 356 if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 ) 357 #if HHI_MPI 358 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) 359 #endif 335 if( !pcCU->getSlice()->isIntra()) 360 336 { 361 337 m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); … … 364 340 if( pcCU->isSkipped(uiAbsPartIdx) ) 365 341 { 342 #if H_MV_ENC_DEC_TRAC 343 DTRACE_PU_S("=========== prediction_unit ===========\n") 344 DTRACE_PU("x0", uiLPelX) 345 DTRACE_PU("x1", uiTPelY) 346 #endif 366 347 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 367 348 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 368 #if H3D_IVMP 349 #if H_3D_IV_MERGE 350 m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx); 369 351 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 370 352 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; 371 Int numValidMergeCand = 0;372 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui )373 353 #else 374 354 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 375 355 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 356 #endif 376 357 Int numValidMergeCand = 0; 377 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) 378 #endif 358 for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui ) 379 359 { 380 360 uhInterDirNeighbours[ui] = 0; 381 361 } 382 m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, SIZE_2Nx2N, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth ); 383 #if HHI_MPI 384 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) 385 { 386 TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); 387 pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); 388 389 UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 390 391 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 392 { 393 const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); 394 #if MERL_VSP_C0152 395 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui ); 396 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx ); 397 #endif 398 #if MERL_VSP_NBDV_RefVId_Fix_D0166 399 Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui ); 400 pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir ); 401 #endif 402 pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); 403 pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); 404 pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); 405 pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); 406 pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); 407 } 408 #if LGE_ILLUCOMP_DEPTH_C0046 409 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 410 #endif 411 } 412 else 413 { 414 #endif 362 m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth ); 415 363 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); 416 #if MERL_VSP_C0152 417 #if LGE_VSP_INHERIT_D0092418 Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM];419 for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)420 { 421 iVSPIndexTrue[i] = 0;422 }364 365 #if H_3D_VSP 366 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 367 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 368 #if MTK_VSP_FIX_ALIGN_WD_E0172 369 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 370 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex ); 423 371 #else 424 Int iVSPIndexTrue[3] = {-1, -1, -1}; 425 #endif 426 #if MERL_VSP_NBDV_RefVId_Fix_D0166 427 Int iVSPDirTrue[3] = {-1, -1, -1};428 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue, uiMergeIndex);372 #if MTK_VSP_FIX_E0172 373 Int vspDir[MRG_MAX_NUM_CANDS_MEM]; 374 memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 375 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag,vspDir, numValidMergeCand, uiMergeIndex ); 376 pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 429 377 #else 430 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); 431 #endif 432 #if MTK_D0156 433 if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() ) 434 { 435 pcCU->setVSPIndexSubParts( 0, uiAbsPartIdx, 0, uiDepth ); 436 } 437 else 438 #endif 439 { 440 Int iVSPIdx = 0; 441 #if LGE_VSP_INHERIT_D0092 442 if (iVSPIndexTrue[uiMergeIndex] == 1) 443 { 444 iVSPIdx = 1; 445 } 378 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex ); 379 #endif 380 #endif// end of MTK_VSP_FIX_ALIGN_WD_E0172 381 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 446 382 #else 447 Int numVspIdx; 448 numVspIdx = 3; 449 for (Int i = 0; i < numVspIdx; i++) 450 { 451 if (iVSPIndexTrue[i] == uiMergeIndex) 452 { 453 iVSPIdx = i+1; 454 break; 455 } 456 } 457 #endif 458 pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth ); // Initialize 459 #if MERL_VSP_NBDV_RefVId_Fix_D0166 460 pcCU->setVSPDirSubParts( 0, uiAbsPartIdx, 0, uiDepth ); 461 #endif 462 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 463 if(iVSPIdx != 0) 464 { 465 Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 466 cMvFieldNeighbours[ 2*uiMergeIndex].setRefIdx(iIVCIdx); 467 } 468 #endif 469 } 470 #else 471 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 383 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 384 #endif 385 #if MTK_VSP_FIX_ALIGN_WD_E0172 386 if(vspFlag[uiMergeIndex]) 387 { 388 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiAbsPartIdx, 0, uiDepth); 389 } 472 390 #endif 473 391 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); … … 484 402 } 485 403 } 486 #if LGE_ILLUCOMP_B0045404 #if H_3D_IC 487 405 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 488 406 #endif 489 #if HHI_MPI 490 } 491 #endif 492 #if QC_ARP_D0177 493 if( pcCU->getSlice()->getSPS()->getUseAdvRP() ) 494 { 495 pcCU->setResPredAvailSubParts ( false, uiAbsPartIdx, 0, uiDepth ); 496 pcCU->setResPredFlagSubParts ( false, uiAbsPartIdx, 0, uiDepth ); 497 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth, m_ppcCU[uiDepth], 0 ); 498 } 407 #if H_3D_ARP 408 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth ); 499 409 #endif 500 410 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); … … 502 412 } 503 413 504 #if HHI_MPI 505 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) 506 { 507 #endif 508 if( pcCU->getNumSucIPCM() == 0 ) 509 { 510 m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); 511 m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 512 } 513 else 514 { 515 pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); 516 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 517 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); 518 pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); 519 } 414 m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth ); 415 m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 520 416 521 417 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) … … 530 426 } 531 427 532 #if ! HHI_MPI533 428 UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); 534 429 UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); 535 #endif536 430 537 431 // prediction mode ( Intra : direction mode, Inter : Mv, reference idx ) 538 432 m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]); 539 540 #if LGE_ILLUCOMP_B0045 541 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI 542 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) != uiDepth ) 543 { 544 #endif 433 #if H_3D_IC 545 434 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 546 435 #endif 547 548 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI 549 } 550 #endif 551 #if QC_ARP_D0177 552 if (pcCU->getSlice()->getSPS()->getUseAdvRP() && pcCU->isIntra( uiAbsPartIdx ) ) 553 { 554 pcCU->setResPredAvailSubParts ( 0, uiAbsPartIdx, 0, uiDepth ); 555 pcCU->setResPredFlagSubParts ( 0, uiAbsPartIdx, 0, uiDepth ); 556 } 557 #endif 558 #if HHI_MPI 559 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) 560 { 561 assert( pcCU->getZorderIdxInCU() == 0 ); 562 TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); 563 pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx ); 564 565 UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 566 567 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 568 { 569 const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); 570 #if MERL_VSP_C0152 571 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); 572 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 573 #endif 574 #if MERL_VSP_NBDV_RefVId_Fix_D0166 575 if (pcCU->getSlice()->getIsDepth()) { 576 pcCU->setVSPDir( uiAbsPartIdx + ui, 0); 577 } 578 else { 579 Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui); 580 pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir); 581 } 582 #endif 583 pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); 584 pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N ); 585 pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth ); 586 pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth ); 587 pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth ); 588 } 589 #if LGE_ILLUCOMP_DEPTH_C0046 590 m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); 591 #endif 592 if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary ) 593 { 594 UInt uiIdx = uiAbsPartIdx; 595 if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) 596 { 597 setdQPFlag(true); 598 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 599 } 600 601 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) 602 { 603 uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ]; 604 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; 605 606 Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr(); 607 if ( bSubInSlice ) 608 { 609 if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) 610 { 611 xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast ); 612 } 613 else 614 { 615 pcCU->setOutsideCUPart( uiIdx, uiDepth+1 ); 616 } 617 } 618 if(ruiIsLast) 619 { 620 break; 621 } 622 uiIdx += uiQNumParts; 623 } 624 if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) 625 { 626 if ( getdQPFlag() ) 627 { 628 UInt uiQPSrcPartIdx; 629 if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() ) 630 { 631 uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU(); 632 } 633 else 634 { 635 uiQPSrcPartIdx = uiAbsPartIdx; 636 } 637 pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP 638 } 639 } 640 return; 641 } 642 } 643 } 644 645 UInt uiCurrWidth = pcCU->getWidth ( uiAbsPartIdx ); 646 UInt uiCurrHeight = pcCU->getHeight( uiAbsPartIdx ); 647 #endif 648 436 #if H_3D_ARP 437 m_pcEntropyDecoder->decodeARPW ( pcCU , uiAbsPartIdx , uiDepth ); 438 #endif 439 #if LGE_INTER_SDC_E0156 440 m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); 441 #endif 649 442 // Coefficient decoding 650 443 Bool bCodeDQP = getdQPFlag(); … … 656 449 Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast) 657 450 { 658 if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP()) 659 { 660 if( getdQPFlag() ) 661 { 662 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 663 } 664 } 665 666 if( pcCU->getNumSucIPCM() > 0 ) 667 { 668 ruiIsLast = 0; 669 return; 451 if( pcCU->getSlice()->getPPS()->getUseDQP()) 452 { 453 pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP 670 454 } 671 455 … … 673 457 } 674 458 675 Void TDecCu::xDecompressCU( TComDataCU* pcCU, TComDataCU* pcCUCur,UInt uiAbsPartIdx, UInt uiDepth )459 Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 676 460 { 677 461 TComPic* pcPic = pcCU->getPic(); … … 685 469 UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); 686 470 TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx()); 687 Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->get EntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr();471 Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr(); 688 472 if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 689 473 { … … 701 485 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ]; 702 486 703 Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->get EntropySliceCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getEntropySliceCurEndCUAddr());487 Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr()); 704 488 if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 705 489 { 706 xDecompressCU(pcCU, m_ppcCU[uiNextDepth],uiIdx, uiNextDepth );490 xDecompressCU(pcCU, uiIdx, uiNextDepth ); 707 491 } 708 492 … … 719 503 switch( m_ppcCU[uiDepth]->getPredictionMode(0) ) 720 504 { 721 case MODE_SKIP:722 505 case MODE_INTER: 723 xReconInter( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); 506 #if LGE_INTER_SDC_E0156 507 if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) ) 508 { 509 xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth ); 510 } 511 else 512 { 513 #endif 514 xReconInter( m_ppcCU[uiDepth], uiDepth ); 515 #if LGE_INTER_SDC_E0156 516 } 517 #endif 724 518 break; 725 519 case MODE_INTRA: 726 #if RWTH_SDC_DLT_B0036520 #if H_3D_DIM_SDC 727 521 if( m_ppcCU[uiDepth]->getSDCFlag(0) ) 728 522 xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth ); 729 523 else 730 524 #endif 731 xReconIntraQT( m_ppcCU[uiDepth], ui AbsPartIdx, uiDepth );525 xReconIntraQT( m_ppcCU[uiDepth], uiDepth ); 732 526 break; 733 527 default: … … 735 529 break; 736 530 } 737 #if LOSSLESS_CODING738 531 if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false)) 739 532 { 740 xFillPCMBuffer(m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth); 741 } 742 #endif 533 xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth); 534 } 743 535 744 536 xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth ); 745 537 } 746 538 747 Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 748 { 749 #if HHI_MPI 750 #if FIX_MPI_B0065 751 if( pcCU->getTextureModeDepth( 0 ) != -1 ) 752 { 753 TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); 754 if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx)) 755 { 756 PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx); 757 pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); 758 } 759 else 760 { 761 pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); 762 } 763 } 764 #else 765 if( pcCU->getTextureModeDepth( 0 ) != -1 ) 766 pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth ); 767 #endif 768 #endif 539 Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth ) 540 { 769 541 770 542 // inter prediction 771 #if MERL_VSP_C0152772 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx );773 #else774 543 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 775 #endif 776 #if H3D_IVRP & !QC_ARP_D0177 777 if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) 778 { 779 m_pcPrediction->residualPrediction(pcCU, m_ppcYuvReco[uiDepth], m_ppcYuvResPred[uiDepth]); 780 } 781 #endif 782 783 #if HHI_MPI 784 if( pcCU->getTextureModeDepth( 0 ) != -1 ) 785 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 786 #endif 787 544 788 545 // inter recon 789 546 xDecodeInterTexture( pcCU, 0, uiDepth ); … … 796 553 else 797 554 { 798 #if H3D_IVRP799 if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))800 {801 m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );802 }803 #endif804 555 m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 )); 805 556 } 806 557 } 558 559 #if LGE_INTER_SDC_E0156 560 Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 561 { 562 // inter prediction 563 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 564 565 UInt uiWidth = pcCU->getWidth ( 0 ); 566 UInt uiHeight = pcCU->getHeight( 0 ); 567 UChar* pMask = pcCU->getInterSDCMask(); 568 569 memset( pMask, 0, uiWidth*uiHeight ); 570 pcCU->xSetInterSDCCUMask( pcCU, pMask ); 571 572 Pel *pResi; 573 UInt uiPelX, uiPelY; 574 UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride(); 575 576 pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 ); 577 for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ ) 578 { 579 for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ ) 580 { 581 UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ]; 582 583 pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );; 584 } 585 pResi += uiResiStride; 586 } 587 588 m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) ); 589 590 // clear UV 591 UInt uiStrideC = m_ppcYuvReco[uiDepth]->getCStride(); 592 Pel *pRecCb = m_ppcYuvReco[uiDepth]->getCbAddr(); 593 Pel *pRecCr = m_ppcYuvReco[uiDepth]->getCrAddr(); 594 595 for (Int y = 0; y < uiHeight/2; y++) 596 { 597 for (Int x = 0; x < uiWidth/2; x++) 598 { 599 pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); 600 pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) ); 601 } 602 603 pRecCb += uiStrideC; 604 pRecCr += uiStrideC; 605 } 606 } 607 #endif 807 608 808 609 Void … … 829 630 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder ); 830 631 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride (); 831 632 Bool useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA); 832 633 //===== init availability pattern ===== 833 634 Bool bAboveAvail = false; … … 839 640 m_pcPrediction->getPredicBufHeight (), 840 641 bAboveAvail, bLeftAvail ); 841 #if LGE_EDGE_INTRA_A0070 842 if( uiLumaPredMode >= EDGE_INTRA_IDX ) 843 { 844 m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride 845 #if LGE_EDGE_INTRA_DELTA_DC 846 , uiLumaPredMode == EDGE_INTRA_DELTA_IDX 847 #endif 848 ); 849 } 642 643 //===== get prediction signal ===== 644 #if H_3D_DIM 645 if( isDimMode( uiLumaPredMode ) ) 646 { 647 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight ); 648 } 850 649 else 851 #endif 852 853 //===== get prediction signal ===== 854 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 855 if( uiLumaPredMode >= NUM_INTRA_MODE ) 856 { 857 m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false ); 858 } 859 else 860 { 861 #endif 862 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); 863 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 650 { 651 #endif 652 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 653 #if H_3D_DIM 864 654 } 865 655 #endif 866 656 867 657 //===== inverse transform ===== 868 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(),TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );658 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 869 659 870 660 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA]; 871 661 assert(scalingListType < 6); 872 #if LOSSLESS_CODING 873 m_pcTrQuant->invtransformNxN( pcCU, TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); 874 #else 875 m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); 876 #endif 662 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip ); 877 663 878 664 … … 886 672 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 887 673 { 888 pReco [ uiX ] = Clip ( pPred[ uiX ] + pResi[ uiX ] );674 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] ); 889 675 pRecIPred[ uiX ] = pReco[ uiX ]; 890 676 } … … 937 723 Pel* piRecIPred = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) ); 938 724 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride(); 939 725 Bool useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText); 940 726 //===== init availability pattern ===== 941 727 Bool bAboveAvail = false; … … 943 729 pcCU->getPattern()->initPattern ( pcCU, uiTrDepth, uiAbsPartIdx ); 944 730 945 if( uiChromaPredMode == LM_CHROMA_IDX && uiChromaId == 0 ) 946 { 947 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, 948 m_pcPrediction->getPredicBuf (), 949 m_pcPrediction->getPredicBufWidth (), 950 m_pcPrediction->getPredicBufHeight (), 951 bAboveAvail, bLeftAvail, 952 true ); 953 954 m_pcPrediction->getLumaRecPixels( pcCU->getPattern(), uiWidth, uiHeight ); 955 } 956 957 pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, 731 pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth, 958 732 m_pcPrediction->getPredicBuf (), 959 733 m_pcPrediction->getPredicBufWidth (), … … 963 737 964 738 //===== get prediction signal ===== 965 if( uiChromaPredMode == LM_CHROMA_IDX ) 966 { 967 m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId ); 739 { 740 if( uiChromaPredMode == DM_CHROMA_IDX ) 741 { 742 uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); 743 #if H_3D_DIM 744 mapDepthModeToIntraDir( uiChromaPredMode ); 745 #endif 746 } 747 m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 748 } 749 750 //===== inverse transform ===== 751 Int curChromaQpOffset; 752 if(eText == TEXT_CHROMA_U) 753 { 754 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb(); 968 755 } 969 756 else 970 757 { 971 if( uiChromaPredMode == DM_CHROMA_IDX ) 972 { 973 uiChromaPredMode = pcCU->getLumaIntraDir( 0 ); 974 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 975 mapDMMtoIntraMode( uiChromaPredMode ); 976 #endif 977 } 978 m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); 979 } 980 981 //===== inverse transform ===== 982 if(eText == TEXT_CHROMA_U) 983 { 984 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); 985 } 986 else 987 { 988 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); 989 } 758 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); 759 } 760 m_pcTrQuant->setQPforQuant ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 990 761 991 762 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText]; 992 763 assert(scalingListType < 6); 993 #if LOSSLESS_CODING 994 m_pcTrQuant->invtransformNxN( pcCU, eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); 995 #else 996 m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType ); 997 #endif 764 m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma ); 998 765 999 766 //===== reconstruction ===== … … 1006 773 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1007 774 { 1008 pReco [ uiX ] = Clip ( pPred[ uiX ] + pResi[ uiX ] );775 pReco [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] ); 1009 776 pRecIPred[ uiX ] = pReco[ uiX ]; 1010 777 } … … 1016 783 } 1017 784 785 1018 786 Void 1019 TDecCu::xIntraRecQT( TComDataCU* pcCU, 1020 UInt uiTrDepth, 1021 UInt uiAbsPartIdx, 1022 TComYuv* pcRecoYuv, 1023 TComYuv* pcPredYuv, 1024 TComYuv* pcResiYuv ) 1025 { 1026 UInt uiFullDepth = pcCU->getDepth(0) + uiTrDepth; 1027 UInt uiTrMode = pcCU->getTransformIdx( uiAbsPartIdx ); 1028 if( uiTrMode == uiTrDepth ) 1029 { 1030 xIntraRecLumaBlk ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv ); 1031 xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 ); 1032 xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 ); 1033 } 1034 else 1035 { 1036 UInt uiNumQPart = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 ); 1037 for( UInt uiPart = 0; uiPart < 4; uiPart++ ) 1038 { 1039 xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv ); 1040 } 1041 } 1042 } 1043 1044 Void 1045 TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 787 TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth ) 1046 788 { 1047 789 UInt uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 ); … … 1051 793 if (pcCU->getIPCMFlag(0)) 1052 794 { 1053 xReconPCM( pcCU, ui AbsPartIdx, uiDepth );795 xReconPCM( pcCU, uiDepth ); 1054 796 return; 1055 797 } … … 1067 809 } 1068 810 1069 #if RWTH_SDC_DLT_B0036811 #if H_3D_DIM_SDC 1070 812 Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1071 813 { … … 1100 842 1101 843 //===== get prediction signal ===== 1102 #if H HI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX1103 if( uiLumaPredMode >= NUM_INTRA_MODE)1104 { 1105 m_pcPrediction->predIntraLumaD MM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false);844 #if H_3D_DIM 845 if( isDimMode( uiLumaPredMode ) ) 846 { 847 m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight ); 1106 848 } 1107 849 else 1108 850 { 1109 851 #endif 1110 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU,bAboveAvail, bLeftAvail );1111 #if H HI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX852 m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 853 #if H_3D_DIM 1112 854 } 1113 855 #endif 1114 856 1115 857 // number of segments depends on prediction mode 1116 UInt uiNumSegments = 1; 858 UInt uiNumSegments = 1; 1117 859 Bool* pbMask = NULL; 1118 860 UInt uiMaskStride = 0; 1119 861 1120 if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX )1121 { 1122 Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx);862 if( getDimType( uiLumaPredMode ) == DMM1_IDX ) 863 { 864 Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx); 1123 865 1124 WedgeList* pacWedgeList = &g_ aacWedgeLists[(g_aucConvertToBit[uiWidth])];866 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])]; 1125 867 TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx )); 1126 868 … … 1132 874 // get DC prediction for each segment 1133 875 Pel apDCPredValues[2]; 1134 xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); 876 #if KWU_SDC_SIMPLE_DC_E0117 877 m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode); 878 #else 879 m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride); 880 #endif 1135 881 1136 882 // reconstruct residual based on mask + DC residuals 1137 883 Pel apDCResiValues[2]; 1138 #if !MERL_General_Fix 1139 Pel apDCRecoValues[2]; 1140 #endif 1141 for( UInt ui = 0; ui < uiNumSegments; ui++ ) 1142 { 1143 Pel pPredIdx = GetDepthValue2Idx( apDCPredValues[ui] ); 1144 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx); 1145 Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); 884 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 885 { 886 #if H_3D_DIM_DLT 887 Pel pPredIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 888 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 889 Pel pRecoValue = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx ); 1146 890 1147 #if !MERL_General_Fix 1148 apDCRecoValues[ui] = pRecoValue; 1149 #endif 1150 apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; 891 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 892 #else 893 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); 894 #endif 1151 895 } 1152 896 … … 1164 908 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1165 909 assert( ucSegment < uiNumSegments ); 1166 #if MTK_SAMPLE_BASED_SDC_D0110910 1167 911 Pel pResiDC = apDCResiValues[ucSegment]; 1168 912 1169 pReco [ uiX ] = Clip( pPred[ uiX ] + pResiDC ); 1170 #else 1171 Pel pPredVal= apDCPredValues[ucSegment]; 1172 Pel pResiDC = apDCResiValues[ucSegment]; 1173 1174 pReco [ uiX ] = Clip( pPredVal + pResiDC ); 1175 #endif 913 pReco [ uiX ] = ClipY( pPred[ uiX ] + pResiDC ); 1176 914 pRecIPred[ uiX ] = pReco[ uiX ]; 1177 915 } … … 1192 930 for (Int x=0; x<uiWidth/2; x++) 1193 931 { 1194 pRecCb[x] = (Pel)(128<<g_uiBitIncrement);1195 pRecCr[x] = (Pel)(128<<g_uiBitIncrement);932 pRecCb[x] = 128; 933 pRecCr[x] = 128; 1196 934 } 1197 935 … … 1287 1025 1288 1026 Pel* pResi; 1289 UInt uiLumaTrMode, uiChromaTrMode; 1290 1291 pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); 1027 UInt trMode = pcCU->getTransformIdx( uiAbsPartIdx ); 1292 1028 1293 1029 // Y … … 1295 1031 pResi = m_ppcYuvResi[uiDepth]->getLumaAddr(); 1296 1032 1297 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(),TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );1298 1299 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );1033 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 1034 1035 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); 1300 1036 1301 1037 // Cb and Cr 1302 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); 1038 Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb(); 1039 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 1303 1040 1304 1041 uiWidth >>= 1; 1305 1042 uiHeight >>= 1; 1306 1043 piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr(); 1307 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 1308 1309 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() ); 1044 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); 1045 1046 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); 1047 m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset ); 1310 1048 1311 1049 piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr(); 1312 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );1050 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff ); 1313 1051 } 1314 1052 … … 1335 1073 uiPicStride = pcCU->getPic()->getPicYuvRec()->getStride(); 1336 1074 piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); 1337 uiPcmLeftShiftBit = g_ uiBitDepth + g_uiBitIncrement- pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();1075 uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); 1338 1076 } 1339 1077 else … … 1349 1087 piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx); 1350 1088 } 1351 uiPcmLeftShiftBit = g_ uiBitDepth + g_uiBitIncrement- pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1089 uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); 1352 1090 } 1353 1091 … … 1367 1105 /** Function for reconstructing a PCM mode CU. 1368 1106 * \param pcCU pointer to current CU 1369 * \param uiAbsPartIdx CU index1370 1107 * \param uiDepth CU Depth 1371 1108 * \returns Void 1372 1109 */ 1373 Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt ui AbsPartIdx, UInt uiDepth )1110 Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth ) 1374 1111 { 1375 1112 // Luma … … 1399 1136 } 1400 1137 1401 #if LOSSLESS_CODING1402 1138 /** Function for filling the PCM buffer of a CU using its reconstructed sample array 1403 1139 * \param pcCU pointer to current CU 1404 * \param uiAbsPartIdx CU index1405 1140 * \param uiDepth CU Depth 1406 1141 * \returns Void 1407 1142 */ 1408 Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt absPartIdx, UIntdepth)1143 Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth) 1409 1144 { 1410 1145 // Luma … … 1452 1187 1453 1188 } 1454 #endif1455 1456 #if RWTH_SDC_DLT_B00361457 Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride )1458 {1459 Int iSumDepth[2];1460 memset(iSumDepth, 0, sizeof(Int)*2);1461 Int iSumPix[2];1462 memset(iSumPix, 0, sizeof(Int)*2);1463 #if HS_REFERENCE_SUBSAMPLE_C01541464 Int subSamplePix;1465 if ( uiSize == 64 || uiSize == 32 )1466 {1467 subSamplePix = 2;1468 }1469 else1470 {1471 subSamplePix = 1;1472 }1473 for (Int y=0; y<uiSize; y+=subSamplePix)1474 {1475 for (Int x=0; x<uiSize; x+=subSamplePix)1476 {1477 UChar ucSegment = pMask?(UChar)pMask[x]:0;1478 assert( ucSegment < uiNumSegments );1479 1480 iSumDepth[ucSegment] += pOrig[x];1481 iSumPix[ucSegment] += 1;1482 }1483 pOrig += uiStride*subSamplePix;1484 pMask += uiMaskStride*subSamplePix;1485 }1486 #else1487 for (Int y=0; y<uiSize; y++)1488 {1489 for (Int x=0; x<uiSize; x++)1490 {1491 UChar ucSegment = pMask?(UChar)pMask[x]:0;1492 assert( ucSegment < uiNumSegments );1493 1494 iSumDepth[ucSegment] += pOrig[x];1495 iSumPix[ucSegment] += 1;1496 }1497 1498 pOrig += uiStride;1499 pMask += uiMaskStride;1500 }1501 #endif1502 // compute mean for each segment1503 for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ )1504 {1505 if( iSumPix[ucSeg] > 0 )1506 rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];1507 else1508 rpSegMeans[ucSeg] = 0; // this happens for zero-segments1509 }1510 }1511 #endif1512 1189 1513 1190 //! \} -
trunk/source/Lib/TLibDecoder/TDecCu.h
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 61 61 TComYuv** m_ppcYuvResi; ///< array of residual buffer 62 62 TComYuv** m_ppcYuvReco; ///< array of prediction & reconstruction buffer 63 #if H3D_IVRP & !QC_ARP_D017764 TComYuv** m_ppcYuvResPred; ///< residual prediction buffer65 #endif66 63 TComDataCU** m_ppcCU; ///< CU data array 67 64 68 65 // access channel 69 66 TComTrQuant* m_pcTrQuant; … … 85 82 /// destroy internal buffers 86 83 Void destroy (); 87 84 88 85 /// decode CU information 89 86 Void decodeCU ( TComDataCU* pcCU, UInt& ruiIsLast ); … … 97 94 Void xFinishDecodeCU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt &ruiIsLast); 98 95 Bool xDecodeSliceEnd ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth); 99 Void xDecompressCU ( TComDataCU* pcCU, TComDataCU* pcCUCur,UInt uiAbsPartIdx, UInt uiDepth );96 Void xDecompressCU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 100 97 101 Void xReconInter ( TComDataCU* pcCU, UInt ui AbsPartIdx, UInt uiDepth );98 Void xReconInter ( TComDataCU* pcCU, UInt uiDepth ); 102 99 103 Void xReconIntraQT ( TComDataCU* pcCU, UInt ui AbsPartIdx, UInt uiDepth );100 Void xReconIntraQT ( TComDataCU* pcCU, UInt uiDepth ); 104 101 Void xIntraRecLumaBlk ( TComDataCU* pcCU, UInt uiTrDepth, UInt uiAbsPartIdx, TComYuv* pcRecoYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv ); 105 102 Void xIntraRecChromaBlk ( TComDataCU* pcCU, UInt uiTrDepth, UInt uiAbsPartIdx, TComYuv* pcRecoYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv, UInt uiChromaId ); 106 Void xIntraRecQT ( TComDataCU* pcCU, UInt uiTrDepth, UInt uiAbsPartIdx, TComYuv* pcRecoYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv );107 103 108 Void xReconPCM ( TComDataCU* pcCU, UInt ui AbsPartIdx, UInt uiDepth );104 Void xReconPCM ( TComDataCU* pcCU, UInt uiDepth ); 109 105 110 106 Void xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 118 114 Bool getdQPFlag () { return m_bDecodeDQP; } 119 115 Void setdQPFlag ( Bool b ) { m_bDecodeDQP = b; } 120 #if LOSSLESS_CODING 121 Void xFillPCMBuffer (TComDataCU* pCU, UInt absPartIdx, UInt depth); 116 Void xFillPCMBuffer (TComDataCU* pCU, UInt depth); 117 #if H_3D_DIM_SDC 118 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 122 119 #endif 123 #if RWTH_SDC_DLT_B0036 124 Void xAnalyzeSegmentsSDC ( Pel* pOrig, 125 UInt uiStride, 126 UInt uiSize, 127 Pel* rpSegMeans, 128 UInt uiNumSegments, 129 Bool* pMask, 130 UInt uiMaskStride ); 131 132 Void xReconIntraSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 120 #if LGE_INTER_SDC_E0156 121 Void xReconInterSDC ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 133 122 #endif 134 123 }; -
trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 46 46 } 47 47 48 #include "TLibCommon/TComAdaptiveLoopFilter.h"49 48 #include "TLibCommon/TComSampleAdaptiveOffset.h" 50 49 … … 52 51 { 53 52 m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); 53 } 54 55 Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 56 { 57 m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); 54 58 } 55 59 … … 67 71 } 68 72 69 #if LGE_ILLUCOMP_B004570 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )71 {72 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );73 74 if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0)75 #if !LGE_ILLUCOMP_DEPTH_C004676 || pcCU->getSlice()->getSPS()->isDepth()77 #endif78 )79 {80 return;81 }82 83 if(!pcCU->getSlice()->getApplyIC())84 return;85 86 #if LGE_ILLUCOMP_DEPTH_C004687 if(pcCU->isICFlagRequired(uiAbsPartIdx, uiDepth)) //This modification is not needed after integrating JCT3V-C013788 #else89 if(pcCU->isICFlagRequired(uiAbsPartIdx))90 #endif91 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth );92 }93 #endif94 73 /** decode merge index 95 74 * \param pcCU … … 101 80 * \returns Void 102 81 */ 103 Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours,UInt uiDepth )82 Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth ) 104 83 { 105 84 UInt uiMergeIndex = 0; 106 m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex , uiAbsPartIdx, uiDepth);85 m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex ); 107 86 pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth ); 108 87 } 109 88 110 #if QC_ARP_D0177 111 Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ) 112 { 113 if( pcCU->getSlice()->getViewId() == 0 || pcCU->getSlice()->getIsDepth() == true || !pcCU->getSlice()->getARPStepNum() ) 114 return; 115 assert( !pcCU->isIntra( uiAbsPartIdx ) ); 116 Bool bResPredAvailable = !pcCU->getSlice()->getARPStepNum() ? false: ((pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N || pcCU->isSkipped(uiAbsPartIdx)) ? true: false); 117 if(!bResPredAvailable) 118 pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); 89 #if H_3D_ARP 90 Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 91 { 92 if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) 93 { 94 return; 95 } 96 97 if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) 98 { 99 pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); 100 } 119 101 else 102 { 120 103 m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); 121 } 122 #endif 104 } 105 } 106 #endif 107 108 #if H_3D_IC 109 Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 110 { 111 pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); 112 113 if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) ) 114 { 115 return; 116 } 117 118 if( !pcCU->getSlice()->getApplyIC() ) 119 return; 120 121 if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) 122 m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); 123 } 124 #endif 125 123 126 Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 124 127 { … … 129 132 { 130 133 m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); 131 132 #if !PKU_QC_DEPTH_INTRA_UNI_D0195133 #if RWTH_SDC_DLT_B0036134 // if B-Slice, code SDC flag later135 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->isDepth() )136 {137 // decode SDC flag138 decodeSDCFlag(pcCU, uiAbsPartIdx, uiDepth);139 }140 #endif141 #endif142 134 } 143 135 144 136 Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 145 137 { 146 #if !PKU_QC_DEPTH_INTRA_UNI_D0195147 #if RWTH_SDC_DLT_B0036148 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) )149 {150 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );151 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );152 return;153 }154 #endif155 #endif156 157 138 m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); 158 159 #if !PKU_QC_DEPTH_INTRA_UNI_D0195160 #if RWTH_SDC_DLT_B0036161 if( pcCU->getSlice()->isInterB() && pcCU->getSlice()->getSPS()->isDepth() && pcCU->isIntra(uiAbsPartIdx) )162 {163 // decode SDC flag164 decodeSDCFlag(pcCU, uiAbsPartIdx, uiDepth);165 166 if( pcCU->getSDCFlag(uiAbsPartIdx) )167 {168 // part size is also known for SDC intra169 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );170 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );171 }172 }173 #endif174 #endif175 139 } 176 140 177 141 Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) 178 142 { 179 #if !PKU_QC_DEPTH_INTRA_UNI_D0195180 #if RWTH_SDC_DLT_B0036181 if( pcCU->getSDCFlag(uiAbsPartIdx) )182 {183 decodeSDCPredMode(pcCU, uiAbsPartIdx, uiDepth);184 return;185 }186 #endif187 #endif188 189 PartSize eMode = pcCU->getPartitionSize( uiAbsPartIdx );190 191 143 if( pcCU->isIntra( uiAbsPartIdx ) ) // If it is Intra mode, encode intra prediction mode. 192 144 { 193 if( eMode == SIZE_NxN ) // if it is NxN size, encode 4 intra directions. 194 { 195 UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(uiAbsPartIdx) << 1 ) ) >> 2; 196 // if it is NxN size, this size might be the smallest partition size. // if it is NxN size, this size might be the smallest partition size. 197 decodeIntraDirModeLuma( pcCU, uiAbsPartIdx, uiDepth+1 ); 198 decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset, uiDepth+1 ); 199 decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*2, uiDepth+1 ); 200 decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*3, uiDepth+1 ); 201 #if PKU_QC_DEPTH_INTRA_UNI_D0195 202 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 203 #endif 204 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 205 } 206 else // if it is not NxN size, encode 1 intra directions 207 { 208 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 209 #if PKU_QC_DEPTH_INTRA_UNI_D0195 210 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 211 #endif 212 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 213 } 145 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 146 #if H_3D_DIM_SDC 147 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 148 #endif 149 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 214 150 } 215 151 else // if it is Inter mode, encode motion vector and reference index 216 152 { 217 153 decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); 218 #if QC_ARP_D0177219 if( pcCU->getSlice()->getSPS()->getUseAdvRP() )220 {221 decodeARPW( pcCU , uiAbsPartIdx , uiDepth, pcSubCU, 0 );222 }223 #endif224 154 } 225 155 } … … 239 169 return; 240 170 } 241 242 #if RWTH_SDC_DLT_B0036 171 #if H_3D_DIM_SDC 243 172 if( pcCU->getSDCFlag(uiAbsPartIdx) ) 244 173 { … … 273 202 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; 274 203 275 #if CU_BASED_MRG_CAND_LIST 276 #if H3D_IVMP 204 #if H_3D_IV_MERGE 277 205 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 278 206 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; 279 for ( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ui++ )280 207 #else 281 208 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 282 209 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 283 for ( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ui++ ) 284 #endif 210 #endif 211 212 for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) 285 213 { 286 214 uhInterDirNeighbours[ui] = 0; 287 215 } 288 216 Int numValidMergeCand = 0; 289 bool isMerged = false; 290 #endif 217 Bool isMerged = false; 291 218 292 219 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); 293 220 pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); 221 #if H_3D_IV_MERGE 222 pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); 223 #endif 294 224 for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) 295 225 { 296 #if !CU_BASED_MRG_CAND_LIST 297 #if H3D_IVMP 298 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 299 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; 300 Int numValidMergeCand = 0; 301 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) 302 #else 303 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists 304 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 305 Int numValidMergeCand = 0; 306 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) 307 #endif 308 { 309 uhInterDirNeighbours[ui] = 0; 310 } 226 #if H_MV_ENC_DEC_TRAC 227 DTRACE_PU_S("=========== prediction_unit ===========\n") 228 // ToDo: 229 //DTRACE_PU("x0", uiLPelX) 230 //DTRACE_PU("x1", uiTPelY) 311 231 #endif 312 232 decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); 313 233 if ( pcCU->getMergeFlag( uiSubPartIdx ) ) 314 234 { 315 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, ePartSize, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth ); 316 #if CU_BASED_MRG_CAND_LIST 235 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 317 236 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 318 237 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) … … 321 240 if ( !isMerged ) 322 241 { 323 pcSubCU->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 242 #if H_3D_VSP 243 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 244 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 245 #if MTK_VSP_FIX_ALIGN_WD_E0172 246 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 247 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); 248 #else 249 #if MTK_VSP_FIX_E0172 250 Int vspDir[MRG_MAX_NUM_CANDS_MEM]; 251 memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 252 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, vspDir, numValidMergeCand ); 253 pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 254 #else 255 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand ); 256 #endif 257 #endif//end of MTK_VSP_FIX_ALIGN_WD_E0172 258 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 259 #if MTK_VSP_FIX_ALIGN_WD_E0172 260 if(vspFlag[uiMergeIndex]) 261 { 262 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth); 263 } 264 #endif 265 #else 266 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 267 #endif 324 268 isMerged = true; 325 269 } … … 328 272 else 329 273 { 330 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 331 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 332 } 274 uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); // Redundant line 275 #if H_3D_VSP 276 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 277 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 278 #if MTK_VSP_FIX_ALIGN_WD_E0172 279 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 280 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex ); 333 281 #else 334 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 335 #if MERL_VSP_C0152 336 #if LGE_VSP_INHERIT_D0092 337 Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM]; 338 for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) 339 { 340 iVSPIndexTrue[i] = 0; 341 } 282 #if MTK_VSP_FIX_E0172 283 Int vspDir[MRG_MAX_NUM_CANDS_MEM]; 284 memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 285 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, vspDir,numValidMergeCand, uiMergeIndex ); 286 pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 342 287 #else 343 Int iVSPIndexTrue[3] = {-1, -1, -1}; 344 #endif 345 #if MERL_VSP_NBDV_RefVId_Fix_D0166 346 Int iVSPDirTrue[3] = {-1, -1, -1}; 347 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue, uiMergeIndex ); 288 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex ); 289 #endif 290 #endif//end of MTK_VSP_FIX_ALIGN_WD_E0172 291 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 292 #if MTK_VSP_FIX_ALIGN_WD_E0172 293 if(vspFlag[uiMergeIndex]) 294 { 295 pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth); 296 } 297 #endif 348 298 #else 349 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); 350 #endif 351 #if HHI_MPI 352 if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used 353 { 354 TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); 355 UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 356 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 357 { 358 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui ); 359 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 360 #if MERL_VSP_NBDV_RefVId_Fix_D0166 361 Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui ); 362 pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir); 363 #endif 364 } 365 } 366 else // MPI not used 367 #endif 368 #if MTK_D0156 369 if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() ) 370 { 371 pcCU->setVSPIndexSubParts( 0, uiSubPartIdx, uiPartIdx, uiDepth ); 372 } 373 else 374 #endif 375 { 376 Int iVSPIdx = 0; 377 #if LGE_VSP_INHERIT_D0092 378 if (iVSPIndexTrue[uiMergeIndex] == 1) 379 { 380 iVSPIdx = 1; 381 } 382 #else 383 Int numVspIdx; 384 numVspIdx = 3; 385 for (Int i = 0; i < numVspIdx; i++) 386 { 387 if (iVSPIndexTrue[i] == uiMergeIndex) 388 { 389 iVSPIdx = i+1; 390 break; 391 } 392 } 393 #endif 394 pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth ); // Initialize 395 #if MERL_VSP_NBDV_RefVId_Fix_D0166 396 pcCU->setVSPDirSubParts( 0, uiSubPartIdx, uiPartIdx, uiDepth ); // Initialize 397 #endif 398 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 399 if(iVSPIdx != 0) 400 { 401 Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 402 cMvFieldNeighbours[ 2*uiMergeIndex].setRefIdx(iIVCIdx); 403 } 404 #endif 405 } 406 407 #else 408 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 409 #endif 410 #endif 299 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 300 #endif 301 } 411 302 pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 412 303 … … 420 311 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 421 312 pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); 422 423 313 } 424 314 } … … 437 327 } 438 328 } 329 #if MTK_VSP_FIX_E0172 || MTK_VSP_FIX_ALIGN_WD_E0172 330 if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false)) 331 #else 332 if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) 333 #endif 334 { 335 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); 336 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); 337 pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth); 338 } 439 339 } 440 340 return; … … 458 358 else 459 359 { 460 m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx , uiDepth);360 m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx ); 461 361 } 462 362 … … 466 366 Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) 467 367 { 468 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getInterDir( uiAbsPartIdx ) != 3) 469 { 470 if(eRefList == REF_PIC_LIST_1) 471 { 472 return; 473 } 474 475 Int iRefFrmIdx = 0; 476 Int iRefFrmIdxTemp; 477 UInt uiInterDir; 478 RefPicList eRefListTemp; 479 480 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 481 482 if ( pcCU->getSlice()->getNumRefIdx ( REF_PIC_LIST_C ) > 1 ) 483 { 484 m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, uiAbsPartIdx, uiDepth, REF_PIC_LIST_C ); 485 } 486 else 487 { 488 iRefFrmIdx=0; 489 } 490 uiInterDir = pcCU->getSlice()->getListIdFromIdxOfLC(iRefFrmIdx) + 1; 491 iRefFrmIdxTemp = pcCU->getSlice()->getRefIdxFromIdxOfLC(iRefFrmIdx); 492 eRefListTemp = (RefPicList)pcCU->getSlice()->getListIdFromIdxOfLC(iRefFrmIdx); 493 494 pcCU->getCUMvField( eRefListTemp )->setAllRefIdx( iRefFrmIdxTemp, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); 495 496 pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); 368 Int iRefFrmIdx = 0; 369 Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ); 370 371 if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx ) 372 { 373 m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, eRefList ); 374 } 375 else if ( !iParseRefFrmIdx ) 376 { 377 iRefFrmIdx = NOT_VALID; 497 378 } 498 379 else 499 380 { 500 Int iRefFrmIdx = 0; 501 Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ); 502 503 if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx ) 504 { 505 m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, uiAbsPartIdx, uiDepth, eRefList ); 506 } 507 else if ( !iParseRefFrmIdx ) 508 { 509 iRefFrmIdx = NOT_VALID; 510 } 511 else 512 { 513 iRefFrmIdx = 0; 514 } 515 516 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 517 pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); 518 } 381 iRefFrmIdx = 0; 382 } 383 384 PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); 385 pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); 519 386 } 520 387 … … 549 416 cMv = cZeroMv; 550 417 551 if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) 552 { 553 #if H3D_IVMP 554 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 555 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 556 #else 557 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcSubCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 558 #endif 559 m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx, iNumAMVPCands ); 560 #else 418 if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) 419 { 561 420 m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); 562 #endif 563 } 564 #if H3D_IVMP 565 pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo, iMVPIdx); 566 #else 421 #if H_MV_ENC_DEC_TRAC 422 #if ENC_DEC_TRACE 423 if ( eRefList == REF_PIC_LIST_0 ) 424 { 425 DTRACE_PU("mvp_l0_flag", iMVPIdx) 426 } 427 else 428 { 429 DTRACE_PU("mvp_l1_flag", iMVPIdx) 430 } 431 #endif 432 #endif 433 } 567 434 pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); 568 #endif569 435 pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); 570 436 pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); 571 437 if ( iRefIdx >= 0 ) 572 438 { 573 m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, iRefIdx,cMv);439 m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); 574 440 cMv += pcSubCUMvField->getMvd( uiPartAddr ); 575 441 } … … 579 445 } 580 446 581 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP)447 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP) 582 448 { 583 449 UInt uiSubdiv; … … 620 486 { 621 487 assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); 622 m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, uiDepth);488 m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); 623 489 } 624 490 625 491 const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx ); 626 627 if( uiLog2TrafoSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) 628 { 629 const Bool bFirstCbfOfCU = uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() || uiTrDepth == 0; 492 { 493 const Bool bFirstCbfOfCU = uiTrDepth == 0; 630 494 if( bFirstCbfOfCU ) 631 495 { … … 637 501 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) 638 502 { 639 if ( uiInnerQuadIdx == 3 && uiUCbfFront3 == 0 && uiLog2TrafoSize < pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) 640 { 641 uiUCbfFront3++; 642 pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); 643 //printf( " \nsave bits, U Cbf"); 644 } 645 else 646 { 647 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); 648 uiUCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth ); 649 } 503 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); 650 504 } 651 505 if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) 652 506 { 653 if ( uiInnerQuadIdx == 3 && uiVCbfFront3 == 0 && uiLog2TrafoSize < pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) 654 { 655 uiVCbfFront3++; 656 pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); 657 //printf( " \nsave bits, V Cbf"); 658 } 659 else 660 { 661 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); 662 uiVCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth ); 663 } 507 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); 664 508 } 665 509 } … … 668 512 pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); 669 513 pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); 670 if ( uiLog2TrafoSize == 2 )671 {672 uiUCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth );673 uiVCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth );674 }675 514 } 676 515 } … … 686 525 const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 687 526 const UInt uiStartAbsPartIdx = uiAbsPartIdx; 688 UInt uiLumaTrMode, uiChromaTrMode;689 pcCU->convertTransIdx( uiStartAbsPartIdx, uiTrDepth+1, uiLumaTrMode, uiChromaTrMode );690 527 UInt uiYCbf = 0; 691 528 UInt uiUCbf = 0; 692 529 UInt uiVCbf = 0; 693 530 694 UInt uiCurrentCbfY = 0;695 UInt uiCurrentCbfU = 0;696 UInt uiCurrentCbfV = 0;697 698 531 for( Int i = 0; i < 4; i++ ) 699 532 { 700 UInt nsAddr = 0; 701 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 ); 702 xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP ); 703 uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode ); 704 uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode ); 705 uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode ); 533 xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP ); 534 uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth+1 ); 535 uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth+1 ); 536 uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth+1 ); 706 537 uiAbsPartIdx += uiQPartNum; 707 538 offsetLuma += size; offsetChroma += (size>>2); 708 539 } 709 540 710 uiYCbfFront3 += uiCurrentCbfY;711 uiUCbfFront3 += uiCurrentCbfU;712 uiVCbfFront3 += uiCurrentCbfV;713 714 pcCU->convertTransIdx( uiStartAbsPartIdx, uiTrDepth, uiLumaTrMode, uiChromaTrMode );715 541 for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) 716 542 { 717 pcCU->getCbf( TEXT_LUMA )[uiStartAbsPartIdx + ui] |= uiYCbf << ui LumaTrMode;718 pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << ui ChromaTrMode;719 pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << ui ChromaTrMode;543 pcCU->getCbf( TEXT_LUMA )[uiStartAbsPartIdx + ui] |= uiYCbf << uiTrDepth; 544 pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << uiTrDepth; 545 pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << uiTrDepth; 720 546 } 721 547 } … … 725 551 pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); 726 552 553 #if !H_MV_ENC_DEC_TRAC 727 554 { 728 555 DTRACE_CABAC_VL( g_nSymbolCounter++ ); … … 735 562 DTRACE_CABAC_T( "\n" ); 736 563 } 564 #endif 737 565 738 UInt uiLumaTrMode, uiChromaTrMode;739 pcCU->convertTransIdx( uiAbsPartIdx, uiTrDepth, uiLumaTrMode, uiChromaTrMode );740 if(pcCU->getPredictionMode( uiAbsPartIdx ) == MODE_INTER && pcCU->useNonSquarePU( uiAbsPartIdx ) )741 {742 pcCU->setNSQTIdxSubParts( uiLog2TrafoSize, uiAbsPartIdx, absTUPartIdx, uiLumaTrMode );743 }744 566 pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth ); 745 567 if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) 746 568 { 747 pcCU->setCbfSubParts( 1 << ui LumaTrMode, TEXT_LUMA, uiAbsPartIdx, uiDepth );569 pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth ); 748 570 } 749 571 else 750 572 { 751 const UInt uiLog2CUSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - pcCU->getDepth( uiAbsPartIdx ); 752 if ( pcCU->getPredictionMode( uiAbsPartIdx ) != MODE_INTRA && uiInnerQuadIdx == 3 && uiYCbfFront3 == 0 && uiUCbfFront3 == 0 && uiVCbfFront3 == 0 753 && ( uiLog2CUSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() + 1 || uiLog2TrafoSize < pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) ) 754 { 755 pcCU->setCbfSubParts( 1 << uiLumaTrMode, TEXT_LUMA, uiAbsPartIdx, uiDepth ); 756 //printf( " \nsave bits, Y Cbf"); 757 uiYCbfFront3++; 758 } 759 else 760 { 761 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode, uiDepth ); 762 uiYCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode ); 763 } 764 } 573 m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth ); 574 } 575 576 765 577 // transform_unit begin 766 578 UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); … … 792 604 Int trWidth = width; 793 605 Int trHeight = height; 794 pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );795 606 m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); 796 607 } … … 799 610 Int trWidth = width >> 1; 800 611 Int trHeight = height >> 1; 801 pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );802 612 if( cbfU ) 803 613 { … … 816 626 Int trWidth = width; 817 627 Int trHeight = height; 818 pcCU->getNSQTSize( uiTrIdx - 1, uiAbsPartIdx, trWidth, trHeight );819 628 if( cbfU ) 820 629 { … … 830 639 } 831 640 } 832 833 641 834 642 Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 854 662 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; 855 663 UInt uiChromaOffset = uiLumaOffset>>2; 856 UInt temp = 0;857 UInt temp1 = 0;858 UInt temp2 = 0;859 664 860 #if RWTH_SDC_DLT_B0036861 if( pcCU->getSDC Available(uiAbsPartIdx) && pcCU->getSDCFlag( uiAbsPartIdx ) )665 #if H_3D_DIM_SDC 666 if( pcCU->getSDCFlag( uiAbsPartIdx ) ) 862 667 { 863 668 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); … … 866 671 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 867 672 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 868 #if !PKU_QC_DEPTH_INTRA_UNI_D0195869 decodeSDCResidualData(pcCU, uiAbsPartIdx, uiDepth);870 #endif871 673 return; 872 674 } 873 675 #endif 874 676 677 #if LGE_INTER_SDC_E0156 678 if( pcCU->getInterSDCFlag( uiAbsPartIdx ) ) 679 { 680 assert( !pcCU->isSkipped( uiAbsPartIdx ) ); 681 assert( !pcCU->isIntra( uiAbsPartIdx) ); 682 assert( pcCU->getSlice()->getIsDepth() ); 683 684 decodeInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth ); 685 return; 686 } 687 #endif 688 875 689 if( pcCU->isIntra(uiAbsPartIdx) ) 876 690 { … … 879 693 { 880 694 UInt uiQtRootCbf = 1; 881 #if HHI_MPI882 if( !(pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N &&883 ( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth == pcCU->getTextureModeDepth( uiAbsPartIdx ) ) ) )884 #else885 695 if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) ) 886 #endif 887 { 888 m_pcEntropyDecoderIf->parseQtRootCbf( pcCU, uiAbsPartIdx, uiDepth, uiQtRootCbf ); 696 { 697 m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf ); 889 698 } 890 699 if ( !uiQtRootCbf ) … … 892 701 pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth ); 893 702 pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); 894 pcCU->setNSQTIdxSubParts( uiAbsPartIdx, uiDepth );895 703 return; 896 704 } 897 705 898 706 } 899 900 #if FIX_MPI_B0065 901 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER && pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getMergeIndex( uiAbsPartIdx ) == 0 && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ) 902 { 903 TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); 904 if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx)) 905 { 906 PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx); 907 pcCU->setPartSizeSubParts( partSize, uiAbsPartIdx, uiDepth ); 908 } 909 else 910 { 911 pcCU->setPartSizeSubParts( SIZE_NxN, uiAbsPartIdx, uiDepth ); 912 } 913 } 914 #endif 915 916 xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP ); 917 918 #if FIX_MPI_B0065 919 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER && pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getMergeIndex( uiAbsPartIdx ) == 0 && pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N && pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ) 920 { 921 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 922 } 923 #endif 924 } 925 926 #if RWTH_SDC_DLT_B0036 927 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 928 Void TDecEntropy::decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 929 { 930 assert( pcCU->getSlice()->getSPS()->isDepth() ); 931 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 932 933 m_pcEntropyDecoderIf->parseSDCPredMode(pcCU, uiAbsPartIdx, uiDepth ); 934 } 935 936 Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 937 { 938 assert( pcCU->getSlice()->getSPS()->isDepth() ); 939 940 m_pcEntropyDecoderIf->parseSDCFlag(pcCU, uiAbsPartIdx, uiDepth ); 941 } 942 #endif 943 Void TDecEntropy::decodeSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 944 { 945 assert( pcCU->getSlice()->getSPS()->isDepth() ); 946 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 947 948 // number of segments depends on prediction mode for INTRA 949 UInt uiNumSegments = 2; 950 UInt uiLumaPredMode = pcCU->getLumaIntraDir( uiAbsPartIdx ); 951 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && (uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX) ) 952 uiNumSegments = 1; 953 707 xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP ); 708 } 709 710 #if LGE_INTER_SDC_E0156 711 Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 712 { 713 pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth); 714 715 if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) 716 { 717 return; 718 } 719 720 if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) ) 721 { 722 return; 723 } 724 725 m_pcEntropyDecoderIf->parseInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); 726 } 727 728 Void TDecEntropy::decodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 729 { 730 if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) 731 { 732 return; 733 } 734 735 if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || !pcCU->getInterSDCFlag( uiAbsPartIdx ) ) 736 { 737 return; 738 } 739 740 UInt uiNumSegments = ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ? 1 : ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 ); 741 954 742 // decode residual data for each segment 955 743 for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ ) 956 m_pcEntropyDecoderIf->parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg); 744 { 745 m_pcEntropyDecoderIf->parseInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth, uiSeg ); 746 } 957 747 } 958 748 #endif -
trunk/source/Lib/TLibDecoder/TDecEntropy.h
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 44 44 #include "../TLibCommon/TComPic.h" 45 45 #include "../TLibCommon/TComPrediction.h" 46 #include "../TLibCommon/TComAdaptiveLoopFilter.h"47 46 #include "../TLibCommon/TComSampleAdaptiveOffset.h" 48 47 49 48 class TDecSbac; 50 49 class TDecCavlc; 51 class SEImessages;52 50 class ParameterSetManagerDecoder; 53 51 … … 67 65 virtual Void setBitstream ( TComInputBitstream* p ) = 0; 68 66 69 virtual Void decodeFlush() = 0;70 71 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B004672 67 virtual Void parseVPS ( TComVPS* pcVPS ) = 0; 73 #endif 74 #if HHI_MPI || H3D_QTL 75 virtual Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ) = 0; 68 #if H_3D 69 virtual Void parseSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) = 0; 76 70 #else 77 71 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 78 72 #endif 79 virtual Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet ) = 0; 80 virtual Void parseAPS ( TComAPS* pAPS ) = 0; 81 virtual void parseSEI(SEImessages&) = 0; 73 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 82 74 83 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 84 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) = 0; 85 #else 86 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) = 0; 87 #endif 75 virtual Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) = 0; 88 76 89 77 virtual Void parseTerminatingBit ( UInt& ruilsLast ) = 0; 90 78 91 #if H3D_IVMP92 virtual Void parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands ) = 0;93 #else94 79 virtual Void parseMVPIdx ( Int& riMVPIdx ) = 0; 95 #endif96 80 97 81 public: 98 82 virtual Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 99 #if LGE_ILLUCOMP_B0045 83 virtual Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 84 virtual Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 85 virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; 86 virtual Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) = 0; 87 #if H_3D_ARP 88 virtual Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 89 #endif 90 #if H_3D_IC 100 91 virtual Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 101 92 #endif 102 virtual Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 103 virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; 104 virtual Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 105 #if H3D_IVRP 106 virtual Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 107 #endif 108 #if QC_ARP_D0177 109 virtual Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 93 #if LGE_INTER_SDC_E0156 94 virtual Void parseInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 95 virtual Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0; 110 96 #endif 111 97 virtual Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 116 102 virtual Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 117 103 118 virtual Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx , UInt uiDepth) = 0;119 virtual Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth,RefPicList eRefList ) = 0;104 virtual Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ) = 0; 105 virtual Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ) = 0; 120 106 virtual Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartAddr, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ) = 0; 121 107 122 108 virtual Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ) = 0; 123 109 virtual Void parseQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) = 0; 124 virtual Void parseQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ) = 0;110 virtual Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf ) = 0; 125 111 126 112 virtual Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 129 115 130 116 virtual Void parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) = 0; 131 132 /// set slice granularity 133 virtual Void setSliceGranularity(Int iSliceGranularity) = 0; 134 135 /// get slice granularity 136 virtual Int getSliceGranularity() = 0; 137 138 virtual Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ) = 0; 117 virtual Void parseTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType) = 0; 139 118 virtual Void updateContextTables( SliceType eSliceType, Int iQp ) = 0; 140 141 #if RWTH_SDC_DLT_B0036142 #if !PKU_QC_DEPTH_INTRA_UNI_D0195143 virtual Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;144 virtual Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;145 #endif146 virtual Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0;147 #endif148 119 149 120 virtual ~TDecEntropyIf() {} … … 171 142 Void setBitstream ( TComInputBitstream* p ) { m_pcEntropyDecoderIf->setBitstream(p); } 172 143 Void resetEntropy ( TComSlice* p) { m_pcEntropyDecoderIf->resetEntropy(p); } 173 174 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046175 144 Void decodeVPS ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); } 176 #endif 177 178 #if HHI_MPI || H3D_QTL 179 Void decodeSPS ( TComSPS* pcSPS, Bool bIsDepth ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, bIsDepth); } 145 #if H_3D 146 Void decodeSPS ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, viewIndex, depthFlag ); } 180 147 #else 181 148 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 182 149 #endif 183 Void decodePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet ) { m_pcEntropyDecoderIf->parsePPS(pcPPS, parameterSet); } 184 Void decodeAPS ( TComAPS* pAPS ) { m_pcEntropyDecoderIf->parseAPS(pAPS);} 185 void decodeSEI(SEImessages& seis) { m_pcEntropyDecoderIf->parseSEI(seis); } 186 187 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 188 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet, isDepth); } 189 #else 190 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet); } 191 #endif 150 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 151 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager); } 192 152 193 153 Void decodeTerminatingBit ( UInt& ruiIsLast ) { m_pcEntropyDecoderIf->parseTerminatingBit(ruiIsLast); } … … 198 158 Void decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 199 159 Void decodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 200 #if LGE_ILLUCOMP_B0045 201 Void decodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 202 #endif 160 Void decodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 203 161 Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 204 Void decodeMergeIndex ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth ); 205 #if QC_ARP_D0177 206 Void decodeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ); 207 #endif 162 Void decodeMergeIndex ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, UInt uiDepth ); 208 163 Void decodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 209 164 Void decodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 210 165 166 #if H_3D_ARP 167 Void decodeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 168 #endif 169 #if H_3D_IC 170 Void decodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 171 #endif 172 #if LGE_INTER_SDC_E0156 173 Void decodeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 174 Void decodeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 175 #endif 211 176 Void decodeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 212 177 … … 218 183 Void decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 219 184 220 Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ) { m_pcEntropyDecoderIf->readTileMarker( uiTileIdx, uiBitsUsed ); }221 185 Void updateContextTables ( SliceType eSliceType, Int iQp ) { m_pcEntropyDecoderIf->updateContextTables( eSliceType, iQp ); } 222 186 223 187 224 188 private: 225 Void xDecodeTransform ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP );189 Void xDecodeTransform ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP ); 226 190 227 191 public: 228 192 Void decodeCoeff ( TComDataCU* pcCU , UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP ); 229 193 230 // ALF-related231 232 /// set slice granularity233 Void setSliceGranularity (Int iSliceGranularity) {m_pcEntropyDecoderIf->setSliceGranularity(iSliceGranularity);}234 235 #if !LGE_SAO_MIGRATION_D0091236 Void decodeSaoParam (SAOParam* saoParam);237 void decodeSaoLcu(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool &repeatedRow );238 Void decodeSaoOneLcu(SaoLcuParam* saoLcuParam);239 #endif240 241 Void decodeFlush() { m_pcEntropyDecoderIf->decodeFlush(); }242 243 #if RWTH_SDC_DLT_B0036244 #if !PKU_QC_DEPTH_INTRA_UNI_D0195245 Void decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );246 Void decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );247 #endif248 Void decodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );249 #endif250 251 194 };// END CLASS DEFINITION TDecEntropy 252 195 -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 36 36 */ 37 37 38 extern bool g_md5_mismatch; ///< top level flag to signal when there is a decode problem39 40 38 #include "TDecGop.h" 41 39 #include "TDecCAVLC.h" … … 48 46 #include <time.h> 49 47 48 extern Bool g_md5_mismatch; ///< top level flag to signal when there is a decode problem 49 50 50 //! \ingroup TLibDecoder 51 51 //! \{ 52 53 static void calcAndPrintMD5Status(TComPicYuv& pic, const SEImessages* seis); 54 52 static void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI); 55 53 // ==================================================================================================================== 56 54 // Constructor / destructor / initialization / destroy … … 59 57 TDecGop::TDecGop() 60 58 { 61 m_iGopSize = 0;62 59 m_dDecTime = 0; 63 60 m_pcSbacDecoders = NULL; 64 61 m_pcBinCABACs = NULL; 65 m_first = true;66 62 } 67 63 … … 79 75 Void TDecGop::destroy() 80 76 { 81 m_alfParamSetPilot.releaseALFParam();82 77 } 83 78 … … 87 82 TDecCavlc* pcCavlcDecoder, 88 83 TDecSlice* pcSliceDecoder, 89 TComLoopFilter* pcLoopFilter, 90 TComAdaptiveLoopFilter* pcAdaptiveLoopFilter 91 ,TComSampleAdaptiveOffset* pcSAO 92 #if DEPTH_MAP_GENERATION 93 ,TComDepthMapGenerator* pcDepthMapGenerator 94 #endif 95 #if H3D_IVRP & !QC_ARP_D0177 96 ,TComResidualGenerator* pcResidualGenerator 97 #endif 84 TComLoopFilter* pcLoopFilter, 85 TComSampleAdaptiveOffset* pcSAO 98 86 ) 99 87 { … … 104 92 m_pcSliceDecoder = pcSliceDecoder; 105 93 m_pcLoopFilter = pcLoopFilter; 106 m_pcAdaptiveLoopFilter = pcAdaptiveLoopFilter;107 94 m_pcSAO = pcSAO; 108 #if DEPTH_MAP_GENERATION109 m_pcDepthMapGenerator = pcDepthMapGenerator;110 #endif111 #if H3D_IVRP & !QC_ARP_D0177112 m_pcResidualGenerator = pcResidualGenerator;113 #endif114 95 } 115 96 … … 118 99 // Private member functions 119 100 // ==================================================================================================================== 120 Void TDecGop::patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr)121 {122 Int numLCUInWidth = alfParamSet->numLCUInWidth;123 Int numLCU = alfParamSet->numLCU;124 125 Int rx, ry, pos, posUp;126 std::vector<ALFParam*> storedFilters[NUM_ALF_COMPONENT];127 storedFilters[ALF_Y].clear();128 storedFilters[ALF_Cb].clear();129 storedFilters[ALF_Cr].clear();130 131 for(Int i=0; i< numLCU; i++)132 {133 rx = (i+ firstLCUAddr)% numLCUInWidth;134 ry = (i+ firstLCUAddr)/ numLCUInWidth;135 pos = (ry*numLCUInWidth) + rx;136 posUp = pos-numLCUInWidth;137 138 for(Int compIdx =0; compIdx < NUM_ALF_COMPONENT; compIdx++)139 {140 AlfUnitParam& alfUnitParam = alfParamSet->alfUnitParam[compIdx][i];141 ALFParam& alfFiltParam = *(alfLCUParam[compIdx][pos]);142 143 switch( alfUnitParam.mergeType )144 {145 case ALF_MERGE_DISABLED:146 {147 if(alfUnitParam.isEnabled)148 {149 if(alfUnitParam.isNewFilt)150 {151 alfFiltParam = *alfUnitParam.alfFiltParam;152 storedFilters[compIdx].push_back( &alfFiltParam );153 }154 else //stored filter155 {156 alfFiltParam = *(storedFilters[compIdx][alfUnitParam.storedFiltIdx]);157 assert(alfFiltParam.alf_flag == 1);158 }159 }160 else161 {162 alfFiltParam.alf_flag = 0;163 }164 }165 break;166 case ALF_MERGE_UP:167 {168 assert(posUp >= 0);169 alfFiltParam = *(alfLCUParam[compIdx][posUp]);170 }171 break;172 case ALF_MERGE_LEFT:173 {174 assert(pos-1 >= 0);175 alfFiltParam = *(alfLCUParam[compIdx][pos-1]);176 }177 break;178 case ALF_MERGE_FIRST:179 {180 alfFiltParam = *(alfLCUParam[compIdx][firstLCUAddr]);181 }182 break;183 default:184 {185 printf("not a supported ALF merge type\n");186 assert(0);187 exit(-1);188 }189 }190 } //compIdx191 } //i (LCU)192 }193 194 101 // ==================================================================================================================== 195 102 // Public member functions 196 103 // ==================================================================================================================== 197 104 198 Void TDecGop::decompress Gop(TComInputBitstream* pcBitstream, TComPic*& rpcPic, Bool bExecuteDeblockAndAlf)105 Void TDecGop::decompressSlice(TComInputBitstream* pcBitstream, TComPic*& rpcPic) 199 106 { 200 107 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx()); … … 206 113 long iBeforeTime = clock(); 207 114 208 UInt uiStartCUAddr = pcSlice->getEntropySliceCurStartCUAddr(); 209 210 if (!bExecuteDeblockAndAlf) 211 { 212 if(m_first) 213 { 214 m_uiILSliceCount = 0; 215 m_puiILSliceStartLCU = new UInt[(rpcPic->getNumCUsInFrame()* rpcPic->getNumPartInCU()) +1]; 216 m_first = false; 217 } 218 219 UInt uiSliceStartCuAddr = pcSlice->getSliceCurStartCUAddr(); 220 if(uiSliceStartCuAddr == uiStartCUAddr) 221 { 222 m_puiILSliceStartLCU[m_uiILSliceCount] = uiSliceStartCuAddr; 223 m_uiILSliceCount++; 224 } 225 226 m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC ); 227 m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder); 228 229 UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 230 231 //init each couple {EntropyDecoder, Substream} 232 UInt *puiSubstreamSizes = pcSlice->getSubstreamSizes(); 233 ppcSubstreams = new TComInputBitstream*[uiNumSubstreams]; 234 m_pcSbacDecoders = new TDecSbac[uiNumSubstreams]; 235 m_pcBinCABACs = new TDecBinCABAC[uiNumSubstreams]; 236 UInt uiBitsRead = pcBitstream->getByteLocation()<<3; 237 for ( UInt ui = 0 ; ui < uiNumSubstreams ; ui++ ) 238 { 239 m_pcSbacDecoders[ui].init(&m_pcBinCABACs[ui]); 240 UInt uiSubstreamSizeBits = (ui+1 < uiNumSubstreams ? puiSubstreamSizes[ui] : pcBitstream->getNumBitsLeft()); 241 ppcSubstreams[ui] = pcBitstream->extractSubstream(ui+1 < uiNumSubstreams ? puiSubstreamSizes[ui] : pcBitstream->getNumBitsLeft()); 242 // update location information from where tile markers were extracted 243 { 244 UInt uiDestIdx = 0; 245 for (UInt uiSrcIdx = 0; uiSrcIdx<pcBitstream->getTileMarkerLocationCount(); uiSrcIdx++) 246 { 247 UInt uiLocation = pcBitstream->getTileMarkerLocation(uiSrcIdx); 248 if ((uiBitsRead>>3)<=uiLocation && uiLocation<((uiBitsRead+uiSubstreamSizeBits)>>3)) 249 { 250 ppcSubstreams[ui]->setTileMarkerLocation( uiDestIdx, uiLocation - (uiBitsRead>>3) ); 251 ppcSubstreams[ui]->setTileMarkerLocationCount( uiDestIdx+1 ); 252 uiDestIdx++; 253 } 254 } 255 ppcSubstreams[ui]->setTileMarkerLocationCount( uiDestIdx ); 256 uiBitsRead += uiSubstreamSizeBits; 257 } 258 } 259 260 for ( UInt ui = 0 ; ui+1 < uiNumSubstreams; ui++ ) 261 { 262 m_pcEntropyDecoder->setEntropyDecoder ( &m_pcSbacDecoders[uiNumSubstreams - 1 - ui] ); 263 m_pcEntropyDecoder->setBitstream ( ppcSubstreams [uiNumSubstreams - 1 - ui] ); 264 m_pcEntropyDecoder->resetEntropy (pcSlice); 265 } 266 267 m_pcEntropyDecoder->setEntropyDecoder ( m_pcSbacDecoder ); 268 m_pcEntropyDecoder->setBitstream ( ppcSubstreams[0] ); 115 UInt uiStartCUAddr = pcSlice->getSliceSegmentCurStartCUAddr(); 116 117 UInt uiSliceStartCuAddr = pcSlice->getSliceCurStartCUAddr(); 118 if(uiSliceStartCuAddr == uiStartCUAddr) 119 { 120 m_sliceStartCUAddress.push_back(uiSliceStartCuAddr); 121 } 122 123 m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC ); 124 m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder); 125 126 UInt uiNumSubstreams = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ? pcSlice->getNumEntryPointOffsets()+1 : pcSlice->getPPS()->getNumSubstreams(); 127 128 // init each couple {EntropyDecoder, Substream} 129 UInt *puiSubstreamSizes = pcSlice->getSubstreamSizes(); 130 ppcSubstreams = new TComInputBitstream*[uiNumSubstreams]; 131 m_pcSbacDecoders = new TDecSbac[uiNumSubstreams]; 132 m_pcBinCABACs = new TDecBinCABAC[uiNumSubstreams]; 133 for ( UInt ui = 0 ; ui < uiNumSubstreams ; ui++ ) 134 { 135 m_pcSbacDecoders[ui].init(&m_pcBinCABACs[ui]); 136 ppcSubstreams[ui] = pcBitstream->extractSubstream(ui+1 < uiNumSubstreams ? puiSubstreamSizes[ui] : pcBitstream->getNumBitsLeft()); 137 } 138 139 for ( UInt ui = 0 ; ui+1 < uiNumSubstreams; ui++ ) 140 { 141 m_pcEntropyDecoder->setEntropyDecoder ( &m_pcSbacDecoders[uiNumSubstreams - 1 - ui] ); 142 m_pcEntropyDecoder->setBitstream ( ppcSubstreams [uiNumSubstreams - 1 - ui] ); 269 143 m_pcEntropyDecoder->resetEntropy (pcSlice); 270 271 if(uiSliceStartCuAddr == uiStartCUAddr) 272 { 273 if(pcSlice->getSPS()->getUseALF()) 274 { 275 if(pcSlice->getAlfEnabledFlag()) 276 { 277 if(pcSlice->getSPS()->getUseALFCoefInSlice()) 278 { 279 Int numSUinLCU = 1<< (g_uiMaxCUDepth << 1); 280 Int firstLCUAddr = pcSlice->getSliceCurStartCUAddr() / numSUinLCU; 281 patchAlfLCUParams(m_pcAdaptiveLoopFilter->getAlfLCUParam(), &m_alfParamSetPilot, firstLCUAddr); 282 } 283 284 if( !pcSlice->getSPS()->getUseALFCoefInSlice()) 285 { 286 m_vAlfCUCtrlSlices.push_back(m_cAlfCUCtrlOneSlice); 287 } 288 } 289 } 290 } 291 292 #if DEPTH_MAP_GENERATION 293 // init view component and predict virtual depth map 294 if( uiStartCUAddr == 0 ) 295 { 296 m_pcDepthMapGenerator->initViewComponent( rpcPic ); 297 #if !H3D_NBDV 298 m_pcDepthMapGenerator->predictDepthMap ( rpcPic ); 299 #endif 300 #if H3D_IVRP & !QC_ARP_D0177 301 m_pcResidualGenerator->initViewComponent( rpcPic ); 302 #endif 303 } 304 #endif 305 306 #if H3D_NBDV 307 if(pcSlice->getViewId() && pcSlice->getSPS()->getMultiviewMvPredMode()) 308 { 309 Int iColPoc = pcSlice->getRefPOC(RefPicList(pcSlice->getColDir()), pcSlice->getColRefIdx()); 310 rpcPic->setRapbCheck(rpcPic->getDisCandRefPictures(iColPoc)); 311 } 312 #endif 313 314 m_pcSbacDecoders[0].load(m_pcSbacDecoder); 315 m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders); 316 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiNumSubstreams-1] ); 317 if ( uiNumSubstreams > 1 ) 318 { 319 // deallocate all created substreams, including internal buffers. 320 for (UInt ui = 0; ui < uiNumSubstreams; ui++) 321 { 322 ppcSubstreams[ui]->deleteFifo(); 323 delete ppcSubstreams[ui]; 324 } 325 delete[] ppcSubstreams; 326 delete[] m_pcSbacDecoders; m_pcSbacDecoders = NULL; 327 delete[] m_pcBinCABACs; m_pcBinCABACs = NULL; 328 } 329 m_dDecTime += (double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; 330 } 331 else 332 { 333 #if H3D_IVRP & !QC_ARP_D0177 334 // set residual picture 335 m_pcResidualGenerator->setRecResidualPic( rpcPic ); 336 #endif 337 #if DEPTH_MAP_GENERATION 338 #if !H3D_NBDV 339 // update virtual depth map 340 m_pcDepthMapGenerator->updateDepthMap( rpcPic ); 341 #endif 342 #endif 343 // deblocking filter 344 Bool bLFCrossTileBoundary = (pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)? 345 (pcSlice->getPPS()->getLFCrossTileBoundaryFlag()):(pcSlice->getPPS()->getSPS()->getLFCrossTileBoundaryFlag()); 346 if (pcSlice->getPPS()->getDeblockingFilterControlPresent()) 347 { 348 if(pcSlice->getSPS()->getUseDF()) 349 { 350 if(pcSlice->getInheritDblParamFromAPS()) 351 { 352 pcSlice->setLoopFilterDisable(pcSlice->getAPS()->getLoopFilterDisable()); 353 if (!pcSlice->getLoopFilterDisable()) 354 { 355 pcSlice->setLoopFilterBetaOffset(pcSlice->getAPS()->getLoopFilterBetaOffset()); 356 pcSlice->setLoopFilterTcOffset(pcSlice->getAPS()->getLoopFilterTcOffset()); 357 } 358 } 359 } 360 } 361 m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary); 362 m_pcLoopFilter->loopFilterPic( rpcPic ); 363 364 pcSlice = rpcPic->getSlice(0); 365 if(pcSlice->getSPS()->getUseSAO() || pcSlice->getSPS()->getUseALF()) 366 { 367 Int sliceGranularity = pcSlice->getPPS()->getSliceGranularity(); 368 m_puiILSliceStartLCU[m_uiILSliceCount] = rpcPic->getNumCUsInFrame()* rpcPic->getNumPartInCU(); 369 rpcPic->createNonDBFilterInfo(m_puiILSliceStartLCU, m_uiILSliceCount,sliceGranularity,pcSlice->getSPS()->getLFCrossSliceBoundaryFlag(),rpcPic->getPicSym()->getNumTiles() ,bLFCrossTileBoundary); 370 } 371 372 if( pcSlice->getSPS()->getUseSAO() ) 373 { 374 #if LGE_SAO_MIGRATION_D0091 375 if(pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) 376 { 377 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam(); 378 saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 379 saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma(); 380 m_pcSAO->setSaoLcuBasedOptimization(1); 381 m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount); 382 m_pcSAO->SAOProcess(rpcPic, saoParam); 383 m_pcSAO->PCMLFDisableProcess(rpcPic); 384 m_pcSAO->destroyPicSaoInfo(); 385 } 144 } 145 146 m_pcEntropyDecoder->setEntropyDecoder ( m_pcSbacDecoder ); 147 m_pcEntropyDecoder->setBitstream ( ppcSubstreams[0] ); 148 m_pcEntropyDecoder->resetEntropy (pcSlice); 149 150 if(uiSliceStartCuAddr == uiStartCUAddr) 151 { 152 m_LFCrossSliceBoundaryFlag.push_back( pcSlice->getLFCrossSliceBoundaryFlag()); 153 } 154 #if H_3D_NBDV 155 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. 156 { 157 Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx()); 158 rpcPic->setNumDdvCandPics(rpcPic->getDisCandRefPictures(iColPoc)); 159 } 160 #endif 161 #if MTK_NBDV_TN_FIX_E0172 162 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. 163 { 164 rpcPic->checkTemporalIVRef(); 165 } 166 #endif 167 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182 168 if(pcSlice->getIsDepth()) 169 { 170 rpcPic->checkTextureRef(); 171 } 172 #endif 173 #if H_3D 174 pcSlice->setDepthToDisparityLUTs(); 175 #endif 176 m_pcSbacDecoders[0].load(m_pcSbacDecoder); 177 m_pcSliceDecoder->decompressSlice( ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders); 178 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiNumSubstreams-1] ); 179 // deallocate all created substreams, including internal buffers. 180 for (UInt ui = 0; ui < uiNumSubstreams; ui++) 181 { 182 ppcSubstreams[ui]->deleteFifo(); 183 delete ppcSubstreams[ui]; 184 } 185 delete[] ppcSubstreams; 186 delete[] m_pcSbacDecoders; m_pcSbacDecoders = NULL; 187 delete[] m_pcBinCABACs; m_pcBinCABACs = NULL; 188 189 m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; 190 } 191 192 Void TDecGop::filterPicture(TComPic*& rpcPic) 193 { 194 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx()); 195 196 //-- For time output for each slice 197 long iBeforeTime = clock(); 198 199 // deblocking filter 200 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 201 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 202 m_pcLoopFilter->loopFilterPic( rpcPic ); 203 204 if(pcSlice->getSPS()->getUseSAO()) 205 { 206 m_sliceStartCUAddress.push_back(rpcPic->getNumCUsInFrame()* rpcPic->getNumPartInCU()); 207 rpcPic->createNonDBFilterInfo(m_sliceStartCUAddress, 0, &m_LFCrossSliceBoundaryFlag, rpcPic->getPicSym()->getNumTiles(), bLFCrossTileBoundary); 208 } 209 210 if( pcSlice->getSPS()->getUseSAO() ) 211 { 212 { 213 SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam(); 214 saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 215 saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma(); 216 m_pcSAO->setSaoLcuBasedOptimization(1); 217 m_pcSAO->createPicSaoInfo(rpcPic); 218 m_pcSAO->SAOProcess(saoParam); 219 m_pcSAO->PCMLFDisableProcess(rpcPic); 220 m_pcSAO->destroyPicSaoInfo(); 221 } 222 } 223 224 if(pcSlice->getSPS()->getUseSAO()) 225 { 226 rpcPic->destroyNonDBFilterInfo(); 227 } 228 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 229 rpcPic->compressMotion(2); 230 #endif 231 #if !H_3D 232 rpcPic->compressMotion(); 233 #endif 234 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 235 if (!pcSlice->isReferenced()) c += 32; 236 237 //-- For time output for each slice 238 #if H_MV 239 printf("\nLayer %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(), 240 pcSlice->getPOC(), 241 pcSlice->getTLayer(), 242 c, 243 pcSlice->getSliceQp() ); 386 244 #else 387 if(pcSlice->getSaoEnabledFlag()) 388 { 389 if (pcSlice->getSaoInterleavingFlag()) 390 { 391 pcSlice->getAPS()->setSaoInterleavingFlag(pcSlice->getSaoInterleavingFlag()); 392 pcSlice->getAPS()->setSaoEnabled(pcSlice->getSaoEnabledFlag()); 393 pcSlice->getAPS()->getSaoParam()->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 394 pcSlice->getAPS()->getSaoParam()->bSaoFlag[1] = pcSlice->getSaoEnabledFlagCb(); 395 pcSlice->getAPS()->getSaoParam()->bSaoFlag[2] = pcSlice->getSaoEnabledFlagCr(); 396 } 397 m_pcSAO->setSaoInterleavingFlag(pcSlice->getAPS()->getSaoInterleavingFlag()); 398 m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount); 399 m_pcSAO->SAOProcess(rpcPic, pcSlice->getAPS()->getSaoParam()); 400 m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic); 401 m_pcSAO->destroyPicSaoInfo(); 402 } 403 #endif 404 } 405 406 // adaptive loop filter 407 if( pcSlice->getSPS()->getUseALF() ) 408 { 409 if( (pcSlice->getSPS()->getUseALFCoefInSlice())?(true):(pcSlice->getAlfEnabledFlag())) 410 { 411 412 if(!pcSlice->getSPS()->getUseALFCoefInSlice()) 413 { 414 patchAlfLCUParams(m_pcAdaptiveLoopFilter->getAlfLCUParam(), pcSlice->getAPS()->getAlfParam()); 415 } 416 m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount, pcSlice->getSliceQp()); 417 m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, m_vAlfCUCtrlSlices, pcSlice->getSPS()->getUseALFCoefInSlice()); 418 m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic); 419 m_pcAdaptiveLoopFilter->destroyPicAlfInfo(); 420 } 421 m_pcAdaptiveLoopFilter->resetLCUAlfInfo(); //reset all LCU ALFParam->alf_flag = 0 422 } 423 424 if(pcSlice->getSPS()->getUseSAO() || pcSlice->getSPS()->getUseALF()) 425 { 426 rpcPic->destroyNonDBFilterInfo(); 427 } 428 429 // rpcPic->compressMotion(); 430 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 431 if (!pcSlice->isReferenced()) c += 32; 432 433 //-- For time output for each slice 434 printf("\n%s View %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", 435 pcSlice->getIsDepth() ? "Depth " : "Texture", 436 pcSlice->getViewId(), 437 pcSlice->getPOC(), 438 pcSlice->getTLayer(), 439 c, 440 pcSlice->getSliceQp() ); 441 442 m_dDecTime += (double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; 443 printf ("[DT %6.3f] ", m_dDecTime ); 444 m_dDecTime = 0; 445 446 for (Int iRefList = 0; iRefList < 2; iRefList++) 447 { 448 printf ("[L%d ", iRefList); 449 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 450 { 451 if( pcSlice->getViewId() != pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex ) ) 452 { 453 printf( "V%d ", pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex ) ); 454 } 455 else 456 { 457 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 458 } 459 } 460 printf ("] "); 461 } 462 if(pcSlice->getNumRefIdx(REF_PIC_LIST_C)>0 && !pcSlice->getNoBackPredFlag()) 463 { 464 printf ("[LC "); 465 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(REF_PIC_LIST_C); iRefIndex++) 466 { 467 if( pcSlice->getViewId() != pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) ) 468 { 469 printf( "V%d ", pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) ); 470 } 471 else 472 { 473 printf ("%d ", pcSlice->getRefPOC((RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex))); 474 } 475 } 476 printf ("] "); 477 } 478 479 if (m_pictureDigestEnabled) 480 { 481 calcAndPrintMD5Status(*rpcPic->getPicYuvRec(), rpcPic->getSEIs()); 482 } 483 484 #if FIXED_ROUNDING_FRAME_MEMORY 485 rpcPic->getPicYuvRec()->xFixedRoundingPic(); 486 #endif 487 488 rpcPic->setOutputMark(true); 489 rpcPic->setReconMark(true); 490 491 rpcPic->setUsedForTMVP( true ); 492 493 m_uiILSliceCount = 0; 494 m_vAlfCUCtrlSlices.clear(); 495 } 496 fflush(stdout); 245 printf("\nPOC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(), 246 pcSlice->getTLayer(), 247 c, 248 pcSlice->getSliceQp() ); 249 #endif 250 251 m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; 252 printf ("[DT %6.3f] ", m_dDecTime ); 253 m_dDecTime = 0; 254 255 for (Int iRefList = 0; iRefList < 2; iRefList++) 256 { 257 printf ("[L%d ", iRefList); 258 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 259 { 260 #if H_MV 261 if( pcSlice->getLayerId() != pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) ) 262 { 263 printf( "V%d ", pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) ); 264 } 265 else 266 { 267 #endif 268 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 269 #if H_MV 270 } 271 #endif 272 } 273 printf ("] "); 274 } 275 if (m_decodedPictureHashSEIEnabled) 276 { 277 SEIMessages pictureHashes = getSeisByType(rpcPic->getSEIs(), SEI::DECODED_PICTURE_HASH ); 278 const SEIDecodedPictureHash *hash = ( pictureHashes.size() > 0 ) ? (SEIDecodedPictureHash*) *(pictureHashes.begin()) : NULL; 279 if (pictureHashes.size() > 1) 280 { 281 printf ("Warning: Got multiple decoded picture hash SEI messages. Using first."); 282 } 283 calcAndPrintHashStatus(*rpcPic->getPicYuvRec(), hash); 284 } 285 286 rpcPic->setOutputMark(true); 287 rpcPic->setReconMark(true); 288 m_sliceStartCUAddress.clear(); 289 m_LFCrossSliceBoundaryFlag.clear(); 497 290 } 498 291 499 292 /** 500 * Calculate and print MD5for pic, compare to picture_digest SEI if501 * present in seis. seis may be NULL. MD5is printed to stdout, in293 * Calculate and print hash for pic, compare to picture_digest SEI if 294 * present in seis. seis may be NULL. Hash is printed to stdout, in 502 295 * a manner suitable for the status line. Theformat is: 503 * [ MD5:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,(yyy)]504 * Where, x..x is the md5296 * [Hash_type:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,(yyy)] 297 * Where, x..x is the hash 505 298 * yyy has the following meanings: 506 * OK - calculated MD5matches the SEI message507 * ***ERROR*** - calculated MD5does not match the SEI message299 * OK - calculated hash matches the SEI message 300 * ***ERROR*** - calculated hash does not match the SEI message 508 301 * unk - no SEI message was available for comparison 509 302 */ 510 static void calcAndPrint MD5Status(TComPicYuv& pic, const SEImessages* seis)303 static void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI) 511 304 { 512 305 /* calculate MD5sum for entire reconstructed picture */ 513 unsigned char recon_digest[16]; 514 calcMD5(pic, recon_digest); 306 UChar recon_digest[3][16]; 307 Int numChar=0; 308 const Char* hashType = "\0"; 309 310 if (pictureHashSEI) 311 { 312 switch (pictureHashSEI->method) 313 { 314 case SEIDecodedPictureHash::MD5: 315 { 316 hashType = "MD5"; 317 calcMD5(pic, recon_digest); 318 numChar = 16; 319 break; 320 } 321 case SEIDecodedPictureHash::CRC: 322 { 323 hashType = "CRC"; 324 calcCRC(pic, recon_digest); 325 numChar = 2; 326 break; 327 } 328 case SEIDecodedPictureHash::CHECKSUM: 329 { 330 hashType = "Checksum"; 331 calcChecksum(pic, recon_digest); 332 numChar = 4; 333 break; 334 } 335 default: 336 { 337 assert (!"unknown hash type"); 338 } 339 } 340 } 515 341 516 342 /* compare digest against received version */ 517 const char* md5_ok = "(unk)"; 518 bool md5_mismatch = false; 519 520 if (seis && seis->picture_digest) 521 { 522 md5_ok = "(OK)"; 523 for (unsigned i = 0; i < 16; i++) 524 { 525 if (recon_digest[i] != seis->picture_digest->digest[i]) 526 { 527 md5_ok = "(***ERROR***)"; 528 md5_mismatch = true; 529 } 530 } 531 } 532 533 printf("[MD5:%s,%s] ", digestToString(recon_digest), md5_ok); 534 if (md5_mismatch) 343 const Char* ok = "(unk)"; 344 Bool mismatch = false; 345 346 if (pictureHashSEI) 347 { 348 ok = "(OK)"; 349 for(Int yuvIdx = 0; yuvIdx < 3; yuvIdx++) 350 { 351 for (UInt i = 0; i < numChar; i++) 352 { 353 if (recon_digest[yuvIdx][i] != pictureHashSEI->digest[yuvIdx][i]) 354 { 355 ok = "(***ERROR***)"; 356 mismatch = true; 357 } 358 } 359 } 360 } 361 362 printf("[%s:%s,%s] ", hashType, digestToString(recon_digest, numChar), ok); 363 364 if (mismatch) 535 365 { 536 366 g_md5_mismatch = true; 537 printf("[rx MD5:%s] ", digestToString(seis->picture_digest->digest));367 printf("[rx%s:%s] ", hashType, digestToString(pictureHashSEI->digest, numChar)); 538 368 } 539 369 } -
trunk/source/Lib/TLibDecoder/TDecGop.h
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 49 49 #include "TLibCommon/TComPic.h" 50 50 #include "TLibCommon/TComLoopFilter.h" 51 #include "TLibCommon/TComAdaptiveLoopFilter.h"52 51 #include "TLibCommon/TComSampleAdaptiveOffset.h" 53 #include "TLibCommon/TComDepthMapGenerator.h"54 #include "../TLibCommon/TComResidualGenerator.h"55 52 56 53 #include "TDecEntropy.h" … … 70 67 { 71 68 private: 72 Int m_iGopSize;73 69 TComList<TComPic*> m_cListPic; // Dynamic buffer 74 70 75 Bool m_first;76 UInt m_uiILSliceCount;77 UInt* m_puiILSliceStartLCU;78 std::vector<AlfCUCtrlInfo> m_vAlfCUCtrlSlices;79 80 71 // Access channel 81 72 TDecEntropy* m_pcEntropyDecoder; … … 87 78 TDecSlice* m_pcSliceDecoder; 88 79 TComLoopFilter* m_pcLoopFilter; 89 #if DEPTH_MAP_GENERATION90 TComDepthMapGenerator* m_pcDepthMapGenerator;91 #endif92 #if H3D_IVRP & !QC_ARP_D017793 TComResidualGenerator* m_pcResidualGenerator;94 #endif95 80 96 // Adaptive Loop filter97 TComAdaptiveLoopFilter* m_pcAdaptiveLoopFilter;98 81 TComSampleAdaptiveOffset* m_pcSAO; 99 82 Double m_dDecTime; 83 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 100 84 101 bool m_pictureDigestEnabled; ///< if true, handle picture_digest SEI messages102 AlfCUCtrlInfo m_cAlfCUCtrlOneSlice;103 AlfParamSet m_alfParamSetPilot;85 //! list that contains the CU address of each slice plus the end address 86 std::vector<Int> m_sliceStartCUAddress; 87 std::vector<Bool> m_LFCrossSliceBoundaryFlag; 104 88 105 89 public: … … 112 96 TDecCavlc* pcCavlcDecoder, 113 97 TDecSlice* pcSliceDecoder, 114 TComLoopFilter* pcLoopFilter, 115 TComAdaptiveLoopFilter* pcAdaptiveLoopFilter 116 ,TComSampleAdaptiveOffset* pcSAO 117 #if DEPTH_MAP_GENERATION 118 ,TComDepthMapGenerator* pcDepthMapGenerator 119 #endif 120 #if H3D_IVRP & !QC_ARP_D0177 121 ,TComResidualGenerator* pcResidualGenerator 122 #endif 98 TComLoopFilter* pcLoopFilter, 99 TComSampleAdaptiveOffset* pcSAO 123 100 ); 124 101 Void create (); 125 102 Void destroy (); 126 Void decompress Gop(TComInputBitstream* pcBitstream, TComPic*& rpcPic, Bool bExecuteDeblockAndAlf);127 Void setGopSize( Int i) { m_iGopSize = i; }103 Void decompressSlice(TComInputBitstream* pcBitstream, TComPic*& rpcPic ); 104 Void filterPicture (TComPic*& rpcPic ); 128 105 129 void setPictureDigestEnabled(bool enabled) { m_pictureDigestEnabled = enabled; } 130 AlfCUCtrlInfo& getAlfCuCtrlParam() { return m_cAlfCUCtrlOneSlice; } 131 AlfParamSet& getAlfParamSet() {return m_alfParamSetPilot;} 132 133 private: 134 Void patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr = 0); 135 106 void setDecodedPictureHashSEIEnabled(Int enabled) { m_decodedPictureHashSEIEnabled = enabled; } 136 107 137 108 }; -
trunk/source/Lib/TLibDecoder/TDecSbac.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 52 52 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 53 53 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 54 #if LGE_ILLUCOMP_B004555 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)56 #endif57 54 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 58 55 , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) 59 #if H 3D_IVRP60 , m_c ResPredFlagSCModel ( 1, 1, NUM_RES_PRED_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels)61 #endif 62 #if QC_ARP_D017763 , m_cCU PUARPW ( 1, 1, NUM_ARPW_CTX, m_contextModels + m_numContextModels, m_numContextModels)56 #if H_3D_ARP 57 , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) 58 #endif 59 #if H_3D_IC 60 , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 64 61 #endif 65 62 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 66 63 , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 67 , m_cCUAlfCtrlFlagSCModel ( 1, 1, NUM_ALF_CTRL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)68 64 , m_cCUIntraPredSCModel ( 1, 1, NUM_ADI_CTX , m_contextModels + m_numContextModels, m_numContextModels) 69 65 , m_cCUChromaPredSCModel ( 1, 1, NUM_CHROMA_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 82 78 , m_cCUAbsSCModel ( 1, 1, NUM_ABS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 83 79 , m_cMVPIdxSCModel ( 1, 1, NUM_MVP_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 84 , m_cALFFlagSCModel ( 1, 1, NUM_ALF_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)85 , m_cALFUvlcSCModel ( 1, 1, NUM_ALF_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels)86 , m_cALFSvlcSCModel ( 1, 1, NUM_ALF_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels)87 80 , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) 88 #if LGE_SAO_MIGRATION_D0091 89 , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 81 , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 90 82 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 91 #else 92 , m_cSaoFlagSCModel ( 1, 1, NUM_SAO_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 93 , m_cSaoUvlcSCModel ( 1, 1, NUM_SAO_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 94 , m_cSaoSvlcSCModel ( 1, 1, NUM_SAO_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 95 , m_cSaoMergeLeftSCModel ( 1, 1, NUM_SAO_MERGE_LEFT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 96 , m_cSaoMergeUpSCModel ( 1, 1, NUM_SAO_MERGE_UP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 97 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 98 #endif 99 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 100 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 101 , m_cDmmFlagSCModel ( 1, 1, NUM_DMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 102 , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 103 #endif 104 , m_cDmmDataSCModel ( 1, 1, NUM_DMM_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 105 #endif 106 #if LGE_EDGE_INTRA_A0070 107 , m_cEdgeIntraSCModel ( 1, 1, NUM_EDGE_INTRA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 108 #if LGE_EDGE_INTRA_DELTA_DC 109 , m_cEdgeIntraDeltaDCSCModel ( 1, 1, NUM_EDGE_INTRA_DELTA_DC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 110 #endif 111 #endif 112 #if RWTH_SDC_DLT_B0036 113 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 114 , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 115 #else 116 , m_cDepthModeModel ( 1, 1, DEPTH_MODE_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 117 , m_cDmmDeltaFlagModel ( 1, 1, DMM_DELTA_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 118 #endif 119 #if RWTH_SDC_CTX_SIMPL_D0032 120 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 121 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 122 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 123 #else 124 , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 125 , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 126 , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 127 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 128 #endif 83 , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 84 , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) 85 #if H_3D_DIM 86 , m_cDepthIntraModeSCModel ( 1, 1, NUM_DEPTH_INTRA_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 87 , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 88 , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 89 #if H_3D_DIM_DMM 90 , m_cDmm1DataSCModel ( 1, 1, NUM_DMM1_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 91 #if !SEC_DMM2_E0146 92 , m_cDmm2DataSCModel ( 1, 1, NUM_DMM2_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 93 #endif 94 , m_cDmm3DataSCModel ( 1, 1, NUM_DMM3_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 95 #endif 96 #if H_3D_DIM_RBC 97 , m_cRbcDataSCModel ( 1, 1, NUM_RBC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 98 #endif 99 #if H_3D_DIM_SDC 100 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 101 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 102 #endif 103 #endif 104 #if LGE_INTER_SDC_E0156 105 , m_cInterSDCFlagSCModel ( 1, 1, NUM_INTER_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 106 , m_cInterSDCResidualSCModel ( 1, 1, NUM_INTER_SDC_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 107 , m_cInterSDCResidualSignFlagSCModel ( 1, 1, NUM_INTER_SDC_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 129 108 #endif 130 109 { 131 110 assert( m_numContextModels <= MAX_NUM_CTX_MOD ); 132 m_iSliceGranularity = 0;133 111 } 134 112 … … 141 119 // ==================================================================================================================== 142 120 143 #if CABAC_INIT_FLAG144 121 Void TDecSbac::resetEntropy(TComSlice* pSlice) 145 122 { … … 162 139 } 163 140 164 #else165 Void TDecSbac::resetEntropywithQPandInitIDC (Int qp, Int iID)166 {167 SliceType sliceType = (SliceType)iID;168 #endif169 170 141 m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 171 142 m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); 172 #if LGE_ILLUCOMP_B0045173 m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG );174 #endif175 143 m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); 176 144 m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); 177 #if H3D_IVRP 178 m_cResPredFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RES_PRED_FLAG ); 179 #endif 180 #if QC_ARP_D0177 181 m_cCUPUARPW.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); 182 #endif 183 m_cCUAlfCtrlFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG ); 145 #if H_3D_ARP 146 m_cCUPUARPWSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); 147 #endif 148 #if H_3D_IC 149 m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); 150 #endif 184 151 m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); 185 152 m_cCUAMPSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_AMP_POS ); … … 200 167 m_cCUAbsSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ABS_FLAG ); 201 168 m_cMVPIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVP_IDX ); 202 m_cALFFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_FLAG ); 203 m_cALFUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_UVLC ); 204 m_cALFSvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_SVLC ); 205 #if LGE_SAO_MIGRATION_D0091 206 m_cSaoMergeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); 169 m_cSaoMergeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); 207 170 m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); 208 #else209 m_cSaoFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_FLAG );210 m_cSaoUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_UVLC );211 m_cSaoSvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_SVLC );212 m_cSaoMergeLeftSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );213 m_cSaoMergeUpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG );214 m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX );215 #endif216 171 217 172 m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 218 #if LGE_EDGE_INTRA_A0070 219 m_cEdgeIntraSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_EDGE_INTRA ); 220 #if LGE_EDGE_INTRA_DELTA_DC 221 m_cEdgeIntraDeltaDCSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_EDGE_INTRA_DELTA_DC ); 222 #endif 173 m_cTransformSkipSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 174 m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 175 #if H_3D_DIM 176 m_cDepthIntraModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE ); 177 m_cDdcFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_FLAG ); 178 m_cDdcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_DATA ); 179 #if H_3D_DIM_DMM 180 m_cDmm1DataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM1_DATA ); 181 #if !SEC_DMM2_E0146 182 m_cDmm2DataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM2_DATA ); 183 #endif 184 m_cDmm3DataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM3_DATA ); 185 #endif 186 #if H_3D_DIM_RBC 187 m_cRbcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RBC_DATA ); 188 #endif 189 #if H_3D_DIM_SDC 190 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 191 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); 192 #endif 193 #endif 194 #if LGE_INTER_SDC_E0156 195 m_cInterSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG ); 196 m_cInterSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL ); 197 m_cInterSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG ); 223 198 #endif 224 199 m_uiLastDQpNonZero = 0; 225 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX226 #if !PKU_QC_DEPTH_INTRA_UNI_D0195227 m_cDmmFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_FLAG );228 m_cDmmModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_MODE );229 #endif230 m_cDmmDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_DATA );231 #endif232 #if RWTH_SDC_DLT_B0036233 #if !PKU_QC_DEPTH_INTRA_UNI_D0195234 m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG );235 #else236 m_cDepthModeModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTHMODE_FLAG );237 m_cDmmDeltaFlagModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMMDELTA_FLAG );238 #endif239 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG );240 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );241 #if !RWTH_SDC_CTX_SIMPL_D0032242 m_cSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_SIGN_FLAG );243 #endif244 m_cSDCPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_PRED_MODE );245 #endif246 200 247 201 // new structure … … 258 212 UInt uiBit; 259 213 m_pcTDecBinIf->decodeBinTrm(uiBit); 214 assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1 260 215 m_pcTDecBinIf->finish(); 261 #if !OL_FLUSH_ALIGN262 // Account for misaligned CABAC.263 Int iCABACReadAhead = m_pcTDecBinIf->getBitsReadAhead();264 iCABACReadAhead--;265 Int iStreamBits = 8-m_pcBitstream->getNumBitsUntilByteAligned();266 if (iCABACReadAhead >= iStreamBits)267 {268 // Misaligned CABAC has read into the 1st byte of the next tile.269 // Back up a byte prior to alignment.270 m_pcBitstream->backupByte();271 }272 #endif273 216 m_pcBitstream->readOutTrailingBits(); 274 217 m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); 275 218 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 276 #if LGE_ILLUCOMP_B0045277 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );278 #endif279 219 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); 280 220 m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); 281 #if H3D_IVRP 282 m_cResPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG ); 283 #endif 284 #if QC_ARP_D0177 285 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 286 #endif 287 m_cCUAlfCtrlFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG ); 221 #if H_3D_ARP 222 m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 223 #endif 224 #if H_3D_IC 225 m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); 226 #endif 288 227 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); 289 228 m_cCUAMPSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS ); … … 304 243 m_cCUAbsSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ABS_FLAG ); 305 244 m_cMVPIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVP_IDX ); 306 m_cALFFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_FLAG ); 307 m_cALFUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_UVLC ); 308 m_cALFSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_SVLC ); 309 #if LGE_SAO_MIGRATION_D0091 310 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 245 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 311 246 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 312 #else313 m_cSaoFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_FLAG );314 m_cSaoUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC );315 m_cSaoSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC );316 m_cSaoMergeLeftSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );317 m_cSaoMergeUpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG );318 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX );319 #endif320 247 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 321 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 322 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 323 m_cDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG ); 324 m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE ); 325 #endif 326 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 327 #endif 328 #if RWTH_SDC_DLT_B0036 329 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 330 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 331 #else 332 m_cDepthModeModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG ); 333 m_cDmmDeltaFlagModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG ); 334 #endif 335 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 336 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 337 #if !RWTH_SDC_CTX_SIMPL_D0032 338 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 339 #endif 340 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 341 #endif 342 248 m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); 249 m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 250 251 #if H_3D_DIM 252 m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE ); 253 m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG ); 254 m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA ); 255 #if H_3D_DIM_DMM 256 m_cDmm1DataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA ); 257 #if !SEC_DMM2_E0146 258 m_cDmm2DataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA ); 259 #endif 260 m_cDmm3DataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA ); 261 #endif 262 #if H_3D_DIM_RBC 263 m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); 264 #endif 265 #if H_3D_DIM_SDC 266 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 267 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 268 #endif 269 #endif 270 #if LGE_INTER_SDC_E0156 271 m_cInterSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG ); 272 m_cInterSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL ); 273 m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG ); 274 #endif 343 275 m_pcTDecBinIf->start(); 344 276 } 345 277 346 Void TDecSbac::readTileMarker( UInt& uiTileIdx, UInt uiBitsUsed )347 {348 UInt uiSymbol;349 uiTileIdx = 0;350 for (Int iShift=uiBitsUsed-1; iShift>=0; iShift--)351 {352 m_pcTDecBinIf->decodeBinEP ( uiSymbol );353 if (uiSymbol)354 {355 uiTileIdx |= (1<<iShift);356 }357 }358 }359 360 278 Void TDecSbac::parseTerminatingBit( UInt& ruiBit ) 361 279 { 362 280 m_pcTDecBinIf->decodeBinTrm( ruiBit ); 281 if ( ruiBit ) 282 { 283 m_pcTDecBinIf->finish(); 284 } 363 285 } 364 286 … … 440 362 } 441 363 442 /** Parsing of coeff_abs_level_minus3 443 * \param ruiSymbol reference to coeff_abs_level_minus3 444 * \param ruiGoRiceParam reference to Rice parameter 364 365 /** Parsing of coeff_abs_level_remaing 366 * \param ruiSymbol reference to coeff_abs_level_remaing 367 * \param ruiParam reference to parameter 445 368 * \returns Void 446 369 */ 447 Void TDecSbac::xReadGoRiceExGolomb( UInt &ruiSymbol, UInt &ruiGoRiceParam ) 448 { 449 Bool bExGolomb = false; 450 UInt uiCodeWord = 0; 451 UInt uiQuotient = 0; 452 UInt uiRemainder = 0; 453 UInt uiMaxVlc = g_auiGoRiceRange[ ruiGoRiceParam ]; 454 UInt uiMaxPreLen = g_auiGoRicePrefixLen[ ruiGoRiceParam ]; 455 370 Void TDecSbac::xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam ) 371 { 372 373 UInt prefix = 0; 374 UInt codeWord = 0; 456 375 do 457 376 { 458 uiQuotient++; 459 m_pcTDecBinIf->decodeBinEP( uiCodeWord ); 460 } 461 while( uiCodeWord && uiQuotient < uiMaxPreLen ); 462 463 uiCodeWord = 1 - uiCodeWord; 464 uiQuotient -= uiCodeWord; 465 466 if ( ruiGoRiceParam > 0 ) 467 { 468 m_pcTDecBinIf->decodeBinsEP( uiRemainder, ruiGoRiceParam ); 469 } 470 471 ruiSymbol = uiRemainder + ( uiQuotient << ruiGoRiceParam ); 472 bExGolomb = ruiSymbol == ( uiMaxVlc + 1 ); 473 474 if( bExGolomb ) 475 { 476 xReadEpExGolomb( uiCodeWord, 0 ); 477 ruiSymbol += uiCodeWord; 478 } 479 480 ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 23 ) ]; 377 prefix++; 378 m_pcTDecBinIf->decodeBinEP( codeWord ); 379 } 380 while( codeWord); 381 codeWord = 1 - codeWord; 382 prefix -= codeWord; 383 codeWord=0; 384 if (prefix < COEF_REMAIN_BIN_REDUCTION ) 385 { 386 m_pcTDecBinIf->decodeBinsEP(codeWord,rParam); 387 rSymbol = (prefix<<rParam) + codeWord; 388 } 389 else 390 { 391 m_pcTDecBinIf->decodeBinsEP(codeWord,prefix-COEF_REMAIN_BIN_REDUCTION+rParam); 392 rSymbol = (((1<<(prefix-COEF_REMAIN_BIN_REDUCTION))+COEF_REMAIN_BIN_REDUCTION-1)<<rParam)+codeWord; 393 } 394 } 395 396 #if H_3D_DIM 397 Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel ) 398 { 399 UInt uiSymbol; 400 UInt uiCount = 0; 401 do 402 { 403 m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel ); 404 uiCount++; 405 } 406 while( uiSymbol && ( uiCount != 13 ) ); 407 408 ruiSymbol = uiCount - 1; 409 410 if( uiSymbol ) 411 { 412 xReadEpExGolomb( uiSymbol, 0 ); 413 ruiSymbol += uiSymbol + 1; 414 } 481 415 482 416 return; 483 417 } 484 418 419 Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt dimType ) 420 { 421 UInt absValDeltaDC = 0; 422 xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) ); 423 rValDeltaDC = (Pel)absValDeltaDC; 424 425 if( rValDeltaDC != 0 ) 426 { 427 UInt uiSign; 428 m_pcTDecBinIf->decodeBinEP( uiSign ); 429 if ( uiSign ) 430 { 431 rValDeltaDC = -rValDeltaDC; 432 } 433 } 434 } 435 #if H_3D_DIM_DMM 436 Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit ) 437 { 438 UInt uiSymbol, uiIdx = 0; 439 for( Int i = 0; i < iNumBit; i++ ) 440 { 441 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm1DataSCModel.get(0, 0, 0) ); 442 uiIdx += uiSymbol << i; 443 } 444 ruiTabIdx = uiIdx; 445 } 446 #if !SEC_DMM2_E0146 447 Void TDecSbac::xParseDmm2Offset( Int& riOffset ) 448 { 449 Int iDeltaEnd = 0; 450 if( DMM2_DELTAEND_MAX > 0 ) 451 { 452 UInt uiFlag = 0; 453 m_pcTDecBinIf->decodeBin( uiFlag, m_cDmm2DataSCModel.get(0, 0, 0) ); 454 455 if( uiFlag ) 456 { 457 UInt uiAbsValMinus1; 458 UInt uiSymbol; 459 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1 = uiSymbol; 460 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1 |= uiSymbol << 1; 461 iDeltaEnd = uiAbsValMinus1 + 1; 462 UInt uiSign; 463 m_pcTDecBinIf->decodeBinEP( uiSign ); 464 if( uiSign ) 465 { 466 iDeltaEnd = -iDeltaEnd; 467 } 468 } 469 } 470 riOffset = iDeltaEnd; 471 } 472 #endif 473 Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit ) 474 { 475 UInt uiSymbol, uiIdx = 0; 476 for( Int i = 0; i < iNumBit; i++ ) 477 { 478 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm3DataSCModel.get(0, 0, 0) ); 479 uiIdx += uiSymbol << i; 480 } 481 ruiIntraIdx = uiIdx; 482 } 483 #endif 484 #if H_3D_DIM_RBC 485 Void TDecSbac::xParseRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 486 { 487 UInt uiSymbol = 0; 488 489 // 1. Top(0) or Left(1) 490 UChar ucLeft; 491 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 492 ucLeft = uiSymbol; 493 494 // 2. Start position (lowest bit first) 495 UChar ucStart = 0; 496 for( UInt ui = 0; ui < 6 - uiDepth; ui++ ) 497 { 498 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 499 ucStart |= (uiSymbol << ui); 500 } 501 502 // 3. Number of edges 503 UChar ucMax = 0; 504 for( UInt ui = 0; ui < 7 - uiDepth; ui++ ) 505 { 506 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 507 ucMax |= (uiSymbol << ui); 508 } 509 ucMax++; // +1 510 511 // 4. Edges 512 UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * RBC_MAX_EDGE_NUM_PER_4x4 ); 513 for( Int iPtr = 0; iPtr < ucMax; iPtr++ ) 514 { 515 UChar ucEdge = 0; 516 UInt uiReorderEdge = 0; 517 for( UInt ui = 0; ui < 6; ui++ ) 518 { 519 m_pcTDecBinIf->decodeBin( uiSymbol, m_cRbcDataSCModel.get( 0, 0, 0 ) ); 520 ucEdge <<= 1; 521 ucEdge |= uiSymbol; 522 if( uiSymbol == 0 ) 523 break; 524 } 525 526 switch( ucEdge ) 527 { 528 case 0 : // "0" 529 uiReorderEdge = 0; 530 break; 531 case 2 : // "10" 532 uiReorderEdge = 1; 533 break; 534 case 6 : // "110" 535 uiReorderEdge = 2; 536 break; 537 case 14 : // "1110" 538 uiReorderEdge = 3; 539 break; 540 case 30 : // "11110" 541 uiReorderEdge = 4; 542 break; 543 case 62 : // "111110" 544 uiReorderEdge = 5; 545 break; 546 case 63 : // "111111" 547 uiReorderEdge = 6; 548 break; 549 default : 550 printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge); 551 assert(false); 552 break; 553 } 554 pucSymbolList[iPtr] = uiReorderEdge; 555 } 556 ///////////////////// 557 // Edge Reconstruction 558 Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx ); 559 pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion ); 560 xFree( pucSymbolList ); 561 } 562 #endif 563 #if H_3D_DIM_SDC 564 Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) 565 { 566 assert( pcCU->getSlice()->getIsDepth() ); 567 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 568 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 569 assert( uiSegment < 2 ); 570 571 UInt uiResidual = 0; 572 UInt uiBit = 0; 573 UInt uiAbsIdx = 0; 574 UInt uiSign = 0; 575 Int iIdx = 0; 576 577 #if H_3D_DIM_DLT 578 UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); 579 #else 580 UInt uiMaxResidualBits = g_bitDepthY; 581 #endif 582 assert( uiMaxResidualBits <= g_bitDepthY ); 583 584 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 585 586 if (uiResidual) 587 { 588 // decode residual sign bit 589 m_pcTDecBinIf->decodeBinEP(uiSign); 590 591 // decode residual magnitude 592 // prefix part 593 UInt uiCount = 0; 594 #if H_3D_DIM_DLT 595 UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); 596 #else 597 UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); 598 #endif 599 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 600 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) 601 { 602 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); 603 if ( uiBit == 0 ) 604 break; 605 else 606 uiCount++; 607 } 608 // suffix part 609 if ( uiCount == uiPrefixThreshold ) 610 { 611 for ( UInt ui = 0; ui < numBitsForValue(uiNumDepthValues - uiPrefixThreshold); ui++ ) 612 { 613 m_pcTDecBinIf->decodeBinEP( uiBit ); 614 uiAbsIdx |= uiBit << ui; 615 } 616 uiAbsIdx += uiCount; 617 } 618 else 619 uiAbsIdx = uiCount; 620 621 uiAbsIdx += 1; 622 iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; 623 } 624 625 pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); 626 } 627 #endif 628 #endif 485 629 486 630 /** Parse I_PCM information. … … 495 639 { 496 640 UInt uiSymbol; 497 Int numSubseqIPCM = 0; 498 Bool readPCMSampleFlag = false; 499 500 if(pcCU->getNumSucIPCM() > 0) 501 { 502 readPCMSampleFlag = true; 503 } 504 else 505 { 641 506 642 m_pcTDecBinIf->decodeBinTrm(uiSymbol); 507 643 644 #if H_MV_ENC_DEC_TRAC 645 DTRACE_CU("pcm_flag", uiSymbol) 646 #endif 508 647 if (uiSymbol) 509 648 { 510 readPCMSampleFlag = true;511 m_pcTDecBinIf->decodeNumSubseqIPCM(numSubseqIPCM);512 pcCU->setNumSucIPCM(numSubseqIPCM + 1);513 m_pcTDecBinIf->decodePCMAlignBits();514 }515 }516 517 if (readPCMSampleFlag == true)518 {519 649 Bool bIpcmFlag = true; 520 521 650 522 651 pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 523 652 pcCU->setSizeSubParts ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); 653 pcCU->setTrIdxSubParts ( 0, uiAbsPartIdx, uiDepth ); 524 654 pcCU->setIPCMFlagSubParts ( bIpcmFlag, uiAbsPartIdx, uiDepth ); 525 655 … … 582 712 } 583 713 584 pcCU->setNumSucIPCM( pcCU->getNumSucIPCM() - 1); 585 if(pcCU->getNumSucIPCM() == 0) 586 { 587 m_pcTDecBinIf->resetBac(); 588 } 589 } 714 m_pcTDecBinIf->start(); 715 } 716 } 717 718 Void TDecSbac::parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 719 { 720 UInt uiSymbol; 721 m_pcTDecBinIf->decodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) ); 722 #if H_MV_ENC_DEC_TRAC 723 DTRACE_CU("cu_transquant_bypass_flag", uiSymbol); 724 #endif 725 pcCU->setCUTransquantBypassSubParts(uiSymbol ? true : false, uiAbsPartIdx, uiDepth); 590 726 } 591 727 … … 606 742 UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ); 607 743 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) ); 744 #if !H_MV_ENC_DEC_TRAC 608 745 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 609 746 DTRACE_CABAC_T( "\tSkipFlag" ); … … 613 750 DTRACE_CABAC_V( uiSymbol ); 614 751 DTRACE_CABAC_T( "\n"); 752 #endif 615 753 616 754 if( uiSymbol ) 617 755 { 618 pcCU->setPredModeSubParts( MODE_SKIP, uiAbsPartIdx, uiDepth ); 756 pcCU->setSkipFlagSubParts( true, uiAbsPartIdx, uiDepth ); 757 pcCU->setPredModeSubParts( MODE_INTER, uiAbsPartIdx, uiDepth ); 619 758 pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); 620 759 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); 621 760 pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth ); 622 761 } 623 } 624 625 #if LGE_ILLUCOMP_B0045 626 /** parse illumination compensation flag 627 * \param pcCU 628 * \param uiAbsPartIdx 629 * \param uiDepth 630 * \returns Void 631 */ 632 Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 633 { 634 UInt uiSymbol = 0; 635 UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); 636 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); 637 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 638 DTRACE_CABAC_T( "\tICFlag" ); 639 DTRACE_CABAC_T( "\tuiCtxIC: "); 640 DTRACE_CABAC_V( uiCtxIC ); 641 DTRACE_CABAC_T( "\tuiSymbol: "); 642 DTRACE_CABAC_V( uiSymbol ); 643 DTRACE_CABAC_T( "\n"); 644 645 pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); 646 } 647 #endif 648 762 #if H_MV_ENC_DEC_TRAC 763 DTRACE_CU("cu_skip_flag", uiSymbol); 764 #endif 765 } 649 766 650 767 /** parse merge flag … … 659 776 UInt uiSymbol; 660 777 m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) ); 778 #if H_MV_ENC_DEC_TRAC 779 DTRACE_PU("merge_flag", uiSymbol) 780 #endif 661 781 pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth ); 662 782 783 #if !H_MV_ENC_DEC_TRAC 663 784 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 664 785 DTRACE_CABAC_T( "\tMergeFlag: " ); … … 669 790 DTRACE_CABAC_V( uiAbsPartIdx ); 670 791 DTRACE_CABAC_T( "\n" ); 671 } 672 673 Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ) 674 { 675 UInt uiNumCand = MRG_MAX_NUM_CANDS; 792 #endif 793 } 794 795 Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) 796 { 676 797 UInt uiUnaryIdx = 0; 677 uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); 678 #if HHI_MPI 679 const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE; 680 const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : uiNumCand; 681 #endif 798 UInt uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); 682 799 if ( uiNumCand > 1 ) 683 800 { … … 698 815 } 699 816 } 817 #if H_MV_ENC_DEC_TRAC 818 DTRACE_PU("merge_idx", uiUnaryIdx) 819 #endif 700 820 } 701 821 ruiMergeIndex = uiUnaryIdx; 702 822 823 #if !H_MV_ENC_DEC_TRAC 703 824 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 704 825 DTRACE_CABAC_T( "\tparseMergeIndex()" ) … … 706 827 DTRACE_CABAC_V( ruiMergeIndex ) 707 828 DTRACE_CABAC_T( "\n" ) 708 #if HHI_MPI 709 if( ruiMergeIndex > uiMviMergePos ) 710 { 711 assert( bMVIAvailable ); 712 ruiMergeIndex--; 713 } 714 else if( ruiMergeIndex == uiMviMergePos ) 715 { 716 assert( bMVIAvailable ); 717 pcCU->setTextureModeDepthSubParts( uiDepth, uiAbsPartIdx, uiDepth ); 718 } 719 #endif 720 } 721 722 #if H3D_IVRP 723 Void 724 TDecSbac::parseResPredFlag( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) 725 { 726 UInt uiCtx = pcCU->getCtxResPredFlag( uiAbsPartIdx ); 727 UInt uiSymbol = 0; 728 m_pcTDecBinIf->decodeBin( uiSymbol, m_cResPredFlagSCModel.get( 0, 0, uiCtx ) ); 729 rbResPredFlag = ( uiSymbol != 0 ); 730 } 731 #endif 732 733 #if H3D_IVMP 734 Void TDecSbac::parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands ) 735 { 736 UInt uiSymbol; 737 xReadUnaryMaxSymbol(uiSymbol, m_cMVPIdxSCModel.get(0), 1, iNumAMVPCands-1); 738 riMVPIdx = uiSymbol; 739 } 740 #else 829 #endif 830 } 831 741 832 Void TDecSbac::parseMVPIdx ( Int& riMVPIdx ) 742 833 { … … 745 836 riMVPIdx = uiSymbol; 746 837 } 747 #endif748 838 749 839 Void TDecSbac::parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) … … 754 844 return; 755 845 } 756 846 757 847 UInt uiSymbol; 758 759 #if H3D_QTL 848 #if H_3D_QTLPC 760 849 Bool bParseSplitFlag = true; 761 850 … … 765 854 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); 766 855 767 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 768 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) 856 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 857 858 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC()) 769 859 { 770 860 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); … … 777 867 #endif 778 868 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) ); 869 #if H_MV_ENC_DEC_TRAC 870 DTRACE_CU("split_cu_flag", uiSymbol); 871 #else 779 872 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 780 873 DTRACE_CABAC_T( "\tSplitFlag\n" ) 781 #if H3D_QTL 874 #endif 875 #if H_3D_QTLPC 782 876 } 783 877 else 878 { 784 879 uiSymbol = 0; 785 #endif 786 880 } 881 #endif 787 882 pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); 788 883 … … 801 896 PartSize eMode; 802 897 803 #if H 3D_QTL898 #if H_3D_QTLPC 804 899 Bool bParsePartSize = true; 805 900 TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS(); … … 808 903 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); 809 904 810 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 811 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) 905 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 906 907 if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC()) 812 908 { 813 909 TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); … … 820 916 } 821 917 #endif 918 822 919 823 920 if ( pcCU->isIntra( uiAbsPartIdx ) ) 824 921 { 825 #if H 3D_QTL922 #if H_3D_QTLPC 826 923 if(bParsePartSize) 827 924 { 828 925 #endif 829 926 uiSymbol = 1; 830 927 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) 831 928 { 832 929 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) ); 930 #if H_MV_ENC_DEC_TRAC 931 DTRACE_CU("part_mode", uiSymbol) 932 #endif 833 933 } 834 934 eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; 835 #if H 3D_QTL935 #if H_3D_QTLPC 836 936 } 837 937 #endif … … 851 951 else 852 952 { 853 #if H 3D_QTL953 #if H_3D_QTLPC 854 954 if(bParsePartSize) 855 955 { 856 956 #endif 857 957 UInt uiMaxNumBits = 2; 858 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getSlice()->getSPS()->getDisInter4x4() &&(g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) )958 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) ) 859 959 { 860 960 uiMaxNumBits ++; … … 874 974 if (eMode == SIZE_2NxN) 875 975 { 876 976 m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); 877 977 if (uiSymbol == 0) 878 978 { … … 891 991 } 892 992 } 893 #if H3D_QTL 993 #if H_MV_ENC_DEC_TRAC 994 DTRACE_CU("part_mode", eMode ) 995 #endif 996 #if H_3D_QTLPC 894 997 } 895 998 #endif … … 917 1020 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) ); 918 1021 iPredMode += uiSymbol; 1022 #if H_MV_ENC_DEC_TRAC 1023 DTRACE_CU("pred_mode_flag", uiSymbol) 1024 #endif 919 1025 pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth ); 920 1026 } 921 #if PKU_QC_DEPTH_INTRA_UNI_D0195 922 Void TDecSbac::parseDepthIntraMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 923 { 924 UInt uiPuIdx = ( pcCU->getWidth(uiAbsPartIdx) == 64 )? 2 : ( ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && pcCU->getWidth(uiAbsPartIdx) == 8 )? 0 : 1); 925 UInt uiDir = 0; 926 Bool bSDCFlag = 0; 927 UInt uiSymbol = 1; 928 UInt uiCode = 0 ; 929 UInt uiBinNum = 0; 930 UInt uiCtxDepthMode = 0; 931 if ( uiPuIdx ==2 ) 932 { 933 while(uiBinNum<2 && uiSymbol) 934 { 935 uiCtxDepthMode = uiPuIdx*3 + uiBinNum; 936 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 937 uiCode = (uiCode<<1)+uiSymbol; 938 uiBinNum++; 939 } 940 if (uiCode == 0) { uiDir = PLANAR_IDX; bSDCFlag = 1;} 941 else if (uiCode == 2) { uiDir = 0; bSDCFlag = 0;} 942 else if (uiCode == 3) { uiDir = DC_IDX; bSDCFlag = 1;} 943 } 944 else if ( uiPuIdx ==0 ) 945 { 946 while(uiBinNum<3 && uiSymbol) 947 { 948 uiCtxDepthMode = uiPuIdx*3 + ( uiBinNum >= 2? 2 : uiBinNum ); 949 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 950 uiCode = (uiCode<<1)+uiSymbol; 951 uiBinNum++; 952 } 953 if (uiCode == 0) { uiDir = 0; bSDCFlag = 0;} 954 else if (uiCode == 2) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 0;} 955 else if (uiCode == 6) { uiDir = DMM_WEDGE_PREDTEX_IDX; bSDCFlag = 0;} 956 else if (uiCode == 7) { uiDir = EDGE_INTRA_IDX; bSDCFlag = 0;} 957 } 958 else 959 { 960 uiCtxDepthMode = uiPuIdx*3 ; 961 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 962 uiCode = (uiCode<<1)+uiSymbol; 963 if (!uiSymbol) 964 { 965 uiCtxDepthMode = uiPuIdx*3 + 1; 966 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 967 uiCode = (uiCode<<1)+uiSymbol; 968 if (uiSymbol) 1027 1028 Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 1029 { 1030 PartSize mode = pcCU->getPartitionSize( absPartIdx ); 1031 UInt partNum = mode==SIZE_NxN?4:1; 1032 UInt partOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(absPartIdx) << 1 ) ) >> 2; 1033 UInt mpmPred[4],symbol; 1034 Int j,intraPredMode; 1035 if (mode==SIZE_NxN) 1036 { 1037 depth++; 1038 } 1039 for (j=0;j<partNum;j++) 1040 { 1041 #if H_3D_DIM 1042 if( pcCU->getSlice()->getVpsDepthModesFlag() ) 1043 { 1044 parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth ); 1045 } 1046 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE ) 1047 #if H_3D_DIM_SDC 1048 if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) ) 1049 #endif 1050 { 1051 #endif 1052 m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); 1053 mpmPred[j] = symbol; 1054 #if H_MV_ENC_DEC_TRAC 1055 DTRACE_CU("prev_intra_luma_pred_flag", symbol) 1056 #endif 1057 #if H_3D_DIM 1058 } 1059 #endif 1060 } 1061 for (j=0;j<partNum;j++) 1062 { 1063 #if H_3D_DIM 1064 if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE ) 1065 #if H_3D_DIM_SDC 1066 if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) ) 1067 #endif 1068 { 1069 #endif 1070 Int preds[3] = {-1, -1, -1}; 1071 Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); 1072 if (mpmPred[j]) 1073 { 1074 m_pcTDecBinIf->decodeBinEP( symbol ); 1075 if (symbol) 1076 { 1077 m_pcTDecBinIf->decodeBinEP( symbol ); 1078 symbol++; 1079 } 1080 #if H_MV_ENC_DEC_TRAC 1081 DTRACE_CU("mpm_idx", symbol) 1082 #endif 1083 intraPredMode = preds[symbol]; 1084 } 1085 else 1086 { 1087 m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); 1088 intraPredMode = symbol; 1089 #if H_MV_ENC_DEC_TRAC 1090 DTRACE_CU("rem_intra_luma_pred_mode", symbol) 1091 #endif 1092 //postponed sorting of MPMs (only in remaining branch) 1093 if (preds[0] > preds[1]) 969 1094 { 970 uiCtxDepthMode = uiPuIdx*3 + 2; 971 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 972 uiCode = (uiCode<<1)+uiSymbol; 973 } 974 } 975 else 976 { 977 uiCtxDepthMode = uiPuIdx*3 + 1; 978 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 979 uiCode = (uiCode<<1)+uiSymbol; 980 if (!uiSymbol) 981 { 982 uiCtxDepthMode = uiPuIdx*3 + 2; 983 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 984 uiCode = (uiCode<<1)+uiSymbol; 985 } 986 else 987 { 988 uiBinNum = 0; 989 while( uiSymbol && uiBinNum<3 ) 990 { 991 uiCtxDepthMode = uiPuIdx*3 + 2; 992 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 993 uiCode = (uiCode<<1)+uiSymbol; 994 uiBinNum++; 995 } 996 } 997 } 998 if (uiCode == 0) { uiDir = PLANAR_IDX; bSDCFlag = 1;} 999 else if (uiCode == 2) { uiDir = 5; bSDCFlag = 0;} 1000 else if (uiCode == 3) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 1;} 1001 else if (uiCode == 4) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 0;} 1002 else if (uiCode == 5) { uiDir = DMM_CONTOUR_PREDTEX_IDX; bSDCFlag = 0;} 1003 else if (uiCode == 6) { uiDir = DMM_WEDGE_PREDTEX_IDX; bSDCFlag = 0;} 1004 else if (uiCode == 14) { uiDir = DC_IDX; bSDCFlag = 1;} 1005 else if (uiCode == 31) { uiDir = DMM_WEDGE_PREDDIR_IDX; bSDCFlag = 0;} 1006 else if (uiCode == 30) { uiDir = EDGE_INTRA_IDX; bSDCFlag = 0;} 1007 } 1008 pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth ); 1009 pcCU->setSDCFlagSubParts(bSDCFlag, uiAbsPartIdx, 0, uiDepth); 1010 } 1011 Void TDecSbac::parseDepthModelingTable ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1012 { 1013 parseDepthIntraMode(pcCU,uiAbsPartIdx,uiDepth); 1014 1015 UInt uiDir = pcCU->getLumaIntraDir(uiAbsPartIdx); 1016 Bool bSdcFlag = pcCU->getSDCAvailable(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx); 1017 Bool bDmmFlag = (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX &&(!bSdcFlag))? 1:0; 1018 if (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX)//DMM modes and SDC DMM1 1019 { 1020 if( uiDir == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 1021 else if( uiDir == DMM_WEDGE_PREDTEX_IDX ) { xParseWedgePredTexInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 1022 else if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 1023 } 1024 else if(uiDir >= EDGE_INTRA_IDX)//CCM mode 1025 { 1026 xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth ); 1027 } 1028 1095 std::swap(preds[0], preds[1]); 1096 } 1097 if (preds[0] > preds[2]) 1098 { 1099 std::swap(preds[0], preds[2]); 1100 } 1101 if (preds[1] > preds[2]) 1102 { 1103 std::swap(preds[1], preds[2]); 1104 } 1105 for ( Int i = 0; i < predNum; i++ ) 1106 { 1107 intraPredMode += ( intraPredMode >= preds[i] ); 1108 } 1109 } 1110 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth ); 1111 #if H_3D_DIM 1112 } 1113 #endif 1114 } 1115 } 1116 1117 Void TDecSbac::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1118 { 1029 1119 UInt uiSymbol; 1030 if (bDmmFlag)1031 {1032 if (bDmmFlag)1033 {1034 m_pcTDecBinIf->decodeBin( uiSymbol , m_cDmmDeltaFlagModel.get(0, 0, 0) );1035 uiDir += uiSymbol;1036 }1037 if (uiSymbol)1038 {1039 UInt uiDC;1040 Int iDC = 0,iDC1 = 0,iDC2 = 0;1041 for ( Int i = 0; i <2; i++ )1042 {1043 xReadExGolombLevel( uiDC, m_cDmmDataSCModel.get(0, 0, 1) );1044 iDC = uiDC;1045 if ( uiDC )1046 {1047 UInt uiSign;1048 m_pcTDecBinIf->decodeBinEP( uiSign );1049 if ( uiSign )1050 {1051 iDC = -iDC;1052 }1053 }1054 if ( i == 0 ) { iDC1 = iDC; }1055 else { iDC2 = iDC; }1056 }1057 1058 if( uiDir == DMM_WEDGE_FULL_D_IDX )1059 {1060 pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );1061 pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );1062 }1063 else if( uiDir == DMM_WEDGE_PREDDIR_D_IDX )1064 {1065 pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );1066 pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );1067 }1068 else if( uiDir == DMM_WEDGE_PREDTEX_D_IDX)1069 {1070 pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );1071 pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );1072 }1073 else if (uiDir== DMM_CONTOUR_PREDTEX_D_IDX )1074 {1075 pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );1076 pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );1077 }1078 }1079 }1080 else if (uiDir >= EDGE_INTRA_IDX)1081 {1082 m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) );1083 if( uiSymbol )1084 {1085 uiDir = EDGE_INTRA_DELTA_IDX;1086 Int iDeltaDC = 0,iDeltaDC0 = 0,iDeltaDC1 = 0;1087 for (Int i = 0; i<2; i++)1088 {1089 xReadExGolombLevel( (UInt &) iDeltaDC, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );1090 if( iDeltaDC != 0 )1091 {1092 UInt uiSign;1093 m_pcTDecBinIf->decodeBinEP( uiSign );1094 if ( uiSign )1095 {1096 iDeltaDC = -iDeltaDC;1097 }1098 }1099 if ( i == 0 ) { iDeltaDC0 = iDeltaDC; }1100 else { iDeltaDC1 = iDeltaDC; }1101 }1102 1103 pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 );1104 pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 );1105 }1106 }1107 else if(bSdcFlag)//SDC mode1108 {1109 assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN);1110 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);1111 pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth);1112 1113 UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2;1114 for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++)1115 {1116 parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg);1117 }1118 }1119 1120 pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth );1121 }1122 #endif1123 Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )1124 {1125 UInt uiSymbol;1126 Int intraPredMode;1127 #if PKU_QC_DEPTH_INTRA_UNI_D01951128 if (pcCU->getSlice()->getSPS()->isDepth())1129 {1130 parseDepthModelingTable(pcCU, uiAbsPartIdx, uiDepth);1131 }1132 if (pcCU->getLumaIntraDir(uiAbsPartIdx)<NUM_INTRA_MODE && !pcCU->getSDCFlag(uiAbsPartIdx))1133 {1134 #else1135 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX1136 UInt uiFlag = 0;1137 if( pcCU->getSlice()->getSPS()->getUseDMM() && (g_uiMaxCUWidth>>uiDepth) <= DMM_WEDGEMODEL_MAX_SIZE )1138 {1139 m_pcTDecBinIf->decodeBin( uiFlag, m_cDmmFlagSCModel.get(0, 0, 0) );1140 }1141 if( uiFlag )1142 {1143 UInt uiDMMode;1144 1145 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX1146 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode = uiSymbol;1147 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode |= uiSymbol << 1;1148 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && g_uiMaxCUWidth>>uiDepth > 4 )1149 {1150 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode |= uiSymbol << 2;1151 }1152 #else1153 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode = uiSymbol;1154 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && g_uiMaxCUWidth>>uiDepth > 4 )1155 {1156 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode |= uiSymbol << 1;1157 }1158 #endif1159 intraPredMode = uiDMMode + NUM_INTRA_MODE;1160 1161 #if HHI_DMM_WEDGE_INTRA1162 if( intraPredMode == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); }1163 if( intraPredMode == DMM_WEDGE_FULL_D_IDX ) { xParseWedgeFullDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); }1164 if( intraPredMode == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); }1165 if( intraPredMode == DMM_WEDGE_PREDDIR_D_IDX ) { xParseWedgePredDirDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); }1166 #endif1167 #if HHI_DMM_PRED_TEX1168 if( intraPredMode == DMM_WEDGE_PREDTEX_D_IDX ) { xParseWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); }1169 #if LGE_DMM3_SIMP_C00441170 if( intraPredMode == DMM_WEDGE_PREDTEX_IDX ) { xParseWedgePredTexInfo ( pcCU, uiAbsPartIdx, uiDepth ); }1171 #endif1172 if( intraPredMode == DMM_CONTOUR_PREDTEX_D_IDX ) { xParseContourPredTexDeltaInfo( pcCU, uiAbsPartIdx, uiDepth ); }1173 #endif1174 }1175 else1176 {1177 #endif1178 1179 #if LGE_EDGE_INTRA_A00701180 Bool bCodeEdgeIntra = false;1181 if( pcCU->getSlice()->getSPS()->isDepth() )1182 {1183 UInt uiPUWidth = pcCU->getWidth( uiAbsPartIdx ) >> (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 1 : 0);1184 if( uiPUWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiPUWidth >= LGE_EDGE_INTRA_MIN_SIZE )1185 bCodeEdgeIntra = true;1186 }1187 #endif1188 #endif1189 Int uiPreds[3] = {-1, -1, -1};1190 Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds);1191 #if !PKU_QC_DEPTH_INTRA_UNI_D01951192 #if LGE_EDGE_INTRA_A00701193 UInt uiCheckBit = 0;1194 #endif1195 #endif1196 1197 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );1198 1199 if ( uiSymbol )1200 {1201 m_pcTDecBinIf->decodeBinEP( uiSymbol );1202 if (uiSymbol)1203 {1204 m_pcTDecBinIf->decodeBinEP( uiSymbol );1205 uiSymbol++;1206 }1207 intraPredMode = uiPreds[uiSymbol];1208 }1209 else1210 {1211 intraPredMode = 0;1212 1213 1214 m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );1215 #if !PKU_QC_DEPTH_INTRA_UNI_D01951216 #if LGE_EDGE_INTRA_A00701217 if (bCodeEdgeIntra)1218 {1219 if (uiSymbol==31)1220 {1221 m_pcTDecBinIf->decodeBinsEP(uiCheckBit,1);1222 if (uiCheckBit)1223 uiSymbol = EDGE_INTRA_IDX;1224 }1225 }1226 #endif1227 #endif1228 intraPredMode = uiSymbol;1229 1230 //postponed sorting of MPMs (only in remaining branch)1231 if (uiPreds[0] > uiPreds[1])1232 {1233 std::swap(uiPreds[0], uiPreds[1]);1234 }1235 if (uiPreds[0] > uiPreds[2])1236 {1237 std::swap(uiPreds[0], uiPreds[2]);1238 }1239 if (uiPreds[1] > uiPreds[2])1240 {1241 std::swap(uiPreds[1], uiPreds[2]);1242 }1243 #if !PKU_QC_DEPTH_INTRA_UNI_D01951244 #if LGE_EDGE_INTRA_A00701245 if ( intraPredMode != EDGE_INTRA_IDX)1246 {1247 #endif1248 #endif1249 for ( Int i = 0; i < uiPredNum; i++ )1250 {1251 intraPredMode += ( intraPredMode >= uiPreds[i] );1252 }1253 #if !PKU_QC_DEPTH_INTRA_UNI_D01951254 #if LGE_EDGE_INTRA_A00701255 }1256 #endif1257 #endif1258 }1259 1260 #if !PKU_QC_DEPTH_INTRA_UNI_D01951261 #if LGE_EDGE_INTRA_A00701262 if( intraPredMode == EDGE_INTRA_IDX )1263 {1264 xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth );1265 #if LGE_EDGE_INTRA_DELTA_DC1266 m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) );1267 if( uiSymbol )1268 {1269 intraPredMode = EDGE_INTRA_DELTA_IDX;1270 Int iDeltaDC0;1271 Int iDeltaDC1;1272 1273 xReadExGolombLevel( (UInt &) iDeltaDC0, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );1274 if( iDeltaDC0 != 0 )1275 {1276 UInt uiSign;1277 m_pcTDecBinIf->decodeBinEP( uiSign );1278 if ( uiSign )1279 {1280 iDeltaDC0 = -iDeltaDC0;1281 }1282 }1283 xReadExGolombLevel( (UInt &) iDeltaDC1, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );1284 if( iDeltaDC1 != 0 )1285 {1286 UInt uiSign;1287 m_pcTDecBinIf->decodeBinEP( uiSign );1288 if ( uiSign )1289 {1290 iDeltaDC1 = -iDeltaDC1;1291 }1292 }1293 1294 pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 );1295 pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 );1296 }1297 #endif1298 }1299 #endif1300 1301 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX1302 }1303 #endif1304 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth );1305 #else1306 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth );1307 }1308 #endif1309 }1310 1311 Void TDecSbac::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )1312 {1313 UInt uiSymbol;1314 1120 1315 1121 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) ); … … 1317 1123 if( uiSymbol == 0 ) 1318 1124 { 1125 #if H_MV_ENC_DEC_TRAC 1126 DTRACE_CU("intra_chroma_pred_mode", uiSymbol ) 1127 #endif 1319 1128 uiSymbol = DM_CHROMA_IDX; 1320 1129 } 1321 1130 else 1322 1131 { 1323 if( pcCU->getSlice()->getSPS()->getUseLMChroma() )1324 {1325 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 1 ) );1326 }1327 else1328 {1329 uiSymbol = 1;1330 }1331 1332 if( uiSymbol == 0 )1333 {1334 uiSymbol = LM_CHROMA_IDX;1335 }1336 else1337 1132 { 1338 1133 UInt uiIPredMode; 1339 1134 m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 ); 1135 #if H_MV_ENC_DEC_TRAC 1136 DTRACE_CU("intra_chroma_pred_mode", uiIPredMode ) 1137 #endif 1340 1138 UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ]; 1341 1139 pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir ); … … 1347 1145 } 1348 1146 1349 Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth ) 1147 #if H_3D_DIM 1148 Void TDecSbac::parseIntraDepth( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 1149 { 1150 parseIntraDepthMode( pcCU, absPartIdx, depth ); 1151 1152 UInt dir = pcCU->getLumaIntraDir( absPartIdx ); 1153 UInt dimType = getDimType( dir ); 1154 1155 switch( dimType ) 1156 { 1157 #if H_3D_DIM_DMM 1158 case( DMM1_IDX ): 1159 { 1160 UInt uiTabIdx = 0; 1161 xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); 1162 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth ); 1163 } break; 1164 #if !SEC_DMM2_E0146 1165 case( DMM2_IDX ): 1166 { 1167 Int iOffset = 0; 1168 xParseDmm2Offset( iOffset ); 1169 pcCU->setDmm2DeltaEndSubParts( iOffset, absPartIdx, depth ); 1170 } break; 1171 #endif 1172 case( DMM3_IDX ): 1173 { 1174 UInt uiIntraIdx = 0; 1175 xParseDmm3WedgeIdx( uiIntraIdx, g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); 1176 pcCU->setDmm3IntraTabIdxSubParts( uiIntraIdx, absPartIdx, depth ); 1177 } break; 1178 case( DMM4_IDX ): break; 1179 #endif 1180 #if H_3D_DIM_RBC 1181 case( RBC_IDX ): 1182 { 1183 xParseRbcEdge( pcCU, absPartIdx, depth ); 1184 } break; 1185 #endif 1186 default: break; 1187 } 1188 1189 #if H_3D_DIM_SDC 1190 if( pcCU->getSDCFlag(absPartIdx) ) 1191 { 1192 assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N); 1193 pcCU->setTrIdxSubParts(0, absPartIdx, depth); 1194 pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth); 1195 1196 UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2; 1197 for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1198 { 1199 xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg); 1200 } 1201 } 1202 else 1203 { 1204 #endif 1205 if( dimType < DIM_NUM_TYPE ) 1206 { 1207 UInt symbol; 1208 m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) ); 1209 if( symbol ) 1210 { 1211 dir += symbol; 1212 for( UInt segment = 0; segment < 2; segment++ ) 1213 { 1214 Pel valDeltaDC = 0; 1215 xParseDimDeltaDC( valDeltaDC, dimType ); 1216 pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC ); 1217 } 1218 } 1219 } 1220 #if H_3D_DIM_SDC 1221 } 1222 #endif 1223 1224 pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); 1225 } 1226 1227 Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) 1228 { 1229 UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 ); 1230 UInt dir = 0; 1231 Bool sdcFlag = 0; 1232 UInt symbol = 1; 1233 UInt modeCode = 0 ; 1234 UInt binNum = 0; 1235 UInt ctxDepthMode = 0; 1236 1237 if( puIdx == 2 ) 1238 { 1239 #if !LGE_SDC_REMOVE_DC_E0158 1240 while( binNum < 2 && symbol ) 1241 #endif 1242 { 1243 ctxDepthMode = puIdx*3 + binNum; 1244 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1245 modeCode = (modeCode<<1) + symbol; 1246 binNum++; 1247 } 1248 if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;} 1249 #if LGE_SDC_REMOVE_DC_E0158 1250 else if( modeCode == 1 ) { dir = 0; sdcFlag = 0;} 1251 #else 1252 else if( modeCode == 2 ) { dir = 0; sdcFlag = 0;} 1253 else if( modeCode == 3 ) { dir = DC_IDX; sdcFlag = 1;} 1254 #endif 1255 } 1256 else if( puIdx == 0 ) 1257 { 1258 while( binNum < 3 && symbol ) 1259 { 1260 ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum); 1261 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1262 modeCode = (modeCode<<1) + symbol; 1263 binNum++; 1264 } 1265 if( modeCode == 0 ) { dir = 0; sdcFlag = 0;} 1266 else if( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;} 1267 else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;} 1268 else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} 1269 } 1270 else 1271 { 1272 #if ZJU_DEPTH_INTRA_MODE_E0204 1273 UInt maxBinNum = 0; 1274 m_pcTDecBinIf->decodeBinEP(symbol); 1275 if( symbol == 1 ) 1276 { 1277 maxBinNum = 3; 1278 } 1279 else 1280 { 1281 maxBinNum = 2; 1282 symbol = 1; 1283 } 1284 while( binNum<maxBinNum && symbol ) 1285 { 1286 ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum ); 1287 m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode)); 1288 modeCode = (modeCode<<1)+symbol; 1289 binNum++; 1290 } 1291 if( maxBinNum == 3 ) 1292 { 1293 if ( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;} 1294 else if ( modeCode == 2 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} 1295 else if ( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;} 1296 else if ( modeCode == 7 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;} 1297 } 1298 else 1299 { 1300 if ( modeCode == 0 ) { dir = 5; sdcFlag = 0;} 1301 else if ( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;} 1302 else if ( modeCode == 3 ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;} 1303 } 1304 #else 1305 ctxDepthMode = puIdx*3 ; 1306 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1307 modeCode = (modeCode<<1) + symbol; 1308 if( !symbol ) 1309 { 1310 ctxDepthMode = puIdx*3 + 1; 1311 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1312 modeCode = (modeCode<<1) + symbol; 1313 if( symbol ) 1314 { 1315 ctxDepthMode = puIdx*3 + 2; 1316 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1317 modeCode = (modeCode<<1) + symbol; 1318 } 1319 } 1320 else 1321 { 1322 ctxDepthMode = puIdx*3 + 1; 1323 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1324 modeCode = (modeCode<<1) + symbol; 1325 if( !symbol ) 1326 { 1327 ctxDepthMode = puIdx*3 + 2; 1328 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1329 modeCode = (modeCode<<1) + symbol; 1330 } 1331 else 1332 { 1333 binNum = 0; 1334 #if LGE_SDC_REMOVE_DC_E0158 1335 #if !SEC_DMM2_E0146 1336 while( symbol && binNum < 2 ) 1337 #endif 1338 #else 1339 #if SEC_DMM2_E0146 1340 while( symbol && binNum < 2 ) 1341 #else 1342 while( symbol && binNum < 3 ) 1343 #endif 1344 #endif 1345 { 1346 ctxDepthMode = puIdx*3 + 2; 1347 m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); 1348 modeCode = (modeCode<<1) + symbol; 1349 binNum++; 1350 } 1351 } 1352 } 1353 if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;} 1354 else if( modeCode == 2 ) { dir = 5; sdcFlag = 0;} 1355 else if( modeCode == 3 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;} 1356 else if( modeCode == 4 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;} 1357 else if( modeCode == 5 ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;} 1358 else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;} 1359 #if LGE_SDC_REMOVE_DC_E0158 1360 #if SEC_DMM2_E0146 1361 else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} 1362 #else 1363 else if( modeCode == 14 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} 1364 else if( modeCode == 15 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;} 1365 #endif 1366 #else 1367 else if( modeCode == 14 ) { dir = DC_IDX; sdcFlag = 1;} 1368 #if SEC_DMM2_E0146 1369 else if( modeCode == 15 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} 1370 #else 1371 else if( modeCode == 30 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} 1372 else if( modeCode == 31 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;} 1373 #endif 1374 #endif 1375 #endif 1376 } 1377 pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); 1378 #if H_3D_DIM_SDC 1379 pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, depth ); 1380 #endif 1381 } 1382 #endif 1383 1384 Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ) 1350 1385 { 1351 1386 UInt uiSymbol; 1352 1387 const UInt uiCtx = pcCU->getCtxInterDir( uiAbsPartIdx ); 1353 1388 ContextModel *pCtx = m_cCUInterDirSCModel.get( 0 ); 1354 m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + uiCtx ) ); 1389 uiSymbol = 0; 1390 if (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N || pcCU->getHeight(uiAbsPartIdx) != 8 ) 1391 { 1392 m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + uiCtx ) ); 1393 } 1355 1394 1356 1395 if( uiSymbol ) 1357 1396 { 1358 1397 uiSymbol = 2; 1398 } 1399 else 1400 { 1401 m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + 4 ) ); 1402 assert(uiSymbol == 0 || uiSymbol == 1); 1359 1403 } 1360 1404 1361 1405 uiSymbol++; 1362 1406 ruiInterDir = uiSymbol; 1407 #if H_MV_ENC_DEC_TRAC 1408 DTRACE_PU("inter_pred_idc", ruiInterDir - 1 ) 1409 #endif 1410 1363 1411 return; 1364 1412 } 1365 1413 1366 Void TDecSbac::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth,RefPicList eRefList )1414 Void TDecSbac::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ) 1367 1415 { 1368 1416 UInt uiSymbol; 1369 1370 if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C ) > 0 && eRefList==REF_PIC_LIST_C)1371 1417 { 1372 1418 ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); … … 1375 1421 if( uiSymbol ) 1376 1422 { 1377 xReadUnaryMaxSymbol( uiSymbol, pCtx + 1, 1, pcCU->getSlice()->getNumRefIdx( REF_PIC_LIST_C )-2 ); 1378 uiSymbol++; 1423 UInt uiRefNum = pcCU->getSlice()->getNumRefIdx( eRefList ) - 2; 1424 pCtx++; 1425 UInt ui; 1426 for( ui = 0; ui < uiRefNum; ++ui ) 1427 { 1428 if( ui == 0 ) 1429 { 1430 m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); 1431 } 1432 else 1433 { 1434 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 1435 } 1436 if( uiSymbol == 0 ) 1437 { 1438 break; 1439 } 1440 } 1441 uiSymbol = ui + 1; 1379 1442 } 1380 1443 riRefFrmIdx = uiSymbol; 1381 1444 } 1445 1446 #if H_MV_ENC_DEC_TRAC 1447 #if ENC_DEC_TRACE 1448 if ( eRefList == REF_PIC_LIST_0 ) 1449 { 1450 DTRACE_PU("ref_idx_l0", uiSymbol) 1451 } 1382 1452 else 1383 1453 { 1384 ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); 1385 m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); 1386 1387 if( uiSymbol ) 1388 { 1389 xReadUnaryMaxSymbol( uiSymbol, pCtx + 1, 1, pcCU->getSlice()->getNumRefIdx( eRefList )-2 ); 1390 uiSymbol++; 1391 } 1392 riRefFrmIdx = uiSymbol; 1393 } 1394 1454 DTRACE_PU("ref_idx_l1", uiSymbol) 1455 } 1456 #endif 1457 #endif 1395 1458 return; 1396 1459 } … … 1412 1475 else 1413 1476 { 1414 1415 1477 m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx ); 1416 1478 m_pcTDecBinIf->decodeBin( uiVerAbs, *pCtx ); … … 1465 1527 { 1466 1528 m_pcTDecBinIf->decodeBin( ruiSubdivFlag, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiLog2TransformBlockSize ) ); 1529 #if !H_MV_ENC_DEC_TRAC 1467 1530 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 1468 1531 DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" ) … … 1472 1535 DTRACE_CABAC_V( uiLog2TransformBlockSize ) 1473 1536 DTRACE_CABAC_T( "\n" ) 1474 } 1475 1476 Void TDecSbac::parseQtRootCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ) 1537 #endif 1538 } 1539 1540 Void TDecSbac::parseQtRootCbf( UInt uiAbsPartIdx, UInt& uiQtRootCbf ) 1477 1541 { 1478 1542 UInt uiSymbol; 1479 1543 const UInt uiCtx = 0; 1480 1544 m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) ); 1545 #if !H_MV_ENC_DEC_TRAC 1481 1546 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 1482 1547 DTRACE_CABAC_T( "\tparseQtRootCbf()" ) … … 1488 1553 DTRACE_CABAC_V( uiAbsPartIdx ) 1489 1554 DTRACE_CABAC_T( "\n" ) 1555 #else 1556 DTRACE_CU( "rqt_root_cbf", uiSymbol ) 1557 #endif 1490 1558 1491 1559 uiQtRootCbf = uiSymbol; … … 1498 1566 Int iDQp; 1499 1567 1500 m_pcTDecBinIf->decodeBin( uiDQp, m_cCUDeltaQpSCModel.get( 0, 0, 0 ) ); 1501 1502 if ( uiDQp == 0 ) 1503 { 1504 qp = pcCU->getRefQP(uiAbsPartIdx); 1505 } 1506 else 1568 UInt uiSymbol; 1569 1570 xReadUnaryMaxSymbol (uiDQp, &m_cCUDeltaQpSCModel.get( 0, 0, 0 ), 1, CU_DQP_TU_CMAX); 1571 1572 if( uiDQp >= CU_DQP_TU_CMAX) 1573 { 1574 xReadEpExGolomb( uiSymbol, CU_DQP_EG_k ); 1575 uiDQp+=uiSymbol; 1576 } 1577 1578 if ( uiDQp > 0 ) 1507 1579 { 1508 1580 UInt uiSign; 1509 1581 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 1510 1582 m_pcTDecBinIf->decodeBinEP(uiSign); 1511 1512 UInt uiMaxAbsDQpMinus1 = 24 + (qpBdOffsetY/2) + (uiSign); 1513 UInt uiAbsDQpMinus1; 1514 xReadUnaryMaxSymbol (uiAbsDQpMinus1, &m_cCUDeltaQpSCModel.get( 0, 0, 1 ), 1, uiMaxAbsDQpMinus1); 1515 1516 iDQp = uiAbsDQpMinus1 + 1; 1517 1583 iDQp = uiDQp; 1518 1584 if(uiSign) 1519 1585 { 1520 1586 iDQp = -iDQp; 1521 1587 } 1522 1523 1588 qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY; 1524 1589 } 1525 1526 UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ; 1527 UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; 1528 pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); 1590 else 1591 { 1592 qp = pcCU->getRefQP(uiAbsPartIdx); 1593 } 1594 pcCU->setQPSubParts(qp, uiAbsPartIdx, uiDepth); 1595 pcCU->setCodedQP(qp); 1529 1596 } 1530 1597 … … 1532 1599 { 1533 1600 UInt uiSymbol; 1534 const UInt uiCtx = pcCU->getCtxQtCbf( uiAbsPartIdx,eType, uiTrDepth );1601 const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth ); 1535 1602 m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) ); 1536 1603 #if !H_MV_ENC_DEC_TRAC 1537 1604 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 1538 1605 DTRACE_CABAC_T( "\tparseQtCbf()" ) … … 1546 1613 DTRACE_CABAC_V( uiAbsPartIdx ) 1547 1614 DTRACE_CABAC_T( "\n" ) 1615 #endif 1548 1616 1549 1617 pcCU->setCbfSubParts( uiSymbol << uiTrDepth, eType, uiAbsPartIdx, uiDepth ); 1618 } 1619 1620 void TDecSbac::parseTransformSkipFlags (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType) 1621 { 1622 if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) 1623 { 1624 return; 1625 } 1626 if(width != 4 || height != 4) 1627 { 1628 return; 1629 } 1630 1631 UInt useTransformSkip; 1632 m_pcTDecBinIf->decodeBin( useTransformSkip , m_cTransformSkipSCModel.get( 0, eTType? TEXT_CHROMA: TEXT_LUMA, 0 ) ); 1633 if(eTType!= TEXT_LUMA) 1634 { 1635 const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - uiDepth; 1636 if(uiLog2TrafoSize == 2) 1637 { 1638 uiDepth --; 1639 } 1640 } 1641 #if !H_MV_ENC_DEC_TRAC 1642 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 1643 DTRACE_CABAC_T("\tparseTransformSkip()"); 1644 DTRACE_CABAC_T( "\tsymbol=" ) 1645 DTRACE_CABAC_V( useTransformSkip ) 1646 DTRACE_CABAC_T( "\tAddr=" ) 1647 DTRACE_CABAC_V( pcCU->getAddr() ) 1648 DTRACE_CABAC_T( "\tetype=" ) 1649 DTRACE_CABAC_V( eTType ) 1650 DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) 1651 DTRACE_CABAC_V( uiAbsPartIdx ) 1652 DTRACE_CABAC_T( "\n" ) 1653 #endif 1654 1655 pcCU->setTransformSkipSubParts( useTransformSkip, eTType, uiAbsPartIdx, uiDepth); 1550 1656 } 1551 1657 … … 1566 1672 ContextModel *pCtxY = m_cCuCtxLastY.get( 0, eTType ); 1567 1673 1674 Int blkSizeOffsetX, blkSizeOffsetY, shiftX, shiftY; 1675 blkSizeOffsetX = eTType ? 0: (g_aucConvertToBit[ width ] *3 + ((g_aucConvertToBit[ width ] +1)>>2)); 1676 blkSizeOffsetY = eTType ? 0: (g_aucConvertToBit[ height ]*3 + ((g_aucConvertToBit[ height ]+1)>>2)); 1677 shiftX= eTType ? g_aucConvertToBit[ width ] :((g_aucConvertToBit[ width ]+3)>>2); 1678 shiftY= eTType ? g_aucConvertToBit[ height ] :((g_aucConvertToBit[ height ]+3)>>2); 1568 1679 // posX 1569 Int widthCtx = eTType ? 4 : width;1570 const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ widthCtx ] * ( g_aucConvertToBit[ widthCtx ] + 3 ) );1571 1680 for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ ) 1572 1681 { 1573 if ( eTType ) 1574 { 1575 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + (uiPosLastX>>g_aucConvertToBit[ width ]) ) ); 1576 } 1577 else 1578 { 1579 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + puiCtxIdxX[ uiPosLastX ] ) ); 1580 } 1682 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + blkSizeOffsetX + (uiPosLastX >>shiftX) ) ); 1581 1683 if( !uiLast ) 1582 1684 { … … 1586 1688 1587 1689 // posY 1588 Int heightCtx = eTType? 4 : height;1589 const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ heightCtx ] * ( g_aucConvertToBit[ heightCtx ] + 3 ) );1590 1690 for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ ) 1591 1691 { 1592 if (eTType) 1593 { 1594 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + (uiPosLastY>>g_aucConvertToBit[ height ]) ) ); 1595 } 1596 else 1597 { 1598 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + puiCtxIdxY[ uiPosLastY ] ) ); 1599 } 1692 m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + blkSizeOffsetY + (uiPosLastY >>shiftY)) ); 1600 1693 if( !uiLast ) 1601 1694 { … … 1634 1727 Void TDecSbac::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) 1635 1728 { 1729 #if !H_MV_ENC_DEC_TRAC 1636 1730 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 1637 1731 DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" ) … … 1658 1752 DTRACE_CABAC_V( pcCU->getPredictionMode( uiAbsPartIdx ) ) 1659 1753 DTRACE_CABAC_T( "\n" ) 1754 #endif 1660 1755 1661 1756 if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() ) … … 1664 1759 uiHeight = pcCU->getSlice()->getSPS()->getMaxTrSize(); 1665 1760 } 1666 1761 if(pcCU->getSlice()->getPPS()->getUseTransformSkip()) 1762 { 1763 parseTransformSkipFlags( pcCU, uiAbsPartIdx, uiWidth, uiHeight, uiDepth, eTType); 1764 } 1765 1667 1766 eTType = eTType == TEXT_LUMA ? TEXT_LUMA : ( eTType == TEXT_NONE ? TEXT_NONE : TEXT_CHROMA ); 1668 1767 … … 1672 1771 const UInt uiMaxNumCoeffM1 = uiMaxNumCoeff - 1; 1673 1772 UInt uiScanIdx = pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, eTType==TEXT_LUMA, pcCU->isIntra(uiAbsPartIdx)); 1674 int blockType = uiLog2BlockSize;1675 if (uiWidth != uiHeight)1676 {1677 uiScanIdx = SCAN_DIAG;1678 blockType = 4;1679 }1680 1773 1681 1774 //===== decode last significant ===== … … 1686 1779 1687 1780 //===== decode significance flags ===== 1688 UInt uiScanPosLast = uiBlkPosLast; 1689 if (uiScanIdx == SCAN_ZIGZAG) 1690 { 1691 // Map zigzag to diagonal scan 1692 uiScanIdx = SCAN_DIAG; 1693 } 1694 const UInt * scan; 1695 if (uiWidth == uiHeight) 1696 { 1697 scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; 1698 } 1699 else 1700 { 1701 scan = g_sigScanNSQT[ uiLog2BlockSize - 2 ]; 1702 } 1781 UInt uiScanPosLast; 1782 const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; 1703 1783 for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) 1704 1784 { … … 1714 1794 1715 1795 const Int iLastScanSet = uiScanPosLast >> LOG2_SCAN_SET_SIZE; 1716 UInt uiNumOne = 0;1796 UInt c1 = 1; 1717 1797 UInt uiGoRiceParam = 0; 1718 1798 1719 UInt const tsig = pcCU->getSlice()->getPPS()->getTSIG();1720 #if LOSSLESS_CODING1721 1799 Bool beValid; 1722 if (pcCU-> isLosslessCoded(uiAbsPartIdx))1800 if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) 1723 1801 { 1724 1802 beValid = false; … … 1728 1806 beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0; 1729 1807 } 1730 #else1731 Bool beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0;1732 #endif1733 1808 UInt absSum = 0; 1734 1809 … … 1737 1812 const UInt uiNumBlkSide = uiWidth >> (MLS_CG_SIZE >> 1); 1738 1813 const UInt * scanCG; 1739 if (uiWidth == uiHeight)1740 1814 { 1741 1815 scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ]; … … 1748 1822 scanCG = g_sigLastScanCG32x32; 1749 1823 } 1750 }1751 else1752 {1753 scanCG = g_sigCGScanNSQT[ uiLog2BlockSize - 2 ];1754 1824 } 1755 1825 Int iScanPosSig = (Int) uiScanPosLast; … … 1772 1842 } 1773 1843 1774 // decode significant_coeffgroup_flag 1775 Int iCGBlkPos = scanCG[ iSubSet ]; 1776 Int iCGPosY = iCGBlkPos / uiNumBlkSide; 1777 Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); 1778 if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) ) 1779 { 1780 iCGPosY = (uiScanIdx == SCAN_HOR ? iCGBlkPos : 0); 1781 iCGPosX = (uiScanIdx == SCAN_VER ? iCGBlkPos : 0); 1782 } 1783 if( iSubSet == iLastScanSet || iSubSet == 0) 1784 { 1785 uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; 1786 } 1787 else 1788 { 1789 UInt uiSigCoeffGroup; 1790 UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight ); 1791 m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); 1792 uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; 1793 } 1794 1795 // decode significant_coeff_flag 1796 UInt uiBlkPos, uiPosY, uiPosX, uiSig, uiCtxSig; 1797 for( ; iScanPosSig >= iSubPos; iScanPosSig-- ) 1798 { 1799 uiBlkPos = scan[ iScanPosSig ]; 1800 uiPosY = uiBlkPos >> uiLog2BlockSize; 1801 uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize ); 1802 uiSig = 0; 1803 1804 if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) 1844 // decode significant_coeffgroup_flag 1845 Int iCGBlkPos = scanCG[ iSubSet ]; 1846 Int iCGPosY = iCGBlkPos / uiNumBlkSide; 1847 Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); 1848 if( iSubSet == iLastScanSet || iSubSet == 0) 1849 { 1850 uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; 1851 } 1852 else 1853 { 1854 UInt uiSigCoeffGroup; 1855 UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); 1856 m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); 1857 uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; 1858 } 1859 1860 // decode significant_coeff_flag 1861 Int patternSigCtx = TComTrQuant::calcPatternSigCtx( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); 1862 UInt uiBlkPos, uiPosY, uiPosX, uiSig, uiCtxSig; 1863 for( ; iScanPosSig >= iSubPos; iScanPosSig-- ) 1864 { 1865 uiBlkPos = scan[ iScanPosSig ]; 1866 uiPosY = uiBlkPos >> uiLog2BlockSize; 1867 uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize ); 1868 uiSig = 0; 1869 1870 if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) 1871 { 1872 if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) 1805 1873 { 1806 if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) 1807 { 1808 uiCtxSig = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType ); 1809 m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] ); 1810 } 1811 else 1812 { 1813 uiSig = 1; 1814 } 1874 uiCtxSig = TComTrQuant::getSigCtxInc( patternSigCtx, uiScanIdx, uiPosX, uiPosY, uiLog2BlockSize, eTType ); 1875 m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] ); 1815 1876 } 1816 pcCoef[ uiBlkPos ] = uiSig; 1817 if( uiSig ) 1877 else 1818 1878 { 1819 pos[ numNonZero ] = uiBlkPos; 1820 numNonZero ++; 1821 if( lastNZPosInCG == -1 ) 1822 { 1823 lastNZPosInCG = iScanPosSig; 1824 } 1825 firstNZPosInCG = iScanPosSig; 1879 uiSig = 1; 1826 1880 } 1827 1881 } 1828 1882 pcCoef[ uiBlkPos ] = uiSig; 1883 if( uiSig ) 1884 { 1885 pos[ numNonZero ] = uiBlkPos; 1886 numNonZero ++; 1887 if( lastNZPosInCG == -1 ) 1888 { 1889 lastNZPosInCG = iScanPosSig; 1890 } 1891 firstNZPosInCG = iScanPosSig; 1892 } 1893 } 1829 1894 1830 1895 if( numNonZero ) 1831 1896 { 1832 Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= (Int)tsig);1897 Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= SBH_THRESHOLD ); 1833 1898 absSum = 0; 1834 1835 UInt c1 = 1;1836 1899 UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0; 1837 1900 UInt uiBin; 1838 1839 if( uiNumOne > 0 ) 1901 if( c1 == 0 ) 1840 1902 { 1841 1903 uiCtxSet++; 1842 1904 } 1843 1844 uiNumOne >>= 1; 1905 c1 = 1; 1845 1906 ContextModel *baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUOneSCModel.get( 0, 0 ) + 4 * uiCtxSet : m_cCUOneSCModel.get( 0, 0 ) + NUM_ONE_FLAG_CTX_LUMA + 4 * uiCtxSet; 1846 1907 Int absCoeff[SCAN_SET_SIZE]; … … 1900 1961 { 1901 1962 UInt uiLevel; 1902 xRead GoRiceExGolomb( uiLevel, uiGoRiceParam );1963 xReadCoefRemainExGolomb( uiLevel, uiGoRiceParam ); 1903 1964 absCoeff[ idx ] = uiLevel + baseLevel; 1965 if(absCoeff[idx]>3*(1<<uiGoRiceParam)) 1966 { 1967 uiGoRiceParam = min<UInt>(uiGoRiceParam+ 1, 4); 1968 } 1904 1969 } 1905 1970 … … 1907 1972 { 1908 1973 iFirstCoeff2 = 0; 1909 uiNumOne++;1910 1974 } 1911 1975 } … … 1923 1987 // Infer sign of 1st element. 1924 1988 if (absSum&0x1) 1989 { 1925 1990 pcCoef[ blkPos ] = -pcCoef[ blkPos ]; 1991 } 1926 1992 } 1927 1993 else … … 1933 1999 } 1934 2000 } 1935 else1936 {1937 uiNumOne >>= 1;1938 }1939 2001 } 1940 2002 … … 1942 2004 } 1943 2005 1944 #if LGE_SAO_MIGRATION_D0091 2006 1945 2007 Void TDecSbac::parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ) 1946 2008 { 1947 if (maxSymbol == 0) 1948 { 1949 val = 0; 1950 return; 1951 } 1952 1953 UInt code; 1954 Int i; 2009 if (maxSymbol == 0) 2010 { 2011 val = 0; 2012 return; 2013 } 2014 2015 UInt code; 2016 Int i; 2017 m_pcTDecBinIf->decodeBinEP( code ); 2018 if ( code == 0 ) 2019 { 2020 val = 0; 2021 return; 2022 } 2023 2024 i=1; 2025 while (1) 2026 { 1955 2027 m_pcTDecBinIf->decodeBinEP( code ); 1956 2028 if ( code == 0 ) 1957 2029 { 1958 val = 0; 1959 return; 1960 } 1961 1962 i=1; 1963 while (1) 1964 { 1965 m_pcTDecBinIf->decodeBinEP( code ); 1966 if ( code == 0 ) 1967 { 1968 break; 1969 } 1970 i++; 1971 if (i == maxSymbol) 1972 { 1973 break; 1974 } 1975 } 1976 1977 val = i; 1978 } 1979 2030 break; 2031 } 2032 i++; 2033 if (i == maxSymbol) 2034 { 2035 break; 2036 } 2037 } 2038 2039 val = i; 2040 } 1980 2041 Void TDecSbac::parseSaoUflc (UInt uiLength, UInt& riVal) 1981 2042 { 1982 m_pcTDecBinIf->decodeBinsEP ( riVal, uiLength ); 1983 } 1984 2043 m_pcTDecBinIf->decodeBinsEP ( riVal, uiLength ); 2044 } 1985 2045 Void TDecSbac::parseSaoMerge (UInt& ruiVal) 1986 2046 { 1987 UInt uiCode; 1988 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeSCModel.get( 0, 0, 0 ) ); 1989 ruiVal = (Int)uiCode; 1990 } 1991 2047 UInt uiCode; 2048 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeSCModel.get( 0, 0, 0 ) ); 2049 ruiVal = (Int)uiCode; 2050 } 1992 2051 Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) 1993 2052 { 1994 UInt uiCode; 1995 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 1996 if (uiCode == 0) 1997 { 1998 ruiVal = 0; 2053 UInt uiCode; 2054 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 2055 if (uiCode == 0) 2056 { 2057 ruiVal = 0; 2058 } 2059 else 2060 { 2061 m_pcTDecBinIf->decodeBinEP( uiCode ); 2062 if (uiCode == 0) 2063 { 2064 ruiVal = 5; 1999 2065 } 2000 2066 else 2001 2067 { 2002 m_pcTDecBinIf->decodeBinEP( uiCode ); 2003 if (uiCode == 0) 2004 { 2005 ruiVal = 5; 2006 } 2007 else 2008 { 2009 ruiVal = 1; 2010 } 2011 } 2012 } 2013 2014 inline Void copySaoOneLcuParam(SaoLcuParam* psDst, SaoLcuParam* psSrc) 2015 { 2016 Int i; 2017 psDst->partIdx = psSrc->partIdx; 2018 psDst->typeIdx = psSrc->typeIdx; 2019 if (psDst->typeIdx != -1) 2020 { 2021 psDst->subTypeIdx = psSrc->subTypeIdx ; 2022 psDst->length = psSrc->length; 2023 for (i=0;i<psDst->length;i++) 2024 { 2025 psDst->offset[i] = psSrc->offset[i]; 2026 } 2027 } 2028 else 2029 { 2030 psDst->length = 0; 2031 for (i=0;i<SAO_BO_LEN;i++) 2032 { 2033 psDst->offset[i] = 0; 2034 } 2035 } 2036 } 2037 2038 Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam, UInt compIdx) 2039 { 2040 UInt uiSymbol; 2041 static Int iTypeLength[MAX_NUM_SAO_TYPE] = 2042 { 2043 SAO_EO_LEN, 2044 SAO_EO_LEN, 2045 SAO_EO_LEN, 2046 SAO_EO_LEN, 2047 SAO_BO_LEN 2048 }; 2049 2050 if (compIdx==2) 2051 { 2052 uiSymbol = (UInt)( psSaoLcuParam->typeIdx + 1); 2053 } 2054 else 2055 { 2056 parseSaoTypeIdx(uiSymbol); 2057 } 2058 psSaoLcuParam->typeIdx = (Int)uiSymbol - 1; 2059 2060 if (uiSymbol) 2061 { 2062 psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx]; 2063 #if FULL_NBIT 2064 Int offsetTh = 1 << ( min((Int)(g_uiBitDepth + (g_uiBitDepth-8)-5),5) ); 2065 #else 2066 Int offsetTh = 1 << ( min((Int)(g_uiBitDepth + g_uiBitIncrement-5),5) ); 2067 #endif 2068 2069 if( psSaoLcuParam->typeIdx == SAO_BO ) 2070 { 2071 for(Int i=0; i< psSaoLcuParam->length; i++) 2072 { 2073 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); 2074 psSaoLcuParam->offset[i] = uiSymbol; 2075 } 2076 for(Int i=0; i< psSaoLcuParam->length; i++) 2077 { 2078 if (psSaoLcuParam->offset[i] != 0) 2079 { 2080 m_pcTDecBinIf->decodeBinEP ( uiSymbol); 2081 if (uiSymbol) 2082 { 2083 psSaoLcuParam->offset[i] = -psSaoLcuParam->offset[i] ; 2084 } 2085 } 2086 } 2087 parseSaoUflc(5, uiSymbol ); 2088 psSaoLcuParam->subTypeIdx = uiSymbol; 2089 } 2090 else if( psSaoLcuParam->typeIdx < 4 ) 2091 { 2092 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[0] = uiSymbol; 2093 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[1] = uiSymbol; 2094 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[2] = -(Int)uiSymbol; 2095 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[3] = -(Int)uiSymbol; 2096 if (compIdx != 2) 2097 { 2098 parseSaoUflc(2, uiSymbol ); 2099 psSaoLcuParam->subTypeIdx = uiSymbol; 2100 psSaoLcuParam->typeIdx += psSaoLcuParam->subTypeIdx; 2101 } 2102 } 2103 } 2104 else 2105 { 2106 psSaoLcuParam->length = 0; 2107 } 2108 } 2109 2110 Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp) 2111 { 2112 Int iAddr = pcCU->getAddr(); 2113 UInt uiSymbol; 2114 2115 for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) 2116 { 2117 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; 2118 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; 2119 pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; 2120 pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx =-1; 2121 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0] = 0; 2122 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[1] = 0; 2123 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[2] = 0; 2124 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3] = 0; 2125 } 2126 if (pSaoParam->bSaoFlag[0] || pSaoParam->bSaoFlag[1] ) 2127 { 2128 if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) 2129 { 2130 parseSaoMerge(uiSymbol); 2131 pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag = (Bool)uiSymbol; 2132 } 2133 if (pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag==0) 2134 { 2135 if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) 2136 { 2137 parseSaoMerge(uiSymbol); 2138 pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag = (Bool)uiSymbol; 2139 } 2140 } 2141 } 2142 2143 for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) 2144 { 2145 if ((iCompIdx == 0 && pSaoParam->bSaoFlag[0]) || (iCompIdx > 0 && pSaoParam->bSaoFlag[1]) ) 2146 { 2147 if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) 2148 { 2149 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag; 2150 } 2151 else 2152 { 2153 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; 2154 } 2155 2156 if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0) 2157 { 2158 if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) 2159 { 2160 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag; 2161 } 2162 else 2163 { 2164 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; 2165 } 2166 2167 if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag) 2168 { 2169 pSaoParam->saoLcuParam[2][iAddr].typeIdx = pSaoParam->saoLcuParam[1][iAddr].typeIdx; 2170 parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr]), iCompIdx); 2171 } 2172 else 2173 { 2174 copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-pSaoParam->numCuInWidth]); 2175 } 2176 } 2177 else 2178 { 2179 copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-1]); 2180 } 2181 } 2182 else 2183 { 2184 pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; 2185 pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; 2186 } 2187 } 2188 } 2189 #else 2190 Void TDecSbac::parseSaoUvlc (UInt& ruiVal) 2191 { 2192 UInt uiCode; 2193 Int i; 2194 2195 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoUvlcSCModel.get( 0, 0, 0 ) ); 2196 if ( uiCode == 0 ) 2197 { 2198 ruiVal = 0; 2199 return; 2200 } 2201 2202 i=1; 2203 while (1) 2204 { 2205 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoUvlcSCModel.get( 0, 0, 1 ) ); 2206 if ( uiCode == 0 ) break; 2207 i++; 2208 } 2209 2210 ruiVal = i; 2211 } 2212 2213 Void TDecSbac::parseSaoSvlc (Int& riVal) 2214 { 2215 UInt uiCode; 2216 Int iSign; 2217 Int i; 2218 2219 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoSvlcSCModel.get( 0, 0, 0 ) ); 2220 2221 if ( uiCode == 0 ) 2222 { 2223 riVal = 0; 2224 return; 2225 } 2226 2227 // read sign 2228 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoSvlcSCModel.get( 0, 0, 1 ) ); 2229 2230 if ( uiCode == 0 ) 2231 { 2232 iSign = 1; 2233 } 2234 else 2235 { 2236 iSign = -1; 2237 } 2238 2239 // read magnitude 2240 i=1; 2241 while (1) 2242 { 2243 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoSvlcSCModel.get( 0, 0, 2 ) ); 2244 if ( uiCode == 0 ) break; 2245 i++; 2246 } 2247 2248 riVal = i*iSign; 2249 } 2250 2251 Void TDecSbac::parseSaoUflc (UInt& riVal) 2252 { 2253 UInt uiSymbol; 2254 riVal = 0; 2255 for (Int i=0;i<5;i++) 2256 { 2257 m_pcTDecBinIf->decodeBinEP ( uiSymbol ); 2258 if (uiSymbol) 2259 { 2260 riVal |= (1<<i); 2261 } 2262 } 2263 } 2264 Void TDecSbac::parseSaoMergeLeft (UInt& ruiVal, UInt uiCompIdx) 2265 { 2266 UInt uiCode; 2267 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeLeftSCModel.get( 0, 0, uiCompIdx ) ); 2268 ruiVal = (Int)uiCode; 2269 } 2270 2271 Void TDecSbac::parseSaoMergeUp (UInt& ruiVal) 2272 { 2273 UInt uiCode; 2274 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeUpSCModel.get( 0, 0, 0 ) ); 2275 ruiVal = (Int)uiCode; 2276 } 2277 Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) 2278 { 2279 UInt uiCode; 2280 Int i; 2281 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 2282 if ( uiCode == 0 ) 2283 { 2284 ruiVal = 0; 2285 return; 2286 } 2287 i=1; 2288 while (1) 2289 { 2290 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 1 ) ); 2291 if ( uiCode == 0 ) break; 2292 i++; 2293 } 2294 ruiVal = i; 2068 ruiVal = 1; 2069 } 2070 } 2295 2071 } 2296 2072 … … 2302 2078 if (psDst->typeIdx != -1) 2303 2079 { 2304 if (psDst->typeIdx == SAO_BO) 2305 { 2306 psDst->bandPosition = psSrc->bandPosition ; 2307 } 2308 else 2309 { 2310 psDst->bandPosition = 0; 2311 } 2080 psDst->subTypeIdx = psSrc->subTypeIdx ; 2312 2081 psDst->length = psSrc->length; 2313 2082 for (i=0;i<psDst->length;i++) … … 2325 2094 } 2326 2095 } 2327 Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam) 2096 2097 Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam, UInt compIdx) 2328 2098 { 2329 2099 UInt uiSymbol; 2330 Int iSymbol;2331 static Int iTypeLength[MAX_NUM_SAO_TYPE] ={2100 static Int iTypeLength[MAX_NUM_SAO_TYPE] = 2101 { 2332 2102 SAO_EO_LEN, 2333 2103 SAO_EO_LEN, … … 2337 2107 }; 2338 2108 2339 parseSaoTypeIdx(uiSymbol); 2109 if (compIdx==2) 2110 { 2111 uiSymbol = (UInt)( psSaoLcuParam->typeIdx + 1); 2112 } 2113 else 2114 { 2115 parseSaoTypeIdx(uiSymbol); 2116 } 2340 2117 psSaoLcuParam->typeIdx = (Int)uiSymbol - 1; 2341 2118 if (uiSymbol) 2342 2119 { 2343 2120 psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx]; 2121 2122 Int bitDepth = compIdx ? g_bitDepthC : g_bitDepthY; 2123 Int offsetTh = 1 << min(bitDepth - 5,5); 2124 2344 2125 if( psSaoLcuParam->typeIdx == SAO_BO ) 2345 2126 { 2346 // Parse Left Band Index2347 parseSaoUflc( uiSymbol );2348 psSaoLcuParam->bandPosition = uiSymbol;2349 2127 for(Int i=0; i< psSaoLcuParam->length; i++) 2350 2128 { 2351 parseSao Svlc(iSymbol);2352 psSaoLcuParam->offset[i] = iSymbol;2129 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); 2130 psSaoLcuParam->offset[i] = uiSymbol; 2353 2131 } 2132 for(Int i=0; i< psSaoLcuParam->length; i++) 2133 { 2134 if (psSaoLcuParam->offset[i] != 0) 2135 { 2136 m_pcTDecBinIf->decodeBinEP ( uiSymbol); 2137 if (uiSymbol) 2138 { 2139 psSaoLcuParam->offset[i] = -psSaoLcuParam->offset[i] ; 2140 } 2141 } 2142 } 2143 parseSaoUflc(5, uiSymbol ); 2144 psSaoLcuParam->subTypeIdx = uiSymbol; 2354 2145 } 2355 2146 else if( psSaoLcuParam->typeIdx < 4 ) 2356 2147 { 2357 parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[0] = uiSymbol; 2358 parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[1] = uiSymbol; 2359 parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[2] = -(Int)uiSymbol; 2360 parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[3] = -(Int)uiSymbol; 2361 } 2148 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[0] = uiSymbol; 2149 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[1] = uiSymbol; 2150 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[2] = -(Int)uiSymbol; 2151 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[3] = -(Int)uiSymbol; 2152 if (compIdx != 2) 2153 { 2154 parseSaoUflc(2, uiSymbol ); 2155 psSaoLcuParam->subTypeIdx = uiSymbol; 2156 psSaoLcuParam->typeIdx += psSaoLcuParam->subTypeIdx; 2157 } 2158 } 2362 2159 } 2363 2160 else … … 2367 2164 } 2368 2165 2369 Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag)2166 Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp) 2370 2167 { 2371 2168 Int iAddr = pcCU->getAddr(); … … 2375 2172 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; 2376 2173 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; 2377 pSaoParam->saoLcuParam[iCompIdx][iAddr]. bandPosition= 0;2174 pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; 2378 2175 pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; 2379 2176 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0] = 0; … … 2382 2179 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3] = 0; 2383 2180 2384 if (pSaoParam->bSaoFlag[iCompIdx]) 2385 { 2386 if (rx>0 && iCUAddrInSlice!=0) 2387 { 2388 parseSaoMergeLeft(uiSymbol,iCompIdx); pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = (Int)uiSymbol; 2181 } 2182 if (pSaoParam->bSaoFlag[0] || pSaoParam->bSaoFlag[1] ) 2183 { 2184 if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) 2185 { 2186 parseSaoMerge(uiSymbol); 2187 pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag = (Bool)uiSymbol; 2188 } 2189 if (pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag==0) 2190 { 2191 if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) 2192 { 2193 parseSaoMerge(uiSymbol); 2194 pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag = (Bool)uiSymbol; 2195 } 2196 } 2197 } 2198 2199 for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) 2200 { 2201 if ((iCompIdx == 0 && pSaoParam->bSaoFlag[0]) || (iCompIdx > 0 && pSaoParam->bSaoFlag[1]) ) 2202 { 2203 if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) 2204 { 2205 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag; 2389 2206 } 2390 2207 else … … 2395 2212 if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0) 2396 2213 { 2397 if ((ry > 0) && (iCUAddrUpInSlice> 0||bLFCrossSliceBoundaryFlag))2214 if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) 2398 2215 { 2399 p arseSaoMergeUp(uiSymbol); pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = uiSymbol;2216 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag; 2400 2217 } 2401 2218 else … … 2405 2222 if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag) 2406 2223 { 2407 parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr])); 2224 pSaoParam->saoLcuParam[2][iAddr].typeIdx = pSaoParam->saoLcuParam[1][iAddr].typeIdx; 2225 parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr]), iCompIdx); 2408 2226 } 2409 2227 else … … 2420 2238 { 2421 2239 pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; 2422 pSaoParam->saoLcuParam[iCompIdx][iAddr]. bandPosition= 0;2423 } 2424 } 2425 } 2426 #endif 2240 pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; 2241 } 2242 } 2243 } 2244 2427 2245 /** 2428 2246 - Initialize our contexts from the nominated source. … … 2454 2272 } 2455 2273 2456 Void TDecSbac::decodeFlush ( ) 2457 { 2458 UInt uiBit; 2459 m_pcTDecBinIf->decodeBinTrm(uiBit); 2460 m_pcTDecBinIf->flush(); 2461 2462 } 2463 2464 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA_A0070 && LGE_EDGE_INTRA_DELTA_DC) 2465 Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel ) 2466 { 2467 UInt uiSymbol; 2468 UInt uiCount = 0; 2469 do 2470 { 2471 m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel ); 2472 uiCount++; 2473 } 2474 while( uiSymbol && ( uiCount != 13 ) ); 2475 2476 ruiSymbol = uiCount - 1; 2274 #if H_3D_ARP 2275 Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2276 { 2277 UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1; 2278 UInt uiW = 0; 2279 UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 2280 UInt uiCode = 0; 2281 2282 assert ( uiMaxW > 0 ); 2283 2284 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) ); 2285 2286 uiW = uiCode; 2287 if( 1 == uiW ) 2288 { 2289 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 3 ) ); 2290 uiW += ( 1 == uiCode ? 1 : 0 ); 2291 } 2292 #if H_MV_ENC_DEC_TRAC 2293 DTRACE_CU("iv_res_pred_weight_idx", uiW ) 2294 #endif 2295 pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); 2296 } 2297 #endif 2298 2299 #if H_3D_IC 2300 /** parse illumination compensation flag 2301 * \param pcCU 2302 * \param uiAbsPartIdx 2303 * \param uiDepth 2304 * \returns Void 2305 */ 2306 Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2307 { 2308 UInt uiSymbol = 0; 2309 UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); 2310 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); 2311 #if !H_MV_ENC_DEC_TRAC 2312 DTRACE_CABAC_VL( g_nSymbolCounter++ ); 2313 DTRACE_CABAC_T( "\tICFlag" ); 2314 DTRACE_CABAC_T( "\tuiCtxIC: "); 2315 DTRACE_CABAC_V( uiCtxIC ); 2316 DTRACE_CABAC_T( "\tuiSymbol: "); 2317 DTRACE_CABAC_V( uiSymbol ); 2318 DTRACE_CABAC_T( "\n"); 2319 #else 2320 DTRACE_CU("ic_flag", uiSymbol) 2321 #endif 2322 2323 pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); 2324 } 2325 #endif 2326 2327 #if LGE_INTER_SDC_E0156 2328 Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2329 { 2330 UInt uiSymbol = 0; 2331 UInt uiCtxInterSDCFlag = pcCU->getCtxInterSDCFlag( uiAbsPartIdx ); 2332 2333 m_pcTDecBinIf->decodeBin( uiSymbol, m_cInterSDCFlagSCModel.get( 0, 0, uiCtxInterSDCFlag ) ); 2477 2334 2478 2335 if( uiSymbol ) 2479 2336 { 2480 xReadEpExGolomb( uiSymbol, 0 ); 2481 ruiSymbol += uiSymbol + 1; 2482 } 2483 2484 return; 2485 } 2486 #endif 2487 #if HHI_DMM_WEDGE_INTRA 2488 Void TDecSbac::xParseWedgeFullInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2489 { 2490 Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); 2491 Int iBits = g_aucWedgeFullBitsListIdx[iIntraIdx]; 2492 2493 UInt uiSymbol, uiTabIdx = 0; 2494 for ( Int i = 0; i < iBits; i++ ) 2495 { 2496 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 0) ); 2497 uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; 2498 uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; 2499 uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; 2500 uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; 2501 uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; 2502 uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; 2503 uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; 2504 uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; 2505 uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; 2506 uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; 2507 uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; 2508 uiTabIdx += ( uiSymbol && i == 11 ) ? 2048 : 0; 2509 uiTabIdx += ( uiSymbol && i == 12 ) ? 4096 : 0; 2510 } 2511 2512 pcCU->setWedgeFullTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); 2513 } 2514 2515 Void TDecSbac::xParseWedgeFullDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2516 { 2517 Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); 2518 Int iBits = g_aucWedgeFullBitsListIdx[iIntraIdx]; 2519 2520 UInt uiSymbol, uiTabIdx = 0; 2521 for ( Int i = 0; i < iBits; i++ ) 2522 { 2523 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 0) ); 2524 uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; 2525 uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; 2526 uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; 2527 uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; 2528 uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; 2529 uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; 2530 uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; 2531 uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; 2532 uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; 2533 uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; 2534 uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; 2535 uiTabIdx += ( uiSymbol && i == 11 ) ? 2048 : 0; 2536 uiTabIdx += ( uiSymbol && i == 12 ) ? 4096 : 0; 2537 } 2538 2539 pcCU->setWedgeFullTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); 2540 2541 UInt uiDC1, uiDC2; 2542 xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); 2543 Int iDC1 = uiDC1; 2544 if ( uiDC1 ) 2545 { 2546 UInt uiSign; 2547 m_pcTDecBinIf->decodeBinEP( uiSign ); 2548 if ( uiSign ) 2549 { 2550 iDC1 = -iDC1; 2551 } 2552 } 2553 xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); 2554 Int iDC2 = uiDC2; 2555 if ( uiDC2 ) 2556 { 2557 UInt uiSign; 2558 m_pcTDecBinIf->decodeBinEP( uiSign ); 2559 if ( uiSign ) 2560 { 2561 iDC2 = -iDC2; 2562 } 2563 } 2564 2565 pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 2566 pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 2567 } 2568 2569 Void TDecSbac::xParseWedgePredDirInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2570 { 2571 if( DMM_WEDGE_PREDDIR_DELTAEND_MAX > 0 ) 2572 { 2573 UInt uiDeltaEnd = 0; 2574 m_pcTDecBinIf->decodeBin( uiDeltaEnd, m_cDmmDataSCModel.get(0, 0, 2) ); 2575 2576 Int iDeltaEnd; 2577 if( uiDeltaEnd != 0 ) 2578 { 2579 UInt uiAbsValMinus1; 2580 UInt uiSymbol; 2581 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 = uiSymbol; 2582 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 |= uiSymbol << 1; 2583 uiDeltaEnd = uiAbsValMinus1 + 1; 2584 2585 iDeltaEnd = uiDeltaEnd; 2586 UInt uiSign; 2587 m_pcTDecBinIf->decodeBinEP( uiSign ); 2588 if( uiSign ) 2589 { 2590 iDeltaEnd = -iDeltaEnd; 2591 } 2592 } 2593 else 2594 { 2595 iDeltaEnd = 0; 2596 } 2597 pcCU->setWedgePredDirDeltaEndSubParts( iDeltaEnd, uiAbsPartIdx, uiDepth ); 2598 } 2599 } 2600 2601 Void TDecSbac::xParseWedgePredDirDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2602 { 2603 if( DMM_WEDGE_PREDDIR_DELTAEND_MAX > 0 ) 2604 { 2605 UInt uiDeltaEnd = 0; 2606 m_pcTDecBinIf->decodeBin( uiDeltaEnd, m_cDmmDataSCModel.get(0, 0, 2) ); 2607 2608 Int iDeltaEnd; 2609 if( uiDeltaEnd != 0 ) 2610 { 2611 UInt uiAbsValMinus1; 2612 UInt uiSymbol; 2613 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 = uiSymbol; 2614 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 |= uiSymbol << 1; 2615 uiDeltaEnd = uiAbsValMinus1 + 1; 2616 2617 iDeltaEnd = uiDeltaEnd; 2618 UInt uiSign; 2619 m_pcTDecBinIf->decodeBinEP( uiSign ); 2620 if( uiSign ) 2621 { 2622 iDeltaEnd = -iDeltaEnd; 2623 } 2624 } 2625 else 2626 { 2627 iDeltaEnd = 0; 2628 } 2629 2630 pcCU->setWedgePredDirDeltaEndSubParts( iDeltaEnd, uiAbsPartIdx, uiDepth ); 2631 } 2632 2633 UInt uiDC1, uiDC2; 2634 xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); 2635 Int iDC1 = uiDC1; 2636 if ( uiDC1 ) 2637 { 2638 UInt uiSign; 2639 m_pcTDecBinIf->decodeBinEP( uiSign ); 2640 if ( uiSign ) 2641 { 2642 iDC1 = -iDC1; 2643 } 2644 } 2645 xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); 2646 Int iDC2 = uiDC2; 2647 if ( uiDC2 ) 2648 { 2649 UInt uiSign; 2650 m_pcTDecBinIf->decodeBinEP( uiSign ); 2651 if ( uiSign ) 2652 { 2653 iDC2 = -iDC2; 2654 } 2655 } 2656 2657 pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 2658 pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 2659 } 2660 #endif 2661 #if HHI_DMM_PRED_TEX 2662 #if LGE_DMM3_SIMP_C0044 2663 Void TDecSbac::xParseWedgePredTexInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2664 { 2665 Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); 2666 Int iBits = g_aucWedgeTexPredBitsListIdx[iIntraIdx]; 2667 2668 UInt uiSymbol, uiTabIdx = 0; 2669 for ( Int i = 0; i < iBits; i++ ) 2670 { 2671 m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 3) ); 2672 uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; 2673 uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; 2674 uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; 2675 uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; 2676 uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; 2677 uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; 2678 uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; 2679 uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; 2680 uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; 2681 uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; 2682 uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; 2683 } 2684 2685 pcCU->setWedgePredTexIntraTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); 2686 } 2687 #endif 2688 2689 Void TDecSbac::xParseWedgePredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2690 { 2691 #if LGE_DMM3_SIMP_C0044 2692 xParseWedgePredTexInfo( pcCU, uiAbsPartIdx, uiDepth ); 2693 #endif 2694 UInt uiDC1, uiDC2; 2695 xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); 2696 Int iDC1 = uiDC1; 2697 if ( uiDC1 ) 2698 { 2699 UInt uiSign; 2700 m_pcTDecBinIf->decodeBinEP( uiSign ); 2701 if ( uiSign ) 2702 { 2703 iDC1 = -iDC1; 2704 } 2705 } 2706 xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); 2707 Int iDC2 = uiDC2; 2708 if ( uiDC2 ) 2709 { 2710 UInt uiSign; 2711 m_pcTDecBinIf->decodeBinEP( uiSign ); 2712 if ( uiSign ) 2713 { 2714 iDC2 = -iDC2; 2715 } 2716 } 2717 2718 pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 2719 pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 2720 } 2721 2722 Void TDecSbac::xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2723 { 2724 UInt uiDC1, uiDC2; 2725 xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); 2726 Int iDC1 = uiDC1; 2727 if ( uiDC1 ) 2728 { 2729 UInt uiSign; 2730 m_pcTDecBinIf->decodeBinEP( uiSign ); 2731 if ( uiSign ) 2732 { 2733 iDC1 = -iDC1; 2734 } 2735 } 2736 xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); 2737 Int iDC2 = uiDC2; 2738 if ( uiDC2 ) 2739 { 2740 UInt uiSign; 2741 m_pcTDecBinIf->decodeBinEP( uiSign ); 2742 if ( uiSign ) 2743 { 2744 iDC2 = -iDC2; 2745 } 2746 } 2747 2748 pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 2749 pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 2750 } 2751 #endif 2752 #if QC_ARP_D0177 2753 Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2754 { 2755 UInt nMaxW = pcCU->getSlice()->getARPStepNum() - 1; 2756 #if !QC_ARP_WARNING_FIX 2757 assert (nMaxW >= 0); 2758 #endif 2759 UInt nW = 0; 2760 if( nMaxW > 0 ) 2761 { 2762 UInt nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 2763 #if !QC_ARP_WARNING_FIX 2764 assert( 0 <= nOffset && nOffset <= 2 ); 2765 #endif 2766 UInt uiCode = 0; 2767 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 0 + nOffset ) ); 2768 nW = uiCode; 2769 if( nW == 1 ) 2770 { 2771 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 3 ) ); 2772 nW += ( uiCode == 1 ); 2773 } 2774 } 2775 pcCU->setARPWSubParts( ( UChar )( nW ) , uiAbsPartIdx, uiDepth ); 2776 } 2777 #endif 2778 #if LGE_EDGE_INTRA_A0070 2779 Void TDecSbac::xParseEdgeIntraInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2780 { 2781 UInt uiSymbol = 0; 2782 2783 // 1. Top(0) or Left(1) 2784 UChar ucLeft; 2785 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 2786 ucLeft = uiSymbol; 2787 2788 // 2. Start position (lowest bit first) 2789 UChar ucStart = 0; 2790 for( UInt ui = 0; ui < 6 - uiDepth; ui++ ) 2791 { 2792 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 2793 ucStart |= (uiSymbol << ui); 2794 } 2795 2796 // 3. Number of edges 2797 UChar ucMax = 0; 2798 for( UInt ui = 0; ui < 7 - uiDepth; ui++ ) 2799 { 2800 m_pcTDecBinIf->decodeBinEP( uiSymbol ); 2801 ucMax |= (uiSymbol << ui); 2802 } 2803 ucMax++; // +1 2804 2805 // 4. Edges 2806 UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 ); 2807 UInt uiCtxEdgeIntra = pcCU->getCtxEdgeIntra( uiAbsPartIdx ); 2808 for( Int iPtr = 0; iPtr < ucMax; iPtr++ ) 2809 { 2810 UChar ucEdge = 0; 2811 UInt uiReorderEdge = 0; 2812 // Left-friendly direction 2813 // 0 ( 0deg) => 0 2814 // 1 ( 45deg) => 10 2815 // 2 ( -45deg) => 110 2816 // 3 ( 90deg) => 1110 2817 // 4 ( -90deg) => 11110 2818 // 5 ( 135deg) => 111110 2819 // 6 (-135deg) => 111111 2820 // Right-friendly direction 2821 // 0 ( 0deg) => 0 2822 // 1 ( -45deg) => 10 2823 // 2 ( 45deg) => 110 2824 // 3 ( -90deg) => 1110 2825 // 4 ( 90deg) => 11110 2826 // 5 (-135deg) => 111110 2827 // 6 ( 135deg) => 111111 2828 // refer to a paper "An efficient chain code with Huffman coding" 2829 for( UInt ui = 0; ui < 6; ui++ ) 2830 { 2831 m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraSCModel.get( 0, 0, uiCtxEdgeIntra ) ); 2832 ucEdge <<= 1; 2833 ucEdge |= uiSymbol; 2834 if( uiSymbol == 0 ) 2835 break; 2836 } 2837 2838 switch( ucEdge ) 2839 { 2840 case 0 : // "0" 2841 uiReorderEdge = 0; 2842 break; 2843 case 2 : // "10" 2844 uiReorderEdge = 1; 2845 break; 2846 case 6 : // "110" 2847 uiReorderEdge = 2; 2848 break; 2849 case 14 : // "1110" 2850 uiReorderEdge = 3; 2851 break; 2852 case 30 : // "11110" 2853 uiReorderEdge = 4; 2854 break; 2855 case 62 : // "111110" 2856 uiReorderEdge = 5; 2857 break; 2858 case 63 : // "111111" 2859 uiReorderEdge = 6; 2860 break; 2861 default : 2862 printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge); 2863 assert(false); 2864 break; 2865 } 2866 pucSymbolList[iPtr] = uiReorderEdge; 2867 } 2868 ///////////////////// 2869 // Edge Reconstruction 2870 Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx ); 2871 pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion ); 2872 xFree( pucSymbolList ); 2873 } 2874 #endif 2875 2876 #if RWTH_SDC_DLT_B0036 2877 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 2878 Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2879 { 2880 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2881 2882 UInt uiSymbol = 0; 2883 UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); 2884 m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); 2885 2886 if( uiSymbol == 1 ) 2887 { 2888 pcCU->setPartSizeSubParts(SIZE_2Nx2N, uiAbsPartIdx, uiDepth); 2889 2890 pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth); 2891 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); 2892 pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth); 2893 } 2894 } 2895 2896 Void TDecSbac::parseSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2897 { 2898 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2899 assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); 2900 2901 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 2902 2903 UInt uiCtx = 0; 2904 2905 UInt uiMPModeIdx = 0; 2906 2907 for(Int i=0; i<RWTH_SDC_NUM_PRED_MODES-1; i++) 2908 { 2909 UInt uiIsMostProb = 0; 2910 #if INTEL_SDC64_D0193 2911 if( !(pcCU->getWidth(uiAbsPartIdx) == 64 && i == 1)) 2912 #endif 2913 m_pcTDecBinIf->decodeBin( uiIsMostProb, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); 2914 2915 if ( uiIsMostProb == 1 ) 2916 break; 2917 2918 // else: get next most probable pred mode 2919 uiMPModeIdx = (uiMPModeIdx+1)%RWTH_SDC_NUM_PRED_MODES; 2920 } 2921 2922 Int intraPredMode = g_auiSDCPredModes[uiMPModeIdx]; 2923 2924 #if HHI_DMM_WEDGE_INTRA 2925 if( intraPredMode == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 2926 if( intraPredMode == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 2927 #endif 2928 2929 pcCU->setLumaIntraDirSubParts((UChar)intraPredMode, uiAbsPartIdx, uiDepth); 2930 } 2931 #endif 2932 2933 Void TDecSbac::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) 2934 { 2935 assert( pcCU->getSlice()->getSPS()->isDepth() ); 2936 assert( pcCU->getSDCFlag(uiAbsPartIdx) ); 2937 assert( uiSegment < 2 ); 2938 2939 UInt uiResidual = 0; 2940 UInt uiBit = 0; 2337 pcCU->setInterSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth ); 2338 pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); 2339 pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth ); 2340 } 2341 else 2342 { 2343 pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth); 2344 } 2345 } 2346 2347 Void TDecSbac::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) 2348 { 2941 2349 UInt uiAbsIdx = 0; 2942 2350 UInt uiSign = 0; 2943 2351 Int iIdx = 0; 2944 2945 UInt uiMaxResidualBits = pcCU->getSlice()->getSPS()->getBitsPerDepthValue(); 2946 assert( uiMaxResidualBits <= g_uiBitDepth ); 2947 2948 #if RWTH_SDC_CTX_SIMPL_D0032 2949 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 2950 #else 2951 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); 2952 #endif 2953 2954 if (uiResidual) 2955 { 2956 // decode residual sign bit 2957 #if RWTH_SDC_CTX_SIMPL_D0032 2958 m_pcTDecBinIf->decodeBinEP(uiSign); 2959 #else 2960 m_pcTDecBinIf->decodeBin(uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); 2961 #endif 2962 2963 // decode residual magnitude 2964 #if LGE_CONCATENATE_D0141 2965 //prefix part 2966 UInt uiCount = 0; 2967 UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues(); 2968 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 2969 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) 2970 { 2971 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); 2972 if ( uiBit == 0 ) 2973 break; 2974 else 2975 uiCount++; 2976 } 2977 //suffix part 2978 if ( uiCount == uiPrefixThreshold ) 2979 { 2980 for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ ) 2981 { 2982 m_pcTDecBinIf->decodeBinEP( uiBit ); 2983 uiAbsIdx |= uiBit << ui; 2984 } 2985 uiAbsIdx += uiCount; 2986 } 2987 else 2988 uiAbsIdx = uiCount; 2989 #else 2990 for (Int i=0; i<uiMaxResidualBits; i++) 2991 { 2992 #if RWTH_SDC_CTX_SIMPL_D0032 2993 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, 0, i ) ); 2994 #else 2995 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); 2996 #endif 2997 uiAbsIdx |= uiBit << i; 2998 } 2999 #endif 3000 3001 uiAbsIdx += 1; 3002 iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; 3003 } 3004 3005 pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); 2352 2353 xReadExGolombLevel( uiAbsIdx, m_cInterSDCResidualSCModel.get( 0, 0, 0 ) ); 2354 2355 uiAbsIdx++; 2356 m_pcTDecBinIf->decodeBin( uiSign, m_cInterSDCResidualSignFlagSCModel.get( 0, 0, 0 ) ); 2357 iIdx = (Int)( uiSign ? -1 : 1 ) * uiAbsIdx; 2358 2359 pcCU->setInterSDCSegmentDCOffset( iIdx, uiSegment, uiAbsPartIdx ); 3006 2360 } 3007 2361 #endif -
trunk/source/Lib/TLibDecoder/TDecSbac.h
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 58 58 // ==================================================================================================================== 59 59 60 class SEImessages;61 62 60 /// SBAC decoder class 63 61 class TDecSbac : public TDecEntropyIf … … 74 72 Void xCopyFrom ( TDecSbac* pSrc ); 75 73 Void xCopyContextsFrom ( TDecSbac* pSrc ); 76 Void decodeFlush(); 77 78 #if CABAC_INIT_FLAG 74 79 75 Void resetEntropy (TComSlice* pSlice ); 76 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } 77 Void parseVPS ( TComVPS* /*pcVPS*/ ) {} 78 #if H_3D 79 Void parseSPS ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {} 80 80 #else 81 Void resetEntropywithQPandInitIDC ( Int iQp, Int iID); 82 Void resetEntropy ( Int iQp, Int iID ) { resetEntropywithQPandInitIDC(iQp, iID); } 83 Void resetEntropy ( TComSlice* pcSlice ) { resetEntropywithQPandInitIDC(pcSlice->getSliceQp(), pcSlice->getCABACinitIDC());} 84 #endif 85 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } 86 87 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 88 Void parseVPS ( TComVPS* pcVPS ) {} 89 #endif 90 #if HHI_MPI || H3D_QTL 91 Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ) {} 92 #else 93 Void parseSPS ( TComSPS* pcSPS ) {} 94 #endif 95 Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet ) {} 96 Void parseAPS ( TComAPS* pAPS ) {} 97 void parseSEI(SEImessages&) {} 98 99 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 100 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) {} 101 #else 102 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) {} 103 #endif 104 81 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 82 #endif 83 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 84 85 Void parseSliceHeader ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/) {} 105 86 Void parseTerminatingBit ( UInt& ruiBit ); 106 #if H3D_IVMP107 Void parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands );108 #else109 87 Void parseMVPIdx ( Int& riMVPIdx ); 110 #endif111 112 #if LGE_SAO_MIGRATION_D0091113 88 Void parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ); 114 Void parseSaoMerge 89 Void parseSaoMerge ( UInt& ruiVal ); 115 90 Void parseSaoTypeIdx ( UInt& ruiVal ); 116 91 Void parseSaoUflc ( UInt uiLength, UInt& ruiVal ); 117 92 Void parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp); 118 93 Void parseSaoOffset (SaoLcuParam* psSaoLcuParam, UInt compIdx); 119 #else120 Void parseSaoUvlc ( UInt& ruiVal );121 Void parseSaoSvlc ( Int& riVal );122 Void parseSaoMergeLeft ( UInt& ruiVal, UInt uiCompIdx );123 Void parseSaoMergeUp ( UInt& ruiVal );124 Void parseSaoTypeIdx ( UInt& ruiVal );125 Void parseSaoUflc ( UInt& ruiVal );126 Void parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag);127 Void parseSaoOffset (SaoLcuParam* psSaoLcuParam);128 #endif129 130 #if RWTH_SDC_DLT_B0036131 #if !PKU_QC_DEPTH_INTRA_UNI_D0195132 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );133 Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );134 #endif135 Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );136 #endif137 94 private: 138 95 Void xReadUnarySymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ); 139 96 Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol ); 140 97 Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); 141 Void xReadGoRiceExGolomb ( UInt &ruiSymbol, UInt &ruiGoRiceParam ); 142 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 143 Void xReadExGolombLevel ( UInt& ruiSymbol, ContextModel& rcSCModel ); 144 #endif 145 #if HHI_DMM_WEDGE_INTRA 146 Void xParseWedgeFullInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 147 Void xParseWedgeFullDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 148 149 Void xParseWedgePredDirInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 150 Void xParseWedgePredDirDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 151 #endif 152 #if HHI_DMM_PRED_TEX 153 #if LGE_DMM3_SIMP_C0044 154 Void xParseWedgePredTexInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 155 #endif 156 Void xParseWedgePredTexDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 157 Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 158 #endif 159 160 #if LGE_EDGE_INTRA_A0070 161 Void xParseEdgeIntraInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 162 #endif 163 98 Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam ); 99 #if H_3D_DIM 100 Void xReadExGolombLevel ( UInt& ruiSymbol, ContextModel& rcSCModel ); 101 Void xParseDimDeltaDC ( Pel& rValDeltaDC, UInt dimType ); 102 #if H_3D_DIM_DMM 103 Void xParseDmm1WedgeIdx ( UInt& ruiTabIdx, Int iNumBit ); 104 #if !SEC_DMM2_E0146 105 Void xParseDmm2Offset ( Int& riOffset ); 106 #endif 107 Void xParseDmm3WedgeIdx ( UInt& ruiIntraIdx, Int iNumBit ); 108 #endif 109 #if H_3D_DIM_RBC 110 Void xParseRbcEdge ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 111 #endif 112 #if H_3D_DIM_SDC 113 Void xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 114 #endif 115 #endif 116 #if LGE_INTER_SDC_E0156 117 Void parseInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 118 Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 119 #endif 164 120 private: 165 121 TComInputBitstream* m_pcBitstream; 166 122 TDecBinIf* m_pcTDecBinIf; 167 168 Int m_iSliceGranularity; //!< slice granularity 169 123 170 124 public: 171 Void parseAlfCtrlFlag ( UInt &ruiAlfCtrlFlag ); 172 173 /// set slice granularity 174 Void setSliceGranularity(Int iSliceGranularity) {m_iSliceGranularity = iSliceGranularity;} 175 176 /// get slice granularity 177 Int getSliceGranularity() {return m_iSliceGranularity; } 178 125 179 126 Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 180 #if LGE_ILLUCOMP_B0045 181 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 182 #endif 127 Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 183 128 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 184 129 Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 185 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); 186 #if H3D_IVRP 187 Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); 188 #endif 189 #if QC_ARP_D0177 130 Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); 131 #if H_3D_ARP 190 132 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 133 #endif 134 #if H_3D_IC 135 Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 191 136 #endif 192 137 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 193 138 Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 194 #if PKU_QC_DEPTH_INTRA_UNI_D0195 195 Void parseDepthIntraMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 196 Void parseDepthModelingTable( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 197 #endif 139 198 140 Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 199 141 200 142 Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 201 143 202 Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth ); 203 Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); 144 #if H_3D_DIM 145 Void parseIntraDepth ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ); 146 Void parseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ); 147 #endif 148 149 Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ); 150 Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ); 204 151 Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ); 205 152 206 153 Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ); 207 154 Void parseQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ); 208 Void parseQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf );155 Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf ); 209 156 210 157 Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 214 161 Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx ); 215 162 Void parseCoeffNxN ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ); 216 217 Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ); 163 Void parseTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType); 164 218 165 Void updateContextTables( SliceType eSliceType, Int iQp ); 219 166 220 Void parseScalingList ( TComScalingList* scalingList) {}167 Void parseScalingList ( TComScalingList* /*scalingList*/ ) {} 221 168 222 169 private: … … 228 175 ContextModel3DBuffer m_cCUSplitFlagSCModel; 229 176 ContextModel3DBuffer m_cCUSkipFlagSCModel; 230 #if LGE_ILLUCOMP_B0045231 ContextModel3DBuffer m_cCUICFlagSCModel;232 #endif233 177 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; 234 178 ContextModel3DBuffer m_cCUMergeIdxExtSCModel; 235 #if H 3D_IVRP236 ContextModel3DBuffer m_c ResPredFlagSCModel;237 #endif 238 #if QC_ARP_D0177239 ContextModel3DBuffer m_cCU PUARPW;179 #if H_3D_ARP 180 ContextModel3DBuffer m_cCUPUARPWSCModel; 181 #endif 182 #if H_3D_IC 183 ContextModel3DBuffer m_cCUICFlagSCModel; 240 184 #endif 241 185 ContextModel3DBuffer m_cCUPartSizeSCModel; 242 186 ContextModel3DBuffer m_cCUPredModeSCModel; 243 ContextModel3DBuffer m_cCUAlfCtrlFlagSCModel;244 187 ContextModel3DBuffer m_cCUIntraPredSCModel; 245 188 ContextModel3DBuffer m_cCUChromaPredSCModel; … … 261 204 ContextModel3DBuffer m_cMVPIdxSCModel; 262 205 263 ContextModel3DBuffer m_cALFFlagSCModel;264 ContextModel3DBuffer m_cALFUvlcSCModel;265 ContextModel3DBuffer m_cALFSvlcSCModel;266 206 ContextModel3DBuffer m_cCUAMPSCModel; 267 #if LGE_SAO_MIGRATION_D0091268 207 ContextModel3DBuffer m_cSaoMergeSCModel; 269 208 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 270 #else 271 ContextModel3DBuffer m_cSaoFlagSCModel; 272 ContextModel3DBuffer m_cSaoUvlcSCModel; 273 ContextModel3DBuffer m_cSaoSvlcSCModel; 274 ContextModel3DBuffer m_cSaoMergeLeftSCModel; 275 ContextModel3DBuffer m_cSaoMergeUpSCModel; 276 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 277 #endif 278 279 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 280 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 281 ContextModel3DBuffer m_cDmmFlagSCModel; 282 ContextModel3DBuffer m_cDmmModeSCModel; 283 #endif 284 ContextModel3DBuffer m_cDmmDataSCModel; 285 #endif 286 #if LGE_EDGE_INTRA_A0070 287 ContextModel3DBuffer m_cEdgeIntraSCModel; 288 #if LGE_EDGE_INTRA_DELTA_DC 289 ContextModel3DBuffer m_cEdgeIntraDeltaDCSCModel; 290 #endif 291 #endif 292 293 #if RWTH_SDC_DLT_B0036 294 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 295 ContextModel3DBuffer m_cSDCFlagSCModel; 296 #else 297 ContextModel3DBuffer m_cDepthModeModel; 298 ContextModel3DBuffer m_cDmmDeltaFlagModel; 299 #endif 300 209 ContextModel3DBuffer m_cTransformSkipSCModel; 210 ContextModel3DBuffer m_CUTransquantBypassFlagSCModel; 211 212 #if H_3D_DIM 213 ContextModel3DBuffer m_cDepthIntraModeSCModel; 214 ContextModel3DBuffer m_cDdcFlagSCModel; 215 ContextModel3DBuffer m_cDdcDataSCModel; 216 #if H_3D_DIM_DMM 217 ContextModel3DBuffer m_cDmm1DataSCModel; 218 #if !SEC_DMM2_E0146 219 ContextModel3DBuffer m_cDmm2DataSCModel; 220 #endif 221 ContextModel3DBuffer m_cDmm3DataSCModel; 222 #endif 223 #if H_3D_DIM_RBC 224 ContextModel3DBuffer m_cRbcDataSCModel; 225 #endif 226 #if H_3D_DIM_SDC 301 227 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 302 #if !RWTH_SDC_CTX_SIMPL_D0032303 ContextModel3DBuffer m_cSDCResidualSignFlagSCModel;304 #endif305 228 ContextModel3DBuffer m_cSDCResidualSCModel; 306 307 ContextModel3DBuffer m_cSDCPredModeSCModel; 229 #endif 230 #endif 231 #if LGE_INTER_SDC_E0156 232 ContextModel3DBuffer m_cInterSDCFlagSCModel; 233 ContextModel3DBuffer m_cInterSDCResidualSCModel; 234 ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel; 308 235 #endif 309 236 }; -
trunk/source/Lib/TLibDecoder/TDecSlice.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 55 55 TDecSlice::~TDecSlice() 56 56 { 57 } 58 59 Void TDecSlice::create( TComSlice* pcSlice, Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth ) 57 for (std::vector<TDecSbac*>::iterator i = CTXMem.begin(); i != CTXMem.end(); i++) 58 { 59 delete (*i); 60 } 61 CTXMem.clear(); 62 } 63 64 Void TDecSlice::initCtxMem( UInt i ) 65 { 66 for (std::vector<TDecSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++) 67 { 68 delete (*j); 69 } 70 CTXMem.clear(); 71 CTXMem.resize(i); 72 } 73 74 Void TDecSlice::create() 60 75 { 61 76 } … … 91 106 } 92 107 93 Void TDecSlice::decompressSlice(TComInputBitstream* pcBitstream, TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders)108 Void TDecSlice::decompressSlice(TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders) 94 109 { 95 110 TComDataCU* pcCU; 96 111 UInt uiIsLast = 0; 97 Int iStartCUEncOrder = max(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU(), rpcPic->getSlice(rpcPic->getCurrSliceIdx())->get EntropySliceCurStartCUAddr()/rpcPic->getNumPartInCU());112 Int iStartCUEncOrder = max(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU(), rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceSegmentCurStartCUAddr()/rpcPic->getNumPartInCU()); 98 113 Int iStartCUAddr = rpcPic->getPicSym()->getCUOrderMap(iStartCUEncOrder); 99 114 … … 108 123 DTRACE_CABAC_T( "\tPOC: " ); 109 124 DTRACE_CABAC_V( rpcPic->getPOC() ); 125 #if H_MV_ENC_DEC_TRAC 126 DTRACE_CABAC_T( " Layer: " ); 127 DTRACE_CABAC_V( rpcPic->getLayerId() ); 128 #endif 110 129 DTRACE_CABAC_T( "\n" ); 111 130 … … 116 135 UInt uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 117 136 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx()); 118 UInt iSymbolMode = pcSlice->getPPS()->getEntropyCodingMode();119 137 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 120 138 121 if( iSymbolMode ) 122 { 123 m_pcBufferSbacDecoders = new TDecSbac [uiTilesAcross]; 124 m_pcBufferBinCABACs = new TDecBinCABAC[uiTilesAcross]; 125 for (UInt ui = 0; ui < uiTilesAcross; ui++) 126 { 127 m_pcBufferSbacDecoders[ui].init(&m_pcBufferBinCABACs[ui]); 128 } 129 //save init. state 130 for (UInt ui = 0; ui < uiTilesAcross; ui++) 131 { 132 m_pcBufferSbacDecoders[ui].load(pcSbacDecoder); 133 } 134 } 135 if( iSymbolMode ) 136 { 137 m_pcBufferLowLatSbacDecoders = new TDecSbac [uiTilesAcross]; 138 m_pcBufferLowLatBinCABACs = new TDecBinCABAC[uiTilesAcross]; 139 for (UInt ui = 0; ui < uiTilesAcross; ui++) 140 m_pcBufferLowLatSbacDecoders[ui].init(&m_pcBufferLowLatBinCABACs[ui]); 141 //save init. state 142 for (UInt ui = 0; ui < uiTilesAcross; ui++) 143 m_pcBufferLowLatSbacDecoders[ui].load(pcSbacDecoder); 139 // delete decoders if already allocated in previous slice 140 if (m_pcBufferSbacDecoders) 141 { 142 delete [] m_pcBufferSbacDecoders; 143 } 144 if (m_pcBufferBinCABACs) 145 { 146 delete [] m_pcBufferBinCABACs; 147 } 148 // allocate new decoders based on tile numbaer 149 m_pcBufferSbacDecoders = new TDecSbac [uiTilesAcross]; 150 m_pcBufferBinCABACs = new TDecBinCABAC[uiTilesAcross]; 151 for (UInt ui = 0; ui < uiTilesAcross; ui++) 152 { 153 m_pcBufferSbacDecoders[ui].init(&m_pcBufferBinCABACs[ui]); 154 } 155 //save init. state 156 for (UInt ui = 0; ui < uiTilesAcross; ui++) 157 { 158 m_pcBufferSbacDecoders[ui].load(pcSbacDecoder); 159 } 160 161 // free memory if already allocated in previous call 162 if (m_pcBufferLowLatSbacDecoders) 163 { 164 delete [] m_pcBufferLowLatSbacDecoders; 165 } 166 if (m_pcBufferLowLatBinCABACs) 167 { 168 delete [] m_pcBufferLowLatBinCABACs; 169 } 170 m_pcBufferLowLatSbacDecoders = new TDecSbac [uiTilesAcross]; 171 m_pcBufferLowLatBinCABACs = new TDecBinCABAC[uiTilesAcross]; 172 for (UInt ui = 0; ui < uiTilesAcross; ui++) 173 { 174 m_pcBufferLowLatSbacDecoders[ui].init(&m_pcBufferLowLatBinCABACs[ui]); 175 } 176 //save init. state 177 for (UInt ui = 0; ui < uiTilesAcross; ui++) 178 { 179 m_pcBufferLowLatSbacDecoders[ui].load(pcSbacDecoder); 144 180 } 145 181 … … 151 187 UInt uiTileStartLCU; 152 188 UInt uiTileLCUX; 153 UInt uiTileLCUY;154 UInt uiTileWidth;155 UInt uiTileHeight;156 189 Int iNumSubstreamsPerTile = 1; // if independent. 157 190 Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag(); 191 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr(); 192 if( depSliceSegmentsEnabled ) 193 { 194 if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) && 195 iStartCUAddr != rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr()) 196 { 197 if(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 198 { 199 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 200 m_pcBufferSbacDecoders[uiTileCol].loadContexts( CTXMem[1] );//2.LCU 201 if ( (iStartCUAddr%uiWidthInLCUs+1) >= uiWidthInLCUs ) 202 { 203 uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 204 uiCol = iStartCUAddr % uiWidthInLCUs; 205 if(uiCol==uiTileLCUX) 206 { 207 CTXMem[0]->loadContexts(pcSbacDecoder); 208 } 209 } 210 } 211 pcSbacDecoder->loadContexts(CTXMem[0] ); //end of depSlice-1 212 pcSbacDecoders[uiSubStrm].loadContexts(pcSbacDecoder); 213 } 214 else 215 { 216 if(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 217 { 218 CTXMem[1]->loadContexts(pcSbacDecoder); 219 } 220 CTXMem[0]->loadContexts(pcSbacDecoder); 221 } 222 } 158 223 for( Int iCUAddr = iStartCUAddr; !uiIsLast && iCUAddr < rpcPic->getNumCUsInFrame(); iCUAddr = rpcPic->getPicSym()->xCalculateNxtCUAddr(iCUAddr) ) 159 224 { … … 163 228 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr(); 164 229 uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 165 uiTileLCUY = uiTileStartLCU / uiWidthInLCUs;166 uiTileWidth = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getTileWidth();167 uiTileHeight = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getTileHeight();168 230 uiCol = iCUAddr % uiWidthInLCUs; 169 uiLin = iCUAddr / uiWidthInLCUs; 231 // The 'line' is now relative to the 1st line in the slice, not the 1st line in the picture. 232 uiLin = (iCUAddr/uiWidthInLCUs)-(iStartCUAddr/uiWidthInLCUs); 170 233 // inherit from TR if necessary, select substream to use. 171 if( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() > 1 ) 172 { 173 if (pcSlice->getPPS()->getNumSubstreams() > 1) 174 { 175 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. 176 iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 177 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(iCUAddr)*iNumSubstreamsPerTile 178 + uiLin%iNumSubstreamsPerTile; 179 } 180 else 181 { 182 // dependent tiles => substreams are "per frame". 183 uiSubStrm = uiLin % iNumSubstreams; 184 } 234 if( (pcSlice->getPPS()->getNumSubstreams() > 1) || ( depSliceSegmentsEnabled && (uiCol == uiTileLCUX)&&(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) )) 235 { 236 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. 237 iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 238 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(iCUAddr)*iNumSubstreamsPerTile 239 + uiLin%iNumSubstreamsPerTile; 185 240 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] ); 186 241 // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line. 187 if ( pcSlice->getPPS()->getNumSubstreams() > 1 && uiCol == uiTileLCUX)242 if (((pcSlice->getPPS()->getNumSubstreams() > 1) || depSliceSegmentsEnabled ) && (uiCol == uiTileLCUX)&&(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag())) 188 243 { 189 244 // We'll sync if the TR is available. … … 201 256 ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr()) || 202 257 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr))) 203 ))||204 (true/*bEnforceEntropySliceRestriction*/ &&205 ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||206 ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr()) ||207 ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))208 258 )) 209 259 ) … … 214 264 { 215 265 // TR is available, we use it. 216 266 pcSbacDecoders[uiSubStrm].loadContexts( &m_pcBufferSbacDecoders[uiTileCol] ); 217 267 } 218 268 } 219 269 pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]); //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders) 220 270 } 221 else if ( iSymbolMode &&pcSlice->getPPS()->getNumSubstreams() <= 1 )271 else if ( pcSlice->getPPS()->getNumSubstreams() <= 1 ) 222 272 { 223 273 // Set variables to appropriate values to avoid later code change. … … 226 276 227 277 if ( (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) && // 1st in tile. 228 (iCUAddr!=0) && (iCUAddr!=rpcPic->getPicSym()->getPicSCUAddr(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr())/rpcPic->getNumPartInCU())) // !1st in frame && !1st in slice 278 (iCUAddr!=0) && (iCUAddr!=rpcPic->getPicSym()->getPicSCUAddr(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr())/rpcPic->getNumPartInCU()) 279 && (iCUAddr!=rpcPic->getPicSym()->getPicSCUAddr(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceSegmentCurStartCUAddr())/rpcPic->getNumPartInCU()) 280 ) // !1st in frame && !1st in slice 229 281 { 230 282 if (pcSlice->getPPS()->getNumSubstreams() > 1) … … 238 290 else 239 291 { 240 #if CABAC_INIT_FLAG241 292 SliceType sliceType = pcSlice->getSliceType(); 242 293 if (pcSlice->getCabacInitFlag()) … … 255 306 } 256 307 m_pcEntropyDecoder->updateContextTables( sliceType, pcSlice->getSliceQp() ); 257 #else258 m_pcEntropyDecoder->updateContextTables( pcSlice->getSliceType(), pcSlice->getSliceQp() );259 #endif260 308 } 261 309 262 Bool bTileMarkerFoundFlag = false; 263 TComInputBitstream *pcTmpPtr; 264 pcTmpPtr = ppcSubstreams[uiSubStrm]; // for CABAC 265 266 for (UInt uiIdx=0; uiIdx<pcTmpPtr->getTileMarkerLocationCount(); uiIdx++) 267 { 268 if ( pcTmpPtr->getByteLocation() == (pcTmpPtr->getTileMarkerLocation( uiIdx )+2) ) 269 { 270 bTileMarkerFoundFlag = true; 271 break; 272 } 273 } 274 275 if (bTileMarkerFoundFlag) 276 { 277 UInt uiTileIdx; 278 // Read tile index 279 m_pcEntropyDecoder->readTileMarker( uiTileIdx, rpcPic->getPicSym()->getBitsUsedByTileIdx() ); 280 } 281 } 282 283 310 } 284 311 285 312 #if ENC_DEC_TRACE 286 313 g_bJustDoIt = g_bEncDecTraceEnable; 287 314 #endif 288 #if LGE_SAO_MIGRATION_D0091289 315 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 290 316 { 291 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam();292 293 if (iCUAddr == iStartCUAddr)294 {317 SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam(); 318 saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 319 if (iCUAddr == iStartCUAddr) 320 { 295 321 saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma(); 296 } 297 Int numCuInWidth = saoParam->numCuInWidth; 298 Int cuAddrInSlice = iCUAddr - rpcPic->getPicSym()->getCUOrderMap(pcSlice->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU()); 299 Int cuAddrUpInSlice = cuAddrInSlice - numCuInWidth; 300 Int rx = iCUAddr % numCuInWidth; 301 Int ry = iCUAddr / numCuInWidth; 302 Int allowMergeLeft = 1; 303 Int allowMergeUp = 1; 304 if (rx!=0) 305 { 306 if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-1) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)) 307 { 308 allowMergeLeft = 0; 309 } 310 } 311 if (ry!=0) 312 { 313 if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-numCuInWidth) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)) 314 { 315 allowMergeUp = 0; 316 } 317 } 318 pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, saoParam,pcCU, cuAddrInSlice, cuAddrUpInSlice, allowMergeLeft, allowMergeUp); 319 } 320 #else 321 if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() ) 322 { 323 pcSlice->getAPS()->getSaoParam()->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 324 if (iCUAddr == iStartCUAddr) 325 { 326 pcSlice->getAPS()->getSaoParam()->bSaoFlag[1] = pcSlice->getSaoEnabledFlagCb(); 327 pcSlice->getAPS()->getSaoParam()->bSaoFlag[2] = pcSlice->getSaoEnabledFlagCr(); 328 } 329 Int numCuInWidth = pcSlice->getAPS()->getSaoParam()->numCuInWidth; 330 Int cuAddrInSlice = iCUAddr - pcSlice->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU(); 322 } 323 Int numCuInWidth = saoParam->numCuInWidth; 324 Int cuAddrInSlice = iCUAddr - rpcPic->getPicSym()->getCUOrderMap(pcSlice->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU()); 331 325 Int cuAddrUpInSlice = cuAddrInSlice - numCuInWidth; 332 326 Int rx = iCUAddr % numCuInWidth; 333 327 Int ry = iCUAddr / numCuInWidth; 334 pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, cuAddrInSlice, cuAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag() ); 335 } 336 #endif 337 328 Int allowMergeLeft = 1; 329 Int allowMergeUp = 1; 330 if (rx!=0) 331 { 332 if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-1) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)) 333 { 334 allowMergeLeft = 0; 335 } 336 } 337 if (ry!=0) 338 { 339 if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-numCuInWidth) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)) 340 { 341 allowMergeUp = 0; 342 } 343 } 344 pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, saoParam,pcCU, cuAddrInSlice, cuAddrUpInSlice, allowMergeLeft, allowMergeUp); 345 } 346 else if ( pcSlice->getSPS()->getUseSAO() ) 347 { 348 Int addr = pcCU->getAddr(); 349 SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam(); 350 for (Int cIdx=0; cIdx<3; cIdx++) 351 { 352 SaoLcuParam *saoLcuParam = &(saoParam->saoLcuParam[cIdx][addr]); 353 if ( ((cIdx == 0) && !pcSlice->getSaoEnabledFlag()) || ((cIdx == 1 || cIdx == 2) && !pcSlice->getSaoEnabledFlagChroma())) 354 { 355 saoLcuParam->mergeUpFlag = 0; 356 saoLcuParam->mergeLeftFlag = 0; 357 saoLcuParam->subTypeIdx = 0; 358 saoLcuParam->typeIdx = -1; 359 saoLcuParam->offset[0] = 0; 360 saoLcuParam->offset[1] = 0; 361 saoLcuParam->offset[2] = 0; 362 saoLcuParam->offset[3] = 0; 363 } 364 } 365 } 338 366 m_pcCuDecoder->decodeCU ( pcCU, uiIsLast ); 339 367 m_pcCuDecoder->decompressCU ( pcCU ); … … 342 370 g_bJustDoIt = g_bEncDecTraceDisable; 343 371 #endif 344 if( iSymbolMode ) 345 { 346 /*If at the end of a LCU line but not at the end of a substream, perform CABAC flush*/ 347 if (!uiIsLast && pcSlice->getPPS()->getNumSubstreams() > 1) 348 { 349 if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight)) 350 { 351 m_pcEntropyDecoder->decodeFlush(); 352 } 353 } 354 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder); 355 356 //Store probabilities of second LCU in line into buffer 357 if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX+1)) 358 { 359 m_pcBufferSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] ); 360 } 361 362 } 363 } 364 372 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder); 373 374 if ( uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU() 375 && pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() 376 && !uiIsLast ) 377 { 378 // Parse end_of_substream_one_bit for WPP case 379 UInt binVal; 380 pcSbacDecoder->parseTerminatingBit( binVal ); 381 assert( binVal ); 382 } 383 384 //Store probabilities of second LCU in line into buffer 385 if ( (uiCol == uiTileLCUX+1)&& (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) ) 386 { 387 m_pcBufferSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] ); 388 } 389 if( uiIsLast && depSliceSegmentsEnabled ) 390 { 391 if (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 392 { 393 CTXMem[1]->loadContexts( &m_pcBufferSbacDecoders[uiTileCol] );//ctx 2.LCU 394 } 395 CTXMem[0]->loadContexts( pcSbacDecoder );//ctx end of dep.slice 396 return; 397 } 398 } 365 399 } 366 400 367 401 ParameterSetManagerDecoder::ParameterSetManagerDecoder() 368 : m_spsBuffer(256) 369 , m_ppsBuffer(16) 370 , m_apsBuffer(64) 371 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 372 , m_vpsBuffer(16) 373 #endif 374 { 375 402 : m_vpsBuffer(MAX_NUM_VPS) 403 , m_spsBuffer(MAX_NUM_SPS) 404 , m_ppsBuffer(MAX_NUM_PPS) 405 { 376 406 } 377 407 … … 381 411 } 382 412 383 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046384 413 TComVPS* ParameterSetManagerDecoder::getPrefetchedVPS (Int vpsId) 385 414 { … … 393 422 } 394 423 } 395 #endif 424 396 425 397 426 TComSPS* ParameterSetManagerDecoder::getPrefetchedSPS (Int spsId) … … 419 448 } 420 449 421 TComAPS* ParameterSetManagerDecoder::getPrefetchedAPS (Int apsId)422 {423 if (m_apsBuffer.getPS(apsId) != NULL )424 {425 return m_apsBuffer.getPS(apsId);426 }427 else428 {429 return getAPS(apsId);430 }431 }432 433 450 Void ParameterSetManagerDecoder::applyPrefetchedPS() 434 451 { 435 m_ apsMap.mergePSList(m_apsBuffer);452 m_vpsMap.mergePSList(m_vpsBuffer); 436 453 m_ppsMap.mergePSList(m_ppsBuffer); 437 454 m_spsMap.mergePSList(m_spsBuffer); 438 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046439 m_vpsMap.mergePSList(m_vpsBuffer);440 #endif441 455 } 442 456 -
trunk/source/Lib/TLibDecoder/TDecSlice.h
r210 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 71 71 TDecSbac* m_pcBufferLowLatSbacDecoders; ///< dependent tiles: line to store temporary contexts, one per column of tiles. 72 72 TDecBinCABAC* m_pcBufferLowLatBinCABACs; 73 std::vector<TDecSbac*> CTXMem; 73 74 74 75 public: … … 77 78 78 79 Void init ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder ); 79 Void create ( TComSlice* pcSlice, Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth);80 Void create (); 80 81 Void destroy (); 81 82 82 Void decompressSlice ( TComInputBitstream* pcBitstream, TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders ); 83 Void decompressSlice ( TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders ); 84 Void initCtxMem( UInt i ); 85 Void setCtxMem( TDecSbac* sb, Int b ) { CTXMem[b] = sb; } 86 Int getCtxMemSize( ) { return (Int)CTXMem.size(); } 83 87 }; 84 88 … … 89 93 ParameterSetManagerDecoder(); 90 94 virtual ~ParameterSetManagerDecoder(); 91 95 Void storePrefetchedVPS(TComVPS *vps) { m_vpsBuffer.storePS( vps->getVPSId(), vps); }; 96 TComVPS* getPrefetchedVPS (Int vpsId); 92 97 Void storePrefetchedSPS(TComSPS *sps) { m_spsBuffer.storePS( sps->getSPSId(), sps); }; 93 98 TComSPS* getPrefetchedSPS (Int spsId); 94 99 Void storePrefetchedPPS(TComPPS *pps) { m_ppsBuffer.storePS( pps->getPPSId(), pps); }; 95 100 TComPPS* getPrefetchedPPS (Int ppsId); 96 Void storePrefetchedAPS(TComAPS *aps) { m_apsBuffer.storePS( aps->getAPSID(), aps); };97 TComAPS* getPrefetchedAPS (Int apsId);98 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B004699 Void storePrefetchedVPS(TComVPS *vps) { m_vpsBuffer.storePS( vps->getVPSId(), vps); };100 TComVPS* getPrefetchedVPS (Int vpsId);101 #endif102 101 Void applyPrefetchedPS(); 103 102 104 103 private: 104 ParameterSetMap<TComVPS> m_vpsBuffer; 105 105 ParameterSetMap<TComSPS> m_spsBuffer; 106 ParameterSetMap<TComPPS> m_ppsBuffer; 107 ParameterSetMap<TComAPS> m_apsBuffer; 108 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 109 ParameterSetMap<TComVPS> m_vpsBuffer; 110 #endif 106 ParameterSetMap<TComPPS> m_ppsBuffer; 111 107 }; 112 108 -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 37 37 38 38 #include "NALread.h" 39 #include "../../App/TAppDecoder/TAppDecTop.h"40 39 #include "TDecTop.h" 41 40 41 #if H_MV 42 ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; 43 #endif 42 44 //! \ingroup TLibDecoder 43 45 //! \{ 44 46 45 47 #if H_3D 46 48 CamParsCollector::CamParsCollector() 47 49 : m_bInitialized( false ) 48 50 { 49 m_aaiCodedOffset = new Int* [ MAX_VIEW_NUM ]; 50 m_aaiCodedScale = new Int* [ MAX_VIEW_NUM ]; 51 m_aiViewOrderIndex = new Int [ MAX_VIEW_NUM ]; 52 #if QC_MVHEVC_B0046 53 m_aiViewId = new Int [ MAX_VIEW_NUM ]; 54 #endif 55 m_aiViewReceived = new Int [ MAX_VIEW_NUM ]; 56 for( UInt uiId = 0; uiId < MAX_VIEW_NUM; uiId++ ) 57 { 58 m_aaiCodedOffset [ uiId ] = new Int [ MAX_VIEW_NUM ]; 59 m_aaiCodedScale [ uiId ] = new Int [ MAX_VIEW_NUM ]; 60 } 61 62 #if MERL_VSP_C0152 63 xCreateLUTs( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 51 m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ]; 52 m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ]; 53 m_aiViewId = new Int [ MAX_NUM_LAYERS ]; 54 55 m_bViewReceived = new Bool [ MAX_NUM_LAYERS ]; 56 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) 57 { 58 m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ]; 59 m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ]; 60 } 61 62 xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 64 63 m_iLog2Precision = LOG2_DISP_PREC_LUT; 65 64 m_uiBitDepthForLUT = 8; // fixed 66 #endif67 65 } 68 66 69 67 CamParsCollector::~CamParsCollector() 70 68 { 71 for( UInt uiId = 0; uiId < MAX_ VIEW_NUM; uiId++ )69 for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) 72 70 { 73 71 delete [] m_aaiCodedOffset [ uiId ]; … … 76 74 delete [] m_aaiCodedOffset; 77 75 delete [] m_aaiCodedScale; 78 delete [] m_aiViewOrderIndex; 79 delete [] m_aiViewReceived; 80 81 #if MERL_VSP_C0152 82 xDeleteArray( m_adBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 ); 83 xDeleteArray( m_aiBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 ); 84 #endif 76 delete [] m_aiViewId; 77 delete [] m_bViewReceived; 78 79 xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); 80 xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); 85 81 } 86 82 … … 92 88 m_uiCamParsCodedPrecision = 0; 93 89 m_bCamParsVaryOverTime = false; 94 m_iLastViewI d= -1;90 m_iLastViewIndex = -1; 95 91 m_iLastPOC = -1; 96 m_uiMaxViewId = 0; 97 } 98 99 #if MERL_VSP_C0152 92 m_uiMaxViewIndex = 0; 93 } 94 100 95 Void 101 96 CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) 102 97 { 103 //AOF( m_uiBitDepthForLUT == 8 ); 104 //AOF(radLUT == NULL && raiLUT == NULL ); 105 106 uiNumberSourceViews = Max( 1, uiNumberSourceViews ); 107 uiNumberTargetViews = Max( 1, uiNumberTargetViews ); 98 99 uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews ); 100 uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews ); 108 101 109 102 radLUT = new Double***[ uiNumberSourceViews ]; … … 159 152 raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; 160 153 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; 161 162 // maximum deviation163 //dMaxDispDev = Max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );164 //dMaxRndDispDvL = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) );165 //dMaxRndDispDvC = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );166 154 } 167 155 … … 171 159 raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; 172 160 } 173 #endif // end MERL_VSP_C0152174 161 175 162 Void … … 182 169 CamParsCollector::setSlice( TComSlice* pcSlice ) 183 170 { 171 184 172 if( pcSlice == 0 ) 185 173 { … … 191 179 return; 192 180 } 193 194 AOF( pcSlice->getSPS()->getViewId() < MAX_VIEW_NUM ); 195 #if !FCO_FIX // Under flexible coding order, depth may need the camera parameters 196 if ( pcSlice->getSPS()->isDepth () ) 181 182 if ( pcSlice->getIsDepth()) 197 183 { 198 184 return; 199 185 } 200 #endif 201 Bool bFirstAU = ( pcSlice->getPOC() == 0 ); 202 Bool bFirstSliceInAU = ( pcSlice->getPOC() != Int ( m_iLastPOC ) ); 203 Bool bFirstSliceInView = ( pcSlice->getSPS()->getViewId() != UInt( m_iLastViewId ) || bFirstSliceInAU ); 204 AOT( bFirstSliceInAU && pcSlice->getSPS()->getViewId() != 0 ); 205 #if FCO_FIX 206 #else 207 AOT( !bFirstSliceInAU && pcSlice->getSPS()->getViewId() < UInt( m_iLastViewId ) ); 208 #endif 209 AOT( !bFirstSliceInAU && pcSlice->getSPS()->getViewId() > UInt( m_iLastViewId + 1 ) ); 210 AOT( !bFirstAU && pcSlice->getSPS()->getViewId() > m_uiMaxViewId ); 186 187 Bool bFirstAU = ( pcSlice->getPOC() == 0 ); 188 Bool bFirstSliceInAU = ( pcSlice->getPOC() != Int ( m_iLastPOC ) ); 189 Bool bFirstSliceInView = ( pcSlice->getViewIndex() != UInt( m_iLastViewIndex ) || bFirstSliceInAU ); 190 191 AOT( bFirstSliceInAU && pcSlice->getViewIndex() != 0 ); 192 AOT( !bFirstSliceInAU && pcSlice->getViewIndex() < UInt( m_iLastViewIndex ) ); 193 194 AOT( !bFirstSliceInAU && pcSlice->getViewIndex() > UInt( m_iLastViewIndex + 1 ) ); 195 196 AOT( !bFirstAU && pcSlice->getViewIndex() > m_uiMaxViewIndex ); 197 211 198 if ( !bFirstSliceInView ) 212 199 { 213 200 if( m_bCamParsVaryOverTime ) // check consistency of slice parameters here 214 201 { 215 UInt uiViewI d = pcSlice->getSPS()->getViewId();216 for( UInt uiBase Id = 0; uiBaseId < uiViewId; uiBaseId++ )217 { 218 AOF( m_aaiCodedScale [ uiBase Id ][ uiViewId ] == pcSlice->getCodedScale () [ uiBaseId] );219 AOF( m_aaiCodedOffset[ uiBase Id ][ uiViewId ] == pcSlice->getCodedOffset () [ uiBaseId] );220 AOF( m_aaiCodedScale [ uiViewI d ][ uiBaseId ] == pcSlice->getInvCodedScale () [ uiBaseId] );221 AOF( m_aaiCodedOffset[ uiViewI d ][ uiBaseId ] == pcSlice->getInvCodedOffset() [ uiBaseId] );202 UInt uiViewIndex = pcSlice->getViewIndex(); 203 for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ ) 204 { 205 AOF( m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedScale () [ uiBaseViewIndex ] ); 206 AOF( m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedOffset () [ uiBaseViewIndex ] ); 207 AOF( m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedScale () [ uiBaseViewIndex ] ); 208 AOF( m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedOffset() [ uiBaseViewIndex ] ); 222 209 } 223 210 } … … 232 219 xOutput( m_iLastPOC ); 233 220 } 234 ::memset( m_ aiViewReceived, 0x00, MAX_VIEW_NUM * sizeof( Int) );235 } 236 237 UInt uiViewI d = pcSlice->getSPS()->getViewId();238 m_ aiViewReceived[ uiViewId ] = 1;221 ::memset( m_bViewReceived, false, MAX_NUM_LAYERS * sizeof( Bool ) ); 222 } 223 224 UInt uiViewIndex = pcSlice->getViewIndex(); 225 m_bViewReceived[ uiViewIndex ] = true; 239 226 if( bFirstAU ) 240 227 { 241 m_uiMaxViewI d = Max( m_uiMaxViewId, uiViewId);242 m_aiView OrderIndex[ uiViewId ] = pcSlice->getSPS()->getViewOrderIdx();243 if( uiViewI d== 1 )228 m_uiMaxViewIndex = std::max( m_uiMaxViewIndex, uiViewIndex ); 229 m_aiViewId[ uiViewIndex ] = pcSlice->getViewId(); 230 if( uiViewIndex == 1 ) 244 231 { 245 232 m_uiCamParsCodedPrecision = pcSlice->getSPS()->getCamParPrecision (); 246 233 m_bCamParsVaryOverTime = pcSlice->getSPS()->hasCamParInSliceHeader (); 247 234 } 248 else if( uiViewI d> 1 )235 else if( uiViewIndex > 1 ) 249 236 { 250 237 AOF( m_uiCamParsCodedPrecision == pcSlice->getSPS()->getCamParPrecision () ); 251 238 AOF( m_bCamParsVaryOverTime == pcSlice->getSPS()->hasCamParInSliceHeader () ); 252 239 } 253 for( UInt uiBaseI d = 0; uiBaseId < uiViewId; uiBaseId++ )240 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 254 241 { 255 242 if( m_bCamParsVaryOverTime ) 256 243 { 257 m_aaiCodedScale [ uiBaseId ][ uiViewId ] = pcSlice->getCodedScale () [ uiBaseId ]; 258 m_aaiCodedOffset[ uiBaseId ][ uiViewId ] = pcSlice->getCodedOffset () [ uiBaseId ]; 259 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId ]; 260 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId ]; 261 #if MERL_VSP_C0152 262 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 263 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 264 #endif 244 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; 245 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; 246 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; 247 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; 248 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 249 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); 265 250 } 266 251 else 267 252 { 268 m_aaiCodedScale [ uiBaseId ][ uiViewId ] = pcSlice->getSPS()->getCodedScale () [ uiBaseId ]; 269 m_aaiCodedOffset[ uiBaseId ][ uiViewId ] = pcSlice->getSPS()->getCodedOffset () [ uiBaseId ]; 270 m_aaiCodedScale [ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ]; 271 m_aaiCodedOffset[ uiViewId ][ uiBaseId ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ]; 272 #if MERL_VSP_C0152 273 xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 274 xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 275 #endif 253 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getSPS()->getCodedScale () [ uiBaseIndex ]; 254 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getSPS()->getCodedOffset () [ uiBaseIndex ]; 255 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getSPS()->getInvCodedScale () [ uiBaseIndex ]; 256 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseIndex ]; 257 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 258 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 276 259 } 277 260 } … … 279 262 else 280 263 { 281 AOF( m_aiView OrderIndex[ uiViewId ] == pcSlice->getSPS()->getViewOrderIdx() );264 AOF( m_aiViewId[ uiViewIndex ] == pcSlice->getViewId() ); 282 265 if( m_bCamParsVaryOverTime ) 283 266 { 284 for( UInt uiBaseI d = 0; uiBaseId < uiViewId; uiBaseId++ )285 { 286 m_aaiCodedScale [ uiBaseI d ][ uiViewId ] = pcSlice->getCodedScale () [ uiBaseId];287 m_aaiCodedOffset[ uiBaseI d ][ uiViewId ] = pcSlice->getCodedOffset () [ uiBaseId];288 m_aaiCodedScale [ uiViewI d ][ uiBaseId ] = pcSlice->getInvCodedScale () [ uiBaseId];289 m_aaiCodedOffset[ uiViewI d ][ uiBaseId ] = pcSlice->getInvCodedOffset() [ uiBaseId];290 #if MERL_VSP_C0152 291 xInitLUTs( uiBaseI d, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );292 xInitLUTs( uiViewI d, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );293 #endif 294 295 296 }297 m_iLastViewI d = (Int)pcSlice->getSPS()->getViewId();298 m_iLastPOC = (Int)pcSlice->getPOC();267 for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) 268 { 269 m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; 270 m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; 271 m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; 272 m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; 273 274 xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 275 xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); 276 } 277 } 278 } 279 280 m_iLastViewIndex = (Int)pcSlice->getViewIndex(); 281 m_iLastPOC = (Int)pcSlice->getPOC(); 299 282 } 300 283 … … 302 285 CamParsCollector::xIsComplete() 303 286 { 304 for( UInt uiView = 0; uiView <= m_uiMaxViewI d; uiView++ )305 { 306 if( m_ aiViewReceived[ uiView ] == 0 )287 for( UInt uiView = 0; uiView <= m_uiMaxViewIndex; uiView++ ) 288 { 289 if( m_bViewReceived[ uiView ] == 0 ) 307 290 { 308 291 return false; … … 319 302 if( iPOC == 0 ) 320 303 { 321 fprintf( m_pCodedScaleOffsetFile, "# ViewId ViewOrderIdx\n" );304 fprintf( m_pCodedScaleOffsetFile, "# ViewIndex ViewId\n" ); 322 305 fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" ); 323 for( UInt uiViewI d = 0; uiViewId <= m_uiMaxViewId; uiViewId++ )324 { 325 fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewI d, m_aiViewOrderIndex[ uiViewId] );306 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) 307 { 308 fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewIndex, m_aiViewId[ uiViewIndex ] ); 326 309 } 327 310 fprintf( m_pCodedScaleOffsetFile, "\n\n"); … … 333 316 Int iS = iPOC; 334 317 Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) ); 335 for( UInt uiViewI d = 0; uiViewId <= m_uiMaxViewId; uiViewId++ )336 { 337 for( UInt uiBaseI d = 0; uiBaseId <= m_uiMaxViewId; uiBaseId++ )318 for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) 319 { 320 for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ ) 338 321 { 339 if( uiViewI d != uiBaseId)322 if( uiViewIndex != uiBaseIndex ) 340 323 { 341 324 fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n", 342 iS, iE, uiViewI d, uiBaseId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId], m_uiCamParsCodedPrecision );325 iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_uiCamParsCodedPrecision ); 343 326 } 344 327 } … … 347 330 } 348 331 } 349 332 #endif 350 333 TDecTop::TDecTop() 351 : m_SEIs(0)352 , m_tAppDecTop( NULL )353 , m_nalUnitTypeBaseView( NAL_UNIT_INVALID )354 334 { 355 335 m_pcPic = 0; 356 m_iGopSize = 0;357 m_bGopSizeSet = false;358 336 m_iMaxRefPicNum = 0; 359 m_uiValidPS = 0;360 337 #if ENC_DEC_TRACE 361 if(!g_hTrace) g_hTrace = fopen( "TraceDec.txt", "wb" ); 338 #if H_MV 339 if ( g_hTrace == NULL ) 340 { 341 #endif 342 g_hTrace = fopen( "TraceDec.txt", "wb" ); 362 343 g_bJustDoIt = g_bEncDecTraceDisable; 363 344 g_nSymbolCounter = 0; 364 #endif 365 m_bRefreshPending = 0; 345 #if H_MV 346 } 347 #endif 348 #endif 366 349 m_pocCRA = 0; 367 m_pocRandomAccess = MAX_INT; 350 m_prevRAPisBLA = false; 351 m_pocRandomAccess = MAX_INT; 368 352 m_prevPOC = MAX_INT; 369 353 m_bFirstSliceInPicture = true; 370 354 m_bFirstSliceInSequence = true; 355 #if H_MV 356 m_layerId = 0; 357 m_viewId = 0; 358 #if H_3D 359 m_viewIndex = 0; 360 m_isDepth = false; 371 361 m_pcCamParsCollector = 0; 372 #if QC_MVHEVC_B0046 373 m_bFirstNal = false; 362 #endif 374 363 #endif 375 364 } … … 378 367 { 379 368 #if ENC_DEC_TRACE 380 if(g_hTrace) fclose( g_hTrace ); 381 g_hTrace=NULL; 369 fclose( g_hTrace ); 382 370 #endif 383 371 } … … 387 375 m_cGopDecoder.create(); 388 376 m_apcSlicePilot = new TComSlice; 389 m_uiSliceIdx = m_uiLastSliceIdx =0;377 m_uiSliceIdx = 0; 390 378 } 391 379 … … 398 386 399 387 m_cSliceDecoder.destroy(); 400 m_tAppDecTop = NULL; 401 402 #if DEPTH_MAP_GENERATION 403 m_cDepthMapGenerator.destroy(); 404 #endif 405 #if H3D_IVRP & !QC_ARP_D0177 406 m_cResidualGenerator.destroy(); 407 #endif 408 409 } 410 411 Void TDecTop::init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance ) 388 } 389 390 Void TDecTop::init() 412 391 { 413 392 // initialize ROM 414 if( bFirstInstance ) 415 { 393 #if !H_MV 416 394 initROM(); 417 } 418 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cAdaptiveLoopFilter, &m_cSAO 419 #if DEPTH_MAP_GENERATION 420 , &m_cDepthMapGenerator 421 #endif 422 #if H3D_IVRP & !QC_ARP_D0177 423 , &m_cResidualGenerator 424 #endif 425 ); 395 #endif 396 m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO ); 426 397 m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); 427 398 m_cEntropyDecoder.init(&m_cPrediction); 428 m_tAppDecTop = pcTAppDecTop;429 #if DEPTH_MAP_GENERATION430 #if VIDYO_VPS_INTEGRATION431 m_cDepthMapGenerator.init( &m_cPrediction, m_tAppDecTop->getVPSAccess(), m_tAppDecTop->getSPSAccess(), m_tAppDecTop->getAUPicAccess() );432 #else433 m_cDepthMapGenerator.init( &m_cPrediction, m_tAppDecTop->getSPSAccess(), m_tAppDecTop->getAUPicAccess() );434 #endif435 #endif436 #if H3D_IVRP & !QC_ARP_D0177437 m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator );438 #endif439 399 } 440 400 … … 446 406 for (Int i = 0; i < iSize; i++ ) 447 407 { 448 if( *iterPic ) 449 { 450 TComPic* pcPic = *(iterPic++); 451 pcPic->destroy(); 408 TComPic* pcPic = *(iterPic++); 409 #if H_MV 410 if( pcPic ) 411 { 412 #endif 413 pcPic->destroy(); 452 414 453 delete pcPic; 454 pcPic = NULL; 455 } 456 } 457 458 // destroy ALF temporary buffers 459 m_cAdaptiveLoopFilter.destroy(); 460 415 delete pcPic; 416 pcPic = NULL; 417 #if H_MV 418 } 419 #endif 420 } 421 461 422 m_cSAO.destroy(); 462 423 463 424 m_cLoopFilter. destroy(); 464 425 426 #if !H_MV 465 427 // destroy ROM 466 if(m_viewId == 0 && m_isDepth == false) 467 { 468 destroyROM(); 469 } 470 } 471 472 #if H3D_IVRP 473 Void 474 TDecTop::deleteExtraPicBuffers( Int iPoc ) 475 { 476 TComPic* pcPic = 0; 477 TComList<TComPic*>::iterator cIter = m_cListPic.begin(); 478 TComList<TComPic*>::iterator cEnd = m_cListPic.end (); 479 for( ; cIter != cEnd; cIter++ ) 480 { 481 if( (*cIter)->getPOC() == iPoc ) 482 { 483 pcPic = *cIter; 484 break; 485 } 486 } 487 //AOF( pcPic ); 488 if ( pcPic ) 489 { 490 pcPic->removeResidualBuffer (); 491 } 492 } 493 #endif 494 495 496 Void 497 TDecTop::compressMotion( Int iPoc ) 498 { 499 TComPic* pcPic = 0; 500 TComList<TComPic*>::iterator cIter = m_cListPic.begin(); 501 TComList<TComPic*>::iterator cEnd = m_cListPic.end (); 502 for( ; cIter != cEnd; cIter++ ) 503 { 504 if( (*cIter)->getPOC() == iPoc ) 505 { 506 pcPic = *cIter; 507 break; 508 } 509 } 510 // AOF( pcPic ); 511 if ( pcPic ) 512 { 513 pcPic->compressMotion(); 514 } 515 } 516 517 Void TDecTop::xUpdateGopSize (TComSlice* pcSlice) 518 { 519 if ( !pcSlice->isIntra() && !m_bGopSizeSet) 520 { 521 m_iGopSize = pcSlice->getPOC(); 522 m_bGopSizeSet = true; 523 524 m_cGopDecoder.setGopSize(m_iGopSize); 525 } 428 destroyROM(); 429 #endif 526 430 } 527 431 528 432 Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic ) 529 433 { 530 xUpdateGopSize(pcSlice); 531 532 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 533 534 #if DEPTH_MAP_GENERATION 535 UInt uiPdm = ( pcSlice->getSPS()->getViewId() ? pcSlice->getSPS()->getPredDepthMapGeneration() : m_tAppDecTop->getSPSAccess()->getPdm() ); 536 Bool bNeedPrdDepthMapBuffer = ( !pcSlice->getSPS()->isDepth() && uiPdm > 0 ); 537 #endif 538 434 Int numReorderPics[MAX_TLAYER]; 435 Window &conformanceWindow = pcSlice->getSPS()->getConformanceWindow(); 436 Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window(); 437 438 for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) 439 { 440 numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer); 441 } 442 443 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 539 444 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 540 445 { 541 446 rpcPic = new TComPic(); 542 447 543 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true); 544 545 #if DEPTH_MAP_GENERATION 546 if( bNeedPrdDepthMapBuffer ) 547 { 548 rpcPic->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(uiPdm), PDM_SUB_SAMP_EXP_Y(uiPdm) ); 549 } 550 #endif 551 448 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 449 conformanceWindow, defaultDisplayWindow, numReorderPics, true); 450 rpcPic->getPicSym()->allocSaoParam(&m_cSAO); 552 451 m_cListPic.pushBack( rpcPic ); 553 452 … … 584 483 m_cListPic.pushBack( rpcPic ); 585 484 } 586 rpcPic->destroy(); 587 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);588 #if DEPTH_MAP_GENERATION 589 if( bNeedPrdDepthMapBuffer && !rpcPic->getPredDepthMap() )590 { 591 rpcPic->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(uiPdm), PDM_SUB_SAMP_EXP_Y(uiPdm) ); 592 } 593 #endif 594 } 595 596 Void TDecTop::executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame, Int& iPOCLastDisplay) 485 rpcPic->destroy(); 486 rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, 487 conformanceWindow, defaultDisplayWindow, numReorderPics, true); 488 rpcPic->getPicSym()->allocSaoParam(&m_cSAO); 489 } 490 491 #if H_MV 492 Void TDecTop::endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet ) 493 #else 494 Void TDecTop::executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic) 495 #endif 597 496 { 598 497 if (!m_pcPic) … … 604 503 TComPic*& pcPic = m_pcPic; 605 504 606 // Execute Deblock and ALF only+ Cleanup607 608 m_cGopDecoder. decompressGop(NULL, pcPic, true);505 // Execute Deblock + Cleanup 506 507 m_cGopDecoder.filterPicture(pcPic); 609 508 610 509 TComSlice::sortPicList( m_cListPic ); // sorting for application output 611 ruiPOC= pcPic->getSlice(m_uiSliceIdx-1)->getPOC();510 poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC(); 612 511 rpcListPic = &m_cListPic; 613 512 m_cCuDecoder.destroy(); 513 #if H_MV 514 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 515 TComSlice::markCurrPic( pcPic ); 516 TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 517 #endif 614 518 m_bFirstSliceInPicture = true; 615 519 … … 624 528 cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); 625 529 cFillSlice.initSlice(); 626 cFillSlice.initTiles();627 530 TComPic *cFillPic; 628 531 xGetNewPicBuffer(&cFillSlice,cFillPic); … … 630 533 cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); 631 534 cFillPic->getSlice(0)->initSlice(); 632 cFillPic->getSlice(0)->initTiles();633 634 635 535 636 536 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); … … 674 574 { 675 575 m_parameterSetManagerDecoder.applyPrefetchedPS(); 676 576 677 577 TComPPS *pps = m_parameterSetManagerDecoder.getPPS(m_apcSlicePilot->getPPSId()); 678 578 assert (pps != 0); … … 680 580 TComSPS *sps = m_parameterSetManagerDecoder.getSPS(pps->getSPSId()); 681 581 assert (sps != 0); 682 #if VIDYO_VPS_INTEGRATION 683 TComVPS *vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId()); 684 assert (vps != 0); 685 #if !QC_REM_IDV_B0046 686 if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) 687 #else 688 if( (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) && !sps->getViewId() ) 689 #endif 690 // VPS can only be activated on IDR or CRA... 691 getTAppDecTop()->getVPSAccess()->setActiveVPSId( sps->getVPSId() ); 692 #endif 582 583 if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) 584 { 585 printf ("Parameter set activation failed!"); 586 assert (0); 587 } 588 589 if( pps->getDependentSliceSegmentsEnabledFlag() ) 590 { 591 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; 592 593 if (m_cSliceDecoder.getCtxMemSize() != NumCtx) 594 { 595 m_cSliceDecoder.initCtxMem(NumCtx); 596 for ( UInt st = 0; st < NumCtx; st++ ) 597 { 598 TDecSbac* ctx = NULL; 599 ctx = new TDecSbac; 600 ctx->init( &m_cBinCABAC ); 601 m_cSliceDecoder.setCtxMem( ctx, st ); 602 } 603 } 604 } 605 693 606 m_apcSlicePilot->setPPS(pps); 694 607 m_apcSlicePilot->setSPS(sps); 695 #if QC_MVHEVC_B0046 696 TComVPS *vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId()); 697 #endif 698 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 699 m_apcSlicePilot->setVPS(vps); 608 #if H_MV 609 m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() ); 700 610 #endif 701 611 pps->setSPS(sps); 702 703 if(sps->getUseSAO() || sps->getUseALF()|| sps->getScalingListFlag() || sps->getUseDF()) 704 { 705 m_apcSlicePilot->setAPS( m_parameterSetManagerDecoder.getAPS(m_apcSlicePilot->getAPSId()) ); 706 } 612 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); 707 613 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); 708 614 709 for (Int i = 0; i < sps->getMaxCUDepth() - 1; i++) 615 g_bitDepthY = sps->getBitDepthY(); 616 g_bitDepthC = sps->getBitDepthC(); 617 g_uiMaxCUWidth = sps->getMaxCUWidth(); 618 g_uiMaxCUHeight = sps->getMaxCUHeight(); 619 g_uiMaxCUDepth = sps->getMaxCUDepth(); 620 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 621 622 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) 710 623 { 711 624 sps->setAMPAcc( i, sps->getUseAMP() ); 712 625 } 713 626 714 for (Int i = sps->get MaxCUDepth() - 1; i < sps->getMaxCUDepth(); i++)627 for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) 715 628 { 716 629 sps->setAMPAcc( i, 0 ); 717 630 } 718 631 719 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 720 m_cLoopFilter. create( g_uiMaxCUDepth ); 721 } 722 632 m_cSAO.destroy(); 633 m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() ); 634 m_cLoopFilter.create( sps->getMaxCUDepth() ); 635 } 636 637 #if H_MV 638 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ) 639 { 640 assert( nalu.m_layerId == m_layerId ); 641 642 #else 723 643 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 724 644 { 645 #endif 725 646 TComPic*& pcPic = m_pcPic; 726 647 m_apcSlicePilot->initSlice(); 727 648 728 //!!!KS: DIRTY HACK729 m_apcSlicePilot->setPPSId(0);730 m_apcSlicePilot->setPPS(m_parameterSetManagerDecoder.getPrefetchedPPS(0));731 m_apcSlicePilot->setSPS(m_parameterSetManagerDecoder.getPrefetchedSPS(0));732 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046733 #if QC_MVHEVC_B0046734 m_apcSlicePilot->setIsDepth(false);735 #endif736 m_apcSlicePilot->setVPS(m_parameterSetManagerDecoder.getPrefetchedVPS(0));737 #endif738 m_apcSlicePilot->initTiles();739 #if QC_MVHEVC_B0046740 m_apcSlicePilot->setViewId( nalu.m_layerId );741 m_apcSlicePilot->setViewId( nalu.m_layerId );742 m_apcSlicePilot->setViewOrderIdx(m_apcSlicePilot->getVPS()->getViewId(nalu.m_layerId), nalu.m_layerId);743 Int iNumDirectRef = m_apcSlicePilot->getVPS()->getNumDirectRefLayer(nalu.m_layerId);744 m_apcSlicePilot->getSPS()->setNumberOfUsableInterViewRefs(iNumDirectRef);745 for(Int iNumIvRef = 0; iNumIvRef < iNumDirectRef; iNumIvRef ++)746 {747 Int iDeltaLayerId = m_apcSlicePilot->getVPS()->getDirectRefLayerId( nalu.m_layerId, iNumIvRef);748 m_apcSlicePilot->getSPS()->setUsableInterViewRef(iNumIvRef, (iDeltaLayerId-nalu.m_layerId));749 }750 #endif751 649 if (m_bFirstSliceInPicture) 752 650 { 753 651 m_uiSliceIdx = 0; 754 m_uiLastSliceIdx = 0;755 652 } 756 653 m_apcSlicePilot->setSliceIdx(m_uiSliceIdx); … … 761 658 762 659 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 763 if( m_bFirstSliceInPicture ) 764 { 765 #if QC_MVHEVC_B0046 766 if( nalu.m_layerId == 0 ) { m_nalUnitTypeBaseView = nalu.m_nalUnitType; } 767 else { m_nalUnitTypeBaseView = m_tAppDecTop->getTDecTop( 0, 0 )->getNalUnitTypeBaseView(); } 768 #else 769 #if VIDYO_VPS_INTEGRATION 770 if( m_apcSlicePilot->getVPS()->getViewId(nalu.m_layerId) == 0 ) { m_nalUnitTypeBaseView = nalu.m_nalUnitType; } 771 else { m_nalUnitTypeBaseView = m_tAppDecTop->getTDecTop( 0, m_apcSlicePilot->getVPS()->getDepthFlag(nalu.m_layerId) )->getNalUnitTypeBaseView(); } 772 #else 773 if( nalu.m_viewId == 0 ) { m_nalUnitTypeBaseView = nalu.m_nalUnitType; } 774 else { m_nalUnitTypeBaseView = m_tAppDecTop->getTDecTop( 0, nalu.m_isDepth )->getNalUnitTypeBaseView(); } 775 #endif 776 #endif 777 m_apcSlicePilot->setNalUnitTypeBaseViewMvc( m_nalUnitTypeBaseView ); 778 } 779 780 m_apcSlicePilot->setReferenced(nalu.m_nalRefFlag); 660 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 661 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 662 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 663 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 664 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 665 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 666 667 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 781 668 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 782 669 783 // ALF CU parameters should be part of the slice header -> needs to be fixed 784 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 785 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet(),m_apcSlicePilot->getVPS()->getDepthFlag(nalu.m_layerId)); 786 #else 787 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet()); 788 #endif 789 // byte align 790 { 791 Int numBitsForByteAlignment = nalu.m_Bitstream->getNumBitsUntilByteAligned(); 792 if ( numBitsForByteAlignment > 0 ) 793 { 794 UInt bitsForByteAlignment; 795 nalu.m_Bitstream->read( numBitsForByteAlignment, bitsForByteAlignment ); 796 assert( bitsForByteAlignment == ( ( 1 << numBitsForByteAlignment ) - 1 ) ); 797 } 798 } 799 670 #if H_MV 671 m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer ); 672 m_apcSlicePilot->setLayerId( nalu.m_layerId ); 673 #endif 674 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); 675 676 #if H_MV 677 TComVPS* vps = m_apcSlicePilot->getVPS(); 678 Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 679 setViewId ( vps->getViewId ( layerIdInVps ) ); 680 #if H_3D 681 setViewIndex( vps->getViewIndex( layerIdInVps ) ); 682 setIsDepth ( vps->getDepthId ( layerIdInVps ) == 1 ); 683 m_ivPicLists->setVPS( vps ); 684 #endif 685 #endif 686 // Skip pictures due to random access 687 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 688 { 689 return false; 690 } 691 // Skip TFD pictures associated with BLA/BLANT pictures 692 if (isSkipPictureForBLA(iPOCLastDisplay)) 693 { 694 return false; 695 } 696 697 //we should only get a different poc for a new picture (with CTU address==0) 698 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) 699 { 700 printf ("Warning, the first slice of a picture might have been lost!\n"); 701 } 800 702 // exit when a new picture is found 801 if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)703 if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) 802 704 { 803 705 if (m_prevPOC >= m_pocRandomAccess) … … 808 710 m_prevPOC = m_apcSlicePilot->getPOC(); 809 711 } 712 #if H_MV 713 if ( newLayerFlag ) 714 { 715 return false; 716 } 717 #if ENC_DEC_TRACE 718 #if H_MV_ENC_DEC_TRAC 719 // parse remainder of SH 720 g_disableHLSTrace = false; 721 #endif 722 #endif 723 #endif 810 724 // actual decoding starts here 811 725 xActivateParameterSets(); 812 m_apcSlicePilot->initTiles();813 726 814 727 if (m_apcSlicePilot->isNextSlice()) … … 817 730 } 818 731 m_bFirstSliceInSequence = false; 819 if (m_apcSlicePilot->isNextSlice())820 {821 // Skip pictures due to random access822 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))823 {824 return false;825 }826 }827 732 //detect lost reference picture and insert copy of earlier frame. 828 while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess) > 0) 829 { 830 xCreateLostPicture(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), false)-1); 733 Int lostPoc; 734 while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0) 735 { 736 xCreateLostPicture(lostPoc-1); 831 737 } 832 738 if (m_bFirstSliceInPicture) … … 835 741 m_cPrediction.initTempBuff(); 836 742 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 743 #if H_MV 744 m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 745 #endif 837 746 // Get a new picture buffer 838 747 xGetNewPicBuffer (m_apcSlicePilot, pcPic); 839 748 840 #if INTER_VIEW_VECTOR_SCALING_C0115 841 pcPic->setViewOrderIdx( m_apcSlicePilot->getVPS()->getViewOrderIdx(nalu.m_layerId) ); // will be changed to view_id 842 #endif 843 /* transfer any SEI messages that have been received to the picture */ 749 // transfer any SEI messages that have been received to the picture 844 750 pcPic->setSEIs(m_SEIs); 845 m_SEIs = NULL;751 m_SEIs.clear(); 846 752 847 753 // Recursive structure … … 850 756 m_cTrQuant.init ( g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getMaxTrSize()); 851 757 852 m_cSliceDecoder.create( m_apcSlicePilot, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);853 #if DEPTH_MAP_GENERATION 854 UInt uiPdm = ( m_apcSlicePilot->getSPS()->getViewId() ? m_apcSlicePilot->getSPS()->getPredDepthMapGeneration() : m_tAppDecTop->getSPSAccess()->getPdm() );855 m_cDepthMapGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement, PDM_SUB_SAMP_EXP_X(uiPdm), PDM_SUB_SAMP_EXP_Y(uiPdm) );856 TComDepthMapGenerator* pcDMG0 = m_tAppDecTop->getDecTop0()->getDepthMapGenerator();857 if( m_apcSlicePilot->getSPS()->getViewId() == 1 && ( pcDMG0->getSubSampExpX() != PDM_SUB_SAMP_EXP_X(uiPdm) || pcDMG0->getSubSampExpY() != PDM_SUB_SAMP_EXP_Y(uiPdm) ))858 { 859 pcDMG0->create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement, PDM_SUB_SAMP_EXP_X(uiPdm), PDM_SUB_SAMP_EXP_Y(uiPdm) );860 }861 #endif 862 #if H3D_IVRP & !QC_ARP_D0177 863 m_cResidualGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement);864 #endif 865 } 866 758 m_cSliceDecoder.create(); 759 } 760 else 761 { 762 // Check if any new SEI has arrived 763 if(!m_SEIs.empty()) 764 { 765 // Currently only decoding Unit SEI message occurring between VCL NALUs copied 766 SEIMessages &picSEI = pcPic->getSEIs(); 767 SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); 768 picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); 769 deleteSEIs(m_SEIs); 770 } 771 } 772 867 773 // Set picture slice pointer 868 774 TComSlice* pcSlice = m_apcSlicePilot; … … 873 779 UInt i, j, p; 874 780 875 876 if( pcSlice->getPPS()->getColumnRowInfoPresent() == 1 ) 877 { 878 //set NumColumnsMins1 and NumRowsMinus1 879 pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getPPS()->getNumColumnsMinus1() ); 880 pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getPPS()->getNumRowsMinus1() ); 881 882 //create the TComTileArray 883 pcPic->getPicSym()->xCreateTComTileArray(); 884 885 if( pcSlice->getPPS()->getUniformSpacingIdr() == 1) 886 { 887 //set the width for each tile 888 for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) 889 { 890 for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) 891 { 892 pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> 893 setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) 894 - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); 895 } 896 } 897 898 //set the height for each tile 899 for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) 900 { 901 for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) 902 { 903 pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> 904 setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) 905 - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); 906 } 907 } 908 } 909 else 910 { 911 //set the width for each tile 912 for(j=0; j < pcSlice->getPPS()->getNumRowsMinus1()+1; j++) 913 { 914 uiCummulativeTileWidth = 0; 915 for(i=0; i < pcSlice->getPPS()->getNumColumnsMinus1(); i++) 916 { 917 pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcSlice->getPPS()->getColumnWidth(i) ); 918 uiCummulativeTileWidth += pcSlice->getPPS()->getColumnWidth(i); 919 } 920 pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); 921 } 922 923 //set the height for each tile 924 for(j=0; j < pcSlice->getPPS()->getNumColumnsMinus1()+1; j++) 925 { 926 uiCummulativeTileHeight = 0; 927 for(i=0; i < pcSlice->getPPS()->getNumRowsMinus1(); i++) 928 { 929 pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcSlice->getPPS()->getRowHeight(i) ); 930 uiCummulativeTileHeight += pcSlice->getPPS()->getRowHeight(i); 931 } 932 pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); 781 //set NumColumnsMins1 and NumRowsMinus1 782 pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getPPS()->getNumColumnsMinus1() ); 783 pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getPPS()->getNumRowsMinus1() ); 784 785 //create the TComTileArray 786 pcPic->getPicSym()->xCreateTComTileArray(); 787 788 if( pcSlice->getPPS()->getUniformSpacingFlag() ) 789 { 790 //set the width for each tile 791 for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) 792 { 793 for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) 794 { 795 pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> 796 setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) 797 - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); 798 } 799 } 800 801 //set the height for each tile 802 for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) 803 { 804 for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) 805 { 806 pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> 807 setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) 808 - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); 933 809 } 934 810 } … … 936 812 else 937 813 { 938 //set NumColumnsMins1 and NumRowsMinus1 939 pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getSPS()->getNumColumnsMinus1() ); 940 pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getSPS()->getNumRowsMinus1() ); 941 942 //create the TComTileArray 943 pcPic->getPicSym()->xCreateTComTileArray(); 944 945 //automatically set the column and row boundary if UniformSpacingIdr = 1 946 if( pcSlice->getSPS()->getUniformSpacingIdr() == 1 ) 947 { 948 //set the width for each tile 949 for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) 950 { 951 for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) 952 { 953 pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> 954 setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) 955 - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); 956 } 957 } 958 959 //set the height for each tile 960 for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) 961 { 962 for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) 963 { 964 pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> 965 setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) 966 - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); 967 } 968 } 969 } 970 else 971 { 972 //set the width for each tile 973 for(j=0; j < pcSlice->getSPS()->getNumRowsMinus1()+1; j++) 974 { 975 uiCummulativeTileWidth = 0; 976 for(i=0; i < pcSlice->getSPS()->getNumColumnsMinus1(); i++) 977 { 978 pcPic->getPicSym()->getTComTile(j * (pcSlice->getSPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcSlice->getSPS()->getColumnWidth(i) ); 979 uiCummulativeTileWidth += pcSlice->getSPS()->getColumnWidth(i); 980 } 981 pcPic->getPicSym()->getTComTile(j * (pcSlice->getSPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); 982 } 983 984 //set the height for each tile 985 for(j=0; j < pcSlice->getSPS()->getNumColumnsMinus1()+1; j++) 986 { 987 uiCummulativeTileHeight = 0; 988 for(i=0; i < pcSlice->getSPS()->getNumRowsMinus1(); i++) 989 { 990 pcPic->getPicSym()->getTComTile(i * (pcSlice->getSPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcSlice->getSPS()->getRowHeight(i) ); 991 uiCummulativeTileHeight += pcSlice->getSPS()->getRowHeight(i); 992 } 993 pcPic->getPicSym()->getTComTile(i * (pcSlice->getSPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); 994 } 814 //set the width for each tile 815 for(j=0; j < pcSlice->getPPS()->getNumRowsMinus1()+1; j++) 816 { 817 uiCummulativeTileWidth = 0; 818 for(i=0; i < pcSlice->getPPS()->getNumColumnsMinus1(); i++) 819 { 820 pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcSlice->getPPS()->getColumnWidth(i) ); 821 uiCummulativeTileWidth += pcSlice->getPPS()->getColumnWidth(i); 822 } 823 pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); 824 } 825 826 //set the height for each tile 827 for(j=0; j < pcSlice->getPPS()->getNumColumnsMinus1()+1; j++) 828 { 829 uiCummulativeTileHeight = 0; 830 for(i=0; i < pcSlice->getPPS()->getNumRowsMinus1(); i++) 831 { 832 pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcSlice->getPPS()->getRowHeight(i) ); 833 uiCummulativeTileHeight += pcSlice->getPPS()->getRowHeight(i); 834 } 835 pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); 995 836 } 996 837 } … … 1008 849 pcPic->getPicSym()->setInverseCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); 1009 850 1010 //convert the start and end CU addresses of the slice and entropyslice into encoding order1011 pcSlice->set EntropySliceCurStartCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getEntropySliceCurStartCUAddr()) );1012 pcSlice->set EntropySliceCurEndCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getEntropySliceCurEndCUAddr()) );851 //convert the start and end CU addresses of the slice and dependent slice into encoding order 852 pcSlice->setSliceSegmentCurStartCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurStartCUAddr()) ); 853 pcSlice->setSliceSegmentCurEndCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurEndCUAddr()) ); 1013 854 if(pcSlice->isNextSlice()) 1014 855 { … … 1034 875 pcPic->setTLayer(nalu.m_temporalId); 1035 876 877 #if H_MV 878 pcPic->setLayerId( nalu.m_layerId ); 879 pcPic->setViewId ( getViewId() ); 880 #if H_3D 881 pcPic->setViewIndex( getViewIndex() ); 882 pcPic->setIsDepth ( getIsDepth () ); 883 #endif 884 #endif 1036 885 if (bNextSlice) 1037 886 { 1038 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_cListPic); 1039 1040 if ( !pcSlice->getPPS()->getEnableTMVPFlag() && pcPic->getTLayer() == 0 ) 1041 { 1042 pcSlice->decodingMarkingForNoTMVP( m_cListPic, pcSlice->getPOC() ); 1043 } 1044 1045 // Set reference list 1046 #if !QC_MVHEVC_B0046 1047 #if VIDYO_VPS_INTEGRATION 1048 pcSlice->setViewId( pcSlice->getVPS()->getViewId(nalu.m_layerId) ); 1049 pcSlice->setIsDepth( pcSlice->getVPS()->getDepthFlag(nalu.m_layerId) ); 887 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic ); 888 // Set reference list 889 #if H_MV 890 pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true ); 891 #if H_3D_ARP 892 pcSlice->setARPStepNum(); 893 if( pcSlice->getARPStepNum() > 1 ) 894 { 895 for(Int iLayerId = 0; iLayerId < nalu.m_layerId; iLayerId ++ ) 896 { 897 Int iViewIdx = pcSlice->getVPS()->getViewIndex(iLayerId); 898 Bool bIsDepth = ( pcSlice->getVPS()->getDepthId ( iLayerId ) == 1 ); 899 if( iViewIdx<getViewIndex() && !bIsDepth ) 900 { 901 pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx ); 902 } 903 } 904 } 905 #endif 1050 906 #else 1051 pcSlice->setViewId(m_viewId); 1052 pcSlice->setIsDepth(m_isDepth); 1053 #endif 1054 #endif 1055 1056 #if INTER_VIEW_VECTOR_SCALING_C0115 1057 #if VIDYO_VPS_INTEGRATION 1058 pcSlice->setViewOrderIdx( pcSlice->getVPS()->getViewOrderIdx(nalu.m_layerId) ); // will be changed to view_id 907 #if FIX1071 908 pcSlice->setRefPicList( m_cListPic, true ); 1059 909 #else 1060 pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() ); 1061 #endif 1062 #endif 1063 1064 #if INTER_VIEW_VECTOR_SCALING_C0115 1065 pcSlice->setIVScalingFlag( pcSlice->getVPS()->getIVScalingFlag()); 1066 #endif 1067 1068 assert( m_tAppDecTop != NULL ); 1069 TComPic * const pcTexturePic = m_isDepth ? m_tAppDecTop->getPicFromView( m_viewId, pcSlice->getPOC(), false ) : NULL; 1070 1071 #if FLEX_CODING_ORDER_M23723 1072 if (pcTexturePic != NULL) 1073 { 1074 assert( !m_isDepth || pcTexturePic != NULL ); 1075 pcSlice->setTexturePic( pcTexturePic ); 1076 } 1077 #else 1078 assert( !m_isDepth || pcTexturePic != NULL ); 1079 pcSlice->setTexturePic( pcTexturePic ); 1080 #endif 1081 1082 1083 std::vector<TComPic*> apcInterViewRefPics = m_tAppDecTop->getInterViewRefPics( m_viewId, pcSlice->getPOC(), m_isDepth, pcSlice->getSPS() ); 1084 pcSlice->setRefPicListMvc( m_cListPic, apcInterViewRefPics ); 1085 #if QC_ARP_D0177 1086 //pcSlice->setBaseViewRefPicList( m_tAppDecTop->getTDecTop( 0 , false )->getListPic() ); 1087 pcSlice->setARPStepNum(); 1088 if(pcSlice->getARPStepNum() > 1) 1089 { 1090 for(Int iViewIdx = 0; iViewIdx < pcSlice->getViewId(); iViewIdx ++ ) 1091 pcSlice->setBaseViewRefPicList( m_tAppDecTop->getTDecTop( iViewIdx, false )->getListPic(), iViewIdx ); 1092 } 910 pcSlice->setRefPicList( m_cListPic ); 911 #endif 912 913 #endif 914 915 #if H_3D 916 pcSlice->setIvPicLists( m_ivPicLists ); 917 #if H_3D_IV_MERGE 918 assert( !getIsDepth() || ( pcSlice->getTexturePic() != 0 ) ); 919 #endif 1093 920 #endif 1094 921 // For generalized B … … 1104 931 } 1105 932 } 1106 if ( pcSlice->isInterB())933 if (!pcSlice->isIntra()) 1107 934 { 1108 935 Bool bLowDelay = true; … … 1117 944 } 1118 945 } 1119 for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++)1120 { 1121 if ( pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() > iCurrPOC)946 if (pcSlice->isInterB()) 947 { 948 for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++) 1122 949 { 1123 bLowDelay = false; 1124 } 950 if ( pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() > iCurrPOC ) 951 { 952 bLowDelay = false; 953 } 954 } 1125 955 } 1126 956 … … 1129 959 1130 960 //--------------- 1131 pcSlice->setRefPOCnViewListsMvc(); 1132 1133 if(!pcSlice->getRefPicListModificationFlagLC()) 1134 { 1135 pcSlice->generateCombinedList(); 1136 } 1137 1138 #if !FIX_LGE_WP_FOR_3D_C0223 1139 if( pcSlice->getRefPicListCombinationFlag() && pcSlice->getPPS()->getWPBiPredIdc()==1 && pcSlice->getSliceType()==B_SLICE ) 1140 { 1141 pcSlice->setWpParamforLC(); 1142 } 1143 #endif 1144 pcSlice->setNoBackPredFlag( false ); 1145 if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag()) 1146 { 1147 if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) ) 1148 { 1149 pcSlice->setNoBackPredFlag( true ); 1150 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ ) 1151 { 1152 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) ) 1153 { 1154 pcSlice->setNoBackPredFlag( false ); 1155 break; 1156 } 1157 } 1158 } 1159 } 961 pcSlice->setRefPOCList(); 962 #if H_3D_TMVP 963 if(pcSlice->getLayerId()) 964 pcSlice->generateAlterRefforTMVP(); 965 #endif 1160 966 } 1161 967 … … 1163 969 if(pcSlice->getSPS()->getScalingListFlag()) 1164 970 { 1165 if(pcSlice->getAPS()->getScalingListEnabled()) 1166 { 1167 pcSlice->setScalingList ( pcSlice->getAPS()->getScalingList() ); 1168 if(pcSlice->getScalingList()->getScalingListPresentFlag()) 1169 { 1170 pcSlice->setDefaultScalingList(); 1171 } 1172 m_cTrQuant.setScalingListDec(pcSlice->getScalingList()); 1173 } 971 pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList() ); 972 if(pcSlice->getPPS()->getScalingListPresentFlag()) 973 { 974 pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList() ); 975 } 976 pcSlice->getScalingList()->setUseTransformSkip(pcSlice->getPPS()->getUseTransformSkip()); 977 if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag()) 978 { 979 pcSlice->setDefaultScalingList(); 980 } 981 m_cTrQuant.setScalingListDec(pcSlice->getScalingList()); 1174 982 m_cTrQuant.setUseScalingList(true); 1175 983 } … … 1180 988 } 1181 989 1182 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1183 if( m_parameterSetManagerDecoder.getPrefetchedSPS(0)->getUseDMM() && g_aacWedgeLists.empty() ) 1184 { 1185 initWedgeLists(); 1186 } 1187 #endif 1188 1189 #if FCO_DVP_REFINE_C0132_C0170 1190 if(m_bFirstSliceInPicture) 1191 { 1192 pcPic->setDepthCoded(false); 1193 1194 if(m_viewId != 0) 1195 { 1196 if( m_isDepth == 0) 1197 { 1198 TComPic * recDepthMapBuffer; 1199 recDepthMapBuffer = m_tAppDecTop->getPicFromView( m_viewId, pcSlice->getPOC(), true ); 1200 pcPic->setRecDepthMap(recDepthMapBuffer); 1201 1202 if(recDepthMapBuffer != NULL) 1203 { 1204 pcPic->setDepthCoded(true); 1205 } 1206 } 1207 } 1208 } 1209 #endif 1210 1211 1212 #if MERL_VSP_C0152 // set BW LUT 1213 if( m_pcCamParsCollector ) // Initialize the LUT elements 990 // Decode a picture 991 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 992 #if H_3D 993 if( m_pcCamParsCollector ) 1214 994 { 1215 995 m_pcCamParsCollector->setSlice( pcSlice ); 1216 996 } 1217 if( pcSlice->getViewId() !=0 ) 1218 { 1219 TComPic* pcBaseTxtPic = m_tAppDecTop->getPicFromView( 0, pcSlice->getPOC(), false ); // get base view reconstructed texture 1220 TComPic* pcBaseDepthPic = m_tAppDecTop->getPicFromView( 0, pcSlice->getPOC(), true ); // get base view reconstructed depth 1221 pcSlice->setRefPicBaseTxt(pcBaseTxtPic); 1222 pcSlice->setRefPicBaseDepth(pcBaseDepthPic); 1223 } 1224 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 1225 getTAppDecTop()->setBWVSPLUT( pcSlice, pcSlice->getViewId(), pcSlice->getPOC() ); // get the LUT for backward warping 1226 #else 1227 if (pcSlice->getViewId() != 0) 1228 { 1229 Bool isDepth = true; 1230 for(Int refviewId = 0; refviewId < (pcSlice->getViewId()); refviewId++) 1231 { 1232 if (m_tAppDecTop->getTDecTop( refviewId, isDepth )) 1233 { 1234 pcSlice->setListDepthPic(m_tAppDecTop->getTDecTop( refviewId, isDepth )->getListPic(), refviewId); // The list will store only the depth pictures 1235 } 1236 getTAppDecTop()->setBWVSPLUT( refviewId, pcSlice, pcSlice->getViewId(), pcSlice->getPOC() ); // get the LUT for backward warping 1237 } 1238 } 1239 #endif 1240 #endif 1241 1242 // Decode a picture 1243 m_cGopDecoder.decompressGop(nalu.m_Bitstream, pcPic, false); 1244 1245 #if QC_IV_AS_LT_B0046 1246 std::vector<TComPic*> apcInterViewRefPics = m_tAppDecTop->getInterViewRefPics( m_viewId, pcSlice->getPOC(), m_isDepth, pcSlice->getSPS() ); 1247 for( Int k = 0; k < apcInterViewRefPics.size(); k++ ) 1248 { 1249 TComPic* pcPicIv = apcInterViewRefPics[k]; 1250 pcPicIv->setIsLongTerm( 0 ); 1251 } 1252 #endif 1253 if( m_pcCamParsCollector ) 1254 { 1255 m_pcCamParsCollector->setSlice( pcSlice ); 1256 } 1257 997 #endif 1258 998 m_bFirstSliceInPicture = false; 1259 999 m_uiSliceIdx++; … … 1262 1002 } 1263 1003 1264 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B00461265 1004 Void TDecTop::xDecodeVPS() 1266 1005 { … … 1269 1008 m_cEntropyDecoder.decodeVPS( vps ); 1270 1009 m_parameterSetManagerDecoder.storePrefetchedVPS(vps); 1271 #if !QC_MVHEVC_B0046 1272 getTAppDecTop()->getVPSAccess()->addVPS( vps ); 1273 #endif 1274 } 1275 #endif 1010 } 1276 1011 1277 1012 Void TDecTop::xDecodeSPS() 1278 1013 { 1279 1014 TComSPS* sps = new TComSPS(); 1280 TComRPSList* rps = new TComRPSList(); 1281 sps->setRPSList(rps); 1282 #if HHI_MPI || H3D_QTL 1283 m_cEntropyDecoder.decodeSPS( sps, m_isDepth ); 1015 #if H_MV 1016 sps->setLayerId( getLayerId() ); 1017 #endif 1018 #if H_3D 1019 // Preliminary fix. assuming that all sps refer to the same SPS. 1020 // Parsing dependency should be resolved! 1021 TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 1022 assert( vps != 0 ); 1023 Int layerIdInVPS = vps->getLayerIdInVps( m_layerId ); 1024 m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) ); 1284 1025 #else 1285 1026 m_cEntropyDecoder.decodeSPS( sps ); 1286 1027 #endif 1287 1028 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1288 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );1289 1029 } 1290 1030 … … 1292 1032 { 1293 1033 TComPPS* pps = new TComPPS(); 1294 m_cEntropyDecoder.decodePPS( pps , &m_parameterSetManagerDecoder);1034 m_cEntropyDecoder.decodePPS( pps ); 1295 1035 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 1296 1297 //!!!KS: Activate parameter sets for parsing APS (unless dependency is resolved) 1298 m_apcSlicePilot->setPPSId(pps->getPPSId()); 1299 xActivateParameterSets(); 1300 m_apcSlicePilot->initTiles(); 1301 } 1302 1303 Void TDecTop::xDecodeAPS() 1304 { 1305 TComAPS *aps = new TComAPS(); 1306 allocAPS (aps); 1307 decodeAPS(aps); 1308 m_parameterSetManagerDecoder.storePrefetchedAPS(aps); 1309 } 1310 1311 Void TDecTop::xDecodeSEI() 1312 { 1313 m_SEIs = new SEImessages; 1314 m_cEntropyDecoder.decodeSEI(*m_SEIs); 1315 } 1316 1036 } 1037 1038 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 1039 { 1040 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 1041 { 1042 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 1043 } 1044 else 1045 { 1046 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 1047 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); 1048 if (activeParamSets.size()>0) 1049 { 1050 SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); 1051 m_parameterSetManagerDecoder.applyPrefetchedPS(); 1052 assert(seiAps->activeSeqParamSetId.size()>0); 1053 if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] )) 1054 { 1055 printf ("Warning SPS activation with Active parameter set SEI failed"); 1056 } 1057 } 1058 } 1059 } 1060 1061 #if H_MV 1062 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag) 1063 #else 1317 1064 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay) 1065 #endif 1318 1066 { 1319 1067 // Initialize entropy decoder … … 1323 1071 switch (nalu.m_nalUnitType) 1324 1072 { 1325 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B00461326 1073 case NAL_UNIT_VPS: 1327 1074 xDecodeVPS(); 1328 1075 return false; 1329 #endif 1076 1330 1077 case NAL_UNIT_SPS: 1331 1078 xDecodeSPS(); … … 1335 1082 xDecodePPS(); 1336 1083 return false; 1337 case NAL_UNIT_APS: 1338 xDecodeAPS(); 1084 1085 case NAL_UNIT_PREFIX_SEI: 1086 case NAL_UNIT_SUFFIX_SEI: 1087 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 1339 1088 return false; 1340 1089 1341 case NAL_UNIT_SEI: 1342 xDecodeSEI(); 1343 return false; 1344 1345 case NAL_UNIT_CODED_SLICE: 1346 case NAL_UNIT_CODED_SLICE_IDR: 1347 #if !QC_REM_IDV_B0046 1348 case NAL_UNIT_CODED_SLICE_IDV: 1349 #endif 1090 case NAL_UNIT_CODED_SLICE_TRAIL_R: 1091 case NAL_UNIT_CODED_SLICE_TRAIL_N: 1092 case NAL_UNIT_CODED_SLICE_TLA_R: 1093 case NAL_UNIT_CODED_SLICE_TSA_N: 1094 case NAL_UNIT_CODED_SLICE_STSA_R: 1095 case NAL_UNIT_CODED_SLICE_STSA_N: 1096 case NAL_UNIT_CODED_SLICE_BLA_W_LP: 1097 case NAL_UNIT_CODED_SLICE_BLA_W_RADL: 1098 case NAL_UNIT_CODED_SLICE_BLA_N_LP: 1099 case NAL_UNIT_CODED_SLICE_IDR_W_RADL: 1100 case NAL_UNIT_CODED_SLICE_IDR_N_LP: 1350 1101 case NAL_UNIT_CODED_SLICE_CRA: 1351 case NAL_UNIT_CODED_SLICE_TLA: 1102 case NAL_UNIT_CODED_SLICE_RADL_N: 1103 case NAL_UNIT_CODED_SLICE_RADL_R: 1104 case NAL_UNIT_CODED_SLICE_RASL_N: 1105 case NAL_UNIT_CODED_SLICE_RASL_R: 1106 #if H_MV 1107 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag); 1108 #else 1352 1109 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); 1110 #endif 1353 1111 break; 1354 1112 default: … … 1359 1117 } 1360 1118 1361 #if QC_MVHEVC_B0046 1362 Void TDecTop::xCopyVPS( TComVPS* pVPSV0 ) 1363 { 1364 m_parameterSetManagerDecoder.storePrefetchedVPS(pVPSV0); 1365 } 1366 1367 Void TDecTop::xCopySPS( TComSPS* pSPSV0 ) 1368 { 1369 TComSPS* sps = new TComSPS(); 1370 sps = pSPSV0; 1371 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 1372 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 1373 } 1374 1375 Void TDecTop::xCopyPPS(TComPPS* pPPSV0 ) 1376 { 1377 m_parameterSetManagerDecoder.storePrefetchedPPS( pPPSV0 ); 1378 1379 //!!!KS: Activate parameter sets for parsing APS (unless dependency is resolved) 1380 m_apcSlicePilot->setPPSId(pPPSV0->getPPSId()); 1381 xActivateParameterSets(); 1382 m_apcSlicePilot->initTiles(); 1383 } 1384 #endif 1119 /** Function for checking if picture should be skipped because of association with a previous BLA picture 1120 * \param iPOCLastDisplay POC of last picture displayed 1121 * \returns true if the picture should be skipped 1122 * This function skips all TFD pictures that follow a BLA picture 1123 * in decoding order and precede it in output order. 1124 */ 1125 Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) 1126 { 1127 if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1128 { 1129 iPOCLastDisplay++; 1130 return true; 1131 } 1132 return false; 1133 } 1134 1385 1135 /** Function for checking if picture should be skipped because of random access 1386 1136 * \param iSkipFrame skip frame counter … … 1390 1140 * All pictures prior to the random access point indicated by the counter iSkipFrame are skipped. 1391 1141 * It also checks the type of Nal unit type at the random access point. 1392 * If the random access point is CRA , pictures with POC equal to or greater than the CRA POC are decoded.1142 * If the random access point is CRA/CRANT/BLA/BLANT, TFD pictures with POC less than the POC of the random access point are skipped. 1393 1143 * If the random access point is IDR all pictures after the random access point are decoded. 1394 * If the random access point is no t IDR or CRA, a warning is issues, and decoding of pictures with POC1395 * equal to or greater than the random access point POC is attempted. For non IDR/CRA random1144 * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC 1145 * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random 1396 1146 * access point there is no guarantee that the decoder will not crash. 1397 1147 */ … … 1405 1155 else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. 1406 1156 { 1407 if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) 1408 { 1409 m_pocRandomAccess = m_apcSlicePilot->getPOC(); // set the POC random access since we need to skip the reordered pictures in CRA. 1410 } 1411 else if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_IDR ) 1412 { 1413 m_pocRandomAccess = 0; // no need to skip the reordered pictures in IDR, they are decodable. 1157 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA 1158 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1159 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1160 || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) 1161 { 1162 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 1163 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 1164 } 1165 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 1166 { 1167 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. 1414 1168 } 1415 1169 else 1416 1170 { 1417 static bool warningMessage = false;1171 static Bool warningMessage = false; 1418 1172 if(!warningMessage) 1419 1173 { … … 1424 1178 } 1425 1179 } 1426 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess) // skip the reordered pictures if necessary 1180 // skip the reordered pictures, if necessary 1181 else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) 1427 1182 { 1428 1183 iPOCLastDisplay++; … … 1433 1188 } 1434 1189 1435 Void TDecTop::allocAPS (TComAPS* pAPS) 1436 { 1437 // we don't know the SPS before it has been activated. These fields could exist 1438 // depending on the corresponding flags in the APS, but SAO/ALF allocation functions will 1439 // have to be moved for that 1440 pAPS->createScalingList(); 1441 pAPS->createSaoParam(); 1442 m_cSAO.allocSaoParam(pAPS->getSaoParam()); 1443 pAPS->createAlfParam(); 1444 } 1445 1190 #if H_MV 1191 TComPic* TDecTop::getPic( Int poc ) 1192 { 1193 xGetPic( m_layerId, poc ); 1194 TComList<TComPic*>* listPic = getListPic(); 1195 TComPic* pcPic = NULL; 1196 for(TComList<TComPic*>::iterator it=listPic->begin(); it!=listPic->end(); it++) 1197 { 1198 if( (*it)->getPOC() == poc ) 1199 { 1200 pcPic = *it ; 1201 break ; 1202 } 1203 } 1204 return pcPic; 1205 } 1206 1207 TComPic* TDecTop::xGetPic( Int layerId, Int poc ) 1208 { 1209 return m_ivPicLists->getPic( layerId, poc ) ; 1210 } 1211 1212 #endif 1446 1213 //! \} -
trunk/source/Lib/TLibDecoder/TDecTop.h
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 44 44 #include "TLibCommon/TComPic.h" 45 45 #include "TLibCommon/TComTrQuant.h" 46 #include "TLibCommon/TComDepthMapGenerator.h"47 46 #include "TLibCommon/SEI.h" 48 47 … … 51 50 #include "TDecSbac.h" 52 51 #include "TDecCAVLC.h" 52 #include "SEIread.h" 53 53 54 54 struct InputNALUnit; … … 56 56 //! \ingroup TLibDecoder 57 57 //! \{ 58 59 #define APS_RESERVED_BUFFER_SIZE 2 //!< must be equal to or larger than 2 to handle bitstream parsing60 58 61 59 // ==================================================================================================================== … … 63 61 // ==================================================================================================================== 64 62 63 #if H_MV 65 64 class TAppDecTop; 66 65 #endif 66 #if H_3D 67 67 class CamParsCollector 68 68 { … … 75 75 Void setSlice ( TComSlice* pcSlice ); 76 76 77 Bool isInitialized() const { return m_bInitialized; } 78 79 #if MERL_VSP_C0152 77 Bool isInitialized() const { return m_bInitialized; } 80 78 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; } 81 #endif 79 82 80 private: 83 81 Bool xIsComplete (); … … 90 88 Int** m_aaiCodedOffset; 91 89 Int** m_aaiCodedScale; 92 Int* m_aiViewOrderIndex; 93 #if QC_MVHEVC_B0046 94 Int* m_aiViewId; 95 #endif 96 Int* m_aiViewReceived; 90 Int* m_aiViewId; 91 92 Bool* m_bViewReceived; 97 93 UInt m_uiCamParsCodedPrecision; 98 94 Bool m_bCamParsVaryOverTime; 99 Int m_iLastViewI d;95 Int m_iLastViewIndex; 100 96 Int m_iLastPOC; 101 UInt m_uiMaxViewI d;102 103 #if MERL_VSP_C0152 97 UInt m_uiMaxViewIndex; 98 99 104 100 UInt m_uiBitDepthForLUT; 105 101 UInt m_iLog2Precision; 106 102 UInt m_uiInputBitDepth; 103 107 104 // look-up tables 108 105 Double**** m_adBaseViewShiftLUT; ///< Disparity LUT … … 113 110 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize1, UInt uiSize2 ); 114 111 template<class T> Void xDeleteArray ( T*& rpt, UInt uiSize ); 115 #endif 116 117 }; 118 119 #if MERL_VSP_C0152 112 113 }; 114 120 115 template <class T> 121 116 Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 ) … … 174 169 }; 175 170 176 #endif 177 171 #endif //H_3D 178 172 /// decoder class 179 173 class TDecTop 180 174 { 181 175 private: 182 Int m_iGopSize; 183 Bool m_bGopSizeSet; 184 int m_iMaxRefPicNum; 185 186 Bool m_bRefreshPending; ///< refresh pending flag 176 Int m_iMaxRefPicNum; 177 187 178 Int m_pocCRA; ///< POC number of the latest CRA picture 179 Bool m_prevRAPisBLA; ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture 188 180 Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) 189 181 190 UInt m_uiValidPS;191 182 TComList<TComPic*> m_cListPic; // Dynamic buffer 183 #if H_MV 184 static ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 185 #else 192 186 ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 193 TComRPSList m_RPSList; 187 #endif 194 188 TComSlice* m_apcSlicePilot; 195 189 196 SEI messages *m_SEIs; ///< "all" SEI messages. If not NULL, we own the object.190 SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices 197 191 198 192 // functional classes … … 206 200 TDecSbac m_cSbacDecoder; 207 201 TDecBinCABAC m_cBinCABAC; 202 SEIReader m_seiReader; 208 203 TComLoopFilter m_cLoopFilter; 209 TComAdaptiveLoopFilter m_cAdaptiveLoopFilter;210 204 TComSampleAdaptiveOffset m_cSAO; 211 205 212 #if DEPTH_MAP_GENERATION 213 TComDepthMapGenerator m_cDepthMapGenerator; 214 #endif 215 #if H3D_IVRP & !QC_ARP_D0177 216 TComResidualGenerator m_cResidualGenerator; 217 #endif 218 206 Bool isSkipPictureForBLA(Int& iPOCLastDisplay); 219 207 Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); 220 208 TComPic* m_pcPic; 221 209 UInt m_uiSliceIdx; 222 UInt m_uiLastSliceIdx;223 210 Int m_prevPOC; 224 211 Bool m_bFirstSliceInPicture; 225 212 Bool m_bFirstSliceInSequence; 226 213 #if H_MV 214 // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 215 Int m_layerId; 227 216 Int m_viewId; 217 TComPicLists* m_ivPicLists; 218 std::vector<TComPic*> m_refPicSetInterLayer; 219 #if H_3D 220 Int m_viewIndex; 228 221 Bool m_isDepth; 229 TAppDecTop* m_tAppDecTop;230 222 CamParsCollector* m_pcCamParsCollector; 231 NalUnitType m_nalUnitTypeBaseView; 223 #endif 224 #endif 232 225 233 226 public: … … 238 231 Void destroy (); 239 232 240 void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); } 241 242 Void init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance ); 233 void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } 234 235 Void init(); 236 #if H_MV 237 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer ); 238 #else 243 239 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); 240 #endif 244 241 245 242 Void deletePicBuffer(); 246 #if QC_MVHEVC_B0046 247 Void xCopySPS( TComSPS* pSPSV0); 248 Void xCopyPPS( TComPPS* pPPSV0); 249 Void xCopyVPS( TComVPS* pVPSV0); 250 #endif 251 #if H3D_IVRP 252 Void deleteExtraPicBuffers ( Int iPoc ); 253 #endif 254 Void compressMotion ( Int iPoc ); 255 256 Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame, Int& iPOCLastDisplay); 257 258 Void setViewId(Int viewId) { m_viewId = viewId;} 259 Int getViewId() { return m_viewId ;} 260 Void setIsDepth( Bool isDepth ) { m_isDepth = isDepth; } 261 262 #if DEPTH_MAP_GENERATION 263 TComDepthMapGenerator* getDepthMapGenerator () { return &m_cDepthMapGenerator; } 264 #endif 265 266 Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } 267 268 TComList<TComPic*>* getListPic() { return &m_cListPic; } 269 Void setTAppDecTop( TAppDecTop* pcTAppDecTop ) { m_tAppDecTop = pcTAppDecTop; } 270 TAppDecTop* getTAppDecTop() { return m_tAppDecTop; } 271 NalUnitType getNalUnitTypeBaseView() { return m_nalUnitTypeBaseView; } 272 #if QC_MVHEVC_B0046 273 bool m_bFirstNal; //used to copy SPS, PPS, VPS 274 ParameterSetManagerDecoder* xGetParaSetDec () {return &m_parameterSetManagerDecoder;} 275 #endif 276 243 244 #if H_MV 245 Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet); 246 #else 247 Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic); 248 #endif 249 250 #if H_MV 251 TComPic* getPic ( Int poc ); 252 TComList<TComPic*>* getListPic () { return &m_cListPic; } 253 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 254 255 Int getCurrPoc () { return m_apcSlicePilot->getPOC(); } 256 Void setLayerId ( Int layer) { m_layerId = layer; } 257 Int getLayerId () { return m_layerId; } 258 Void setViewId ( Int viewId ) { m_viewId = viewId; } 259 Int getViewId () { return m_viewId; } 260 #if H_3D 261 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 262 Int getViewIndex () { return m_viewIndex; } 263 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 264 Bool getIsDepth () { return m_isDepth; } 265 Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } 266 #endif 267 #endif 277 268 protected: 278 269 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); 279 Void xUpdateGopSize (TComSlice* pcSlice);280 270 Void xCreateLostPicture (Int iLostPOC); 281 271 282 Void decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };283 272 Void xActivateParameterSets(); 273 #if H_MV 274 TComPic* xGetPic( Int layerId, Int poc ); 275 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 276 #else 284 277 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); 285 # if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046278 #endif 286 279 Void xDecodeVPS(); 287 #endif288 280 Void xDecodeSPS(); 289 281 Void xDecodePPS(); 290 Void xDecodeAPS(); 291 Void xDecodeSEI(); 292 293 Void allocAPS (TComAPS* pAPS); //!< memory allocation for APS 282 Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); 283 294 284 };// END CLASS DEFINITION TDecTop 295 285
Note: See TracChangeset for help on using the changeset viewer.