159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* ------------------------------------------------------------------ 259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Copyright (C) 1998-2009 PacketVideo 359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * 459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Licensed under the Apache License, Version 2.0 (the "License"); 559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * you may not use this file except in compliance with the License. 659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * You may obtain a copy of the License at 759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * 859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * http://www.apache.org/licenses/LICENSE-2.0 959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * 1059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Unless required by applicable law or agreed to in writing, software 1159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * distributed under the License is distributed on an "AS IS" BASIS, 1259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 1359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * express or implied. 1459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * See the License for the specific language governing permissions 1559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * and limitations under the License. 1659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * ------------------------------------------------------------------- 1759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong */ 1859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* Filename: dct_inline.h */ 1959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* Description: Implementation for in-line functions used in dct.cpp */ 2059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* Modified: */ 2159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*********************************************************************************/ 2259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#ifndef _DCT_INLINE_H_ 2359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#define _DCT_INLINE_H_ 2459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 2559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#if !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) 2659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 2759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla724(int32 op1, int32 op2, int32 op3) 2859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 2959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 3059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 3159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong OSCL_UNUSED_ARG(op1); 3259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 3359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong out = op2 * 724 + op3; /* op1 is not used here */ 3459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 3559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 3659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 3759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 3859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla392(int32 k0, int32 k14, int32 round) 3959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 4059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k1; 4159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 4259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong OSCL_UNUSED_ARG(k14); 4359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 4459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong k1 = k0 * 392 + round; 4559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 4659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return k1; 4759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 4859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 4959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla554(int32 k4, int32 k12, int32 k1) 5059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 5159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k0; 5259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 5359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong OSCL_UNUSED_ARG(k12); 5459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 5559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong k0 = k4 * 554 + k1; 5659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 5759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return k0; 5859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 5959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 6059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla1338(int32 k6, int32 k14, int32 k1) 6159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 6259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 6359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 6459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong OSCL_UNUSED_ARG(k14); 6559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 6659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong out = k6 * 1338 + k1; 6759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 6859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 6959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 7059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 7159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla946(int32 k6, int32 k14, int32 k1) 7259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 7359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 7459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 7559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong OSCL_UNUSED_ARG(k14); 7659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 7759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong out = k6 * 946 + k1; 7859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 7959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 8059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 8159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 8259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 sum_abs(int32 k0, int32 k1, int32 k2, int32 k3, 8359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k4, int32 k5, int32 k6, int32 k7) 8459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 8559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 carry, abs_sum; 8659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 8759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k0 >> 31; 8859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum = (k0 ^ carry); 8959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k1 >> 31; 9059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k1 ^ carry) - carry; 9159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k2 >> 31; 9259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k2 ^ carry) - carry; 9359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k3 >> 31; 9459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k3 ^ carry) - carry; 9559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k4 >> 31; 9659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k4 ^ carry) - carry; 9759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k5 >> 31; 9859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k5 ^ carry) - carry; 9959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k6 >> 31; 10059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k6 ^ carry) - carry; 10159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong carry = k7 >> 31; 10259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong abs_sum += (k7 ^ carry) - carry; 10359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 10459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return abs_sum; 10559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 10659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 10759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#elif defined(__CC_ARM) /* only work with arm v5 */ 10859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 10959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#if defined(__TARGET_ARCH_5TE) 11059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 11159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla724(int32 op1, int32 op2, int32 op3) 11259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 11359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 11459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 11559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 11659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 11759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong smlabb out, op1, op2, op3 11859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 11959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 12059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 12159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 12259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 12359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla392(int32 k0, int32 k14, int32 round) 12459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 12559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k1; 12659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 12759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 12859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 12959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong smlabt k1, k0, k14, round 13059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 13159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 13259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return k1; 13359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 13459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 13559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla554(int32 k4, int32 k12, int32 k1) 13659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 13759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k0; 13859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 13959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 14059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 14159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong smlabt k0, k4, k12, k1 14259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 14359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 14459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return k0; 14559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 14659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 14759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla1338(int32 k6, int32 k14, int32 k1) 14859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 14959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 15059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 15159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 15259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 15359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong smlabb out, k6, k14, k1 15459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 15559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 15659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 15759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 15859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 15959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla946(int32 k6, int32 k14, int32 k1) 16059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 16159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 16259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 16359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 16459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 16559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong smlabb out, k6, k14, k1 16659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 16759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 16859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 16959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 17059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 17159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#else // not ARM5TE 17259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 17359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 17459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla724(int32 op1, int32 op2, int32 op3) 17559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 17659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 17759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 17859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 17959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 18059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong and out, op2, #0xFFFF 18159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mla out, op1, out, op3 18259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 18359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 18459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 18559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 18659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 18759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla392(int32 k0, int32 k14, int32 round) 18859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 18959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k1; 19059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 19159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 19259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 19359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mov k1, k14, asr #16 19459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mla k1, k0, k1, round 19559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 19659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 19759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return k1; 19859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 19959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 20059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla554(int32 k4, int32 k12, int32 k1) 20159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 20259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k0; 20359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 20459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 20559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 20659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mov k0, k12, asr #16 20759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mla k0, k4, k0, k1 20859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 20959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 21059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return k0; 21159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 21259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 21359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla1338(int32 k6, int32 k14, int32 k1) 21459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 21559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 21659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 21759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 21859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 21959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong and out, k14, 0xFFFF 22059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mla out, k6, out, k1 22159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 22259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 22359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 22459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 22559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 22659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla946(int32 k6, int32 k14, int32 k1) 22759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 22859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 out; 22959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 23059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 23159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 23259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong and out, k14, 0xFFFF 23359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong mla out, k6, out, k1 23459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 23559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 23659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 23759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 23859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 23959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif 24059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 24159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 sum_abs(int32 k0, int32 k1, int32 k2, int32 k3, 24259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k4, int32 k5, int32 k6, int32 k7) 24359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 24459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 carry, abs_sum; 24559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong __asm 24659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong { 24759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eor carry, k0, k0, asr #31 ; 24859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors abs_sum, k1, k1, asr #31 ; 24959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 25059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors carry, k2, k2, asr #31 ; 25159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 25259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors carry, k3, k3, asr #31 ; 25359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 25459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors carry, k4, k4, asr #31 ; 25559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 25659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors carry, k5, k5, asr #31 ; 25759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 25859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors carry, k6, k6, asr #31 ; 25959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 26059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong eors carry, k7, k7, asr #31 ; 26159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong adc abs_sum, abs_sum, carry ; 26259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong } 26359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 26459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return abs_sum; 26559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 26659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 26759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#elif ( defined(PV_ARM_GCC_V5) || defined(PV_ARM_GCC_V4) ) /* ARM GNU COMPILER */ 26859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 26959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla724(int32 op1, int32 op2, int32 op3) 27059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 27159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 out; 27259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 aa = (int32)op1; 27359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 bb = (int32)op2; 27459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 cc = (int32)op3; 27559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 27659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong asm volatile("smlabb %0, %1, %2, %3" 27759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "=&r"(out) 27859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "r"(aa), 27959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(bb), 28059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(cc)); 28159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 28259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 28359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 28459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 28559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla392(int32 k0, int32 k14, int32 round) 28659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 28759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 out; 28859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 aa = (int32)k0; 28959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 bb = (int32)k14; 29059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 cc = (int32)round; 29159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 29259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong asm volatile("smlabt %0, %1, %2, %3" 29359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "=&r"(out) 29459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "r"(aa), 29559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(bb), 29659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(cc)); 29759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 29859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 29959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 30059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 30159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla554(int32 k4, int32 k12, int32 k1) 30259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 30359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 out; 30459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 aa = (int32)k4; 30559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 bb = (int32)k12; 30659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 cc = (int32)k1; 30759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 30859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong asm volatile("smlabt %0, %1, %2, %3" 30959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "=&r"(out) 31059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "r"(aa), 31159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(bb), 31259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(cc)); 31359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 31459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 31559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 31659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 31759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla1338(int32 k6, int32 k14, int32 k1) 31859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 31959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 out; 32059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 aa = (int32)k6; 32159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 bb = (int32)k14; 32259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 cc = (int32)k1; 32359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 32459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong asm volatile("smlabb %0, %1, %2, %3" 32559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "=&r"(out) 32659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "r"(aa), 32759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(bb), 32859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(cc)); 32959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 33059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 33159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 33259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 mla946(int32 k6, int32 k14, int32 k1) 33359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 33459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 out; 33559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 aa = (int32)k6; 33659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 bb = (int32)k14; 33759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 cc = (int32)k1; 33859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 33959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong asm volatile("smlabb %0, %1, %2, %3" 34059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "=&r"(out) 34159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "r"(aa), 34259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(bb), 34359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(cc)); 34459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return out; 34559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 34659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 34759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong__inline int32 sum_abs(int32 k0, int32 k1, int32 k2, int32 k3, 34859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong int32 k4, int32 k5, int32 k6, int32 k7) 34959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{ 35059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 carry; 35159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 abs_sum; 35259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 aa = (int32)k0; 35359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 bb = (int32)k1; 35459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 cc = (int32)k2; 35559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 dd = (int32)k3; 35659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 ee = (int32)k4; 35759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 ff = (int32)k5; 35859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 gg = (int32)k6; 35959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong register int32 hh = (int32)k7; 36059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 36159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong asm volatile("eor %0, %2, %2, asr #31\n\t" 36259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %1, %3, %3, asr #31\n\t" 36359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 36459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %0, %4, %4, asr #31\n\t" 36559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 36659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %0, %5, %5, asr #31\n\t" 36759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 36859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %0, %6, %6, asr #31\n\t" 36959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 37059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %0, %7, %7, asr #31\n\t" 37159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 37259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %0, %8, %8, asr #31\n\t" 37359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 37459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "eors %0, %9, %9, asr #31\n\t" 37559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "adc %1, %1, %0\n\t" 37659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 37759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong : "=&r"(carry), 37859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "=&r"(abs_sum): 37959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(aa), 38059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(bb), 38159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(cc), 38259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(dd), 38359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(ee), 38459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(ff), 38559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(gg), 38659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong "r"(hh)); 38759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 38859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong return abs_sum; 38959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong} 39059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 39159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif // Diff. OS 39259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 39359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong#endif //_DCT_INLINE_H_ 39459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 39559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong 396