10c1bc742181ded4930842b46e9507372f0b1b963James Dong;/** 20c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong; * File Name: omxVCM4P2_QuantInvInter_I_s.s 40c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OpenMAX DL: v1.0.2 50c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Revision: 12290 60c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Date: Wednesday, April 9, 2008 70c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 80c1bc742181ded4930842b46e9507372f0b1b963James Dong; * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 90c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 100c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 110c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 120c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description: 130c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Contains modules for inter reconstruction 140c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 150c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 160c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 170c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 180c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 190c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Function: omxVCM4P2_QuantInvInter_I 200c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 210c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description: 220c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Performs inverse quantization on intra/inter coded block. 230c1bc742181ded4930842b46e9507372f0b1b963James Dong; * This function supports bits_per_pixel = 8. Mismatch control 240c1bc742181ded4930842b46e9507372f0b1b963James Dong; * is performed for the first MPEG-4 mode inverse quantization method. 250c1bc742181ded4930842b46e9507372f0b1b963James Dong; * The output coefficients are clipped to the range: [-2048, 2047]. 260c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Mismatch control is performed for the first inverse quantization method. 270c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 280c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Remarks: 290c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 300c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Parameters: 310c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] pSrcDst pointer to the input (quantized) intra/inter block. Must be 16-byte aligned. 320c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] QP quantization parameter (quantiser_scale) 330c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] videoComp (Intra version only.) Video component type of the 340c1bc742181ded4930842b46e9507372f0b1b963James Dong; * current block. Takes one of the following flags: 350c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE, 360c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_VC_ALPHA. 370c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] shortVideoHeader a flag indicating presence of short_video_header; 380c1bc742181ded4930842b46e9507372f0b1b963James Dong; * shortVideoHeader==1 selects linear intra DC mode, 390c1bc742181ded4930842b46e9507372f0b1b963James Dong; * and shortVideoHeader==0 selects nonlinear intra DC mode. 400c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out] pSrcDst pointer to the output (dequantized) intra/inter block. Must be 16-byte aligned. 410c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 420c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Return Value: 430c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_NoErr - no error 440c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_BadArgErr - bad arguments 450c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - If pSrcDst is NULL or is not 16-byte aligned. 460c1bc742181ded4930842b46e9507372f0b1b963James Dong; * or 470c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - If QP <= 0. 480c1bc742181ded4930842b46e9507372f0b1b963James Dong; * or 490c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA. 500c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 510c1bc742181ded4930842b46e9507372f0b1b963James Dong; */ 520c1bc742181ded4930842b46e9507372f0b1b963James Dong 530c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE omxtypes_s.h 540c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE armCOMM_s.h 550c1bc742181ded4930842b46e9507372f0b1b963James Dong 560c1bc742181ded4930842b46e9507372f0b1b963James Dong M_VARIANTS CortexA8 570c1bc742181ded4930842b46e9507372f0b1b963James Dong 580c1bc742181ded4930842b46e9507372f0b1b963James Dong IF CortexA8 590c1bc742181ded4930842b46e9507372f0b1b963James Dong 600c1bc742181ded4930842b46e9507372f0b1b963James Dong 610c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Arguments 620c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst RN 0 630c1bc742181ded4930842b46e9507372f0b1b963James DongQP RN 1 640c1bc742181ded4930842b46e9507372f0b1b963James Dong 650c1bc742181ded4930842b46e9507372f0b1b963James Dong 660c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables 670c1bc742181ded4930842b46e9507372f0b1b963James DongCount RN 3 680c1bc742181ded4930842b46e9507372f0b1b963James DongdoubleQP RN 4 690c1bc742181ded4930842b46e9507372f0b1b963James DongReturn RN 0 700c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Neon registers 710c1bc742181ded4930842b46e9507372f0b1b963James Dong 720c1bc742181ded4930842b46e9507372f0b1b963James Dong 730c1bc742181ded4930842b46e9507372f0b1b963James DongdQP10 DN D0.S32[0] 740c1bc742181ded4930842b46e9507372f0b1b963James DongqQP1 QN Q0.S32 750c1bc742181ded4930842b46e9507372f0b1b963James Dong 760c1bc742181ded4930842b46e9507372f0b1b963James DongdQP1 DN D0.S16 770c1bc742181ded4930842b46e9507372f0b1b963James DongdMinusQP1 DN D1.S16 780c1bc742181ded4930842b46e9507372f0b1b963James Dong 790c1bc742181ded4930842b46e9507372f0b1b963James DongdCoeff0 DN D2.S16 800c1bc742181ded4930842b46e9507372f0b1b963James DongdCoeff1 DN D3.S16 810c1bc742181ded4930842b46e9507372f0b1b963James Dong 820c1bc742181ded4930842b46e9507372f0b1b963James DongqResult0 QN Q3.S32 830c1bc742181ded4930842b46e9507372f0b1b963James DongdResult0 DN D7.S16 840c1bc742181ded4930842b46e9507372f0b1b963James DongqSign0 QN Q3.S32 850c1bc742181ded4930842b46e9507372f0b1b963James DongdSign0 DN D6.S16 860c1bc742181ded4930842b46e9507372f0b1b963James Dong 870c1bc742181ded4930842b46e9507372f0b1b963James DongqResult1 QN Q4.S32 880c1bc742181ded4930842b46e9507372f0b1b963James DongdResult1 DN D8.S16 890c1bc742181ded4930842b46e9507372f0b1b963James DongqSign1 QN Q4.S32 900c1bc742181ded4930842b46e9507372f0b1b963James DongdSign1 DN D8.S16 910c1bc742181ded4930842b46e9507372f0b1b963James Dong 920c1bc742181ded4930842b46e9507372f0b1b963James Dongd2QP0 DN D10.S32[0] 930c1bc742181ded4930842b46e9507372f0b1b963James Dongq2QP0 QN Q5.S32 940c1bc742181ded4930842b46e9507372f0b1b963James Dongd2QP DN D10.S16 950c1bc742181ded4930842b46e9507372f0b1b963James Dong 960c1bc742181ded4930842b46e9507372f0b1b963James DongdZero0 DN D11.S16 970c1bc742181ded4930842b46e9507372f0b1b963James DongdZero1 DN D12.S16 980c1bc742181ded4930842b46e9507372f0b1b963James DongdConst0 DN D13.S16 990c1bc742181ded4930842b46e9507372f0b1b963James Dong 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START omxVCM4P2_QuantInvInter_I,r4,d13 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD doubleQP,QP,QP ;// doubleQP= 2*QP 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOV d2QP0,doubleQP 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong VDUP q2QP0,d2QP0 ;// Move doubleQP in to a scalar 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong TST QP,#1 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong VLD1 {dCoeff0,dCoeff1},[pSrcDst] ;// Load first 8 values to Coeff0,Coeff1 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBEQ QP,QP,#1 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOV dQP10,QP ;// If QP is even then QP1=QP-1 else QP1=QP 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Count,#64 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong VDUP qQP1,dQP10 ;// Duplicate tempResult with QP1 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN d2QP,q2QP0,#0 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong VEOR dConst0,dConst0,dConst0 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN dQP1,qQP1,#0 ;// QP1 truncated to 16 bits 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong VSUB dMinusQP1,dConst0,dQP1 ;// dMinusQP1=-QP1 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong 1190c1bc742181ded4930842b46e9507372f0b1b963James DongLoop 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//Performing Inverse Quantization 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong VCLT dSign0,dCoeff0, #0 ;// Compare Coefficient 0 against 0 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong VCLT dSign1,dCoeff1, #0 ;// Compare Coefficient 1 against 0 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong VCEQ dZero0,dCoeff0,#0 ;// Compare Coefficient 0 against zero 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong VBSL dSign0,dMinusQP1,dQP1 ;// dSign0 = -QP1 if Coeff0< 0 else QP1 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong VCEQ dZero1,dCoeff1,#0 ;// Compare Coefficient 1 against zero 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong VBSL dSign1,dMinusQP1,dQP1 ;// dSign1 = -QP1 if Coeff1< 0 else QP1 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOVL qSign0,dSign0 ;// Sign extend qSign0 to 32 bits 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOVL qSign1,dSign1 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong VMLAL qResult0,dCoeff0,d2QP ;// qResult0[i]= qCoeff0[i]+qCoeff0[i]*(-2) if Coeff <0 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// qResult0[i]= qCoeff0[i] if Coeff >=0 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong VMLAL qResult1,dCoeff1,d2QP ;// qResult1[i]= qCoeff1[i]+qCoeff1[i]*(-2) if Coeff <0 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// qResult1[i]= qCoeff1[i] if Coeff >=0 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Clip Result to [-2048,2047] 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong VQSHL qResult0,qResult0,#20 ;// clip to [-2048,2047] 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong VQSHL qResult1,qResult1,#20 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHR qResult0,qResult0,#4 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHR qResult1,qResult1,#4 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN dResult0,qResult0,#16 ;// Narrow the clipped Value to Halfword 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN dResult1,qResult1,#16 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong VBIT dResult0,dConst0,dZero0 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong VBIT dResult1,dConst0,dZero1 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong VST1 {dResult0,dResult1},[pSrcDst]! ;// Store the result 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS Count,Count,#8 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong VLD1 {dCoeff0,dCoeff1},[pSrcDst] 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong BGT Loop 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Return,#OMX_Sts_NoErr 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong END 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong 163