Commit Graph
78 Commits
Author SHA1 Message Date
Mike-Solar 9cae5d9c5f fix Ubuntu and Windows CI 2026-05-28 21:43:33 +08:00
Mike-Solar 6b94ceea14 docs:Add plan of spilting into multi-library 2026-05-21 20:31:17 +08:00
Mike-Solar 295c5eaa24 fix: Use makefile to compile OpenFX-Misc 2026-05-21 17:46:08 +08:00
Mike-Solar 0984756c19 fix: Compile v8.1.1 instead of latest ffmpeg for Ubuntu, remove override for MainWindow::nativeEvent, and change Windows packages to UCRT. 2026-05-21 17:40:24 +08:00
Mike-Solar 444a8e5287 fix: Compile latest ffmpeg for Ubuntu, install fmt for Windows. 2026-05-21 17:26:37 +08:00
Mike-Solar 3f238ce08e fix: Define WIN32 and WINDOWS for MSYS2, and remove <qtypes.h> in image.h. 2026-05-21 17:06:29 +08:00
Mike-Solar 027476e691 docs: update roadmap 2026-05-21 17:01:36 +08:00
Mike-Solar 0daef48b62 fix: remove <qtypes.h> to fix Linux CI. 2026-05-21 16:53:55 +08:00
Mike-Solar 393a9eda63 docs: add build guide and CI. 2026-05-21 16:50:17 +08:00
Mike-Solar a0abf9cfb0 Fixed: fixed black screen when pulling playhead back. 2026-05-21 16:29:39 +08:00
Mike-Solar 2a84027ff9 fix(renderer): macOS TBDR cross-context sync and OFX instance thread-safety
This commit fixes crashes (SIGSEGV in CImg blur_bilateral) and black-frame
corruption artifacts during playback and scrubbing on macOS Apple Silicon.

Root cause analysis:
1. macOS uses Tile-Based Deferred Rendering (TBDR). glFlush() does not
   guarantee tile memory writeback, causing glReadPixels to read incomplete
   tiles (black/corrupted frames) and cache them to disk.
2. Olive uses multiple shared OpenGL contexts (RenderProcessor contexts vs.
   thread-local PluginRenderer context). glFinish() only waits for the
   current context, not the shared context that produced the texture. CPU
   readback in PluginRenderer could read partially-rendered tiles.
3. OlivePluginInstance and OliveClipInstance are not thread-safe. Concurrent
   RenderProcessors could corrupt internal QMap/images_ and params_ via
   setInputTexture/renderAction races.

Fixes:
- OpenGLRenderer::Flush() on macOS now uses glFinish() unconditionally.
- OpenGLRenderer::DownloadFromTexture() and OpenGLRenderer::Blit() insert
  glFinish() before readback/detach to ensure tile writeback completes.
- PluginRenderer::RenderPlugin() now acquires a per-instance mutex to
  serialize concurrent OFX render calls.
- Before CPU readback in PluginRenderer, flush the renderer that originally
  produced each input texture, ensuring cross-context synchronization.
- RenderProcessor::ProcessVideoFootage() flushes after BlitColorManaged.
- Add black-frame detection in ProcessVideoCacheJob() to auto-purge TBDR-
   corrupted cache files.
- Add diagnostic qDebug() logging in viewer, decoder, renderer, and plugin
  paths to aid future debugging.
2026-05-17 14:54:49 +08:00
Mike-Solar ff0eee3a88 perf(plugin): cache PluginRenderer per-thread and skip redundant clip prefs
Fix three performance traps in the OFX plugin preview pipeline that
  caused slideshow-like performance when any plugin was active.

  1. Eliminate per-frame PluginRenderer creation (GL FBO alloc/free)

     RenderProcessor is stack-allocated per ticket, so its
     plugin_renderer_ member was constructed and destroyed every frame.
     PluginRenderer inherits OpenGLRenderer, whose PostInit() calls
     glGenFramebuffers() and whose destructor calls glDeleteFramebuffers().
     On Apple Silicon's TBDR this is pathologically expensive.

     Fix: use a thread_local cached PluginRenderer so each render thread
     creates it only once and reuses it forever.

  2. Call getClipPreferences() conditionally

     The code unconditionally called instance->getClipPreferences() on
     every single frame. This dispatches kOfxImageEffectActionGetClipPreferences
     into the plugin even when no inputs or parameters have changed.

     Fix: check areClipPrefsDirty() first. The OpenFX Host Support library
     already tracks this flag and sets it to true when slave params or clip
     connections change.

  3. Call ApplyParamOverrides() before renderAction

     ApplyParamOverrides() was defined but never invoked, so animated
     plugin parameters were never pushed into the OFX instance before
     rendering.

     Fix: call it after beginRenderAction() and before renderAction(),
     injecting the current NodeValueRow values at the correct OfxTime.
2026-05-16 17:34:29 +08:00
Mike-Solar 3845c31b37 perf(plugin): eliminate GPU↔CPU ping-pong in OFX render path
This commit removes redundant readbacks and uploads in the OpenFX
  plugin pipeline, achieving zero-copy rendering for GL-capable
  plugins and reducing CPU path overhead.

  PluginRenderer (OpenGL path):
  - Skip ReadbackTextureToFrame + ConvertFrameIfNeeded + Upload after
    plugin render. The destination texture is already valid on GPU.
  - Pass readback_cpu=false to setInputTexture() so input textures are
    provided via loadTexture() (GL texture IDs) instead of being
    downloaded to CPU Image buffers.
  - Remove duplicate ReadbackTextureToFrame block between
    getClipPreferences and the second setInputTexture call.

  OliveClipInstance:
  - Add optional bool readback_cpu=true to setInputTexture(). When
    false, only params and input_textures_ are updated; CPU readback
    and memcpy into Image are skipped.
  - Add pruneImagesCache() to prevent unbounded growth of images_.
    Input clips are limited to 8 cached frames; output clips are
    left untouched.

  Micro-optimizations:
  - Replace per-row memcpy loops with single block memcpy when
    src/dst strides are contiguous (common case in Olive pipeline).
  - Remove dead GL_PREAMBLE macro definition.

  fix(viewer): resolve playback head lag, frozen frames, and pause delay

  Three playback pipeline behavioral issues are fixed:

  1. Prequeue blocked playhead start:
     Reduce kVideoPlaybackInterval from 0.5s to 0.1s. This lowers
     prequeue length from 15–30 frames to 3–6 frames, so the
     playback timer starts much sooner after pressing Play.

  2. Frozen display during playback:
     Relax the hard frame-drop logic in RendererGeneratedFrameForQueue.
     When the queue has fewer than 2 frames, keep late frames instead
     of dropping them, preventing the viewer from freezing entirely
     when rendering cannot keep up with playback speed.

  3. Delayed frame update after pause:
     Cancel in-flight render tickets in PauseInternal() before
     deleting queue watchers. Previously the render thread continued
     processing stale playback frames, blocking the single-frame
     render requested by UpdateTextureFromNode().
2026-05-16 16:45:13 +08:00
Mike-Solar 7ebfebb29a Fix OFX plugin render failures and stabilize integration tests
This commit resolves several categories of OFX plugin failures that
  manifested as magenta (pink) render output or crashes:

  1. Param default-value initialization
     - IntegerInstance, DoubleInstance, BooleanInstance, ChoiceInstance,
       and StringInstance now read kOfxParamPropDefault from the descriptor
       at construction time. Previously, when no PluginNode was attached
       (integration-test mode), get() returned 0/0.0/false, causing
       generator plugins to receive invalid extent/format/PAR values and
       crash in coordinate assertions.
     - IntegerInstance also fixed uninitialized `id` that caused
       kOfxStatErrBadHandle in CImg plugins.

  2. Clip property initialization
     - newClipInstance() now seeds pixelDepth and components from the
       host VideoParams instead of leaving them as None. This prevents
       Transform3x3Plugin and similar plugins from asserting on
       getPixelComponentCount() during fetchClip inside createInstance.
     - getAspectRatio() and getProjectPixelAspectRatio() now fall back
       to 1.0 when the project's PAR is not yet set, avoiding division-
       by-zero in coordinate conversion.

  3. Frame-rate and time-base preservation
     - setInputTexture() no longer overwrites the clip's frame_rate or
       time_base with the input texture's values. Multi-input plugins
       were crashing because setupClipPreferencesArgs throws when inputs
     have mismatched rates.

  4. Render loop hardening
     - getClipPreferences() is now wrapped in try/catch so that frame-
       rate mismatch exceptions mark render failure instead of aborting
       the render thread.
     - getRegionOfInterestAction() treats kOfxStatErrBadHandle as non-
       fatal and falls back to default RoI.
     - RenderPlugin syncs all clip instances after setVideoParam so that
       getAspectRatio/getFrameRate return valid values before
       createInstanceAction queries them.

  5. Test suite updates
     - All PluginMisc tests now use F32 input to match the host pipeline
       default.
     - CreateGradientTexture fixed to support F32 pixel format.
     - Added CImgBilateral and CImgGuided_MultiInput tests.
     - Secret parameters are now registered as hidden Node inputs so that
       getClipPreferences can read them (fixes generator pink screen).

  6. Debug logging in HostSupport
     - clipGetImage and clipGetRegionOfDefinition now catch exceptions
       and log the failing clip name for easier debugging.
2026-05-15 21:32:28 +08:00
Mike-Solar e85c6cf60a fix: OFX param instance lifecycle and thread-safety fixes
- Fix SIGSEGV in PluginMisc.Keyer by linking Param::SetInstance to instances.
    Olive's custom param instances (IntegerInstance, DoubleInstance, etc.) were
    not passing the SetInstance pointer to the OpenFX HostSupport base class,
    leaving _paramSetInstance as nullptr. When Keyer called paramSetValue during
    createInstanceAction, the suite function dereferenced the null pointer in
    paramChangedByPlugin(). Now newParam() passes 'this' to every constructor.

  - Fix render-thread crash when OFX plugins set params during rendering.
    MinOFX calls paramSetValue inside createInstanceAction from the render
    thread. SubmitUndoCommand() used to push undo commands directly to
    UndoStack, which modifies QAction state (GUI-only). Added IsGuiThread()
    check: non-GUI threads execute redo_now() and discard the command without
    touching the undo stack.

  - Enable PluginMisc.MergeOver and PluginMisc.Keyer integration tests.
    MergeOver now supplies both Source and Bg textures; Keyer uses U16 format.
    Both pass in the full test suite.

  - Make ViewerQueue thread-safe with QMutex around AppendTimewise/PurgeBefore.
    Adds copy ctor and assignment to support mutex-per-instance semantics.
2026-05-14 22:32:34 +08:00
Mike-Solar 4aa4d59770 feat: hide non-texture OFX params from node graph + host coordinate standardization
Hide non-texture OFX params from node graph
  --------------------------------------------
  OFX plugins like ColorCorrect expose dozens of scalar parameters as
  node inputs, making nodes extremely tall and pushing Source/Mask far
  down. Previously attempted via kInputFlagHidden, but that also hid
  them from the parameter panel.

  Fix: move the filter to NodeViewItem::IsInputValid() instead.
  For OFX plugin nodes (getPluginInstance() != nullptr), only
  kTexture inputs are rendered as ports. Scalar parameters remain
  fully visible in the parameter panel.

  Files: app/widget/nodeview/nodeviewitem.cpp
         app/node/plugins/Plugin.cpp

  Standardize OFX host coordinate system
  --------------------------------------
  Olive's OFX host had partial and inconsistent coordinate handling.

  1. Fix Project coordinate methods
     - getProjectSize() / getProjectExtent() / getProjectOffset()
       now multiply X by pixel_aspect_ratio(), returning canonical
       coordinates per the OFX spec.

  2. Fix Clip default RoD
     - OliveClipInstance::getRegionOfDefinition() default now returns
       {0, 0, width*PAR, height} instead of raw pixel coords.

  3. Add parameter coordinate system conversion
     - DoubleInstance / Double2DInstance / Double3DInstance now check
       _descriptor.getDefaultCoordinateSystem().
     - For kOfxParamCoordinatesNormalised:
         get: internal pixel value -> normalised (divide by extent)
         set: normalised plugin value -> pixel (multiply by extent)
     - DefaultValueForParam() also converts normalised defaults to
       canonical before storing in Node, keeping Olive internal/UI
       values consistently in pixel space.

  Files: app/pluginSupport/OlivePluginInstance.cpp
         app/pluginSupport/OliveClip.cpp
         app/pluginSupport/paraminstance.h
         app/node/plugins/Plugin.cpp
2026-05-14 21:54:18 +08:00
Mike-Solar e012f16083 feat: group OpenFX plugins under dedicated "OpenFX" category with sub-groups
All OpenFX plugins were previously hardcoded to return kCategoryUnknown,
  causing them to pile up under "Uncategorized" in the node creation menu.

  This commit introduces a two-level grouping system for OFX plugins:

  1. Add new kCategoryOpenFX top-level category
     - Node::CategoryID enum extended with kCategoryOpenFX
     - PluginNode::Category() now returns {kCategoryOpenFX}
     - Node::GetCategoryName() returns "OpenFX"

  2. Add secondary sub-grouping support
     - Node base class gains virtual SubCategory() method
     - PluginNode implements SubCategory() backed by sub_category_ member
     - sub_category_ is set in the constructor from the plugin's OFX context:
         Filter     → "Filter"
         Generator  → "Generator"
         Transition → "Transition"
         others     → "General"

  3. Update NodeFactory::CreateMenu()
     - When a node belongs to kCategoryOpenFX and provides a non-empty
       SubCategory(), creates a second-level submenu under "OpenFX"
     - Nodes without a sub-category are placed directly in the top menu

  Expected menu layout:
    OpenFX
      ├── Filter
      │     ├── ColorCorrect
      │     └── ...
      ├── Generator
      ├── Transition
      └── General

  All 4 test suites pass.
2026-05-14 21:05:29 +08:00
Mike-Solar b2de04962d feat: heuristic semantic display for OFX RGBA parameters
ColorCorrectOFX and similar plugins declare per-channel controls
  (Gamma, Contrast, Saturation, Gain, Offset) as kOfxParamTypeRGBA.
  Olive previously mapped every RGBA param to NodeValue::kColor and
  rendered it as a ColorButton, which is semantically wrong for
  adjustment sliders.

  This commit adds heuristic semantic detection to distinguish
  "true color" inputs (color pickers) from "per-channel scalar"
  inputs (float sliders):

    - label/hint/name keywords ("gamma", "contrast", "gain", ...)
    - display range outside [0, 1]
    - uniform default values across all channels

  The detected semantic ("color" or "scalar") is stored as the
  node input property "color_semantic".  The display range and hint
  are also persisted as "min" / "max" / "tooltip".

  NodeParamViewWidgetBridge now branches on "color_semantic":
    - "scalar"  → 4× FloatSlider (reuses existing ProcessSlider /
      keyframe-track logic, since kColor already splits into 4 tracks)
    - otherwise → ColorButton (unchanged)

  All 4 test suites pass.
2026-05-14 20:50:45 +08:00
Mike-Solar 43ba1c4642 fix ofx plugin bug 2026-05-14 20:26:17 +08:00
Mike-Solar 599c876d03 全链路强制F32 2026-05-14 01:51:14 +08:00
Mike-Solar f3c50017e9 rendering still not correct 2026-04-19 18:59:56 +08:00
Mike-Solar 3b5b0187cb fix chroma keyer 2026-04-12 01:42:27 +08:00
Mike-Solar eb79be87a4 add smoke test 2026-04-12 01:26:41 +08:00
Mike-Solar 843b8762f6 fix audio bug 2026-04-12 01:08:22 +08:00
Mike-Solar c1b77ceec5 Merge branch 'plugin' 2026-01-17 17:03:39 +08:00
Mike-Solar 648de07b00 Add LRU TODO 2026-01-17 16:53:54 +08:00
Mike-Solar c1bcfeb78b finish plugin suppoirt 2026-01-17 16:49:21 +08:00
Mike-Solar a2698e7ef4 solve problem invalid roi and param 2026-01-17 16:41:03 +08:00
Mike-Solar 894ee5c0da update copyright 2026-01-16 22:29:47 +08:00
Mike-Solar bfb1b2fce4 update copyright back 2026-01-16 21:22:05 +08:00
Mike-Solar e851653fa3 尝试修复粉紫屏未果 2026-01-16 21:11:24 +08:00
Mike-Solar 3f774dfa53 update core 2026-01-10 18:57:46 +08:00
Mike-Solar 4d393f3d23 尝试解决插件bug 2026-01-10 18:56:58 +08:00
Mike-Solar e37972b227 Try to fix plugin issue 2026-01-05 21:31:35 +08:00
Mike-Solar 8ed5660faf solve some bugs 2026-01-05 18:01:13 +08:00
Mike-Solar 6b64abb1fa Limit import files 2026-01-05 16:36:43 +08:00
Mike-Solar 4bd453bab0 Undate core 2026-01-05 16:23:11 +08:00
Mike-Solar b8669f6a11 Change project name; 2026-01-05 16:22:26 +08:00
Mike-Solar 86e82b13e2 remove unused includes 2026-01-05 14:24:28 +08:00
Mike-Solar cdc66d1a02 fix no video shown 2026-01-05 13:52:02 +08:00
Mike-Solar b107370550 Fix CI 2026-01-05 13:19:36 +08:00
Mike-Solar eea983b3a2 Fix CI 2026-01-05 13:13:41 +08:00
Mike-Solar 12bca573f1 Fix CI 2026-01-05 13:06:35 +08:00
Mike-Solar ffc634ab42 Fix CI 2026-01-05 12:42:03 +08:00
Mike-Solar 02b58bde8e Fix CI 2026-01-05 12:16:06 +08:00
Mike-Solar 632afa9ce8 Fix CI 2026-01-05 12:14:08 +08:00
Mike-Solar ee128f1b37 修正ext/KDDockWidgets 2026-01-05 12:11:21 +08:00
Mike-Solar 21d5ed5f59 完善测试 2026-01-05 04:02:05 +08:00
Mike-Solar 4b97a66f17 添加测试 2026-01-05 03:52:02 +08:00
Mike-Solar 79f376b512 修复bug 2026-01-05 03:40:36 +08:00
Mike-Solar 8263ccf814 修正测试 2026-01-05 03:11:34 +08:00
Mike-Solar 1f679551f2 添加测试 2026-01-05 02:55:21 +08:00
Mike-Solar 9d0790370f 添加测试 2026-01-05 02:55:12 +08:00
Mike-Solar 0323c74c83 添加文档 2026-01-05 02:26:20 +08:00
Mike-Solar 003c3bb5be 修改部分语法错误 2026-01-05 02:25:13 +08:00
Mike-Solar cad331eb2c Fix compile errors 2026-01-05 01:50:05 +08:00
Mike-Solar c136cdf7f6 完成1 2026-01-05 00:03:51 +08:00
Mike-Solar 4cbdfd1a88 Finish TODO 8,9 2026-01-04 23:53:12 +08:00
Mike-Solar 271f56f3dd Procceed translate 2026-01-04 23:22:50 +08:00
Mike-Solar e1938a14e0 Finish TODO 6 and 7 2026-01-04 23:16:10 +08:00
Mike-Solar 1b29bd147e Add missing param instance types (String, Double3D/Integer3D, Group/Page, Custom/Bytes) and mapping to node inputs. app/pluginSupport/OlivePluginInstance.cpp, app/node/plugins/Plugin.cpp 2026-01-04 22:53:26 +08:00
Mike-Solar 3b16824f34 Ensure render path sets per-frame output data and handles ROD/bounds correctly. 2026-01-04 22:40:05 +08:00
Mike-Solar f191486375 Implement multi-input OFX clip wiring and texture handling
Store PluginJob input values for lookup
Add per-clip texture inputs on plugin nodes
Map input clips to textures during render (with Source fallback)
2026-01-04 22:30:41 +08:00
Mike-Solar f317e0e173 Add null checks for timebase in TimeScaledObject and fix background color assignment in ViewerDisplayWidget 2025-11-24 10:33:38 +08:00
Mike-Solar 2c4d235da6 Update KDDockWidgets submodule URL 2025-11-23 16:39:30 +08:00
Mike-Solar 1e33a31b73 Update FFmpeg handling and focus management
Refactor FFmpeg frame processing and improve focus management in panels. Add memory sanitization for debug builds and update KDDockWidgets integration.
2025-11-23 16:35:09 +08:00
Mike-Solar 2ea53667c0 Refactor FFmpeg decoder for improved readability and efficiency
Simplify the frame reading process and metadata extraction in `ffmpegdecoder.cpp` by reducing redundant code and improving variable initialization. Add a helper function in `ffmpegdecoder.h` to map FFmpeg field orders to Olive interlacing types, enhancing code clarity. Adjust the condition for interleaved write in `ffmpegencoder.cpp` for better handling.
2025-11-10 21:06:35 +08:00
Mike-Solar 5aaa49c515 Add push button support for OFX plugins
This commit adds support for push buttons in OFX plugins by:

- Adding `kPushButton` to `NodeValue` enum
- Implementing `pushButtonClicked` slot in `PluginNode`
- Creating `NodeParamButton` widget for UI representation
- Updating `paraminstance.h` to handle push button instances
- Modifying `nodeparamviewwidgetbridge.cpp` to connect push button signals
2025-11-10 13:57:04 +08:00
Mike-Solar 8a7b6cf869 Add OFX plugin support and related infrastructure
This commit extends the OFX plugin support in Olive by:

- Initializing and scanning for OFX plugins
- Updating PluginNode to handle OFX plugin parameters and inputs
- Adding necessary methods and properties for OFX plugin integration
- Enhancing NodeFactory to include OFX plugin nodes
- Refactoring and renaming OliveInstance to OlivePluginInstance
- Introducing new classes for parameter handling (ParamInstance)
- Adding PluginJob for rendering OFX plugins
- Adjusting CMakeLists.txt files to include new source files
2025-11-09 17:03:56 +08:00
Mike-Solar 26e6924cdf feat: Implement OFX plugin support infrastructure
This commit adds comprehensive support for OFX plugins in Olive, including:

- Add plugin node infrastructure with getPlugin() method
- Implement OliveHost for managing OFX plugin instances
- Create OliveInstance to handle plugin parameter and timeline interactions
- Add OliveClip implementation for plugin clip handling
- Implement region of definition (RoD) and region of interest (RoI) functionality
- Add interactive mode support in Current class
- Integrate plugin rendering into RenderProcessor
- Fix include dependencies and remove unused OlivePlugin.cpp reference
2025-10-25 17:59:50 +08:00
Mike-Solar 81b2640411 add: some changes to add openfx support 2025-10-24 20:20:04 +08:00
Mike-Solar c1b8618391 fix: crash when processing audio 2025-09-14 21:10:02 +08:00
Mike-Solar e8238dac54 change: core submodule. 2025-09-14 20:55:52 +08:00
Mike-Solar b5092777df change: core submodule. 2025-09-14 20:53:22 +08:00
Mike-Solar 9ae018341c add: add 2 functions. 2025-09-14 20:52:25 +08:00
Mike-Solar c71b20bb95 add: add 3 functions. Provide the way to get current audio and video params. 2025-09-14 20:43:56 +08:00
Mike-Solar 0f368e29d4 change: submodule 2025-09-05 01:54:50 +08:00
Mike-Solar 46a913cc76 Delete .github/ISSUE_TEMPLATE directory 2025-08-03 03:35:43 +08:00