00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, int len);
00022
00023 static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, int index1, int index2, int len){
00024 int i;
00025 COEFF coeff1 = coeffp[index1];
00026 COEFF coeff2 = coeffp[index2];
00027
00028 for(i=0; i<len; i++)
00029 out[i] = R(coeff1*in1[i] + coeff2*in2[i]);
00030 }
00031
00032 static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, int index, int len){
00033 int i;
00034 COEFF coeff = coeffp[index];
00035 for(i=0; i<len; i++)
00036 out[i] = R(coeff*in[i]);
00037 }
00038
00039 static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, int len){
00040 int i;
00041
00042 for(i=0; i<len; i++) {
00043 INTER t = in[2][i]*coeffp[0*6+2] + in[3][i]*coeffp[0*6+3];
00044 out[0][i] = R(t + in[0][i]*coeffp[0*6+0] + in[4][i]*coeffp[0*6+4]);
00045 out[1][i] = R(t + in[1][i]*coeffp[1*6+1] + in[5][i]*coeffp[1*6+5]);
00046 }
00047 }
00048
00049 static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, int len){
00050 int i;
00051
00052 for(i=0; i<len; i++) {
00053 INTER t = in[2][i]*coeffp[0*8+2] + in[3][i]*coeffp[0*8+3];
00054 out[0][i] = R(t + in[0][i]*coeffp[0*8+0] + in[4][i]*coeffp[0*8+4] + in[6][i]*coeffp[0*8+6]);
00055 out[1][i] = R(t + in[1][i]*coeffp[1*8+1] + in[5][i]*coeffp[1*8+5] + in[7][i]*coeffp[1*8+7]);
00056 }
00057 }
00058
00059 static RENAME(mix_any_func_type) *RENAME(get_mix_any_func)(SwrContext *s){
00060 if( s->out_ch_layout == AV_CH_LAYOUT_STEREO && (s->in_ch_layout == AV_CH_LAYOUT_5POINT1 || s->in_ch_layout == AV_CH_LAYOUT_5POINT1_BACK)
00061 && s->matrix[0][2] == s->matrix[1][2] && s->matrix[0][3] == s->matrix[1][3]
00062 && !s->matrix[0][1] && !s->matrix[0][5] && !s->matrix[1][0] && !s->matrix[1][4]
00063 )
00064 return RENAME(mix6to2);
00065
00066 if( s->out_ch_layout == AV_CH_LAYOUT_STEREO && s->in_ch_layout == AV_CH_LAYOUT_7POINT1
00067 && s->matrix[0][2] == s->matrix[1][2] && s->matrix[0][3] == s->matrix[1][3]
00068 && !s->matrix[0][1] && !s->matrix[0][5] && !s->matrix[1][0] && !s->matrix[1][4]
00069 && !s->matrix[0][7] && !s->matrix[1][6]
00070 )
00071 return RENAME(mix8to2);
00072
00073 return NULL;
00074 }