-
Notifications
You must be signed in to change notification settings - Fork 357
Add hwaccel scale filter with preview scaling #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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.
There was a problem hiding this 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.
7044954 to
e86527a
Compare
@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!
scaleproperty) by using hwaccel scale filters.MLT_AVFORMAT_HWACCEL_PPSto 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