57 void hb_fir_filter_mips(
float *
out,
const float fir_coef[
HB_FIR_SIZE + 1],
63 memcpy(data,
mem, HB_FIR_SIZE *
sizeof(
float));
68 float * p_data = (data+i);
75 "mtc1 $zero, %[output] \n\t"
76 "lwc1 $f0, 0(%[p_data]) \n\t"
77 "lwc1 $f1, 0(%[fir_coef]) \n\t"
78 "lwc1 $f2, 4(%[p_data]) \n\t"
79 "madd.s %[output], %[output], $f0, $f1 \n\t"
80 "lwc1 $f3, 4(%[fir_coef]) \n\t"
81 "lwc1 $f4, 8(%[p_data]) \n\t"
82 "madd.s %[output], %[output], $f2, $f3 \n\t"
83 "lwc1 $f5, 8(%[fir_coef]) \n\t"
85 "lwc1 $f0, 12(%[p_data]) \n\t"
86 "lwc1 $f1, 12(%[fir_coef]) \n\t"
87 "madd.s %[output], %[output], $f4, $f5 \n\t"
88 "lwc1 $f2, 16(%[p_data]) \n\t"
89 "madd.s %[output], %[output], $f0, $f1 \n\t"
90 "lwc1 $f3, 16(%[fir_coef]) \n\t"
91 "lwc1 $f4, 20(%[p_data]) \n\t"
92 "lwc1 $f5, 20(%[fir_coef]) \n\t"
93 "madd.s %[output], %[output], $f2, $f3 \n\t"
95 "lwc1 $f0, 24(%[p_data]) \n\t"
96 "lwc1 $f1, 24(%[fir_coef]) \n\t"
97 "lwc1 $f2, 28(%[p_data]) \n\t"
98 "madd.s %[output], %[output], $f4, $f5 \n\t"
99 "lwc1 $f3, 28(%[fir_coef]) \n\t"
100 "madd.s %[output], %[output], $f0, $f1 \n\t"
101 "lwc1 $f4, 32(%[p_data]) \n\t"
102 "madd.s %[output], %[output], $f2, $f3 \n\t"
103 "lwc1 $f5, 32(%[fir_coef]) \n\t"
104 "madd.s %[output], %[output], $f4, $f5 \n\t"
106 "lwc1 $f0, 36(%[p_data]) \n\t"
107 "lwc1 $f1, 36(%[fir_coef]) \n\t"
108 "lwc1 $f2, 40(%[p_data]) \n\t"
109 "lwc1 $f3, 40(%[fir_coef]) \n\t"
110 "madd.s %[output], %[output], $f0, $f1 \n\t"
111 "lwc1 $f4, 44(%[p_data]) \n\t"
112 "lwc1 $f5, 44(%[fir_coef]) \n\t"
113 "madd.s %[output], %[output], $f2, $f3 \n\t"
115 "lwc1 $f0, 48(%[p_data]) \n\t"
116 "lwc1 $f1, 48(%[fir_coef]) \n\t"
117 "lwc1 $f2, 52(%[p_data]) \n\t"
118 "madd.s %[output], %[output], $f4, $f5 \n\t"
119 "lwc1 $f3, 52(%[fir_coef]) \n\t"
120 "lwc1 $f4, 56(%[p_data]) \n\t"
121 "madd.s %[output], %[output], $f0, $f1 \n\t"
122 "lwc1 $f5, 56(%[fir_coef]) \n\t"
123 "madd.s %[output], %[output], $f2, $f3 \n\t"
125 "lwc1 $f0, 60(%[p_data]) \n\t"
126 "lwc1 $f1, 60(%[fir_coef]) \n\t"
127 "lwc1 $f2, 64(%[p_data]) \n\t"
128 "madd.s %[output], %[output], $f4, $f5 \n\t"
129 "lwc1 $f3, 64(%[fir_coef]) \n\t"
130 "madd.s %[output], %[output], $f0, $f1 \n\t"
131 "lwc1 $f4, 68(%[p_data]) \n\t"
132 "madd.s %[output], %[output], $f2, $f3 \n\t"
133 "lwc1 $f5, 68(%[fir_coef]) \n\t"
134 "madd.s %[output], %[output], $f4, $f5 \n\t"
136 "lwc1 $f0, 72(%[p_data]) \n\t"
137 "lwc1 $f1, 72(%[fir_coef]) \n\t"
138 "lwc1 $f2, 76(%[p_data]) \n\t"
139 "lwc1 $f3, 76(%[fir_coef]) \n\t"
140 "madd.s %[output], %[output], $f0, $f1 \n\t"
141 "lwc1 $f4, 80(%[p_data]) \n\t"
142 "lwc1 $f5, 80(%[fir_coef]) \n\t"
143 "madd.s %[output], %[output], $f2, $f3 \n\t"
145 "lwc1 $f0, 84(%[p_data]) \n\t"
146 "lwc1 $f1, 84(%[fir_coef]) \n\t"
147 "lwc1 $f2, 88(%[p_data]) \n\t"
148 "madd.s %[output], %[output], $f4, $f5 \n\t"
149 "lwc1 $f3, 88(%[fir_coef]) \n\t"
150 "lwc1 $f4, 92(%[p_data]) \n\t"
151 "madd.s %[output], %[output], $f0, $f1 \n\t"
152 "lwc1 $f5, 92(%[fir_coef]) \n\t"
153 "madd.s %[output], %[output], $f2, $f3 \n\t"
155 "lwc1 $f0, 96(%[p_data]) \n\t"
156 "lwc1 $f1, 96(%[fir_coef]) \n\t"
157 "lwc1 $f2, 100(%[p_data]) \n\t"
158 "madd.s %[output], %[output], $f4, $f5 \n\t"
159 "lwc1 $f3, 100(%[fir_coef]) \n\t"
160 "lwc1 $f4, 104(%[p_data]) \n\t"
161 "madd.s %[output], %[output], $f0, $f1 \n\t"
162 "lwc1 $f5, 104(%[fir_coef]) \n\t"
163 "madd.s %[output], %[output], $f2, $f3 \n\t"
165 "lwc1 $f0, 108(%[p_data]) \n\t"
166 "lwc1 $f1, 108(%[fir_coef]) \n\t"
167 "madd.s %[output], %[output], $f4, $f5 \n\t"
168 "lwc1 $f2, 112(%[p_data]) \n\t"
169 "lwc1 $f3, 112(%[fir_coef]) \n\t"
170 "madd.s %[output], %[output], $f0, $f1 \n\t"
171 "lwc1 $f4, 116(%[p_data]) \n\t"
172 "lwc1 $f5, 116(%[fir_coef]) \n\t"
173 "lwc1 $f0, 120(%[p_data]) \n\t"
174 "madd.s %[output], %[output], $f2, $f3 \n\t"
175 "lwc1 $f1, 120(%[fir_coef]) \n\t"
176 "madd.s %[output], %[output], $f4, $f5 \n\t"
177 "madd.s %[output], %[output], $f0, $f1 \n\t"
179 : [output]
"=&f"(output)
180 : [fir_coef]
"r"(fir_coef), [p_data]
"r"(p_data)
181 :
"$f0",
"$f1",
"$f2",
"$f3",
"$f4",
"$f5",
"memory"
185 memcpy(
mem, data + AMRWB_SFR_SIZE_16k, HB_FIR_SIZE *
sizeof(
float));
ptrdiff_t const GLvoid * data
Reference: libavcodec/amrwbdec.c.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
#define AMRWB_SFR_SIZE_16k
samples per subframe at 16 kHz
#define HB_FIR_SIZE
amount of past data needed by HB filters
AMR wideband data and definitions.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out