omxVCM4P10_DeblockLuma_I.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
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
27 *
28 * Description:
29 * This function performs deblock filtering the horizontal and vertical edges of a luma macroblock
30 *(16x16).
31 *
32 * Remarks:
33 *
34 * Parameters:
35 * [in]	pSrcDst         pointer to the input macroblock. Must be 8-byte aligned.
36 * [in]	srcdstStep      image width
37 * [in]	pAlpha          pointer to a 2x2 table of alpha thresholds, organized as follows: { external
38 *                             vertical edge, internal vertical edge, external horizontal
39 *                             edge, internal horizontal edge }
40 * [in]	pBeta			pointer to a 2x2 table of beta thresholds, organized as follows: { external
41 *                              vertical edge, internal vertical edge, external  horizontal edge,
42 *                              internal  horizontal edge }
43 * [in]	pThresholds		pointer to a 16x2 table of threshold (TC0), organized as follows: { values for
44 *                              the  left or above edge of each 4x4 block, arranged in  vertical block order
45 *                              and then in horizontal block order)
46 * [in]	pBS				 pointer to a 16x2 table of BS parameters arranged in scan block order for vertical edges and then horizontal edges;
47 *                               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.
48 * [out]	pSrcDst		pointer to filtered output macroblock.
49 *
50 * Return Value:
51 * OMX_Sts_NoErr - no error
52 * OMX_Sts_BadArgErr - bad arguments
53 *    - Either of the pointers in pSrcDst, pAlpha, pBeta, pTresholds or pBS is NULL.
54 *    - pSrcDst is not 8-byte aligned.
55 *    - srcdstStep is not a multiple of 8
56 *    - 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.
57.
58 *
59 */
60
61OMXResult omxVCM4P10_DeblockLuma_I(
62	OMX_U8* pSrcDst,
63	OMX_S32 srcdstStep,
64	const OMX_U8* pAlpha,
65	const OMX_U8* pBeta,
66	const OMX_U8* pThresholds,
67	const OMX_U8 *pBS
68)
69{
70    OMXResult errorCode;
71
72    armRetArgErrIf(pSrcDst == NULL,             OMX_Sts_BadArgErr);
73    armRetArgErrIf(armNot8ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
74    armRetArgErrIf(srcdstStep & 7,              OMX_Sts_BadArgErr);
75    armRetArgErrIf(pAlpha == NULL,              OMX_Sts_BadArgErr);
76    armRetArgErrIf(pBeta == NULL,               OMX_Sts_BadArgErr);
77    armRetArgErrIf(pThresholds == NULL,         OMX_Sts_BadArgErr);
78    armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr);
79    armRetArgErrIf(pBS == NULL,                     OMX_Sts_BadArgErr);
80    armRetArgErrIf(armNot4ByteAligned(pBS),         OMX_Sts_BadArgErr);
81
82    errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I(
83        pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS);
84
85    armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode)
86
87    errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I(
88        pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16);
89
90    return errorCode;
91}
92