Skip to main content

InferenceController

InferenceController

Orchestrates inference runs and owns the batch worker thread.

#include <InferenceController.hpp>

Inherits from QObject

Public Classes

Name
struct Impl

Public Slots

Name
void runSingleFrame(int frame)
Run single-frame inference at the given frame index.
void runBatch(int start, int end, int batch_size)
Run independent (non-recurrent) batch inference over [start, end].
void runBatchIntervals(std::vector< std::pair< int64_t, int64_t > > intervals, int batch_size)
Run independent batch inference over multiple intervals.
void runRecurrentSequence(int start, int frame_count)
Run sequential recurrent inference over a frame range.
void cancel()
Request cancellation of the current batch inference.

Public Signals

Name
void batchProgressChanged(int current, int total)
Emitted during batch inference; Qt queued from worker thread.
void recurrentProgressChanged(int current, int total)
Emitted during recurrent inference.
void batchFinished(bool success, QString const & error_message)
Emitted when batch inference completes (success or failure).
void runningChanged(bool running)
Emitted when running state changes.

Public Functions

Name
InferenceController(SlotAssembler * assembler, std::shared_ptr< DataManager > dm, std::shared_ptr< DeepLearningState > state, QObject * parent =[nullptr])
Constructor for InferenceController.
~InferenceController() override
bool isRunning() const
Whether a batch inference is currently running.
void setMediaProcessingOptionsLookup(MediaProcessingOptionsLookup lookup)
Supply Media processing options for batch inference clones.

Public Slots Documentation

slot runSingleFrame

void runSingleFrame(
    int frame
)

Run single-frame inference at the given frame index.

Parameters:

  • frame Frame index to process.

Precondition: frame >= 0; a negative value is silently clamped to 0 by computeEncodingFrame() during input assembly, causing the wrong frame to be encoded without any error signal (enforcement: none) [IMPORTANT]

slot runBatch

void runBatch(
    int start,
    int end,
    int batch_size
)

Run independent (non-recurrent) batch inference over [start, end].

Parameters:

  • start First frame (inclusive).
  • end Last frame (inclusive).
  • batch_size Number of frames per forward pass (>= 1).

Precondition: start >= 0; a negative start frame is silently clamped to 0 by computeEncodingFrame() during input assembly, causing the wrong frames to be encoded without any error signal (enforcement: none) [IMPORTANT]

slot runBatchIntervals

void runBatchIntervals(
    std::vector< std::pair< int64_t, int64_t > > intervals,
    int batch_size
)

Run independent batch inference over multiple intervals.

Parameters:

  • intervals Vector of (start, end) frame ranges (inclusive).
  • batch_size Number of frames per forward pass (>= 1).

Precondition: Each interval’s start value must be >= 0; a negative start is silently clamped to 0 by computeEncodingFrame() during input assembly, causing the wrong frames to be encoded without any error signal (enforcement: none) [IMPORTANT]

Progress reports the cumulative frame count across all intervals.

slot runRecurrentSequence

void runRecurrentSequence(
    int start,
    int frame_count
)

Run sequential recurrent inference over a frame range.

Parameters:

  • start First frame index.
  • frame_count Number of frames to process.

Precondition:

  • start >= 0; a negative start frame is silently clamped to 0 by computeEncodingFrame() during input assembly, causing the wrong frames to be encoded without any error signal (enforcement: none) [IMPORTANT]
  • frame_count >= 1; a value of 0 or negative causes the frame loop to silently produce no output and emit batchFinished(true) (enforcement: none) [LOW]

slot cancel

void cancel()

Request cancellation of the current batch inference.

Public Signals Documentation

signal batchProgressChanged

void batchProgressChanged(
    int current,
    int total
)

Emitted during batch inference; Qt queued from worker thread.

signal recurrentProgressChanged

void recurrentProgressChanged(
    int current,
    int total
)

Emitted during recurrent inference.

signal batchFinished

void batchFinished(
    bool success,
    QString const & error_message
)

Emitted when batch inference completes (success or failure).

Parameters:

  • success Whether inference completed without error.
  • error_message Non-empty when success is false.

signal runningChanged

void runningChanged(
    bool running
)

Emitted when running state changes.

Public Functions Documentation

function InferenceController

explicit InferenceController(
    SlotAssembler * assembler,
    std::shared_ptr< DataManager > dm,
    std::shared_ptr< DeepLearningState > state,
    QObject * parent =nullptr
)

Constructor for InferenceController.

Parameters:

  • assembler Non-owning pointer; caller retains ownership.
  • dm Shared DataManager for encoding inputs and writing outputs.
  • state Shared state holding bindings and parameters.
  • parent Optional QObject parent.

function ~InferenceController

~InferenceController() override

function isRunning

bool isRunning() const

Whether a batch inference is currently running.

function setMediaProcessingOptionsLookup

void setMediaProcessingOptionsLookup(
    MediaProcessingOptionsLookup lookup
)

Supply Media processing options for batch inference clones.

Typically resolves [MediaDisplayOptions](/api_generated/Classes/structMediaDisplayOptions.md) from [MediaWidgetState](/api_generated/Classes/classMediaWidgetState.md).


Updated on 2026-11-13 at 20:25:40 +0000