GSoC 2023: Improve Waveform drawing speed

Week 5 Report: June 26th to July 2nd

  • PR was up for review but we didn’t manage to get it merged (@iss was working in person with the rest of the Blender team).
  • Chatted with @iss about the next steps:
    • The sequencer draw code already only requests waveforms for strips that are already visible, so there’s nothing there we can improve
    • The best option to improve things regarding visibility would be to determine how much (%) of the strip is visible and only read enough samples to render that part of the waveform.

I toyed with the idea of having a struct like this associated with each stripe:

struct WaveformSpanData {
  struct WaveformSpanData* next;
  void* waveformData;
  uint8_t spanStart;
  uint8_t spanEnd;

};

Every time we need to re-draw the strip we do the following:

  1. Determine what “span” of the strip is visible
  2. Check the if the current span overlaps with any existing ones
  3. If the span overlaps:
    1. If the span is entirely contained within an existing span, we just draw the waveform.
    2. If the span is not entirely contained, we merge the overlapping spans and only read the missing waveform data.
  4. If there are no overlapping spans, issue the read for this new span and push it to the WaveformSpanData list

I’m still working on the implementation.
I need to figure out how to deal with AUD_readSound.

I’m not totally sure if I can arbitrarily seek to a position in the AUD_Sound object. If I can, then it should be fairly easy to just seek the audio to a position before requesting the new waveform data.

NOTE: Span start/end are tracked as uint8_t since a span only goes from 0% to 100% of the of the strip. We’ll require that spans start/end percentages be integers (instead of floating point).

Next step

5 Likes