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