10c1bc742181ded4930842b46e9507372f0b1b963James Dong/* ---------------------------------------------------------------- 20c1bc742181ded4930842b46e9507372f0b1b963James Dong * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong * 40c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: omxVCM4P10_DeblockLuma_I.c 50c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2 60c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision: 9641 70c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date: Thursday, February 7, 2008 80c1bc742181ded4930842b46e9507372f0b1b963James Dong * 90c1bc742181ded4930842b46e9507372f0b1b963James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 100c1bc742181ded4930842b46e9507372f0b1b963James Dong * 110c1bc742181ded4930842b46e9507372f0b1b963James Dong * 120c1bc742181ded4930842b46e9507372f0b1b963James Dong * 130c1bc742181ded4930842b46e9507372f0b1b963James Dong * H.264 luma deblock 140c1bc742181ded4930842b46e9507372f0b1b963James Dong * 150c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 160c1bc742181ded4930842b46e9507372f0b1b963James Dong 170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 190c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h" 200c1bc742181ded4930842b46e9507372f0b1b963James Dong 210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 220c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 230c1bc742181ded4930842b46e9507372f0b1b963James Dong 240c1bc742181ded4930842b46e9507372f0b1b963James Dong 250c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: omxVCM4P10_DeblockLuma_I (6.3.3.3.5) 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs in-place deblock filtering the horizontal and 300c1bc742181ded4930842b46e9507372f0b1b963James Dong * vertical edges of a luma macroblock (16x16). 310c1bc742181ded4930842b46e9507372f0b1b963James Dong * 320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments: 330c1bc742181ded4930842b46e9507372f0b1b963James Dong * 340c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcDst - pointer to the input macroblock; must be 16-byte aligned. 350c1bc742181ded4930842b46e9507372f0b1b963James Dong * srcdstStep - image width; must be a multiple of 16. 360c1bc742181ded4930842b46e9507372f0b1b963James Dong * pAlpha - pointer to a 2x2 table of alpha thresholds, organized as 370c1bc742181ded4930842b46e9507372f0b1b963James Dong * follows: {external vertical edge, internal vertical edge, 380c1bc742181ded4930842b46e9507372f0b1b963James Dong * external horizontal edge, internal horizontal edge }. Per 390c1bc742181ded4930842b46e9507372f0b1b963James Dong * [ISO14496-10] alpha values must be in the range [0,255]. 400c1bc742181ded4930842b46e9507372f0b1b963James Dong * pBeta - pointer to a 2x2 table of beta thresholds, organized as follows: 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * {external vertical edge, internal vertical edge, external 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * horizontal edge, internal horizontal edge }. Per [ISO14496-10] 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * beta values must be in the range [0,18]. 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * pThresholds - pointer to a 16x2 table of threshold (TC0), organized as 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * follows: {values for the left or above edge of each 4x4 block, 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * arranged in vertical block order and then in horizontal block 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * order}; must be aligned on a 4-byte boundary. Per [ISO14496-10] 480c1bc742181ded4930842b46e9507372f0b1b963James Dong * values must be in the range [0,25]. 490c1bc742181ded4930842b46e9507372f0b1b963James Dong * pBS - pointer to a 16x2 table of BS parameters arranged in scan block 500c1bc742181ded4930842b46e9507372f0b1b963James Dong * order for vertical edges and then horizontal edges; valid in the 510c1bc742181ded4930842b46e9507372f0b1b963James Dong * range [0,4] with the following restrictions: i) pBS[i]== 4 may 520c1bc742181ded4930842b46e9507372f0b1b963James Dong * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 530c1bc742181ded4930842b46e9507372f0b1b963James Dong * 4. Must be 4-byte aligned. 540c1bc742181ded4930842b46e9507372f0b1b963James Dong * 550c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments: 560c1bc742181ded4930842b46e9507372f0b1b963James Dong * 570c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcDst - pointer to filtered output macroblock. 580c1bc742181ded4930842b46e9507372f0b1b963James Dong * 590c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 600c1bc742181ded4930842b46e9507372f0b1b963James Dong * 610c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr - no error 620c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr - bad arguments 630c1bc742181ded4930842b46e9507372f0b1b963James Dong * - one or more of the following pointers is NULL: pSrcDst, pAlpha, 640c1bc742181ded4930842b46e9507372f0b1b963James Dong * pBeta, pThresholds or pBS. pSrcDst is not 16-byte aligned. 650c1bc742181ded4930842b46e9507372f0b1b963James Dong * either pThresholds or pBS is not aligned on a 4-byte boundary. 660c1bc742181ded4930842b46e9507372f0b1b963James Dong * - one or more entries in the table pAlpha[0..3] is outside the range 670c1bc742181ded4930842b46e9507372f0b1b963James Dong * [0,255]. 680c1bc742181ded4930842b46e9507372f0b1b963James Dong * - one or more entries in the table pBeta[0..3] is outside the range 690c1bc742181ded4930842b46e9507372f0b1b963James Dong * [0,18]. 700c1bc742181ded4930842b46e9507372f0b1b963James Dong * - one or more entries in the table pThresholds[0..31]is outside of 710c1bc742181ded4930842b46e9507372f0b1b963James Dong * the range [0,25]. 720c1bc742181ded4930842b46e9507372f0b1b963James Dong * - pBS is out of range, i.e., one of the following conditions is true: 730c1bc742181ded4930842b46e9507372f0b1b963James Dong * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 740c1bc742181ded4930842b46e9507372f0b1b963James Dong * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 750c1bc742181ded4930842b46e9507372f0b1b963James Dong * - srcdstStep is not a multiple of 16. 760c1bc742181ded4930842b46e9507372f0b1b963James Dong * 770c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 780c1bc742181ded4930842b46e9507372f0b1b963James Dong 790c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_DeblockLuma_I( 800c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8* pSrcDst, 810c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S32 srcdstStep, 820c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8* pAlpha, 830c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8* pBeta, 840c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8* pThresholds, 850c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pBS 860c1bc742181ded4930842b46e9507372f0b1b963James Dong) 870c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 880c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXResult errorCode; 890c1bc742181ded4930842b46e9507372f0b1b963James Dong 900c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); 910c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(armNot16ByteAligned(pSrcDst), OMX_Sts_BadArgErr); 920c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(srcdstStep & 15, OMX_Sts_BadArgErr); 930c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pAlpha == NULL, OMX_Sts_BadArgErr); 940c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pBeta == NULL, OMX_Sts_BadArgErr); 950c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pThresholds == NULL, OMX_Sts_BadArgErr); 960c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(armNot4ByteAligned(pThresholds), OMX_Sts_BadArgErr); 970c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pBS == NULL, OMX_Sts_BadArgErr); 980c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(armNot4ByteAligned(pBS), OMX_Sts_BadArgErr); 990c1bc742181ded4930842b46e9507372f0b1b963James Dong 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong errorCode = omxVCM4P10_FilterDeblockingLuma_VerEdge_I( 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst, srcdstStep, pAlpha, pBeta, pThresholds, pBS); 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(errorCode != OMX_Sts_NoErr, errorCode) 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong errorCode = omxVCM4P10_FilterDeblockingLuma_HorEdge_I( 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst, srcdstStep, pAlpha+2, pBeta+2, pThresholds+16, pBS+16); 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong return errorCode; 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong} 110