Commit Graph

262 Commits

Author SHA1 Message Date
Jonathan Thomas
59d46e59be Large refactor of Clip::GetFrame and time-remapping of audio samples.
- Refactor AudioLocation into own header
- AudioResampler now supports variable channels
- Adding cache back to Clips - to prevent the cost of multiple calls for the same GetFrame() frame, used in time-remapping
- Large refactor of Clip::GetFrame, to prevent multiple code paths, and much improved time-remapping
- Clip's time keyframe now supports Bezier and sub-frame precision - to you can curve audio speed using any curve shape
- Fixing # of audio samples on Clip frame's, based on timeline position (to predictably divide samples per frame)
- New Clip unit tests for time remapping and resampling audio, and reversing audio
- New Frame::GetAudioSamples arg, to allow for reversing the direction of audio samples
- Fix bug in Frame::AddAudioSilence() to correctly cache the # of audio samples
- FrameMapper clean up resample context (when changing frame rate)
- FrameMapper refactor to optimize # of calls to Reader()::GetFrame(), since calls to Clip::GetFrame are quite expensive
- Removing RepeatingFraction functionality from Keyframe object (since it was a bad implementation detail from our previous time remapping)
- Making Keyframe GetDelta method a float, and no longer an int - to allow for more precision on time remapping
- Large amount of white space fixing (to make things consistent)
2023-02-27 22:11:13 -06:00
Jonathan Thomas
7a733c0a7b Fixing whitespace 2022-10-28 19:03:17 -05:00
Jonathan Thomas
9f3fa0af52 Fixing whitespace 2022-10-28 19:01:27 -05:00
Jonathan Thomas
1547fb1d52 New unit tests around GetMaxFrame / GetMaxTime. Improvemetns to apply_json_to_timeline() to not clear all cache when setting the timeline's "duration" - an optimization for performance 2022-10-28 15:25:30 -05:00
Jonathan Thomas
c12e3fe96e - 2 new unit tests, to verify Reader() ownership and clean-up is correct
- Bug fix for clip, to delete a new Reader, regardless of how it was set (correctly track allocated readers, and ignore FrameMappers pointed to existing allocated reader)
- Bug fix for timeline to correctly wrap Reader with FrameMapper
2022-10-28 11:00:47 -05:00
Jonathan Thomas
52de46078a Adding mutex to Timeline::Close 2022-10-26 23:15:50 -05:00
Jonathan Thomas
389bf33adb - Protect AddClip(), RemoveClip(), update_open_clips(), sort_clips(), sort_effects() methods with mutex, making them thread safe
- Refactor sorting of clips & effects, and only sort these arrays when the arrays change (instead of each call to GetFrame)
- Cache max timeline duration, and make Timeline::GetMaxTime() thread safe
- New multi-threaded unit tests, which are designed to verify no seg faults on multi-threaded calls to Timeline::GetFrame(), Timeline::AddClip(), and Timeline::RemoveClip()
- New public Timeline::SortTimeline() method which is called by child Clips automatically, when certain properties are changed
2022-10-22 22:55:40 -05:00
Jonathan Thomas
788a3c77a6 Fixing whitespace 2022-10-21 18:15:41 -05:00
Jonathan Thomas
d8f8cba27f Do not sort_clips on every call to GetFrame, as this invalidates the internal clips list, and causes crashes in ClearAllCache() and Clear() methods. 2022-10-21 18:11:32 -05:00
Jonathan Thomas
ca33d951e6 Removing cache clearing from Timeline::Clear method - unneeded 2022-10-15 21:48:55 -05:00
Jonathan Thomas
4ad94c7727 Fixing more whitespace 2022-10-13 10:25:04 -05:00
Jonathan Thomas
9284113867 Fixing more whitespace 2022-10-13 10:21:40 -05:00
Jonathan Thomas
032ff77602 Fixing more whitespace 2022-10-13 10:21:00 -05:00
Jonathan Thomas
4e12ceb51f Fixing more whitespace 2022-10-13 10:20:23 -05:00
Jonathan Thomas
9eb5d6f903 Fixing more whitespace 2022-10-13 10:19:05 -05:00
Jonathan Thomas
31566a192a Protection for ClearAllCache method, to prevent messing with closed clips. Added a multi-threaded unit tests for Timeline::GetFrame access - to verify nothing crashes. 2022-10-13 00:01:03 -05:00
Jonathan Thomas
8fcdbc9d03 Timeline now checks cache 2nd time, after mutex - incase previous call generated the same frame 2022-10-11 23:01:26 -05:00
Jonathan Thomas
5f9c4e06d8 Large performance regression fixed by moving mutex further into the Timeline::GetFrame method - only when generating a new frame (allowing cache to actually work freely). Adding mutex back to FFmpegReader::GetFrame. Removing redundant mutex from ReaderBase.h. Adding mutex to all methods that call shrink_to_fit(). 2022-10-11 18:14:36 -05:00
Jonathan Thomas
245186f2a0 Fixing some small memory related issues - uninitialized variable, RESVG initialization only for svg files, Close QtImageReader on destructor, erase allocated_effects and allocated_clips. 2022-10-10 11:17:53 -05:00
Jonathan Thomas
32a89cfce9 Add lock to new Clear() method to prevent crashes 2022-10-06 21:59:11 -05:00
Jonathan Thomas
934ca786ed Adding new Clear() method to Timeline, to delete all allocated clips, effects, and frame mapeprs (freeing memory). Also, keep track of allocated clips and effects on timeline (when using SetJson to create them), so we can clean them up correctly on Clear() or RemoveClip()/RemoveEffect(). Added new test case for Clear(). 2022-10-06 15:07:31 -05:00
Jonathan Thomas
8c7b463e38 Improvements to the ClearAllCache() function, allowing both shallow and deep clearing. Lots of bug fixes in VideoCacheThread, to correctly pre-roll and cache the correct frames, and a new method of disabling/enabling the cache thread. 2022-09-15 18:33:06 -05:00
Jonathan Thomas
d0a3002808 Fixing transition end frame calculation 2022-08-27 16:59:14 -05:00
Jonathan Thomas
d2c7e856bb Fixing invalid "end frame" calculation for clips (we were accidentally adding +1) to the last frame of every clip, causing a repeat of the clip's last frame.
For example, if a video had only 10 frames (video_length), timeline would calculate the start_frame as 1, and end_frame as 11, which is incorrect. It should use start_frame as 1, end_frame as 10.
2022-06-25 17:39:48 -05:00
Jonathan Thomas
fbd0ecfc83 Merge branch 'develop' into caching-timing-improvements 2022-02-13 10:59:27 -06:00