History

avfilter/vf_libplacebo: set correct alpha mode before blending

&pl_alpha_overlay expects straight alpha, but the alpha output may be premultiplied as a result of the target alpha mode (or in the absence of an alpha channel). Fix it by requesting independent alpha explicitly when blending.

Niklas Haas committed 1 year ago

Commit 651bfd01 parent c85879c1 file · +3 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_libplacebo.c+3−0
@@ -908,6 +908,9 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) · 907 unmodified lines
908 opts->params.skip_caching_single_frame = high_fps;908 opts->params.skip_caching_single_frame = high_fps;
909 update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base));909 update_crops(ctx, in, &target, out->pts * av_q2d(outlink->time_base));
910 pl_render_image_mix(in->renderer, &in->mix, &target, &opts->params);910 pl_render_image_mix(in->renderer, &in->mix, &target, &opts->params);
911
912 /* Force straight output and set correct blend mode */
913 target.repr.alpha = PL_ALPHA_INDEPENDENT;
911 opts->params.blend_params = &pl_alpha_overlay;914 opts->params.blend_params = &pl_alpha_overlay;
912#if PL_API_VER >= 346915#if PL_API_VER >= 346
913 opts->params.background = opts->params.border = PL_CLEAR_SKIP;916 opts->params.background = opts->params.border = PL_CLEAR_SKIP;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t