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_DeblockLuma_I.c
     21  * OpenMAX DL: v1.0.2
     22  * Revision:   12290
     23  * Date:       Wednesday, April 9, 2008
     24  *
     25  *
     26  *
     27  *
     28  * H.264 luma 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 /**
     41  * Function: omxVCM4P10_DeblockLuma_I
     42  *
     43  * Description:
     44  * This function performs deblock filtering the horizontal and vertical edges of a luma macroblock
     45  *(16x16).
     46  *
     47  * Remarks:
     48  *
     49  * Parameters:
     50  * [in]	pSrcDst         pointer to the input macroblock. Must be 8-byte aligned.
     51  * [in]	srcdstStep      image width
     52  * [in]	pAlpha          pointer to a 2x2 table of alpha thresholds, organized as follows: { external
     53  *                             vertical edge, internal vertical edge, external horizontal
     54  *                             edge, internal horizontal edge }
     55  * [in]	pBeta			pointer to a 2x2 table of beta thresholds, organized as follows: { external
     56  *                              vertical edge, internal vertical edge, external  horizontal edge,
     57  *                              internal  horizontal edge }
     58  * [in]	pThresholds		pointer to a 16x2 table of threshold (TC0), organized as follows: { values for
     59  *                              the  left or above edge of each 4x4 block, arranged in  vertical block order
     60  *                              and then in horizontal block order)
     61  * [in]	pBS				 pointer to a 16x2 table of BS parameters arranged in scan block order for vertical edges and then horizontal edges;
     62  *                               valid in the range [0,4] with the following restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^1]== 4.  Must be 4-byte aligned.
     63  * [out]	pSrcDst		pointer to filtered output macroblock.
     64  *
     65  * Return Value:
     66  * OMX_Sts_NoErr - no error
     67  * OMX_Sts_BadArgErr - bad arguments
     68  *    - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds or pBS is NULL.
     69  *    - pSrcDst is not 8-byte aligned.
     70  *    - srcdstStep is not a multiple of 8
     71  *    - pBS is out of range, i.e., one of the following conditions is true: pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && pBS[i^1]!=4) for 0<=i<=3.
     72 .
     73  *
     74  */
     75 
     76 OMXResult omxVCM4P10_DeblockLuma_I(
     77 	OMX_U8* pSrcDst,
     78 	OMX_S32 srcdstStep,
     79 	const OMX_U8* pAlpha,
     80 	const OMX_U8* pBeta,
     81 	const OMX_U8* pThresholds,
     82 	const OMX_U8 *pBS
     83 )
     84 {
     85     OMXResult errorCode;
     86 
     87     armRetArgErrIf(pSrcDst == NULL,             OMX_Sts_BadArgErr);
     88     armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
     89     armRetArgErrIf(srcdstStep & 7,              OMX_Sts_BadArgErr);
     90     armRetArgErrIf(pAlpha == NULL,              OMX_Sts_BadArgErr);
     91     armRetArgErrIf(pBeta == NULL,               OMX_Sts_BadArgErr);
     92     armRetArgErrIf(pThresholds == NULL,         OMX_Sts_BadArgErr);
     93     armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
     94     armRetArgErrIf(pBS == NULL,                     OMX_Sts_BadArgErr);
     95     armRetArgErrIf(armNot4ByteAligned(pBS),         OMX_Sts_BadArgErr);
     96 
     97     errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
     98         pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
     99 
    100     armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
    101 
    102     errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
    103         pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16);
    104 
    105     return errorCode;
    106 }
    107