armVCM4P10_InterpolateHalfVer_Luma.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
1/* 2 * Copyright (C) 2007-2008 ARM Limited 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17/** 18 * 19 * File Name: armVCM4P10_InterpolateHalfVer_Luma.c 20 * OpenMAX DL: v1.0.2 21 * Revision: 9641 22 * Date: Thursday, February 7, 2008 23 * 24 * 25 * 26 * Description: 27 * This functions will help to calculate Half Pel luma interpolation 28 * 29 */ 30 31#include "omxtypes.h" 32#include "armOMX.h" 33#include "omxVC.h" 34 35#include "armCOMM.h" 36#include "armVC.h" 37 38/** 39 * Function: armVCM4P10_InterpolateHalfVer_Luma 40 * 41 * Description: 42 * This function performs interpolation for vertical 1/2-pel positions 43 * around a full-pel position. 44 * 45 * Remarks: 46 * 47 * [in] pSrc Pointer to top-left corner of block used to interpolate 48 * in the reconstructed frame plane 49 * [in] iSrcStep Step of the source buffer. 50 * [in] iDstStep Step of the destination(interpolation) buffer. 51 * [in] iWidth Width of the current block 52 * [in] iHeight Height of the current block 53 * [out] pDst Pointer to the interpolation buffer of the 1/2-pel 54 * 55 * Return Value: 56 * Standard OMXResult value. 57 * 58 */ 59 60OMXResult armVCM4P10_InterpolateHalfVer_Luma( 61 const OMX_U8* pSrc, 62 OMX_U32 iSrcStep, 63 OMX_U8* pDst, 64 OMX_U32 iDstStep, 65 OMX_U32 iWidth, 66 OMX_U32 iHeight 67) 68{ 69 OMX_S32 HalfCoeff, pos; 70 OMX_INT y, x; 71 72 /* check for argument error */ 73 armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr) 74 armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr) 75 76 77 for (y = 0; y < iHeight; y++) 78 { 79 for (x = 0; x < iWidth; x++) 80 { 81 pos = y * iSrcStep + x; 82 HalfCoeff = 83 pSrc [pos - 2 * iSrcStep] - 84 5 * pSrc [pos - 1 * iSrcStep] + 85 20 * pSrc [pos] + 86 20 * pSrc [pos + 1 * iSrcStep] - 87 5 * pSrc [pos + 2 * iSrcStep] + 88 pSrc [pos + 3 * iSrcStep]; 89 90 HalfCoeff = (HalfCoeff + 16) >> 5; 91 HalfCoeff = armClip(0, 255, HalfCoeff); 92 93 pDst [y * iDstStep + x] = (OMX_U8) HalfCoeff; 94 } 95 } 96 97 return OMX_Sts_NoErr; 98} 99 100