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: 9641 210c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Date: Thursday, February 7, 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 ARM1136JS 720c1bc742181ded4930842b46e9507372f0b1b963James Dong 730c1bc742181ded4930842b46e9507372f0b1b963James Dong 740c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT armVCM4P2_DCScaler 750c1bc742181ded4930842b46e9507372f0b1b963James Dong 760c1bc742181ded4930842b46e9507372f0b1b963James Dong 770c1bc742181ded4930842b46e9507372f0b1b963James Dong 780c1bc742181ded4930842b46e9507372f0b1b963James Dong IF ARM1136JS 790c1bc742181ded4930842b46e9507372f0b1b963James Dong 800c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Input Arguments 810c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst RN 0 820c1bc742181ded4930842b46e9507372f0b1b963James DongQP RN 1 830c1bc742181ded4930842b46e9507372f0b1b963James DongvideoComp RN 2 840c1bc742181ded4930842b46e9507372f0b1b963James DongshortVideoHeader RN 3 850c1bc742181ded4930842b46e9507372f0b1b963James Dong 860c1bc742181ded4930842b46e9507372f0b1b963James Dong;//Local Variables 870c1bc742181ded4930842b46e9507372f0b1b963James DongReturn RN 0 880c1bc742181ded4930842b46e9507372f0b1b963James DongdcScaler RN 4 890c1bc742181ded4930842b46e9507372f0b1b963James Dongtemp RN 12 900c1bc742181ded4930842b46e9507372f0b1b963James Dongindex RN 6 910c1bc742181ded4930842b46e9507372f0b1b963James Dong 920c1bc742181ded4930842b46e9507372f0b1b963James DongtempVal21 RN 4 930c1bc742181ded4930842b46e9507372f0b1b963James DongtempVal43 RN 5 940c1bc742181ded4930842b46e9507372f0b1b963James DongQP1 RN 6 950c1bc742181ded4930842b46e9507372f0b1b963James DongX2 RN 7 960c1bc742181ded4930842b46e9507372f0b1b963James DongX3 RN 14 970c1bc742181ded4930842b46e9507372f0b1b963James DongResult1 RN 8 980c1bc742181ded4930842b46e9507372f0b1b963James DongResult2 RN 9 990c1bc742181ded4930842b46e9507372f0b1b963James Dongtwo RN 10 1000c1bc742181ded4930842b46e9507372f0b1b963James DongCount RN 11 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START omxVCM4P2_QuantInvIntra_I,r11 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Perform Inverse Quantization for DC coefficient 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong TEQ shortVideoHeader,#0 ;// Test if short Video Header flag =0 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong MOVNE dcScaler,#8 ;// if shortVideoHeader is non zero dcScaler=8 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong BNE calDCVal 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR index, =armVCM4P2_DCScaler 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD index,index,videoComp,LSL #5 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRB dcScaler,[index,QP] 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong ;//M_CalDCScalar shortVideoHeader,videoComp, QP 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong 1210c1bc742181ded4930842b46e9507372f0b1b963James DongcalDCVal 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[pSrcDst] 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB temp,temp,dcScaler ;// dcCoeff = dcScaler * Quantized DC coefficient(from memory) 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT temp,#12,temp ;// Saturating to 12 bits 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Count,#64 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong TST QP,#1 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRD tempVal21,[pSrcDst] ;// Loads first two values of pSrcDst to tempVal21, 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// next two values to tempVal43 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBEQ QP1,QP,#1 ;// QP1=QP if QP is odd , QP1=QP-1 if QP is even 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong MOVNE QP1,QP 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV two,#2 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong 1400c1bc742181ded4930842b46e9507372f0b1b963James DongLoop 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB X2,tempVal21,two ;// X2= first val(lower 16 bits of tampVal21)*2 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP X2,#0 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X2,X2,#0 ;// X2=absoluteval(first val) 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLABBNE X2,QP,X2,QP1 ;// X2=2*absval(first val)*QP+QP if QP is odd 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// X2=2*absval(first val)*QP+QP-1 if QP is even 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULTB X3,tempVal21,two ;// X3= second val(top 16 bits of tampVal21)*2 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X2,X2,#0 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP X3,#0 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X3,X3,#0 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLABBNE X3,QP,X3,QP1 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X3,X3,#0 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong PKHBT Result1,X2,X3,LSL #16 ;// Result1[0-15]=X2[0-15],Result1[16-31]=X3[16-31] 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB X2,tempVal43,two ;// X2= first val(lower 16 bits of tampVal43)*2 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT16 Result1,#12,Result1 ;// clip to range [-2048,2047] 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP X2,#0 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong 1630c1bc742181ded4930842b46e9507372f0b1b963James Dong 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLE X2,X2,#0 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLABBNE X2,QP,X2,QP1 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULTB X3,tempVal43,two ;// X2= first val(top 16 bits of tampVal21)*2 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X2,X2,#0 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP X3,#0 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRD tempVal21,[pSrcDst,#8] ;// Load next four Values to tempVal21,tempVal43 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X3,X3,#0 1740c1bc742181ded4930842b46e9507372f0b1b963James Dong SMLABBNE X3,QP,X3,QP1 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT X3,X3,#0 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong PKHBT Result2,X2,X3,LSL #16 ;// Result2[0-15]=X2[0-15],Result2[16-31]=X3[16-31] 1770c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT16 Result2,#12,Result2 ;// clip to range [-2048,2047] 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong SUBS Count,Count,#4 ;// Decrement Count by 4 and continue if it has not reached 0 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong STRD Result1,[pSrcDst],#8 ;// Store Double words and increment the pointer to point the next store address 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong BGT Loop 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong SUB pSrcDst,pSrcDst,#128 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Storing the Inverse Quantized DC coefficient 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pSrcDst],#2 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong 1940c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Return,#OMX_Sts_NoErr 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong END 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong 203