[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[608] | 6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
[5] | 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. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 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 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TDecEntropy.cpp |
---|
| 35 | \brief entropy decoder class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TDecEntropy.h" |
---|
| 39 | |
---|
[56] | 40 | //! \ingroup TLibDecoder |
---|
| 41 | //! \{ |
---|
| 42 | |
---|
[2] | 43 | Void TDecEntropy::setEntropyDecoder ( TDecEntropyIf* p ) |
---|
| 44 | { |
---|
| 45 | m_pcEntropyDecoderIf = p; |
---|
| 46 | } |
---|
| 47 | |
---|
[56] | 48 | #include "TLibCommon/TComSampleAdaptiveOffset.h" |
---|
[2] | 49 | |
---|
| 50 | Void TDecEntropy::decodeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 51 | { |
---|
| 52 | m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 53 | } |
---|
| 54 | |
---|
[608] | 55 | Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 56 | { |
---|
| 57 | m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 58 | } |
---|
| 59 | |
---|
[2] | 60 | /** decode merge flag |
---|
| 61 | * \param pcSubCU |
---|
| 62 | * \param uiAbsPartIdx |
---|
| 63 | * \param uiDepth |
---|
| 64 | * \param uiPUIdx |
---|
| 65 | * \returns Void |
---|
| 66 | */ |
---|
| 67 | Void TDecEntropy::decodeMergeFlag( TComDataCU* pcSubCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
| 68 | { |
---|
[56] | 69 | // at least one merge candidate exists |
---|
| 70 | m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx ); |
---|
[2] | 71 | } |
---|
| 72 | |
---|
| 73 | /** decode merge index |
---|
| 74 | * \param pcCU |
---|
| 75 | * \param uiPartIdx |
---|
| 76 | * \param uiAbsPartIdx |
---|
| 77 | * \param puhInterDirNeighbours pointer to list of inter direction from the casual neighbours |
---|
| 78 | * \param pcMvFieldNeighbours pointer to list of motion vector field from the casual neighbours |
---|
| 79 | * \param uiDepth |
---|
| 80 | * \returns Void |
---|
| 81 | */ |
---|
[608] | 82 | Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[2] | 83 | { |
---|
| 84 | UInt uiMergeIndex = 0; |
---|
[608] | 85 | m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex ); |
---|
[2] | 86 | pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
| 87 | } |
---|
| 88 | |
---|
[608] | 89 | #if H_3D_ARP |
---|
| 90 | Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[443] | 91 | { |
---|
[608] | 92 | if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) |
---|
| 93 | { |
---|
[443] | 94 | return; |
---|
[608] | 95 | } |
---|
| 96 | |
---|
| 97 | if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) |
---|
| 98 | { |
---|
| 99 | pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); |
---|
| 100 | } |
---|
[443] | 101 | else |
---|
[608] | 102 | { |
---|
[443] | 103 | m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); |
---|
[608] | 104 | } |
---|
[443] | 105 | } |
---|
| 106 | #endif |
---|
[608] | 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 | |
---|
[699] | 113 | #if SEC_ONLY_TEXTURE_IC_F0151 |
---|
| 114 | if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() ) |
---|
| 115 | #else |
---|
[608] | 116 | if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) ) |
---|
[699] | 117 | #endif |
---|
[608] | 118 | { |
---|
| 119 | return; |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | if( !pcCU->getSlice()->getApplyIC() ) |
---|
| 123 | return; |
---|
| 124 | |
---|
| 125 | if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) |
---|
| 126 | m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 127 | } |
---|
| 128 | #endif |
---|
| 129 | |
---|
[2] | 130 | Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 131 | { |
---|
| 132 | m_pcEntropyDecoderIf->parseSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | Void TDecEntropy::decodePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 136 | { |
---|
| 137 | m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 141 | { |
---|
| 142 | m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
| 146 | { |
---|
| 147 | if( pcCU->isIntra( uiAbsPartIdx ) ) // If it is Intra mode, encode intra prediction mode. |
---|
| 148 | { |
---|
[608] | 149 | decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 150 | #if H_3D_DIM_SDC |
---|
| 151 | if(!pcCU->getSDCFlag(uiAbsPartIdx)) |
---|
[443] | 152 | #endif |
---|
[608] | 153 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 154 | } |
---|
| 155 | else // if it is Inter mode, encode motion vector and reference index |
---|
| 156 | { |
---|
[56] | 157 | decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); |
---|
| 158 | } |
---|
| 159 | } |
---|
[2] | 160 | |
---|
[56] | 161 | /** Parse I_PCM information. |
---|
| 162 | * \param pcCU pointer to CUpointer to CU |
---|
| 163 | * \param uiAbsPartIdx CU index |
---|
| 164 | * \param uiDepth CU depth |
---|
| 165 | * \returns Void |
---|
| 166 | */ |
---|
| 167 | Void TDecEntropy::decodeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 168 | { |
---|
| 169 | if(!pcCU->getSlice()->getSPS()->getUsePCM() |
---|
| 170 | || pcCU->getWidth(uiAbsPartIdx) > (1<<pcCU->getSlice()->getSPS()->getPCMLog2MaxSize()) |
---|
| 171 | || pcCU->getWidth(uiAbsPartIdx) < (1<<pcCU->getSlice()->getSPS()->getPCMLog2MinSize()) ) |
---|
| 172 | { |
---|
| 173 | return; |
---|
[2] | 174 | } |
---|
[608] | 175 | #if H_3D_DIM_SDC |
---|
[189] | 176 | if( pcCU->getSDCFlag(uiAbsPartIdx) ) |
---|
| 177 | { |
---|
| 178 | return; |
---|
| 179 | } |
---|
| 180 | #endif |
---|
| 181 | |
---|
[56] | 182 | m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 183 | } |
---|
| 184 | |
---|
| 185 | Void TDecEntropy::decodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 186 | { |
---|
| 187 | m_pcEntropyDecoderIf->parseIntraDirLumaAng( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | Void TDecEntropy::decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 191 | { |
---|
| 192 | m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 193 | } |
---|
| 194 | |
---|
[56] | 195 | /** decode motion information for every PU block. |
---|
[2] | 196 | * \param pcCU |
---|
| 197 | * \param uiAbsPartIdx |
---|
| 198 | * \param uiDepth |
---|
| 199 | * \param pcSubCU |
---|
| 200 | * \returns Void |
---|
| 201 | */ |
---|
| 202 | Void TDecEntropy::decodePUWise( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
| 203 | { |
---|
| 204 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
| 205 | UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); |
---|
| 206 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
---|
| 207 | |
---|
[608] | 208 | #if H_3D_IV_MERGE |
---|
[56] | 209 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
| 210 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 211 | #else |
---|
| 212 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
| 213 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
| 214 | #endif |
---|
[608] | 215 | |
---|
| 216 | for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) |
---|
[56] | 217 | { |
---|
| 218 | uhInterDirNeighbours[ui] = 0; |
---|
| 219 | } |
---|
| 220 | Int numValidMergeCand = 0; |
---|
[608] | 221 | Bool isMerged = false; |
---|
[56] | 222 | |
---|
[2] | 223 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
| 224 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
[608] | 225 | #if H_3D_IV_MERGE |
---|
| 226 | pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
---|
| 227 | #endif |
---|
[2] | 228 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
---|
| 229 | { |
---|
[608] | 230 | #if H_MV_ENC_DEC_TRAC |
---|
| 231 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
---|
| 232 | // ToDo: |
---|
| 233 | //DTRACE_PU("x0", uiLPelX) |
---|
| 234 | //DTRACE_PU("x1", uiTPelY) |
---|
[56] | 235 | #endif |
---|
[2] | 236 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 237 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
---|
| 238 | { |
---|
[608] | 239 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); |
---|
[56] | 240 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
| 241 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) |
---|
[2] | 242 | { |
---|
[56] | 243 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 244 | if ( !isMerged ) |
---|
[2] | 245 | { |
---|
[608] | 246 | #if H_3D_VSP |
---|
| 247 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 248 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
| 249 | InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 250 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); |
---|
| 251 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
[622] | 252 | |
---|
[608] | 253 | if(vspFlag[uiMergeIndex]) |
---|
| 254 | { |
---|
| 255 | pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth); |
---|
| 256 | } |
---|
| 257 | #else |
---|
| 258 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
| 259 | #endif |
---|
[56] | 260 | isMerged = true; |
---|
[2] | 261 | } |
---|
[56] | 262 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
---|
| 263 | } |
---|
| 264 | else |
---|
| 265 | { |
---|
[622] | 266 | uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
[608] | 267 | #if H_3D_VSP |
---|
| 268 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 269 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
| 270 | InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 271 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex ); |
---|
| 272 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
| 273 | if(vspFlag[uiMergeIndex]) |
---|
[296] | 274 | { |
---|
[608] | 275 | pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth); |
---|
[296] | 276 | } |
---|
[443] | 277 | #else |
---|
[608] | 278 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
[443] | 279 | #endif |
---|
[56] | 280 | } |
---|
| 281 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
| 282 | |
---|
| 283 | TComMv cTmpMv( 0, 0 ); |
---|
| 284 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 285 | { |
---|
| 286 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
[2] | 287 | { |
---|
[56] | 288 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
| 289 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
| 290 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 291 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 292 | } |
---|
| 293 | } |
---|
[56] | 294 | } |
---|
| 295 | else |
---|
| 296 | { |
---|
[2] | 297 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 298 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 299 | { |
---|
| 300 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
| 301 | { |
---|
| 302 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
| 303 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
| 304 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
| 305 | } |
---|
| 306 | } |
---|
| 307 | } |
---|
[622] | 308 | #if H_3D_VSP |
---|
[608] | 309 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false)) |
---|
| 310 | #else |
---|
| 311 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) |
---|
| 312 | #endif |
---|
| 313 | { |
---|
| 314 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
---|
| 315 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
---|
| 316 | pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth); |
---|
| 317 | } |
---|
[2] | 318 | } |
---|
| 319 | return; |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | /** decode inter direction for a PU block |
---|
| 323 | * \param pcCU |
---|
| 324 | * \param uiAbsPartIdx |
---|
| 325 | * \param uiDepth |
---|
| 326 | * \param uiPartIdx |
---|
| 327 | * \returns Void |
---|
| 328 | */ |
---|
| 329 | Void TDecEntropy::decodeInterDirPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx ) |
---|
| 330 | { |
---|
| 331 | UInt uiInterDir; |
---|
| 332 | |
---|
| 333 | if ( pcCU->getSlice()->isInterP() ) |
---|
| 334 | { |
---|
| 335 | uiInterDir = 1; |
---|
| 336 | } |
---|
| 337 | else |
---|
| 338 | { |
---|
[608] | 339 | m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx ); |
---|
[2] | 340 | } |
---|
| 341 | |
---|
| 342 | pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
| 343 | } |
---|
| 344 | |
---|
| 345 | Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
| 346 | { |
---|
[608] | 347 | Int iRefFrmIdx = 0; |
---|
| 348 | Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ); |
---|
| 349 | |
---|
| 350 | if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx ) |
---|
[2] | 351 | { |
---|
[608] | 352 | m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, eRefList ); |
---|
[2] | 353 | } |
---|
[608] | 354 | else if ( !iParseRefFrmIdx ) |
---|
| 355 | { |
---|
| 356 | iRefFrmIdx = NOT_VALID; |
---|
| 357 | } |
---|
[2] | 358 | else |
---|
| 359 | { |
---|
[608] | 360 | iRefFrmIdx = 0; |
---|
| 361 | } |
---|
[2] | 362 | |
---|
[608] | 363 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
| 364 | pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
[2] | 365 | } |
---|
| 366 | |
---|
| 367 | /** decode motion vector difference for a PU block |
---|
| 368 | * \param pcCU |
---|
| 369 | * \param uiAbsPartIdx |
---|
| 370 | * \param uiDepth |
---|
| 371 | * \param uiPartIdx |
---|
| 372 | * \param eRefList |
---|
| 373 | * \returns Void |
---|
| 374 | */ |
---|
| 375 | Void TDecEntropy::decodeMvdPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
| 376 | { |
---|
| 377 | if ( pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ) ) |
---|
| 378 | { |
---|
| 379 | m_pcEntropyDecoderIf->parseMvd( pcCU, uiAbsPartIdx, uiPartIdx, uiDepth, eRefList ); |
---|
| 380 | } |
---|
| 381 | } |
---|
| 382 | |
---|
| 383 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
| 384 | { |
---|
[56] | 385 | Int iMVPIdx = -1; |
---|
[2] | 386 | |
---|
| 387 | TComMv cZeroMv( 0, 0 ); |
---|
| 388 | TComMv cMv = cZeroMv; |
---|
| 389 | Int iRefIdx = -1; |
---|
| 390 | |
---|
| 391 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
---|
| 392 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
---|
| 393 | |
---|
| 394 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
---|
| 395 | cMv = cZeroMv; |
---|
[56] | 396 | |
---|
[608] | 397 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
---|
[56] | 398 | { |
---|
| 399 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
---|
[608] | 400 | #if H_MV_ENC_DEC_TRAC |
---|
| 401 | #if ENC_DEC_TRACE |
---|
| 402 | if ( eRefList == REF_PIC_LIST_0 ) |
---|
| 403 | { |
---|
| 404 | DTRACE_PU("mvp_l0_flag", iMVPIdx) |
---|
| 405 | } |
---|
| 406 | else |
---|
| 407 | { |
---|
| 408 | DTRACE_PU("mvp_l1_flag", iMVPIdx) |
---|
| 409 | } |
---|
[56] | 410 | #endif |
---|
[608] | 411 | #endif |
---|
[56] | 412 | } |
---|
[2] | 413 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
---|
| 414 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
---|
| 415 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
---|
| 416 | if ( iRefIdx >= 0 ) |
---|
| 417 | { |
---|
[608] | 418 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); |
---|
[2] | 419 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
---|
| 420 | } |
---|
| 421 | |
---|
| 422 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
---|
[56] | 423 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
---|
[2] | 424 | } |
---|
| 425 | |
---|
[608] | 426 | Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP) |
---|
[2] | 427 | { |
---|
[56] | 428 | UInt uiSubdiv; |
---|
| 429 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; |
---|
| 430 | |
---|
| 431 | if(uiTrIdx==0) |
---|
| 432 | { |
---|
| 433 | m_bakAbsPartIdxCU = uiAbsPartIdx; |
---|
| 434 | } |
---|
| 435 | if( uiLog2TrafoSize == 2 ) |
---|
| 436 | { |
---|
| 437 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
| 438 | if( ( uiAbsPartIdx % partNum ) == 0 ) |
---|
| 439 | { |
---|
| 440 | m_uiBakAbsPartIdx = uiAbsPartIdx; |
---|
| 441 | m_uiBakChromaOffset = offsetChroma; |
---|
| 442 | } |
---|
| 443 | } |
---|
| 444 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) |
---|
| 445 | { |
---|
| 446 | uiSubdiv = 1; |
---|
| 447 | } |
---|
| 448 | else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) |
---|
| 449 | { |
---|
| 450 | uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx)); |
---|
| 451 | } |
---|
| 452 | else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
| 453 | { |
---|
| 454 | uiSubdiv = 1; |
---|
| 455 | } |
---|
| 456 | else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
| 457 | { |
---|
| 458 | uiSubdiv = 0; |
---|
| 459 | } |
---|
| 460 | else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) |
---|
| 461 | { |
---|
| 462 | uiSubdiv = 0; |
---|
| 463 | } |
---|
| 464 | else |
---|
| 465 | { |
---|
| 466 | assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); |
---|
[608] | 467 | m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); |
---|
[56] | 468 | } |
---|
[2] | 469 | |
---|
[56] | 470 | const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx ); |
---|
[2] | 471 | { |
---|
[608] | 472 | const Bool bFirstCbfOfCU = uiTrDepth == 0; |
---|
[56] | 473 | if( bFirstCbfOfCU ) |
---|
[2] | 474 | { |
---|
[56] | 475 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
| 476 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
[2] | 477 | } |
---|
[56] | 478 | if( bFirstCbfOfCU || uiLog2TrafoSize > 2 ) |
---|
[2] | 479 | { |
---|
[56] | 480 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) |
---|
[2] | 481 | { |
---|
[608] | 482 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); |
---|
[2] | 483 | } |
---|
[56] | 484 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) |
---|
[2] | 485 | { |
---|
[608] | 486 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); |
---|
[2] | 487 | } |
---|
| 488 | } |
---|
[56] | 489 | else |
---|
[2] | 490 | { |
---|
[56] | 491 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
| 492 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
[2] | 493 | } |
---|
| 494 | } |
---|
| 495 | |
---|
[56] | 496 | if( uiSubdiv ) |
---|
[2] | 497 | { |
---|
[56] | 498 | UInt size; |
---|
| 499 | width >>= 1; |
---|
| 500 | height >>= 1; |
---|
| 501 | size = width*height; |
---|
| 502 | uiTrIdx++; |
---|
| 503 | ++uiDepth; |
---|
| 504 | const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
| 505 | const UInt uiStartAbsPartIdx = uiAbsPartIdx; |
---|
| 506 | UInt uiYCbf = 0; |
---|
| 507 | UInt uiUCbf = 0; |
---|
| 508 | UInt uiVCbf = 0; |
---|
| 509 | |
---|
| 510 | for( Int i = 0; i < 4; i++ ) |
---|
[2] | 511 | { |
---|
[608] | 512 | xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP ); |
---|
| 513 | uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth+1 ); |
---|
| 514 | uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth+1 ); |
---|
| 515 | uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth+1 ); |
---|
[56] | 516 | uiAbsPartIdx += uiQPartNum; |
---|
| 517 | offsetLuma += size; offsetChroma += (size>>2); |
---|
[2] | 518 | } |
---|
[56] | 519 | |
---|
| 520 | for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) |
---|
| 521 | { |
---|
[608] | 522 | pcCU->getCbf( TEXT_LUMA )[uiStartAbsPartIdx + ui] |= uiYCbf << uiTrDepth; |
---|
| 523 | pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << uiTrDepth; |
---|
| 524 | pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << uiTrDepth; |
---|
[56] | 525 | } |
---|
[2] | 526 | } |
---|
| 527 | else |
---|
| 528 | { |
---|
[56] | 529 | assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) ); |
---|
| 530 | pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); |
---|
| 531 | |
---|
[608] | 532 | #if !H_MV_ENC_DEC_TRAC |
---|
[2] | 533 | { |
---|
[56] | 534 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
| 535 | DTRACE_CABAC_T( "\tTrIdx: abspart=" ); |
---|
| 536 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
| 537 | DTRACE_CABAC_T( "\tdepth=" ); |
---|
| 538 | DTRACE_CABAC_V( uiDepth ); |
---|
| 539 | DTRACE_CABAC_T( "\ttrdepth=" ); |
---|
| 540 | DTRACE_CABAC_V( uiTrDepth ); |
---|
| 541 | DTRACE_CABAC_T( "\n" ); |
---|
[2] | 542 | } |
---|
[608] | 543 | #endif |
---|
[56] | 544 | |
---|
| 545 | pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
| 546 | if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) |
---|
[2] | 547 | { |
---|
[608] | 548 | pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
[2] | 549 | } |
---|
[56] | 550 | else |
---|
[2] | 551 | { |
---|
[608] | 552 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth ); |
---|
[2] | 553 | } |
---|
[608] | 554 | |
---|
| 555 | |
---|
[56] | 556 | // transform_unit begin |
---|
| 557 | UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); |
---|
| 558 | UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
| 559 | UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
| 560 | if( uiLog2TrafoSize == 2 ) |
---|
[2] | 561 | { |
---|
[56] | 562 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
| 563 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
---|
[2] | 564 | { |
---|
[56] | 565 | cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
| 566 | cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
[2] | 567 | } |
---|
| 568 | } |
---|
[56] | 569 | if ( cbfY || cbfU || cbfV ) |
---|
[2] | 570 | { |
---|
[56] | 571 | // dQP: only for LCU |
---|
| 572 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
[2] | 573 | { |
---|
[56] | 574 | if ( bCodeDQP ) |
---|
[2] | 575 | { |
---|
[56] | 576 | decodeQP( pcCU, m_bakAbsPartIdxCU); |
---|
| 577 | bCodeDQP = false; |
---|
[2] | 578 | } |
---|
| 579 | } |
---|
| 580 | } |
---|
[56] | 581 | if( cbfY ) |
---|
[2] | 582 | { |
---|
[56] | 583 | Int trWidth = width; |
---|
| 584 | Int trHeight = height; |
---|
| 585 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); |
---|
[2] | 586 | } |
---|
[56] | 587 | if( uiLog2TrafoSize > 2 ) |
---|
[2] | 588 | { |
---|
[56] | 589 | Int trWidth = width >> 1; |
---|
| 590 | Int trHeight = height >> 1; |
---|
| 591 | if( cbfU ) |
---|
[2] | 592 | { |
---|
[56] | 593 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
[2] | 594 | } |
---|
[56] | 595 | if( cbfV ) |
---|
[2] | 596 | { |
---|
[56] | 597 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
[2] | 598 | } |
---|
| 599 | } |
---|
| 600 | else |
---|
| 601 | { |
---|
[56] | 602 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
| 603 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
---|
[2] | 604 | { |
---|
[56] | 605 | Int trWidth = width; |
---|
| 606 | Int trHeight = height; |
---|
| 607 | if( cbfU ) |
---|
[2] | 608 | { |
---|
[56] | 609 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
[2] | 610 | } |
---|
[56] | 611 | if( cbfV ) |
---|
[2] | 612 | { |
---|
[56] | 613 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
[2] | 614 | } |
---|
| 615 | } |
---|
| 616 | } |
---|
[56] | 617 | // transform_unit end |
---|
[2] | 618 | } |
---|
| 619 | } |
---|
| 620 | |
---|
[56] | 621 | Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
| 622 | { |
---|
| 623 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
| 624 | { |
---|
| 625 | m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); |
---|
| 626 | } |
---|
| 627 | } |
---|
[2] | 628 | |
---|
| 629 | |
---|
| 630 | /** decode coefficients |
---|
| 631 | * \param pcCU |
---|
| 632 | * \param uiAbsPartIdx |
---|
| 633 | * \param uiDepth |
---|
| 634 | * \param uiWidth |
---|
| 635 | * \param uiHeight |
---|
| 636 | * \returns Void |
---|
| 637 | */ |
---|
[56] | 638 | Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP ) |
---|
[2] | 639 | { |
---|
| 640 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
| 641 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
| 642 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
| 643 | |
---|
[608] | 644 | #if H_3D_DIM_SDC |
---|
| 645 | if( pcCU->getSDCFlag( uiAbsPartIdx ) ) |
---|
[189] | 646 | { |
---|
| 647 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
| 648 | assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); |
---|
| 649 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); |
---|
| 650 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); |
---|
| 651 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); |
---|
[608] | 652 | return; |
---|
| 653 | } |
---|
[443] | 654 | #endif |
---|
[608] | 655 | |
---|
[655] | 656 | #if H_3D_INTER_SDC |
---|
[608] | 657 | if( pcCU->getInterSDCFlag( uiAbsPartIdx ) ) |
---|
| 658 | { |
---|
| 659 | assert( !pcCU->isSkipped( uiAbsPartIdx ) ); |
---|
| 660 | assert( !pcCU->isIntra( uiAbsPartIdx) ); |
---|
| 661 | assert( pcCU->getSlice()->getIsDepth() ); |
---|
| 662 | |
---|
| 663 | decodeInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[189] | 664 | return; |
---|
| 665 | } |
---|
| 666 | #endif |
---|
[608] | 667 | |
---|
[2] | 668 | if( pcCU->isIntra(uiAbsPartIdx) ) |
---|
| 669 | { |
---|
| 670 | } |
---|
| 671 | else |
---|
| 672 | { |
---|
[56] | 673 | UInt uiQtRootCbf = 1; |
---|
| 674 | if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) ) |
---|
| 675 | { |
---|
[608] | 676 | m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf ); |
---|
[2] | 677 | } |
---|
[56] | 678 | if ( !uiQtRootCbf ) |
---|
| 679 | { |
---|
| 680 | pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth ); |
---|
| 681 | pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); |
---|
| 682 | return; |
---|
| 683 | } |
---|
[2] | 684 | |
---|
| 685 | } |
---|
[608] | 686 | xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP ); |
---|
| 687 | } |
---|
[189] | 688 | |
---|
[655] | 689 | #if H_3D_INTER_SDC |
---|
[608] | 690 | Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 691 | { |
---|
| 692 | pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth); |
---|
| 693 | |
---|
| 694 | if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) |
---|
[189] | 695 | { |
---|
[608] | 696 | return; |
---|
[189] | 697 | } |
---|
| 698 | |
---|
[608] | 699 | if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) ) |
---|
[189] | 700 | { |
---|
[608] | 701 | return; |
---|
[189] | 702 | } |
---|
[608] | 703 | |
---|
| 704 | m_pcEntropyDecoderIf->parseInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[2] | 705 | } |
---|
| 706 | |
---|
[608] | 707 | Void TDecEntropy::decodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[189] | 708 | { |
---|
[608] | 709 | if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) |
---|
| 710 | { |
---|
| 711 | return; |
---|
| 712 | } |
---|
[189] | 713 | |
---|
[608] | 714 | if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || !pcCU->getInterSDCFlag( uiAbsPartIdx ) ) |
---|
| 715 | { |
---|
| 716 | return; |
---|
| 717 | } |
---|
| 718 | |
---|
| 719 | UInt uiNumSegments = ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ? 1 : ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 ); |
---|
| 720 | |
---|
[189] | 721 | // decode residual data for each segment |
---|
| 722 | for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ ) |
---|
[608] | 723 | { |
---|
| 724 | m_pcEntropyDecoderIf->parseInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth, uiSeg ); |
---|
| 725 | } |
---|
[189] | 726 | } |
---|
| 727 | #endif |
---|
| 728 | |
---|
[56] | 729 | //! \} |
---|