Ignore:
Timestamp:
6 May 2014, 17:59:48 (11 years ago)
Author:
qualcomm
Message:

Fixed a CGS bug related to non-zero scale offsets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp

    r684 r770  
    276276  Int nStrideILRY = pRecPic->getStride();
    277277  Int nStrideILRC = pRecPic->getCStride();
    278   Int nWidth = m_pDsOrigPic->getWidth();   //should exclude the padding;
    279   Int nHeight= m_pDsOrigPic->getHeight();
    280278  xReset3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() );
    281279  xReset3DArray( m_pColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() );
    282280
    283281  //alignment padding
    284   Pel *pU = pRecPic->getCbAddr();
    285   Pel *pV = pRecPic->getCrAddr();
    286   pU[(nWidth>>1)] = pU[(nWidth>>1)-1];
    287   pV[(nWidth>>1)] = pV[(nWidth>>1)-1];
    288   memcpy(pU-nStrideILRC, pU, ((nWidth>>1)+1)*sizeof(Pel));
    289   memcpy(pV-nStrideILRC, pV, ((nWidth>>1)+1)*sizeof(Pel));
    290   pU += nStrideILRC+ (nWidth>>1);
    291   pV += nStrideILRC+ (nWidth>>1);
    292 
    293   for( Int y = 1 ; y < (nHeight>>1) ; y ++ )
    294   {
    295     *pU = pU[-1];
    296     *pV = pV[-1];
    297     pU += nStrideILRC;
    298     pV += nStrideILRC;
    299   }
    300   memcpy(pU-(nWidth>>1), pU-(nWidth>>1)-nStrideILRC, ((nWidth>>1)+1)*sizeof(Pel));
    301   memcpy(pV-(nWidth>>1), pV-(nWidth>>1)-nStrideILRC, ((nWidth>>1)+1)*sizeof(Pel));
    302 
    303   for( Int i = 0 ; i < nHeight ; i++ )
    304   {
    305     Int posSrcY = i * nStrideSrcY;
    306     Int posIRLY = i * nStrideILRY;
    307     Int posSrcUV = ( i >> 1 ) * nStrideSrcC;
    308     Int posIRLUV = ( i >> 1 ) * nStrideILRC;
    309     for( Int j = 0 ; j < nWidth ; j++ , posSrcY++ , posIRLY++ , posSrcUV += !( j & 0x01 ) , posIRLUV += !( j & 0x01 ) )
     282  pRecPic->setBorderExtension( false );
     283  pRecPic->extendPicBorder();
     284
     285  TComSlice * pSlice = pCurPic->getSlice(pCurPic->getCurrSliceIdx());
     286  UInt refLayerId = pSlice->getVPS()->getRefLayerId(pSlice->getLayerId(), refLayerIdc);
     287  const Window &scalEL = pSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
     288  TComPicYuv *pcRecPicBL = pSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
     289  // borders of down-sampled picture
     290  Int leftDS =  (scalEL.getWindowLeftOffset()*g_posScalingFactor[refLayerIdc][0]+(1<<15))>>16;
     291  Int rightDS = pcRecPicBL->getWidth() - 1 + (((scalEL.getWindowRightOffset())*g_posScalingFactor[refLayerIdc][0]+(1<<15))>>16);
     292  Int topDS = (((scalEL.getWindowTopOffset())*g_posScalingFactor[refLayerIdc][1]+(1<<15))>>16);
     293  Int bottomDS = pcRecPicBL->getHeight() - 1 + (((scalEL.getWindowBottomOffset())*g_posScalingFactor[refLayerIdc][1]+(1<<15))>>16);
     294  // overlapped region
     295  Int left = max( 0 , leftDS );
     296  Int right = min( pcRecPicBL->getWidth() - 1 , rightDS );
     297  Int top = max( 0 , topDS );
     298  Int bottom = min( pcRecPicBL->getHeight() - 1 , bottomDS );
     299  // since we do data collection only for overlapped region, the border extension is good enough
     300
     301  for( Int i = top ; i <= bottom ; i++ )
     302  {
     303    Int iDS = i-topDS;
     304    Int jDS = left-leftDS;
     305    Int posSrcY = iDS * nStrideSrcY + jDS;
     306    Int posIRLY = i * nStrideILRY + left;
     307    Int posSrcUV = ( iDS >> 1 ) * nStrideSrcC + (jDS>>1);
     308    Int posIRLUV = ( i >> 1 ) * nStrideILRC + (left>>1);
     309    for( Int j = left ; j <= right ; j++ , posSrcY++ , posIRLY++ , posSrcUV += !( j & 0x01 ) , posIRLUV += !( j & 0x01 ) )
    310310    {
    311311      Int Y = pSrcY[posSrcY];
Note: See TracChangeset for help on using the changeset viewer.