diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c
index b8ca901b65addcb421898dbf16a2f33d9ffd65ac..ecdeab3460ab61bfa2b1d0d2f2d9829f3af47e31 100644
--- a/libswresample/rematrix_template.c
+++ b/libswresample/rematrix_template.c
@@ -42,8 +42,8 @@ typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF
 
 static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, integer index1, integer index2, integer len){
     int i;
-    COEFF coeff1 = coeffp[index1];
-    COEFF coeff2 = coeffp[index2];
+    INTER coeff1 = coeffp[index1];
+    INTER coeff2 = coeffp[index2];
 
     for(i=0; i<len; i++)
         out[i] = R(coeff1*in1[i] + coeff2*in2[i]);
@@ -51,7 +51,7 @@ static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEF
 
 static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, integer index, integer len){
     int i;
-    COEFF coeff = coeffp[index];
+    INTER coeff = coeffp[index];
     for(i=0; i<len; i++)
         out[i] = R(coeff*in[i]);
 }
@@ -61,8 +61,8 @@ static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, inte
 
     for(i=0; i<len; i++) {
         INTER t = in[2][i]*coeffp[0*6+2] + in[3][i]*coeffp[0*6+3];
-        out[0][i] = R(t + in[0][i]*coeffp[0*6+0] + in[4][i]*coeffp[0*6+4]);
-        out[1][i] = R(t + in[1][i]*coeffp[1*6+1] + in[5][i]*coeffp[1*6+5]);
+        out[0][i] = R(t + in[0][i]*(INTER)coeffp[0*6+0] + in[4][i]*(INTER)coeffp[0*6+4]);
+        out[1][i] = R(t + in[1][i]*(INTER)coeffp[1*6+1] + in[5][i]*(INTER)coeffp[1*6+5]);
     }
 }
 
@@ -71,8 +71,8 @@ static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, inte
 
     for(i=0; i<len; i++) {
         INTER t = in[2][i]*coeffp[0*8+2] + in[3][i]*coeffp[0*8+3];
-        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]);
-        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]);
+        out[0][i] = R(t + in[0][i]*(INTER)coeffp[0*8+0] + in[4][i]*(INTER)coeffp[0*8+4] + in[6][i]*(INTER)coeffp[0*8+6]);
+        out[1][i] = R(t + in[1][i]*(INTER)coeffp[1*8+1] + in[5][i]*(INTER)coeffp[1*8+5] + in[7][i]*(INTER)coeffp[1*8+7]);
     }
 }