Add color_transform normalize filter#1159
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new colorspace normalize filter that automatically handles color transfer characteristic (TRC) conversions throughout the MLT pipeline. The filter addresses the need to normalize colorspace between different color TRCs as requested by consumers.
- Adds a new
colorspacefilter that converts images to the TRC requested by consumers - Integrates the filter into the loader pipeline and consumer processing chain
- Enhances AVFormat modules to properly set color properties on frames
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/core/loader.ini | Registers the colorspace filter in the loader pipeline |
| src/modules/core/filter_colorspace.yml | Metadata definition for the new colorspace filter |
| src/modules/core/filter_colorspace.c | Implementation of the colorspace conversion filter |
| src/modules/core/factory.c | Registers the filter and its metadata in the core module |
| src/modules/core/CMakeLists.txt | Adds the filter source file to the build |
| src/modules/avformat/link_avfilter.c | Sets color properties from AVFrame to MLT frame properties |
| src/modules/avformat/filter_avfilter.c | Sets color properties from AVFrame to MLT frame properties |
| src/modules/avformat/common.h | Adds function declaration for color range conversion |
| src/modules/avformat/common.c | Implements color range conversion from AV to MLT |
| src/framework/mlt_image.h | Adds function declaration for default TRC lookup |
| src/framework/mlt_image.c | Implements default TRC lookup based on colorspace |
| src/framework/mlt_consumer.c | Integrates colorspace filter into consumer processing |
| src/framework/mlt.vers | Exports the new default TRC function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
54f8b64 to
123c3ac
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ba3ab80 to
cf69925
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I've been doing a lot of testing of the more advanced scenarios involving movit, HLG and decklink plus a little bit of the others, which are working fine.
Update: strike changing the ten_bit presets |
|
I can do the other calls to |
That is fine with me. Although, I thought I had converted all the filters - it would be good to fix any that I missed. I am undecided about whether to convert producers (like the color producer) or just let the new color_transform filter make the conversion. There are multiple layers of logic to determine what TRC should be used. And if we copy/paste that all around the code, it might be frustrating to change later. I'd trust your judgement. |
|
I think this is ready now. Please review my changes and we can merge. |
This filter can force the color TRC to whatever the consumer requests.
This adds support for 10 bit and reduces conversions.
This image format is supposed to instruct the producer to provide as native or closest to source as possible. That can be useful by API but also Movit uses this because it tries to handle things as much as possible. This improves the color accuracy of SDR within a BT.2020/HLG project on Movit.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Good to go. Thanks for your help. |
This filter can force the color TRC to whatever the consumer requests.
Posting this as a draft for conceptual review. The PR should not be pushed until it is tested with Shotcut.
This commit adds a new normalize filter that is added once by the loader on each clip, and then again by the consumer at the end of all the services. The first instance will set the TRC to be whatever is set by consumer.mlt_color_trc. The second will change the TRC to consumer.color_trc.
Example usage:
melt test.mp4 -consumer sdl2 mlt_color_trc=linear mlt_image_format=rgba64