rematrix: add type for coefficients

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/2/head
Michael Niedermayer 13 years ago
parent 9f9b2ab1b1
commit 1e40b2c22b
  1. 3
      libswresample/rematrix.c
  2. 4
      libswresample/rematrix_template.c

@ -25,16 +25,19 @@
#define ONE (1.0) #define ONE (1.0)
#define R(x) x #define R(x) x
#define SAMPLE float #define SAMPLE float
#define COEFF float
#define RENAME(x) x ## _float #define RENAME(x) x ## _float
#include "rematrix_template.c" #include "rematrix_template.c"
#undef SAMPLE #undef SAMPLE
#undef RENAME #undef RENAME
#undef R #undef R
#undef ONE #undef ONE
#undef COEFF
#define ONE (-32768) #define ONE (-32768)
#define R(x) (((x) + 16384)>>15) #define R(x) (((x) + 16384)>>15)
#define SAMPLE int16_t #define SAMPLE int16_t
#define COEFF int
#define RENAME(x) x ## _s16 #define RENAME(x) x ## _s16
#include "rematrix_template.c" #include "rematrix_template.c"

@ -19,14 +19,14 @@
*/ */
static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, SAMPLE coeff1, SAMPLE coeff2, int len){ static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF coeff1, COEFF coeff2, int len){
int i; int i;
for(i=0; i<len; i++) for(i=0; i<len; i++)
out[i] = R(coeff1*in1[i] + coeff2*in2[i]); out[i] = R(coeff1*in1[i] + coeff2*in2[i]);
} }
static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, SAMPLE coeff, int len){ static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF coeff, int len){
if(coeff == ONE){ if(coeff == ONE){
memcpy(out, in, sizeof(SAMPLE)*len); memcpy(out, in, sizeof(SAMPLE)*len);
}else{ }else{

Loading…
Cancel
Save