From 4a9641b5610ff4451fead5b9a206004641517892 Mon Sep 17 00:00:00 2001 From: akarin Date: Mon, 27 Sep 2021 05:22:34 +0900 Subject: [PATCH] VapourSynth/libavsmash_source.c, lwlibav_source.c: mark alpha clip as always in full range Fixes AkarinVS/L-SMASH-Works#11. Signed-off-by: akarin (cherry picked from commit https://github.com/AkarinVS/L-SMASH-Works/commit/843a046d0064f8c5e6d1c22e211c2447b4bb8fee) --- VapourSynth/libavsmash_source.c | 4 +++- VapourSynth/lwlibav_source.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/VapourSynth/libavsmash_source.c b/VapourSynth/libavsmash_source.c index d0d831f9..a2b88c54 100644 --- a/VapourSynth/libavsmash_source.c +++ b/VapourSynth/libavsmash_source.c @@ -282,7 +282,9 @@ static const VSFrameRef *VS_CC vs_filter_get_frame( int n, int activation_reason vsapi->setFilterError( "lsmas: failed to output an alpha video frame.", frame_ctx ); return NULL; } - VSMap *props = vsapi->getFramePropsRW( vs_frame ); + VSMap *props = vsapi->getFramePropsRW( vs_frame2 ); + vsapi->propSetFrame( props, "_ColorRange", 0, paReplace ); // alpha clip always full range + props = vsapi->getFramePropsRW( vs_frame ); vsapi->propSetFrame( props, "_Alpha", vs_frame2, paAppend ); vsapi->freeFrame( vs_frame2 ); } diff --git a/VapourSynth/lwlibav_source.c b/VapourSynth/lwlibav_source.c index d3926391..6eb3d1ac 100644 --- a/VapourSynth/lwlibav_source.c +++ b/VapourSynth/lwlibav_source.c @@ -269,7 +269,9 @@ static const VSFrameRef *VS_CC vs_filter_get_frame( int n, int activation_reason vsapi->setFilterError( "lsmas: failed to output an alpha video frame.", frame_ctx ); return NULL; } - VSMap *props = vsapi->getFramePropsRW( vs_frame ); + VSMap *props = vsapi->getFramePropsRW( vs_frame2 ); + vsapi->propSetFrame( props, "_ColorRange", 0, paReplace ); // alpha clip always full range + props = vsapi->getFramePropsRW( vs_frame ); vsapi->propSetFrame( props, "_Alpha", vs_frame2, paAppend ); vsapi->freeFrame( vs_frame2 ); }