This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 353b8297a5c81c08049b43845ff21876e360b3f7 Author: Ramiro Polla <[email protected]> AuthorDate: Wed Jun 17 21:49:31 2026 +0200 Commit: Ramiro Polla <[email protected]> CommitDate: Sun Jul 19 15:07:03 2026 +0200 swscale/aarch64/ops: use SwsDitherUOp for SwsAArch64OpImplParams.dither This is one more step to eventually replace the parameter fields in SwsAArch64OpImplParams by generic structs from libswscale/uops.h. The function names and ordering in ops_entries.c is maintained to simplify the gradual move to uops.h. Sponsored-by: Sovereign Tech Fund Signed-off-by: Ramiro Polla <[email protected]> --- libswscale/aarch64/ops_asmgen.c | 6 +++--- libswscale/aarch64/ops_entries.c | 44 +++++++++++++++++++------------------- libswscale/aarch64/ops_impl.h | 7 +----- libswscale/aarch64/ops_impl_conv.c | 7 +++--- libswscale/tests/sws_ops_aarch64.c | 29 ++++++++++++++++++++----- 5 files changed, 53 insertions(+), 40 deletions(-) diff --git a/libswscale/aarch64/ops_asmgen.c b/libswscale/aarch64/ops_asmgen.c index 95f7dcb551..ae16eab5b8 100644 --- a/libswscale/aarch64/ops_asmgen.c +++ b/libswscale/aarch64/ops_asmgen.c @@ -1216,10 +1216,10 @@ static void asmgen_op_dither(SwsAArch64Context *s, const SwsAArch64OpImplParams /* Very cheap bucket sort. */ int max_offset = 0; LOOP_MASK(p, i) - max_offset = FFMAX(max_offset, MASK_GET(p->dither.y_offset, i)); + max_offset = FFMAX(max_offset, p->dither.y_offset[i]); for (int y_off = 0; y_off <= max_offset; y_off++) { LOOP_MASK(p, i) { - if (MASK_GET(p->dither.y_offset, i) == y_off) + if (p->dither.y_offset[i] == y_off) sorted[n_comps++] = i; } } @@ -1261,7 +1261,7 @@ static void asmgen_op_dither(SwsAArch64Context *s, const SwsAArch64OpImplParams int prev_i = 0; for (int sorted_i = 0; sorted_i < n_comps; sorted_i++) { int i = sorted[sorted_i]; - uint8_t y_off = MASK_GET(p->dither.y_offset, i); + uint8_t y_off = p->dither.y_offset[i]; bool do_load = (y_off != last_y_off); if (last_y_off < 0) { diff --git a/libswscale/aarch64/ops_entries.c b/libswscale/aarch64/ops_entries.c index 027f6b1ea5..cc29d102b1 100644 --- a/libswscale/aarch64/ops_entries.c +++ b/libswscale/aarch64/ops_entries.c @@ -390,25 +390,25 @@ ENTRY(ff_sws_linear_fma_c0000000fc_8_f32_1001_neon, { .uop = SWS_UOP_LINEAR_FMA, ENTRY(ff_sws_linear_fma_c003f3fccf_8_f32_1111_neon, { .uop = SWS_UOP_LINEAR_FMA, .linear = { .one = 0x0, .zero = 0xbb10a }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) ENTRY(ff_sws_linear_fma_c00c00c00c_8_f32_1111_neon, { .uop = SWS_UOP_LINEAR_FMA, .linear = { .one = 0x0, .zero = 0xbefbe }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) ENTRY(ff_sws_linear_fma_c00ff3fcff_8_f32_1111_neon, { .uop = SWS_UOP_LINEAR_FMA, .linear = { .one = 0x0, .zero = 0xba108 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_0325_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x0325, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_032f_4_8_f32_1110_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x032f, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1110 }) -ENTRY(ff_sws_dither_2305_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x2305, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_230f_4_8_f32_1110_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x230f, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1110 }) -ENTRY(ff_sws_dither_3000_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x3000, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_302f_4_8_f32_1110_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x302f, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1110 }) -ENTRY(ff_sws_dither_3ff0_4_8_f32_1001_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x3ff0, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1001 }) -ENTRY(ff_sws_dither_5023_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x5023, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_5032_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x5032, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_5230_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x5230, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) -ENTRY(ff_sws_dither_5ff0_4_8_f32_1001_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x5ff0, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1001 }) -ENTRY(ff_sws_dither_5fff_4_8_f32_1000_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0x5fff, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1000 }) -ENTRY(ff_sws_dither_f023_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf023, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) -ENTRY(ff_sws_dither_f032_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf032, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) -ENTRY(ff_sws_dither_f203_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf203, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) -ENTRY(ff_sws_dither_f230_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf230, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) -ENTRY(ff_sws_dither_f2f0_4_8_f32_0101_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf2f0, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0101 }) -ENTRY(ff_sws_dither_f2ff_4_8_f32_0100_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf2ff, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0100 }) -ENTRY(ff_sws_dither_f302_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xf302, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) -ENTRY(ff_sws_dither_ff30_4_8_f32_0011_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xff30, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0011 }) -ENTRY(ff_sws_dither_ff3f_4_8_f32_0010_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xff3f, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0010 }) -ENTRY(ff_sws_dither_fff0_4_8_f32_0001_neon, { .uop = SWS_UOP_DITHER, .dither.y_offset = 0xfff0, .dither.size_log2 = 4, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0001 }) +ENTRY(ff_sws_dither_0325_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {5, 2, 3, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) +ENTRY(ff_sws_dither_032f_4_8_f32_1110_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 2, 3, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1110 }) +ENTRY(ff_sws_dither_2305_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {5, 0, 3, 2}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) +ENTRY(ff_sws_dither_230f_4_8_f32_1110_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 3, 2}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1110 }) +ENTRY(ff_sws_dither_3000_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 0, 3}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) +ENTRY(ff_sws_dither_302f_4_8_f32_1110_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 2, 0, 3}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1110 }) +ENTRY(ff_sws_dither_3ff0_4_8_f32_1001_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 0, 3}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1001 }) +ENTRY(ff_sws_dither_5023_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {3, 2, 0, 5}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) +ENTRY(ff_sws_dither_5032_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {2, 3, 0, 5}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) +ENTRY(ff_sws_dither_5230_4_8_f32_1111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 3, 2, 5}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1111 }) +ENTRY(ff_sws_dither_5ff0_4_8_f32_1001_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 0, 5}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1001 }) +ENTRY(ff_sws_dither_5fff_4_8_f32_1000_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 0, 5}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x1000 }) +ENTRY(ff_sws_dither_f023_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {3, 2, 0, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) +ENTRY(ff_sws_dither_f032_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {2, 3, 0, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) +ENTRY(ff_sws_dither_f203_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {3, 0, 2, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) +ENTRY(ff_sws_dither_f230_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 3, 2, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) +ENTRY(ff_sws_dither_f2f0_4_8_f32_0101_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 2, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0101 }) +ENTRY(ff_sws_dither_f2ff_4_8_f32_0100_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 2, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0100 }) +ENTRY(ff_sws_dither_f302_4_8_f32_0111_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {2, 0, 3, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0111 }) +ENTRY(ff_sws_dither_ff30_4_8_f32_0011_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 3, 0, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0011 }) +ENTRY(ff_sws_dither_ff3f_4_8_f32_0010_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 3, 0, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0010 }) +ENTRY(ff_sws_dither_fff0_4_8_f32_0001_neon, { .uop = SWS_UOP_DITHER, .dither = { .y_offset = {0, 0, 0, 0}, .size_log2 = 4 }, .block_size = 8, .type = SWS_PIXEL_F32, .mask = 0x0001 }) diff --git a/libswscale/aarch64/ops_impl.h b/libswscale/aarch64/ops_impl.h index 378ce013d3..88f8d030f9 100644 --- a/libswscale/aarch64/ops_impl.h +++ b/libswscale/aarch64/ops_impl.h @@ -30,11 +30,6 @@ /* Each nibble in the mask corresponds to one component. */ typedef uint16_t SwsAArch64OpMask; -typedef struct SwsAArch64DitherOp { - uint16_t y_offset; - uint8_t size_log2; -} SwsAArch64DitherOp; - /** * SwsAArch64OpImplParams describes the parameters for an SwsUOpType * operation. It consists of simplified parameters from the SwsOp structure, @@ -51,7 +46,7 @@ typedef struct SwsAArch64OpImplParams { SwsMoveUOp move; SwsPackUOp pack; SwsLinearUOp linear; - SwsAArch64DitherOp dither; + SwsDitherUOp dither; }; } SwsAArch64OpImplParams; diff --git a/libswscale/aarch64/ops_impl_conv.c b/libswscale/aarch64/ops_impl_conv.c index 98df0a9c03..6b39dc8573 100644 --- a/libswscale/aarch64/ops_impl_conv.c +++ b/libswscale/aarch64/ops_impl_conv.c @@ -288,10 +288,9 @@ static int convert_to_aarch64_impl(SwsContext *ctx, const SwsOpList *ops, int n, MASK_SET(out->mask, 1, op->dither.y_offset[1] >= 0); MASK_SET(out->mask, 2, op->dither.y_offset[2] >= 0); MASK_SET(out->mask, 3, op->dither.y_offset[3] >= 0); - MASK_SET(out->dither.y_offset, 0, op->dither.y_offset[0]); - MASK_SET(out->dither.y_offset, 1, op->dither.y_offset[1]); - MASK_SET(out->dither.y_offset, 2, op->dither.y_offset[2]); - MASK_SET(out->dither.y_offset, 3, op->dither.y_offset[3]); + LOOP(out->mask, i) { + out->dither.y_offset[i] = op->dither.y_offset[i]; + } out->dither.size_log2 = op->dither.size_log2; break; } diff --git a/libswscale/tests/sws_ops_aarch64.c b/libswscale/tests/sws_ops_aarch64.c index 006e4eb68f..c2234d4824 100644 --- a/libswscale/tests/sws_ops_aarch64.c +++ b/libswscale/tests/sws_ops_aarch64.c @@ -88,6 +88,19 @@ static uint64_t linear_to_mask(const SwsLinearUOp *linear) return mask; } +static uint16_t dither_to_mask(const SwsAArch64OpImplParams *p, const SwsDitherUOp *dither) +{ + uint16_t mask = 0; + for (int i = 0; i < 4; i++) { + if (p->mask & SWS_COMP(i)) { + MASK_SET(mask, i, dither->y_offset[i]); + } else { + MASK_SET(mask, i, 0xf); + } + } + return mask; +} + static int aarch64_op_impl_cmp(const void *a, const void *b) { const SwsAArch64OpImplParams *pa = (const SwsAArch64OpImplParams *) a; @@ -133,13 +146,16 @@ static int aarch64_op_impl_cmp(const void *a, const void *b) return (int64_t) (ia - ib) < 0 ? -1 : 1; break; } - case SWS_UOP_DITHER: - if (pa->dither.y_offset != pb->dither.y_offset) - return (int) pa->dither.y_offset - pb->dither.y_offset; + case SWS_UOP_DITHER: { + uint16_t ia = dither_to_mask(pa, &pa->dither); + uint16_t ib = dither_to_mask(pb, &pb->dither); + if (ia != ib) + return (int) ia - ib; if (pa->dither.size_log2 != pb->dither.size_log2) return (int) pa->dither.size_log2 - pb->dither.size_log2; break; } + } if (pa->block_size != pb->block_size) return (int) pa->block_size - pb->block_size; @@ -307,7 +323,7 @@ static void impl_func_name(AVBPrint *bp, const SwsAArch64OpImplParams *params) av_bprintf(bp, "_%010" PRIx64, linear_to_mask(¶ms->linear)); break; case SWS_UOP_DITHER: - av_bprintf(bp, "_%04x_%u", params->dither.y_offset, params->dither.size_log2); + av_bprintf(bp, "_%04x_%u", dither_to_mask(params, ¶ms->dither), params->dither.size_log2); break; } av_bprintf(bp, "_%u_%s_%04x_neon", params->block_size, pixel_type_names[params->type], params->mask); @@ -384,7 +400,10 @@ static void serialize_op(AVBPrint *bp, const SwsAArch64OpImplParams *params) av_bprintf(bp, ", .linear = { .one = 0x%x, .zero = 0x%x }", params->linear.one, params->linear.zero); break; case SWS_UOP_DITHER: - av_bprintf(bp, ", .dither.y_offset = 0x%04x, .dither.size_log2 = %u", params->dither.y_offset, params->dither.size_log2); + av_bprintf(bp, ", .dither = { .y_offset = {%u, %u, %u, %u}, .size_log2 = %u }", + params->dither.y_offset[0], params->dither.y_offset[1], + params->dither.y_offset[2], params->dither.y_offset[3], + params->dither.size_log2); break; } av_bprintf(bp, ", .block_size = %u, .type = %s, .mask = 0x%04x })", params->block_size, pixel_types[params->type], params->mask); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
