Skip to main content

Module motion_estimation

Module motion_estimation 

Source
Expand description

GPU-accelerated motion estimation for AV1 and VP9 video codecs.

This module provides compute-shader-based motion estimation pipelines suitable for AV1 and VP9 intra/inter frame encoding. The GPU kernels exploit massively parallel block matching to evaluate Sum of Absolute Differences (SAD) and Sum of Squared Differences (SSD) across many candidate motion vectors simultaneously.

§Architecture

The pipeline is divided into three GPU dispatch stages:

  1. Hierarchical downscale – build a Gaussian pyramid (up to 4 levels) so that large motion is found at low resolution first.
  2. Block-match sweep – for every block in the current frame, evaluate all candidate motion vectors within the search window using parallel SAD/SSD kernels dispatched with workgroup-local shared memory (reducing global-memory bandwidth by ~8×).
  3. Refinement – perform ±1 / ±½ pixel sub-pixel refinement around the best integer candidate found in stage 2.

§Status

The GPU shader dispatch plumbing is present but the WGSL shaders for AV1/VP9-specific block partitions (superblock, transform units, etc.) are stubs. The CPU reference path is fully functional and used for testing / CI.

Structs§

BlockMvResult
Motion estimation result for a single block.
FrameMvResult
Full-frame motion estimation result.
MotionEstimationConfig
Configuration for a motion-estimation pass.
MotionEstimator
GPU-accelerated motion estimator.
MotionVector
A 2-D integer motion vector (pixel precision).
SubpixelMv
A 2-D sub-pixel motion vector (1/4-pixel precision, values are in units of 1/4 pixel).

Enums§

BlockPartition
Block partition mode used during motion search.
MotionMetric
Cost metric for evaluating motion-vector candidates.
TargetCodec
Codec the motion-estimation result will be used for.