reduce dropped frames
This commit is contained in:
parent
6f12fe7ed5
commit
90ea4c599f
6
main.cpp
6
main.cpp
@ -71,11 +71,12 @@ static void poh_thread()
|
|||||||
{
|
{
|
||||||
std::vector<float> block_mag(block_len);
|
std::vector<float> block_mag(block_len);
|
||||||
|
|
||||||
|
poh_accept_input = true; // accept first block
|
||||||
while(!shutdown_threads) {
|
while(!shutdown_threads) {
|
||||||
poh_accept_input = true;
|
|
||||||
poh_input_ready.acquire();
|
poh_input_ready.acquire();
|
||||||
|
|
||||||
fft_mag(poh_input_block, block_mag.data(), block_len);
|
fft_mag(poh_input_block, block_mag.data(), block_len);
|
||||||
|
poh_accept_input = true; // poh_input_block not used again until next iteration
|
||||||
|
|
||||||
// stabilize laser
|
// stabilize laser
|
||||||
float freq_peak_local;
|
float freq_peak_local;
|
||||||
@ -107,10 +108,11 @@ static void ls_thread()
|
|||||||
{
|
{
|
||||||
std::vector<float> block_mag(block_len);
|
std::vector<float> block_mag(block_len);
|
||||||
|
|
||||||
while(!shutdown_threads) {
|
|
||||||
ls_accept_input = true;
|
ls_accept_input = true;
|
||||||
|
while(!shutdown_threads) {
|
||||||
ls_input_ready.acquire();
|
ls_input_ready.acquire();
|
||||||
fft_mag(ls_input_block, block_mag.data(), block_len);
|
fft_mag(ls_input_block, block_mag.data(), block_len);
|
||||||
|
ls_accept_input = true;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(wf_ls_mutex);
|
std::lock_guard<std::mutex> guard(wf_ls_mutex);
|
||||||
std::memmove(&wf_ls[wf_width], &wf_ls[0], sizeof(int)*wf_width*(wf_height - 1));
|
std::memmove(&wf_ls[wf_width], &wf_ls[0], sizeof(int)*wf_width*(wf_height - 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user