Skip to content

Conversation

@ddennedy
Copy link
Member

@ddennedy ddennedy commented Dec 10, 2025

@j-b-m I am doing some final testing before merging. This takes hwaccel to the next level and makes it usable. It goes a very long way to offset the slow speed of using the new 10-bit linear color processing.

A problem with hwaccel is the large amount of data to copy over a bus between CPU RAM and GPU VRAM if you can not keep everything in the GPU. But, it occurred to me that we can use it conjunction with preview scaling by using hwaccel scale filters directly in the producer!

  • Lets it work with preview scaling (consumer scale property) by using hwaccel scale filters.
  • Fixes it to work with (auto)rotate . (This does not use hwaccel filters; not all hwaccel methods have all of them. May come later.)
  • Adds env var MLT_AVFORMAT_HWACCEL_PPS to set the maximum pixels per second to use hwaccel decode without consumer scale. I could see many people only want to work with 1080p on lower end devices, not always enable preview scale, and want to reduce CPU usage. Turn on preview scaling if you need more than this threshold, for example, 1080p60.

Related Shotcut changes are minimal: https://github.com/mltframework/shotcut/compare/hwaccel?expand=1

@ddennedy ddennedy requested a review from Copilot December 10, 2025 03:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds hardware-accelerated scaling filters for video decoding, enabling GPU-based scaling for multiple hardware acceleration backends (Vulkan, D3D11, VAAPI, VideoToolbox). The implementation conditionally applies hardware scaling when the consumer requests downscaling, reducing unnecessary transfers between GPU and CPU memory.

Key changes:

  • Adds hardware-accelerated filter setup and application functions for different GPU backends
  • Extends pixel format support to include NV12 and P010LE formats commonly used in hardware decoding
  • Implements conditional filter initialization based on consumer scale factor and hardware format
  • Propagates consumer scale property to frames for producer-side scaling decisions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/modules/avformat/producer_avformat.c Implements hwaccel filter infrastructure with setup/apply functions; adds pixel format mappings; integrates conditional scaling based on consumer requirements
src/framework/mlt_consumer.c Propagates consumer scale property to frame properties for producer access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ddennedy ddennedy changed the title Hwaccel filters Add hwaccel scale filter with preview scaling Dec 10, 2025
@ddennedy ddennedy marked this pull request as draft December 11, 2025 00:39
@ddennedy ddennedy requested a review from Copilot December 12, 2025 23:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ddennedy ddennedy marked this pull request as ready for review December 12, 2025 23:14
@ddennedy ddennedy marked this pull request as draft December 13, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants