Commit Graph

23 Commits

Author SHA1 Message Date
Jonathan Thomas
1c912d8fd6 Fixing clip unit tests due to regression in the initial rotation keyframe 2025-11-18 14:34:23 -06:00
Jonathan Thomas
a7dfc596ca Fixing regression in Clip::init_reader_rotation() function, which could sometimes override scale_x and scale_y, when a rotation keyframe contained more than 1 point. 2025-11-13 16:18:18 -06:00
Jonathan Thomas
7e29fc0935 Improving audio directionality, with new function: SetAudioDirection(), so we can safely flip audio buffer direction when needed (i.e. time curves, reversed time). Also adding a new SetDirectionHint function to FrameMapper class - so our Clip class can inform the FrameMapper of its direction at any given moment. Also, clear resampler when changing directions inside a Time curve (since the audio buffer will be flipped - the resampler internal cache must be cleared). 2025-10-11 16:29:11 -05:00
Jonathan Thomas
9a262882de A few small refactors of clip unit tests 2025-09-30 23:09:32 -05:00
Jonathan Thomas
0c15c1692e Adding new reversed time curve unit test, to verify 230,000 samples are actually reversed over the length of the clip without skipping or missing a single one. 2025-09-26 18:34:33 -05:00
Jonathan Thomas
3723fbd99f Fixing regression on Mac and Windows builds for Clip blend modes (color tolerances) 2025-09-12 23:00:22 -05:00
Jonathan Thomas
021c6ecc07 Adding unit tests to validate FFmpegReader, Clip, and Timeline frame accuracy of GIF files, plus GIF with time curves. 2025-09-12 22:57:26 -05:00
Jonathan Thomas
a66727a687 Expanding Clip unit tests to include all composite blend modes available to libopenshot. 2025-09-12 18:06:26 -05:00
Jonathan Thomas
523ef17aa4 Adding composite/blend modes to libopenshot:
-Normal
-Darken
-Multiply
-Color Burn
-Lighten
-Screen
-Color Dodge
-Add
-Overlay
-Soft Light
-Hard Light
-Difference
-Exclusion
2025-09-12 17:47:41 -05:00
Jonathan Thomas
f2a5bfb581 Fixed AnalogTape tests and an unused Clip test line 2025-09-12 15:04:14 -05:00
Jonathan Thomas
d77f3e5338 Improving performance on Clip class:
- Replacing alpha with QPainter SetOpactity (much faster)
- Fixing get_file_extension to not crash with filepaths that do no contain a "."
- Removing render hints from apply_background (since no transform or text rendering), making compositing (faster in certain cases)
- Optionally adding SmoothPixmapTransform based on a valid transform (faster in certain cases)
- Skip Opacity for fully opaque clips
- New Clip unit tests to validate new functionality
2025-09-12 14:54:46 -05:00
Jonathan Thomas
45c273bf42 Large fix for FrameMapper when resampling audio - to correctly apply the EXTRA_INPUT_SAMPLES, to prevent the resampler from becoming input limited.
- Fixed some unit tests
- Added new convenience methods for SampleRange, to extend either side, or shift it left or right
- Added new SampleRange unit tests
- No more audio pops at the beginning of clips which are being resampled!!!
- Time remapping now works perfectly smoothly, no more pops or crashes!!!
2023-03-11 16:50:28 -06:00
Jonathan Thomas
09ce05bbf2 Many improvements for smooth audio playback when 'time' keyframes are used for time remapping.
- Added new Frame::ReverseAudio() helper method - for time keyframe support playing backwards audio
- Fixed math rounding error on time keyframe Resampler, to use the rounded source samples value
- Removed some unused args and Frame audio methods
- Reset FrameMapper resample context when non-adjacent frames are requested
- Correctly reverse Frame audio if a time keyframe is present, and reversing audio
- Rewrite Keyframe::IsIncreasing() function, to give accurate direction of time keyframes at any index (special logic to support first and last indexes)
- Fixed Keyframe unit tests - since logic has changed a bit
- Improved time mapping unit tests
- Replace many c-style casts with static_cast
- Added new sine.wav test file
2023-03-10 01:15:14 -06:00
Jonathan Thomas
d104664da3 Fixed an issue with reversed resampled audio in FrameMapper, which caused lots of clicks / seams between frames... Also, added a new overload to GetInterleavedAudioSamples, to reverse the samples before returning the float* array. Essentially, the FrameMapper is now aware of it's parent clip, and especially the 'time' keyframe, if the audio is in the forward or reverse direction. Also fixed a memory leak in time remapping. 2023-02-28 14:13:12 -06:00
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
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
FeRD (Frank Dana)
677ed5f591 Tests: Switch test files to openshot_catch.h 2022-06-17 15:37:51 -04:00
Jonathan Thomas
a8e9c95fea Silence openshot::Frame audio when requesting a Clip::GetFrame() past the end of the Clip's Reader. For example, if a Clip has 1000 frames, and the user requests frame 1001, we will return the last cached openshot::Frame object, but we don't want to repeat the audio samples (causing a stutter). Any frame past the end of the reader, should always silence the audio samples. Also, fixed a few invalid comments, and added a Unit test. 2022-03-02 16:24:09 -06:00
FeRD (Frank Dana)
59108504e3 Code changes for compatibility with JUCE 6.x
- Replace all juce::CriticalSection with std::recursive_mutex
- Replace all juce::AudioSampleBuffer with juce::AudioBuffer<float>
- Eliminate implicit reliance on 'using namespace juce;'
- Replace OpenShotAudio.h includes with targeted juce modules
2021-11-09 06:22:25 -05:00
FeRD (Frank Dana)
9133389b92 Clip: Fix has_video, add unit test 2021-10-27 00:26:56 -04:00
Frank Dana
59138ea3e4 Adopt license management via Reuse project/tool (#711)
* reuse-managed license/copyright headers

reuse is a tool for compliance with the REUSE recommendations. See
<https://reuse.software/> for more information, and
<https://reuse.readthedocs.io/> for the online documentation.

* Set jsoncpp license
* Add MIT license for Decklink sources
* Explicitly license examples/
  - Add headers to source files
  - Change blanket licensing in .reuse/dep5 to only cover binary media
  - Import CC-BY-3.0 license and assign to sintel_trailer
2021-10-16 01:26:26 -04:00
FeRD (Frank Dana)
d9775d4a5e Port unit tests to Catch2 2021-04-09 04:09:36 -04:00
FeRD (Frank Dana)
c68b16643e Rename tests/*_Tests.cpp to tests/*.cpp 2021-04-07 23:41:04 -04:00