25 #define AVC_ITRANS_H(in0, in1, in2, in3, out0, out1, out2, out3) \
27 v8i16 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
32 tmp2_m = tmp2_m - in3; \
34 tmp3_m = in1 + tmp3_m; \
36 BUTTERFLY_4(tmp0_m, tmp1_m, tmp2_m, tmp3_m, out0, out1, out2, out3); \
43 v8i16 hres0, hres1, hres2, hres3;
44 v8i16 vres0, vres1, vres2, vres3;
47 LD4x4_SH(src, src0, src1, src2, src3);
48 AVC_ITRANS_H(src0, src1, src2, src3, hres0, hres1, hres2, hres3);
50 AVC_ITRANS_H(hres0, hres1, hres2, hres3, vres0, vres1, vres2, vres3);
53 ST_SH2(zeros, zeros, src, 8);
63 v8i16 input_dc, pred_r, pred_l;
65 dc = (src[0] + 32) >> 6;
66 input_dc = __msa_fill_h(dc);
69 LW4(dst, dst_stride, src0, src1, src2, src3);
77 out = __msa_pckev_b((v16i8) pred_l, (v16i8) pred_r);
78 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
84 #define DC_DEST_STRIDE 16
85 int16_t out0, out1, out2, out3;
87 v8i16 vec0, vec1, vec2, vec3;
88 v8i16 hres0, hres1, hres2, hres3;
89 v8i16 vres0, vres1, vres2, vres3;
90 v4i32 vres0_r, vres1_r, vres2_r, vres3_r;
91 v4i32 de_q_vec = __msa_fill_w(de_q_val);
93 LD4x4_SH(src, src0, src1, src2, src3);
95 BUTTERFLY_4(src0, src2, src3, src1, vec0, vec3, vec2, vec1);
96 BUTTERFLY_4(vec0, vec1, vec2, vec3, hres0, hres3, hres2, hres1);
98 BUTTERFLY_4(hres0, hres1, hres3, hres2, vec0, vec3, vec2, vec1);
99 BUTTERFLY_4(vec0, vec1, vec2, vec3, vres0, vres1, vres2, vres3);
110 SRARI_W4_SW(vres0_r, vres1_r, vres2_r, vres3_r, 8);
111 PCKEV_H2_SH(vres1_r, vres0_r, vres3_r, vres2_r, vec0, vec1);
113 out0 = __msa_copy_s_h(vec0, 0);
114 out1 = __msa_copy_s_h(vec0, 1);
115 out2 = __msa_copy_s_h(vec0, 2);
116 out3 = __msa_copy_s_h(vec0, 3);
123 out0 = __msa_copy_s_h(vec0, 4);
124 out1 = __msa_copy_s_h(vec0, 5);
125 out2 = __msa_copy_s_h(vec0, 6);
126 out3 = __msa_copy_s_h(vec0, 7);
133 out0 = __msa_copy_s_h(vec1, 0);
134 out1 = __msa_copy_s_h(vec1, 1);
135 out2 = __msa_copy_s_h(vec1, 2);
136 out3 = __msa_copy_s_h(vec1, 3);
143 out0 = __msa_copy_s_h(vec1, 4);
144 out1 = __msa_copy_s_h(vec1, 5);
145 out2 = __msa_copy_s_h(vec1, 6);
146 out3 = __msa_copy_s_h(vec1, 7);
152 #undef DC_DEST_STRIDE
157 v8i16
src0,
src1, src2, src3, src4, src5, src6, src7;
158 v8i16 vec0, vec1, vec2, vec3;
159 v8i16 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
160 v8i16 res0, res1, res2, res3, res4, res5, res6, res7;
161 v4i32 tmp0_r, tmp1_r, tmp2_r, tmp3_r, tmp4_r, tmp5_r, tmp6_r, tmp7_r;
162 v4i32 tmp0_l, tmp1_l, tmp2_l, tmp3_l, tmp4_l, tmp5_l, tmp6_l, tmp7_l;
163 v4i32 vec0_r, vec1_r, vec2_r, vec3_r, vec0_l, vec1_l, vec2_l, vec3_l;
164 v4i32 res0_r, res1_r, res2_r, res3_r, res4_r, res5_r, res6_r, res7_r;
165 v4i32 res0_l, res1_l, res2_l, res3_l, res4_l, res5_l, res6_l, res7_l;
166 v16i8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
171 LD_SH8(src, 8, src0, src1, src2, src3, src4, src5, src6, src7);
180 BUTTERFLY_4(vec0, vec1, vec2, vec3, tmp0, tmp1, tmp2, tmp3);
183 vec0 = src5 - vec0 - src3 - src7;
185 vec1 = src1 - vec1 + src7 - src3;
187 vec2 = vec2 - src1 + src7 + src5;
189 vec3 = vec3 + src3 + src5 +
src1;
199 BUTTERFLY_8(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7,
200 res0, res1, res2, res3, res4, res5, res6, res7);
202 res0, res1, res2, res3, res4, res5, res6, res7);
211 BUTTERFLY_4(tmp0_r, tmp0_l, tmp4_l, tmp4_r, vec0_r, vec0_l, vec1_l, vec1_r);
213 vec2_r = tmp2_r >> 1;
214 vec2_l = tmp2_l >> 1;
217 vec3_r = tmp6_r >> 1;
218 vec3_l = tmp6_l >> 1;
222 BUTTERFLY_4(vec0_r, vec1_r, vec2_r, vec3_r, tmp0_r, tmp2_r, tmp4_r, tmp6_r);
223 BUTTERFLY_4(vec0_l, vec1_l, vec2_l, vec3_l, tmp0_l, tmp2_l, tmp4_l, tmp6_l);
225 vec0_r = tmp7_r >> 1;
226 vec0_l = tmp7_l >> 1;
227 vec0_r = tmp5_r - vec0_r - tmp3_r - tmp7_r;
228 vec0_l = tmp5_l - vec0_l - tmp3_l - tmp7_l;
229 vec1_r = tmp3_r >> 1;
230 vec1_l = tmp3_l >> 1;
231 vec1_r = tmp1_r - vec1_r + tmp7_r - tmp3_r;
232 vec1_l = tmp1_l - vec1_l + tmp7_l - tmp3_l;
233 vec2_r = tmp5_r >> 1;
234 vec2_l = tmp5_l >> 1;
235 vec2_r = vec2_r - tmp1_r + tmp7_r + tmp5_r;
236 vec2_l = vec2_l - tmp1_l + tmp7_l + tmp5_l;
237 vec3_r = tmp1_r >> 1;
238 vec3_l = tmp1_l >> 1;
239 vec3_r = vec3_r + tmp3_r + tmp5_r + tmp1_r;
240 vec3_l = vec3_l + tmp3_l + tmp5_l + tmp1_l;
241 tmp1_r = vec3_r >> 2;
242 tmp1_l = vec3_l >> 2;
245 tmp3_r = vec2_r >> 2;
246 tmp3_l = vec2_l >> 2;
249 tmp5_r = vec1_r >> 2;
250 tmp5_l = vec1_l >> 2;
253 tmp7_r = vec0_r >> 2;
254 tmp7_l = vec0_l >> 2;
255 tmp7_r = vec3_r - tmp7_r;
256 tmp7_l = vec3_l - tmp7_l;
258 BUTTERFLY_4(tmp0_r, tmp0_l, tmp7_l, tmp7_r, res0_r, res0_l, res7_l, res7_r);
259 BUTTERFLY_4(tmp2_r, tmp2_l, tmp5_l, tmp5_r, res1_r, res1_l, res6_l, res6_r);
260 BUTTERFLY_4(tmp4_r, tmp4_l, tmp3_l, tmp3_r, res2_r, res2_l, res5_l, res5_r);
261 BUTTERFLY_4(tmp6_r, tmp6_l, tmp1_l, tmp1_r, res3_r, res3_l, res4_l, res4_r);
262 SRA_4V(res0_r, res0_l, res1_r, res1_l, 6);
263 SRA_4V(res2_r, res2_l, res3_r, res3_l, 6);
264 SRA_4V(res4_r, res4_l, res5_r, res5_l, 6);
265 SRA_4V(res6_r, res6_l, res7_r, res7_l, 6);
266 PCKEV_H4_SH(res0_l, res0_r, res1_l, res1_r, res2_l, res2_r, res3_l, res3_r,
267 res0, res1, res2, res3);
268 PCKEV_H4_SH(res4_l, res4_r, res5_l, res5_r, res6_l, res6_r, res7_l, res7_r,
269 res4, res5, res6, res7);
270 LD_SB8(dst, dst_stride, dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7);
271 ILVR_B4_SH(zeros, dst0, zeros, dst1, zeros, dst2, zeros, dst3,
272 tmp0, tmp1, tmp2, tmp3);
273 ILVR_B4_SH(zeros, dst4, zeros, dst5, zeros, dst6, zeros, dst7,
274 tmp4, tmp5, tmp6, tmp7);
275 ADD4(res0, tmp0, res1, tmp1, res2, tmp2, res3, tmp3,
276 res0, res1, res2, res3);
277 ADD4(res4, tmp4, res5, tmp5, res6, tmp6, res7, tmp7,
278 res4, res5, res6, res7);
281 PCKEV_B4_SB(res1, res0, res3, res2, res5, res4, res7, res6,
282 dst0, dst1, dst2, dst3);
283 ST8x4_UB(dst0, dst1, dst, dst_stride);
284 dst += (4 * dst_stride);
285 ST8x4_UB(dst2, dst3, dst, dst_stride);
292 v16i8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
293 v8i16 dst0_r, dst1_r, dst2_r, dst3_r, dst4_r, dst5_r, dst6_r, dst7_r;
297 dc_val = (src[0] + 32) >> 6;
298 dc = __msa_fill_h(dc_val);
302 LD_SB8(dst, dst_stride, dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7);
303 ILVR_B4_SH(zeros, dst0, zeros, dst1, zeros, dst2, zeros, dst3,
304 dst0_r, dst1_r, dst2_r, dst3_r);
305 ILVR_B4_SH(zeros, dst4, zeros, dst5, zeros, dst6, zeros, dst7,
306 dst4_r, dst5_r, dst6_r, dst7_r);
307 ADD4(dst0_r, dc, dst1_r, dc, dst2_r, dc, dst3_r, dc,
308 dst0_r, dst1_r, dst2_r, dst3_r);
309 ADD4(dst4_r, dc, dst5_r, dc, dst6_r, dc, dst7_r, dc,
310 dst4_r, dst5_r, dst6_r, dst7_r);
313 PCKEV_B4_SB(dst1_r, dst0_r, dst3_r, dst2_r, dst5_r, dst4_r, dst7_r, dst6_r,
314 dst0, dst1, dst2, dst3);
315 ST8x4_UB(dst0, dst1, dst, dst_stride);
316 dst += (4 * dst_stride);
317 ST8x4_UB(dst2, dst3, dst, dst_stride);
324 memset(src, 0, 16 *
sizeof(
dctcoef));
331 memset(src, 0, 64 *
sizeof(
dctcoef));
353 for (i = 0; i < 16; i++) {
357 if (nnz == 1 && ((
dctcoef *) block)[i * 16])
359 block + i * 16 *
sizeof(
pixel),
363 block + i * 16 *
sizeof(
pixel),
375 for (cnt = 0; cnt < 16; cnt += 4) {
379 if (nnz == 1 && ((
dctcoef *) block)[cnt * 16])
381 block + cnt * 16 *
sizeof(
pixel),
385 block + cnt * 16 *
sizeof(
pixel),
398 for (j = 1; j < 3; j++) {
399 for (i = (j * 16); i < (j * 16 + 4); i++) {
402 block + i * 16 *
sizeof(
pixel),
404 else if (((
dctcoef *) block)[i * 16])
406 block + i * 16 *
sizeof(
pixel),
419 for (j = 1; j < 3; j++) {
420 for (i = (j * 16); i < (j * 16 + 4); i++) {
423 block + i * 16 *
sizeof(
pixel),
425 else if (((
dctcoef *) block)[i * 16])
427 block + i * 16 *
sizeof(
pixel),
432 for (j = 1; j < 3; j++) {
433 for (i = (j * 16 + 4); i < (j * 16 + 8); i++) {
434 if (nzc[
scan8[i + 4]])
436 block + i * 16 *
sizeof(
pixel),
438 else if (((
dctcoef *) block)[i * 16])
440 block + i * 16 *
sizeof(
pixel),
454 for (i = 0; i < 16; i++) {
457 block + i * 16 *
sizeof(
pixel), dst_stride);
458 else if (((
dctcoef *) block)[i * 16])
460 block + i * 16 *
sizeof(
pixel),
#define ADDBLK_ST4x4_UB(in0, in1, in2, in3, pdst, stride)
void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
static void avc_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
static void avc_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, int32_t de_q_val)
static void avc_idct4x4_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
#define AVC_ITRANS_H(in0, in1, in2, in3, out0, out1, out2, out3)
#define ST4x4_UB(in0, in1, idx0, idx1, idx2, idx3, pdst, stride)
#define SRA_4V(in0, in1, in2, in3, shift)
#define UNPCK_UB_SH(in, out0, out1)
#define CLIP_SH2_0_255(in0, in1)
#define BUTTERFLY_4(in0, in1, in2, in3, out0, out1, out2, out3)
void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
#define UNPCK_R_SH_SW(in, out)
#define ADD4(in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, out2, out3)
void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
void ff_h264_idct_add8_422_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
#define LD4x4_SH(psrc, out0, out1, out2, out3)
#define TRANSPOSE8x8_SH_SH(...)
#define CLIP_SH4_0_255(in0, in1, in2, in3)
static const uint8_t scan8[16 *3+3]
void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, int32_t de_qval)
void ff_h264_idct8_add4_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
#define BUTTERFLY_8(in0, in1, in2, in3, in4, in5, in6, in7,out0, out1, out2, out3, out4, out5, out6, out7)
#define INSERT_W4_UB(...)
void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
static const float pred[4]
static void avc_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
#define UNPCK_SH_SW(in, out0, out1)
static void avc_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
#define LW4(psrc, stride, out0, out1, out2, out3)
#define ST8x4_UB(in0, in1, pdst, stride)
void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
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
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-> dc
#define TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, out0, out1, out2, out3)