Skip to content

Commit

Permalink
libmyth/audio/freesurround*: silence -Wshadow
Browse files Browse the repository at this point in the history
freesurround_decoder.cpp: This was identical to a code block before the if.

freesurround.cpp:

The fsurround_params constructor is never called explicitly, so just set
the default values in the struct definition.  Those values are immediately
overwritten in the FreeSurround constructor anyways.

In FreeSurround::putFrames(), copy the shadowed variables into the places
they are used.
  • Loading branch information
ulmus-scott committed Jul 30, 2024
1 parent 2b2cc28 commit 588a94b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
17 changes: 6 additions & 11 deletions mythtv/libs/libmyth/audio/freesurround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ void FreeSurround::SetParams()
}
}

FreeSurround::fsurround_params::fsurround_params(int32_t center_width,
int32_t dimension) :
center_width(center_width),
dimension(dimension)
{
}

FreeSurround::~FreeSurround()
{
LOG(VB_AUDIO, LOG_DEBUG, QString("FreeSurround::~FreeSurround"));
Expand All @@ -151,10 +144,6 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
auto *samples = (float *)buffer;
// demultiplex

float **inputs = m_decoder->getInputBuffers();
float *lt = &inputs[0][ic];
float *rt = &inputs[1][ic];

if ((m_surroundMode != SurroundModePassive) && (ic+numFrames > bs))
{
numFrames = bs - ic;
Expand All @@ -177,6 +166,9 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
process = false;
break;
default:
float **inputs = m_decoder->getInputBuffers();
float *lt = &inputs[0][ic];
float *rt = &inputs[1][ic];
for (i=0; i<numFrames; i++)
*lt++ = *rt++ = *samples++;
process = true;
Expand Down Expand Up @@ -216,6 +208,9 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
process = false;
break;
default:
float **inputs = m_decoder->getInputBuffers();
float *lt = &inputs[0][ic];
float *rt = &inputs[1][ic];
for (i=0; i<numFrames; i++)
{
*lt++ = *samples++;
Expand Down
6 changes: 2 additions & 4 deletions mythtv/libs/libmyth/audio/freesurround.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ class FreeSurround

// the changeable parameters
struct fsurround_params {
int32_t center_width; // presence of the center channel
int32_t dimension; // dimension
int32_t center_width { 100 }; // presence of the center channel
int32_t dimension { 0 }; // dimension
float coeff_a { 0.8165 }; // surround mixing coefficients
float coeff_b { 0.5774 }; // surround mixing coefficients
int32_t phasemode { 0 }; // phase shifting mode
int32_t steering { 1 }; // steering mode (0=simple, 1=linear)
int32_t front_sep { 100 }; // front stereo separation
int32_t rear_sep { 100 }; // rear stereo separation
// (default) constructor
explicit fsurround_params(int32_t center_width=100, int32_t dimension=0);
} m_params;

// additional settings
Expand Down
7 changes: 0 additions & 7 deletions mythtv/libs/libmyth/audio/freesurround_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,6 @@ class fsurround_decoder::Impl {
} else {
// --- this is the old & simple steering mode ---

// calculate the amplitude/phase difference
float ampDiff = clamp_unit_mag((ampL+ampR < epsilon) ? 0 : (ampR-ampL) / (ampR+ampL));
float phaseDiff = phaseL - phaseR;
if (phaseDiff < -PI) phaseDiff += 2*PI;
if (phaseDiff > PI) phaseDiff -= 2*PI;
phaseDiff = abs(phaseDiff);

// determine sound field x-position
m_xFs[f] = ampDiff;

Expand Down

0 comments on commit 588a94b

Please sign in to comment.