This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 46f6ca9366658dcafb3bf836fd95790139e7417b Author: Niklas Haas <[email protected]> AuthorDate: Wed Sep 16 18:27:04 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Sun Sep 20 13:09:12 2026 +0000 swscale/ops_dispatch: copy input lines during setup() when filtering This fixes breakage when vertically filtering unpadded sources, because the previous loop did not account for extra lines from the vertical filter itself. Alternate approach to #24382. Signed-off-by: Niklas Haas <[email protected]> See-Also: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24382 --- libswscale/ops_dispatch.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c index f15287537c..a0d049f616 100644 --- a/libswscale/ops_dispatch.c +++ b/libswscale/ops_dispatch.c @@ -158,18 +158,6 @@ static inline void get_row_data(const SwsOpPass *p, const int y_dst, out[i] = base->out[i] + (y_dst >> base->out_sub_y[i]) * base->out_stride[i]; } -static inline int get_lines_in(const SwsOpPass *p, const int y, const int h, - const int plane) -{ - const SwsOpExec *base = &p->exec_base; - if (!p->offsets_y) - return h >> base->in_sub_y[plane]; - - const int y0 = p->offsets_y[y] >> base->in_sub_y[plane]; - const int y1 = (p->offsets_y[y + h - 1] + p->filter_size_v - 1) >> base->in_sub_y[plane]; - return y1 - y0 + 1; -} - static inline size_t pixel_bytes(size_t pixels, int pixel_bits, enum AVRounding rounding) { @@ -366,6 +354,15 @@ static int op_pass_setup(const SwsFrame *out, const SwsFrame *in, tail->in_offset_x[i] = exec->in_offset_x[i] - p->tail_off_in; } + /* If vertically filtering, we need to copy all lines before processing + * any slice, because filters may read past the current slice bounds */ + for (int i = 0; p->memcpy_in && p->offsets_y && i < p->planes_in; i++) { + const int lines = AV_CEIL_RSHIFT(in->height, exec->in_sub_y[i]); + copy_lines((uint8_t *) tail->in[i], tail->in_stride[i], + exec->in[i] + p->tail_off_in, exec->in_stride[i], + lines, p->tail_size_in); + } + return 0; } @@ -438,9 +435,11 @@ static void op_pass_run(const SwsFrame *out, const SwsFrame *in, const int y, for (int i = 0; i < p->planes_in; i++) { if (memcpy_in) { - const int lines = get_lines_in(p, y, h, i); - copy_lines((uint8_t *) tail.in[i], tail.in_stride[i], - exec.in[i], exec.in_stride[i], lines, p->tail_size_in); + if (!p->offsets_y) { /* already copied by op_pass_setup() */ + const int lines = h >> exec.in_sub_y[i]; + copy_lines((uint8_t *) tail.in[i], tail.in_stride[i], + exec.in[i], exec.in_stride[i], lines, p->tail_size_in); + } } else { /* Reuse input pointers directly */ const size_t loop_size = tail_blocks * exec.block_size_in[i]; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
