24 Commits
Author SHA1 Message Date
Jonathan Thomas b590640fba Speed up JSON keyframe updates and add focused transform benchmarks
Interactive transform edits repeatedly replace growing X/Y keyframe curves.
Applying each update copied the same JSON data through several layers and
rebuilt keyframe storage from scratch, making edits increasingly expensive
as an animation accumulated points.

Move JSON values that are already owned by the loader through the existing
by-value interfaces instead of copying them again. Clip and effect loading
now share a base-field helper that reads common fields without copying all
of the derived animation data. Parsed SetJson input and nested color/point
values use the same ownership approach.

Keep allocated keyframe capacity across replacements and append sorted
points directly. Unordered input and duplicate frames still use AddPoint,
preserving ordering and replacement behavior. Existing public signatures,
virtual method layout, JSON format, and timeline locking remain unchanged.

Add two optional benchmark cases for a 720p/24fps image clip with 0 or 1,000
existing keyframes per axis. Each performs 100 successive X/Y transform
updates through Timeline::ApplyJsonDiff and reports the median of three
trials. Input preparation stays outside the measurement, and final point
counts and values are checked so a skipped update cannot look faster.
These cases belong to the separate benchmark executable, not normal CTest
runs. Report Ops/s because an operation can now be a JSON edit or a frame.

Document the reproduction commands and local before/after measurements.
The measured cost per update fell from 0.82 to 0.33 ms for the initially
empty curves and from 17.99 to 6.73 ms for curves starting at 1,000 points.
These isolate native JSON application; they do not measure GUI rendering
or guarantee the same performance on other machines.

Add regression coverage for caller-owned JSON, sorted and unordered input,
duplicate and fractional frames, interpolation handles, large curve
replacement, multiple actions in one diff, unchanged properties, and cache
invalidation.

Validation: rebuilt the library, benchmark, and affected test executables;
all 197 KeyFrame, Timeline, Clip, Point, Color, ColorGrade, Mask, and
EffectMask tests passed in 6.2 seconds. Both remaining transform benchmark
cases also completed successfully. The slower 5,000-point benchmark case
is intentionally omitted.
2026-09-20 00:15:23 -05:00
Jonathan Thomas be99ec02c6 Migrate object detection to YOLOv5 ONNX
- Replace YOLOv3 Darknet loading with YOLOv5 ONNX model loading and validation.
- Parse YOLOv5 outputs with top class candidates for smoother labels.
- Improve SORT tracking with class-score smoothing and stricter geometry gates.
- Prevent active tracks from hopping to adjacent objects or tiny nested detections.
- Keep object ids stable through protobuf load/save and add an object-detection debug example.
- Add class-based default colors and matching border/background defaults.
- Add All Objects pseudo-selection support for tracked-object properties.
- Honor tracked-object corner radius when using tracker/object detector masks.
- Add regression tests for tracking stability, all-object styling, masks, and keyframes.
2026-05-10 21:48:24 -05:00
Jonathan Thomas d274163314 Improve tracked object rendering controls
- Remove unused tracked-object rotation property from JSON, properties, and box values
- Add per-object Draw Text support alongside Draw Box
- Use deterministic class colors for Object Detector instead of random seeded colors
- Scale tracked-object stroke widths based on preview raster size
- Keep Object Detector text rendering gated by both global and per-object text settings
2026-05-10 14:34:38 -05:00
Jonathan Thomas 0081cda5ee Apply reader-side orientation metadata and stabilize tracker stroke rendering
- Move phone/video rotation metadata handling into readers with an internal clip compatibility mode for legacy projects. FFmpegReader now reports oriented dimensions, applies orientation to decoded frames, and preserves old JSON behavior through reader_orientation_mode.

- Also adjust tracker/object-detection stroke width for preview raster scaling so tracked boxes remain visible during clip scale animations.
2026-05-08 20:58:53 -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 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 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
FeRD (Frank Dana) 677ed5f591 Tests: Switch test files to openshot_catch.h 2022-06-17 15:37:51 -04: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
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
Frank Dana 88d3011455 Unit tests: Use == to compare strings (#741)
When there's a mismatch, Catch2 will output the contents of both
strings rather than a meaningless .compare() numeric value.
2021-09-27 07:14:48 -04:00
FeRD (Frank Dana) 6a1579edd0 tests/KeyFrame: Tests for Print__() methods 2021-06-11 06:13:22 -04:00
Brenno 27eb0e6e23 Fixed Keyframe Test 2021-05-24 11:45:39 -03:00
Brenno 4d9d6ece9a Merge remote-tracking branch 'origin/develop' into effect-parenting 2021-04-21 13:34:49 -03:00
FeRD (Frank Dana) 89b1643e9f Tests: Shorten some crazy long test names 2021-04-19 17:25:06 -04:00
Brenno 2c9d2f2a32 OpenCV is again an optional dependency 2021-04-15 22:05:35 -03:00
Brenno 2cf2c55f9b Changed None to empty string, corrected dynamic pointers 2021-04-12 21:32:27 -03:00
Brenno a7cefa4bd2 Removed namespaces, iostream library and added TrackedObject test 2021-04-12 21:22:58 -03:00
FeRD (Frank Dana) d1d9293870 tests/KeyFrame: Split a CHECK(), for readability 2021-04-11 23:52:35 -04:00
Frank Dana cd22b0681b tests/KeyFrame.cpp: Typo 2021-04-10 23:54:29 +00:00
Frank Dana 93306a42a8 tests/KeyFrame.cpp: Typo 2021-04-10 23:54:11 +00:00
FeRD (Frank Dana) c8c92b5c5d Merge branch 'develop' into effect-parenting 2021-04-10 19:26:22 -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