This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit a7c6a5f74e93cfb2fe69a00d82bbce84f588c664
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri May 1 17:47:05 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Tue Jun 9 18:27:20 2026 +0200

    swscale/ops_chain: remove dead code
    
    This is no longer needed now that both C and x86 are ported to uops.
    The other ff_sws_setup_*() functions are still used by the aarch64 backend.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_chain.c    | 185 ----------------------------------------------
 libswscale/ops_chain.h    |  33 +--------
 libswscale/uops_backend.c |   1 -
 libswscale/x86/ops.c      |   4 -
 4 files changed, 3 insertions(+), 220 deletions(-)

diff --git a/libswscale/ops_chain.c b/libswscale/ops_chain.c
index 1c3e0c3677..331f2f696b 100644
--- a/libswscale/ops_chain.c
+++ b/libswscale/ops_chain.c
@@ -60,192 +60,8 @@ int ff_sws_op_chain_append(SwsOpChain *chain, SwsFuncPtr 
func,
     return 0;
 }
 
-/**
- * Match an operation against a reference operation. Returns a score for how
- * well the reference matches the operation, or 0 if there is no match.
- *
- * For unfiltered SWS_OP_READ/SWS_OP_WRITE, SWS_OP_SWAP_BYTES and
- * SWS_OP_SWIZZLE, the exact type is not checked, just the size.
- *
- * Components marked SWS_COMP_GARBAGE are ignored when matching. If `flexible`
- * is true, the op body is ignored - only the operation, pixel type, and
- * component masks are checked.
- */
-static int op_match(const SwsOp *op, const SwsOpEntry *entry)
-{
-    int score = 10;
-    if (op->op != entry->op)
-        return 0;
-
-    switch (op->op) {
-    case SWS_OP_READ:
-    case SWS_OP_WRITE:
-        if (op->rw.filter && op->type != entry->type)
-            return 0;
-        av_fallthrough;
-    case SWS_OP_SWAP_BYTES:
-    case SWS_OP_SWIZZLE:
-        /* Only the size matters for these operations */
-        if (ff_sws_pixel_type_size(op->type) != 
ff_sws_pixel_type_size(entry->type))
-            return 0;
-        break;
-    default:
-        if (op->type != entry->type)
-            return 0;
-        break;
-    }
-
-    const SwsCompMask needed = ff_sws_comp_mask_needed(op);
-    if (needed & ~entry->mask)
-        return 0; /* Entry doesn't compute all needed components */
-
-    /* Otherwise, operating on fewer components is better */
-    score += av_popcount(SWS_COMP_INV(entry->mask));
-
-    /* Flexible variants always match, but lower the score to prioritize more
-     * specific implementations if they exist */
-    if (entry->flexible)
-        return score - 5;
-
-    switch (op->op) {
-    case SWS_OP_INVALID:
-        return 0;
-    case SWS_OP_READ:
-    case SWS_OP_WRITE:
-        if (op->rw.elems   != entry->rw.elems ||
-            op->rw.frac    != entry->rw.frac  ||
-            op->rw.filter  != entry->rw.filter ||
-            (op->rw.elems > 1 && op->rw.packed != entry->rw.packed))
-            return 0;
-        return score;
-    case SWS_OP_SWAP_BYTES:
-        return score;
-    case SWS_OP_PACK:
-    case SWS_OP_UNPACK:
-        for (int i = 0; i < 4 && op->pack.pattern[i]; i++) {
-            if (op->pack.pattern[i] != entry->pack.pattern[i])
-                return 0;
-        }
-        return score;
-    case SWS_OP_CLEAR:
-        /* Clear mask must match exactly */
-        if (op->clear.mask != entry->clear.mask)
-            return 0;
-        for (int i = 0; i < 4; i++) {
-            if (!SWS_COMP_TEST(op->clear.mask, i) || !SWS_OP_NEEDED(op, i))
-                continue;
-            else if (!entry->clear.value[i].den)
-                continue; /* Any clear value supported */
-            else if (av_cmp_q(op->clear.value[i], entry->clear.value[i]))
-                return 0;
-        }
-        return score;
-    case SWS_OP_LSHIFT:
-    case SWS_OP_RSHIFT:
-        av_assert1(entry->flexible);
-        break;
-    case SWS_OP_SWIZZLE:
-        for (int i = 0; i < 4; i++) {
-            if (SWS_OP_NEEDED(op, i) && op->swizzle.in[i] != 
entry->swizzle.in[i])
-                return 0;
-        }
-        return score;
-    case SWS_OP_CONVERT:
-        if (op->convert.to     != entry->convert.to ||
-            op->convert.expand != entry->convert.expand)
-            return 0;
-        return score;
-    case SWS_OP_DITHER:
-        return op->dither.size_log2 == entry->dither_size ? score : 0;
-    case SWS_OP_MIN:
-    case SWS_OP_MAX:
-        return score;
-    case SWS_OP_LINEAR:
-        if (op->lin.mask != entry->linear_mask)
-            return 0;
-        return score;
-    case SWS_OP_SCALE:
-        return av_cmp_q(op->scale.factor, entry->scale) ? 0 : score;
-    case SWS_OP_FILTER_H:
-    case SWS_OP_FILTER_V:
-        return score;
-    case SWS_OP_TYPE_NB:
-        break;
-    }
-
-    av_unreachable("Invalid operation type!");
-    return 0;
-}
-
-int ff_sws_op_compile_tables(SwsContext *ctx, const SwsOpTable *const tables[],
-                             int num_tables, const SwsOp *op,
-                             const int block_size, SwsOpChain *chain)
-{
-    const unsigned cpu_flags = av_get_cpu_flags();
-    const SwsOpEntry *best = NULL;
-    const SwsOpTable *best_table = NULL;
-    int ret, best_score = 0;
-
-    SwsImplParams params = {
-        .ctx    = ctx,
-        .op     = op
-    };
-
-    for (int n = 0; n < num_tables; n++) {
-        const SwsOpTable *table = tables[n];
-        av_assert0(!table->uops);
-        if (table->block_size && table->block_size != block_size ||
-            table->cpu_flags & ~cpu_flags)
-            continue;
-
-        params.table = table;
-        for (int i = 0; table->entries[i]; i++) {
-            const SwsOpEntry *entry = table->entries[i];
-            int score = op_match(op, entry);
-            if (score <= best_score)
-                continue;
-            if (entry->check && !entry->check(&params))
-                continue;
-            best_score = score;
-            best_table = table;
-            best = entry;
-        }
-    }
-
-    if (!best)
-        return AVERROR(ENOTSUP);
-
-    params.table = best_table;
-
-    SwsImplResult res = {0};
-    if (best->setup) {
-        ret = best->setup(&params, &res);
-        if (ret < 0)
-            return ret;
-    }
-
-    ret = ff_sws_op_chain_append(chain, res.func ? res.func : best->func,
-                                 res.free, &res.priv);
-    if (ret < 0) {
-        if (res.free)
-            res.free(&res.priv);
-        return ret;
-    }
-
-    chain->cpu_flags |= best_table->cpu_flags;
-    chain->over_read  = FFMAX(chain->over_read,  res.over_read);
-    chain->over_write = FFMAX(chain->over_write, res.over_write);
-    return 0;
-}
-
 #define q2pixel(type, q) ((q).den ? (type) (q).num / (q).den : 0)
 
-int ff_sws_setup_shift(const SwsImplParams *params, SwsImplResult *out)
-{
-    out->priv.u8[0] = params->op->shift.amount;
-    return 0;
-}
-
 int ff_sws_setup_scale(const SwsImplParams *params, SwsImplResult *out)
 {
     const SwsOp *op = params->op;
@@ -312,7 +128,6 @@ int ff_sws_uop_lookup(SwsContext *ctx, const SwsOpTable 
*const tables[],
 
     for (int n = 0; !match && n < num_tables; n++) {
         const SwsOpTable *table = params.table = tables[n];
-        av_assert0(table->uops);
         if (table->block_size && table->block_size != block_size ||
             table->cpu_flags & ~cpu_flags)
             continue;
diff --git a/libswscale/ops_chain.h b/libswscale/ops_chain.h
index 031b172c2c..2126787782 100644
--- a/libswscale/ops_chain.h
+++ b/libswscale/ops_chain.h
@@ -120,26 +120,11 @@ typedef struct SwsImplResult {
 } SwsImplResult;
 
 typedef struct SwsOpEntry {
-    /* Kernel metadata; reduced size subset of SwsOp */
-    union {
-        SwsOpType op;
-        SwsUOpType uop;
-    };
+    /* Kernel metadata; reduced size subset of SwsUOp (sans data) */
+    SwsUOpType uop;
     SwsPixelType type;
     SwsCompMask mask;
-    bool flexible; /* if true, only the type and op are matched (for ops only) 
*/
-
-    union { /* extra data defining the operation, unless `flexible` is true */
-        SwsUOpParams   par;
-        SwsReadWriteOp rw;
-        SwsPackOp      pack;
-        SwsSwizzleOp   swizzle;
-        SwsConvertOp   convert;
-        SwsClearOp     clear;
-        uint32_t       linear_mask; /* subset of SwsLinearOp */
-        int            dither_size; /* subset of SwsDitherOp */
-        AVRational     scale;       /* scale factor for SWS_OP_SCALE */
-    };
+    SwsUOpParams par;
 
     /* Kernel implementation */
     SwsFuncPtr func;
@@ -148,7 +133,6 @@ typedef struct SwsOpEntry {
 } SwsOpEntry;
 
 /* Setup helpers for common/trivial operation types */
-int ff_sws_setup_shift(const SwsImplParams *params, SwsImplResult *out);
 int ff_sws_setup_scale(const SwsImplParams *params, SwsImplResult *out);
 int ff_sws_setup_clamp(const SwsImplParams *params, SwsImplResult *out);
 int ff_sws_setup_clear(const SwsImplParams *params, SwsImplResult *out);
@@ -170,20 +154,9 @@ static inline void ff_op_priv_unref(SwsOpPriv *priv)
 struct SwsOpTable {
     unsigned cpu_flags;   /* required CPU flags for this table */
     int block_size;       /* fixed block size of this table */
-    bool uops;            /* if true, entries are uops, not ops */
     const SwsOpEntry *entries[]; /* terminated by NULL */
 };
 
-/**
- * "Compile" a single op by looking it up in a list of fixed size op tables.
- * See `op_match` in `ops_chain.c` for details on how the matching works.
- *
- * Returns 0 or a negative error code.
- */
-int ff_sws_op_compile_tables(SwsContext *ctx, const SwsOpTable *const tables[],
-                             int num_tables, const SwsOp *op,
-                             const int block_size, SwsOpChain *chain);
-
 /**
  * "Compile" a single uop by looking it up in a list of fixed size uop tables,
  * in decreasing order of preference.
diff --git a/libswscale/uops_backend.c b/libswscale/uops_backend.c
index 46e429cc5b..ee4d7465a7 100644
--- a/libswscale/uops_backend.c
+++ b/libswscale/uops_backend.c
@@ -95,7 +95,6 @@
 
 static const SwsOpTable op_table = {
     .block_size = SWS_BLOCK_SIZE,
-    .uops = true,
     .entries = {
         REF_ALL_UOPS(U8)
         REF_ALL_UOPS(U16)
diff --git a/libswscale/x86/ops.c b/libswscale/x86/ops.c
index 60e83d9714..335d0a85a8 100644
--- a/libswscale/x86/ops.c
+++ b/libswscale/x86/ops.c
@@ -355,7 +355,6 @@ SWS_FOR_STRUCT(U8, CLEAR,           DECL_ENTRY, EXT, NULL, 
setup_clear)
 static const SwsOpTable ops_u8##EXT = {                                        
 \
     .cpu_flags = AV_CPU_FLAG_##FLAG,                                           
 \
     .block_size = SIZE,                                                        
 \
-    .uops = true,                                                              
 \
     .entries = {                                                               
 \
         REF_OPS_COMMON(EXT, U8)                                                
 \
         SWS_FOR(U8, READ_PLANAR,    REF_ENTRY, EXT)                            
 \
@@ -374,7 +373,6 @@ SWS_FOR_STRUCT(U8,  EXPAND_PAIR, DECL_ENTRY, EXT, NULL, 
NULL)
 static const SwsOpTable ops_u16##EXT = {                                       
 \
     .cpu_flags = AV_CPU_FLAG_##FLAG,                                           
 \
     .block_size = SIZE,                                                        
 \
-    .uops = true,                                                              
 \
     .entries = {                                                               
 \
         REF_OPS_COMMON(EXT, U16)                                               
 \
         SWS_FOR(U8,  TO_U16, REF_ENTRY, EXT)                                   
 \
@@ -395,7 +393,6 @@ SWS_FOR_STRUCT(U8,  EXPAND_QUAD, DECL_ENTRY, EXT, NULL, 
NULL)
 static const SwsOpTable ops_u32##EXT = {                                       
 \
     .cpu_flags = AV_CPU_FLAG_##FLAG,                                           
 \
     .block_size = SIZE,                                                        
 \
-    .uops = true,                                                              
 \
     .entries = {                                                               
 \
         REF_OPS_COMMON(EXT, U32)                                               
 \
         SWS_FOR(U8,  TO_U32, REF_ENTRY, EXT)                                   
 \
@@ -432,7 +429,6 @@ SWS_FOR_STRUCT(F32, READ_PLANAR_FV_FMA, DECL_ENTRY, EXT, 
NULL, setup_filter_v)
 static const SwsOpTable ops_f32##EXT = {                                       
 \
     .cpu_flags = AV_CPU_FLAG_##FLAG,                                           
 \
     .block_size = SIZE,                                                        
 \
-    .uops = true,                                                              
 \
     .entries = {                                                               
 \
         REF_OPS_COMMON(EXT, F32)                                               
 \
         SWS_FOR(U8,  TO_F32, REF_ENTRY, EXT)                                   
 \

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to