1/* ----------------------------------------------------------------
2 *
3 *
4 * File Name:  armVCM4P10_FwdTransformResidual4x4.c
5 * OpenMAX DL: v1.0.2
6 * Revision:   9641
7 * Date:       Thursday, February 7, 2008
8 *
9 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
10 *
11 *
12 *
13 * H.264 transform module
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 * Description:
26 * Forward Transform Residual 4x4 Coefficients
27 *
28 * Parameters:
29 * [in]  pSrc		Source 4x4 block
30 * [out] pDst		Destination 4x4 block
31 *
32 */
33void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc)
34{
35    int i;
36
37    /* Transform rows */
38    for (i=0; i<16; i+=4)
39    {
40        int d0 = pSrc[i+0];
41        int d1 = pSrc[i+1];
42        int d2 = pSrc[i+2];
43        int d3 = pSrc[i+3];
44        int e0 = d0 + d3;
45        int e1 = d0 - d3;
46        int e2 = d1 + d2;
47        int e3 = d1 - d2;
48        int f0 = e0 + e2;
49        int f1 = (e1 << 1) + e3;
50        int f2 = e0 - e2;
51        int f3 = e1 - (e3 << 1);
52        pDst[i+0] = (OMX_S16)f0;
53        pDst[i+1] = (OMX_S16)f1;
54        pDst[i+2] = (OMX_S16)f2;
55        pDst[i+3] = (OMX_S16)f3;
56    }
57
58    /* Transform columns */
59    for (i=0; i<4; i++)
60    {
61        int f0 = pDst[i+0];
62        int f1 = pDst[i+4];
63        int f2 = pDst[i+8];
64        int f3 = pDst[i+12];
65        int g0 = f0 + f3;
66        int g1 = f0 - f3;
67        int g2 = f1 + f2;
68        int g3 = f1 - f2;
69        int h0 = g0 + g2;
70        int h1 = (g1 << 1) + g3;
71        int h2 = g0 - g2;
72        int h3 = g1 - (g3 << 1);
73        pDst[i+0] = (OMX_S16) h0;
74        pDst[i+4] = (OMX_S16) h1;
75        pDst[i+8] = (OMX_S16) h2;
76        pDst[i+12] = (OMX_S16) h3;
77    }
78}
79