Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -210,6 +210,9 @@ int swr_rematrix_init(SwrContext *s){
|
| 210 | 210 |
if(s->out_ch_layout & (1ULL<<i)) |
| 211 | 211 |
out_i++; |
| 212 | 212 |
} |
| 213 |
+ if(s->rematrix_volume < 0) |
|
| 214 |
+ maxcoef = -s->rematrix_volume; |
|
| 215 |
+ |
|
| 213 | 216 |
if(( s->out_sample_fmt < AV_SAMPLE_FMT_FLT |
| 214 | 217 |
|| s->int_sample_fmt < AV_SAMPLE_FMT_FLT) && maxcoef > 1.0){
|
| 215 | 218 |
for(i=0; i<SWR_CH_MAX; i++) |
| ... | ... |
@@ -218,6 +221,15 @@ int swr_rematrix_init(SwrContext *s){
|
| 218 | 218 |
s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768); |
| 219 | 219 |
} |
| 220 | 220 |
} |
| 221 |
+ |
|
| 222 |
+ if(s->rematrix_volume > 0){
|
|
| 223 |
+ for(i=0; i<SWR_CH_MAX; i++) |
|
| 224 |
+ for(j=0; j<SWR_CH_MAX; j++){
|
|
| 225 |
+ s->matrix[i][j] *= s->rematrix_volume; |
|
| 226 |
+ s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768); |
|
| 227 |
+ } |
|
| 228 |
+ } |
|
| 229 |
+ |
|
| 221 | 230 |
for(i=0; i<av_get_channel_layout_nb_channels(s->out_ch_layout); i++){
|
| 222 | 231 |
for(j=0; j<av_get_channel_layout_nb_channels(s->in_ch_layout); j++){
|
| 223 | 232 |
av_log(NULL, AV_LOG_DEBUG, "%f ", s->matrix[i][j]); |
| ... | ... |
@@ -49,6 +49,7 @@ static const AVOption options[]={
|
| 49 | 49 |
{"ocl", "output channel layout", OFFSET(out_ch_layout), AV_OPT_TYPE_INT64, {.dbl=0}, 0, INT64_MAX, 0, "channel_layout"},
|
| 50 | 50 |
{"clev", "center mix level" , OFFSET(clev) , AV_OPT_TYPE_FLOAT, {.dbl=C_30DB}, 0, 4, 0},
|
| 51 | 51 |
{"slev", "sourround mix level" , OFFSET(slev) , AV_OPT_TYPE_FLOAT, {.dbl=C_30DB}, 0, 4, 0},
|
| 52 |
+{"rmvol", "rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, -1000, 1000, 0},
|
|
| 52 | 53 |
{"flags", NULL , OFFSET(flags) , AV_OPT_TYPE_FLAGS, {.dbl=0}, 0, UINT_MAX, 0, "flags"},
|
| 53 | 54 |
{"res", "force resampling", 0, AV_OPT_TYPE_CONST, {.dbl=SWR_FLAG_RESAMPLE}, INT_MIN, INT_MAX, 0, "flags"},
|
| 54 | 55 |
|
| ... | ... |
@@ -176,7 +177,7 @@ int swr_init(SwrContext *s){
|
| 176 | 176 |
if(!s->out_ch_layout) |
| 177 | 177 |
s->out_ch_layout= av_get_default_channel_layout(s->out.ch_count); |
| 178 | 178 |
|
| 179 |
- s->rematrix= s->out_ch_layout !=s->in_ch_layout; |
|
| 179 |
+ s->rematrix= s->out_ch_layout !=s->in_ch_layout || s->rematrix_volume!=1.0; |
|
| 180 | 180 |
|
| 181 | 181 |
#define RSC 1 //FIXME finetune |
| 182 | 182 |
if(!s-> in.ch_count) |