1/* ---------------------------------------------------------------- 2 * 3 * 4 * File Name: omxVCM4P10_FilterDeblockingLuma_VerEdge_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 module 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_FilterDeblockingLuma_VerEdge_I (6.3.3.3.1) 26 * 27 * Description: 28 * Performs in-place deblock filtering on four vertical edges of the luma 29 * macroblock (16x16). 30 * 31 * Input Arguments: 32 * 33 * pSrcDst - Pointer to the input macroblock; must be 16-byte aligned. 34 * srcdstStep -Step of the arrays; must be a multiple of 16. 35 * pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha 36 * threshold for the external vertical edge, and the second item is 37 * for the internal vertical edge); per [ISO14496-10] alpha values 38 * must be in the range [0,255]. 39 * pBeta -Array of size 2 of beta thresholds (the first item is the beta 40 * threshold for the external vertical edge, and the second item is 41 * for the internal vertical edge); per [ISO14496-10] beta values 42 * must be in the range [0,18]. 43 * pThresholds -Array of size 16 of Thresholds (TC0) (values for the left 44 * edge of each 4x4 block, arranged in vertical block order); must 45 * be aligned on a 4-byte boundary.. Per [ISO14496-10] values must 46 * be in the range [0,25]. 47 * pBS -Array of size 16 of BS parameters (arranged in vertical block 48 * order); valid in the range [0,4] with the following 49 * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) 50 * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned. 51 * 52 * Output Arguments: 53 * 54 * pSrcDst -Pointer to filtered output macroblock. 55 * 56 * Return Value: 57 * If the function runs without error, it returns OMX_Sts_NoErr. 58 * If one of the following cases occurs, the function returns 59 * OMX_Sts_BadArgErr: 60 * Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS 61 * is NULL. 62 * Either pThresholds or pBS is not aligned on a 4-byte boundary. 63 * pSrcDst is not 16-byte aligned. 64 * srcdstStep is not a multiple of 16. 65 * pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 66 * pBeta[0] and/or pBeta[1] is outside the range [0,18]. 67 * One or more entries in the table pThresholds[0..15]is outside of the 68 * range [0,25]. 69 * pBS is out of range, i.e., one of the following conditions is true: 70 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && 71 * pBS[i^3]!=4) for 0<=i<=3. 72 * 73 */ 74 75OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I( 76 OMX_U8* pSrcDst, 77 OMX_S32 srcdstStep, 78 const OMX_U8* pAlpha, 79 const OMX_U8* pBeta, 80 const OMX_U8* pThresholds, 81 const OMX_U8 *pBS 82 ) 83{ 84 int X, Y, I, Internal=0; 85 86 armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); 87 armRetArgErrIf(armNot16ByteAligned(pSrcDst),OMX_Sts_BadArgErr); 88 armRetArgErrIf(srcdstStep & 15, OMX_Sts_BadArgErr); 89 armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr); 90 armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr); 91 armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr); 92 armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr); 93 armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr); 94 armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr); 95 armRetArgErrIf(pBeta[0] > 18, OMX_Sts_BadArgErr); 96 armRetArgErrIf(pBeta[1] > 18, OMX_Sts_BadArgErr); 97 98 99 for (X=0; X<16; X+=4, Internal=1) 100 { 101 for (Y=0; Y<16; Y++) 102 { 103 I = (Y>>2)+4*(X>>2); 104 105 armRetArgErrIf(pBS[Y] > 4, OMX_Sts_BadArgErr); 106 107 armRetArgErrIf((pBS[Y] == 4) && (Y > 3), 108 OMX_Sts_BadArgErr); 109 110 armRetArgErrIf(( (pBS[Y] == 4) && (pBS[Y^3] != 4) ), 111 OMX_Sts_BadArgErr); 112 113 armRetArgErrIf(pThresholds[Y] > 25, OMX_Sts_BadArgErr); 114 115 /* Filter vertical edge with q0 at (X,Y) */ 116 armVCM4P10_DeBlockPixel( 117 pSrcDst + Y*srcdstStep + X, 118 1, 119 pThresholds[I], 120 pAlpha[Internal], 121 pBeta[Internal], 122 pBS[I], 123 0); 124 } 125 } 126 127 return OMX_Sts_NoErr; 128} 129