Ignore:
Timestamp:
12 Apr 2018, 11:12:21 (7 years ago)
Author:
tech
Message:
  • Update HM-16.18
  • Cleanups
  • Encoder Extension

-- Representation formats
-- Parameter set sharing
-- GOP configuration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-16.2-dev/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1405 r1412  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    6060  m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
    6161}
    62 #if NH_3D_DIS
     62#if NH_3D
    6363Void TDecEntropy::decodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    6464{
     
    104104}
    105105
    106 #if NH_3D_ARP
     106#if NH_3D
    107107Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    108108{
     
    121121  }
    122122}
    123 #endif
    124 
    125 #if NH_3D_IC
     123
    126124Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    127125{
    128126  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    129127
    130 #if NH_3D_ARP
    131128  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
    132 #else
    133   if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
    134 #endif
    135129  {
    136130    return;
     
    165159  {
    166160    decodeIntraDirModeLuma  ( pcCU, uiAbsPartIdx, uiDepth );
    167 #if NH_3D_SDC_INTRA
     161#if NH_3D
    168162    decodeSDCFlag   ( pcCU, uiAbsPartIdx, uiDepth );
    169163#endif
     
    239233  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    240234
    241 #if NH_3D_MLC
    242 //#if H_3D_IV_MERGE
     235#if NH_3D
    243236  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    244237  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    247240  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    248241#endif
    249 #if NH_3D_SPIVMP
     242#if NH_3D
    250243  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];     
    251244  TComMvField*  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
    252245  UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
    253 #endif
    254 #if NH_3D_IV_MERGE
    255246  pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
    256247#endif
     
    262253  Bool hasMergedCandList = false;
    263254
     255#if MCTS_ENC_CHECK
     256  UInt numSpatialMergeCandidates = 0;
     257#endif
    264258  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
    265259  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
     
    296290
    297291  ////// Parse CUs extension syntax
    298 #if NH_3D_DBBP
    299292  decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
    300 #endif
    301 #if NH_3D_SDC_INTER
    302293  decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth );
    303 #endif
    304 #if NH_3D_ARP
    305   decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    306 #endif
    307 #if NH_3D_IC
    308   decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    309 #endif
     294  decodeARPW    ( pcCU, uiAbsPartIdx, uiDepth );
     295  decodeICFlag  ( pcCU, uiAbsPartIdx, uiDepth );
    310296
    311297  ////// Decode motion vectors
     
    323309#endif
    324310
    325 #if NH_3D_DBBP
    326311      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
    327 #else
    328       if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
    329 #endif
    330312      {
    331313        if ( !hasMergedCandList )
    332314        {
    333315          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
    334 
    335 #if NH_3D_MLC
    336 #if NH_3D_VSP
    337316          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    338317          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    339 #endif
    340 #if NH_3D_SPIVMP
    341318          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    342 #endif
    343319          pcSubCU->initAvailableFlags();
    344 #endif
     320#if MCTS_ENC_CHECK
     321          numSpatialMergeCandidates = 0;
     322          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates );
     323#else
    345324          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    346 #if NH_3D_MLC
    347           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    348 #if NH_3D_SPIVMP
    349             , pcMvFieldSP, puhInterDirSP
    350 #endif
    351             , numValidMergeCand );
    352           pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    353 #if NH_3D_VSP
    354             , vspFlag
    355 #endif
    356 #if NH_3D_SPIVMP
    357             , bSPIVMPFlag
    358 #endif
    359             , numValidMergeCand );
    360 #if NH_3D_VSP
     325#endif
     326
     327          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP, numValidMergeCand );
     328          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, bSPIVMPFlag, numValidMergeCand );
    361329          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    362 #endif
    363 #endif
    364330          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
    365331          hasMergedCandList = true;
     
    368334      else
    369335      {
    370 #if NH_3D_MLC
    371 #if NH_3D_VSP
    372336        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    373337        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    374 #endif
    375 #if NH_3D_SPIVMP
    376338        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    377 #endif
    378339        pcSubCU->initAvailableFlags();
    379 #endif
     340#if MCTS_ENC_CHECK
     341        numSpatialMergeCandidates = 0;
     342        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates, uiMergeIndex );
     343#else
    380344        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    381 #if NH_3D_MLC
    382         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
    383 #if NH_3D_SPIVMP
    384           , pcMvFieldSP, puhInterDirSP
    385 #endif
    386           ,numValidMergeCand, uiMergeIndex );
    387         pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    388 #if NH_3D_VSP
    389           , vspFlag
    390 #endif
    391 #if NH_3D_SPIVMP
    392           , bSPIVMPFlag
    393 #endif
    394           ,numValidMergeCand );
    395 #if NH_3D_VSP
     345#endif
     346        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP ,numValidMergeCand, uiMergeIndex );
     347        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours , vspFlag, bSPIVMPFlag ,numValidMergeCand );
    396348        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    397 #endif
    398 #endif
    399349      }
    400350      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     
    409359          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    410360          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    411 #if NH_3D_VSP
    412 #if NH_3D_DBBP
    413361          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
    414 #else
    415           if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
    416 #endif
    417362          {
    418363            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
     
    426371            }
    427372          }
    428 #endif
    429         }
    430       }
    431 #if NH_3D_SPIVMP
     373        }
     374      }
    432375      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
    433376      if (bSPIVMPFlag[uiMergeIndex] != 0)
     
    451394        }
    452395      }
    453 #endif
    454396    }
    455397    else
     
    481423    }
    482424  }
     425
     426  delete[] pcMvFieldSP;
     427  delete[] puhInterDirSP;
     428
    483429#else
    484430  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
     
    501447      }
    502448#endif
    503 #if NH_3D_IC
    504       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    505 #endif
    506 
    507449      const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    508450      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
     
    512454          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
    513455
    514 #if NH_3D_MLC
    515 #if NH_3D_VSP
    516           Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    517           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    518 #endif
    519 #if NH_3D_SPIVMP
    520           memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    521 #endif
    522           pcSubCU->initAvailableFlags();
    523 #endif
     456#if MCTS_ENC_CHECK
     457          numSpatialMergeCandidates = 0;
     458          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates );
     459#else
    524460          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    525 #if NH_3D_MLC
    526           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    527 #if NH_3D_SPIVMP
    528             , pcMvFieldSP, puhInterDirSP
    529 #endif
    530             , numValidMergeCand );
    531           pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    532 #if NH_3D_VSP
    533             , vspFlag
    534 #endif
    535 #if NH_3D_SPIVMP
    536             , bSPIVMPFlag
    537 #endif
    538             , numValidMergeCand );
    539 #if NH_3D_VSP
    540           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    541 #endif
    542461#endif
    543462          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
     
    547466      else
    548467      {
    549 
    550 #if NH_3D_MLC
    551 #if NH_3D_VSP
    552         Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    553         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    554 #endif
    555 #if NH_3D_SPIVMP
    556         memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    557 #endif
    558         pcSubCU->initAvailableFlags();
    559 #endif
     468#if MCTS_ENC_CHECK
     469        numSpatialMergeCandidates = 0;
     470        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates, uiMergeIndex );
     471#else
     472
    560473        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    561 #if NH_3D_MLC
    562         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
    563 #if NH_3D_SPIVMP
    564           , pcMvFieldSP, puhInterDirSP
    565 #endif
    566           ,numValidMergeCand, uiMergeIndex );
    567         pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    568 #if NH_3D_VSP
    569           , vspFlag
    570 #endif
    571 #if NH_3D_SPIVMP
    572           , bSPIVMPFlag
    573 #endif
    574           ,numValidMergeCand );
    575 #if NH_3D_VSP
    576         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    577 #endif
    578 #endif
    579       }
    580 
     474#endif
     475      }
     476#if MCTS_ENC_CHECK
     477      if (m_pConformanceCheck->getTMctsCheck() &&  pcSubCU->isLastColumnCTUInTile() && (uiMergeIndex >= numSpatialMergeCandidates) )
     478      {
     479        m_pConformanceCheck->flagTMctsError("Merge Index using non-spatial merge candidate (Merge)");
     480      }
     481
     482#endif
    581483      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    582484
     
    590492          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    591493          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    592 #if NH_3D_VSP
    593           if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
    594           {
    595             if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
    596             {
    597               UInt dummy;
    598               Int vspSize;
    599               Int width, height;
    600               pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
    601               pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
    602               pcCU->setVSPFlag( uiSubPartIdx, vspSize );
    603             }
    604           }
    605 #endif
    606         }
    607       }
    608 #if NH_3D_SPIVMP
    609       pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
    610       if (bSPIVMPFlag[uiMergeIndex] != 0)
    611       {
    612         Int iWidth, iHeight;
    613         UInt uiIdx;
    614         pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
    615 
    616         UInt uiSPAddr;
    617 
    618         Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
    619 
    620         pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
    621 
    622         for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
    623         {
    624           pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
    625           pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
    626           pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
    627           pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
    628         }
    629       }
    630 #endif
     494        }
     495      }
    631496    }
    632497    else
     
    652517        }
    653518      }
    654 #if NH_3D_IC
    655       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    656 #endif
    657519    }
    658520
     
    664526    }
    665527  }
    666 #endif
    667 #if NH_3D_SPIVMP
    668   delete[] pcMvFieldSP;
    669   delete[] puhInterDirSP;
    670528#endif
    671529  return;
     
    812670  }
    813671  pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo);
     672#if MCTS_ENC_CHECK
     673  if ((iRefIdx >= 0) && m_pConformanceCheck->getTMctsCheck() && pcSubCU->isLastColumnCTUInTile() && (iMVPIdx == pAMVPInfo->numSpatialMVPCandidates))
     674  {
     675    m_pConformanceCheck->flagTMctsError("Merge Index using non-spatial merge candidate (AMVP)");
     676  }
     677#endif
     678
    814679  pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth);
    815680  pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth );
     
    1085950Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool& bCodeDQP, Bool& isChromaQpAdjCoded )
    1086951{
    1087 #if NH_3D_SDC_INTRA
     952#if NH_3D
    1088953  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )
    1089954  {
     
    1092957    assert( pcCU->getCbf(uiAbsPartIdx, COMPONENT_Y) == 1 );
    1093958}
    1094 #endif
    1095 #if NH_3D_SDC_INTER
    1096959  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) )
    1097960  {
     
    1100963    assert( pcCU->getSlice()->getIsDepth() );
    1101964  }
    1102 #endif
    1103 #if NH_3D
    1104965  if( pcCU->getSlice()->getIsDepth() )
    1105966  {
    1106 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    1107967    if( pcCU->getSDCFlag( uiAbsPartIdx ) )
    1108968    {
     
    1110970      return;
    1111971    }
    1112 #endif
    1113 #if NH_3D_DMM
    1114972    if( pcCU->isIntra( uiAbsPartIdx ) )
    1115973    {
     
    1124982      }
    1125983    }
    1126 #endif
    1127984  }
    1128985#endif
     
    11621019}
    11631020
    1164 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     1021#if NH_3D
    11651022Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    11661023{
     
    11861043  m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
    11871044}
    1188 #endif
    1189 #if NH_3D_DBBP
     1045
    11901046Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    11911047{
Note: See TracChangeset for help on using the changeset viewer.