armVCM4P10_TransformResidual4x4.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_TransformResidual4x4.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 * Transform Residual 4x4 Coefficients 42 * 43 * Parameters: 44 * [in] pSrc Source 4x4 block 45 * [out] pDst Destination 4x4 block 46 * 47 */ 48 49void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc) 50{ 51 int i; 52 53 /* Transform rows */ 54 for (i=0; i<16; i+=4) 55 { 56 int d0 = pSrc[i+0]; 57 int d1 = pSrc[i+1]; 58 int d2 = pSrc[i+2]; 59 int d3 = pSrc[i+3]; 60 int e0 = d0 + d2; 61 int e1 = d0 - d2; 62 int e2 = (d1>>1) - d3; 63 int e3 = d1 + (d3>>1); 64 int f0 = e0 + e3; 65 int f1 = e1 + e2; 66 int f2 = e1 - e2; 67 int f3 = e0 - e3; 68 pDst[i+0] = (OMX_S16)f0; 69 pDst[i+1] = (OMX_S16)f1; 70 pDst[i+2] = (OMX_S16)f2; 71 pDst[i+3] = (OMX_S16)f3; 72 } 73 74 /* Transform columns */ 75 for (i=0; i<4; i++) 76 { 77 int f0 = pDst[i+0]; 78 int f1 = pDst[i+4]; 79 int f2 = pDst[i+8]; 80 int f3 = pDst[i+12]; 81 int g0 = f0 + f2; 82 int g1 = f0 - f2; 83 int g2 = (f1>>1) - f3; 84 int g3 = f1 + (f3>>1); 85 int h0 = g0 + g3; 86 int h1 = g1 + g2; 87 int h2 = g1 - g2; 88 int h3 = g0 - g3; 89 pDst[i+0] = (OMX_S16)((h0+32)>>6); 90 pDst[i+4] = (OMX_S16)((h1+32)>>6); 91 pDst[i+8] = (OMX_S16)((h2+32)>>6); 92 pDst[i+12] = (OMX_S16)((h3+32)>>6); 93 } 94} 95 96