Home | History | Annotate | Download | only in src
      1 /* ----------------------------------------------------------------
      2  *
      3  *
      4  * File Name:  omxVCM4P10_DeblockChroma_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 intra chroma 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  * Function:  omxVCM4P10_DeblockChroma_I   (6.3.3.3.6)
     26  *
     27  * Description:
     28  * Performs in-place deblocking filtering on all edges of the chroma
     29  * macroblock (16x16).
     30  *
     31  * Input Arguments:
     32  *
     33  *   pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
     34  *   srcdstStep - step of the arrays; must be a multiple of 8.
     35  *   pAlpha - pointer to a 2x2 array of alpha thresholds, organized as
     36  *            follows: {external vertical edge, internal vertical edge,
     37  *            external horizontal edge, internal horizontal edge }.  Per
     38  *            [ISO14496-10] alpha values must be in the range [0,255].
     39  *   pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows:
     40  *            { external vertical edge, internal vertical edge, external
     41  *            horizontal edge, internal horizontal edge }.  Per [ISO14496-10]
     42  *            beta values must be in the range [0,18].
     43  *   pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left
     44  *            or above edge of each 4x2 or 2x4 block, arranged in vertical
     45  *            block order and then in horizontal block order); must be aligned
     46  *            on a 4-byte boundary. Per [ISO14496-10] values must be in the
     47  *            range [0,25].
     48  *   pBS - array of size 16x2 of BS parameters (arranged in scan block order
     49  *            for vertical edges and then horizontal edges); valid in the
     50  *            range [0,4] with the following restrictions: i) pBS[i]== 4 may
     51  *            occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
     52  *            4.  Must be 4-byte aligned.
     53  *
     54  * Output Arguments:
     55  *
     56  *   pSrcDst - pointer to filtered output macroblock.
     57  *
     58  * Return Value:
     59  *
     60  *    OMX_Sts_NoErr - no error
     61  *    OMX_Sts_BadArgErr - bad arguments
     62  *    -    one or more of the following pointers is NULL: pSrcDst, pAlpha,
     63  *              pBeta, pThresholds, or pBS. pSrcDst is not 8-byte aligned.
     64  *              either pThresholds or pBS is not 4-byte aligned.
     65  *    -   one or more entries in the table pAlpha[0..3] is outside the range
     66  *              [0,255].
     67  *    -   one or more entries in the table pBeta[0..3] is outside the range
     68  *              [0,18].
     69  *    -   one or more entries in the table pThresholds[0..15]is outside of
     70  *              the range [0,25].
     71  *    -   pBS is out of range, i.e., one of the following conditions is true:
     72  *            pBS[i]<0, pBS[i]>4, pBS[i]==4  for i>=4, or
     73  *            (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
     74  *    -   srcdstStep is not a multiple of 8.
     75  *
     76  */
     77 OMXResult omxVCM4P10_DeblockChroma_I(
     78 	OMX_U8* pSrcDst,
     79 	OMX_S32 srcdstStep,
     80 	const OMX_U8* pAlpha,
     81 	const OMX_U8* pBeta,
     82 	const OMX_U8* pThresholds,
     83     const OMX_U8 *pBS
     84 )
     85 {
     86     OMXResult errorCode;
     87 
     88     armRetArgErrIf(pSrcDst == NULL,                 OMX_Sts_BadArgErr);
     89     armRetArgErrIf(armNot8ByteAligned(pSrcDst),     OMX_Sts_BadArgErr);
     90     armRetArgErrIf(srcdstStep & 7,                  OMX_Sts_BadArgErr);
     91     armRetArgErrIf(pAlpha == NULL,                  OMX_Sts_BadArgErr);
     92     armRetArgErrIf(pBeta == NULL,                   OMX_Sts_BadArgErr);
     93     armRetArgErrIf(pThresholds == NULL,             OMX_Sts_BadArgErr);
     94     armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
     95     armRetArgErrIf(pBS == NULL,                     OMX_Sts_BadArgErr);
     96     armRetArgErrIf(armNot4ByteAligned(pBS),         OMX_Sts_BadArgErr);
     97 
     98     errorCode = omxVCM4P10_FilterDeblockingChroma_VerEdge_I(
     99         pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
    100 
    101     armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
    102 
    103     errorCode = omxVCM4P10_FilterDeblockingChroma_HorEdge_I(
    104         pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+8, pBS+16);
    105 
    106     return errorCode;
    107 }
    108