diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 5929ae4098..ed2d9fd883 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -494,13 +494,13 @@ av_cold int swri_rematrix_init(SwrContext *s){ } *((int*)s->native_one) = 32768; if (maxsum <= 32768) { - s->mix_1_1_f = (mix_1_1_func_type*)copy_s16; - s->mix_2_1_f = (mix_2_1_func_type*)sum2_s16; - s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s16(s); + s->mix_1_1_f = copy_s16; + s->mix_2_1_f = sum2_s16; + s->mix_any_f = get_mix_any_func_s16(s); } else { - s->mix_1_1_f = (mix_1_1_func_type*)copy_clip_s16; - s->mix_2_1_f = (mix_2_1_func_type*)sum2_clip_s16; - s->mix_any_f = (mix_any_func_type*)get_mix_any_func_clip_s16(s); + s->mix_1_1_f = copy_clip_s16; + s->mix_2_1_f = sum2_clip_s16; + s->mix_any_f = get_mix_any_func_clip_s16(s); } }else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(float)); @@ -511,9 +511,9 @@ av_cold int swri_rematrix_init(SwrContext *s){ for (j = 0; j < nb_in; j++) ((float*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((float*)s->native_one) = 1.0; - s->mix_1_1_f = (mix_1_1_func_type*)copy_float; - s->mix_2_1_f = (mix_2_1_func_type*)sum2_float; - s->mix_any_f = (mix_any_func_type*)get_mix_any_func_float(s); + s->mix_1_1_f = copy_float; + s->mix_2_1_f = sum2_float; + s->mix_any_f = get_mix_any_func_float(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_DBLP){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double)); s->native_one = av_mallocz(sizeof(double)); @@ -523,9 +523,9 @@ av_cold int swri_rematrix_init(SwrContext *s){ for (j = 0; j < nb_in; j++) ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((double*)s->native_one) = 1.0; - s->mix_1_1_f = (mix_1_1_func_type*)copy_double; - s->mix_2_1_f = (mix_2_1_func_type*)sum2_double; - s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s); + s->mix_1_1_f = copy_double; + s->mix_2_1_f = sum2_double; + s->mix_any_f = get_mix_any_func_double(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){ s->native_one = av_mallocz(sizeof(int)); if (!s->native_one) @@ -545,9 +545,9 @@ av_cold int swri_rematrix_init(SwrContext *s){ } } *((int*)s->native_one) = 32768; - s->mix_1_1_f = (mix_1_1_func_type*)copy_s32; - s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32; - s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s32(s); + s->mix_1_1_f = copy_s32; + s->mix_2_1_f = sum2_s32; + s->mix_any_f = get_mix_any_func_s32(s); }else av_assert0(0); //FIXME quantize for integeres diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c index d4726c4dbb..62ba3e53bf 100644 --- a/libswresample/rematrix_template.c +++ b/libswresample/rematrix_template.c @@ -49,9 +49,12 @@ # define RENAME(x) x ## _s32 #endif -typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, integer len); - -static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, integer index1, integer index2, integer len){ +static void RENAME(sum2)(void *out_, const void *in1_, const void *in2_, + void *coeffp_, integer index1, integer index2, integer len) +{ + const SAMPLE *in1 = in1_, *in2 = in2_; + const COEFF *coeffp = coeffp_; + SAMPLE *out = out_; int i; INTER coeff1 = coeffp[index1]; INTER coeff2 = coeffp[index2]; @@ -60,14 +63,22 @@ static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEF out[i] = R(coeff1*in1[i] + coeff2*in2[i]); } -static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, integer index, integer len){ +static void RENAME(copy)(void *out_, const void *in_, void *coeffp_, integer index, integer len) +{ + const COEFF *coeffp = coeffp_; + const SAMPLE *in = in_; + SAMPLE *out = out_; int i; INTER coeff = coeffp[index]; for(i=0; iout_ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) && ( !av_channel_layout_compare(&s->in_ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1) || !av_channel_layout_compare(&s->in_ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK))