comparison aac.c @ 10881:798c62217427 libavcodec

AAC: ARM/NEON asm for VMUL2/4 functions
author mru
date Fri, 15 Jan 2010 02:58:24 +0000
parents 9ad6c1c4455c
children 966a8afdd9aa
comparison
equal deleted inserted replaced
10880:1184d065c26a 10881:798c62217427
90 90
91 #include <assert.h> 91 #include <assert.h>
92 #include <errno.h> 92 #include <errno.h>
93 #include <math.h> 93 #include <math.h>
94 #include <string.h> 94 #include <string.h>
95
96 #if ARCH_ARM
97 # include "arm/aac.h"
98 #endif
95 99
96 union float754 { 100 union float754 {
97 float f; 101 float f;
98 uint32_t i; 102 uint32_t i;
99 }; 103 };
860 } else if (ms_present == 2) { 864 } else if (ms_present == 2) {
861 memset(cpe->ms_mask, 1, cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb * sizeof(cpe->ms_mask[0])); 865 memset(cpe->ms_mask, 1, cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb * sizeof(cpe->ms_mask[0]));
862 } 866 }
863 } 867 }
864 868
869 #ifndef VMUL2
865 static inline float *VMUL2(float *dst, const float *v, unsigned idx, 870 static inline float *VMUL2(float *dst, const float *v, unsigned idx,
866 const float *scale) 871 const float *scale)
867 { 872 {
868 float s = *scale; 873 float s = *scale;
869 *dst++ = v[idx & 15] * s; 874 *dst++ = v[idx & 15] * s;
870 *dst++ = v[idx>>4 & 15] * s; 875 *dst++ = v[idx>>4 & 15] * s;
871 return dst; 876 return dst;
872 } 877 }
873 878 #endif
879
880 #ifndef VMUL4
874 static inline float *VMUL4(float *dst, const float *v, unsigned idx, 881 static inline float *VMUL4(float *dst, const float *v, unsigned idx,
875 const float *scale) 882 const float *scale)
876 { 883 {
877 float s = *scale; 884 float s = *scale;
878 *dst++ = v[idx & 3] * s; 885 *dst++ = v[idx & 3] * s;
879 *dst++ = v[idx>>2 & 3] * s; 886 *dst++ = v[idx>>2 & 3] * s;
880 *dst++ = v[idx>>4 & 3] * s; 887 *dst++ = v[idx>>4 & 3] * s;
881 *dst++ = v[idx>>6 & 3] * s; 888 *dst++ = v[idx>>6 & 3] * s;
882 return dst; 889 return dst;
883 } 890 }
884 891 #endif
892
893 #ifndef VMUL2S
885 static inline float *VMUL2S(float *dst, const float *v, unsigned idx, 894 static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
886 unsigned sign, const float *scale) 895 unsigned sign, const float *scale)
887 { 896 {
888 union float754 s0, s1; 897 union float754 s0, s1;
889 898
894 *dst++ = v[idx & 15] * s0.f; 903 *dst++ = v[idx & 15] * s0.f;
895 *dst++ = v[idx>>4 & 15] * s1.f; 904 *dst++ = v[idx>>4 & 15] * s1.f;
896 905
897 return dst; 906 return dst;
898 } 907 }
899 908 #endif
909
910 #ifndef VMUL4S
900 static inline float *VMUL4S(float *dst, const float *v, unsigned idx, 911 static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
901 unsigned sign, const float *scale) 912 unsigned sign, const float *scale)
902 { 913 {
903 unsigned nz = idx >> 12; 914 unsigned nz = idx >> 12;
904 union float754 s = { .f = *scale }; 915 union float754 s = { .f = *scale };
919 t.i = s.i ^ (sign & 1<<31); 930 t.i = s.i ^ (sign & 1<<31);
920 *dst++ = v[idx>>6 & 3] * t.f; 931 *dst++ = v[idx>>6 & 3] * t.f;
921 932
922 return dst; 933 return dst;
923 } 934 }
935 #endif
924 936
925 /** 937 /**
926 * Decode spectral data; reference: table 4.50. 938 * Decode spectral data; reference: table 4.50.
927 * Dequantize and scale spectral data; reference: 4.6.3.3. 939 * Dequantize and scale spectral data; reference: 4.6.3.3.
928 * 940 *