Skip to content

Commit

Permalink
Fixed linux compile flags
Browse files Browse the repository at this point in the history
  • Loading branch information
williamyang98 committed Jul 10, 2023
1 parent f16fedd commit 5c09338
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 41 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ endif()

target_compile_definitions(easyloggingpp PRIVATE ELPP_THREAD_SAFE)

# TODO: Determine if there is a working CMake third party script that lets us find the most aggressive SIMD options possible
if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
# x86 processors
message(STATUS "Setting x86 SIMD CXX_FLAGS and defines")
if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING)
# NOTE: The MSVC compiler assumes a conservative microarchitecture and optimises using SSE2 by default
# Since this is a performance sensitive application, we want to be aggressive with SIMD optimisations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /arch:AVX2")
# NOTE: If we are on a platform without AVX2
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /arch:AVX")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /arch:AVX")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma -ffast-math")
# NOTE: If we are compiling with sse4.2 not avx2+fma (affects pll and viterbi decoder)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -ffast-math")
# NOTE: We are optimising specifically for your CPU's microarchitecture
# This is okay since we don't ship prebuilt binaries for linux distributions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -ffast-math")
endif()
else()
# arm processors
Expand Down
43 changes: 8 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You can change the compiler options in CMakeLists.txt to disable or enable these

Refer to [this github issue](https://github.com/FiendChain/DAB-Radio/issues/2#issuecomment-1627787907) explaining how to modify the build for **older CPUs**.

On Windows you also need to edit the <code>vcpkg.json</code> manifest so that FFTW uses the "avx" feature instead of "avx2". Depending on how old your CPU is, you can also try out "sse2" and "sse". Likewise for Ubuntu you will need to determine which flags your cpu supports. You can do this by running <code>cat /proc/cpuinfo</code> and checking the flags section.
***NOTE***: On Windows you also need to edit the <code>vcpkg.json</code> manifest so that FFTW uses the correct feature instead of "avx2". Valid options are ["avx2","avx","sse2","sse"]. Linux builds will compile to the cpu's microarchitecture using <code>-march=native</code>.

Dependencies are (refer to <code>vcpkg.json</code> or <code>toolchains/*/install_packages.sh</code>):
- glfw3
Expand All @@ -93,39 +93,12 @@ The continuous integration (CI) scripts are in <code>.github/workflows</code> if
- [RJVB/sse_mathfun](https://github.com/RJVB/sse_mathfun) for their SSE2 implementations of _mm_cos_pd

# TODO
## Optimisations
- Make OFDM demodulator more performant
- ~~Replace use of cosf and sinf in phase locked loop for fine freq compensation~~
- ~~Added multithreading to improve performance~~
- ~~Speed up complex multiplication with manual vectorization~~
- ~~Replaced atan2f with L1 norm and component extraction~~
- ~~Make DAB frame decoder more performant~~
- ~~Replace inefficient general viterbi decoder with the SPIRAL project's implementation found [here](https://www.spiral.net/software/viterbi.html).~~
- Profile other parts of the code that are excessively slow
- Error correction
- ~~Use soft decision Viterbi decoding to improve error correction at low SNR~~
- ~~Increase the traceback length of the Viterbi decoder (Not preferrable due to currently slow implementation)~~
- Determine how to use the firecode CRC16 in the AAC super frame to correct errors

## Features
- Improve the basic radio GUI
- Make a user friendly interface that is streamlined
- Replace imgui with a less GPU/CPU hungry GUI framework
- ~~Integrate the rtl_sdr.exe code from the librtlsdr library~~
- ~~Add in ensemble scanning across possible block frequencies~~
- ~~Add support for basic radio to handle multiple ensembles~~
- Automatically scan ensembles and persist data
- Support the rest of the DAB standard
- MPEG-II audio for DAB channels
- ~~Stream/packet data for slideshows and extra programme information~~
- Handle strings with utf-8, utf-16 character sets (right now they show up as a question mark)
- ~~Add coarse frequency correction~~
- For OFDM demodulator the hand written SIMD might perform extremely poorly when compiling on gcc or clang.
- For DAB+ determine how to perform error correction on the firecode CRC16 in the AAC super frame.
- Replace imgui with a retain mode alternative.
- Automatically scan DAB ensembles and channels and persistent them on the user's drive.
- Support the rest of the DAB standard.
- MPEG-II audio for DAB channels.
- Handle strings with utf-8, utf-16 character sets.
- Add TII (transmitter identificaton information) decoding
- Add SNR meter
- Add view for OFDM symbol magnitude spectrum
- Persist DAB database on the hard disk
- Save as JSON
- Load from JSON at runtime if specified

## Documentation
- Add as much comments to link specific pieces of code to parts of the standard that were heavily referenced. This includes the specific document number, the specific clause and specific table/chart used.
1 change: 1 addition & 0 deletions src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function(init_example target)
if(DEFINED MSVC)
target_compile_options(${target} PRIVATE "/MP")
else()
target_compile_options(${target} PRIVATE -pthread)
target_link_libraries(${target} PRIVATE pthread)
endif()
endfunction()
Expand Down

0 comments on commit 5c09338

Please sign in to comment.