mirror of https://git.ffmpeg.org/ffmpeg.git
rematrix: change type of integers from 16 to 32bit to allow increasing volume with it.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1e40b2c22b
commit
b1470d7a60
|
@ -197,7 +197,7 @@ int swr_rematrix_init(SwrContext *s){
|
||||||
int ch_in=0;
|
int ch_in=0;
|
||||||
for(j=0; j<64; j++){
|
for(j=0; j<64; j++){
|
||||||
s->matrix[out_i][in_i]= matrix[i][j];
|
s->matrix[out_i][in_i]= matrix[i][j];
|
||||||
s->matrix16[out_i][in_i]= lrintf(matrix[i][j] * 32768);
|
s->matrix32[out_i][in_i]= lrintf(matrix[i][j] * 32768);
|
||||||
if(matrix[i][j]){
|
if(matrix[i][j]){
|
||||||
s->matrix_ch[out_i][++ch_in]= in_i;
|
s->matrix_ch[out_i][++ch_in]= in_i;
|
||||||
sum += fabs(matrix[i][j]);
|
sum += fabs(matrix[i][j]);
|
||||||
|
@ -215,7 +215,7 @@ int swr_rematrix_init(SwrContext *s){
|
||||||
for(i=0; i<SWR_CH_MAX; i++)
|
for(i=0; i<SWR_CH_MAX; i++)
|
||||||
for(j=0; j<SWR_CH_MAX; j++){
|
for(j=0; j<SWR_CH_MAX; j++){
|
||||||
s->matrix[i][j] /= maxcoef;
|
s->matrix[i][j] /= maxcoef;
|
||||||
s->matrix16[i][j]= lrintf(s->matrix[i][j] * 32768);
|
s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<av_get_channel_layout_nb_channels(s->out_ch_layout); i++){
|
for(i=0; i<av_get_channel_layout_nb_channels(s->out_ch_layout); i++){
|
||||||
|
@ -241,7 +241,7 @@ int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int must
|
||||||
if(s->int_sample_fmt == AV_SAMPLE_FMT_FLT){
|
if(s->int_sample_fmt == AV_SAMPLE_FMT_FLT){
|
||||||
copy_float((float *)out->ch[out_i], (const float *)in->ch[in_i], s->matrix [out_i][in_i], len);
|
copy_float((float *)out->ch[out_i], (const float *)in->ch[in_i], s->matrix [out_i][in_i], len);
|
||||||
}else
|
}else
|
||||||
copy_s16 ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[in_i], s->matrix16[out_i][in_i], len);
|
copy_s16 ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[in_i], s->matrix32[out_i][in_i], len);
|
||||||
}else{
|
}else{
|
||||||
out->ch[out_i]= in->ch[in_i];
|
out->ch[out_i]= in->ch[in_i];
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int must
|
||||||
len);
|
len);
|
||||||
}else{
|
}else{
|
||||||
sum2_s16 ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[ s->matrix_ch[out_i][1] ], (const int16_t*)in->ch[ s->matrix_ch[out_i][2] ],
|
sum2_s16 ((int16_t*)out->ch[out_i], (const int16_t*)in->ch[ s->matrix_ch[out_i][1] ], (const int16_t*)in->ch[ s->matrix_ch[out_i][2] ],
|
||||||
s->matrix16[out_i][ s->matrix_ch[out_i][1] ], s->matrix16[out_i][ s->matrix_ch[out_i][2] ],
|
s->matrix32[out_i][ s->matrix_ch[out_i][1] ], s->matrix32[out_i][ s->matrix_ch[out_i][2] ],
|
||||||
len);
|
len);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -272,7 +272,7 @@ int swr_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int must
|
||||||
int v=0;
|
int v=0;
|
||||||
for(j=0; j<s->matrix_ch[out_i][0]; j++){
|
for(j=0; j<s->matrix_ch[out_i][0]; j++){
|
||||||
in_i= s->matrix_ch[out_i][1+j];
|
in_i= s->matrix_ch[out_i][1+j];
|
||||||
v+= ((int16_t*)in->ch[in_i])[i] * s->matrix16[out_i][in_i];
|
v+= ((int16_t*)in->ch[in_i])[i] * s->matrix32[out_i][in_i];
|
||||||
}
|
}
|
||||||
((int16_t*)out->ch[out_i])[i]= (v + 16384)>>15;
|
((int16_t*)out->ch[out_i])[i]= (v + 16384)>>15;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ typedef struct SwrContext { //FIXME find unused fields
|
||||||
struct AVResampleContext *resample;
|
struct AVResampleContext *resample;
|
||||||
|
|
||||||
float matrix[SWR_CH_MAX][SWR_CH_MAX];
|
float matrix[SWR_CH_MAX][SWR_CH_MAX];
|
||||||
int16_t matrix16[SWR_CH_MAX][SWR_CH_MAX];
|
int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];
|
||||||
uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];
|
uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];
|
||||||
|
|
||||||
//TODO callbacks for asm optims
|
//TODO callbacks for asm optims
|
||||||
|
|
Loading…
Reference in New Issue