Home | History | Annotate | Download | only in src
      1 /* ----------------------------------------------------------------
      2  *
      3  *
      4  * File Name:  omxVCM4P10_DeblockLuma_I.c
      5  * OpenMAX DL: v1.0.2
      6  * Revision:   9641
      7  * Date:       Thursday, February 7, 2008
      8  *
      9  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
     10  *
     11  *
     12  *
     13  * H.264 luma deblock
     14  *
     15  */
     16 
     17 #include "omxtypes.h"
     18 #include "armOMX.h"
     19 #include "omxVC.h"
     20 
     21 #include "armCOMM.h"
     22 #include "armVC.h"
     23 
     24 
     25 /**
     26  * Function:  omxVCM4P10_DeblockLuma_I   (6.3.3.3.5)
     27  *
     28  * Description:
     29  * This function performs in-place deblock filtering the horizontal and
     30  * vertical edges of a luma macroblock (16x16).
     31  *
     32  * Input Arguments:
     33  *
     34  *   pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
     35  *   srcdstStep - image width; must be a multiple of 16.
     36  *   pAlpha - pointer to a 2x2 table of alpha thresholds, organized as
     37  *            follows: {external vertical edge, internal vertical edge,
     38  *            external horizontal edge, internal horizontal edge }.  Per
     39  *            [ISO14496-10] alpha values must be in the range [0,255].
     40  *   pBeta - pointer to a 2x2 table of beta thresholds, organized as follows:
     41  *            {external vertical edge, internal vertical edge, external
     42  *            horizontal edge, internal horizontal edge }.  Per [ISO14496-10]
     43  *            beta values must be in the range [0,18].
     44  *   pThresholds - pointer to a 16x2 table of threshold (TC0), organized as
     45  *            follows: {values for the left or above edge of each 4x4 block,
     46  *            arranged in vertical block order and then in horizontal block
     47  *            order}; must be aligned on a 4-byte boundary.  Per [ISO14496-10]
     48  *            values must be in the range [0,25].
     49  *   pBS - pointer to a 16x2 table of BS parameters arranged in scan block
     50  *            order for vertical edges and then horizontal edges; valid in the
     51  *            range [0,4] with the following restrictions: i) pBS[i]== 4 may
     52  *            occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
     53  *            4. Must be 4-byte aligned.
     54  *
     55  * Output Arguments:
     56  *
     57  *   pSrcDst - pointer to filtered output macroblock.
     58  *
     59  * Return Value:
     60  *
     61  *    OMX_Sts_NoErr - no error
     62  *    OMX_Sts_BadArgErr - bad arguments
     63  *    -     one or more of the following pointers is NULL: pSrcDst, pAlpha,
     64  *              pBeta, pThresholds or pBS. pSrcDst is not 16-byte aligned.
     65  *              either pThresholds or pBS is not aligned on a 4-byte boundary.
     66  *    -    one or more entries in the table pAlpha[0..3] is outside the range
     67  *              [0,255].
     68  *    -    one or more entries in the table pBeta[0..3] is outside the range
     69  *              [0,18].
     70  *    -    one or more entries in the table pThresholds[0..31]is outside of
     71  *              the range [0,25].
     72  *    -    pBS is out of range, i.e., one of the following conditions is true:
     73  *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
     74  *             (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
     75  *    -    srcdstStep is not a multiple of 16.
     76  *
     77  */
     78 
     79 OMXResult omxVCM4P10_DeblockLuma_I(
     80 	OMX_U8* pSrcDst,
     81 	OMX_S32 srcdstStep,
     82 	const OMX_U8* pAlpha,
     83 	const OMX_U8* pBeta,
     84 	const OMX_U8* pThresholds,
     85 	const OMX_U8 *pBS
     86 )
     87 {
     88     OMXResult errorCode;
     89 
     90     armRetArgErrIf(pSrcDst == NULL,             OMX_Sts_BadArgErr);
     91     armRetArgErrIf(armNot16ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
     92     armRetArgErrIf(srcdstStep & 15,              OMX_Sts_BadArgErr);
     93     armRetArgErrIf(pAlpha == NULL,              OMX_Sts_BadArgErr);
     94     armRetArgErrIf(pBeta == NULL,               OMX_Sts_BadArgErr);
     95     armRetArgErrIf(pThresholds == NULL,         OMX_Sts_BadArgErr);
     96     armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
     97     armRetArgErrIf(pBS == NULL,                     OMX_Sts_BadArgErr);
     98     armRetArgErrIf(armNot4ByteAligned(pBS),         OMX_Sts_BadArgErr);
     99 
    100     errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
    101         pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
    102 
    103     armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
    104 
    105     errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
    106         pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16);
    107 
    108     return errorCode;
    109 }
    110