Ignore:
Timestamp:
13 Feb 2014, 22:58:51 (10 years ago)
Author:
tech
Message:

Integrated following MV-HEVC HLS 7 items:

H_MV_HLS7_GEN Stub for further integrations (not tested)
H_MV_HLS_7_OUTPUT_LAYERS_5_10_22_27
Output layer sets, various

(VPS/P0300/alt output layer flag) #27 Change alt output layer flag to be signalled within the loop of output layer sets, from JCTVC-P0300-v2. Decision: Adopt.
(VPS/P0156/Num of output_layer_flag) #10 Proposal 3: The output_layer_flag[ i ][ j ] is signalled for j equal to 0 to NumLayersInIdList[ lsIdx ] inclusive. It was remarked that we might be able to just assume that the top layer is always output; however, this was not entirely clear , so the safe thing to do may be to also send the flag for this layer.
(VPS/P0295/Default output layer sets) #5 Discussion from (P0110). Decision: Three-state approach (text in P0295, decoder shall allow 3 to be present and shall treat 3 the same as the value 2).

H_MV_HLS_7_HRD_P0156_7 (HRD/P0156/MaxSubLayersInLayerSetMinus1) #7 Proposal 1: signal, in the VPS extension, the DPB parameters for an output layer set for sub-DPBs only up to the maximum temporal sub-layers in the corresponding layer set
H_MV_HLS_7_VPS_P0048_14
(VPS/P0048/profile_ref_minus1 rem) #14 Remove profile_ref_minus1 from the VPS extension, from JCTVC-P0048
H_MV_HLS_7_VPS_P0076_15 (VPS/P0076/video signal info move) #15 Move video signal information syntax structure earlier in the VPS VUI.
H_MV_HLS_7_SPS_P0155_16_32
(SPS/P0155/sps_sub_layer_ordering_info) #16, #32 Not signal the sps_max_num_reorder_pics[], sps_max_latency_increase_plus1[], and sps_max_dec_pic_buffering_minus1[] syntax elements in the SPS when nuh_layer_id > 0.
H_MV_HLS_7_GEN_P0166_PPS_EXTENSION (GEN/P0166/pps_extension) #17 Add PPS extension type flags for conditional presence of syntax extensions per extension type, aligned with the SPS extension type flags, from JCTVC-P0166. Further align the SPS extension type flags syntax between RExt and MV-HEVC/SHVC
H_MV_HLS_7_FIX_SET_DPB_SIZE
Fix derivation dpb size parameters
H_MV_HLS_7_RESERVED_FLAGS Added flags

(SPS/P0312/SHVC reserved flag) The flag will be used for the syntax vert_phase_position_enable_flag in SHVC draft
(VPS/O0215/SHVC reserved flag): this flag will be used for the syntax cross_layer_phase_alignment_flag in SHVC draft.
(VPS VUI/O0199,P0312/SHVC reserved flags) the 3 reserved bits will be used for the syntaxes single_layer_for_non_irap_flag, higher_layer_irap_skip_flag and vert_phase_position_not_in_use_flag in SHVC draft.

H_MV_FIX_VPS_LAYER_ID_NOT_EQUAL_ZERO Discard VPS with nuh_layer_Id > 0
H_MV_HLS_7_MISC_P0130_EOS
(MISC/P0130/EOS NAL layer id) #19 Require that end of bitstream NAL unit shall have nuh_layer_id equal to 0, from JCTVC-P0130. Decoders shall allow an end of bitstream NAL unit with nuh_layer_id > 0 to be present, and shall ignore the NAL unit.
H_MV_HLS_7_MISC_P0182_13 (MISC/P0182/BL PS Compatibility flag) #13 Define the flag (in VPS VUI) with the proposed semantics, without specifying an associated extraction process. Editors to select the position in the VPS VUI.
H_MV_HLS_7_MISC_P0068_21
(MISC/P0068/all irap idr flag) #21 Add flag in VUI to indicate that all IRAP pictures are IDRs and that all layer pictures in an AU are IDR aligned, from JCTVC-P0068 proposal 1.
H_MV_HLS_7_FIX_INFER_CROSS_LAYER_IRAP_ALIGNED_FLAG Fix inference of cross_layer_irap_aligned_flag
H_MV_HLS_7_MISC_P0079_18
(MISC/P0079/NumActiveRefLayerPics) #18 Modification of derivation of variable NumActiveRefLayerPics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r852 r854  
    4040#include "TEncCu.h"
    4141#include "TEncAnalyze.h"
     42
    4243#include <cmath>
    4344#include <algorithm>
     
    421422  // get Original YUV data from picture
    422423  m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() );
    423  
     424
    424425#if H_3D_QTLPC 
    425426  Bool    bTrySplit     = true;
     
    11981199        if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    11991200        {
    1200           if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer
    1201           {
    1202             m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
    1203           }
    1204           else
    1205           {
    1206             m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);
    1207           }
     1201            if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer
     1202            {
     1203              m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
     1204            }
     1205            else
     1206            {
     1207              m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);
     1208            }
    12081209
    12091210#if AMP_ENC_SPEEDUP
     
    12361237
    12371238        rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits
    1238         rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    1239       }
     1239          rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
     1240        }
    12401241#if H_3D_VSO // M10
    12411242      if ( m_pcRdCost->getUseVSO() )
     
    12431244      else
    12441245#endif
    1245         rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     1246      rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    12461247
    12471248      if( (g_uiMaxCUWidth>>uiDepth) == rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() && rpcTempCU->getSlice()->getPPS()->getUseDQP())
     
    12511252        {
    12521253          if( ( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(uiBlkIdx+rpcTempCU->getZorderIdxInCU()) == rpcTempCU->getSlice()->getSliceSegmentCurStartCUAddr() ) &&
    1253             ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) )
     1254              ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) )
    12541255          {
    12551256            hasResidual = true;
     
    12731274          m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false );
    12741275          rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits
    1275           rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
     1276            rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    12761277#if H_3D_VSO // M11
    12771278          if ( m_pcRdCost->getUseLambdaScaleVSO())         
     
    12791280          else
    12801281#endif
    1281             rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     1282          rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    12821283#endif
    12831284
     
    12921293      }
    12931294
    1294       m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
     1295        m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    12951296      Bool isEndOfSlice        = rpcBestCU->getSlice()->getSliceMode()==FIXED_NUMBER_OF_BYTES
    1296         && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3);
     1297                                 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3);
    12971298      Bool isEndOfSliceSegment = rpcBestCU->getSlice()->getSliceSegmentMode()==FIXED_NUMBER_OF_BYTES
    1298         && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3);
     1299                                 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3);
    12991300      if(isEndOfSlice||isEndOfSliceSegment)
    13001301      {
     
    13031304      xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth);                                  // RD compare current larger prediction
    13041305    }                                                                                  // with sub partitioned prediction.
    1305   }
     1306    }
    13061307
    13071308#if H_3D_VSO // M12
     
    17861787#endif
    17871788#if H_3D_ARP
    1788   for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
    1789 #else
    1790   for( UInt ui = 0; ui < numValidMergeCand; ++ui )
     1789for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
     1790#else
     1791for( UInt ui = 0; ui < numValidMergeCand; ++ui )
    17911792#endif
    17921793  {
     
    18611862#endif
    18621863
    1863     for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
    1864     {
    1865       for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
    1866       {     
     1864  for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
     1865  {
     1866    for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
     1867    {     
    18671868#if H_3D_IC
    18681869        if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )
     
    18761877        if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1))
    18771878        {
    1878           if( !(bestIsSkip && uiNoResidual == 0) )
     1879        if( !(bestIsSkip && uiNoResidual == 0) )
     1880        {
     1881          // set MC parameters
     1882          rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level
     1883          rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag,     0, uhDepth );
     1884          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
     1885#if H_3D_IC
     1886          rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );
     1887#endif
     1888#if H_3D_ARP
     1889          rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     1890#endif
     1891          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
     1892          rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
     1893#if H_3D_VSP
     1894          rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
     1895          rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
     1896#endif
     1897#if MTK_DDD_G0063
     1898          if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )
    18791899          {
    1880             // set MC parameters
    1881             rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level
    1882             rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag,     0, uhDepth );
    1883             rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    1884 #if H_3D_IC
    1885             rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );
    1886 #endif
    1887 #if H_3D_ARP
    1888             rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
    1889 #endif
    1890             rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
    1891             rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
    1892 #if H_3D_VSP
    1893             rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
    1894             rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
    1895 #endif
    1896 #if MTK_DDD_G0063
    1897             if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )
    1898             {
    18991900              rpcTempCU->setUseDDD( true, 0, 0, uhDepth );
    19001901              rpcTempCU->setDDDepthSubParts( ucDDDepth, 0, 0, uhDepth );
     1902          }
     1903          else
     1904          {
     1905              rpcTempCU->setUseDDD( false, 0, 0, uhDepth );
     1906          }
     1907#endif
     1908#if H_3D_SPIVMP
     1909          rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);
     1910          if (bSPIVMPFlag[uiMergeCand])
     1911          {
     1912            UInt uiSPAddr;
     1913            Int iWidth = rpcTempCU->getWidth(0);
     1914            Int iHeight = rpcTempCU->getHeight(0);
     1915            Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     1916            rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     1917            for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
     1918            {
     1919              rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
     1920              rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
     1921              rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
     1922              rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
     1923            }
     1924          }
     1925          else
     1926#endif
     1927#if NTT_STORE_SPDV_VSP_G0148
     1928            {
     1929          if ( vspFlag[uiMergeCand] )
     1930          {
     1931            UInt partAddr;
     1932            Int vspSize;
     1933            Int width, height;
     1934            rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );
     1935            if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )
     1936            {
     1937              rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );
     1938              rpcTempCU->setVSPFlag( partAddr, vspSize );
    19011939            }
    19021940            else
    19031941            {
    1904               rpcTempCU->setUseDDD( false, 0, 0, uhDepth );
     1942              rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    19051943            }
    1906 #endif
    1907 #if H_3D_SPIVMP
    1908             rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);
    1909             if (bSPIVMPFlag[uiMergeCand])
     1944            if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )
    19101945            {
    1911               UInt uiSPAddr;
    1912               Int iWidth = rpcTempCU->getWidth(0);
    1913               Int iHeight = rpcTempCU->getHeight(0);
    1914               Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
    1915               rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
    1916               for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
    1917               {
    1918                 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
    1919                 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
    1920                 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
    1921                 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
    1922               }
     1946              rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );
     1947              rpcTempCU->setVSPFlag( partAddr, vspSize );
    19231948            }
    19241949            else
    1925 #endif
     1950            {
     1951              rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     1952            }
     1953            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
     1954          }
     1955          else
     1956          {
     1957#endif
     1958            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
     1959            rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     1960            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    19261961#if NTT_STORE_SPDV_VSP_G0148
     1962          }
     1963        }
     1964#endif
     1965       // do MC
     1966       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     1967       // estimate residual and encode everything
     1968#if H_3D_VSO //M2
     1969       if( m_pcRdCost->getUseRenModel() )
     1970       { //Reset
     1971         UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     1972         UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     1973         Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     1974         UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     1975         m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1976       }
     1977#endif
     1978       m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
     1979         m_ppcOrigYuv    [uhDepth],
     1980         m_ppcPredYuvTemp[uhDepth],
     1981         m_ppcResiYuvTemp[uhDepth],
     1982         m_ppcResiYuvBest[uhDepth],
     1983         m_ppcRecoYuvTemp[uhDepth],
     1984         (uiNoResidual? true:false));
     1985
     1986
     1987          if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )
     1988         {
     1989            // If no residual when allowing for one, then set mark to not try case where residual is forced to 0
     1990           mergeCandBuffer[uiMergeCand] = 1;
     1991         }
     1992
     1993          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     1994#if NTT_STORE_SPDV_VSP_G0148 // possible bug fix
     1995          if( rpcTempCU->getSkipFlag(0) )
     1996          {
     1997            rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
     1998          }
     1999#endif
     2000#if H_3D_INTER_SDC
     2001          TComDataCU *rpcTempCUPre = rpcTempCU;
     2002#endif
     2003          Int orgQP = rpcTempCU->getQP( 0 );
     2004          xCheckDQP( rpcTempCU );
     2005          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2006#if H_3D_INTER_SDC
     2007          if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
     2008          {
     2009#if SEC_INTER_SDC_G0101
     2010            for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
    19272011            {
    1928               if ( vspFlag[uiMergeCand] )
    1929               {
    1930                 UInt partAddr;
    1931                 Int vspSize;
    1932                 Int width, height;
    1933                 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );
    1934                 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )
    1935                 {
    1936                   rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );
    1937                   rpcTempCU->setVSPFlag( partAddr, vspSize );
    1938                 }
    1939                 else
    1940                 {
    1941                   rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1942                 }
    1943                 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )
    1944                 {
    1945                   rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );
    1946                   rpcTempCU->setVSPFlag( partAddr, vspSize );
    1947                 }
    1948                 else
    1949                 {
    1950                   rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1951                 }
    1952                 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    1953               }
    1954               else
    1955               {
    1956 #endif
    1957                 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    1958                 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1959                 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1960 #if NTT_STORE_SPDV_VSP_G0148
    1961               }
    1962             }
    1963 #endif
    1964             // do MC
    1965             m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    1966             // estimate residual and encode everything
    1967 #if H_3D_VSO //M2
    1968             if( m_pcRdCost->getUseRenModel() )
    1969             { //Reset
    1970               UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
    1971               UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
    1972               Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
    1973               UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
    1974               m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
    1975             }
    1976 #endif
    1977             m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
    1978               m_ppcOrigYuv    [uhDepth],
    1979               m_ppcPredYuvTemp[uhDepth],
    1980               m_ppcResiYuvTemp[uhDepth],
    1981               m_ppcResiYuvBest[uhDepth],
    1982               m_ppcRecoYuvTemp[uhDepth],
    1983               (uiNoResidual? true:false));
    1984 
    1985 
    1986             if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )
    1987             {
    1988               // If no residual when allowing for one, then set mark to not try case where residual is forced to 0
    1989               mergeCandBuffer[uiMergeCand] = 1;
    1990             }
    1991 
    1992             rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
    1993 #if NTT_STORE_SPDV_VSP_G0148 // possible bug fix
    1994             if( rpcTempCU->getSkipFlag(0) )
    1995             {
    1996               rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
    1997             }
    1998 #endif
    1999 #if H_3D_INTER_SDC
    2000             TComDataCU *rpcTempCUPre = rpcTempCU;
    2001 #endif
    2002             Int orgQP = rpcTempCU->getQP( 0 );
    2003             xCheckDQP( rpcTempCU );
    2004             xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    2005 #if H_3D_INTER_SDC
    2006             if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
    2007             {
    2008 #if SEC_INTER_SDC_G0101
    2009               for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
    2010               {
    2011                 if( rpcTempCU != rpcTempCUPre )
    2012                 {
    2013                   rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag  );
    2014                   rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
    2015                 }
    2016                 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
    2017                 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
    2018                 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
    2019 #if H_3D_VSO //M2
    2020                 if( m_pcRdCost->getUseRenModel() )
    2021                 { //Reset
    2022                   UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
    2023                   UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
    2024                   Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
    2025                   UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
    2026                   m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
    2027                 }
    2028 #endif
    2029                 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
    2030                   m_ppcOrigYuv[uhDepth],
    2031                   ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
    2032                   m_ppcResiYuvTemp[uhDepth],
    2033                   m_ppcRecoYuvTemp[uhDepth],
    2034                   uiOffest,
    2035                   uhDepth );
    2036 
    2037                 xCheckDQP( rpcTempCU );
    2038                 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
    2039               }
    2040 #else
    20412012              if( rpcTempCU != rpcTempCUPre )
    20422013              {
     
    20612032                ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
    20622033                m_ppcResiYuvTemp[uhDepth],
    2063                 m_ppcRecoYuvTemp[uhDepth],
     2034                m_ppcRecoYuvTemp[uhDepth],
     2035                uiOffest,
    20642036                uhDepth );
    20652037
    20662038              xCheckDQP( rpcTempCU );
    20672039              xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
    2068 #endif
    20692040            }
    2070 #endif
    2071             rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );
    2072 
    2073             if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
     2041#else
     2042            if( rpcTempCU != rpcTempCUPre )
    20742043            {
     2044              rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag  );
     2045              rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2046            }
     2047            rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2048            rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2049            rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2050#if H_3D_VSO //M2
     2051            if( m_pcRdCost->getUseRenModel() )
     2052            { //Reset
     2053              UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     2054              UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     2055              Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     2056              UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     2057              m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2058            }
     2059#endif
     2060            m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2061              m_ppcOrigYuv[uhDepth],
     2062              ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2063              m_ppcResiYuvTemp[uhDepth],
     2064              m_ppcRecoYuvTemp[uhDepth],
     2065              uhDepth );
     2066
     2067            xCheckDQP( rpcTempCU );
     2068            xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2069#endif
     2070          }
     2071#endif
     2072          rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );
     2073
     2074      if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
     2075      {
    20752076#if H_3D_INTER_SDC
    2076               if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )
    2077               {
    2078                 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );
    2079               }
    2080               else
    2081               {
    2082 #endif
    2083                 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
     2077        if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )
     2078        {
     2079          bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );
     2080        }
     2081        else
     2082        {
     2083#endif
     2084        bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
    20842085#if H_3D_INTER_SDC
    2085               }
    2086 #endif
    2087             }
     2086        }
     2087#endif
     2088      }
     2089    }
     2090   }
     2091  }
     2092
     2093  if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection())
     2094  {
     2095    if(rpcBestCU->getQtRootCbf( 0 ) == 0)
     2096    {
     2097      if( rpcBestCU->getMergeFlag( 0 ))
     2098      {
     2099        *earlyDetectionSkipMode = true;
     2100      }
     2101      else
     2102      {
     2103        Int absoulte_MV=0;
     2104        for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     2105        {
     2106          if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
     2107          {
     2108            TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx ));
     2109            Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor();
     2110            Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer();
     2111            absoulte_MV+=iHor+iVer;
    20882112          }
    20892113        }
    2090       }
    2091 
    2092       if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection())
    2093       {
    2094         if(rpcBestCU->getQtRootCbf( 0 ) == 0)
     2114
     2115        if(absoulte_MV == 0)
    20952116        {
    2096           if( rpcBestCU->getMergeFlag( 0 ))
    2097           {
    2098             *earlyDetectionSkipMode = true;
    2099           }
    2100           else
    2101           {
    2102             Int absoulte_MV=0;
    2103             for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
    2104             {
    2105               if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
    2106               {
    2107                 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx ));
    2108                 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor();
    2109                 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer();
    2110                 absoulte_MV+=iHor+iVer;
    2111               }
    2112             }
    2113 
    2114             if(absoulte_MV == 0)
    2115             {
    2116               *earlyDetectionSkipMode = true;
    2117             }
    2118           }
     2117          *earlyDetectionSkipMode = true;
    21192118        }
    21202119      }
    21212120    }
     2121  }
     2122 }
    21222123#if H_3D_SPIVMP
    2123     delete[] pcMvFieldSP;
    2124     delete[] puhInterDirSP;
     2124 delete[] pcMvFieldSP;
     2125 delete[] puhInterDirSP;
    21252126#endif
    21262127#if H_3D_ARP
    2127   }
     2128 }
    21282129#endif
    21292130}
Note: See TracChangeset for help on using the changeset viewer.