Libav
|
00001 /* 00002 * Copyright (c) 2010 Mans Rullgard <mans@mansr.com> 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg 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 * FFmpeg 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 FFmpeg; 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__ volatile ("ubfx %0, %4, #0, #4 \n\t" 00034 "ubfx %1, %4, #4, #4 \n\t" 00035 "ldr %0, [%3, %0, lsl #2] \n\t" 00036 "ldr %1, [%3, %1, lsl #2] \n\t" 00037 "vld1.32 {d1[]}, [%5,: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) 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__ volatile ("ubfx %0, %6, #0, #2 \n\t" 00053 "ubfx %1, %6, #2, #2 \n\t" 00054 "ldr %0, [%5, %0, lsl #2] \n\t" 00055 "ubfx %2, %6, #4, #2 \n\t" 00056 "ldr %1, [%5, %1, lsl #2] \n\t" 00057 "ubfx %3, %6, #6, #2 \n\t" 00058 "ldr %2, [%5, %2, lsl #2] \n\t" 00059 "vmov d0, %0, %1 \n\t" 00060 "ldr %3, [%5, %3, lsl #2] \n\t" 00061 "vld1.32 {d2[],d3[]},[%7,: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 : "r"(v), "r"(idx), "r"(scale) 00067 : "d0", "d1", "d2", "d3"); 00068 return dst; 00069 } 00070 00071 #define VMUL2S VMUL2S 00072 static inline float *VMUL2S(float *dst, const float *v, unsigned idx, 00073 unsigned sign, const float *scale) 00074 { 00075 unsigned v0, v1, v2, v3; 00076 __asm__ volatile ("ubfx %0, %6, #0, #4 \n\t" 00077 "ubfx %1, %6, #4, #4 \n\t" 00078 "ldr %0, [%5, %0, lsl #2] \n\t" 00079 "lsl %2, %8, #30 \n\t" 00080 "ldr %1, [%5, %1, lsl #2] \n\t" 00081 "lsl %3, %8, #31 \n\t" 00082 "vmov d0, %0, %1 \n\t" 00083 "bic %2, %2, #1<<30 \n\t" 00084 "vld1.32 {d1[]}, [%7,:32] \n\t" 00085 "vmov d2, %2, %3 \n\t" 00086 "veor d0, d0, d2 \n\t" 00087 "vmul.f32 d0, d0, d1 \n\t" 00088 "vst1.32 {d0}, [%4,:64]! \n\t" 00089 : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst) 00090 : "r"(v), "r"(idx), "r"(scale), "r"(sign) 00091 : "d0", "d1", "d2"); 00092 return dst; 00093 } 00094 00095 #define VMUL4S VMUL4S 00096 static inline float *VMUL4S(float *dst, const float *v, unsigned idx, 00097 unsigned sign, const float *scale) 00098 { 00099 unsigned v0, v1, v2, v3, nz; 00100 __asm__ volatile ("vld1.32 {d2[],d3[]},[%9,:32] \n\t" 00101 "ubfx %0, %8, #0, #2 \n\t" 00102 "ubfx %1, %8, #2, #2 \n\t" 00103 "ldr %0, [%7, %0, lsl #2] \n\t" 00104 "ubfx %2, %8, #4, #2 \n\t" 00105 "ldr %1, [%7, %1, lsl #2] \n\t" 00106 "ubfx %3, %8, #6, #2 \n\t" 00107 "ldr %2, [%7, %2, lsl #2] \n\t" 00108 "vmov d0, %0, %1 \n\t" 00109 "ldr %3, [%7, %3, lsl #2] \n\t" 00110 "lsr %6, %8, #12 \n\t" 00111 "rbit %6, %6 \n\t" 00112 "vmov d1, %2, %3 \n\t" 00113 "lsls %6, %6, #1 \n\t" 00114 "and %0, %5, #1<<31 \n\t" 00115 "lslcs %5, %5, #1 \n\t" 00116 "lsls %6, %6, #1 \n\t" 00117 "and %1, %5, #1<<31 \n\t" 00118 "lslcs %5, %5, #1 \n\t" 00119 "lsls %6, %6, #1 \n\t" 00120 "and %2, %5, #1<<31 \n\t" 00121 "lslcs %5, %5, #1 \n\t" 00122 "vmov d4, %0, %1 \n\t" 00123 "and %3, %5, #1<<31 \n\t" 00124 "vmov d5, %2, %3 \n\t" 00125 "veor q0, q0, q2 \n\t" 00126 "vmul.f32 q0, q0, q1 \n\t" 00127 "vst1.32 {q0}, [%4,:128]! \n\t" 00128 : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), 00129 "+r"(sign), "=r"(nz) 00130 : "r"(v), "r"(idx), "r"(scale) 00131 : "d0", "d1", "d2", "d3", "d4", "d5"); 00132 return dst; 00133 } 00134 00135 #endif /* HAVE_NEON && HAVE_INLINE_ASM */ 00136 00137 #endif /* AVCODEC_ARM_AAC_H */