GSoC 2022: Waveform improvements(Feedback Thread)

Hi everyone, this is a feedback thread for my GSoC 2022 project. To keep weekly report thread clean, I don’t want to write too much details in that. Instead, I will write more in this topic(maybe just like write blog here? I’m not sure). I hope to get more feedback to improve my work and code ability. Feel free to use this thread!


Weekly Report(more details):
I am busy with my final now, for I can’t do much work these days.

What I have done:
Read the source code of VSE

I have read some source code of VSE and I found some files maybe important to me. BKE_sound_read_waveform function in sound.c reads the audio and saves it in sound->waveform. The core of this function is AUD_readSound function in AUD_special.cpp, which actually read the aduio and waste most time of waveform drawing in my test. AUD_readSound create a reader to get minimum signal, max signal and power of the signal( I tend to use signal to explain audio volume ). These three value will be saved in buffer which is a float pointer parameter of AUD_readSound.
The returned reader also interest me.

std::shared_ptr<IReader> reader = ChannelMapper(*sound, specs).createReader();

ChannelMapper seems related to a factory method but I’m not sure.
Waveform drawing function is draw_seq_waveform_overlay in sequencer_draw.c. It use waveform data to draw waveform. But I don’t know the algorithm that it use.



What to do next week:

  1. Learn more about factory method and check whether ChannelMapper is related to a factory method

  2. Read the source code of draw_seq_waveform_overlay to understand the drawing algorithm


Weekly Report(June 20 - June 26):
I am so busy with my study this week that I have no time to implement my plan. I will certainly restart my job next week.

Weekly Report:
I read the source code of audaspace, BLI_thread and waveform drawing this week and implemented a demo in my local test branch. Though my demo has many bugs, it improves the speed of waveform drawing by 22%!
The mainly work I have done in the demo is parallelizing the loading. VSE used to load waveform one by one, that is, it will not load other sound until the current one have been loaded. In my demo, every sound has individual load thread, it will make full use of disk I/O and imporve the speed of waveform drawing.

This video may not be very clear as the original video is quite large so I can’t upload it.