omxVCM4P10_InterpolateLuma.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
10c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
20c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name:  omxVCM4P10_InterpolateLuma.c
40c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2
50c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision:   9641
60c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date:       Thursday, February 7, 2008
70c1bc742181ded4930842b46e9507372f0b1b963James Dong *
80c1bc742181ded4930842b46e9507372f0b1b963James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
90c1bc742181ded4930842b46e9507372f0b1b963James Dong *
100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
120c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function will calculate Performs quarter-pixel interpolation
130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
140c1bc742181ded4930842b46e9507372f0b1b963James Dong */
150c1bc742181ded4930842b46e9507372f0b1b963James Dong
160c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h"
170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h"
180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h"
190c1bc742181ded4930842b46e9507372f0b1b963James Dong
200c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h"
210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h"
220c1bc742181ded4930842b46e9507372f0b1b963James Dong
230c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InterpolateLuma   (6.3.3.2.1)
250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs quarter-pixel interpolation for inter luma MB. It is assumed that
280c1bc742181ded4930842b46e9507372f0b1b963James Dong * the frame is already padded when calling this function.
290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
300c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
320c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc -Pointer to the source reference frame buffer
330c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep -reference frame step, in bytes; must be a multiple of roi.width
340c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep -destination frame step, in bytes; must be a multiple of
350c1bc742181ded4930842b46e9507372f0b1b963James Dong *            roi.width
360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dx -Fractional part of horizontal motion vector component in 1/4 pixel
370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unit; valid in the range [0,3]
380c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dy -Fractional part of vertical motion vector y component in 1/4 pixel
390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unit; valid in the range [0,3]
400c1bc742181ded4930842b46e9507372f0b1b963James Dong *   roi -Dimension of the interpolation region; the parameters roi.width and
410c1bc742181ded4930842b46e9507372f0b1b963James Dong *            roi.height must be equal to either 4, 8, or 16.
420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst -Pointer to the destination frame buffer if roi.width==4,  4-byte
460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required if roi.width==8,  8-byte alignment required
470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            if roi.width==16, 16-byte alignment required
480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
490c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If one of the following cases occurs, the function returns
520c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pSrc or pDst is NULL.
540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcStep or dstStep < roi.width.
550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dx or dy is out of range [0,3].
560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width or roi.height is out of range {4, 8, 16}.
570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 4, but pDst is not 4 byte aligned.
580c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 8 or 16, but pDst is not 8 byte aligned.
590c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcStep or dstStep is not a multiple of 8.
600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
610c1bc742181ded4930842b46e9507372f0b1b963James Dong */
620c1bc742181ded4930842b46e9507372f0b1b963James Dong
630c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InterpolateLuma (
640c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8* pSrc,
650c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 srcStep,
660c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8* pDst,
670c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 dstStep,
680c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 dx,
690c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 dy,
700c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMXSize roi
710c1bc742181ded4930842b46e9507372f0b1b963James Dong )
720c1bc742181ded4930842b46e9507372f0b1b963James Dong{
730c1bc742181ded4930842b46e9507372f0b1b963James Dong    /* check for argument error */
740c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
750c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
760c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(srcStep < roi.width, OMX_Sts_BadArgErr)
770c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dstStep < roi.width, OMX_Sts_BadArgErr)
780c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dx < 0, OMX_Sts_BadArgErr)
790c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dx > 3, OMX_Sts_BadArgErr)
800c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dy < 0, OMX_Sts_BadArgErr)
810c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dy > 3, OMX_Sts_BadArgErr)
820c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((roi.width != 4) && (roi.width != 8) && (roi.width != 16), OMX_Sts_BadArgErr)
830c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((roi.height != 4) && (roi.height != 8) && (roi.height != 16), OMX_Sts_BadArgErr)
840c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((roi.width == 4) && armNot4ByteAligned(pDst), OMX_Sts_BadArgErr)
850c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((roi.width == 8) && armNot8ByteAligned(pDst), OMX_Sts_BadArgErr)
860c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((roi.width == 16) && armNot16ByteAligned(pDst), OMX_Sts_BadArgErr)
870c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(srcStep & 7, OMX_Sts_BadArgErr)
880c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dstStep & 7, OMX_Sts_BadArgErr)
890c1bc742181ded4930842b46e9507372f0b1b963James Dong
900c1bc742181ded4930842b46e9507372f0b1b963James Dong    return armVCM4P10_Interpolate_Luma
910c1bc742181ded4930842b46e9507372f0b1b963James Dong        (pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
920c1bc742181ded4930842b46e9507372f0b1b963James Dong
930c1bc742181ded4930842b46e9507372f0b1b963James Dong}
940c1bc742181ded4930842b46e9507372f0b1b963James Dong
950c1bc742181ded4930842b46e9507372f0b1b963James Dong
960c1bc742181ded4930842b46e9507372f0b1b963James Dong/*****************************************************************************
970c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              END OF FILE
980c1bc742181ded4930842b46e9507372f0b1b963James Dong *****************************************************************************/
990c1bc742181ded4930842b46e9507372f0b1b963James Dong
100