summaryrefslogtreecommitdiff
path: root/ffmpeg/libswresample/rematrix_template.c
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
committerTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
commitf7813a5324be39d13ab536c245d15dfc602a7849 (patch)
treefad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libswresample/rematrix_template.c
parentb7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff)
basic type mechanism working
Diffstat (limited to 'ffmpeg/libswresample/rematrix_template.c')
-rw-r--r--ffmpeg/libswresample/rematrix_template.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/ffmpeg/libswresample/rematrix_template.c b/ffmpeg/libswresample/rematrix_template.c
index b8ca901..95a3b9a 100644
--- a/ffmpeg/libswresample/rematrix_template.c
+++ b/ffmpeg/libswresample/rematrix_template.c
@@ -36,14 +36,20 @@
# define COEFF int
# define INTER int
# define RENAME(x) x ## _s16
+#elif defined(TEMPLATE_REMATRIX_S32)
+# define R(x) (((x) + 16384)>>15)
+# define SAMPLE int32_t
+# define COEFF int
+# define INTER int64_t
+# 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){
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 +57,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]);
}
@@ -60,9 +66,9 @@ static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, inte
int i;
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]);
+ INTER t = in[2][i]*(INTER)coeffp[0*6+2] + in[3][i]*(INTER)coeffp[0*6+3];
+ 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]);
}
}
@@ -70,9 +76,9 @@ static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, inte
int i;
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]);
+ INTER t = in[2][i]*(INTER)coeffp[0*8+2] + in[3][i]*(INTER)coeffp[0*8+3];
+ 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]);
}
}