Skip to content

Commit

Permalink
Remove global 'using namespace std'.
Browse files Browse the repository at this point in the history
  • Loading branch information
wo80 committed Jan 1, 2024
1 parent 1d115c0 commit b510967
Show file tree
Hide file tree
Showing 25 changed files with 40 additions and 53 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ src/examples/python/streaming_extractor/streaming_extractortuningfrequency.h
# this shouldn't be here, but yeah well...
test/src/basetest/test_*.o
src/algorithms/essentia_algorithms_reg.cpp
src/algorithms/essentia_algorithms_reg_2.h

# pre-built 3rdparty dependencies
packaging/debian_3rdparty/bin
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/extractor/musicextractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class MusicExtractor : public Algorithm {

const char* statsArray[] = { "mean", "var", "stdev", "median", "min", "max", "dmean", "dmean2", "dvar", "dvar2" };
const char* cepstrumStatsArray[] = { "mean", "cov", "icov" };
vector<string> stats = arrayToVector<string>(statsArray);
vector<string> cepstrumStats = arrayToVector<string>(cepstrumStatsArray);
std::vector<std::string> stats = arrayToVector<std::string>(statsArray);
std::vector<std::string> cepstrumStats = arrayToVector<std::string>(cepstrumStatsArray);

declareParameter("lowlevelStats", "the statistics to compute for low-level features", "", stats);
declareParameter("tonalStats", "the statistics to compute for tonal features", "", stats);
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/rhythm/superfluxnovelty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void SuperFluxNovelty::configure() {

void SuperFluxNovelty::compute() {

const vector< vector<Real> >& bands = _bands.get();
const std::vector< std::vector<Real> >& bands = _bands.get();
Real& diffs = _diffs.get();

int nFrames = bands.size();
Expand All @@ -52,7 +52,7 @@ const vector< vector<Real> >& bands = _bands.get();
throw EssentiaException("SuperFluxNovelty: not enough frames for the specified frameWidth");
}

vector<Real> maxsBuffer(nBands, 0);
std::vector<Real> maxsBuffer(nBands, 0);

// buffer for differences
Real cur_diff;
Expand Down
3 changes: 1 addition & 2 deletions src/algorithms/rhythm/superfluxnovelty.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define ESSENTIA_SUPERFLUXNOVELTY_H

#include "algorithmfactory.h"
using namespace std;

namespace essentia {
namespace standard {
Expand Down Expand Up @@ -74,7 +73,7 @@ namespace streaming {
class SuperFluxNovelty : public Algorithm {

protected:
Sink< vector<Real> > _bands;
Sink< std::vector<Real> > _bands;
Source<Real > _diffs;

essentia::standard::Algorithm* _algo;
Expand Down
8 changes: 4 additions & 4 deletions src/algorithms/rhythm/superfluxpeaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ void SuperFluxPeaks::configure() {

void SuperFluxPeaks::compute() {

const vector<Real>& signal = _signal.get();
vector<Real>& peaks = _peaks.get();
const std::vector<Real>& signal = _signal.get();
std::vector<Real>& peaks = _peaks.get();
if (signal.empty()) {
peaks.resize(0);
return;
}

int size = signal.size();

vector<Real> avg(size);
std::vector<Real> avg(size);
_movAvg->input("signal").set(signal);
_movAvg->output("signal").set(avg);
_movAvg->compute();

vector<Real> maxs(size);
std::vector<Real> maxs(size);
_maxf->input("signal").set(signal);
_maxf->output("signal").set(maxs);
_maxf->compute();
Expand Down
1 change: 0 additions & 1 deletion src/algorithms/rhythm/superfluxpeaks.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "algorithmfactory.h"

using namespace std;
namespace essentia {
namespace standard {

Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/spectral/spectrumtocent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ void SpectrumToCent::configure() {


void SpectrumToCent::compute() {
const vector<Real>& spectrum = _spectrumInput.get();
vector<Real>& bands = _bandsOutput.get();
vector<Real>& freqs = _freqOutput.get();
const std::vector<Real>& spectrum = _spectrumInput.get();
std::vector<Real>& bands = _bandsOutput.get();
std::vector<Real>& freqs = _freqOutput.get();

if (spectrum.size() <= 1) {
throw EssentiaException("SpectrumToCent: the size of the input spectrum is not greater than one");
Expand Down
2 changes: 0 additions & 2 deletions src/algorithms/spectral/spectrumtocent.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "essentiautil.h"
#include "algorithmfactory.h"

using namespace std;

namespace essentia {
namespace standard {

Expand Down
6 changes: 3 additions & 3 deletions src/algorithms/spectral/triangularbands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void TriangularBands::configure() {


void TriangularBands::compute() {
const vector<Real>& spectrum = _spectrumInput.get();
vector<Real>& bands = _bandsOutput.get();
const std::vector<Real>& spectrum = _spectrumInput.get();
std::vector<Real>& bands = _bandsOutput.get();

if (spectrum.size() <= 1) {
throw EssentiaException("TriangularBands: the size of the input spectrum is not greater than one");
Expand Down Expand Up @@ -120,7 +120,7 @@ void TriangularBands::createFilters(int spectrumSize) {
throw EssentiaException("TriangularBands: Filter bank cannot be computed from a spectrum with less than 2 bins");
}

_filterCoefficients = vector<vector<Real> >(_nBands, vector<Real>(spectrumSize, 0.0));
_filterCoefficients = std::vector<std::vector<Real> >(_nBands, std::vector<Real>(spectrumSize, 0.0));

Real frequencyScale = (_sampleRate / 2.0) / (spectrumSize - 1);

Expand Down
2 changes: 0 additions & 2 deletions src/algorithms/spectral/triangularbands.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "algorithm.h"
#include "essentiautil.h"

using namespace std;

namespace essentia {
namespace standard {

Expand Down
8 changes: 3 additions & 5 deletions src/algorithms/standard/maxfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@

#include "algorithmfactory.h"

using namespace std;

namespace essentia {
namespace standard {

class MaxFilter : public Algorithm {

protected:
Input<vector<Real> > _array;
Output<vector<Real> > _filtered;
Input<std::vector<Real> > _array;
Output<std::vector<Real> > _filtered;

// circular buffer containing past values
vector<Real> _buffer;
std::vector<Real> _buffer;
Real _curMax;
bool _filledBuffer;
int _bufferFillIdx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
#include "essentia/streaming/algorithms/vectorinput.h"


using namespace std;
using namespace essentia;
using namespace essentia::streaming;

class FreesoundDescriptorSet {

public:
static const string nameSpace;
static const std::string nameSpace;

protected:
Pool options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
#include "FreesoundDescriptorsSet.h"
#include "essentia/essentiamath.h"

using namespace std;

class FreesoundLowlevelDescriptors : public FreesoundDescriptorSet {

public:
static const string nameSpace;
static const std::string nameSpace;

FreesoundLowlevelDescriptors(Pool& options) {
this->options = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@

#include "FreesoundDescriptorsSet.h"

using namespace std;
using namespace essentia;
using namespace essentia::streaming;

class FreesoundRhythmDescriptors : public FreesoundDescriptorSet {

public:

static const string nameSpace;
static const std::string nameSpace;

FreesoundRhythmDescriptors(Pool& options) {
this->options = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FreesoundSfxDescriptors : public FreesoundDescriptorSet {

public:

static const string nameSpace;
static const std::string nameSpace;

FreesoundSfxDescriptors(Pool& options) {
this->options = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class FreesoundTonalDescriptors : public FreesoundDescriptorSet {

public:
static const string nameSpace;
static const std::string nameSpace;

FreesoundTonalDescriptors(Pool& options) {
this->options = options;
Expand Down
3 changes: 1 addition & 2 deletions src/essentia/utils/extractor_music/MusicDescriptorsSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
#include "essentia/streaming/algorithms/poolstorage.h"
#include "essentia/streaming/algorithms/vectorinput.h"

using namespace std;
using namespace essentia;
using namespace essentia::streaming;

class MusicDescriptorSet {

public:
static const string nameSpace;
static const std::string nameSpace;

protected:
Pool options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
#include "MusicDescriptorsSet.h"
#include "essentia/essentiamath.h"

using namespace std;

class MusicLowlevelDescriptors : public MusicDescriptorSet {

public:
static const string nameSpace;
static const std::string nameSpace;

MusicLowlevelDescriptors(Pool& options) {
this->options = options;
Expand Down
3 changes: 1 addition & 2 deletions src/essentia/utils/extractor_music/MusicRhythmDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@

#include "MusicDescriptorsSet.h"

using namespace std;
using namespace essentia;
using namespace essentia::streaming;

class MusicRhythmDescriptors : public MusicDescriptorSet {

public:

static const string nameSpace;
static const std::string nameSpace;

MusicRhythmDescriptors(Pool& options) {
this->options = options;
Expand Down
2 changes: 1 addition & 1 deletion src/essentia/utils/extractor_music/MusicTonalDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class MusicTonalDescriptors : public MusicDescriptorSet {

public:
static const string nameSpace;
static const std::string nameSpace;

MusicTonalDescriptors(Pool& options) {
this->options = options;
Expand Down
6 changes: 5 additions & 1 deletion src/essentia/utils/tnt/jama_eig.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// for abs() below

using namespace TNT;
using namespace std;

namespace JAMA
{
Expand Down Expand Up @@ -219,6 +218,8 @@ class Eigenvalue

void tql2 () {

using std::max;

// This is derived from the Algol procedures tql2, by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
// Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
Expand Down Expand Up @@ -455,6 +456,9 @@ class Eigenvalue

void hqr2 () {

using std::min;
using std::max;

// This is derived from the Algol procedure hqr2,
// by Martin and Wilkinson, Handbook for Auto. Comp.,
// Vol.ii-Linear Algebra, and the corresponding
Expand Down
2 changes: 1 addition & 1 deletion src/essentia/utils/tnt/jama_lu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//for min(), max() below

using namespace TNT;
using namespace std;

namespace JAMA
{
Expand Down Expand Up @@ -78,6 +77,7 @@ class LU
piv(A.dim1())

{
using std::min;

// Use a "left-looking", dot-product, Crout/Doolittle algorithm.

Expand Down
3 changes: 2 additions & 1 deletion src/essentia/utils/tnt/jama_svd.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// for abs() below

using namespace TNT;
using namespace std;

namespace JAMA
{
Expand Down Expand Up @@ -49,6 +48,8 @@ class SVD

SVD (const Array2D<Real> &Arg) {

using std::min;
using std::max;

m = Arg.dim1();
n = Arg.dim2();
Expand Down
8 changes: 3 additions & 5 deletions src/examples/credit_libav.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using namespace std;


void creditLibAV() {
// credit using LibAv in extractors to comply with LibAv license
// see: https://libav.org/legal.html
cout << endl <<
"This software uses code of Libav (https://libav.org) licensed under the " << endl <<
"LGPLv2.1 (see: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)" << endl;
std::cout << std::endl <<
"This software uses code of Libav (https://libav.org) licensed under the " << std::endl <<
"LGPLv2.1 (see: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)" << std::endl;
}


3 changes: 1 addition & 2 deletions src/examples/music_extractor/extractor_utils.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include <essentia/pool.h>
#include <essentia/algorithmfactory.h>

using namespace std;
using namespace essentia;

void setExtractorDefaultOptions(Pool &options);
void setExtractorOptions(const std::string& filename, Pool& options);
void mergeValues(Pool& pool, Pool& options);
void outputToFile(Pool& pool, const string& outputFilename, Pool& options);
void outputToFile(Pool& pool, const std::string& outputFilename, Pool& options);

0 comments on commit b510967

Please sign in to comment.