10c1bc742181ded4930842b46e9507372f0b1b963James Dong; ********** 20c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong; * File Name: omxVCM4P2_PredictReconCoefIntra_s.s 40c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OpenMAX DL: v1.0.2 50c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Revision: 9641 60c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Date: Thursday, February 7, 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 module for DC/AC coefficient prediction 140c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 150c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 160c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Function: omxVCM4P2_PredictReconCoefIntra 170c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 180c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Description: 190c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Performs adaptive DC/AC coefficient prediction for an intra block. Prior 200c1bc742181ded4930842b46e9507372f0b1b963James Dong; * to the function call, prediction direction (predDir) should be selected 210c1bc742181ded4930842b46e9507372f0b1b963James Dong; * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2. 220c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 230c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Remarks: 240c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 250c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Parameters: 260c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] pSrcDst pointer to the coefficient buffer which contains the 270c1bc742181ded4930842b46e9507372f0b1b963James Dong; * quantized coefficient residuals (PQF) of the current 280c1bc742181ded4930842b46e9507372f0b1b963James Dong; * block; must be aligned on a 4-byte boundary. The 290c1bc742181ded4930842b46e9507372f0b1b963James Dong; * output coefficients are saturated to the range 300c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [-2048, 2047]. 310c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] pPredBufRow pointer to the coefficient row buffer; must be aligned 320c1bc742181ded4930842b46e9507372f0b1b963James Dong; * on a 4-byte boundary. 330c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] pPredBufCol pointer to the coefficient column buffer; must be 340c1bc742181ded4930842b46e9507372f0b1b963James Dong; * aligned on a 4-byte boundary. 350c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] curQP quantization parameter of the current block. curQP may 360c1bc742181ded4930842b46e9507372f0b1b963James Dong; * equal to predQP especially when the current block and 370c1bc742181ded4930842b46e9507372f0b1b963James Dong; * the predictor block are in the same macroblock. 380c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] predQP quantization parameter of the predictor block 390c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] predDir indicates the prediction direction which takes one 400c1bc742181ded4930842b46e9507372f0b1b963James Dong; * of the following values: 410c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_VIDEO_HORIZONTAL predict horizontally 420c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_VIDEO_VERTICAL predict vertically 430c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] ACPredFlag a flag indicating if AC prediction should be 440c1bc742181ded4930842b46e9507372f0b1b963James Dong; * performed. It is equal to ac_pred_flag in the bit 450c1bc742181ded4930842b46e9507372f0b1b963James Dong; * stream syntax of MPEG-4 460c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [in] videoComp video component type (luminance, chrominance or 470c1bc742181ded4930842b46e9507372f0b1b963James Dong; * alpha) of the current block 480c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out] pSrcDst pointer to the coefficient buffer which contains 490c1bc742181ded4930842b46e9507372f0b1b963James Dong; * the quantized coefficients (QF) of the current 500c1bc742181ded4930842b46e9507372f0b1b963James Dong; * block 510c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out] pPredBufRow pointer to the updated coefficient row buffer 520c1bc742181ded4930842b46e9507372f0b1b963James Dong; * [out] pPredBufCol pointer to the updated coefficient column buffer 530c1bc742181ded4930842b46e9507372f0b1b963James Dong; * Return Value: 540c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_NoErr - no error 550c1bc742181ded4930842b46e9507372f0b1b963James Dong; * OMX_Sts_BadArgErr - Bad arguments 560c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - At least one of the pointers is NULL: pSrcDst, pPredBufRow, or pPredBufCol. 570c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - At least one the following cases: curQP <= 0, predQP <= 0, curQP >31, 580c1bc742181ded4930842b46e9507372f0b1b963James Dong; * predQP > 31, preDir exceeds [1,2]. 590c1bc742181ded4930842b46e9507372f0b1b963James Dong; * - At least one of the pointers pSrcDst, pPredBufRow, or pPredBufCol is not 600c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 4-byte aligned. 610c1bc742181ded4930842b46e9507372f0b1b963James Dong; * 620c1bc742181ded4930842b46e9507372f0b1b963James Dong; ********* 630c1bc742181ded4930842b46e9507372f0b1b963James Dong 640c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE omxtypes_s.h 650c1bc742181ded4930842b46e9507372f0b1b963James Dong INCLUDE armCOMM_s.h 660c1bc742181ded4930842b46e9507372f0b1b963James Dong 670c1bc742181ded4930842b46e9507372f0b1b963James Dong M_VARIANTS ARM1136JS 680c1bc742181ded4930842b46e9507372f0b1b963James Dong 690c1bc742181ded4930842b46e9507372f0b1b963James Dong 700c1bc742181ded4930842b46e9507372f0b1b963James Dong 710c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT armVCM4P2_Reciprocal_QP_S32 720c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT armVCM4P2_Reciprocal_QP_S16 730c1bc742181ded4930842b46e9507372f0b1b963James Dong IMPORT armVCM4P2_DCScaler 740c1bc742181ded4930842b46e9507372f0b1b963James Dong 750c1bc742181ded4930842b46e9507372f0b1b963James Dong 760c1bc742181ded4930842b46e9507372f0b1b963James Dong 770c1bc742181ded4930842b46e9507372f0b1b963James Dong IF ARM1136JS 780c1bc742181ded4930842b46e9507372f0b1b963James Dong 790c1bc742181ded4930842b46e9507372f0b1b963James Dong 800c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Input Arguments 810c1bc742181ded4930842b46e9507372f0b1b963James Dong 820c1bc742181ded4930842b46e9507372f0b1b963James DongpSrcDst RN 0 830c1bc742181ded4930842b46e9507372f0b1b963James DongpPredBufRow RN 1 840c1bc742181ded4930842b46e9507372f0b1b963James DongpPredBufCol RN 2 850c1bc742181ded4930842b46e9507372f0b1b963James DongcurQP RN 3 860c1bc742181ded4930842b46e9507372f0b1b963James DongQP RN 3 870c1bc742181ded4930842b46e9507372f0b1b963James DongpredQP RN 4 880c1bc742181ded4930842b46e9507372f0b1b963James DongpredDir RN 5 890c1bc742181ded4930842b46e9507372f0b1b963James DongACPredFlag RN 6 900c1bc742181ded4930842b46e9507372f0b1b963James DongvideoComp RN 7 910c1bc742181ded4930842b46e9507372f0b1b963James Dong 920c1bc742181ded4930842b46e9507372f0b1b963James Dong;// Local Variables 930c1bc742181ded4930842b46e9507372f0b1b963James Dong 940c1bc742181ded4930842b46e9507372f0b1b963James Dongtemp2 RN 5 950c1bc742181ded4930842b46e9507372f0b1b963James DongnegCurQP RN 7 960c1bc742181ded4930842b46e9507372f0b1b963James DongnegdcScaler RN 7 970c1bc742181ded4930842b46e9507372f0b1b963James DongtempPred RN 8 980c1bc742181ded4930842b46e9507372f0b1b963James Dong 990c1bc742181ded4930842b46e9507372f0b1b963James DongdcScaler RN 4 1000c1bc742181ded4930842b46e9507372f0b1b963James DongCoeffTable RN 9 1010c1bc742181ded4930842b46e9507372f0b1b963James DongabsCoeffDC RN 9 1020c1bc742181ded4930842b46e9507372f0b1b963James Dongtemp3 RN 6 1030c1bc742181ded4930842b46e9507372f0b1b963James DongabsCoeffAC RN 6 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong 1050c1bc742181ded4930842b46e9507372f0b1b963James DongshortVideoHeader RN 9 1060c1bc742181ded4930842b46e9507372f0b1b963James DongpredCoeffTable RN 10 1070c1bc742181ded4930842b46e9507372f0b1b963James DongCount RN 10 1080c1bc742181ded4930842b46e9507372f0b1b963James Dongtemp1 RN 12 1090c1bc742181ded4930842b46e9507372f0b1b963James Dongindex RN 12 1100c1bc742181ded4930842b46e9507372f0b1b963James DongRem RN 14 1110c1bc742181ded4930842b46e9507372f0b1b963James Dongtemp RN 11 1120c1bc742181ded4930842b46e9507372f0b1b963James DongReturn RN 0 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong M_START omxVCM4P2_PredictReconCoefIntra,r12 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Assigning pointers to Input arguments on Stack 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG predQPonStack,4 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG predDironStack,4 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG ACPredFlagonStack,4 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong M_ARG videoComponStack,4 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// DC Prediction 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR videoComp,videoComponStack ;// Load videoComp From Stack 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR predDir,predDironStack ;// Load Prediction direction 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// dcScaler Calculation 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR index, =armVCM4P2_DCScaler 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD index,index,videoComp,LSL #5 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRB dcScaler,[index,QP] 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong 1380c1bc742181ded4930842b46e9507372f0b1b963James DongcalDCVal 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR predCoeffTable, =armVCM4P2_Reciprocal_QP_S16 ;// Loading the table with entries 32767/(1 to 63) 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP predDir,#2 ;// Check if the Prediction direction is vertical 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Caulucate temp pred by performing Division 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong LDREQSH absCoeffDC,[pPredBufRow] ;// If vetical load the coeff from Row Prediction Buffer 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRNESH absCoeffDC,[pPredBufCol] ;// If horizontal load the coeff from column Prediction Buffer 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong RSB negdcScaler,dcScaler,#0 ;// negdcScaler=-dcScaler 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV temp1,absCoeffDC ;// temp1=prediction coeff 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP temp1,#0 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT absCoeffDC,temp1,#0 ;//absCoeffDC=abs(temp1) 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD temp,dcScaler,dcScaler 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[predCoeffTable,temp] ;// Load value from coeff table for performing division using multiplication 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB tempPred,temp,absCoeffDC ;// tempPred=pPredBufRow(Col)[0]*32767/dcScaler 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD temp3,dcScaler,#1 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong LSR tempPred,tempPred,#15 ;// tempPred=pPredBufRow(Col)[0]/dcScaler 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong LSR temp3,temp3,#1 ;// temp3=round(dcScaler/2) 1630c1bc742181ded4930842b46e9507372f0b1b963James Dong 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong MLA Rem,negdcScaler,tempPred,absCoeffDC ;// Rem = pPredBufRow(Col)[0]-tempPred*dcScaler 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[pPredBufCol] 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP Rem,temp3 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong ADDGE tempPred,#1 ;// If Rem>=round(dcScaler/2);tempPred=tempPred+1 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP temp1,#0 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT tempPred,tempPred,#0 ;/ if pPredBufRow(Col)[0]<0; tempPred=-tempPred 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong 1740c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pPredBufRow,#-16] 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[pSrcDst] ;// temp=pSrcDst[0] 1770c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR ACPredFlag,ACPredFlagonStack 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD temp,temp,tempPred ;// temp=pSrcDst[0]+tempPred 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT16 temp,#12,temp ;// clip temp to [-2048,2047] 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB temp1,temp,dcScaler ;// temp1=clipped(pSrcDst[0])*dcScaler 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong M_LDR predQP,predQPonStack 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pSrcDst] 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP ACPredFlag,#1 ;// Check if the AC prediction flag is set or not 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp1,[pPredBufCol] ;// store temp1 to pPredBufCol 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// AC Prediction 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong BNE Exit ;// If not set Exit 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR predCoeffTable, =armVCM4P2_Reciprocal_QP_S32 ;// Loading the table with entries 0x1ffff/(1 to 63) 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV temp1,#4 1940c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL temp1,curQP,temp1 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP predDir,#2 ;// Check the Prediction direction 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong RSB negCurQP,curQP,#0 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong LDR CoeffTable,[predCoeffTable,temp1] ;// CoeffTable=0x1ffff/curQP 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD curQP,curQP,#1 ;// curQP=curQP+1 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong LSR curQP,curQP,#1 ;// curQP=round(curQP/2) 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Count,#2 ;// Initializing the Loop Count 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong BNE Horizontal ;// If the Prediction direction is horizontal branch to Horizontal 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong 2030c1bc742181ded4930842b46e9507372f0b1b963James Dong 2040c1bc742181ded4930842b46e9507372f0b1b963James Dong 2050c1bc742181ded4930842b46e9507372f0b1b963James Dongloop1 2060c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Calculate tempPred 2070c1bc742181ded4930842b46e9507372f0b1b963James Dong 2080c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRSH absCoeffAC,[pPredBufRow,Count] ;// absCoeffAC=pPredBufRow[i], 1=<i<=7 2090c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV temp1,absCoeffAC 2100c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP temp1,#0 ;// compare pPredBufRow[i] with zero, 1=<i<=7 2110c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT absCoeffAC,temp1,#0 ;// absCoeffAC= abs(pPredBufRow[i]) 2120c1bc742181ded4930842b46e9507372f0b1b963James Dong 2130c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB absCoeffAC,absCoeffAC,predQP ;// temp1=pPredBufRow[i]*predQP 2140c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL tempPred,absCoeffAC,CoeffTable ;// tempPred=pPredBufRow[i]*predQP*0x1ffff/curQP 2150c1bc742181ded4930842b46e9507372f0b1b963James Dong LSR tempPred,tempPred,#17 2160c1bc742181ded4930842b46e9507372f0b1b963James Dong 2170c1bc742181ded4930842b46e9507372f0b1b963James Dong MLA Rem,negCurQP,tempPred,absCoeffAC ;// Rem=abs(pPredBufRow[i])-tempPred*curQP 2180c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[pSrcDst,Count] ;// temp=pSrcDst[i],1<=i<8 2190c1bc742181ded4930842b46e9507372f0b1b963James Dong 2200c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP Rem,curQP 2210c1bc742181ded4930842b46e9507372f0b1b963James Dong ADDGE tempPred,#1 ;// if Rem>=round(curQP/2); tempPred=tempPred+1 2220c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP temp1,#0 2230c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT tempPred,tempPred,#0 ;// if pPredBufRow[i]<0 ; tempPred=-tempPred 2240c1bc742181ded4930842b46e9507372f0b1b963James Dong 2250c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Update source and Row Prediction buffers 2260c1bc742181ded4930842b46e9507372f0b1b963James Dong 2270c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD temp,temp,tempPred ;// temp=tempPred+pSrcDst[i] 2280c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT16 temp,#12,temp ;// Clip temp to [-2048,2047] 2290c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pSrcDst,Count] 2300c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pPredBufRow,Count] ;// pPredBufRow[i]=temp 2310c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD Count,Count,#2 ;// i=i+1 2320c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP Count,#16 ;// compare if i=8 2330c1bc742181ded4930842b46e9507372f0b1b963James Dong BLT loop1 2340c1bc742181ded4930842b46e9507372f0b1b963James Dong B Exit ;// Branch to exit 2350c1bc742181ded4930842b46e9507372f0b1b963James Dong 2360c1bc742181ded4930842b46e9507372f0b1b963James DongHorizontal 2370c1bc742181ded4930842b46e9507372f0b1b963James Dong 2380c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Count,#16 ;// Initializing i=8 2390c1bc742181ded4930842b46e9507372f0b1b963James Dong 2400c1bc742181ded4930842b46e9507372f0b1b963James Dongloop2 2410c1bc742181ded4930842b46e9507372f0b1b963James Dong 2420c1bc742181ded4930842b46e9507372f0b1b963James Dong LSR temp2,Count,#3 ;// temp2=i>>3 2430c1bc742181ded4930842b46e9507372f0b1b963James Dong 2440c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Calculate tempPred 2450c1bc742181ded4930842b46e9507372f0b1b963James Dong 2460c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH absCoeffAC,[pPredBufCol,temp2] ;// absCoefAC=pPredBufCol[i>>3] 2470c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV temp1,absCoeffAC 2480c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP temp1,#0 ;// compare pPredBufRow[i] with zero, 1=<i<=7 2490c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT absCoeffAC,temp1,#0 ;// absCoeffAC=abs(pPredBufCol[i>>3]) 2500c1bc742181ded4930842b46e9507372f0b1b963James Dong 2510c1bc742181ded4930842b46e9507372f0b1b963James Dong SMULBB absCoeffAC,absCoeffAC,predQP ;// temp1=pPredBufCol[i>>3]*predQP 2520c1bc742181ded4930842b46e9507372f0b1b963James Dong MUL tempPred,absCoeffAC,CoeffTable ;// tempPred=pPredBufCol[i>>3]*predQP*0x1ffff/curQP 2530c1bc742181ded4930842b46e9507372f0b1b963James Dong LSR tempPred,tempPred,#17 ;// tempPred=pPredBufCol[i>>3]*predQP/curQP 2540c1bc742181ded4930842b46e9507372f0b1b963James Dong 2550c1bc742181ded4930842b46e9507372f0b1b963James Dong MLA Rem,negCurQP,tempPred,absCoeffAC 2560c1bc742181ded4930842b46e9507372f0b1b963James Dong LDRH temp,[pSrcDst,Count] ;// temp=pSrcDst[i] 2570c1bc742181ded4930842b46e9507372f0b1b963James Dong 2580c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP Rem,curQP ;// Compare Rem with round(curQP/2) 2590c1bc742181ded4930842b46e9507372f0b1b963James Dong ADDGE tempPred,#1 ;// tempPred=tempPred+1 if Rem>=round(curQP/2) 2600c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP temp1,#0 2610c1bc742181ded4930842b46e9507372f0b1b963James Dong RSBLT tempPred,tempPred,#0 ;// if pPredBufCol[i>>3 <0 tempPred=-tempPred 2620c1bc742181ded4930842b46e9507372f0b1b963James Dong 2630c1bc742181ded4930842b46e9507372f0b1b963James Dong ;// Update source and Row Prediction buffers 2640c1bc742181ded4930842b46e9507372f0b1b963James Dong 2650c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD temp,temp,tempPred ;// temp=pSrcDst[i]+tempPred 2660c1bc742181ded4930842b46e9507372f0b1b963James Dong SSAT16 temp,#12,temp ;// Clip temp to [-2048,2047] 2670c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pSrcDst,Count] ;// pSrcDst[0]= clipped value 2680c1bc742181ded4930842b46e9507372f0b1b963James Dong STRH temp,[pPredBufCol,temp2] ;// pPredBufCol[i>>3]=temp 2690c1bc742181ded4930842b46e9507372f0b1b963James Dong ADD Count,Count,#16 ;// i=i+8 2700c1bc742181ded4930842b46e9507372f0b1b963James Dong CMP Count,#128 ;// compare i with 64 2710c1bc742181ded4930842b46e9507372f0b1b963James Dong BLT loop2 2720c1bc742181ded4930842b46e9507372f0b1b963James Dong 2730c1bc742181ded4930842b46e9507372f0b1b963James Dong 2740c1bc742181ded4930842b46e9507372f0b1b963James DongExit 2750c1bc742181ded4930842b46e9507372f0b1b963James Dong 2760c1bc742181ded4930842b46e9507372f0b1b963James Dong MOV Return,#OMX_Sts_NoErr 2770c1bc742181ded4930842b46e9507372f0b1b963James Dong 2780c1bc742181ded4930842b46e9507372f0b1b963James Dong M_END 2790c1bc742181ded4930842b46e9507372f0b1b963James Dong ENDIF 2800c1bc742181ded4930842b46e9507372f0b1b963James Dong END 2810c1bc742181ded4930842b46e9507372f0b1b963James Dong 2820c1bc742181ded4930842b46e9507372f0b1b963James Dong 2830c1bc742181ded4930842b46e9507372f0b1b963James Dong 284