Skip to content
Snippets Groups Projects
Commit 0b66ded9 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Philippe Gorley
Browse files

resampler: use a vector based matrix to support build w/msc

Change-Id: Ic7680230fe3f9c5f29c72978b0a9a2aa56b028cd
parent b38b204b
Branches
Tags
No related merge requests found
......@@ -64,9 +64,10 @@ Resampler::reinit(const AVFrame* in, const AVFrame* out)
* LFE downmixing is optional, so any coefficient can be used, we use +6dB for mono and
* +0dB in each channel for stereo.
*/
if (in->channel_layout == AV_CH_LAYOUT_5POINT1 || in->channels == 6) {
double matrix[out->channels][in->channels];
if (in->channel_layout == AV_CH_LAYOUT_5POINT1 || in->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) {
// NOTE MSVC can't allocate dynamic size arrays on the stack
if (out->channels == 2) {
double matrix[2][6];
// L = 1.0*FL + 0.707*FC + 0.707*BL + 1.0*LFE
matrix[0][0] = 1;
matrix[0][1] = 0;
......@@ -81,7 +82,9 @@ Resampler::reinit(const AVFrame* in, const AVFrame* out)
matrix[1][3] = 1;
matrix[1][4] = 0;
matrix[1][5] = 0.707;
swr_set_matrix(swrCtx_, matrix[0], 6);
} else {
double matrix[1][6];
// M = 1.0*FL + 1.414*FC + 1.0*FR + 0.707*BL + 0.707*BR + 2.0*LFE
matrix[0][0] = 1;
matrix[0][1] = 1;
......@@ -89,8 +92,8 @@ Resampler::reinit(const AVFrame* in, const AVFrame* out)
matrix[0][3] = 2;
matrix[0][4] = 0.707;
matrix[0][5] = 0.707;
swr_set_matrix(swrCtx_, matrix[0], 6);
}
swr_set_matrix(swrCtx_, matrix[0], in->channels);
}
swr_init(swrCtx_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment