Exemplo n.º 1
0
ErrVal MbDecoder::process( MbDataAccess& rcMbDataAccess,
                           Bool          bReconstructAll )
{
  ROF( m_bInitDone );

  RNOK( xScaleTCoeffs( rcMbDataAccess ) );

  YuvPicBuffer *pcRecYuvBuffer;
  RNOK( m_pcFrameMng->getRecYuvBuffer( pcRecYuvBuffer ) );

  IntYuvMbBuffer  cPredIntYuvMbBuffer;
  IntYuvMbBuffer  cResIntYuvMbBuffer;
  YuvMbBuffer     cYuvMbBuffer;
  

  if( rcMbDataAccess.getMbData().isPCM() )
  {
    RNOK( xDecodeMbPCM( rcMbDataAccess, cYuvMbBuffer ) );
    cResIntYuvMbBuffer .setAllSamplesToZero();
    cPredIntYuvMbBuffer.loadBuffer( &cYuvMbBuffer );
  }
  else
  {
    if( rcMbDataAccess.getMbData().isIntra() )
    {
      m_pcIntraPrediction->setAvailableMaskMb( rcMbDataAccess.getAvailableMask() );
      cResIntYuvMbBuffer.loadIntraPredictors( pcRecYuvBuffer );
  
      if( rcMbDataAccess.getMbData().isIntra4x4() )
      {
        if( rcMbDataAccess.getMbData().isTransformSize8x8() )
        {
          RNOK( xDecodeMbIntra8x8( rcMbDataAccess, cResIntYuvMbBuffer, cPredIntYuvMbBuffer ) );
        }
        else
        {
          RNOK( xDecodeMbIntra4x4( rcMbDataAccess, cResIntYuvMbBuffer, cPredIntYuvMbBuffer ) );
        }
      }
      else
      {
        RNOK( xDecodeMbIntra16x16( rcMbDataAccess, cResIntYuvMbBuffer, cPredIntYuvMbBuffer ) );
      }
      cYuvMbBuffer.loadBuffer( &cResIntYuvMbBuffer );
    }
    else
    {
      RNOK( xDecodeMbInter( rcMbDataAccess, cYuvMbBuffer, cPredIntYuvMbBuffer, cResIntYuvMbBuffer, bReconstructAll ) );
    }
  }
  pcRecYuvBuffer->loadBuffer( &cYuvMbBuffer );


  {
	  B4x4Idx cdx;
	  XPel* puc = cResIntYuvMbBuffer.getYBlk(cdx);
	  for (int i = 0; i < 16; ++i)
	  {
			for (int j = 0; j < 16; ++j)
			{
				printf("%4d", puc[i*24+j]);
			}
			printf("\n");
	  }
	  printf("\n");
  }

  return Err::m_nOK;
  
}
Exemplo n.º 2
0
ErrVal
MbDecoder::decode( MbDataAccess&  rcMbDataAccess,
                   MbDataAccess*  pcMbDataAccessBase,
                   IntFrame*      pcFrame,
                   IntFrame*      pcResidual,
                   IntFrame*      pcPredSignal,
                   IntFrame*      pcBaseLayer,
                   IntFrame*      pcBaseLayerResidual,
                   RefFrameList*  pcRefFrameList0,
                   RefFrameList*  pcRefFrameList1,
                   Bool           bReconstructAll )
{
  ROF( m_bInitDone );

  RNOK( xPredictionFromBaseLayer( rcMbDataAccess, pcMbDataAccessBase ) );

  IntYuvMbBuffer  cPredBuffer;  cPredBuffer.setAllSamplesToZero();

  //===== scale coefficients =====
  RNOK( xScaleTCoeffs( rcMbDataAccess ) );

  if( rcMbDataAccess.getMbData().isIntra() )
  {
    //===== clear residual signal for intra macroblocks =====
    if( pcResidual )
    {
      IntYuvMbBuffer  cYuvMbBuffer;  cYuvMbBuffer.setAllSamplesToZero();
      RNOK( pcResidual->getFullPelYuvBuffer()->loadBuffer( &cYuvMbBuffer ) );
    }

    if( rcMbDataAccess.getMbData().isPCM() )
    {
      //===== I_PCM mode =====
      RNOK( xDecodeMbPCM( rcMbDataAccess, pcFrame->getFullPelYuvBuffer() ) );
      cPredBuffer.loadBuffer( pcFrame->getFullPelYuvBuffer() );
    }
    else if( rcMbDataAccess.getMbData().getMbMode() == INTRA_BL )
    {
      //===== I_BL mode =====
      RNOK( xDecodeMbIntraBL( rcMbDataAccess,  pcFrame->getFullPelYuvBuffer(),
                              cPredBuffer, pcBaseLayer->getFullPelYuvBuffer() ) );
    }
    else
    {
      m_pcIntraPrediction->setAvailableMaskMb( rcMbDataAccess.getAvailableMask() );
      IntYuvMbBuffer cRecBuffer;  cRecBuffer.loadIntraPredictors( pcFrame->getFullPelYuvBuffer() );

      if( rcMbDataAccess.getMbData().isIntra16x16() )
      {
        //===== I_16x16 mode ====
        RNOK( xDecodeMbIntra16x16( rcMbDataAccess, cRecBuffer, cPredBuffer ) );
      }
      else if( rcMbDataAccess.getMbData().isTransformSize8x8() )
      {
        //===== I_8x8 mode =====
        RNOK( xDecodeMbIntra8x8( rcMbDataAccess, cRecBuffer, cPredBuffer ) );
      }
      else
      {
        //===== I_4x4 mode =====
        RNOK( xDecodeMbIntra4x4( rcMbDataAccess, cRecBuffer, cPredBuffer ) );
      }
      RNOK( pcFrame->getFullPelYuvBuffer()->loadBuffer( &cRecBuffer ) );
    }
  }
  else
  {
    //===== motion-compensated modes =====
    RNOK( xDecodeMbInter( rcMbDataAccess, pcMbDataAccessBase,
                          cPredBuffer, pcFrame->getFullPelYuvBuffer(),
                          pcResidual, pcBaseLayerResidual,
                          *pcRefFrameList0, *pcRefFrameList1, bReconstructAll ) );
  }


  //===== store prediction signal =====
  if( pcPredSignal )
  {
    RNOK( pcPredSignal->getFullPelYuvBuffer()->loadBuffer( &cPredBuffer ) );
  }

  return Err::m_nOK;
}