1 /**
2 *
3 * File Name: omxVCM4P10_InvTransformResidualAndAdd.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 * Description:
12 * This function will inverse integer 4x4 transform
13 *
14 */
15
16 #include "omxtypes.h"
17 #include "armOMX.h"
18 #include "omxVC.h"
19
20 #include "armCOMM.h"
21 #include "armVC.h"
22
23 /**
24 * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1)
25 *
26 * Description:
27 * This function performs inverse an 4x4 integer transformation to produce
28 * the difference signal and then adds the difference to the prediction to get
29 * the reconstructed signal.
30 *
31 * Input Arguments:
32 *
33 * pSrcPred - Pointer to prediction signal. 4-byte alignment required.
34 * pDequantCoeff - Pointer to the transformed coefficients. 8-byte
35 * alignment required.
36 * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4.
37 * iDstReconStep - Step of the destination reconstruction buffer; must be a
38 * multiple of 4.
39 * bAC - Indicate whether there is AC coefficients in the coefficients
40 * matrix.
41 *
42 * Output Arguments:
43 *
44 * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte
45 * alignment required.
46 *
47 * Return Value:
48 *
49 * OMX_Sts_NoErr - no error
50 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following
51 * conditions are true:
52 * - at least one of the following pointers is NULL:
53 * pSrcPred, pDequantCoeff, pDstRecon
54 * - pSrcPred is not aligned on a 4-byte boundary
55 * - iSrcPredStep or iDstReconStep is not a multiple of 4.
56 * - pDequantCoeff is not aligned on an 8-byte boundary
57 *
58 */
omxVCM4P10_InvTransformResidualAndAdd(const OMX_U8 * pSrcPred,const OMX_S16 * pDequantCoeff,OMX_U8 * pDstRecon,OMX_U32 iSrcPredStep,OMX_U32 iDstReconStep,OMX_U8 bAC)59 OMXResult omxVCM4P10_InvTransformResidualAndAdd(
60 const OMX_U8* pSrcPred,
61 const OMX_S16* pDequantCoeff,
62 OMX_U8* pDstRecon,
63 OMX_U32 iSrcPredStep,
64 OMX_U32 iDstReconStep,
65 OMX_U8 bAC
66 )
67 {
68 OMX_INT i, j;
69 OMX_S16 In[16], Out[16];
70 OMX_S32 Value;
71
72 /* check for argument error */
73 armRetArgErrIf(pSrcPred == NULL, OMX_Sts_BadArgErr)
74 armRetArgErrIf(armNot4ByteAligned(pSrcPred), OMX_Sts_BadArgErr)
75 armRetArgErrIf(pDequantCoeff == NULL, OMX_Sts_BadArgErr)
76 armRetArgErrIf(armNot8ByteAligned(pDequantCoeff), OMX_Sts_BadArgErr)
77 armRetArgErrIf(pDstRecon == NULL, OMX_Sts_BadArgErr)
78 armRetArgErrIf(armNot4ByteAligned(pDstRecon), OMX_Sts_BadArgErr)
79 armRetArgErrIf(bAC > 1, OMX_Sts_BadArgErr)
80 armRetArgErrIf(iSrcPredStep == 0 || iSrcPredStep & 3, OMX_Sts_BadArgErr)
81 armRetArgErrIf(iDstReconStep == 0 || iDstReconStep & 3, OMX_Sts_BadArgErr)
82
83 if (bAC)
84 {
85 for (i = 0; i < 16; i++)
86 {
87 In[i] = pDequantCoeff [i];
88 }
89 }
90 else
91 {
92 /* Copy DC */
93 In[0] = pDequantCoeff [0];
94
95 for (i = 1; i < 16; i++)
96 {
97 In[i] = 0;
98 }
99 }
100
101 /* Residual Transform */
102 armVCM4P10_TransformResidual4x4 (Out, In);
103
104 for (j = 0; j < 4; j++)
105 {
106 for (i = 0; i < 4; i++)
107 {
108 /* Add predition */
109 Value = (OMX_S32) Out [j * 4 + i] + pSrcPred [j * iSrcPredStep + i];
110
111 /* Saturate Value to OMX_U8 */
112 Value = armClip (0, 255, Value);
113
114 pDstRecon[j * iDstReconStep + i] = (OMX_U8) Value;
115 }
116 }
117
118 return OMX_Sts_NoErr;
119 }
120
121 /*****************************************************************************
122 * END OF FILE
123 *****************************************************************************/
124
125