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: omxVCM4P2_TransRecBlockCoef_intra.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 modules DCT->quant and reconstructing the intra texture data 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * 300c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 310c1bc742181ded4930842b46e9507372f0b1b963James Dong 320c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 330c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 340c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h" 350c1bc742181ded4930842b46e9507372f0b1b963James Dong 360c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 370c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 380c1bc742181ded4930842b46e9507372f0b1b963James Dong 390c1bc742181ded4930842b46e9507372f0b1b963James Dong 400c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: omxVCM4P2_TransRecBlockCoef_intra (6.2.4.4.4) 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * Quantizes the DCT coefficients, implements intra block AC/DC coefficient 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * prediction, and reconstructs the current intra block texture for prediction 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * on the next frame. Quantized row and column coefficients are returned in 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * the updated coefficient buffers. 480c1bc742181ded4930842b46e9507372f0b1b963James Dong * 490c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments: 500c1bc742181ded4930842b46e9507372f0b1b963James Dong * 510c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrc - pointer to the pixels of current intra block; must be aligned on 520c1bc742181ded4930842b46e9507372f0b1b963James Dong * an 8-byte boundary. 530c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufRow - pointer to the coefficient row buffer containing 540c1bc742181ded4930842b46e9507372f0b1b963James Dong * ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16. 550c1bc742181ded4930842b46e9507372f0b1b963James Dong * Coefficients are organized into blocks of eight as described 560c1bc742181ded4930842b46e9507372f0b1b963James Dong * below (Internal Prediction Coefficient Update Procedures). The 570c1bc742181ded4930842b46e9507372f0b1b963James Dong * DC coefficient is first, and the remaining buffer locations 580c1bc742181ded4930842b46e9507372f0b1b963James Dong * contain the quantized AC coefficients. Each group of eight row 590c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer elements combined with one element eight elements ahead 600c1bc742181ded4930842b46e9507372f0b1b963James Dong * contains the coefficient predictors of the neighboring block 610c1bc742181ded4930842b46e9507372f0b1b963James Dong * that is spatially above or to the left of the block currently to 620c1bc742181ded4930842b46e9507372f0b1b963James Dong * be decoded. A negative-valued DC coefficient indicates that this 630c1bc742181ded4930842b46e9507372f0b1b963James Dong * neighboring block is not INTRA-coded or out of bounds, and 640c1bc742181ded4930842b46e9507372f0b1b963James Dong * therefore the AC and DC coefficients are invalid. Pointer must 650c1bc742181ded4930842b46e9507372f0b1b963James Dong * be aligned on an 8-byte boundary. 660c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufCol - pointer to the prediction coefficient column buffer 670c1bc742181ded4930842b46e9507372f0b1b963James Dong * containing 16 elements of type OMX_S16. Coefficients are 680c1bc742181ded4930842b46e9507372f0b1b963James Dong * organized as described in section 6.2.2.5. Pointer must be 690c1bc742181ded4930842b46e9507372f0b1b963James Dong * aligned on an 8-byte boundary. 700c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSumErr - pointer to a flag indicating whether or not AC prediction is 710c1bc742181ded4930842b46e9507372f0b1b963James Dong * required; AC prediction is enabled if *pSumErr >=0, but the 720c1bc742181ded4930842b46e9507372f0b1b963James Dong * value is not used for coefficient prediction, i.e., the sum of 730c1bc742181ded4930842b46e9507372f0b1b963James Dong * absolute differences starts from 0 for each call to this 740c1bc742181ded4930842b46e9507372f0b1b963James Dong * function. Otherwise AC prediction is disabled if *pSumErr < 0 . 750c1bc742181ded4930842b46e9507372f0b1b963James Dong * blockIndex - block index indicating the component type and position, as 760c1bc742181ded4930842b46e9507372f0b1b963James Dong * defined in [ISO14496-2], subclause 6.1.3.8. 770c1bc742181ded4930842b46e9507372f0b1b963James Dong * curQp - quantization parameter of the macroblock to which the current 780c1bc742181ded4930842b46e9507372f0b1b963James Dong * block belongs 790c1bc742181ded4930842b46e9507372f0b1b963James Dong * pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0] 800c1bc742181ded4930842b46e9507372f0b1b963James Dong * contains the quantization parameter associated with the 8x8 810c1bc742181ded4930842b46e9507372f0b1b963James Dong * block left of the current block (QPa), and pQpBuf[1] contains 820c1bc742181ded4930842b46e9507372f0b1b963James Dong * the quantization parameter associated with the 8x8 block above 830c1bc742181ded4930842b46e9507372f0b1b963James Dong * the current block (QPc). In the event that the corresponding 840c1bc742181ded4930842b46e9507372f0b1b963James Dong * block is outside of the VOP bound, the Qp value will not affect 850c1bc742181ded4930842b46e9507372f0b1b963James Dong * the intra prediction process, as described in [ISO14496-2], 860c1bc742181ded4930842b46e9507372f0b1b963James Dong * sub-clause 7.4.3.3, Adaptive AC Coefficient Prediction. 870c1bc742181ded4930842b46e9507372f0b1b963James Dong * srcStep - width of the source buffer; must be a multiple of 8. 880c1bc742181ded4930842b46e9507372f0b1b963James Dong * dstStep - width of the reconstructed destination buffer; must be a 890c1bc742181ded4930842b46e9507372f0b1b963James Dong * multiple of 16. 900c1bc742181ded4930842b46e9507372f0b1b963James Dong * shortVideoHeader - binary flag indicating presence of 910c1bc742181ded4930842b46e9507372f0b1b963James Dong * short_video_header; shortVideoHeader==1 selects linear intra DC 920c1bc742181ded4930842b46e9507372f0b1b963James Dong * mode, and shortVideoHeader==0 selects non linear intra DC mode. 930c1bc742181ded4930842b46e9507372f0b1b963James Dong * 940c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments: 950c1bc742181ded4930842b46e9507372f0b1b963James Dong * 960c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains 970c1bc742181ded4930842b46e9507372f0b1b963James Dong * the predicted DC coefficient; the remaining entries contain the 980c1bc742181ded4930842b46e9507372f0b1b963James Dong * quantized AC coefficients (without prediction). The pointer 990c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDstmust be aligned on a 16-byte boundary. 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong * pRec - pointer to the reconstructed texture; must be aligned on an 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong * 8-byte boundary. 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufRow - pointer to the updated coefficient row buffer 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufCol - pointer to the updated coefficient column buffer 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPreACPredict - if prediction is enabled, the parameter points to the 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong * start of the buffer containing the coefficient differences for 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong * VLC encoding. The entry pPreACPredict[0]indicates prediction 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong * direction for the current block and takes one of the following 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong * values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_VC_VERTICAL. The entries 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPreACPredict[1]-pPreACPredict[7]contain predicted AC 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients. If prediction is disabled (*pSumErr<0) then the 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong * contents of this buffer are undefined upon return from the 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong * function 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSumErr - pointer to the value of the accumulated AC coefficient errors, 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong * i.e., sum of the absolute differences between predicted and 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong * unpredicted AC coefficients 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong * 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong * 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr - no error 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr - Bad arguments: 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong * - At least one of the following pointers is NULL: pSrc, pDst, pRec, 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong * pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr. 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong * - blockIndex < 0 or blockIndex >= 10; 1250c1bc742181ded4930842b46e9507372f0b1b963James Dong * - curQP <= 0 or curQP >= 32. 1260c1bc742181ded4930842b46e9507372f0b1b963James Dong * - srcStep, or dstStep <= 0 or not a multiple of 8. 1270c1bc742181ded4930842b46e9507372f0b1b963James Dong * - pDst is not 16-byte aligned: . 1280c1bc742181ded4930842b46e9507372f0b1b963James Dong * - At least one of the following pointers is not 8-byte aligned: 1290c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrc, pRec. 1300c1bc742181ded4930842b46e9507372f0b1b963James Dong * 1310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Note: The coefficient buffers must be updated in accordance with the 1320c1bc742181ded4930842b46e9507372f0b1b963James Dong * update procedures defined in section in 6.2.2. 1330c1bc742181ded4930842b46e9507372f0b1b963James Dong * 1340c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 1350c1bc742181ded4930842b46e9507372f0b1b963James Dong 1360c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_TransRecBlockCoef_intra( 1370c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pSrc, 1380c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pDst, 1390c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 * pRec, 1400c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 *pPredBufRow, 1410c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 *pPredBufCol, 1420c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pPreACPredict, 1430c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT *pSumErr, 1440c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT blockIndex, 1450c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 curQp, 1460c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pQpBuf, 1470c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT srcStep, 1480c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT dstStep, 1490c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT shortVideoHeader 1500c1bc742181ded4930842b46e9507372f0b1b963James Dong) 1510c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 1520c1bc742181ded4930842b46e9507372f0b1b963James Dong /* 64 elements are needed but to align it to 16 bytes need 1530c1bc742181ded4930842b46e9507372f0b1b963James Dong 8 more elements of padding */ 1540c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 tempBuf1[79], tempBuf2[79]; 1550c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 tempBuf3[79]; 1560c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 *pTempBuf1, *pTempBuf2,*pTempBuf3; 1570c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXVCM4P2VideoComponent videoComp; 1580c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 flag; 1590c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT x, y, count, predDir; 1600c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT predQP, ACPredFlag; 1610c1bc742181ded4930842b46e9507372f0b1b963James Dong 1620c1bc742181ded4930842b46e9507372f0b1b963James Dong 1630c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Aligning the local buffers */ 1640c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf1 = armAlignTo16Bytes(tempBuf1); 1650c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf2 = armAlignTo16Bytes(tempBuf2); 1660c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf3 = armAlignTo16Bytes(tempBuf3); 1670c1bc742181ded4930842b46e9507372f0b1b963James Dong 1680c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Argument error checks */ 1690c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr); 1700c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pRec == NULL, OMX_Sts_BadArgErr); 1710c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr); 1720c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr); 1730c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs8ByteAligned(pRec), OMX_Sts_BadArgErr); 1740c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr); 1750c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr); 1760c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr); 1770c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPreACPredict == NULL, OMX_Sts_BadArgErr); 1780c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pSumErr == NULL, OMX_Sts_BadArgErr); 1790c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pQpBuf == NULL, OMX_Sts_BadArgErr); 1800c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf((srcStep <= 0) || (dstStep <= 0) || 1810c1bc742181ded4930842b46e9507372f0b1b963James Dong (dstStep & 7) || (srcStep & 7) 1820c1bc742181ded4930842b46e9507372f0b1b963James Dong , OMX_Sts_BadArgErr); 1830c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf((blockIndex < 0) || (blockIndex > 9), OMX_Sts_BadArgErr); 1840c1bc742181ded4930842b46e9507372f0b1b963James Dong 1850c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf((curQp <= 0) || (curQp >=32), OMX_Sts_BadArgErr); 1860c1bc742181ded4930842b46e9507372f0b1b963James Dong 1870c1bc742181ded4930842b46e9507372f0b1b963James Dong 1880c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Setting the videoComp */ 1890c1bc742181ded4930842b46e9507372f0b1b963James Dong if (blockIndex <= 3) 1900c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1910c1bc742181ded4930842b46e9507372f0b1b963James Dong videoComp = OMX_VC_LUMINANCE; 1920c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1930c1bc742181ded4930842b46e9507372f0b1b963James Dong else 1940c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1950c1bc742181ded4930842b46e9507372f0b1b963James Dong videoComp = OMX_VC_CHROMINANCE; 1960c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1970c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Converting from 2-d to 1-d buffer */ 1980c1bc742181ded4930842b46e9507372f0b1b963James Dong for (y = 0, count = 0; y < 8; y++) 1990c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2000c1bc742181ded4930842b46e9507372f0b1b963James Dong for(x= 0; x < 8; x++, count++) 2010c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2020c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf1[count] = pSrc[(y*srcStep) + x]; 2030c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2040c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2050c1bc742181ded4930842b46e9507372f0b1b963James Dong 2060c1bc742181ded4930842b46e9507372f0b1b963James Dong omxVCM4P2_DCT8x8blk (pTempBuf1, pTempBuf2); 2070c1bc742181ded4930842b46e9507372f0b1b963James Dong omxVCM4P2_QuantIntra_I( 2080c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf2, 2090c1bc742181ded4930842b46e9507372f0b1b963James Dong curQp, 2100c1bc742181ded4930842b46e9507372f0b1b963James Dong blockIndex, 2110c1bc742181ded4930842b46e9507372f0b1b963James Dong shortVideoHeader); 2120c1bc742181ded4930842b46e9507372f0b1b963James Dong 2130c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Converting from 1-D to 2-D buffer */ 2140c1bc742181ded4930842b46e9507372f0b1b963James Dong for (y = 0, count = 0; y < 8; y++) 2150c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2160c1bc742181ded4930842b46e9507372f0b1b963James Dong for(x = 0; x < 8; x++, count++) 2170c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2180c1bc742181ded4930842b46e9507372f0b1b963James Dong /* storing tempbuf2 to tempbuf1 */ 2190c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf1[count] = pTempBuf2[count]; 2200c1bc742181ded4930842b46e9507372f0b1b963James Dong pDst[(y*dstStep) + x] = pTempBuf2[count]; 2210c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2220c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2230c1bc742181ded4930842b46e9507372f0b1b963James Dong 2240c1bc742181ded4930842b46e9507372f0b1b963James Dong /* AC and DC prediction */ 2250c1bc742181ded4930842b46e9507372f0b1b963James Dong armVCM4P2_SetPredDir( 2260c1bc742181ded4930842b46e9507372f0b1b963James Dong blockIndex, 2270c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufRow, 2280c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufCol, 2290c1bc742181ded4930842b46e9507372f0b1b963James Dong &predDir, 2300c1bc742181ded4930842b46e9507372f0b1b963James Dong &predQP, 2310c1bc742181ded4930842b46e9507372f0b1b963James Dong pQpBuf); 2320c1bc742181ded4930842b46e9507372f0b1b963James Dong 2330c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetDataErrIf(((predQP <= 0) || (predQP >= 32)), OMX_Sts_BadArgErr); 2340c1bc742181ded4930842b46e9507372f0b1b963James Dong 2350c1bc742181ded4930842b46e9507372f0b1b963James Dong flag = 1; 2360c1bc742181ded4930842b46e9507372f0b1b963James Dong if (*pSumErr < 0) 2370c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2380c1bc742181ded4930842b46e9507372f0b1b963James Dong ACPredFlag = 0; 2390c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2400c1bc742181ded4930842b46e9507372f0b1b963James Dong else 2410c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2420c1bc742181ded4930842b46e9507372f0b1b963James Dong ACPredFlag = 1; 2430c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2440c1bc742181ded4930842b46e9507372f0b1b963James Dong 2450c1bc742181ded4930842b46e9507372f0b1b963James Dong armVCM4P2_ACDCPredict( 2460c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf2, 2470c1bc742181ded4930842b46e9507372f0b1b963James Dong pPreACPredict, 2480c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufRow, 2490c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufCol, 2500c1bc742181ded4930842b46e9507372f0b1b963James Dong curQp, 2510c1bc742181ded4930842b46e9507372f0b1b963James Dong predQP, 2520c1bc742181ded4930842b46e9507372f0b1b963James Dong predDir, 2530c1bc742181ded4930842b46e9507372f0b1b963James Dong ACPredFlag, 2540c1bc742181ded4930842b46e9507372f0b1b963James Dong videoComp, 2550c1bc742181ded4930842b46e9507372f0b1b963James Dong flag, 2560c1bc742181ded4930842b46e9507372f0b1b963James Dong pSumErr); 2570c1bc742181ded4930842b46e9507372f0b1b963James Dong 2580c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Reconstructing the texture data */ 2590c1bc742181ded4930842b46e9507372f0b1b963James Dong omxVCM4P2_QuantInvIntra_I( 2600c1bc742181ded4930842b46e9507372f0b1b963James Dong pTempBuf1, 2610c1bc742181ded4930842b46e9507372f0b1b963James Dong curQp, 2620c1bc742181ded4930842b46e9507372f0b1b963James Dong videoComp, 2630c1bc742181ded4930842b46e9507372f0b1b963James Dong shortVideoHeader); 2640c1bc742181ded4930842b46e9507372f0b1b963James Dong omxVCM4P2_IDCT8x8blk (pTempBuf1, pTempBuf3); 2650c1bc742181ded4930842b46e9507372f0b1b963James Dong for(count = 0; count < 64; count++) 2660c1bc742181ded4930842b46e9507372f0b1b963James Dong { 2670c1bc742181ded4930842b46e9507372f0b1b963James Dong pRec[count] = armMax(0,pTempBuf3[count]); 2680c1bc742181ded4930842b46e9507372f0b1b963James Dong } 2690c1bc742181ded4930842b46e9507372f0b1b963James Dong 2700c1bc742181ded4930842b46e9507372f0b1b963James Dong return OMX_Sts_NoErr; 2710c1bc742181ded4930842b46e9507372f0b1b963James Dong} 2720c1bc742181ded4930842b46e9507372f0b1b963James Dong 2730c1bc742181ded4930842b46e9507372f0b1b963James Dong/* End of file */ 2740c1bc742181ded4930842b46e9507372f0b1b963James Dong 2750c1bc742181ded4930842b46e9507372f0b1b963James Dong 276