Commit Graph

441 Commits

Author SHA1 Message Date
Jonathan Thomas
118810f160 Do not add +1 to GetMaxFrame() calculation. This is incorrect math for calculating the max frame of a timeline, and not correct. For example, 1 second long timeline at 30 FPS, should have exactly 30 frames (not 31). 2024-09-24 12:40:37 -05:00
Jonathan Thomas
683f33b81e Simplify caption unit tests, to check for a range of pixels for white text 2024-09-06 17:39:24 -05:00
Jonathan Thomas
9e9bfb3404 Merge pull request #935 from Ninpo/fix-test-file-collisions
Fixes test file collisions with high concurrency builds
2024-05-10 20:24:09 -05:00
Jonathan Thomas
4594cf85b6 Fix Tracker/ObjectDetector unit tests, due to new default values 2024-02-22 21:17:24 -06:00
Jonathan Thomas
d87e9e49c8 Un-reverting previous commit, removing queuing from FFmpegWriter for simplicity. Increasing margin on webm unit tests, when checking pixel color. 2024-02-10 20:28:47 -06:00
Ninpo
e17c2a3f14 Fixes test file collisions with high concurrency builds
Fix by Ninpo <ninpo@qap.la>

When tests are run in parallel it's possible for ImageWriter
and FFmpegWriter Gif tests to truncate/overwrite the other's
output1.gif. This change makes use of test file names unique
to the tests themselves.

Because cmake defaults to Makefiles and make does not -j$(nproc)
by default, this bug can't show up unless part of a build with parallel
make with tests included.

https://github.com/OpenShot/libopenshot/issues/933
2023-07-10 00:10:51 +01:00
kxxt
e6f6b64a0f Fix Stabilize_Video test for platforms that doesn't use fast color space conversion
The Stabilize_Video test fails on platforms that doesn't support
accelerated colorspace conversion from yuv420p to rgba.

e8e4863325/libswscale/yuv2rgb.c (L678-L696)

This PR fixes it by rounding the result that caused the test failure.

On x86_64, y = -0.001074643496478603
On riscv64, y = -0.0009904620157904118
2023-05-28 12:28:33 +08:00
Jonathan Thomas
f544d84f48 Fixing memory leak on Clips, where we were not clearing cache on Close, or forcing Close on destruction. Especially noticeable on projects with a ton of clips. Tweaking unit tests to prevent crash due to new Clip destructor behavior when using stack variables. 2023-04-19 16:08:36 -05:00
Jonathan Thomas
1832899526 Removing debug code 2023-03-27 13:48:43 -05:00
Jonathan Thomas
b37ec87d3e Updating windows x86 unit test values to align with Windows x86 2023-03-27 12:52:21 -05:00
Jonathan Thomas
01c3c62c99 Adding additional debugging code for an x86 Windows issue with font rendering 2023-03-27 11:16:10 -05:00
Jonathan Thomas
44d318949a Small windows unit test regression 2023-03-27 01:27:39 -05:00
Jonathan Thomas
2b07f93e51 Fixing unit tests with correct Linux and Windows pixel coordinates - since default font sizes have been adjusted. 2023-03-27 01:07:45 -05:00
Jonathan Thomas
c34fa59b8f Switching Caption effect from font "Points" to "Pixels", so fonts are scaled correctly in High DPI environments. 2023-03-27 00:24:09 -05:00
Jonathan Thomas
9daf04f14e Take 2: Adjust caption scaling logic, to keep different resolution projects from having dramatically different font sizes. More debug code for Windows. 2023-03-26 23:22:12 -05:00
Jonathan Thomas
c250151c33 Adjust Caption margins and fix unit tests, which have changed the text position. Adding Debug output to unit test for Windows troubleshooting. 2023-03-25 18:10:33 -05:00
Jonathan Thomas
bf0f809d4a Removing unused variable (Codacy suggestion) 2023-03-11 21:10:42 -06: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
450af52f64 WIP: Experimental Unit Tests without Display (#900)
* Experimental test for unit tests without display

* Ignore unit tests running on an invalid QT Platform (i.e. offscreen - running as a test on GitHub)

* Fix whitespace on Caption effect

* Check for env variable for QT_QPA_PLATFORM == offscreen, and ignore Caption unit tests (for GitHub checks)
2023-02-14 01:44:38 -06:00
Jonathan Thomas
fbbe4571a5 Removing debug code for Caption effect unit tests 2023-02-14 00:30:25 -06:00
Jonathan Thomas
bcade0c276 Enabling high DPI support for Caption unit test, and using different values for Windows and Linux unit tests, since fonts are rendering using different systems... and are not equal. 2023-02-14 00:16:41 -06:00
Jonathan Thomas
2131d38a72 Adding debug code for failed windows unit test 2023-02-13 23:35:10 -06:00