diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 66a43c1..03152c1 100644
|
a
|
b
|
av_cold int swri_rematrix_init(SwrContext *s){
|
| 445 | 445 | s->mix_2_1_f = (mix_2_1_func_type*)sum2_double; |
| 446 | 446 | s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s); |
| 447 | 447 | }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){ |
| 448 | | // Only for dithering currently |
| 449 | | // s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double)); |
| 450 | | s->native_one = av_mallocz(sizeof(int)); |
| | 448 | s->native_matrix = av_calloc(nb_in * nb_out, sizeof(int64_t)); |
| | 449 | s->native_one = av_mallocz(sizeof(int64_t)); |
| 451 | 450 | if (!s->native_one) |
| 452 | 451 | return AVERROR(ENOMEM); |
| 453 | | // for (i = 0; i < nb_out; i++) |
| 454 | | // for (j = 0; j < nb_in; j++) |
| 455 | | // ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; |
| | 452 | for (i = 0; i < nb_out; i++) { |
| | 453 | double rem = 0; |
| | 454 | |
| | 455 | for (j = 0; j < nb_in; j++) { |
| | 456 | double target = s->matrix[i][j] * 32768 + rem; |
| | 457 | ((int64_t*)s->native_matrix)[i * nb_in + j] = lrintf(target); |
| | 458 | rem += target - ((int64_t*)s->native_matrix)[i * nb_in + j]; |
| | 459 | } |
| | 460 | } |
| 456 | 461 | *((int*)s->native_one) = 32768; |
| 457 | 462 | s->mix_1_1_f = (mix_1_1_func_type*)copy_s32; |
| 458 | 463 | s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32; |