1 /** 2 * 3 * File Name: armVCM4P10_InterpolateHalfVer_Luma.c 4 * OpenMAX DL: v1.0.2 5 * Revision: 9641 6 * Date: Thursday, February 7, 2008 7 * 8 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 9 * 10 * 11 * Description: 12 * This functions will help to calculate Half Pel luma interpolation 13 * 14 */ 15 16 #include "omxtypes.h" 17 #include "armOMX.h" 18 #include "omxVC.h" 19 20 #include "armCOMM.h" 21 #include "armVC.h" 22 23 /** 24 * Function: armVCM4P10_InterpolateHalfVer_Luma 25 * 26 * Description: 27 * This function performs interpolation for vertical 1/2-pel positions 28 * around a full-pel position. 29 * 30 * Remarks: 31 * 32 * [in] pSrc Pointer to top-left corner of block used to interpolate 33 * in the reconstructed frame plane 34 * [in] iSrcStep Step of the source buffer. 35 * [in] iDstStep Step of the destination(interpolation) buffer. 36 * [in] iWidth Width of the current block 37 * [in] iHeight Height of the current block 38 * [out] pDst Pointer to the interpolation buffer of the 1/2-pel 39 * 40 * Return Value: 41 * Standard OMXResult value. 42 * 43 */ 44 45 OMXResult armVCM4P10_InterpolateHalfVer_Luma( 46 const OMX_U8* pSrc, 47 OMX_U32 iSrcStep, 48 OMX_U8* pDst, 49 OMX_U32 iDstStep, 50 OMX_U32 iWidth, 51 OMX_U32 iHeight 52 ) 53 { 54 OMX_S32 HalfCoeff, pos; 55 OMX_INT y, x; 56 57 /* check for argument error */ 58 armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr) 59 armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr) 60 61 62 for (y = 0; y < iHeight; y++) 63 { 64 for (x = 0; x < iWidth; x++) 65 { 66 pos = y * iSrcStep + x; 67 HalfCoeff = 68 pSrc [pos - 2 * iSrcStep] - 69 5 * pSrc [pos - 1 * iSrcStep] + 70 20 * pSrc [pos] + 71 20 * pSrc [pos + 1 * iSrcStep] - 72 5 * pSrc [pos + 2 * iSrcStep] + 73 pSrc [pos + 3 * iSrcStep]; 74 75 HalfCoeff = (HalfCoeff + 16) >> 5; 76 HalfCoeff = armClip(0, 255, HalfCoeff); 77 78 pDst [y * iDstStep + x] = (OMX_U8) HalfCoeff; 79 } 80 } 81 82 return OMX_Sts_NoErr; 83 } 84 85