[324] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-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 | |
---|
| 34 | /** \file TDecEntropy.cpp |
---|
| 35 | \brief entropy decoder class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TDecEntropy.h" |
---|
| 39 | |
---|
| 40 | //! \ingroup TLibDecoder |
---|
| 41 | //! \{ |
---|
| 42 | |
---|
| 43 | Void TDecEntropy::setEntropyDecoder ( TDecEntropyIf* p ) |
---|
| 44 | { |
---|
| 45 | m_pcEntropyDecoderIf = p; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | #include "TLibCommon/TComSampleAdaptiveOffset.h" |
---|
| 49 | |
---|
| 50 | Void TDecEntropy::decodeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 51 | { |
---|
| 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 ); |
---|
| 58 | } |
---|
| 59 | |
---|
| 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 | { |
---|
| 69 | // at least one merge candidate exists |
---|
| 70 | m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx ); |
---|
| 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 | */ |
---|
| 82 | Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 83 | { |
---|
| 84 | UInt uiMergeIndex = 0; |
---|
| 85 | m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex ); |
---|
| 86 | pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
| 87 | } |
---|
| 88 | |
---|
[504] | 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 | } |
---|
| 101 | else |
---|
| 102 | { |
---|
| 103 | m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); |
---|
| 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 | |
---|
[324] | 126 | Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 127 | { |
---|
| 128 | m_pcEntropyDecoderIf->parseSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | Void TDecEntropy::decodePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 132 | { |
---|
| 133 | m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 137 | { |
---|
| 138 | m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
| 142 | { |
---|
| 143 | if( pcCU->isIntra( uiAbsPartIdx ) ) // If it is Intra mode, encode intra prediction mode. |
---|
| 144 | { |
---|
| 145 | decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
[531] | 146 | #if H_3D_DIM_SDC |
---|
| 147 | if(!pcCU->getSDCFlag(uiAbsPartIdx)) |
---|
| 148 | #endif |
---|
[324] | 149 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 150 | } |
---|
| 151 | else // if it is Inter mode, encode motion vector and reference index |
---|
| 152 | { |
---|
| 153 | decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); |
---|
| 154 | } |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | /** Parse I_PCM information. |
---|
| 158 | * \param pcCU pointer to CUpointer to CU |
---|
| 159 | * \param uiAbsPartIdx CU index |
---|
| 160 | * \param uiDepth CU depth |
---|
| 161 | * \returns Void |
---|
| 162 | */ |
---|
| 163 | Void TDecEntropy::decodeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 164 | { |
---|
| 165 | if(!pcCU->getSlice()->getSPS()->getUsePCM() |
---|
| 166 | || pcCU->getWidth(uiAbsPartIdx) > (1<<pcCU->getSlice()->getSPS()->getPCMLog2MaxSize()) |
---|
| 167 | || pcCU->getWidth(uiAbsPartIdx) < (1<<pcCU->getSlice()->getSPS()->getPCMLog2MinSize()) ) |
---|
| 168 | { |
---|
| 169 | return; |
---|
| 170 | } |
---|
[531] | 171 | #if H_3D_DIM_SDC |
---|
| 172 | if( pcCU->getSDCFlag(uiAbsPartIdx) ) |
---|
| 173 | { |
---|
| 174 | return; |
---|
| 175 | } |
---|
| 176 | #endif |
---|
[324] | 177 | |
---|
| 178 | m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 179 | } |
---|
| 180 | |
---|
| 181 | Void TDecEntropy::decodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 182 | { |
---|
| 183 | m_pcEntropyDecoderIf->parseIntraDirLumaAng( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 184 | } |
---|
| 185 | |
---|
| 186 | Void TDecEntropy::decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 187 | { |
---|
| 188 | m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | /** decode motion information for every PU block. |
---|
| 192 | * \param pcCU |
---|
| 193 | * \param uiAbsPartIdx |
---|
| 194 | * \param uiDepth |
---|
| 195 | * \param pcSubCU |
---|
| 196 | * \returns Void |
---|
| 197 | */ |
---|
| 198 | Void TDecEntropy::decodePUWise( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
| 199 | { |
---|
| 200 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
| 201 | UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); |
---|
| 202 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
---|
| 203 | |
---|
[476] | 204 | #if H_3D_IV_MERGE |
---|
| 205 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
| 206 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 207 | #else |
---|
[324] | 208 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
| 209 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
[476] | 210 | #endif |
---|
[324] | 211 | |
---|
| 212 | for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) |
---|
| 213 | { |
---|
| 214 | uhInterDirNeighbours[ui] = 0; |
---|
| 215 | } |
---|
| 216 | Int numValidMergeCand = 0; |
---|
| 217 | Bool isMerged = false; |
---|
| 218 | |
---|
| 219 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
| 220 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
[476] | 221 | #if H_3D_IV_MERGE |
---|
| 222 | pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
---|
| 223 | #endif |
---|
[324] | 224 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
---|
| 225 | { |
---|
[521] | 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) |
---|
| 231 | #endif |
---|
[324] | 232 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 233 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
---|
| 234 | { |
---|
| 235 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); |
---|
| 236 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
| 237 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) |
---|
| 238 | { |
---|
| 239 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
| 240 | if ( !isMerged ) |
---|
| 241 | { |
---|
[510] | 242 | #if H_3D_VSP |
---|
| 243 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
| 244 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
[597] | 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 |
---|
[510] | 255 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand ); |
---|
[597] | 256 | #endif |
---|
| 257 | #endif//end of MTK_VSP_FIX_ALIGN_WD_E0172 |
---|
[510] | 258 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
[597] | 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 |
---|
[510] | 265 | #else |
---|
[324] | 266 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
[510] | 267 | #endif |
---|
[324] | 268 | isMerged = true; |
---|
| 269 | } |
---|
| 270 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
---|
| 271 | } |
---|
| 272 | else |
---|
| 273 | { |
---|
[510] | 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); |
---|
[597] | 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 ); |
---|
| 281 | #else |
---|
| 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 ); |
---|
| 287 | #else |
---|
[510] | 288 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex ); |
---|
[597] | 289 | #endif |
---|
| 290 | #endif//end of MTK_VSP_FIX_ALIGN_WD_E0172 |
---|
[510] | 291 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
[597] | 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 |
---|
[510] | 298 | #else |
---|
[324] | 299 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
[510] | 300 | #endif |
---|
[324] | 301 | } |
---|
| 302 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
| 303 | |
---|
| 304 | TComMv cTmpMv( 0, 0 ); |
---|
| 305 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 306 | { |
---|
| 307 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
| 308 | { |
---|
| 309 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
| 310 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
| 311 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 312 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 313 | } |
---|
| 314 | } |
---|
| 315 | } |
---|
| 316 | else |
---|
| 317 | { |
---|
| 318 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
| 319 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 320 | { |
---|
| 321 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
| 322 | { |
---|
| 323 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
| 324 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
| 325 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
| 326 | } |
---|
| 327 | } |
---|
| 328 | } |
---|
[597] | 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 |
---|
[324] | 332 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) |
---|
[597] | 333 | #endif |
---|
[324] | 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 | } |
---|
| 339 | } |
---|
| 340 | return; |
---|
| 341 | } |
---|
| 342 | |
---|
| 343 | /** decode inter direction for a PU block |
---|
| 344 | * \param pcCU |
---|
| 345 | * \param uiAbsPartIdx |
---|
| 346 | * \param uiDepth |
---|
| 347 | * \param uiPartIdx |
---|
| 348 | * \returns Void |
---|
| 349 | */ |
---|
| 350 | Void TDecEntropy::decodeInterDirPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx ) |
---|
| 351 | { |
---|
| 352 | UInt uiInterDir; |
---|
| 353 | |
---|
| 354 | if ( pcCU->getSlice()->isInterP() ) |
---|
| 355 | { |
---|
| 356 | uiInterDir = 1; |
---|
| 357 | } |
---|
| 358 | else |
---|
| 359 | { |
---|
| 360 | m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx ); |
---|
| 361 | } |
---|
| 362 | |
---|
| 363 | pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
| 367 | { |
---|
| 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; |
---|
| 378 | } |
---|
| 379 | else |
---|
| 380 | { |
---|
| 381 | iRefFrmIdx = 0; |
---|
| 382 | } |
---|
| 383 | |
---|
| 384 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
| 385 | pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | /** decode motion vector difference for a PU block |
---|
| 389 | * \param pcCU |
---|
| 390 | * \param uiAbsPartIdx |
---|
| 391 | * \param uiDepth |
---|
| 392 | * \param uiPartIdx |
---|
| 393 | * \param eRefList |
---|
| 394 | * \returns Void |
---|
| 395 | */ |
---|
| 396 | Void TDecEntropy::decodeMvdPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
| 397 | { |
---|
| 398 | if ( pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ) ) |
---|
| 399 | { |
---|
| 400 | m_pcEntropyDecoderIf->parseMvd( pcCU, uiAbsPartIdx, uiPartIdx, uiDepth, eRefList ); |
---|
| 401 | } |
---|
| 402 | } |
---|
| 403 | |
---|
| 404 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
| 405 | { |
---|
| 406 | Int iMVPIdx = -1; |
---|
| 407 | |
---|
| 408 | TComMv cZeroMv( 0, 0 ); |
---|
| 409 | TComMv cMv = cZeroMv; |
---|
| 410 | Int iRefIdx = -1; |
---|
| 411 | |
---|
| 412 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
---|
| 413 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
---|
| 414 | |
---|
| 415 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
---|
| 416 | cMv = cZeroMv; |
---|
| 417 | |
---|
| 418 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
---|
| 419 | { |
---|
| 420 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
---|
[521] | 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 |
---|
[324] | 433 | } |
---|
| 434 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
---|
| 435 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
---|
| 436 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
---|
| 437 | if ( iRefIdx >= 0 ) |
---|
| 438 | { |
---|
| 439 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); |
---|
| 440 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
---|
| 441 | } |
---|
| 442 | |
---|
| 443 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
---|
| 444 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
---|
| 445 | } |
---|
| 446 | |
---|
| 447 | Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP) |
---|
| 448 | { |
---|
| 449 | UInt uiSubdiv; |
---|
| 450 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; |
---|
| 451 | |
---|
| 452 | if(uiTrIdx==0) |
---|
| 453 | { |
---|
| 454 | m_bakAbsPartIdxCU = uiAbsPartIdx; |
---|
| 455 | } |
---|
| 456 | if( uiLog2TrafoSize == 2 ) |
---|
| 457 | { |
---|
| 458 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
| 459 | if( ( uiAbsPartIdx % partNum ) == 0 ) |
---|
| 460 | { |
---|
| 461 | m_uiBakAbsPartIdx = uiAbsPartIdx; |
---|
| 462 | m_uiBakChromaOffset = offsetChroma; |
---|
| 463 | } |
---|
| 464 | } |
---|
| 465 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) |
---|
| 466 | { |
---|
| 467 | uiSubdiv = 1; |
---|
| 468 | } |
---|
| 469 | else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) |
---|
| 470 | { |
---|
| 471 | uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx)); |
---|
| 472 | } |
---|
| 473 | else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
| 474 | { |
---|
| 475 | uiSubdiv = 1; |
---|
| 476 | } |
---|
| 477 | else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
| 478 | { |
---|
| 479 | uiSubdiv = 0; |
---|
| 480 | } |
---|
| 481 | else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) |
---|
| 482 | { |
---|
| 483 | uiSubdiv = 0; |
---|
| 484 | } |
---|
| 485 | else |
---|
| 486 | { |
---|
| 487 | assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); |
---|
| 488 | m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); |
---|
| 489 | } |
---|
| 490 | |
---|
| 491 | const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx ); |
---|
| 492 | { |
---|
| 493 | const Bool bFirstCbfOfCU = uiTrDepth == 0; |
---|
| 494 | if( bFirstCbfOfCU ) |
---|
| 495 | { |
---|
| 496 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
| 497 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
| 498 | } |
---|
| 499 | if( bFirstCbfOfCU || uiLog2TrafoSize > 2 ) |
---|
| 500 | { |
---|
| 501 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) |
---|
| 502 | { |
---|
| 503 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); |
---|
| 504 | } |
---|
| 505 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) |
---|
| 506 | { |
---|
| 507 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); |
---|
| 508 | } |
---|
| 509 | } |
---|
| 510 | else |
---|
| 511 | { |
---|
| 512 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
| 513 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
| 514 | } |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | if( uiSubdiv ) |
---|
| 518 | { |
---|
| 519 | UInt size; |
---|
| 520 | width >>= 1; |
---|
| 521 | height >>= 1; |
---|
| 522 | size = width*height; |
---|
| 523 | uiTrIdx++; |
---|
| 524 | ++uiDepth; |
---|
| 525 | const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
| 526 | const UInt uiStartAbsPartIdx = uiAbsPartIdx; |
---|
| 527 | UInt uiYCbf = 0; |
---|
| 528 | UInt uiUCbf = 0; |
---|
| 529 | UInt uiVCbf = 0; |
---|
| 530 | |
---|
| 531 | for( Int i = 0; i < 4; i++ ) |
---|
| 532 | { |
---|
| 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 ); |
---|
| 537 | uiAbsPartIdx += uiQPartNum; |
---|
| 538 | offsetLuma += size; offsetChroma += (size>>2); |
---|
| 539 | } |
---|
| 540 | |
---|
| 541 | for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) |
---|
| 542 | { |
---|
| 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; |
---|
| 546 | } |
---|
| 547 | } |
---|
| 548 | else |
---|
| 549 | { |
---|
| 550 | assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) ); |
---|
| 551 | pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); |
---|
| 552 | |
---|
[521] | 553 | #if !H_MV_ENC_DEC_TRAC |
---|
[324] | 554 | { |
---|
| 555 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
| 556 | DTRACE_CABAC_T( "\tTrIdx: abspart=" ); |
---|
| 557 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
| 558 | DTRACE_CABAC_T( "\tdepth=" ); |
---|
| 559 | DTRACE_CABAC_V( uiDepth ); |
---|
| 560 | DTRACE_CABAC_T( "\ttrdepth=" ); |
---|
| 561 | DTRACE_CABAC_V( uiTrDepth ); |
---|
| 562 | DTRACE_CABAC_T( "\n" ); |
---|
| 563 | } |
---|
[521] | 564 | #endif |
---|
[324] | 565 | |
---|
| 566 | pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
| 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 ) ) |
---|
| 568 | { |
---|
| 569 | pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
| 570 | } |
---|
| 571 | else |
---|
| 572 | { |
---|
| 573 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth ); |
---|
| 574 | } |
---|
| 575 | |
---|
| 576 | |
---|
| 577 | // transform_unit begin |
---|
| 578 | UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); |
---|
| 579 | UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
| 580 | UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
| 581 | if( uiLog2TrafoSize == 2 ) |
---|
| 582 | { |
---|
| 583 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
| 584 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
---|
| 585 | { |
---|
| 586 | cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
| 587 | cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
| 588 | } |
---|
| 589 | } |
---|
| 590 | if ( cbfY || cbfU || cbfV ) |
---|
| 591 | { |
---|
| 592 | // dQP: only for LCU |
---|
| 593 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
| 594 | { |
---|
| 595 | if ( bCodeDQP ) |
---|
| 596 | { |
---|
| 597 | decodeQP( pcCU, m_bakAbsPartIdxCU); |
---|
| 598 | bCodeDQP = false; |
---|
| 599 | } |
---|
| 600 | } |
---|
| 601 | } |
---|
| 602 | if( cbfY ) |
---|
| 603 | { |
---|
| 604 | Int trWidth = width; |
---|
| 605 | Int trHeight = height; |
---|
| 606 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); |
---|
| 607 | } |
---|
| 608 | if( uiLog2TrafoSize > 2 ) |
---|
| 609 | { |
---|
| 610 | Int trWidth = width >> 1; |
---|
| 611 | Int trHeight = height >> 1; |
---|
| 612 | if( cbfU ) |
---|
| 613 | { |
---|
| 614 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
| 615 | } |
---|
| 616 | if( cbfV ) |
---|
| 617 | { |
---|
| 618 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
| 619 | } |
---|
| 620 | } |
---|
| 621 | else |
---|
| 622 | { |
---|
| 623 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
| 624 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
---|
| 625 | { |
---|
| 626 | Int trWidth = width; |
---|
| 627 | Int trHeight = height; |
---|
| 628 | if( cbfU ) |
---|
| 629 | { |
---|
| 630 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
| 631 | } |
---|
| 632 | if( cbfV ) |
---|
| 633 | { |
---|
| 634 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
| 635 | } |
---|
| 636 | } |
---|
| 637 | } |
---|
| 638 | // transform_unit end |
---|
| 639 | } |
---|
| 640 | } |
---|
| 641 | |
---|
| 642 | Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
| 643 | { |
---|
| 644 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
| 645 | { |
---|
| 646 | m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); |
---|
| 647 | } |
---|
| 648 | } |
---|
| 649 | |
---|
| 650 | |
---|
| 651 | /** decode coefficients |
---|
| 652 | * \param pcCU |
---|
| 653 | * \param uiAbsPartIdx |
---|
| 654 | * \param uiDepth |
---|
| 655 | * \param uiWidth |
---|
| 656 | * \param uiHeight |
---|
| 657 | * \returns Void |
---|
| 658 | */ |
---|
| 659 | Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP ) |
---|
| 660 | { |
---|
| 661 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
| 662 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
| 663 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
| 664 | |
---|
[531] | 665 | #if H_3D_DIM_SDC |
---|
| 666 | if( pcCU->getSDCFlag( uiAbsPartIdx ) ) |
---|
| 667 | { |
---|
| 668 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
| 669 | assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); |
---|
| 670 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); |
---|
| 671 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); |
---|
| 672 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); |
---|
| 673 | return; |
---|
| 674 | } |
---|
| 675 | #endif |
---|
| 676 | |
---|
[598] | 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 | |
---|
[324] | 689 | if( pcCU->isIntra(uiAbsPartIdx) ) |
---|
| 690 | { |
---|
| 691 | } |
---|
| 692 | else |
---|
| 693 | { |
---|
| 694 | UInt uiQtRootCbf = 1; |
---|
| 695 | if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) ) |
---|
| 696 | { |
---|
| 697 | m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf ); |
---|
| 698 | } |
---|
| 699 | if ( !uiQtRootCbf ) |
---|
| 700 | { |
---|
| 701 | pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth ); |
---|
| 702 | pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); |
---|
| 703 | return; |
---|
| 704 | } |
---|
| 705 | |
---|
| 706 | } |
---|
| 707 | xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP ); |
---|
| 708 | } |
---|
| 709 | |
---|
[598] | 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 | |
---|
| 742 | // decode residual data for each segment |
---|
| 743 | for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ ) |
---|
| 744 | { |
---|
| 745 | m_pcEntropyDecoderIf->parseInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth, uiSeg ); |
---|
| 746 | } |
---|
| 747 | } |
---|
| 748 | #endif |
---|
| 749 | |
---|
[324] | 750 | //! \} |
---|