armVCM4P10_FwdTransformResidual4x4.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
1/* 2 * Copyright (C) 2007-2008 ARM Limited 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17/* ---------------------------------------------------------------- 18 * 19 * 20 * File Name: armVCM4P10_FwdTransformResidual4x4.c 21 * OpenMAX DL: v1.0.2 22 * Revision: 9641 23 * Date: Thursday, February 7, 2008 24 * 25 * 26 * 27 * 28 * H.264 transform module 29 * 30 */ 31 32#include "omxtypes.h" 33#include "armOMX.h" 34#include "omxVC.h" 35 36#include "armCOMM.h" 37#include "armVC.h" 38 39/* 40 * Description: 41 * Forward Transform Residual 4x4 Coefficients 42 * 43 * Parameters: 44 * [in] pSrc Source 4x4 block 45 * [out] pDst Destination 4x4 block 46 * 47 */ 48void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc) 49{ 50 int i; 51 52 /* Transform rows */ 53 for (i=0; i<16; i+=4) 54 { 55 int d0 = pSrc[i+0]; 56 int d1 = pSrc[i+1]; 57 int d2 = pSrc[i+2]; 58 int d3 = pSrc[i+3]; 59 int e0 = d0 + d3; 60 int e1 = d0 - d3; 61 int e2 = d1 + d2; 62 int e3 = d1 - d2; 63 int f0 = e0 + e2; 64 int f1 = (e1 << 1) + e3; 65 int f2 = e0 - e2; 66 int f3 = e1 - (e3 << 1); 67 pDst[i+0] = (OMX_S16)f0; 68 pDst[i+1] = (OMX_S16)f1; 69 pDst[i+2] = (OMX_S16)f2; 70 pDst[i+3] = (OMX_S16)f3; 71 } 72 73 /* Transform columns */ 74 for (i=0; i<4; i++) 75 { 76 int f0 = pDst[i+0]; 77 int f1 = pDst[i+4]; 78 int f2 = pDst[i+8]; 79 int f3 = pDst[i+12]; 80 int g0 = f0 + f3; 81 int g1 = f0 - f3; 82 int g2 = f1 + f2; 83 int g3 = f1 - f2; 84 int h0 = g0 + g2; 85 int h1 = (g1 << 1) + g3; 86 int h2 = g0 - g2; 87 int h3 = g1 - (g3 << 1); 88 pDst[i+0] = (OMX_S16) h0; 89 pDst[i+4] = (OMX_S16) h1; 90 pDst[i+8] = (OMX_S16) h2; 91 pDst[i+12] = (OMX_S16) h3; 92 } 93} 94