Cross Component Prediction

本文详细介绍了HEVCRangeExtension标准中的CCP技术,这是一种基于线性模型的色度分量预测优化方法,旨在减少颜色分量残差信号间的数据相关性。文章探讨了CCP在不同采样空间的应用,尤其是在4:4:4格式视频中的实施细节,并讨论了LM模式下预测值的计算方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • HEVC CCP回顾
    • CCP是HEVC Range Extension标准中的技术,是基于线性模型 (Linear Mode, LM)的色度分量预测优化技术,其目的是降低颜色分量残差信号之间的数据相关性,且该技术仅作用于采样空间为 4:4:4的视频序列。
    • RGB 颜色空间的视频序列,其颜色分量之间存在大量的数据冗余,一般通过将其转换为 YCbCr 颜色空间。但是,转换后的颜色分量之间仍存在一定的数据相关性。因此,一种基于线性模型的色度分量预测优化技术在 JCT-VC 会议中被提出。在该线性模型中,实际预测值 y 的计算方式为,y = a * x + b,其中, x 为根据预测得到的色度分量原始预测值, a、b为线性模型的参数, 且a为权重,b为预测偏移值。
    • 参考文献:
      A. Khairat, T. Nguyen, M. Siekmann, D. Marpe, and T. Wiegand, Adaptive Cross-Component Prediction for 4:4:4 High Efficiency Video Coding, IEEE International Conference on Image Processing (ICIP 2014), Paris, Oct 27-30, 2014.
      T. Nguyen, A. Khairat, D. Marpe, M. Siekmann, and T. Wiegand, Extended Cross-Component Prediction in HEVC, Picture Coding Symposium, Cairns, Australia, 2015, pp. 164–168.
      Cross-Component Prediction in HEVC Range Extensions与该paper对应的中文博客:HEVC帧内/帧间预测:Cross-Component Prediction (CCP)

  • JVET中的CCP
    • 扩展到Cr的预测由预测原始值与Cb的重构残差值预测得到(HEVC中都是chroma由Luma预测得到):predCr = predCr + a * resiCb
    • chroma intra prediction mode增加了一种LM模式,用于从下采样的luma recontruct值来计算chroma分量的预测值:predC = a * recL + b

  • JEM中代码实现

    • 详见宏COM16_C806_LMCHROMA
    • 采样空间限制
      //仅对420格式使用 
      if (m_chromaFormatIDC != CHROMA_420)
      {
      if (m_useLMChroma)
      {
      printf("LMChroma must be off for non-420 chroma format input\n");
      m_useLMChroma = false;
      }
      }
    • 增加一种chroma预测的方式,即planar,dc,ver, hor + LM + DM,由5种扩展成6种
    • SPS增加cross_component_prediction_enabled_flag
    • 关键函数 xIntraCodingTUBlock
      //chroma is LM, then use downsampled luma & LM parameter for predictor 
      //if not use LM, and the component is Cr, and LM parameter a < 0, then use Cb resi & LM paramter for predictor
      #if COM16_C806_LMCHROMA
      if( uiChFinalMode == LM_CHROMA_IDX )
      {
      //get downsampled luma recontructed values
      getLumaRecPixels( rTu, uiWidth, uiHeight );
      predLMIntraChroma( rTu, compID, piPred, uiStride, uiWidth, uiHeight );
      }
      else
      {
      #endif
      predIntraAng( compID, uiChFinalMode, piOrg, uiStride, piPred, uiStride, rTu, bUseFilteredPredictions );
      #if COM16_C806_LMCHROMA
      if( compID == COMPONENT_Cr && pcCU->getSlice()->getSPS()->getUseLMChroma() )
      {
      addCrossColorResi( rTu, compID, piPred, uiStride, uiWidth, uiHeight, pcResiYuv->getAddr( COMPONENT_Cb, uiAbsPartIdx ), pcResiYuv->getStride(COMPONENT_Cb) );
      }
      }
      #endif
    • LM参数的计算方式,见函数xGetLMParameters
      //pred chroma from luma, in predLMIntraChroma() 
      if (iPredType == 0) //chroma from luma
      {
      iSrcStride = m_iLumaRecStride;
      pSrcColor0 = m_pLumaRecBuffer + iSrcStride + 1;
      pCurChroma0 = m_piYuvExt[compID][PRED_BUF_UNFILTERED];
      iCurStride = 2 * uiWidth+ 1;
      pCurChroma0 += iCurStride + 1;
      }
      else
      //pred cr from cb, in addCrossColorResi
      {
      assert (compID == COMPONENT_Cr);
      // pSrcColor0 = pcPattern->getAdiCbBuf( uiWidth, uiHeight, getPredicBuf() );
      pSrcColor0 = m_piYuvExt[COMPONENT_Cb][PRED_BUF_UNFILTERED];
      pCurChroma0 = m_piYuvExt[COMPONENT_Cr][PRED_BUF_UNFILTERED];
      // pCurChroma0 = pcPattern->getAdiCrBuf( uiWidth, uiHeight, getPredicBuf() );
      iSrcStride = 2 * uiWidth+ 1;
      iCurStride = 2 * uiWidth+ 1;
      pSrcColor0 += iSrcStride + 1;
      pCurChroma0 += iCurStride + 1;
      }
      Int x = 0, y = 0, xx = 0, xy = 0;
      Int i, j;
      Int iCountShift = 0;
      UInt uiInternalBitDepth = sps.getBitDepth(CHANNEL_TYPE_CHROMA);

    Pel *pSrc = pSrcColor0 - iSrcStride;
    Pel *pCur = pCurChroma0 - iCurStride;
    //calculate sum of src, cur, src* src, src*cur
    if (bAboveAvaillable)
    {
    for( j = 0; j < uiWidth; j++ )
    {
    x += pSrc[j];
    y += pCur[j];
    xx += pSrc[j] * pSrc[j];
    xy += pSrc[j] * pCur[j];
    }
    }

    if (bLeftAvaillable)
    {
    pSrc = pSrcColor0 - 1;
    pCur = pCurChroma0 - 1;

    for( i = 0; i < uiHeight; i++ )
    {
    x += pSrc[0];
    y += pCur[0];
    xx += pSrc[0] * pSrc[0];
    xy += pSrc[0] * pCur[0];

    pSrc += iSrcStride;
    pCur += iCurStride;
    }
    }

    if (bLeftAvaillable && bAboveAvaillable)
    {
    iCountShift = g_aucConvertToBit[ uiWidth ] + 3;
    }
    else if (bLeftAvaillable || bAboveAvaillable)
    {
    iCountShift = g_aucConvertToBit[ uiWidth ] + 2;
    }
    else
    {
    a = 0;
    if (iPredType == 0)
    {
    b = 1 << (uiInternalBitDepth - 1);
    }
    else
    {
    b = 0;
    }
    iShift = 0;
    return;
    }

    Int iTempShift = uiInternalBitDepth + iCountShift - 15;

    if( iTempShift > 0 )
    {
    x = ( x + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    y = ( y + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    iCountShift -= iTempShift;
    }

    // LLS parameters estimation –>
    xCalcLMParameters( x, y, xx, xy, iCountShift, iPredType, uiInternalBitDepth, a, b, iShift );

    • lambda设置,见宏COM16_C806_CR_FROM_CB_LAMBDA_ADJUSTMENT
       //cb lambda * 15/16, cr lambda *16/15 
      if ( uiChFinalMode != LM_CHROMA_IDX && pcCU->getSlice()->getSPS()->getUseLMChroma() )
      {
      if (compID == COMPONENT_Cb)
      {
      m_pcTrQuant->setLambda ( m_pcTrQuant->getlambda() * 15/16);
      }
      else if (compID == COMPONENT_Cr)
      {
      m_pcTrQuant->setLambda ( m_pcTrQuant->getlambda() * 16/15);
      }
      }

### PLSCV (Partial Least Squares Cross Validation) Implementation Code in MATLAB In MATLAB, implementing Partial Least Squares Regression (PLSR) combined with cross-validation can be achieved using built-in functions such as `plsregress` or through custom scripts that incorporate k-fold cross-validation techniques. Below is an illustrative example of how to perform PLS regression along with cross-validation: #### Example Tutorial on Implementing PLSCV in MATLAB ```matlab % Load sample dataset load spectra % This loads NIR spectra data into X and octane measurements into y. % Define number of folds for cross-validation k = 5; % Initialize variables to store results across different numbers of components. mseCV = zeros(1,10); % Mean squared error from CV ncomp = 1:10; % Number of components to test for iComp = ncomp cvMSE = 0; % Perform K-Fold Cross-Validation c = cvpartition(size(X,1),'KFold',k); for ii=1:k trIdx = training(c,ii); teIdx = ~trIdx; % Fit model using training set [XL,YL,XS,YS,BETA,PCTVAR,MSEP] = plsregress(X(trIdx,:),y(trIdx),iComp); % Predict responses based on fitted model Ypred = [ones(sum(teIdx),1) X(teIdx,:)] * BETA; % Calculate mean square prediction error msePred(ii) = sum((Ypred - y(teIdx)).^2)/sum(teIdx); end % Store average MSE over all folds mseCV(iComp) = mean(msePred); end % Plotting Results figure(); plot(ncomp,mseCV,'-*'); xlabel('Number of Components'); ylabel('Mean Squared Error'); title('Cross Validated Prediction Errors'); % Select optimal number of components where minimum MSE occurs [minMSE,optNComp] = min(mseCV); disp(['Optimal number of components:', num2str(optNComp)]); ``` This script demonstrates loading a dataset, performing k-fold cross-validation while varying the number of latent variables/components used by partial least squares regression, calculating the mean squared errors associated with predictions made during each fold iteration, plotting these values against component count, and finally selecting the best-performing configuration according to lowest observed validation loss[^1].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值