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:
@@ -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 = ©->ops[i];
|
||||
SwsOp *op = ©->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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user