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 * 1678e52bfac041d71ce53b5b13c2abf78af742b09dLajos Molnar */ 170c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 180c1bc742181ded4930842b46e9507372f0b1b963James Dong * 190c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: armVCM4P2_ACDCPredict.c 200c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2 210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision: 9641 220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date: Thursday, February 7, 2008 230c1bc742181ded4930842b46e9507372f0b1b963James Dong * 240c1bc742181ded4930842b46e9507372f0b1b963James Dong * 250c1bc742181ded4930842b46e9507372f0b1b963James Dong * 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Contains module for DC/AC coefficient prediction 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * 300c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 310c1bc742181ded4930842b46e9507372f0b1b963James Dong 320c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 330c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 340c1bc742181ded4930842b46e9507372f0b1b963James Dong 350c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 360c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 370c1bc742181ded4930842b46e9507372f0b1b963James Dong 380c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 390c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_ACDCPredict 400c1bc742181ded4930842b46e9507372f0b1b963James Dong * 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs adaptive DC/AC coefficient prediction for an intra block. Prior 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * to the function call, prediction direction (predDir) should be selected 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2. 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks: 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * 480c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters: 490c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pSrcDst pointer to the coefficient buffer which contains 500c1bc742181ded4930842b46e9507372f0b1b963James Dong * the quantized coefficient residuals (PQF) of the 510c1bc742181ded4930842b46e9507372f0b1b963James Dong * current block 520c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pPredBufRow pointer to the coefficient row buffer 530c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pPredBufCol pointer to the coefficient column buffer 540c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] curQP quantization parameter of the current block. curQP 550c1bc742181ded4930842b46e9507372f0b1b963James Dong * may equal to predQP especially when the current 560c1bc742181ded4930842b46e9507372f0b1b963James Dong * block and the predictor block are in the same 570c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock. 580c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] predQP quantization parameter of the predictor block 590c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] predDir indicates the prediction direction which takes one 600c1bc742181ded4930842b46e9507372f0b1b963James Dong * of the following values: 610c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_VC_HORIZONTAL predict horizontally 620c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_VC_VERTICAL predict vertically 630c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] ACPredFlag a flag indicating if AC prediction should be 640c1bc742181ded4930842b46e9507372f0b1b963James Dong * performed. It is equal to ac_pred_flag in the bit 650c1bc742181ded4930842b46e9507372f0b1b963James Dong * stream syntax of MPEG-4 660c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] videoComp video component type (luminance, chrominance or 670c1bc742181ded4930842b46e9507372f0b1b963James Dong * alpha) of the current block 680c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] flag This flag defines the if one wants to use this functions to 690c1bc742181ded4930842b46e9507372f0b1b963James Dong * calculate PQF (set 1, prediction) or QF (set 0, reconstruction) 700c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pPreACPredict pointer to the predicted coefficients buffer. 710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Filled ONLY if it is not NULL 720c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pSrcDst pointer to the coefficient buffer which contains 730c1bc742181ded4930842b46e9507372f0b1b963James Dong * the quantized coefficients (QF) of the current 740c1bc742181ded4930842b46e9507372f0b1b963James Dong * block 750c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pPredBufRow pointer to the updated coefficient row buffer 760c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pPredBufCol pointer to the updated coefficient column buffer 770c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pSumErr pointer to the updated sum of the difference 780c1bc742181ded4930842b46e9507372f0b1b963James Dong * between predicted and unpredicted coefficients 790c1bc742181ded4930842b46e9507372f0b1b963James Dong * If this is NULL, do not update 800c1bc742181ded4930842b46e9507372f0b1b963James Dong * 810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes. 830c1bc742181ded4930842b46e9507372f0b1b963James Dong * 840c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 850c1bc742181ded4930842b46e9507372f0b1b963James Dong 860c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_ACDCPredict( 870c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pSrcDst, 880c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pPreACPredict, 890c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pPredBufRow, 900c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pPredBufCol, 910c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT curQP, 920c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT predQP, 930c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT predDir, 940c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT ACPredFlag, 950c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXVCM4P2VideoComponent videoComp, 960c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 flag, 970c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT *pSumErr 980c1bc742181ded4930842b46e9507372f0b1b963James Dong) 990c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT dcScaler, i; 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 tempPred; 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Argument error checks */ 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr); 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr); 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(curQP <= 0, OMX_Sts_BadArgErr); 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(predQP <= 0, OMX_Sts_BadArgErr); 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf((predDir != 1) && (predDir != 2), OMX_Sts_BadArgErr); 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs4ByteAligned(pSrcDst), OMX_Sts_BadArgErr); 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs4ByteAligned(pPredBufRow), OMX_Sts_BadArgErr); 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs4ByteAligned(pPredBufCol), OMX_Sts_BadArgErr); 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Set DC scaler value to avoid some compilers giving a warning. */ 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler=0; 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Calculate the DC scaler value */ 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong if (videoComp == OMX_VC_LUMINANCE) 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong if (curQP >= 1 && curQP <= 4) 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = 8; 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong else if (curQP >= 5 && curQP <= 8) 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = 2 * curQP; 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong else if (curQP >= 9 && curQP <= 24) 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = curQP + 8; 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong else 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = (2 * curQP) - 16; 1360c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong else if (videoComp == OMX_VC_CHROMINANCE) 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong if (curQP >= 1 && curQP <= 4) 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = 8; 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong else if (curQP >= 5 && curQP <= 24) 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = (curQP + 13)/2; 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong else 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong dcScaler = curQP - 6; 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong if (pPreACPredict != NULL) 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong pPreACPredict[0] = predDir; 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong if (predDir == OMX_VC_VERTICAL) 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong /* F[0][0]//dc_scaler */ 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong tempPred = armIntDivAwayFromZero(pPredBufRow[0], dcScaler); 1630c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong else 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong /* F[0][0]//dc_scaler */ 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong tempPred = armIntDivAwayFromZero(pPredBufCol[0], dcScaler); 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Updating the DC value to the row and col buffer */ 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong *(pPredBufRow - 8) = *pPredBufCol; 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong if (flag) 1740c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Cal and store F[0][0] into the col buffer */ 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong *pPredBufCol = pSrcDst[0] * dcScaler; 1770c1bc742181ded4930842b46e9507372f0b1b963James Dong 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong /* PQF = QF - F[0][0]//dc_scaler */ 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[0] -= tempPred; 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong else 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong /* QF = PQF + F[0][0]//dc_scaler */ 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[0] += tempPred; 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Saturate */ 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[0] = armClip (-2048, 2047, pSrcDst[0]); 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Cal and store F[0][0] into the col buffer */ 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong *pPredBufCol = pSrcDst[0] * dcScaler; 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong 1940c1bc742181ded4930842b46e9507372f0b1b963James Dong if (ACPredFlag == 1) 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong if (predDir == OMX_VC_VERTICAL) 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong for (i = 1; i < 8; i++) 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong tempPred = armIntDivAwayFromZero \ 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong (pPredBufRow[i] * predQP, curQP); 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong if (flag) 2030c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2040c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Updating QF to the row buff */ 2050c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufRow[i] = pSrcDst[i]; 2060c1bc742181ded4930842b46e9507372f0b1b963James Dong /*PQFX[v][0] = QFX[v][0] - (QFA[v][0] * QPA) // QPX */ 2070c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[i] -= tempPred; 2080c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Sum of absolute values of AC prediction error, this can 2090c1bc742181ded4930842b46e9507372f0b1b963James Dong be used as a reference to choose whether to use 2100c1bc742181ded4930842b46e9507372f0b1b963James Dong AC prediction */ 2110c1bc742181ded4930842b46e9507372f0b1b963James Dong *pSumErr += armAbs(pSrcDst[i]); 2120c1bc742181ded4930842b46e9507372f0b1b963James Dong /* pPreACPredict[1~7] store the error signal 2130c1bc742181ded4930842b46e9507372f0b1b963James Dong after AC prediction */ 2140c1bc742181ded4930842b46e9507372f0b1b963James Dong pPreACPredict[i] = pSrcDst[i]; 2150c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2160c1bc742181ded4930842b46e9507372f0b1b963James Dong else 2170c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2180c1bc742181ded4930842b46e9507372f0b1b963James Dong /*QFX[v][0] = PQFX[v][0] + (QFA[v][0] * QPA) // QPX */ 2190c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[i] += tempPred; 2200c1bc742181ded4930842b46e9507372f0b1b963James Dong 2210c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Saturate */ 2220c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[i] = armClip (-2048, 2047, pSrcDst[i]); 2230c1bc742181ded4930842b46e9507372f0b1b963James Dong 2240c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Updating QF to the row buff */ 2250c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufRow[i] = pSrcDst[i]; 2260c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2270c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2280c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2290c1bc742181ded4930842b46e9507372f0b1b963James Dong else 2300c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2310c1bc742181ded4930842b46e9507372f0b1b963James Dong for (i = 8; i < 64; i += 8) 2320c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2330c1bc742181ded4930842b46e9507372f0b1b963James Dong tempPred = armIntDivAwayFromZero \ 2340c1bc742181ded4930842b46e9507372f0b1b963James Dong (pPredBufCol[i>>3] * predQP, curQP); 2350c1bc742181ded4930842b46e9507372f0b1b963James Dong if (flag) 2360c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2370c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Updating QF to col buff */ 2380c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufCol[i>>3] = pSrcDst[i]; 2390c1bc742181ded4930842b46e9507372f0b1b963James Dong /*PQFX[0][u] = QFX[0][u] - (QFA[0][u] * QPA) // QPX */ 2400c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[i] -= tempPred; 2410c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Sum of absolute values of AC prediction error, this can 2420c1bc742181ded4930842b46e9507372f0b1b963James Dong be used as a reference to choose whether to use AC 2430c1bc742181ded4930842b46e9507372f0b1b963James Dong prediction */ 2440c1bc742181ded4930842b46e9507372f0b1b963James Dong *pSumErr += armAbs(pSrcDst[i]); 2450c1bc742181ded4930842b46e9507372f0b1b963James Dong /* pPreACPredict[1~7] store the error signal 2460c1bc742181ded4930842b46e9507372f0b1b963James Dong after AC prediction */ 2470c1bc742181ded4930842b46e9507372f0b1b963James Dong pPreACPredict[i>>3] = pSrcDst[i]; 2480c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2490c1bc742181ded4930842b46e9507372f0b1b963James Dong else 2500c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2510c1bc742181ded4930842b46e9507372f0b1b963James Dong /*QFX[0][u] = PQFX[0][u] + (QFA[0][u] * QPA) // QPX */ 2520c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[i] += tempPred; 2530c1bc742181ded4930842b46e9507372f0b1b963James Dong 2540c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Saturate */ 2550c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst[i] = armClip (-2048, 2047, pSrcDst[i]); 2560c1bc742181ded4930842b46e9507372f0b1b963James Dong 2570c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Updating QF to col buff */ 2580c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufCol[i>>3] = pSrcDst[i]; 2590c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2600c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2610c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2620c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2630c1bc742181ded4930842b46e9507372f0b1b963James Dong 2640c1bc742181ded4930842b46e9507372f0b1b963James Dong return OMX_Sts_NoErr; 2650c1bc742181ded4930842b46e9507372f0b1b963James Dong} 2660c1bc742181ded4930842b46e9507372f0b1b963James Dong 2670c1bc742181ded4930842b46e9507372f0b1b963James Dong/*End of File*/ 2680c1bc742181ded4930842b46e9507372f0b1b963James Dong 269