/**************************************************************************** * * Module Title : Reconstruct.c * * Description : Block reconstruction functions. * ****************************************************************************/ #define STRICT // Strict type checking /**************************************************************************** * Header Files ****************************************************************************/ #include "reconstruct.h" #include "codec_common.h" /**************************************************************************** * * ROUTINE : SatUnsigned8 * * INPUTS : INT16 *DataBlock : Pointer to 8x8 input block. * UINT32 ResultLineStep : Stride of output block. * UINT32 DataLineStep : Stride of input block. * * OUTPUTS : UINT8 *ResultPtr : Pointer to 8x8 output block. * * RETURNS : void * * FUNCTION : Saturates the input data to 8 bits unsigned and stores * in the output buffer. * * SPECIAL NOTES : None. * ****************************************************************************/ void SatUnsigned8 ( UINT8 *ResultPtr, INT16 *DataBlock, UINT32 ResultLineStep, UINT32 DataLineStep ) { INT32 i; // Partly expanded loop for ( i=0; i> 1) + ChangePtr[0] ); TmpDataPtr[1] = (INT16)( (((INT32)RefPtr1[1] + (INT32)RefPtr2[1]) >> 1) + ChangePtr[1] ); TmpDataPtr[2] = (INT16)( (((INT32)RefPtr1[2] + (INT32)RefPtr2[2]) >> 1) + ChangePtr[2] ); TmpDataPtr[3] = (INT16)( (((INT32)RefPtr1[3] + (INT32)RefPtr2[3]) >> 1) + ChangePtr[3] ); TmpDataPtr[4] = (INT16)( (((INT32)RefPtr1[4] + (INT32)RefPtr2[4]) >> 1) + ChangePtr[4] ); TmpDataPtr[5] = (INT16)( (((INT32)RefPtr1[5] + (INT32)RefPtr2[5]) >> 1) + ChangePtr[5] ); TmpDataPtr[6] = (INT16)( (((INT32)RefPtr1[6] + (INT32)RefPtr2[6]) >> 1) + ChangePtr[6] ); TmpDataPtr[7] = (INT16)( (((INT32)RefPtr1[7] + (INT32)RefPtr2[7]) >> 1) + ChangePtr[7] ); // Next row of Block ChangePtr += BLOCK_HEIGHT_WIDTH; TmpDataPtr += BLOCK_HEIGHT_WIDTH; RefPtr1 += LineStep; RefPtr2 += LineStep; } // Saturate the output to unsigned 8 bit values in recon buffer SatUnsigned8( ReconPtr, TmpDataBuffer, LineStep, BLOCK_HEIGHT_WIDTH ); } /**************************************************************************** * * ROUTINE : ReconBlock_C * * INPUTS : INT16 *SrcBlock : Pointer to 8x8 prediction error. * INT16 *ReconRefPtr : Pointer to 8x8 block prediction. * UINT32 LineStep : Stride of output block. * * OUTPUTS : UINT8 *DestBlock : Pointer to 8x8 reconstructed block. * * RETURNS : void * * FUNCTION : Reconstrut a block by adding the prediction error * block to the source block and clipping values. * * SPECIAL NOTES : None. * ****************************************************************************/ void ReconBlock_C ( INT16 *SrcBlock, INT16 *ReconRefPtr, UINT8 *DestBlock, UINT32 LineStep ) { UINT32 i; INT16 *SrcBlockPtr = SrcBlock; // For each block row for ( i=0; i