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_QuantInvIntra_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; * 340c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Function: omxVCM4P2_QuantInvIntra_I 350c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 360c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description: 370c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Performs inverse quantization on intra/inter coded block. 380c1bc742181ded4930842b46e9507372f0b1b963James Dong; * This function supports bits_per_pixel = 8. Mismatch control 390c1bc742181ded4930842b46e9507372f0b1b963James Dong; * is performed for the first MPEG-4 mode inverse quantization method. 400c1bc742181ded4930842b46e9507372f0b1b963James Dong; * The output coefficients are clipped to the range: [-2048, 2047]. 410c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Mismatch control is performed for the first inverse quantization method. 420c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 430c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Remarks: 440c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 450c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Parameters: 460c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] pSrcDst pointer to the input (quantized) intra/inter block. Must be 16-byte aligned. 470c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] QP quantization parameter (quantiser_scale) 480c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] videoComp (Intra version only.) Video component type of the 490c1bc742181ded4930842b46e9507372f0b1b963James Dong; * current block. Takes one of the following flags: 500c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE, 510c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_VC_ALPHA. 520c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] shortVideoHeader a flag indicating presence of short_video_header; 530c1bc742181ded4930842b46e9507372f0b1b963James Dong; * shortVideoHeader==1 selects linear intra DC mode, 540c1bc742181ded4930842b46e9507372f0b1b963James Dong; * and shortVideoHeader==0 selects nonlinear intra DC mode. 550c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out] pSrcDst pointer to the output (dequantized) intra/inter block. Must be 16-byte aligned. 560c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 570c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Return Value: 580c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_NoErr - no error 590c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_BadArgErr - bad arguments 600c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - If pSrcDst is NULL or is not 16-byte aligned. 610c1bc742181ded4930842b46e9507372f0b1b963James Dong; * or 620c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - If QP <= 0. 630c1bc742181ded4930842b46e9507372f0b1b963James Dong; * or 640c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - videoComp is none of OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE and OMX_VC_ALPHA. 650c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 660c1bc742181ded4930842b46e9507372f0b1b963James Dong 670c1bc742181ded4930842b46e9507372f0b1b963James Dong 680c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE omxtypes_s.h 690c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE armCOMM_s.h 700c1bc742181ded4930842b46e9507372f0b1b963James Dong 710c1bc742181ded4930842b46e9507372f0b1b963James Dong M_VARIANTS CortexA8 720c1bc742181ded4930842b46e9507372f0b1b963James Dong 730c1bc742181ded4930842b46e9507372f0b1b963James Dong 740c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT armVCM4P2_DCScaler 750c1bc742181ded4930842b46e9507372f0b1b963James Dong 760c1bc742181ded4930842b46e9507372f0b1b963James Dong IF CortexA8 770c1bc742181ded4930842b46e9507372f0b1b963James Dong 780c1bc742181ded4930842b46e9507372f0b1b963James Dong 790c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Arguments 800c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst RN 0 810c1bc742181ded4930842b46e9507372f0b1b963James DongQP RN 1 820c1bc742181ded4930842b46e9507372f0b1b963James DongvideoComp RN 2 830c1bc742181ded4930842b46e9507372f0b1b963James DongshortVideoHeader RN 3 840c1bc742181ded4930842b46e9507372f0b1b963James Dong 850c1bc742181ded4930842b46e9507372f0b1b963James Dong 860c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables 870c1bc742181ded4930842b46e9507372f0b1b963James Dong 880c1bc742181ded4930842b46e9507372f0b1b963James DongdcScaler RN 4 890c1bc742181ded4930842b46e9507372f0b1b963James Dongtemp RN 14 900c1bc742181ded4930842b46e9507372f0b1b963James Dongindex RN 5 910c1bc742181ded4930842b46e9507372f0b1b963James Dong 920c1bc742181ded4930842b46e9507372f0b1b963James Dong 930c1bc742181ded4930842b46e9507372f0b1b963James DongCount RN 5 940c1bc742181ded4930842b46e9507372f0b1b963James DongdoubleQP RN 4 950c1bc742181ded4930842b46e9507372f0b1b963James DongReturn RN 0 960c1bc742181ded4930842b46e9507372f0b1b963James Dong 970c1bc742181ded4930842b46e9507372f0b1b963James Dong 980c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Neon registers 990c1bc742181ded4930842b46e9507372f0b1b963James Dong 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong 1010c1bc742181ded4930842b46e9507372f0b1b963James DongdQP10 DN D0.S32[0] 1020c1bc742181ded4930842b46e9507372f0b1b963James DongqQP1 QN Q0.S32 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong 1040c1bc742181ded4930842b46e9507372f0b1b963James DongdQP1 DN D0.S16 1050c1bc742181ded4930842b46e9507372f0b1b963James DongdMinusQP1 DN D1.S16 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong 1070c1bc742181ded4930842b46e9507372f0b1b963James DongdCoeff0 DN D2.S16 1080c1bc742181ded4930842b46e9507372f0b1b963James DongdCoeff1 DN D3.S16 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong 1100c1bc742181ded4930842b46e9507372f0b1b963James DongqResult0 QN Q3.S32 1110c1bc742181ded4930842b46e9507372f0b1b963James DongdResult0 DN D7.S16 1120c1bc742181ded4930842b46e9507372f0b1b963James DongqSign0 QN Q3.S32 1130c1bc742181ded4930842b46e9507372f0b1b963James DongdSign0 DN D6.S16 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong 1150c1bc742181ded4930842b46e9507372f0b1b963James DongqResult1 QN Q4.S32 1160c1bc742181ded4930842b46e9507372f0b1b963James DongdResult1 DN D8.S16 1170c1bc742181ded4930842b46e9507372f0b1b963James DongqSign1 QN Q4.S32 1180c1bc742181ded4930842b46e9507372f0b1b963James DongdSign1 DN D8.S16 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong 1200c1bc742181ded4930842b46e9507372f0b1b963James Dongd2QP0 DN D10.S32[0] 1210c1bc742181ded4930842b46e9507372f0b1b963James Dongq2QP0 QN Q5.S32 1220c1bc742181ded4930842b46e9507372f0b1b963James Dongd2QP DN D10.S16 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong 1240c1bc742181ded4930842b46e9507372f0b1b963James DongdZero0 DN D11.S16 1250c1bc742181ded4930842b46e9507372f0b1b963James DongdZero1 DN D4.S16 1260c1bc742181ded4930842b46e9507372f0b1b963James DongdConst0 DN D5.S16 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START omxVCM4P2_QuantInvIntra_I,r5,d11 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Perform Inverse Quantization for DC coefficient 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong TEQ shortVideoHeader,#0 ;// Test if short Video Header flag =0 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong MOVNE dcScaler,#8 ;// if shortVideoHeader is non zero dcScaler=8 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong BNE calDCVal 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR index, =armVCM4P2_DCScaler 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD index,index,videoComp,LSL #5 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRB dcScaler,[index,QP] 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//M_CalDCScalar shortVideoHeader,videoComp, QP 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong 1480c1bc742181ded4930842b46e9507372f0b1b963James DongcalDCVal 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[pSrcDst] 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB temp,temp,dcScaler ;// dcCoeff = dcScaler * Quantized DC coefficient(from memory) 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT temp,#12,temp ;// Saturating to 12 bits 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Perform Inverse Quantization for Ac Coefficients 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD doubleQP,QP,QP ;// doubleQP= 2*QP 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOV d2QP0,doubleQP 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong VDUP q2QP0,d2QP0 ;// Move doubleQP in to a scalar 1630c1bc742181ded4930842b46e9507372f0b1b963James Dong TST QP,#1 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong VLD1 {dCoeff0,dCoeff1},[pSrcDst] ;// Load first 8 values to Coeff0,Coeff1 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBEQ QP,QP,#1 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOV dQP10,QP ;// If QP is even then QP1=QP-1 else QP1=QP 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Count,#64 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong VDUP qQP1,dQP10 ;// Duplicate tempResult with QP1 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN d2QP,q2QP0,#0 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong VEOR dConst0,dConst0,dConst0 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN dQP1,qQP1,#0 ;// QP1 truncated to 16 bits 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong VSUB dMinusQP1,dConst0,dQP1 ;// dMinusQP1=-QP1 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong 1740c1bc742181ded4930842b46e9507372f0b1b963James DongLoop 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//Performing Inverse Quantization 1770c1bc742181ded4930842b46e9507372f0b1b963James Dong 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong VCLT dSign0,dCoeff0, #0 ;// Compare Coefficient 0 against 0 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong VCLT dSign1,dCoeff1, #0 ;// Compare Coefficient 1 against 0 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong VCEQ dZero0,dCoeff0,#0 ;// Compare Coefficient 0 against zero 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong VBSL dSign0,dMinusQP1,dQP1 ;// dSign0 = -QP1 if Coeff0< 0 else QP1 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong VCEQ dZero1,dCoeff1,#0 ;// Compare Coefficient 1 against zero 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong VBSL dSign1,dMinusQP1,dQP1 ;// dSign1 = -QP1 if Coeff1< 0 else QP1 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOVL qSign0,dSign0 ;// Sign extend qSign0 to 32 bits 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong VMOVL qSign1,dSign1 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong VMLAL qResult0,dCoeff0,d2QP ;// qResult0[i]= qCoeff0[i]+qCoeff0[i]*(-2) if Coeff <0 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// qResult0[i]= qCoeff0[i] if Coeff >=0 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong VMLAL qResult1,dCoeff1,d2QP ;// qResult1[i]= qCoeff1[i]+qCoeff1[i]*(-2) if Coeff <0 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// qResult1[i]= qCoeff1[i] if Coeff >=0 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Clip Result to [-2048,2047] 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong VQSHL qResult0,qResult0,#20 ;// clip to [-2048,2047] 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong VQSHL qResult1,qResult1,#20 1940c1bc742181ded4930842b46e9507372f0b1b963James Dong 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHR qResult0,qResult0,#4 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHR qResult1,qResult1,#4 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN dResult0,qResult0,#16 ;// Narrow the clipped Value to Halfword 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong VSHRN dResult1,qResult1,#16 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong VBIT dResult0,dConst0,dZero0 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong VBIT dResult1,dConst0,dZero1 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong VST1 {dResult0,dResult1},[pSrcDst]! ;// Store the result 2030c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS Count,Count,#8 2040c1bc742181ded4930842b46e9507372f0b1b963James Dong VLD1 {dCoeff0,dCoeff1},[pSrcDst] 2050c1bc742181ded4930842b46e9507372f0b1b963James Dong 2060c1bc742181ded4930842b46e9507372f0b1b963James Dong 2070c1bc742181ded4930842b46e9507372f0b1b963James Dong BGT Loop 2080c1bc742181ded4930842b46e9507372f0b1b963James Dong 2090c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pSrcDst,pSrcDst,#128 2100c1bc742181ded4930842b46e9507372f0b1b963James Dong 2110c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Store the Inverse quantized Dc coefficient 2120c1bc742181ded4930842b46e9507372f0b1b963James Dong 2130c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pSrcDst],#2 2140c1bc742181ded4930842b46e9507372f0b1b963James Dong 2150c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Return,#OMX_Sts_NoErr 2160c1bc742181ded4930842b46e9507372f0b1b963James Dong 2170c1bc742181ded4930842b46e9507372f0b1b963James Dong 2180c1bc742181ded4930842b46e9507372f0b1b963James Dong 2190c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 2200c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2210c1bc742181ded4930842b46e9507372f0b1b963James Dong 2220c1bc742181ded4930842b46e9507372f0b1b963James Dong 2230c1bc742181ded4930842b46e9507372f0b1b963James Dong END 2240c1bc742181ded4930842b46e9507372f0b1b963James Dong 225