1bebc99d6fa433c04139294a5057f8439d772dbd9James Dong/**
2bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
3bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * File Name:  omxVCM4P2_TransRecBlockCoef_intra.c
4bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * OpenMAX DL: v1.0.2
5bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Revision:   9641
6bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Date:       Thursday, February 7, 2008
7bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
8bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
9bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
10bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
11bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
12bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Description:
13bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Contains modules DCT->quant and reconstructing the intra texture data
14bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
15bebc99d6fa433c04139294a5057f8439d772dbd9James Dong */
16bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
17bebc99d6fa433c04139294a5057f8439d772dbd9James Dong#include "omxtypes.h"
18bebc99d6fa433c04139294a5057f8439d772dbd9James Dong#include "armOMX.h"
19bebc99d6fa433c04139294a5057f8439d772dbd9James Dong#include "omxVC.h"
20bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
21bebc99d6fa433c04139294a5057f8439d772dbd9James Dong#include "armCOMM.h"
22bebc99d6fa433c04139294a5057f8439d772dbd9James Dong#include "armVC.h"
23bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
24bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
25bebc99d6fa433c04139294a5057f8439d772dbd9James Dong/**
26bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Function:  omxVCM4P2_TransRecBlockCoef_intra   (6.2.4.4.4)
27bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
28bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Description:
29bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Quantizes the DCT coefficients, implements intra block AC/DC coefficient
30bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * prediction, and reconstructs the current intra block texture for prediction
31bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * on the next frame.  Quantized row and column coefficients are returned in
32bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * the updated coefficient buffers.
33bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
34bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Input Arguments:
35bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
36bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pSrc - pointer to the pixels of current intra block; must be aligned on
37bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            an 8-byte boundary.
38bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pPredBufRow - pointer to the coefficient row buffer containing
39bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16.
40bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            Coefficients are organized into blocks of eight as described
41bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            below (Internal Prediction Coefficient Update Procedures).  The
42bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            DC coefficient is first, and the remaining buffer locations
43bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            contain the quantized AC coefficients. Each group of eight row
44bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            buffer elements combined with one element eight elements ahead
45bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            contains the coefficient predictors of the neighboring block
46bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            that is spatially above or to the left of the block currently to
47bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            be decoded. A negative-valued DC coefficient indicates that this
48bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            neighboring block is not INTRA-coded or out of bounds, and
49bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            therefore the AC and DC coefficients are invalid.  Pointer must
50bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            be aligned on an 8-byte boundary.
51bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pPredBufCol - pointer to the prediction coefficient column buffer
52bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            containing 16 elements of type OMX_S16. Coefficients are
53bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            organized as described in section 6.2.2.5.  Pointer must be
54bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            aligned on an 8-byte boundary.
55bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pSumErr - pointer to a flag indicating whether or not AC prediction is
56bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            required; AC prediction is enabled if *pSumErr >=0, but the
57bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            value is not used for coefficient prediction, i.e., the sum of
58bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            absolute differences starts from 0 for each call to this
59bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            function.  Otherwise AC prediction is disabled if *pSumErr < 0 .
60bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   blockIndex - block index indicating the component type and position, as
61bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            defined in [ISO14496-2], subclause 6.1.3.8.
62bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   curQp - quantization parameter of the macroblock to which the current
63bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            block belongs
64bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0]
65bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            contains the quantization parameter associated with the 8x8
66bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            block left of the current block (QPa), and pQpBuf[1] contains
67bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            the quantization parameter associated with the 8x8 block above
68bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            the current block (QPc).  In the event that the corresponding
69bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            block is outside of the VOP bound, the Qp value will not affect
70bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            the intra prediction process, as described in [ISO14496-2],
71bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            sub-clause 7.4.3.3,  Adaptive AC Coefficient Prediction.
72bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   srcStep - width of the source buffer; must be a multiple of 8.
73bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   dstStep - width of the reconstructed destination buffer; must be a
74bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            multiple of 16.
75bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   shortVideoHeader - binary flag indicating presence of
76bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            short_video_header; shortVideoHeader==1 selects linear intra DC
77bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            mode, and shortVideoHeader==0 selects non linear intra DC mode.
78bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
79bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Output Arguments:
80bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
81bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains
82bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            the predicted DC coefficient; the remaining entries contain the
83bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            quantized AC coefficients (without prediction).  The pointer
84bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            pDstmust be aligned on a 16-byte boundary.
85bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pRec - pointer to the reconstructed texture; must be aligned on an
86bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            8-byte boundary.
87bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pPredBufRow - pointer to the updated coefficient row buffer
88bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pPredBufCol - pointer to the updated coefficient column buffer
89bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pPreACPredict - if prediction is enabled, the parameter points to the
90bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            start of the buffer containing the coefficient differences for
91bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            VLC encoding. The entry pPreACPredict[0]indicates prediction
92bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            direction for the current block and takes one of the following
93bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or
94bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            OMX_VC_VERTICAL.  The entries
95bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            pPreACPredict[1]-pPreACPredict[7]contain predicted AC
96bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            coefficients.  If prediction is disabled (*pSumErr<0) then the
97bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            contents of this buffer are undefined upon return from the
98bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            function
99bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *   pSumErr - pointer to the value of the accumulated AC coefficient errors,
100bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            i.e., sum of the absolute differences between predicted and
101bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *            unpredicted AC coefficients
102bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
103bebc99d6fa433c04139294a5057f8439d772dbd9James Dong * Return Value:
104bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
105bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    OMX_Sts_NoErr - no error
106bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    OMX_Sts_BadArgErr - Bad arguments:
107bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    -    At least one of the following pointers is NULL: pSrc, pDst, pRec,
108bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *         pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr.
109bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    -    blockIndex < 0 or blockIndex >= 10;
110bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    -    curQP <= 0 or curQP >= 32.
111bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    -    srcStep, or dstStep <= 0 or not a multiple of 8.
112bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    -    pDst is not 16-byte aligned: .
113bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *    -    At least one of the following pointers is not 8-byte aligned:
114bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *         pSrc, pRec.
115bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
116bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *  Note: The coefficient buffers must be updated in accordance with the
117bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *        update procedures defined in section in 6.2.2.
118bebc99d6fa433c04139294a5057f8439d772dbd9James Dong *
119bebc99d6fa433c04139294a5057f8439d772dbd9James Dong */
120bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
121bebc99d6fa433c04139294a5057f8439d772dbd9James DongOMXResult omxVCM4P2_TransRecBlockCoef_intra(
122bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     const OMX_U8 *pSrc,
123bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_S16 * pDst,
124bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_U8 * pRec,
125bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_S16 *pPredBufRow,
126bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_S16 *pPredBufCol,
127bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_S16 * pPreACPredict,
128bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_INT *pSumErr,
129bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_INT blockIndex,
130bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_U8 curQp,
131bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     const OMX_U8 *pQpBuf,
132bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_INT srcStep,
133bebc99d6fa433c04139294a5057f8439d772dbd9James Dong     OMX_INT dstStep,
134bebc99d6fa433c04139294a5057f8439d772dbd9James Dong	 OMX_INT shortVideoHeader
135bebc99d6fa433c04139294a5057f8439d772dbd9James Dong)
136bebc99d6fa433c04139294a5057f8439d772dbd9James Dong{
137bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* 64 elements are needed but to align it to 16 bytes need
138bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    8 more elements of padding */
139bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMX_S16 tempBuf1[79], tempBuf2[79];
140bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMX_S16 tempBuf3[79];
141bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMX_S16 *pTempBuf1, *pTempBuf2,*pTempBuf3;
142bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMXVCM4P2VideoComponent videoComp;
143bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMX_U8  flag;
144bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMX_INT x, y, count, predDir;
145bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    OMX_INT predQP, ACPredFlag;
146bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
147bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
148bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* Aligning the local buffers */
149bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    pTempBuf1 = armAlignTo16Bytes(tempBuf1);
150bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    pTempBuf2 = armAlignTo16Bytes(tempBuf2);
151bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    pTempBuf3 = armAlignTo16Bytes(tempBuf3);
152bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
153bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* Argument error checks */
154bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
155bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pRec == NULL, OMX_Sts_BadArgErr);
156bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
157bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
158bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(!armIs8ByteAligned(pRec), OMX_Sts_BadArgErr);
159bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
160bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr);
161bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr);
162bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pPreACPredict == NULL, OMX_Sts_BadArgErr);
163bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pSumErr == NULL, OMX_Sts_BadArgErr);
164bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf(pQpBuf == NULL, OMX_Sts_BadArgErr);
165bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf((srcStep <= 0) || (dstStep <= 0) ||
166bebc99d6fa433c04139294a5057f8439d772dbd9James Dong                (dstStep & 7) || (srcStep & 7)
167bebc99d6fa433c04139294a5057f8439d772dbd9James Dong                , OMX_Sts_BadArgErr);
168bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf((blockIndex < 0) || (blockIndex > 9), OMX_Sts_BadArgErr);
169bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
170bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetArgErrIf((curQp <= 0) || (curQp >=32), OMX_Sts_BadArgErr);
171bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
172bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
173bebc99d6fa433c04139294a5057f8439d772dbd9James Dong   /* Setting the videoComp */
174bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    if (blockIndex <= 3)
175bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
176bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        videoComp = OMX_VC_LUMINANCE;
177bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
178bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    else
179bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
180bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        videoComp = OMX_VC_CHROMINANCE;
181bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
182bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* Converting from 2-d to 1-d buffer */
183bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    for (y = 0, count = 0; y < 8; y++)
184bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
185bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        for(x= 0; x < 8; x++, count++)
186bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        {
187bebc99d6fa433c04139294a5057f8439d772dbd9James Dong            pTempBuf1[count] = pSrc[(y*srcStep) + x];
188bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        }
189bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
190bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
191bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    omxVCM4P2_DCT8x8blk  (pTempBuf1, pTempBuf2);
192bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    omxVCM4P2_QuantIntra_I(
193bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pTempBuf2,
194bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        curQp,
195bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        blockIndex,
196bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        shortVideoHeader);
197bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
198bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* Converting from 1-D to 2-D buffer */
199bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    for (y = 0, count = 0; y < 8; y++)
200bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
201bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        for(x = 0; x < 8; x++, count++)
202bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        {
203bebc99d6fa433c04139294a5057f8439d772dbd9James Dong            /* storing tempbuf2 to tempbuf1 */
204bebc99d6fa433c04139294a5057f8439d772dbd9James Dong            pTempBuf1[count] = pTempBuf2[count];
205bebc99d6fa433c04139294a5057f8439d772dbd9James Dong            pDst[(y*dstStep) + x] = pTempBuf2[count];
206bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        }
207bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
208bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
209bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* AC and DC prediction */
210bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armVCM4P2_SetPredDir(
211bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        blockIndex,
212bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pPredBufRow,
213bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pPredBufCol,
214bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        &predDir,
215bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        &predQP,
216bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pQpBuf);
217bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
218bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armRetDataErrIf(((predQP <= 0) || (predQP >= 32)), OMX_Sts_BadArgErr);
219bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
220bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    flag = 1;
221bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    if (*pSumErr < 0)
222bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
223bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        ACPredFlag = 0;
224bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
225bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    else
226bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
227bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        ACPredFlag = 1;
228bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
229bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
230bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    armVCM4P2_ACDCPredict(
231bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pTempBuf2,
232bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pPreACPredict,
233bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pPredBufRow,
234bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pPredBufCol,
235bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        curQp,
236bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        predQP,
237bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        predDir,
238bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        ACPredFlag,
239bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        videoComp,
240bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        flag,
241bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pSumErr);
242bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
243bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    /* Reconstructing the texture data */
244bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    omxVCM4P2_QuantInvIntra_I(
245bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pTempBuf1,
246bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        curQp,
247bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        videoComp,
248bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        shortVideoHeader);
249bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    omxVCM4P2_IDCT8x8blk (pTempBuf1, pTempBuf3);
250bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    for(count = 0; count < 64; count++)
251bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    {
252bebc99d6fa433c04139294a5057f8439d772dbd9James Dong        pRec[count] = armMax(0,pTempBuf3[count]);
253bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    }
254bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
255bebc99d6fa433c04139294a5057f8439d772dbd9James Dong    return OMX_Sts_NoErr;
256bebc99d6fa433c04139294a5057f8439d772dbd9James Dong}
257bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
258bebc99d6fa433c04139294a5057f8439d772dbd9James Dong/* End of file */
259bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
260bebc99d6fa433c04139294a5057f8439d772dbd9James Dong
261