1/* ----------------------------------------------------------------
2 *
3 *
4 * File Name:  armVCM4P10_TransformResidual4x4.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 * Transform Residual 4x4 Coefficients
27 *
28 * Parameters:
29 * [in]  pSrc		Source 4x4 block
30 * [out] pDst		Destination 4x4 block
31 *
32 */
33
34void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc)
35{
36    int i;
37
38    /* Transform rows */
39    for (i=0; i<16; i+=4)
40    {
41        int d0 = pSrc[i+0];
42        int d1 = pSrc[i+1];
43        int d2 = pSrc[i+2];
44        int d3 = pSrc[i+3];
45        int e0 = d0 + d2;
46        int e1 = d0 - d2;
47        int e2 = (d1>>1) - d3;
48        int e3 = d1 + (d3>>1);
49        int f0 = e0 + e3;
50        int f1 = e1 + e2;
51        int f2 = e1 - e2;
52        int f3 = e0 - e3;
53        pDst[i+0] = (OMX_S16)f0;
54        pDst[i+1] = (OMX_S16)f1;
55        pDst[i+2] = (OMX_S16)f2;
56        pDst[i+3] = (OMX_S16)f3;
57    }
58
59    /* Transform columns */
60    for (i=0; i<4; i++)
61    {
62        int f0 = pDst[i+0];
63        int f1 = pDst[i+4];
64        int f2 = pDst[i+8];
65        int f3 = pDst[i+12];
66        int g0 = f0 + f2;
67        int g1 = f0 - f2;
68        int g2 = (f1>>1) - f3;
69        int g3 = f1 + (f3>>1);
70        int h0 = g0 + g3;
71        int h1 = g1 + g2;
72        int h2 = g1 - g2;
73        int h3 = g0 - g3;
74        pDst[i+0] = (OMX_S16)((h0+32)>>6);
75        pDst[i+4] = (OMX_S16)((h1+32)>>6);
76        pDst[i+8] = (OMX_S16)((h2+32)>>6);
77        pDst[i+12] = (OMX_S16)((h3+32)>>6);
78    }
79}
80
81