This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 58f933798fae0d2997a7ea0269c77fff0870ff24 Author: Niklas Haas <[email protected]> AuthorDate: Mon Dec 1 16:10:38 2025 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Mon Dec 15 14:31:58 2025 +0000 swscale/ops_tmpl_float: respect specified dither matrix offsets Since we only need 8 bytes to store the dither matrix pointer, we actually still have 8 bytes left-over. That means we could either store the 8-bit row offset directly, or alternatively compute a 16-bit pointer offsets. I have chosen to do the former for the C backend, in the interest of simplicity. The one downside of this approach is that it would fail on hypothetical 128-bit platforms; although I seriously hope that this code does not live long enough to see the need for 128-bit addressable memory. --- libswscale/ops_tmpl_float.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libswscale/ops_tmpl_float.c b/libswscale/ops_tmpl_float.c index 345f9dd57b..78b3a9c4fc 100644 --- a/libswscale/ops_tmpl_float.c +++ b/libswscale/ops_tmpl_float.c @@ -56,6 +56,11 @@ DECL_SETUP(setup_dither) if (!matrix) return AVERROR(ENOMEM); + static_assert(sizeof(out->ptr) <= sizeof(uint8_t[8]), ">8 byte pointers not supported"); + uint8_t *offset = &out->u8[8]; + for (int i = 0; i < 4; i++) + offset[i] = op->dither.y_offset[i]; + for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) matrix[y * width + x] = av_q2pixel(op->dither.matrix[y * size + x]); @@ -69,12 +74,13 @@ DECL_SETUP(setup_dither) DECL_FUNC(dither, const int size_log2) { const pixel_t *restrict matrix = impl->priv.ptr; + const uint8_t *offset = &impl->priv.u8[8]; const int mask = (1 << size_log2) - 1; const int y_line = iter->y; - const int row0 = (y_line + 0) & mask; - const int row1 = (y_line + 3) & mask; - const int row2 = (y_line + 2) & mask; - const int row3 = (y_line + 5) & mask; + const int row0 = (y_line + offset[0]) & mask; + const int row1 = (y_line + offset[1]) & mask; + const int row2 = (y_line + offset[2]) & mask; + const int row3 = (y_line + offset[3]) & mask; const int size = 1 << size_log2; const int width = FFMAX(size, SWS_BLOCK_SIZE); const int base = iter->x & ~(SWS_BLOCK_SIZE - 1) & (size - 1); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
