1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

swscale/ops: add link back to owning SwsOpList

This makes some helper functions more convenient to implement in a way that's
less dependent on SwsOpList design decisions, and without requiring threading
that parameter through every function.

Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
Niklas Haas
2026-10-08 12:14:36 +02:00
committed by Niklas Haas
parent 50c0282615
commit 5f2a38d11c
2 changed files with 12 additions and 3 deletions

View File

@@ -702,7 +702,9 @@ SwsOpList *ff_sws_op_list_duplicate(const SwsOpList *ops)
}
for (int i = 0; i < copy->num_ops; i++) {
const SwsOp *op = &copy->ops[i];
SwsOp *op = &copy->ops[i];
op->ops = copy;
switch (op->op) {
case SWS_OP_READ:
if (op->rw.filter.kernel)
@@ -764,6 +766,7 @@ int ff_sws_op_list_insert_at(SwsOpList *ops, int index, SwsOp *op)
for (int i = ops->num_ops - 1; i > index; i--)
ops->ops[i] = ops->ops[i - 1];
ops->ops[index] = *op;
ops->ops[index].ops = ops;
return 0;
}

View File

@@ -238,7 +238,10 @@ typedef struct SwsOpPad {
SwsCompMask dep_in, dep_out;
} SwsOpPad;
typedef struct SwsOp {
typedef struct SwsOp SwsOp;
typedef struct SwsOpList SwsOpList;
struct SwsOp {
SwsOpType op; /* operation to perform */
SwsPixelType type; /* pixel type to operate on */
union {
@@ -264,7 +267,10 @@ typedef struct SwsOp {
* metadata for all operations, during ff_sws_ops_compile().
*/
SwsOpPad outputs[4];
} SwsOp;
/* Link back to the SwsOpList that owns this operation */
SwsOpList *ops;
};
#define SWS_OP_NEEDED(op, idx) (!((op)->outputs[idx].flags & SWS_COMP_GARBAGE))