Skip to content

D3D12: Add Video Engine based rotation, flip, alpha blend, crop, scaling

The following merge requests implements the necessary changes to add d3d12 gallium support for Video Engine based (no shaders) effects: rotation, flip, alpha blend, crop, scaling and plumb those all the way up to the VAAPI frontend. The change happens in several layers:

  • pipe: Adds process_frame method to video object, which gets passed new structures specifying the in/out regions, rotation mirroring and global alpha blending parameters, as well as new pipe caps for these.
  • va: Please note that if the gallium driver does not support get_video_param(..., PIPE_VIDEO_PROFILE_UNKNOWN, PIPE_VIDEO_ENTRYPOINT_UNKNOWN, PIPE_VIDEO_CAP_SUPPORTED), the behavior is backward compatible, and the existing shader solution is used.
    • Add support for VA caps: VA_BLEND_GLOBAL_ALPHA, VA_MIRROR_HORIZONTAL, VA_MIRROR_VERTICAL, VA_ROTATION_90, VA_ROTATION_180, VA_ROTATION_270 via the new pipe caps.
    • Integrate the newly added process_frame method for NV12 in postproc.c.
    • Minor changes to vlVaCreateContext, vlVaBeginPicture, vlVaEndPicture to support pipe_video_codec based VPP. (Backward compatible if the driver doesn't support the new caps as before this change)
  • d3d12: Implement pipe_video_codec::process_frame using ID3D12VideoProcessor and cleanup some code.

Tested in WSL2 (Ubuntu 22.04) with gstreamer/ffmpeg and VAAPI the following scenarios:

  • ffmpeg VA based transcode with also vaapi_scale in between dec, enc.
  • gstreamer vaapipostproc, vaapioverlay for scale, crop, alpha blend different input streams, rotation and mirroring. See some examples below:

alpha_blend1

rotate_crop

cascade_blend_translation

Merge request reports