Libav 0.7.1
|
00001 /* 00002 * Copyright (c) 2010 Mans Rullgard <mans@mansr.com> 00003 * 00004 * This file is part of Libav. 00005 * 00006 * Libav is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * Libav is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with Libav; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef AVCODEC_ARM_AAC_H 00022 #define AVCODEC_ARM_AAC_H 00023 00024 #include "config.h" 00025 00026 #if HAVE_NEON && HAVE_INLINE_ASM 00027 00028 #define VMUL2 VMUL2 00029 static inline float *VMUL2(float *dst, const float *v, unsigned idx, 00030 const float *scale) 00031 { 00032 unsigned v0, v1; 00033 __asm__ ("ubfx %0, %6, #0, #4 \n\t" 00034 "ubfx %1, %6, #4, #4 \n\t" 00035 "ldr %0, [%5, %0, lsl #2] \n\t" 00036 "ldr %1, [%5, %1, lsl #2] \n\t" 00037 "vld1.32 {d1[]}, [%7,:32] \n\t" 00038 "vmov d0, %0, %1 \n\t" 00039 "vmul.f32 d0, d0, d1 \n\t" 00040 "vst1.32 {d0}, [%2,:64]! \n\t" 00041 : "=&r"(v0), "=&r"(v1), "+r"(dst), "=m"(dst[0]), "=m"(dst[1]) 00042 : "r"(v), "r"(idx), "r"(scale) 00043 : "d0", "d1"); 00044 return dst; 00045 } 00046 00047 #define VMUL4 VMUL4 00048 static inline float *VMUL4(float *dst, const float *v, unsigned idx, 00049 const float *scale) 00050 { 00051 unsigned v0, v1, v2, v3; 00052 __asm__ ("ubfx %0, %10, #0, #2 \n\t" 00053 "ubfx %1, %10, #2, #2 \n\t" 00054 "ldr %0, [%9, %0, lsl #2] \n\t" 00055 "ubfx %2, %10, #4, #2 \n\t" 00056 "ldr %1, [%9, %1, lsl #2] \n\t" 00057 "ubfx %3, %10, #6, #2 \n\t" 00058 "ldr %2, [%9, %2, lsl #2] \n\t" 00059 "vmov d0, %0, %1 \n\t" 00060 "ldr %3, [%9, %3, lsl #2] \n\t" 00061 "vld1.32 {d2[],d3[]},[%11,:32] \n\t" 00062 "vmov d1, %2, %3 \n\t" 00063 "vmul.f32 q0, q0, q1 \n\t" 00064 "vst1.32 {q0}, [%4,:128]! \n\t" 00065 : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), 00066 "=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3]) 00067 : "r"(v), "r"(idx), "r"(scale) 00068 : "d0", "d1", "d2", "d3"); 00069 return dst; 00070 } 00071 00072 #define VMUL2S VMUL2S 00073 static inline float *VMUL2S(float *dst, const float *v, unsigned idx, 00074 unsigned sign, const float *scale) 00075 { 00076 unsigned v0, v1, v2, v3; 00077 __asm__ ("ubfx %0, %8, #0, #4 \n\t" 00078 "ubfx %1, %8, #4, #4 \n\t" 00079 "ldr %0, [%7, %0, lsl #2] \n\t" 00080 "lsl %2, %10, #30 \n\t" 00081 "ldr %1, [%7, %1, lsl #2] \n\t" 00082 "lsl %3, %10, #31 \n\t" 00083 "vmov d0, %0, %1 \n\t" 00084 "bic %2, %2, #1<<30 \n\t" 00085 "vld1.32 {d1[]}, [%9,:32] \n\t" 00086 "vmov d2, %2, %3 \n\t" 00087 "veor d0, d0, d2 \n\t" 00088 "vmul.f32 d0, d0, d1 \n\t" 00089 "vst1.32 {d0}, [%4,:64]! \n\t" 00090 : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), 00091 "=m"(dst[0]), "=m"(dst[1]) 00092 : "r"(v), "r"(idx), "r"(scale), "r"(sign) 00093 : "d0", "d1", "d2"); 00094 return dst; 00095 } 00096 00097 #define VMUL4S VMUL4S 00098 static inline float *VMUL4S(float *dst, const float *v, unsigned idx, 00099 unsigned sign, const float *scale) 00100 { 00101 unsigned v0, v1, v2, v3, nz; 00102 __asm__ ("vld1.32 {d2[],d3[]},[%13,:32] \n\t" 00103 "ubfx %0, %12, #0, #2 \n\t" 00104 "ubfx %1, %12, #2, #2 \n\t" 00105 "ldr %0, [%11,%0, lsl #2] \n\t" 00106 "ubfx %2, %12, #4, #2 \n\t" 00107 "ldr %1, [%11,%1, lsl #2] \n\t" 00108 "ubfx %3, %12, #6, #2 \n\t" 00109 "ldr %2, [%11,%2, lsl #2] \n\t" 00110 "vmov d0, %0, %1 \n\t" 00111 "ldr %3, [%11,%3, lsl #2] \n\t" 00112 "lsr %6, %12, #12 \n\t" 00113 "rbit %6, %6 \n\t" 00114 "vmov d1, %2, %3 \n\t" 00115 "lsls %6, %6, #1 \n\t" 00116 "and %0, %5, #1<<31 \n\t" 00117 "lslcs %5, %5, #1 \n\t" 00118 "lsls %6, %6, #1 \n\t" 00119 "and %1, %5, #1<<31 \n\t" 00120 "lslcs %5, %5, #1 \n\t" 00121 "lsls %6, %6, #1 \n\t" 00122 "and %2, %5, #1<<31 \n\t" 00123 "lslcs %5, %5, #1 \n\t" 00124 "vmov d4, %0, %1 \n\t" 00125 "and %3, %5, #1<<31 \n\t" 00126 "vmov d5, %2, %3 \n\t" 00127 "veor q0, q0, q2 \n\t" 00128 "vmul.f32 q0, q0, q1 \n\t" 00129 "vst1.32 {q0}, [%4,:128]! \n\t" 00130 : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), 00131 "+r"(sign), "=r"(nz), 00132 "=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3]) 00133 : "r"(v), "r"(idx), "r"(scale) 00134 : "cc", "d0", "d1", "d2", "d3", "d4", "d5"); 00135 return dst; 00136 } 00137 00138 #endif /* HAVE_NEON && HAVE_INLINE_ASM */ 00139 00140 #endif /* AVCODEC_ARM_AAC_H */