Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b887c96db92a
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 75f6036c5d68
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Feb 24, 2020

  1. Stretched digital samples into two, so that digital waveforms with fa…

    …r-spaced samples look sane. Fixes #65.
    azonenberg committed Feb 24, 2020
    Copy the full SHA
    75f6036 View commit details
Showing with 35 additions and 15 deletions.
  1. +35 −15 glscopeclient/WaveformArea_rendering.cpp
50 changes: 35 additions & 15 deletions glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -85,26 +85,46 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
//TODO: some of this can probably move to GPU too?
vector<float> traceBuffer;
vector<uint32_t> indexBuffer;
traceBuffer.resize(count*2);
indexBuffer.resize(m_width);
double offset = channel->GetOffset();
#pragma omp parallel for num_threads(8)
for(size_t j=0; j<count; j++)
{
traceBuffer[j*2] = pdat->GetSampleStart(j) * xscale + xoff;

float y;
if(digdat)
if(digdat)
{
//We need to stretch every sample to two samples, one at the very left and one at the very right,
//so interpolation works right.
//TODO: we can probably avoid this by rewriting the compute shader to not interpolate like this
size_t realcount = count;
count *= 2;

traceBuffer.resize(count*2);
indexBuffer.resize(m_width);
#pragma omp parallel for num_threads(8)
for(size_t j=0; j<realcount; j++)
{
//TODO: digital overlay stuff
y = ybase + 5 + ( (*digdat)[j] ? 20: 0 );
traceBuffer[j*4] = pdat->GetSampleStart(j) * xscale + xoff;
traceBuffer[j*4 + 2] = pdat->GetSampleEnd(j) * xscale + xoff - 1;

float y = ybase + 5 + ( (*digdat)[j] ? 20: 0 );
traceBuffer[j*4 + 1] = y;
traceBuffer[j*4 + 3] = y;
}
else if(fft)
y = DbToYPosition(-70 - (20 * log10((*andat)[j]))); //TODO: don't hard code plot limits
else
y = (m_pixelsPerVolt * ((*andat)[j] + offset)) + ybase;
}
else
{
traceBuffer.resize(count*2);
indexBuffer.resize(m_width);
#pragma omp parallel for num_threads(8)
for(size_t j=0; j<count; j++)
{
traceBuffer[j*2] = pdat->GetSampleStart(j) * xscale + xoff;

traceBuffer[j*2 + 1] = y;
float y;
if(fft)
y = DbToYPosition(-70 - (20 * log10((*andat)[j]))); //TODO: don't hard code plot limits
else
y = (m_pixelsPerVolt * ((*andat)[j] + offset)) + ybase;

traceBuffer[j*2 + 1] = y;
}
}

double dt = GetTime() - start;