00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00052 #include "libavutil/avutil.h"
00053 #include "libavcodec/amrwbdata.h"
00054 #include "amrwbdec_mips.h"
00055
00056 #if HAVE_INLINE_ASM
00057 void hb_fir_filter_mips(float *out, const float fir_coef[HB_FIR_SIZE + 1],
00058 float mem[HB_FIR_SIZE], const float *in)
00059 {
00060 int i;
00061 float data[AMRWB_SFR_SIZE_16k + HB_FIR_SIZE];
00062
00063 memcpy(data, mem, HB_FIR_SIZE * sizeof(float));
00064 memcpy(data + HB_FIR_SIZE, in, AMRWB_SFR_SIZE_16k * sizeof(float));
00065
00066 for (i = 0; i < AMRWB_SFR_SIZE_16k; i++) {
00067 float output;
00068 float * p_data = (data+i);
00069
00074 __asm__ volatile(
00075 "mtc1 $zero, %[output] \n\t"
00076 "lwc1 $f0, 0(%[p_data]) \n\t"
00077 "lwc1 $f1, 0(%[fir_coef]) \n\t"
00078 "lwc1 $f2, 4(%[p_data]) \n\t"
00079 "madd.s %[output], %[output], $f0, $f1 \n\t"
00080 "lwc1 $f3, 4(%[fir_coef]) \n\t"
00081 "lwc1 $f4, 8(%[p_data]) \n\t"
00082 "madd.s %[output], %[output], $f2, $f3 \n\t"
00083 "lwc1 $f5, 8(%[fir_coef]) \n\t"
00084
00085 "lwc1 $f0, 12(%[p_data]) \n\t"
00086 "lwc1 $f1, 12(%[fir_coef]) \n\t"
00087 "madd.s %[output], %[output], $f4, $f5 \n\t"
00088 "lwc1 $f2, 16(%[p_data]) \n\t"
00089 "madd.s %[output], %[output], $f0, $f1 \n\t"
00090 "lwc1 $f3, 16(%[fir_coef]) \n\t"
00091 "lwc1 $f4, 20(%[p_data]) \n\t"
00092 "lwc1 $f5, 20(%[fir_coef]) \n\t"
00093 "madd.s %[output], %[output], $f2, $f3 \n\t"
00094
00095 "lwc1 $f0, 24(%[p_data]) \n\t"
00096 "lwc1 $f1, 24(%[fir_coef]) \n\t"
00097 "lwc1 $f2, 28(%[p_data]) \n\t"
00098 "madd.s %[output], %[output], $f4, $f5 \n\t"
00099 "lwc1 $f3, 28(%[fir_coef]) \n\t"
00100 "madd.s %[output], %[output], $f0, $f1 \n\t"
00101 "lwc1 $f4, 32(%[p_data]) \n\t"
00102 "madd.s %[output], %[output], $f2, $f3 \n\t"
00103 "lwc1 $f5, 32(%[fir_coef]) \n\t"
00104 "madd.s %[output], %[output], $f4, $f5 \n\t"
00105
00106 "lwc1 $f0, 36(%[p_data]) \n\t"
00107 "lwc1 $f1, 36(%[fir_coef]) \n\t"
00108 "lwc1 $f2, 40(%[p_data]) \n\t"
00109 "lwc1 $f3, 40(%[fir_coef]) \n\t"
00110 "madd.s %[output], %[output], $f0, $f1 \n\t"
00111 "lwc1 $f4, 44(%[p_data]) \n\t"
00112 "lwc1 $f5, 44(%[fir_coef]) \n\t"
00113 "madd.s %[output], %[output], $f2, $f3 \n\t"
00114
00115 "lwc1 $f0, 48(%[p_data]) \n\t"
00116 "lwc1 $f1, 48(%[fir_coef]) \n\t"
00117 "lwc1 $f2, 52(%[p_data]) \n\t"
00118 "madd.s %[output], %[output], $f4, $f5 \n\t"
00119 "lwc1 $f3, 52(%[fir_coef]) \n\t"
00120 "lwc1 $f4, 56(%[p_data]) \n\t"
00121 "madd.s %[output], %[output], $f0, $f1 \n\t"
00122 "lwc1 $f5, 56(%[fir_coef]) \n\t"
00123 "madd.s %[output], %[output], $f2, $f3 \n\t"
00124
00125 "lwc1 $f0, 60(%[p_data]) \n\t"
00126 "lwc1 $f1, 60(%[fir_coef]) \n\t"
00127 "lwc1 $f2, 64(%[p_data]) \n\t"
00128 "madd.s %[output], %[output], $f4, $f5 \n\t"
00129 "lwc1 $f3, 64(%[fir_coef]) \n\t"
00130 "madd.s %[output], %[output], $f0, $f1 \n\t"
00131 "lwc1 $f4, 68(%[p_data]) \n\t"
00132 "madd.s %[output], %[output], $f2, $f3 \n\t"
00133 "lwc1 $f5, 68(%[fir_coef]) \n\t"
00134 "madd.s %[output], %[output], $f4, $f5 \n\t"
00135
00136 "lwc1 $f0, 72(%[p_data]) \n\t"
00137 "lwc1 $f1, 72(%[fir_coef]) \n\t"
00138 "lwc1 $f2, 76(%[p_data]) \n\t"
00139 "lwc1 $f3, 76(%[fir_coef]) \n\t"
00140 "madd.s %[output], %[output], $f0, $f1 \n\t"
00141 "lwc1 $f4, 80(%[p_data]) \n\t"
00142 "lwc1 $f5, 80(%[fir_coef]) \n\t"
00143 "madd.s %[output], %[output], $f2, $f3 \n\t"
00144
00145 "lwc1 $f0, 84(%[p_data]) \n\t"
00146 "lwc1 $f1, 84(%[fir_coef]) \n\t"
00147 "lwc1 $f2, 88(%[p_data]) \n\t"
00148 "madd.s %[output], %[output], $f4, $f5 \n\t"
00149 "lwc1 $f3, 88(%[fir_coef]) \n\t"
00150 "lwc1 $f4, 92(%[p_data]) \n\t"
00151 "madd.s %[output], %[output], $f0, $f1 \n\t"
00152 "lwc1 $f5, 92(%[fir_coef]) \n\t"
00153 "madd.s %[output], %[output], $f2, $f3 \n\t"
00154
00155 "lwc1 $f0, 96(%[p_data]) \n\t"
00156 "lwc1 $f1, 96(%[fir_coef]) \n\t"
00157 "lwc1 $f2, 100(%[p_data]) \n\t"
00158 "madd.s %[output], %[output], $f4, $f5 \n\t"
00159 "lwc1 $f3, 100(%[fir_coef]) \n\t"
00160 "lwc1 $f4, 104(%[p_data]) \n\t"
00161 "madd.s %[output], %[output], $f0, $f1 \n\t"
00162 "lwc1 $f5, 104(%[fir_coef]) \n\t"
00163 "madd.s %[output], %[output], $f2, $f3 \n\t"
00164
00165 "lwc1 $f0, 108(%[p_data]) \n\t"
00166 "lwc1 $f1, 108(%[fir_coef]) \n\t"
00167 "madd.s %[output], %[output], $f4, $f5 \n\t"
00168 "lwc1 $f2, 112(%[p_data]) \n\t"
00169 "lwc1 $f3, 112(%[fir_coef]) \n\t"
00170 "madd.s %[output], %[output], $f0, $f1 \n\t"
00171 "lwc1 $f4, 116(%[p_data]) \n\t"
00172 "lwc1 $f5, 116(%[fir_coef]) \n\t"
00173 "lwc1 $f0, 120(%[p_data]) \n\t"
00174 "madd.s %[output], %[output], $f2, $f3 \n\t"
00175 "lwc1 $f1, 120(%[fir_coef]) \n\t"
00176 "madd.s %[output], %[output], $f4, $f5 \n\t"
00177 "madd.s %[output], %[output], $f0, $f1 \n\t"
00178
00179 : [output]"=&f"(output)
00180 : [fir_coef]"r"(fir_coef), [p_data]"r"(p_data)
00181 : "$f0", "$f1", "$f2", "$f3", "$f4", "$f5"
00182 );
00183 out[i] = output;
00184 }
00185 memcpy(mem, data + AMRWB_SFR_SIZE_16k, HB_FIR_SIZE * sizeof(float));
00186 }
00187 #endif