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