Skip to content
Snippets Groups Projects
InterPrediction.cpp 37.4 KiB
Newer Older
  • Learn to ignore specific revisions
  •       const Pel* pSrcY1 = m_filteredBlockTmp[3][COMPONENT_Y] + 2 * src1Stride + 2;
    
          bool bioEnabled = xCalcBiPredSubBlkDist(pu, pSrcY0, src0Stride, pSrcY1, src1Stride, clipBitDepths);
          if (bioEnabled)
          {
            applyBiOptFlow(pu, pcYuvSrc0, pcYuvSrc1, iRefIdx0, iRefIdx1, pcYuvDst, clipBitDepths);
          }
          else
          {
            pcYuvDst.bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]);
          }
        }
    
        pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied);
    
        pcYuvDst.addAvg( pcYuvSrc0, pcYuvSrc1, clpRngs );
    
      }
      else if( iRefIdx0 >= 0 && iRefIdx1 < 0 )
      {
        pcYuvDst.copyClip( pcYuvSrc0, clpRngs );
      }
      else if( iRefIdx0 < 0 && iRefIdx1 >= 0 )
      {
        pcYuvDst.copyClip( pcYuvSrc1, clpRngs );
      }
    }
    
    
    void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList 
    )
    
    {
            CodingStructure &cs = *pu.cs;
      const PPS &pps            = *cs.pps;
      const SliceType sliceType =  cs.slice->getSliceType();
    
      if( eRefPicList != REF_PIC_LIST_X )
      {
        if( ( ( sliceType == P_SLICE && pps.getUseWP() ) || ( sliceType == B_SLICE && pps.getWPBiPred() ) ) )
        {
          xPredInterUni         ( pu,          eRefPicList, predBuf, true );
          xWeightedPredictionUni( pu, predBuf, eRefPicList, predBuf, -1, m_maxCompIDToPred );
        }
        else
        {
          xPredInterUni( pu, eRefPicList, predBuf, false );
        }
      }
      else
      {
        if( pu.mergeType != MRG_TYPE_DEFAULT_N )
        {
          xSubPuMC( pu, predBuf, eRefPicList );
        }
        else if( xCheckIdenticalMotion( pu ) )
        {
          xPredInterUni( pu, REF_PIC_LIST_0, predBuf, false );
        }
        else
        {
          xPredInterBi( pu, predBuf );
        }
      }
      return;
    }
    
    
    void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRefPicList 
    )
    
    {
      for( auto &pu : CU::traversePUs( cu ) )
      {
        PelUnitBuf predBuf = cu.cs->getPredBuf( pu );
        motionCompensation( pu, predBuf, eRefPicList );
      }
    }
    
    
    void InterPrediction::motionCompensation( PredictionUnit &pu, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/ 
    )
    
      motionCompensation( pu, predBuf, eRefPicList 
      );
    
    #if JVET_L0256_BIO
    int InterPrediction::rightShiftMSB(int numer, int denom)
    {
      int     d;
      int msbIdx = 0;
      for (msbIdx = 0; msbIdx<32; msbIdx++)
      {
        if (denom < ((int)1 << msbIdx))
        {
          break;
        }
      }
    
      int shiftIdx = msbIdx - 1;
      d = (numer >> shiftIdx);
    
    
    #if JVET_J0090_MEMORY_BANDWITH_MEASURE
    void InterPrediction::cacheAssign( CacheModel *cache )
    {
      m_cacheModel = cache;
      m_if.cacheAssign( cache );
      m_if.initInterpolationFilter( !cache->isCacheEnable() );
    }
    #endif
    
    //! \}