diff options
Diffstat (limited to 'opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include')
14 files changed, 88 insertions, 288 deletions
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h index d38f953..fd66e9a 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,10 +49,7 @@ terms listed above has been obtained from the copyright holder. ----------------------------------------------------------------------------*/ #include "basicop_malloc.h" -#if defined(PV_ARM_V5) -#include "basic_op_arm_v5.h" - -#elif defined(PV_ARM_GCC_V5) +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) #include "basic_op_arm_gcc_v5.h" #else diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h index 1abc4fa..5752171 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h @@ -112,7 +112,7 @@ extern "C" L_sum = 32-bit sum of L_var1 and L_var2 (Word32) */ - __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) + static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) { register Word32 ra = L_var1; register Word32 rb = L_var2; @@ -120,7 +120,7 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("qadd %0, %1, %2" + __asm__ volatile("qadd %0, %1, %2" : "=r"(result) : "r"(ra), "r"(rb) ); @@ -149,7 +149,7 @@ extern "C" Returns: L_diff = 32-bit difference of L_var1 and L_var2 (Word32) */ - __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + static inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow) { register Word32 ra = L_var1; register Word32 rb = L_var2; @@ -157,7 +157,7 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("qsub %0, %1, %2" + __asm__ volatile("qsub %0, %1, %2" : "=r"(result) : "r"(ra), "r"(rb) ); @@ -197,12 +197,12 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(result) : "r"(rb), "r"(rc) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(rc) : "r"(ra), "r"(result) ); @@ -232,7 +232,7 @@ extern "C" L_product = 32-bit product of L_var1 and L_var2 (Word32) */ - __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) + static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) { register Word32 ra = var1; register Word32 rb = var2; @@ -241,12 +241,12 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(product) : "r"(ra), "r"(rb) ); - asm volatile("qadd %0, %1, %2" + __asm__ volatile("qadd %0, %1, %2" : "=r"(result) : "r"(product), "r"(product) ); @@ -277,7 +277,7 @@ extern "C" Returns: result = 32-bit result of L_var3 - (var1 * var2) */ - __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) + static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) { register Word32 ra = L_var3; register Word32 rb = var1; @@ -287,12 +287,12 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(product) : "r"(rb), "r"(rc) ); - asm volatile("qdsub %0, %1, %2" + __asm__ volatile("qdsub %0, %1, %2" : "=r"(result) : "r"(ra), "r"(product) ); @@ -338,44 +338,44 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(L_product) : "r"(ra), "r"(rc) ); - asm volatile("mov %0, #0" + __asm__ volatile("mov %0, #0" : "=r"(result) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(L_sum) : "r"(result), "r"(L_product) ); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(product32) : "r"(ra), "r"(rd) ); - asm volatile("mov %0, %1, ASR #15" + __asm__ volatile("mov %0, %1, ASR #15" : "=r"(ra) : "r"(product32) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(L_product) : "r"(L_sum), "r"(ra) ); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(product32) : "r"(rb), "r"(rc) ); - asm volatile("mov %0, %1, ASR #15" + __asm__ volatile("mov %0, %1, ASR #15" : "=r"(rb) : "r"(product32) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(L_sum) : "r"(L_product), "r"(rb) ); @@ -417,29 +417,29 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(L_product) : "r"(ra), "r"(rc) ); - asm volatile("mov %0, #0" + __asm__ volatile("mov %0, #0" : "=r"(result) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(L_product) : "r"(result), "r"(L_product) ); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(result) : "r"(rb), "r"(rc) ); - asm volatile("mov %0, %1, ASR #15" + __asm__ volatile("mov %0, %1, ASR #15" : "=r"(ra) : "r"(result) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(result) : "r"(L_product), "r"(ra) ); @@ -468,7 +468,7 @@ extern "C" Returns: product = 16-bit limited product of var1 and var2 (Word16) */ - __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) + static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) { register Word32 ra = var1; register Word32 rb = var2; @@ -477,12 +477,12 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile( + __asm__ volatile( "smulbb %0, %1, %2" : "=r"(temp) : "r"(ra), "r"(rb) ); - asm volatile( + __asm__ volatile( "qadd %0, %1, %2\n\t" "mov %0, %0, asr #16" : "=&r*i"(product) @@ -492,33 +492,33 @@ extern "C" return ((Word16) product); } - __inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3) + static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3) { register Word32 ra = L_var1; register Word32 rb = L_var2; register Word32 rc = L_var3; Word32 result; - asm volatile("smlabb %0, %1, %2, %3" + __asm__ volatile("smlabb %0, %1, %2, %3" : "=r"(result) : "r"(ra), "r"(rb), "r"(rc) ); return (result); } - __inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3) + static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3) { register Word32 ra = L_var1; register Word32 rb = L_var2; register Word32 rc = L_var3; Word32 result; - asm volatile("rsb %0, %1, #0" + __asm__ volatile("rsb %0, %1, #0" : "=r"(ra) : "r"(ra) ); - asm volatile("smlabb %0, %1, %2, %3" + __asm__ volatile("smlabb %0, %1, %2, %3" : "=r"(result) : "r"(ra), "r"(rb), "r"(rc) ); diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h index eb91049..62072a5 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h @@ -117,9 +117,9 @@ extern "C" if ((L_var1 ^ L_var2) >= 0) { - if ((L_sum ^ L_var1) < 0) + if ((L_sum ^ L_var1) >> 31) { - L_sum = (L_var1 < 0) ? MIN_32 : MAX_32; + L_sum = (L_var1 >> 31) ? MIN_32 : MAX_32; *pOverflow = 1; } } @@ -155,11 +155,11 @@ extern "C" L_diff = L_var1 - L_var2; - if ((L_var1 ^ L_var2) < 0) + if ((L_var1 ^ L_var2) >> 31) { if ((L_diff ^ L_var1) & MIN_32) { - L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32; + L_diff = (L_var1 >> 31) ? MIN_32 : MAX_32; *pOverflow = 1; } } @@ -202,9 +202,9 @@ extern "C" /* Check if L_sum and L_var_3 share the same sign */ if ((L_var3 ^ result) > 0) { - if ((L_sum ^ L_var3) < 0) + if ((L_sum ^ L_var3) >> 31) { - L_sum = (L_var3 < 0) ? MIN_32 : MAX_32; + L_sum = (L_var3 >> 31) ? MIN_32 : MAX_32; *pOverflow = 1; } } @@ -342,9 +342,9 @@ extern "C" if ((L_product ^ product32) > 0) { - if ((L_sum ^ L_product) < 0) + if ((L_sum ^ L_product) >> 31) { - L_sum = (L_product < 0) ? MIN_32 : MAX_32; + L_sum = (L_product >> 31) ? MIN_32 : MAX_32; } } @@ -358,9 +358,9 @@ extern "C" if ((L_product ^ product32) > 0) { - if ((L_sum ^ L_product) < 0) + if ((L_sum ^ L_product) >> 31) { - L_sum = (L_product < 0) ? MIN_32 : MAX_32; + L_sum = (L_product >> 31) ? MIN_32 : MAX_32; } } return (L_sum); @@ -413,9 +413,9 @@ extern "C" if ((L_product ^ result) > 0) { - if ((L_sum ^ L_product) < 0) + if ((L_sum ^ L_product) >> 31) { - L_sum = (L_product < 0) ? MIN_32 : MAX_32; + L_sum = (L_product >> 31) ? MIN_32 : MAX_32; *pOverflow = 1; } } diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h index 8fceb9d..ac72c31 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,22 +87,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ - - __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) - { - Word32 result; - - OSCL_UNUSED_ARG(pOverflow); - __asm - { - QADD result, L_var1, L_var2 - } - return(result); - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ - +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) { register Word32 ra = L_var1; diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h index 865f043..f672428 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,21 +86,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ - - __inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) - { - Word32 result; - Word32 L_sum; - - OSCL_UNUSED_ARG(pOverflow); - - __asm {SMULBB result, var1, var2} - __asm {QDADD L_sum, L_var3, result} - return (L_sum); - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) { diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h index b1a51ba..86c5735 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,25 +88,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ - - __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) - { - Word32 product; - Word32 result; - - OSCL_UNUSED_ARG(pOverflow); - - __asm - { - SMULBB product, var1, var2 - QDSUB result, L_var3, product - } - - return (result); - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) { diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h index 2aaea47..33fedb1 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,26 +87,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ - -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ - - __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) - { - Word32 result; - Word32 product; - - OSCL_UNUSED_ARG(pOverflow); - - __asm - { - SMULBB product, var1, var2 - QADD result, product, product - } - - return (result); - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) { diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h index a9b0732..88d86ca 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,7 @@ terms listed above has been obtained from the copyright holder. ----------------------------------------------------------------------------*/ #include "basicop_malloc.h" + /*--------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" @@ -88,24 +89,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ - - __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow) - { - Word32 result; - - OSCL_UNUSED_ARG(pOverflow); - - __asm - { - QSUB result, L_var1, L_var2 - } - - return(result); - - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) /* Instructions for ARM-linux cross-compiler*/ __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow) { diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h index f2cb7cf..8df43c9 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,47 +88,13 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ - __inline Word32 Mpy_32(Word16 L_var1_hi, + static inline Word32 Mpy_32(Word16 L_var1_hi, Word16 L_var1_lo, Word16 L_var2_hi, Word16 L_var2_lo, Flag *pOverflow) - - { - /*---------------------------------------------------------------------------- - ; Define all local variables - ----------------------------------------------------------------------------*/ - Word32 L_product; - Word32 L_sum; - Word32 product32; - - OSCL_UNUSED_ARG(pOverflow); - /*---------------------------------------------------------------------------- - ; Function body here - ----------------------------------------------------------------------------*/ - /* L_product = L_mult (L_var1_hi, L_var2_hi, pOverflow);*/ - - __asm {SMULBB L_product, L_var1_hi, L_var2_hi} - __asm {QDADD L_product, 0, L_product} - __asm {SMULBB product32, L_var1_hi, L_var2_lo} - product32 >>= 15; - __asm {QDADD L_sum, L_product, product32} - L_product = L_sum; - __asm {SMULBB product32, L_var1_lo, L_var2_hi} - product32 >>= 15; - __asm {QDADD L_sum, L_product, product32} - return (L_sum); - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ - - static inline Word32 Mpy_32(Word16 L_var1_hi, - Word16 L_var1_lo, - Word16 L_var2_hi, - Word16 L_var2_lo, - Flag *pOverflow) { register Word32 product32; register Word32 L_sum; diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h index 33ade51..3a68e69 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,36 +88,14 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/ +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ - __inline Word32 Mpy_32_16(Word16 L_var1_hi, + static inline Word32 Mpy_32_16(Word16 L_var1_hi, Word16 L_var1_lo, Word16 var2, Flag *pOverflow) { - Word32 L_product; - Word32 L_sum; - Word32 result; - - OSCL_UNUSED_ARG(pOverflow); - - __asm {SMULBB L_product, L_var1_hi, var2} - __asm {QDADD L_product, 0, L_product} - __asm {SMULBB result, L_var1_lo, var2} - result >>= 15; - __asm {QDADD L_sum, L_product, result} - return (L_sum); - } - -#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/ - - static inline Word32 Mpy_32_16(Word16 L_var1_hi, - Word16 L_var1_lo, - Word16 var2, - Flag *pOverflow) - { - register Word32 ra = L_var1_hi; register Word32 rb = L_var1_lo; register Word32 rc = var2; @@ -125,29 +103,29 @@ extern "C" OSCL_UNUSED_ARG(pOverflow); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(L_product) : "r"(ra), "r"(rc) ); - asm volatile("mov %0, #0" + __asm__ volatile("mov %0, #0" : "=r"(result) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(L_product) : "r"(result), "r"(L_product) ); - asm volatile("smulbb %0, %1, %2" + __asm__ volatile("smulbb %0, %1, %2" : "=r"(result) : "r"(rb), "r"(rc) ); - asm volatile("mov %0, %1, ASR #15" + __asm__ volatile("mov %0, %1, ASR #15" : "=r"(ra) : "r"(result) ); - asm volatile("qdadd %0, %1, %2" + __asm__ volatile("qdadd %0, %1, %2" : "=r"(result) : "r"(L_product), "r"(ra) ); diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h index eac2004..c89a94e 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,26 +85,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if defined(PV_ARM_V5) - - __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) - { - Word32 product; - - OSCL_UNUSED_ARG(pOverflow); - - __asm - { - SMULBB product, var1, var2 - MOV product, product, ASR #15 - CMP product, 0x7FFF - MOVGE product, 0x7FFF - } - - return ((Word16) product); - } - -#elif defined(PV_ARM_GCC_V5) +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) { diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h index faea591..288b6c7 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,29 +86,9 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) - /* C EQUIVALENT */ - OSCL_IMPORT_REF Word16 norm_l(Word32 L_var1); - -#elif defined(PV_ARM_V5) - - __inline Word16 norm_l(Word32 L_var1) - { - register Word32 var_out = 0; - - __asm - { - CMP L_var1, #0 - EORNE L_var1, L_var1, L_var1, LSL #1 - CLZNE var_out, L_var1 - } - - return ((Word16)var_out); - } - -#elif defined(PV_ARM_GCC_V5) +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) static inline Word16 norm_l(Word32 L_var1) { register Word32 var_out = 0; @@ -116,7 +96,7 @@ extern "C" if (L_var1) { ra ^= (ra << 1); - asm volatile( + __asm__ volatile( "clz %0, %1" : "=r"(var_out) : "r"(ra) @@ -124,6 +104,9 @@ extern "C" } return (var_out); } +#else + /* C EQUIVALENT */ + OSCL_IMPORT_REF Word16 norm_l(Word32 L_var1); #endif /*---------------------------------------------------------------------------- @@ -134,5 +117,3 @@ extern "C" #endif #endif - - diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h index 955903a..7847f34 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,31 +86,9 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) - /* C EQUIVALENT */ - - OSCL_IMPORT_REF Word16 norm_s(Word16 var1); - -#elif defined(PV_ARM_V5) - - __inline Word16 norm_s(Word16 var) - { - register Word32 var_out = 0; - Word32 var1 = var << 16; - - __asm - { - CMP var1, #0 - EORNE var1, var1, var1, LSL #1 - CLZNE var_out, var1 - } - - return ((Word16)var_out); - } - -#elif defined(PV_ARM_GCC_V5) +#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) static inline Word16 norm_s(Word16 var1) { register Word32 var_out = 0; @@ -118,7 +96,7 @@ extern "C" if (ra) { ra ^= (ra << 1); - asm volatile( + __asm__ volatile( "clz %0, %1" : "=r"(var_out) : "r"(ra) @@ -126,7 +104,9 @@ extern "C" } return (var_out); } - +#else + /*C EQUIVALENT */ + OSCL_IMPORT_REF Word16 norm_s(Word16 var1); #endif /*---------------------------------------------------------------------------- ; END @@ -136,5 +116,3 @@ extern "C" #endif #endif - - diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h index ee4d732..3cf16d5 100644 --- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h +++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/typedef.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------ - * Copyright (C) 1998-2009 PacketVideo + * Copyright (C) 1998-2010 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ terms listed above has been obtained from the copyright holder. * ******************************************************************************** */ +#include "oscl_base_macros.h"// has integer values of PV_COMPILER #ifndef typedef_h #define typedef_h "$Id $" |