Skip to content

Iq tool buffered #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

vladisslav2011
Copy link
Contributor

@vladisslav2011 vladisslav2011 commented Dec 14, 2021

Implement buffered file_source/file_sink to improve IQ recording/playback success rate in case of slow media/heavy background activity.
Includes #1013.
This is the last PR, created from splitting #1008 into smaller parts.
May close #1098
May close #1017

@vladisslav2011 vladisslav2011 mentioned this pull request Dec 14, 2021
@vladisslav2011 vladisslav2011 marked this pull request as draft December 16, 2021 15:42
@vladisslav2011
Copy link
Contributor Author

I think, there is better way to implement buffered file_source: reuse GNU Radio vmcircbuf for buffering, add throttle block functionality and, maybe, do type conversion inside of buffered file_source. All of these tasks are relatively lightweight and do not worth wasting dedicated thread and set of output buffers.

@vladisslav2011 vladisslav2011 force-pushed the iq_tool_buffered branch 3 times, most recently from ca781db to 208df18 Compare December 27, 2021 23:31
@vladisslav2011 vladisslav2011 force-pushed the iq_tool_buffered branch 7 times, most recently from 91079da to db90364 Compare January 5, 2022 02:13
@MightyPork
Copy link

I just tested this. It works better than the old system, looping also works great, but the slider is somewhat erratic.

  • I think it's limited to 1 second of resolution, so fine movement in shorter recordings is not possible
  • when you click on the slide to jump to that positionm, instead it starts playing from the beginning, or jumps to the end.
Peek.2022-02-18.21-39.gqrx.mp4

@vladisslav2011
Copy link
Contributor Author

  • instead it starts playing from the beginning, or jumps to the end

That's because slider left click granularity is 1 minute, but your recording is just 7 seconds long. Try clicking the slider with a middle mouse button or test it with a bit longer recording (2-3 minutes at least).

@MightyPork
Copy link

Ah, middle click works as left click normally would on a slider. This could use some explanation in the dialog, I would never find out. I rarely have recordings longer than a minute due to the file size.

How about << and >> buttons to do this 1 minute skip, perhaps at the ends of the slider?

@vladisslav2011
Copy link
Contributor Author

This could use some explanation in the dialog, I would never find out.

That's expected behavior to me. Left click does a page skip (like on scrollbars), middle click moves to exact position (like on scrollbars too).
Adding buttons is possible, but changing page skip would break keyboard navigation.

2022-02-19 00-08-45

@stefanino-ch
Copy link
Contributor

stefanino-ch commented Jul 21, 2023

Synced qgrx master branch as of 2023-07-20.
Integrated this pull request.

During compilation I get:
[ 26%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/mainwindow.cpp.o /home/stefan/sw-dev/gqrx-2023-07/gqrx/src/applications/gqrx/mainwindow.cpp: In constructor ‘MainWindow::MainWindow(const QString&, bool, QWidget*)’: /home/stefan/sw-dev/gqrx-2023-07/gqrx/src/applications/gqrx/mainwindow.cpp:124:34: error: ‘DEFAULT_FFT_SIZE’ is not a member of ‘receiver’ 124 | d_iqFftData.resize(receiver::DEFAULT_FFT_SIZE); | ^~~~~~~~~~~~~~~~ /home/stefan/sw-dev/gqrx-2023-07/gqrx/src/applications/gqrx/mainwindow.cpp:132:37: error: ‘DEFAULT_FFT_SIZE’ is not a member of ‘receiver’ 132 | d_audioFftData.resize(receiver::DEFAULT_FFT_SIZE); | ^~~~~~~~~~~~~~~~ gmake[2]: *** [src/CMakeFiles/gqrx.dir/build.make:221: src/CMakeFiles/gqrx.dir/applications/gqrx/mainwindow.cpp.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:233: src/CMakeFiles/gqrx.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 13:57:16: The process "/usr/bin/cmake" exited with code 2. Error while building/deploying project gqrx (kit: Desktop) When executing step "Build"

DEFAULT_FFT_SIZE is definitely missing in all the receiver files I have.
For me it looks like there's a dependency to a previous pr?

Here's what I got from the merge in receiver.h:

`
//<<<<<<< HEAD
static const unsigned int DEFAULT_FFT_SIZE = 8192;

//=======
enum file_formats {
FILE_FORMAT_LAST=0,
FILE_FORMAT_NONE,
FILE_FORMAT_CF,
FILE_FORMAT_CS8,
FILE_FORMAT_CS16L,
FILE_FORMAT_CS32L,
FILE_FORMAT_CS8U,
FILE_FORMAT_CS16LU,
FILE_FORMAT_CS32LU,
};

struct iq_tool_stats
{
    bool recording;
    bool playing;
    bool failed;
    int buffer_usage;
    size_t file_pos;
 };

//>>>>>>> pr1016
`
Note: // in front of the git tags are just for display purpose

Don't deleting the line:
static const unsigned int DEFAULT_FFT_SIZE = 8192;

Makes the code to compile. But not shure if there is still an issue with it.

@stefanino-ch
Copy link
Contributor

@vladisslav2011 something is wrong with the recordings. If I do a record of one Minute, a file length of 10 seconds is displayed in the IqRecorder window. If I play the file it shows data for 10 seconds, that's it.
Or in other words the recorded file is (60/10) 6 times shorter than it should be.

@vladisslav2011
Copy link
Contributor Author

There may be bugs from recent changes or previous incomplete rebase, missing recent fixes to IQ formats implementation.

While I still think, that the new plotter is not ready yet, maybe it's time to rebase my fork, rearrange commits and update old PRs.
I have not decided yet if I should include the new plotter and fix it's issues (heavy performance impact from averaging, references to absolute units, markers) or just revert it and subsequent fixes...
I think, I'll update my PRs today or tomorrow.

@stefanino-ch
Copy link
Contributor

There may be bugs from recent changes or previous incomplete rebase, missing recent fixes to IQ formats implementation.

While I still think, that the new plotter is not ready yet, maybe it's time to rebase my fork, rearrange commits and update old PRs. I have not decided yet if I should include the new plotter and fix it's issues (heavy performance impact from averaging, references to absolute units, markers) or just revert it and subsequent fixes... I think, I'll update my PRs today or tomorrow.

Just found that the shortened recording is already an issue in the main branch and not based on this pr.

@vladisslav2011 vladisslav2011 marked this pull request as ready for review July 28, 2023 23:06
@vladisslav2011
Copy link
Contributor Author

@stefanino-ch I've rebased all my pull requests on top of current master.
Feel free to tag me in case you found, that something got broken during rebase.

@stefanino-ch
Copy link
Contributor

@vladisslav2011
I used your pr during a long time in a recording system. The different file formats and the buffer helped a lot in therms of saving disk space and recording stability.
Unfortunately this system died, I've tried now to reintegrate your pr on the current main tree but get:

Auto-merging CMakeLists.txt
Auto-merging src/applications/gqrx/mainwindow.cpp
CONFLICT (content): Merge conflict in src/applications/gqrx/mainwindow.cpp
Auto-merging src/applications/gqrx/mainwindow.h
CONFLICT (content): Merge conflict in src/applications/gqrx/mainwindow.h
Auto-merging src/applications/gqrx/receiver.cpp
Auto-merging src/applications/gqrx/receiver.h
Auto-merging src/qtgui/freqctrl.cpp
CONFLICT (content): Merge conflict in src/qtgui/freqctrl.cpp
Auto-merging src/qtgui/freqctrl.h
Auto-merging src/qtgui/iq_tool.cpp
CONFLICT (content): Merge conflict in src/qtgui/iq_tool.cpp
Auto-merging src/qtgui/iq_tool.h
CONFLICT (content): Merge conflict in src/qtgui/iq_tool.h
Auto-merging src/qtgui/iq_tool.ui
Auto-merging src/qtgui/plotter.cpp
Auto-merging src/qtgui/plotter.h
Automatic merge failed; fix conflicts and then commit the result.

Updating all the code goes way off my programming knowledge (I was into all those files).

I wonder, are you maybe thinking about an update to get it to work on the current tree or is this illusoric?

vladisslav2011 and others added 6 commits April 3, 2025 21:46
...while playing back IQ file.

Problem: It is possible to change the center frequency while playing an
IQ file. In this case the real file center frequency does not get shifted
to a correct position, so the spectrum plot/waterfall becomes shifted from
actual played frequency, bookmarks become not valid, freqCtrl shows wrong
frequency, plotter shows wrong frequency and so on.

This commit changes frequency setting logic to be more staraightfroward
and consistent.

Independent of frequency change event source (freqctrls, plotter, remote)
do the things in a same way: calculate new center and offset, taking into
account the fact, that the center frequency may be loked due to IQ file
playback, set the new frequency on a receiver side, then update all GUI
controls to reflect changes.

Enforce new frequency limits on the plotter side when IQ playback is
started.
IQ recorder: disable harmful buttons while recording is in progress.

Changing IO devices and loading/saving settings does not look like good thing
to do while recording an IQ file.

IQ tool: Always choose correct sampling rate

Reselect file before starting playback. Fixes incorrect sample rate
when playback is started, stopped, devices switched, dsp started,
stopped and then started playback of the same IQ file.

IQ tool: disable/enable controls properly

Disable directory selector, file list while playing/recording  IQ
file.
Disable slider while recording IQ file.
To prevent buffer droppouts on HDD housekeeping/background activity
And add IQ player repeat option...
@vladisslav2011
Copy link
Contributor Author

@stefanino-ch
I've rebased the PR on top of current master. Tag me if something got broken during rebase.

@stefanino-ch
Copy link
Contributor

@vladisslav2011
I've integrated and tested today your PR update. No issues at all works smooth and saves a lot of recording space again. Thank you very much for your effort.

@argilo
The PR helps to save a lot of disk space while recording. As it is at the moment, and as far I could test, it integrates without any issue into the main tree. I vote for an integration very soon, as it might help also many others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loop IQ playback IQ Tool playback slider runaway when the DSP is stopped
4 participants