diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2023-10-24 23:54:18 +0200 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2023-10-24 23:54:18 +0200 |
commit | d3aacbb8c67fb07ef60308c7e8cdebd9c188ff62 (patch) | |
tree | 6e21b9f749adb5d585f18584ff4c01eafe9ffe9c | |
parent | fe85f8d1ad38c19246b048075b307819933260b5 (diff) | |
download | atracdenc-d3aacbb8c67fb07ef60308c7e8cdebd9c188ff62.tar.gz |
Simplify cmake. Fix warnings.
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 38 | ||||
-rw-r--r-- | src/atrac1denc.cpp | 4 | ||||
-rw-r--r-- | src/atrac3denc.cpp | 4 | ||||
-rw-r--r-- | src/atrac3denc.h | 2 | ||||
-rw-r--r-- | src/rm.cpp | 2 |
6 files changed, 27 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f831b7..7d07bfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1) project(atracdenc) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f8130f4..ea5144b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,26 +1,31 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.0) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1) -macro(use_11) - if (CMAKE_VERSION VERSION_LESS "3.1") - message ("cmake version: " ${CMAKE_VERSION} " --std arguments will be forced") - - set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE) - set (CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE) - else () - set (CMAKE_CXX_STANDARD 11) - set (CMAKE_C_STANDARD 11) - endif () -endmacro(use_11) - -use_11() +set (CMAKE_CXX_STANDARD 11) +set (CMAKE_C_STANDARD 11) #add_definitions( "-Wall -O2 -g -Rpass-analysis=loop-vectorize" ) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer") -if (UNIX) - add_definitions( "-Wall -O2 -g" ) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE) endif() +include(CheckCXXCompilerFlag) + +function(enable_cxx_compiler_flag_if_supported flag) + string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${flag}" flag_supported) + if(flag_supported) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() + +enable_cxx_compiler_flag_if_supported("-Wall") +enable_cxx_compiler_flag_if_supported("-Wextra") + project(atracdenc) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") @@ -95,3 +100,4 @@ set(SOURCE_EXE add_executable(atracdenc ${SOURCE_EXE}) target_link_libraries(atracdenc pcm_io oma atracdenc_impl ${SNDFILE_LIBRARIES}) install(TARGETS atracdenc) + diff --git a/src/atrac1denc.cpp b/src/atrac1denc.cpp index 64e4f48..93a69b8 100644 --- a/src/atrac1denc.cpp +++ b/src/atrac1denc.cpp @@ -132,7 +132,7 @@ void TAtrac1MDCT::IMdct(TFloat Specs[512], const TBlockSize& mode, TFloat* low, } TPCMEngine<TFloat>::TProcessLambda TAtrac1Decoder::GetLambda() { - return [this](TFloat* data, const TPCMEngine<TFloat>::ProcessMeta& meta) { + return [this](TFloat* data, const TPCMEngine<TFloat>::ProcessMeta& /*meta*/) { TFloat sum[512]; const uint32_t srcChannels = Aea->GetChannelNum(); for (uint32_t channel = 0; channel < srcChannels; channel++) { @@ -169,7 +169,7 @@ TPCMEngine<TFloat>::TProcessLambda TAtrac1Encoder::GetLambda() { bitAlloc.push_back(new TAtrac1SimpleBitAlloc(Aea.get(), Settings.GetBfuIdxConst(), Settings.GetFastBfuNumSearch())); } - return [this, srcChannels, bitAlloc](TFloat* data, const TPCMEngine<TFloat>::ProcessMeta& meta) { + return [this, srcChannels, bitAlloc](TFloat* data, const TPCMEngine<TFloat>::ProcessMeta& /*meta*/) { for (uint32_t channel = 0; channel < srcChannels; channel++) { TFloat src[NumSamples]; vector<TFloat> specs(512); diff --git a/src/atrac3denc.cpp b/src/atrac3denc.cpp index 29db54a..c6be93e 100644 --- a/src/atrac3denc.cpp +++ b/src/atrac3denc.cpp @@ -91,7 +91,6 @@ void TAtrac3MDCT::Midct(TFloat specs[1024], TFloat* bands[4], TGainDemodulatorAr TAtrac3Encoder::TAtrac3Encoder(TCompressedOutputPtr&& oma, TAtrac3EncoderSettings&& encoderSettings) : Oma(std::move(oma)) , Params(std::move(encoderSettings)) - , TransientDetectors(2 * 4, TTransientDetector(8, 256)) //2 - channels, 4 - bands , SingleChannelElements(Params.SourceChannels) , TransientParamsHistory(Params.SourceChannels, std::vector<TTransientParam>(4)) {} @@ -209,7 +208,6 @@ TAtrac3Encoder::TTransientParam TAtrac3Encoder::CalcTransientParam(const std::ve void TAtrac3Encoder::CreateSubbandInfo(TFloat* in[4], uint32_t channel, - TTransientDetector* transientDetector, TAtrac3Data::SubbandInfo* subbandInfo) { @@ -318,7 +316,7 @@ TPCMEngine<TFloat>::TProcessLambda TAtrac3Encoder::GetLambda() sce->SubbandInfo.Reset(); if (!Params.NoGainControll) { TFloat* p[4] = {PcmBuffer.GetSecond(channel), PcmBuffer.GetSecond(channel+2), PcmBuffer.GetSecond(channel+4), PcmBuffer.GetSecond(channel+6)}; - CreateSubbandInfo(p, channel, &TransientDetectors[channel*4], &sce->SubbandInfo); //4 detectors per band + CreateSubbandInfo(p, channel, &sce->SubbandInfo); //4 detectors per band } TFloat* maxOverlapLevels = PrevPeak[channel]; diff --git a/src/atrac3denc.h b/src/atrac3denc.h index 3d373a2..febf6f7 100644 --- a/src/atrac3denc.h +++ b/src/atrac3denc.h @@ -88,7 +88,6 @@ class TAtrac3Encoder : public IProcessor<TFloat>, public TAtrac3MDCT { Atrac3SplitFilterBank<TFloat> SplitFilterBank[2]; TScaler<TAtrac3Data> Scaler; - std::vector<TTransientDetector> TransientDetectors; std::vector<NAtrac3::TAtrac3BitStreamWriter::TSingleChannelElement> SingleChannelElements; public: struct TTransientParam { @@ -107,7 +106,6 @@ public: TFloat LimitRel(TFloat x); TTransientParam CalcTransientParam(const std::vector<TFloat>& gain, TFloat lastMax); void CreateSubbandInfo(TFloat* in[4], uint32_t channel, - TTransientDetector* transientDetector, TAtrac3Data::SubbandInfo* subbandInfo); void ResetTransientParamsHistory(int channel, int band); void SetTransientParamsHistory(int channel, int band, const TTransientParam& params); @@ -147,7 +147,7 @@ void scramble_data(const char* input, char* out, size_t bytes) { class TRm : public ICompressedOutput { public: - TRm(const std::string& filename, const std::string& title, uint8_t numChannels, + TRm(const std::string& filename, const std::string& /*title*/, uint8_t numChannels, uint32_t numFrames, uint32_t frameSize, bool jointStereo) : File_(OpenFile(filename)) , FrameDuration_((1000.0 * 1024.0 / 44100.0)) // ms |