This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/8.1 in repository ffmpeg.
commit f866705d4dc5286754d44af0e5e49fe56973f376 Author: Niklas Haas <[email protected]> AuthorDate: Mon Jun 8 14:44:01 2026 +0200 Commit: Marvin Scholz <[email protected]> CommitDate: Mon Jun 29 15:49:48 2026 +0200 swscale/filters: add option for adding an input pixel offset This is needed for chroma subsampling, which requires a different filter offset for chroma subsamples (according to the frame's chroma location). Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> (cherry-picked from commit 8215e9bbea07173b59e842a860df58aca18ff01a) Signed-off-by: Marvin Scholz <[email protected]> --- libswscale/filters.c | 3 ++- libswscale/filters.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libswscale/filters.c b/libswscale/filters.c index 140da8736f..f9e0f3a1d0 100644 --- a/libswscale/filters.c +++ b/libswscale/filters.c @@ -77,7 +77,7 @@ static void compute_row(SwsFilterWeights *f, const SwsFilterFunction *fun, * the entire square from (0,0) to (1,1). When normalizing between different * image sizes, we therefore need to add/subtract off these 0.5 offsets. */ - const double src_pos = (dst_pos + 0.5) * ratio_inv - 0.5; + const double src_pos = (dst_pos + 0.5) * ratio_inv - 0.5 + f->offset; if (f->filter_size == 1) { *pos = fmin(fmax(round(src_pos), 0.0), f->src_size - 1); *out = SWS_FILTER_SCALE; @@ -241,6 +241,7 @@ int ff_sws_filter_generate(void *log, const SwsFilterParams *params, memcpy(filter->name, fun.name, sizeof(filter->name)); filter->src_size = params->src_size; filter->dst_size = params->dst_size; + filter->offset = params->offset; filter->filter_size = filter_size; if (filter->filter_size == 1) filter->sum_positive = SWS_FILTER_SCALE; diff --git a/libswscale/filters.h b/libswscale/filters.h index b1f4e13ab7..9cb467db24 100644 --- a/libswscale/filters.h +++ b/libswscale/filters.h @@ -72,6 +72,13 @@ typedef struct SwsFilterParams { */ int src_size; int dst_size; + + /** + * The sample offset, in units of input pixels. This is added onto all + * sampled coordinates directly, i.e. a value of offset = 1.0 would shift + * the output to the top/left by one whole source pixel. + */ + double offset; } SwsFilterParams; /** @@ -104,6 +111,7 @@ typedef struct SwsFilterWeights { */ int src_size; int dst_size; + double offset; /** * Extra metadata about the filter, used to inform the optimizer / range _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
