GSoC 2022: Waveform Drawing Improvements Weekly Report

Hi, this is a post for my GSoC 2022 Project weekly report. If you have any feedback, please comment on the feedback thread. Any feedback is welcomed!


Closing this thread to limit this to the weekly reports. @xsmingerfan Feel free to open a second thread for feedback if you like.

1 Like

Weekly Report:
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

  • BKE_sound_read_waveform of sound.c

  • AUD_readSound of AUD_special.cpp

  • draw_seq_waveform_overlay of sequencer_draw.c

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

For more details, please see feedback thread

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.


Weekly Report(7/04 - 7/10):
My code is commited to soc-2022-waveform-drawing branch which is mainly on sequencer_preview.c. It becomes more robust compared to last week’s and I have test it in the case when loading many large audio.
The benchmark I made last week is not quite reliable for there are too many background applications running in my computer. In my new benchmark, the speed of drawing improves by around 37.6%. I think this result may be more reliable than last week’s.

Next Week:
The next week I will try to implement waveform drawing system which tracks timeline playhead. The final effect is just like what Figure(a) shows. In this system, Waveform will be processed in segments. Those near the timeline playhead should be guaranteed to be drawn preferentially, which makes sure that artists view waveform “in real-time” as drawing is being processed.

This will lead changes in BKE_sound_read_waveform function.


Weekly Report (7/11 - 7/17):
I try to develop the feature mentioned last week, but haven’t finished yet. I have met some technical problems.
To develop it, BKE_sound_read_waveform should be changed. AUD_readSound is the core function of BKE_sound_read_waveform which reads the actual waveform data. In my plan, I will use two threads to call this function and each of it will read a part of sound and write waveform data to sound->waveform. This requires AUD_readSound seekable so that we can read diffrent part of sound. But sadly it isn’t. So, I add a new function AUD_readSoundSeekable in AUD_Special.c. It has a parameter that can determine where to start to read. It mainly rely on Reader’s seek(seek_pos) funtion. Seek function should take effect but it seems that it doesn’t seek the audio. I have no idea about it now.
Besides, for the seek function will reduce the audio reading speed, I am not sure wheather it will boost the load speed.
I will discuss these two problems with my mentor next week. And the feature development will be certainly finished next week unless it is not “cost-effective”.


Weekly Report (7/18 - 7/24):
I am sorry to not finsh my goal made last week. An other project of mine takes me too much time and I get ill this week. I’m learn ffmpeg now, hoping to solve the seek problem.


Weekly Report (7/25 - 7/31):
A planned trip made me not have much progress this week, but I tried to develop segments drawing. I have wrote the segements drawing demo and it is testing now. Still have lots of bugs.