| [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 | * |
|---|
| [1179] | 6 | * Copyright (c) 2010-2015, 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 | } |
|---|
| [1185] | 54 | #if H_3D |
|---|
| [1179] | 55 | Void TDecEntropy::decodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 56 | { |
|---|
| 57 | if( !pcCU->getSlice()->getDepthIntraSkipFlag() ) |
|---|
| 58 | { |
|---|
| 59 | return; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | m_pcEntropyDecoderIf->parseDIS( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 63 | } |
|---|
| [1039] | 64 | #endif |
|---|
| [1179] | 65 | |
|---|
| [608] | 66 | Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 67 | { |
|---|
| 68 | m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| [2] | 71 | /** decode merge flag |
|---|
| 72 | * \param pcSubCU |
|---|
| 73 | * \param uiAbsPartIdx |
|---|
| 74 | * \param uiDepth |
|---|
| 75 | * \param uiPUIdx |
|---|
| 76 | * \returns Void |
|---|
| 77 | */ |
|---|
| 78 | Void TDecEntropy::decodeMergeFlag( TComDataCU* pcSubCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
|---|
| 79 | { |
|---|
| [56] | 80 | // at least one merge candidate exists |
|---|
| 81 | m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx ); |
|---|
| [2] | 82 | } |
|---|
| 83 | |
|---|
| 84 | /** decode merge index |
|---|
| 85 | * \param pcCU |
|---|
| 86 | * \param uiPartIdx |
|---|
| 87 | * \param uiAbsPartIdx |
|---|
| 88 | * \param puhInterDirNeighbours pointer to list of inter direction from the casual neighbours |
|---|
| 89 | * \param pcMvFieldNeighbours pointer to list of motion vector field from the casual neighbours |
|---|
| 90 | * \param uiDepth |
|---|
| 91 | * \returns Void |
|---|
| 92 | */ |
|---|
| [608] | 93 | Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| [2] | 94 | { |
|---|
| 95 | UInt uiMergeIndex = 0; |
|---|
| [608] | 96 | m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex ); |
|---|
| [2] | 97 | pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth ); |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| [608] | 100 | #if H_3D_ARP |
|---|
| 101 | Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| [443] | 102 | { |
|---|
| [608] | 103 | if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) |
|---|
| 104 | { |
|---|
| [443] | 105 | return; |
|---|
| [608] | 106 | } |
|---|
| 107 | |
|---|
| 108 | if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) |
|---|
| 109 | { |
|---|
| 110 | pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); |
|---|
| 111 | } |
|---|
| [443] | 112 | else |
|---|
| [608] | 113 | { |
|---|
| [443] | 114 | m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); |
|---|
| [608] | 115 | } |
|---|
| [443] | 116 | } |
|---|
| 117 | #endif |
|---|
| [608] | 118 | |
|---|
| 119 | #if H_3D_IC |
|---|
| 120 | Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 121 | { |
|---|
| 122 | pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); |
|---|
| 123 | |
|---|
| [833] | 124 | if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) |
|---|
| [608] | 125 | { |
|---|
| 126 | return; |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | if( !pcCU->getSlice()->getApplyIC() ) |
|---|
| 130 | return; |
|---|
| 131 | |
|---|
| 132 | if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) |
|---|
| 133 | m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 134 | } |
|---|
| 135 | #endif |
|---|
| 136 | |
|---|
| [2] | 137 | Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 138 | { |
|---|
| 139 | m_pcEntropyDecoderIf->parseSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | Void TDecEntropy::decodePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 143 | { |
|---|
| 144 | m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 148 | { |
|---|
| 149 | m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 150 | } |
|---|
| 151 | |
|---|
| 152 | Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
|---|
| 153 | { |
|---|
| 154 | if( pcCU->isIntra( uiAbsPartIdx ) ) // If it is Intra mode, encode intra prediction mode. |
|---|
| 155 | { |
|---|
| [608] | 156 | decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| [1185] | 157 | #if H_3D_DIM_SDC |
|---|
| [1179] | 158 | decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 159 | #if H_3D_DISABLE_CHROMA |
|---|
| 160 | if(!pcCU->getSDCFlag(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) |
|---|
| 161 | #else |
|---|
| [608] | 162 | if(!pcCU->getSDCFlag(uiAbsPartIdx)) |
|---|
| [443] | 163 | #endif |
|---|
| [1179] | 164 | #endif |
|---|
| [608] | 165 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| [2] | 166 | } |
|---|
| 167 | else // if it is Inter mode, encode motion vector and reference index |
|---|
| 168 | { |
|---|
| [56] | 169 | decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); |
|---|
| 170 | } |
|---|
| 171 | } |
|---|
| [2] | 172 | |
|---|
| [56] | 173 | /** Parse I_PCM information. |
|---|
| 174 | * \param pcCU pointer to CUpointer to CU |
|---|
| 175 | * \param uiAbsPartIdx CU index |
|---|
| 176 | * \param uiDepth CU depth |
|---|
| 177 | * \returns Void |
|---|
| 178 | */ |
|---|
| 179 | Void TDecEntropy::decodeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 180 | { |
|---|
| 181 | if(!pcCU->getSlice()->getSPS()->getUsePCM() |
|---|
| 182 | || pcCU->getWidth(uiAbsPartIdx) > (1<<pcCU->getSlice()->getSPS()->getPCMLog2MaxSize()) |
|---|
| 183 | || pcCU->getWidth(uiAbsPartIdx) < (1<<pcCU->getSlice()->getSPS()->getPCMLog2MinSize()) ) |
|---|
| 184 | { |
|---|
| 185 | return; |
|---|
| [2] | 186 | } |
|---|
| [189] | 187 | |
|---|
| [56] | 188 | m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| [2] | 189 | } |
|---|
| 190 | |
|---|
| 191 | Void TDecEntropy::decodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 192 | { |
|---|
| 193 | m_pcEntropyDecoderIf->parseIntraDirLumaAng( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | Void TDecEntropy::decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 197 | { |
|---|
| 198 | m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 199 | } |
|---|
| 200 | |
|---|
| [56] | 201 | /** decode motion information for every PU block. |
|---|
| [2] | 202 | * \param pcCU |
|---|
| 203 | * \param uiAbsPartIdx |
|---|
| 204 | * \param uiDepth |
|---|
| 205 | * \param pcSubCU |
|---|
| 206 | * \returns Void |
|---|
| 207 | */ |
|---|
| 208 | Void TDecEntropy::decodePUWise( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
|---|
| 209 | { |
|---|
| 210 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
|---|
| 211 | UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); |
|---|
| 212 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
|---|
| 213 | |
|---|
| [608] | 214 | #if H_3D_IV_MERGE |
|---|
| [56] | 215 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
|---|
| 216 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 217 | #else |
|---|
| 218 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
|---|
| 219 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
|---|
| 220 | #endif |
|---|
| [773] | 221 | #if H_3D_SPIVMP |
|---|
| [724] | 222 | Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 223 | TComMvField* pcMvFieldSP; |
|---|
| 224 | UChar* puhInterDirSP; |
|---|
| 225 | pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; |
|---|
| 226 | puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; |
|---|
| 227 | #endif |
|---|
| [608] | 228 | for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) |
|---|
| [56] | 229 | { |
|---|
| 230 | uhInterDirNeighbours[ui] = 0; |
|---|
| 231 | } |
|---|
| 232 | Int numValidMergeCand = 0; |
|---|
| [608] | 233 | Bool isMerged = false; |
|---|
| [56] | 234 | |
|---|
| [2] | 235 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
|---|
| 236 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
|---|
| [608] | 237 | #if H_3D_IV_MERGE |
|---|
| 238 | pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
|---|
| 239 | #endif |
|---|
| [1185] | 240 | #if H_3D |
|---|
| [2] | 241 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
|---|
| 242 | { |
|---|
| [608] | 243 | #if H_MV_ENC_DEC_TRAC |
|---|
| 244 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
|---|
| 245 | // ToDo: |
|---|
| 246 | //DTRACE_PU("x0", uiLPelX) |
|---|
| 247 | //DTRACE_PU("x1", uiTPelY) |
|---|
| [56] | 248 | #endif |
|---|
| [1179] | 249 | |
|---|
| 250 | ////// Parse PUs syntax |
|---|
| [2] | 251 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 252 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
|---|
| 253 | { |
|---|
| [1179] | 254 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); |
|---|
| 255 | } |
|---|
| 256 | else |
|---|
| 257 | { |
|---|
| 258 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 259 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 260 | { |
|---|
| 261 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
|---|
| 262 | { |
|---|
| 263 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 264 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 265 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 266 | } |
|---|
| 267 | } |
|---|
| 268 | } |
|---|
| 269 | } |
|---|
| 270 | |
|---|
| 271 | ////// Parse CUs extension syntax |
|---|
| 272 | decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 273 | decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 274 | |
|---|
| 275 | #if H_3D_ARP |
|---|
| 276 | decodeARPW ( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 277 | #endif |
|---|
| 278 | #if H_3D_IC |
|---|
| 279 | decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 280 | #endif |
|---|
| 281 | |
|---|
| 282 | ////// Decode motion vectors |
|---|
| 283 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
|---|
| 284 | { |
|---|
| 285 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
|---|
| 286 | { |
|---|
| 287 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
|---|
| 288 | #if H_3D_DBBP |
|---|
| 289 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false ) |
|---|
| 290 | #else |
|---|
| 291 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) |
|---|
| 292 | #endif |
|---|
| 293 | { |
|---|
| 294 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
|---|
| 295 | if ( !isMerged ) |
|---|
| 296 | { |
|---|
| 297 | #if H_3D_VSP |
|---|
| 298 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 299 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
|---|
| 300 | #if H_3D_SPIVMP |
|---|
| 301 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
|---|
| 302 | #endif |
|---|
| 303 | pcSubCU->initAvailableFlags(); |
|---|
| 304 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); |
|---|
| 305 | pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours |
|---|
| 306 | #if H_3D_SPIVMP |
|---|
| 307 | , pcMvFieldSP, puhInterDirSP |
|---|
| 308 | #endif |
|---|
| 309 | , numValidMergeCand ); |
|---|
| 310 | pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag |
|---|
| 311 | #if H_3D_SPIVMP |
|---|
| 312 | , bSPIVMPFlag |
|---|
| 313 | #endif |
|---|
| 314 | , numValidMergeCand ); |
|---|
| 315 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
|---|
| 316 | |
|---|
| 317 | #else |
|---|
| 318 | #if H_3D |
|---|
| 319 | pcSubCU->initAvailableFlags(); |
|---|
| 320 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); |
|---|
| 321 | pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
|---|
| 322 | |
|---|
| 323 | #else |
|---|
| 324 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
|---|
| 325 | #endif |
|---|
| 326 | #endif |
|---|
| 327 | isMerged = true; |
|---|
| 328 | } |
|---|
| 329 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
|---|
| 330 | } |
|---|
| 331 | else |
|---|
| 332 | { |
|---|
| 333 | uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
|---|
| 334 | #if H_3D_VSP |
|---|
| 335 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
|---|
| 336 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
|---|
| 337 | #if H_3D_SPIVMP |
|---|
| 338 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
|---|
| 339 | #endif |
|---|
| 340 | pcSubCU->initAvailableFlags(); |
|---|
| 341 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 342 | pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours |
|---|
| 343 | #if H_3D_SPIVMP |
|---|
| 344 | , pcMvFieldSP, puhInterDirSP |
|---|
| 345 | #endif |
|---|
| 346 | ,numValidMergeCand, uiMergeIndex ); |
|---|
| 347 | pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag |
|---|
| 348 | #if H_3D_SPIVMP |
|---|
| 349 | , bSPIVMPFlag |
|---|
| 350 | #endif |
|---|
| 351 | ,numValidMergeCand ); |
|---|
| 352 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
|---|
| 353 | #else |
|---|
| 354 | #if H_3D |
|---|
| 355 | pcSubCU->initAvailableFlags(); |
|---|
| 356 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 357 | pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 358 | #else |
|---|
| 359 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| 360 | #endif |
|---|
| 361 | #endif |
|---|
| 362 | } |
|---|
| 363 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
|---|
| 364 | |
|---|
| 365 | TComMv cTmpMv( 0, 0 ); |
|---|
| 366 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 367 | { |
|---|
| 368 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
|---|
| 369 | { |
|---|
| 370 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
|---|
| 371 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
|---|
| 372 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 373 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 374 | #if H_3D_VSP |
|---|
| 375 | #if H_3D_DBBP |
|---|
| 376 | if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) ) |
|---|
| 377 | #else |
|---|
| 378 | if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 ) |
|---|
| 379 | #endif |
|---|
| 380 | { |
|---|
| 381 | if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) ) |
|---|
| 382 | { |
|---|
| 383 | UInt dummy; |
|---|
| 384 | Int vspSize; |
|---|
| 385 | Int width, height; |
|---|
| 386 | pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 ); |
|---|
| 387 | pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize ); |
|---|
| 388 | pcCU->setVSPFlag( uiSubPartIdx, vspSize ); |
|---|
| 389 | } |
|---|
| 390 | } |
|---|
| 391 | #endif |
|---|
| 392 | } |
|---|
| 393 | } |
|---|
| 394 | #if H_3D_SPIVMP |
|---|
| 395 | pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
|---|
| 396 | if (bSPIVMPFlag[uiMergeIndex] != 0) |
|---|
| 397 | { |
|---|
| 398 | Int iWidth, iHeight; |
|---|
| 399 | UInt uiIdx; |
|---|
| 400 | pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true ); |
|---|
| 401 | |
|---|
| 402 | UInt uiSPAddr; |
|---|
| 403 | |
|---|
| 404 | Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; |
|---|
| 405 | |
|---|
| 406 | pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); |
|---|
| 407 | |
|---|
| 408 | for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) |
|---|
| 409 | { |
|---|
| 410 | pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); |
|---|
| 411 | pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); |
|---|
| 412 | pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); |
|---|
| 413 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); |
|---|
| 414 | } |
|---|
| 415 | } |
|---|
| 416 | #endif |
|---|
| 417 | } |
|---|
| 418 | else |
|---|
| 419 | { |
|---|
| 420 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 421 | { |
|---|
| 422 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
|---|
| 423 | { |
|---|
| 424 | decodeMvsAMVP ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 425 | } |
|---|
| 426 | } |
|---|
| 427 | } |
|---|
| 428 | |
|---|
| 429 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) |
|---|
| 430 | { |
|---|
| 431 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
|---|
| 432 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
|---|
| 433 | pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth); |
|---|
| 434 | } |
|---|
| 435 | } |
|---|
| 436 | #else |
|---|
| 437 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
|---|
| 438 | { |
|---|
| 439 | #if H_MV_ENC_DEC_TRAC |
|---|
| 440 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
|---|
| 441 | // ToDo: |
|---|
| 442 | //DTRACE_PU("x0", uiLPelX) |
|---|
| 443 | //DTRACE_PU("x1", uiTPelY) |
|---|
| 444 | #endif |
|---|
| 445 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 446 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
|---|
| 447 | { |
|---|
| [608] | 448 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); |
|---|
| [56] | 449 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
|---|
| [833] | 450 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false ) |
|---|
| [2] | 451 | { |
|---|
| [56] | 452 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
|---|
| 453 | if ( !isMerged ) |
|---|
| [2] | 454 | { |
|---|
| [608] | 455 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
|---|
| [56] | 456 | isMerged = true; |
|---|
| [2] | 457 | } |
|---|
| [56] | 458 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
|---|
| 459 | } |
|---|
| 460 | else |
|---|
| 461 | { |
|---|
| [622] | 462 | uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
|---|
| [724] | 463 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
|---|
| [56] | 464 | } |
|---|
| 465 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
|---|
| [833] | 466 | |
|---|
| [56] | 467 | TComMv cTmpMv( 0, 0 ); |
|---|
| 468 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 469 | { |
|---|
| 470 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
|---|
| [2] | 471 | { |
|---|
| [56] | 472 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
|---|
| 473 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
|---|
| 474 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 475 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| [2] | 476 | } |
|---|
| 477 | } |
|---|
| [56] | 478 | } |
|---|
| 479 | else |
|---|
| 480 | { |
|---|
| [2] | 481 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
|---|
| 482 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
|---|
| 483 | { |
|---|
| 484 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
|---|
| 485 | { |
|---|
| 486 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 487 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 488 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
|---|
| 489 | } |
|---|
| 490 | } |
|---|
| [724] | 491 | #if H_3D_ARP |
|---|
| 492 | decodeARPW ( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 493 | #endif |
|---|
| [833] | 494 | #if H_3D_IC |
|---|
| 495 | decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 496 | #endif |
|---|
| [2] | 497 | } |
|---|
| [608] | 498 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) |
|---|
| 499 | { |
|---|
| 500 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
|---|
| 501 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
|---|
| 502 | pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth); |
|---|
| 503 | } |
|---|
| [2] | 504 | } |
|---|
| [1179] | 505 | #endif |
|---|
| [773] | 506 | #if H_3D_SPIVMP |
|---|
| [735] | 507 | delete[] pcMvFieldSP; |
|---|
| 508 | delete[] puhInterDirSP; |
|---|
| [724] | 509 | #endif |
|---|
| [2] | 510 | return; |
|---|
| 511 | } |
|---|
| 512 | |
|---|
| 513 | /** decode inter direction for a PU block |
|---|
| 514 | * \param pcCU |
|---|
| 515 | * \param uiAbsPartIdx |
|---|
| 516 | * \param uiDepth |
|---|
| 517 | * \param uiPartIdx |
|---|
| 518 | * \returns Void |
|---|
| 519 | */ |
|---|
| 520 | Void TDecEntropy::decodeInterDirPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx ) |
|---|
| 521 | { |
|---|
| 522 | UInt uiInterDir; |
|---|
| 523 | |
|---|
| 524 | if ( pcCU->getSlice()->isInterP() ) |
|---|
| 525 | { |
|---|
| 526 | uiInterDir = 1; |
|---|
| 527 | } |
|---|
| 528 | else |
|---|
| 529 | { |
|---|
| [608] | 530 | m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx ); |
|---|
| [2] | 531 | } |
|---|
| 532 | |
|---|
| 533 | pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); |
|---|
| 534 | } |
|---|
| 535 | |
|---|
| 536 | Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
|---|
| 537 | { |
|---|
| [608] | 538 | Int iRefFrmIdx = 0; |
|---|
| 539 | Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ); |
|---|
| 540 | |
|---|
| 541 | if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx ) |
|---|
| [2] | 542 | { |
|---|
| [608] | 543 | m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, eRefList ); |
|---|
| [2] | 544 | } |
|---|
| [608] | 545 | else if ( !iParseRefFrmIdx ) |
|---|
| 546 | { |
|---|
| 547 | iRefFrmIdx = NOT_VALID; |
|---|
| 548 | } |
|---|
| [2] | 549 | else |
|---|
| 550 | { |
|---|
| [608] | 551 | iRefFrmIdx = 0; |
|---|
| 552 | } |
|---|
| [2] | 553 | |
|---|
| [608] | 554 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
|---|
| 555 | pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); |
|---|
| [2] | 556 | } |
|---|
| 557 | |
|---|
| 558 | /** decode motion vector difference for a PU block |
|---|
| 559 | * \param pcCU |
|---|
| 560 | * \param uiAbsPartIdx |
|---|
| 561 | * \param uiDepth |
|---|
| 562 | * \param uiPartIdx |
|---|
| 563 | * \param eRefList |
|---|
| 564 | * \returns Void |
|---|
| 565 | */ |
|---|
| 566 | Void TDecEntropy::decodeMvdPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
|---|
| 567 | { |
|---|
| 568 | if ( pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ) ) |
|---|
| 569 | { |
|---|
| 570 | m_pcEntropyDecoderIf->parseMvd( pcCU, uiAbsPartIdx, uiPartIdx, uiDepth, eRefList ); |
|---|
| 571 | } |
|---|
| 572 | } |
|---|
| 573 | |
|---|
| [1185] | 574 | #if H_3D |
|---|
| [2] | 575 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
|---|
| 576 | { |
|---|
| [56] | 577 | Int iMVPIdx = -1; |
|---|
| [2] | 578 | |
|---|
| [1179] | 579 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
|---|
| 580 | { |
|---|
| 581 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
|---|
| 582 | #if H_MV_ENC_DEC_TRAC |
|---|
| 583 | #if ENC_DEC_TRACE |
|---|
| 584 | if ( eRefList == REF_PIC_LIST_0 ) |
|---|
| 585 | { |
|---|
| 586 | DTRACE_PU("mvp_l0_flag", iMVPIdx) |
|---|
| 587 | } |
|---|
| 588 | else |
|---|
| 589 | { |
|---|
| 590 | DTRACE_PU("mvp_l1_flag", iMVPIdx) |
|---|
| 591 | } |
|---|
| 592 | #endif |
|---|
| 593 | #endif |
|---|
| 594 | } |
|---|
| 595 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
|---|
| 596 | } |
|---|
| 597 | |
|---|
| 598 | Void TDecEntropy::decodeMvsAMVP( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
|---|
| 599 | { |
|---|
| [2] | 600 | TComMv cZeroMv( 0, 0 ); |
|---|
| 601 | TComMv cMv = cZeroMv; |
|---|
| 602 | Int iRefIdx = -1; |
|---|
| 603 | |
|---|
| 604 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
|---|
| 605 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
|---|
| 606 | |
|---|
| 607 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
|---|
| 608 | cMv = cZeroMv; |
|---|
| [56] | 609 | |
|---|
| [1179] | 610 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
|---|
| 611 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
|---|
| 612 | if ( iRefIdx >= 0 ) |
|---|
| 613 | { |
|---|
| 614 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); |
|---|
| 615 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
|---|
| 616 | } |
|---|
| 617 | |
|---|
| 618 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
|---|
| 619 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
|---|
| 620 | } |
|---|
| 621 | #else |
|---|
| 622 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
|---|
| 623 | { |
|---|
| 624 | Int iMVPIdx = -1; |
|---|
| 625 | |
|---|
| 626 | TComMv cZeroMv( 0, 0 ); |
|---|
| 627 | TComMv cMv = cZeroMv; |
|---|
| 628 | Int iRefIdx = -1; |
|---|
| 629 | |
|---|
| 630 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
|---|
| 631 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
|---|
| 632 | |
|---|
| 633 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
|---|
| 634 | cMv = cZeroMv; |
|---|
| 635 | |
|---|
| [608] | 636 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
|---|
| [56] | 637 | { |
|---|
| 638 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
|---|
| [608] | 639 | #if H_MV_ENC_DEC_TRAC |
|---|
| 640 | #if ENC_DEC_TRACE |
|---|
| 641 | if ( eRefList == REF_PIC_LIST_0 ) |
|---|
| 642 | { |
|---|
| 643 | DTRACE_PU("mvp_l0_flag", iMVPIdx) |
|---|
| 644 | } |
|---|
| 645 | else |
|---|
| 646 | { |
|---|
| 647 | DTRACE_PU("mvp_l1_flag", iMVPIdx) |
|---|
| 648 | } |
|---|
| [56] | 649 | #endif |
|---|
| [608] | 650 | #endif |
|---|
| [56] | 651 | } |
|---|
| [2] | 652 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
|---|
| 653 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
|---|
| 654 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
|---|
| 655 | if ( iRefIdx >= 0 ) |
|---|
| 656 | { |
|---|
| [608] | 657 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); |
|---|
| [2] | 658 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
|---|
| 659 | } |
|---|
| 660 | |
|---|
| 661 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
|---|
| [56] | 662 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
|---|
| [2] | 663 | } |
|---|
| [1179] | 664 | #endif |
|---|
| [1185] | 665 | |
|---|
| [872] | 666 | Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Int quadtreeTULog2MinSizeInCU) |
|---|
| [2] | 667 | { |
|---|
| [1179] | 668 | |
|---|
| 669 | #if H_MV_ENC_DEC_TRAC |
|---|
| 670 | #if ENC_DEC_TRACE |
|---|
| 671 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 672 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
|---|
| 673 | |
|---|
| 674 | DTRACE_TU_S("=========== transform_tree ===========\n") |
|---|
| 675 | DTRACE_TU("x0", uiLPelX) |
|---|
| 676 | DTRACE_TU("x1", uiTPelY) |
|---|
| 677 | DTRACE_TU("log2TrafoSize", g_uiMaxCUWidth>>uiDepth) |
|---|
| 678 | DTRACE_TU("trafoDepth" , uiDepth) |
|---|
| 679 | #endif |
|---|
| 680 | #endif |
|---|
| 681 | |
|---|
| [56] | 682 | UInt uiSubdiv; |
|---|
| 683 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; |
|---|
| 684 | |
|---|
| 685 | if(uiTrIdx==0) |
|---|
| 686 | { |
|---|
| 687 | m_bakAbsPartIdxCU = uiAbsPartIdx; |
|---|
| 688 | } |
|---|
| 689 | if( uiLog2TrafoSize == 2 ) |
|---|
| 690 | { |
|---|
| 691 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
|---|
| 692 | if( ( uiAbsPartIdx % partNum ) == 0 ) |
|---|
| 693 | { |
|---|
| 694 | m_uiBakAbsPartIdx = uiAbsPartIdx; |
|---|
| 695 | m_uiBakChromaOffset = offsetChroma; |
|---|
| 696 | } |
|---|
| 697 | } |
|---|
| 698 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) |
|---|
| 699 | { |
|---|
| 700 | uiSubdiv = 1; |
|---|
| 701 | } |
|---|
| 702 | else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) |
|---|
| 703 | { |
|---|
| [872] | 704 | uiSubdiv = (uiLog2TrafoSize > quadtreeTULog2MinSizeInCU); |
|---|
| [56] | 705 | } |
|---|
| 706 | else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
|---|
| 707 | { |
|---|
| 708 | uiSubdiv = 1; |
|---|
| 709 | } |
|---|
| 710 | else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
|---|
| 711 | { |
|---|
| 712 | uiSubdiv = 0; |
|---|
| 713 | } |
|---|
| [872] | 714 | else if( uiLog2TrafoSize == quadtreeTULog2MinSizeInCU ) |
|---|
| [56] | 715 | { |
|---|
| 716 | uiSubdiv = 0; |
|---|
| 717 | } |
|---|
| 718 | else |
|---|
| 719 | { |
|---|
| [872] | 720 | assert( uiLog2TrafoSize > quadtreeTULog2MinSizeInCU ); |
|---|
| [608] | 721 | m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); |
|---|
| [56] | 722 | } |
|---|
| [2] | 723 | |
|---|
| [56] | 724 | const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx ); |
|---|
| [2] | 725 | { |
|---|
| [608] | 726 | const Bool bFirstCbfOfCU = uiTrDepth == 0; |
|---|
| [56] | 727 | if( bFirstCbfOfCU ) |
|---|
| [2] | 728 | { |
|---|
| [56] | 729 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
|---|
| 730 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
|---|
| [2] | 731 | } |
|---|
| [56] | 732 | if( bFirstCbfOfCU || uiLog2TrafoSize > 2 ) |
|---|
| [2] | 733 | { |
|---|
| [1179] | 734 | #if H_3D_DISABLE_CHROMA |
|---|
| 735 | if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) |
|---|
| 736 | { |
|---|
| [56] | 737 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) |
|---|
| [2] | 738 | { |
|---|
| [608] | 739 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); |
|---|
| [2] | 740 | } |
|---|
| [56] | 741 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) |
|---|
| [2] | 742 | { |
|---|
| [608] | 743 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); |
|---|
| [2] | 744 | } |
|---|
| 745 | } |
|---|
| [56] | 746 | else |
|---|
| [2] | 747 | { |
|---|
| [1179] | 748 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) |
|---|
| 749 | { |
|---|
| 750 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiTrDepth - 1 ); |
|---|
| 751 | } |
|---|
| 752 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) |
|---|
| 753 | { |
|---|
| 754 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiTrDepth - 1 ); |
|---|
| 755 | } |
|---|
| 756 | } |
|---|
| 757 | #else |
|---|
| 758 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) |
|---|
| 759 | { |
|---|
| 760 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); |
|---|
| 761 | } |
|---|
| 762 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) |
|---|
| 763 | { |
|---|
| 764 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); |
|---|
| 765 | } |
|---|
| 766 | #endif |
|---|
| 767 | } |
|---|
| 768 | else |
|---|
| 769 | { |
|---|
| [56] | 770 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
|---|
| 771 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
|---|
| [2] | 772 | } |
|---|
| 773 | } |
|---|
| 774 | |
|---|
| [56] | 775 | if( uiSubdiv ) |
|---|
| [2] | 776 | { |
|---|
| [56] | 777 | UInt size; |
|---|
| 778 | width >>= 1; |
|---|
| 779 | height >>= 1; |
|---|
| 780 | size = width*height; |
|---|
| 781 | uiTrIdx++; |
|---|
| 782 | ++uiDepth; |
|---|
| 783 | const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
|---|
| 784 | const UInt uiStartAbsPartIdx = uiAbsPartIdx; |
|---|
| 785 | UInt uiYCbf = 0; |
|---|
| 786 | UInt uiUCbf = 0; |
|---|
| 787 | UInt uiVCbf = 0; |
|---|
| 788 | |
|---|
| 789 | for( Int i = 0; i < 4; i++ ) |
|---|
| [2] | 790 | { |
|---|
| [872] | 791 | xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP, quadtreeTULog2MinSizeInCU ); |
|---|
| [608] | 792 | uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth+1 ); |
|---|
| 793 | uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth+1 ); |
|---|
| 794 | uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth+1 ); |
|---|
| [56] | 795 | uiAbsPartIdx += uiQPartNum; |
|---|
| 796 | offsetLuma += size; offsetChroma += (size>>2); |
|---|
| [2] | 797 | } |
|---|
| [56] | 798 | |
|---|
| 799 | for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) |
|---|
| 800 | { |
|---|
| [608] | 801 | pcCU->getCbf( TEXT_LUMA )[uiStartAbsPartIdx + ui] |= uiYCbf << uiTrDepth; |
|---|
| 802 | pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << uiTrDepth; |
|---|
| 803 | pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << uiTrDepth; |
|---|
| [56] | 804 | } |
|---|
| [2] | 805 | } |
|---|
| 806 | else |
|---|
| 807 | { |
|---|
| [56] | 808 | assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) ); |
|---|
| 809 | pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); |
|---|
| 810 | |
|---|
| [608] | 811 | #if !H_MV_ENC_DEC_TRAC |
|---|
| [2] | 812 | { |
|---|
| [56] | 813 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
|---|
| 814 | DTRACE_CABAC_T( "\tTrIdx: abspart=" ); |
|---|
| 815 | DTRACE_CABAC_V( uiAbsPartIdx ); |
|---|
| 816 | DTRACE_CABAC_T( "\tdepth=" ); |
|---|
| 817 | DTRACE_CABAC_V( uiDepth ); |
|---|
| 818 | DTRACE_CABAC_T( "\ttrdepth=" ); |
|---|
| 819 | DTRACE_CABAC_V( uiTrDepth ); |
|---|
| 820 | DTRACE_CABAC_T( "\n" ); |
|---|
| [2] | 821 | } |
|---|
| [608] | 822 | #endif |
|---|
| [56] | 823 | |
|---|
| 824 | pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
|---|
| 825 | 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] | 826 | { |
|---|
| [608] | 827 | pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
|---|
| [2] | 828 | } |
|---|
| [56] | 829 | else |
|---|
| [2] | 830 | { |
|---|
| [608] | 831 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth ); |
|---|
| [2] | 832 | } |
|---|
| [608] | 833 | |
|---|
| 834 | |
|---|
| [56] | 835 | // transform_unit begin |
|---|
| 836 | UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); |
|---|
| 837 | UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
|---|
| 838 | UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
|---|
| 839 | if( uiLog2TrafoSize == 2 ) |
|---|
| [2] | 840 | { |
|---|
| [56] | 841 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
|---|
| 842 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
|---|
| [2] | 843 | { |
|---|
| [56] | 844 | cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
|---|
| 845 | cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
|---|
| [2] | 846 | } |
|---|
| 847 | } |
|---|
| [56] | 848 | if ( cbfY || cbfU || cbfV ) |
|---|
| [2] | 849 | { |
|---|
| [56] | 850 | // dQP: only for LCU |
|---|
| 851 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
|---|
| [2] | 852 | { |
|---|
| [56] | 853 | if ( bCodeDQP ) |
|---|
| [2] | 854 | { |
|---|
| [56] | 855 | decodeQP( pcCU, m_bakAbsPartIdxCU); |
|---|
| 856 | bCodeDQP = false; |
|---|
| [2] | 857 | } |
|---|
| 858 | } |
|---|
| 859 | } |
|---|
| [56] | 860 | if( cbfY ) |
|---|
| [2] | 861 | { |
|---|
| [56] | 862 | Int trWidth = width; |
|---|
| 863 | Int trHeight = height; |
|---|
| 864 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); |
|---|
| [2] | 865 | } |
|---|
| [56] | 866 | if( uiLog2TrafoSize > 2 ) |
|---|
| [2] | 867 | { |
|---|
| [56] | 868 | Int trWidth = width >> 1; |
|---|
| 869 | Int trHeight = height >> 1; |
|---|
| 870 | if( cbfU ) |
|---|
| [2] | 871 | { |
|---|
| [56] | 872 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
|---|
| [2] | 873 | } |
|---|
| [56] | 874 | if( cbfV ) |
|---|
| [2] | 875 | { |
|---|
| [56] | 876 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
|---|
| [2] | 877 | } |
|---|
| 878 | } |
|---|
| 879 | else |
|---|
| 880 | { |
|---|
| [56] | 881 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
|---|
| 882 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
|---|
| [2] | 883 | { |
|---|
| [56] | 884 | Int trWidth = width; |
|---|
| 885 | Int trHeight = height; |
|---|
| 886 | if( cbfU ) |
|---|
| [2] | 887 | { |
|---|
| [56] | 888 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
|---|
| [2] | 889 | } |
|---|
| [56] | 890 | if( cbfV ) |
|---|
| [2] | 891 | { |
|---|
| [56] | 892 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
|---|
| [2] | 893 | } |
|---|
| 894 | } |
|---|
| 895 | } |
|---|
| [56] | 896 | // transform_unit end |
|---|
| [2] | 897 | } |
|---|
| 898 | } |
|---|
| 899 | |
|---|
| [56] | 900 | Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
|---|
| 901 | { |
|---|
| 902 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
|---|
| 903 | { |
|---|
| 904 | m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); |
|---|
| 905 | } |
|---|
| 906 | } |
|---|
| [2] | 907 | |
|---|
| 908 | |
|---|
| 909 | /** decode coefficients |
|---|
| 910 | * \param pcCU |
|---|
| 911 | * \param uiAbsPartIdx |
|---|
| 912 | * \param uiDepth |
|---|
| 913 | * \param uiWidth |
|---|
| 914 | * \param uiHeight |
|---|
| 915 | * \returns Void |
|---|
| 916 | */ |
|---|
| [56] | 917 | Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP ) |
|---|
| [2] | 918 | { |
|---|
| 919 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
|---|
| 920 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
|---|
| 921 | UInt uiChromaOffset = uiLumaOffset>>2; |
|---|
| [833] | 922 | #if H_3D_DIM_SDC |
|---|
| 923 | if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) ) |
|---|
| 924 | { |
|---|
| 925 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
|---|
| 926 | assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); |
|---|
| 927 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); |
|---|
| [1179] | 928 | #if H_3D_DISABLE_CHROMA |
|---|
| 929 | if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 ) |
|---|
| 930 | { |
|---|
| 931 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); |
|---|
| 932 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); |
|---|
| 933 | } |
|---|
| 934 | #else |
|---|
| [833] | 935 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); |
|---|
| 936 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); |
|---|
| [1179] | 937 | #endif |
|---|
| [833] | 938 | } |
|---|
| 939 | |
|---|
| 940 | #if H_3D_INTER_SDC |
|---|
| 941 | if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) ) |
|---|
| 942 | { |
|---|
| 943 | assert( !pcCU->isSkipped( uiAbsPartIdx ) ); |
|---|
| 944 | assert( !pcCU->isIntra( uiAbsPartIdx) ); |
|---|
| 945 | assert( pcCU->getSlice()->getIsDepth() ); |
|---|
| 946 | } |
|---|
| 947 | #endif |
|---|
| 948 | if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) ) |
|---|
| 949 | { |
|---|
| 950 | Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1; |
|---|
| 951 | UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2; |
|---|
| [2] | 952 | |
|---|
| [833] | 953 | if( !pcCU->getSDCFlag( uiAbsPartIdx ) ) |
|---|
| 954 | { |
|---|
| 955 | for( Int iPart = 0; iPart < iPartNum; iPart++ ) |
|---|
| 956 | { |
|---|
| 957 | if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE ) |
|---|
| 958 | { |
|---|
| 959 | m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ); |
|---|
| 960 | } |
|---|
| 961 | } |
|---|
| 962 | } |
|---|
| 963 | else |
|---|
| 964 | { |
|---|
| 965 | m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 966 | return; |
|---|
| 967 | } |
|---|
| 968 | } |
|---|
| [443] | 969 | #endif |
|---|
| [608] | 970 | |
|---|
| [2] | 971 | if( pcCU->isIntra(uiAbsPartIdx) ) |
|---|
| 972 | { |
|---|
| 973 | } |
|---|
| 974 | else |
|---|
| 975 | { |
|---|
| [56] | 976 | UInt uiQtRootCbf = 1; |
|---|
| 977 | if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) ) |
|---|
| 978 | { |
|---|
| [608] | 979 | m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf ); |
|---|
| [2] | 980 | } |
|---|
| [56] | 981 | if ( !uiQtRootCbf ) |
|---|
| 982 | { |
|---|
| 983 | pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth ); |
|---|
| 984 | pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); |
|---|
| 985 | return; |
|---|
| 986 | } |
|---|
| [2] | 987 | |
|---|
| 988 | } |
|---|
| [872] | 989 | |
|---|
| 990 | Int getQuadtreeTULog2MinSizeInCU = pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx); |
|---|
| 991 | |
|---|
| 992 | xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP, getQuadtreeTULog2MinSizeInCU ); |
|---|
| [608] | 993 | } |
|---|
| [189] | 994 | |
|---|
| [655] | 995 | #if H_3D_INTER_SDC |
|---|
| [833] | 996 | Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 997 | { |
|---|
| 998 | pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth ); |
|---|
| [1179] | 999 | if ( pcCU->isSkipped( uiAbsPartIdx ) ) |
|---|
| 1000 | { |
|---|
| 1001 | return; |
|---|
| 1002 | } |
|---|
| [833] | 1003 | |
|---|
| [1179] | 1004 | |
|---|
| [1124] | 1005 | if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) || |
|---|
| 1006 | ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getIntraSdcWedgeFlag() ) ) |
|---|
| [833] | 1007 | { |
|---|
| 1008 | return; |
|---|
| 1009 | } |
|---|
| 1010 | |
|---|
| 1011 | if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) ) |
|---|
| 1012 | { |
|---|
| 1013 | return; |
|---|
| 1014 | } |
|---|
| 1015 | |
|---|
| 1016 | assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) ); |
|---|
| 1017 | m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 1018 | } |
|---|
| [189] | 1019 | #endif |
|---|
| [833] | 1020 | #if H_3D_DBBP |
|---|
| 1021 | Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
|---|
| 1022 | { |
|---|
| [1179] | 1023 | if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) |
|---|
| 1024 | { |
|---|
| 1025 | m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); |
|---|
| 1026 | } |
|---|
| [833] | 1027 | } |
|---|
| 1028 | #endif |
|---|
| [189] | 1029 | |
|---|
| [56] | 1030 | //! \} |
|---|