omxVCM4P10_DeblockChroma_I.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
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
41 *
42 * Description:
43 * Performs deblocking filtering on all edges of the chroma macroblock (16x16).
44 *
45 * Remarks:
46 *
47 * Parameters:
48 * [in]	pSrcDst         pointer to the input macroblock. Must be 8-byte aligned.
49 * [in]	srcdstStep      Step of the arrays
50 * [in]	pAlpha          pointer to a 2x2 array of alpha thresholds, organized as follows: { external
51 *                          vertical edge, internal  vertical edge, external
52 *                         horizontal edge, internal horizontal edge }
53 * [in]	pBeta			pointer to a 2x2 array of beta thresholds, organized as follows: { external
54 *                              vertical edge, internal vertical edge, external  horizontal edge,
55 *                              internal  horizontal edge }
56 * [in]	pThresholds		AArray of size  8x2 of Thresholds (TC0) (values for the left or
57 *                               above edge of each 4x2 or 2x4 block, arranged in  vertical block order
58 *                               and then in  horizontal block order)
59 * [in]	pBS				array of size 16x2 of BS parameters (arranged in scan block order for vertical edges and then horizontal edges);
60 *                         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.
61 * [out]	pSrcDst		pointer to filtered output macroblock
62 *
63 * Return Value:
64 * OMX_Sts_NoErr - no error
65 * OMX_Sts_BadArgErr - bad arguments
66 *   - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds, or pBS is NULL.
67 *   - pSrcDst is not 8-byte aligned.
68 *   - either pThresholds or pBS is not 4-byte aligned.
69 *   - 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.
70 *   - srcdstStep is not a multiple of 8.
71 *
72 */
73OMXResult omxVCM4P10_DeblockChroma_I(
74	OMX_U8* pSrcDst,
75	OMX_S32 srcdstStep,
76	const OMX_U8* pAlpha,
77	const OMX_U8* pBeta,
78	const OMX_U8* pThresholds,
79    const OMX_U8 *pBS
80)
81{
82    OMXResult errorCode;
83
84    armRetArgErrIf(pSrcDst == NULL,                 OMX_Sts_BadArgErr);
85    armRetArgErrIf(armNot8ByteAligned(pSrcDst),     OMX_Sts_BadArgErr);
86    armRetArgErrIf(srcdstStep & 7,                  OMX_Sts_BadArgErr);
87    armRetArgErrIf(pAlpha == NULL,                  OMX_Sts_BadArgErr);
88    armRetArgErrIf(pBeta == NULL,                   OMX_Sts_BadArgErr);
89    armRetArgErrIf(pThresholds == NULL,             OMX_Sts_BadArgErr);
90    armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
91    armRetArgErrIf(pBS == NULL,                     OMX_Sts_BadArgErr);
92    armRetArgErrIf(armNot4ByteAligned(pBS),         OMX_Sts_BadArgErr);
93
94    errorCode = omxVCM4P10_FilterDeblockingChroma_VerEdge_I(
95        pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
96
97    armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
98
99    errorCode = omxVCM4P10_FilterDeblockingChroma_HorEdge_I(
100        pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+8, pBS+16);
101
102    return errorCode;
103}
104