From c9c43f9f14cca93d29e15f9a897539734e92834f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 13 Sep 2023 16:03:40 +0800 Subject: [PATCH] consistent naming --- main.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/main.cpp b/main.cpp index e7fe4d4..e702e32 100644 --- a/main.cpp +++ b/main.cpp @@ -26,7 +26,7 @@ using namespace std::literals::chrono_literals; void fft_mag(std::complex* in, float* out, size_t len); -static const size_t block_len = 16384; +static const size_t frame_len = 16384; static const int wf_width = 1000; static const int wf_height = 1200; @@ -58,7 +58,7 @@ static void tec_thread() static std::atomic poh_accept_input; static std::binary_semaphore poh_input_ready{0}; -static std::complex poh_input_block[block_len]; +static std::complex poh_input_frame[frame_len]; static std::mutex wf_poh_mutex; static unsigned int wf_poh[wf_width*wf_height]; @@ -69,18 +69,18 @@ static std::atomic tec_p; static void poh_thread() { - std::vector block_mag(block_len); + std::vector frame_mag(frame_len); - poh_accept_input = true; // accept first block + poh_accept_input = true; // accept first frame while(!shutdown_threads) { poh_input_ready.acquire(); - fft_mag(poh_input_block, block_mag.data(), block_len); - poh_accept_input = true; // poh_input_block not used again until next iteration + fft_mag(poh_input_frame, frame_mag.data(), frame_len); + poh_accept_input = true; // poh_input_frame not used again until next iteration // stabilize laser float freq_peak_local; - freq_peak_local = 40.0f*float(distance(block_mag.begin(), max_element(block_mag.begin(), block_mag.end())))/float(block_len); + freq_peak_local = 40.0f*float(distance(frame_mag.begin(), max_element(frame_mag.begin(), frame_mag.end())))/float(frame_len); freq_peak = freq_peak_local; float freq_error = freq_peak_local - freq_setpoint; tec_current = std::max(tec_bias+tec_p*freq_error, 0.0f); @@ -90,8 +90,8 @@ static void poh_thread() std::lock_guard guard(wf_poh_mutex); std::memmove(&wf_poh[wf_width], &wf_poh[0], sizeof(int)*wf_width*(wf_height - 1)); for(int i=0;i ls_accept_input; static std::binary_semaphore ls_input_ready{0}; -static std::complex ls_input_block[block_len]; +static std::complex ls_input_frame[frame_len]; static std::mutex wf_ls_mutex; static unsigned int wf_ls[wf_width*wf_height]; static void ls_thread() { - std::vector block_mag(block_len); + std::vector frame_mag(frame_len); ls_accept_input = true; while(!shutdown_threads) { ls_input_ready.acquire(); - fft_mag(ls_input_block, block_mag.data(), block_len); + fft_mag(ls_input_frame, frame_mag.data(), frame_len); ls_accept_input = true; { std::lock_guard guard(wf_ls_mutex); std::memmove(&wf_ls[wf_width], &wf_ls[0], sizeof(int)*wf_width*(wf_height - 1)); for(int i=0;i* samples = (std::complex*)samples_v; - for(size_t i=0;i