1 /**
2 *
3 * File Name:  omxVCM4P2_PredictReconCoefIntra.c
4 * OpenMAX DL: v1.0.2
5 * Revision:   9641
6 * Date:       Thursday, February 7, 2008
7 *
8 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
9 *
10 *
11 *
12 * File:        omxVCM4P2_PredictReconCoefIntra_S16.c
13 * Description: Contains modules for AC DC prediction
14 *
15 */
16
17#include "omxtypes.h"
18#include "armOMX.h"
19#include "omxVC.h"
20
21#include "armCOMM.h"
22#include "armVC.h"
23
24/**
25 * Function:  omxVCM4P2_PredictReconCoefIntra   (6.2.5.4.3)
26 *
27 * Description:
28 * Performs adaptive DC/AC coefficient prediction for an intra block.  Prior
29 * to the function call, prediction direction (predDir) should be selected as
30 * specified in [ISO14496-2], subclause 7.4.3.1.
31 *
32 * Input Arguments:
33 *
34 *   pSrcDst - pointer to the coefficient buffer which contains the quantized
35 *            coefficient residuals (PQF) of the current block; must be
36 *            aligned on a 4-byte boundary.  The output coefficients are
37 *            saturated to the range [-2048, 2047].
38 *   pPredBufRow - pointer to the coefficient row buffer; must be aligned on
39 *            a 4-byte boundary.
40 *   pPredBufCol - pointer to the coefficient column buffer; must be aligned
41 *            on a 4-byte boundary.
42 *   curQP - quantization parameter of the current block. curQP may equal to
43 *            predQP especially when the current block and the predictor block
44 *            are in the same macroblock.
45 *   predQP - quantization parameter of the predictor block
46 *   predDir - indicates the prediction direction which takes one of the
47 *            following values: OMX_VC_HORIZONTAL - predict horizontally
48 *            OMX_VC_VERTICAL - predict vertically
49 *   ACPredFlag - a flag indicating if AC prediction should be performed. It
50 *            is equal to ac_pred_flag in the bit stream syntax of MPEG-4
51 *   videoComp - video component type (luminance or chrominance) of the
52 *            current block
53 *
54 * Output Arguments:
55 *
56 *   pSrcDst - pointer to the coefficient buffer which contains the quantized
57 *            coefficients (QF) of the current block
58 *   pPredBufRow - pointer to the updated coefficient row buffer
59 *   pPredBufCol - pointer to the updated coefficient column buffer  Note:
60 *            Buffer update: Update the AC prediction buffer (both row and
61 *            column buffer).
62 *
63 * Return Value:
64 *
65 *    OMX_Sts_NoErr - no error
66 *    OMX_Sts_BadArgErr - bad arguments, if:
67 *        -    At least one of the pointers is NULL:
68 *              pSrcDst, pPredBufRow, or pPredBufCol.
69 *        -    curQP <= 0,
70 *        -    predQP <= 0,
71 *        -    curQP >31,
72 *        -    predQP > 31,
73 *        -    preDir exceeds [1,2]
74 *        -    pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned.
75 *
76 */
77
78OMXResult omxVCM4P2_PredictReconCoefIntra(
79     OMX_S16 * pSrcDst,
80     OMX_S16 * pPredBufRow,
81     OMX_S16 * pPredBufCol,
82     OMX_INT curQP,
83     OMX_INT predQP,
84     OMX_INT predDir,
85     OMX_INT ACPredFlag,
86     OMXVCM4P2VideoComponent videoComp
87 )
88{
89    OMX_U8 flag;
90    /* Argument error checks */
91    armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
92    armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr);
93    armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr);
94    armRetArgErrIf(curQP <= 0, OMX_Sts_BadArgErr);
95    armRetArgErrIf(predQP <= 0, OMX_Sts_BadArgErr);
96    armRetArgErrIf(curQP > 31, OMX_Sts_BadArgErr);
97    armRetArgErrIf(predQP > 31, OMX_Sts_BadArgErr);
98    armRetArgErrIf((predDir != 1) && (predDir != 2), OMX_Sts_BadArgErr);
99    armRetArgErrIf(!armIs4ByteAligned(pSrcDst), OMX_Sts_BadArgErr);
100    armRetArgErrIf(!armIs4ByteAligned(pPredBufRow), OMX_Sts_BadArgErr);
101    armRetArgErrIf(!armIs4ByteAligned(pPredBufCol), OMX_Sts_BadArgErr);
102
103    flag = 0;
104    return armVCM4P2_ACDCPredict(
105        pSrcDst,
106        NULL,
107        pPredBufRow,
108        pPredBufCol,
109        curQP,
110        predQP,
111        predDir,
112        ACPredFlag,
113        videoComp,
114        flag,
115        NULL);
116
117}
118
119/* End of file */
120
121
122