mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-11 08:13:06 +00:00
swscale/uops: thread SwsContext through ff_sws_ops_translate()
Needed to access ctx->flags, in particular SWS_BITEXACT. Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
@@ -43,7 +43,7 @@ static int print_ops(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
|
||||
if (!uops)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
int ret = ff_sws_ops_translate(ops, 0, uops);
|
||||
int ret = ff_sws_ops_translate(ctx, ops, 0, uops);
|
||||
if (ret == AVERROR(ENOTSUP)) {
|
||||
av_log(NULL, AV_LOG_INFO, " Retrying with split passes:\n");
|
||||
goto fail;
|
||||
|
||||
+6
-5
@@ -540,8 +540,8 @@ static bool is_expand_bit(SwsPixelType type, AVRational factor)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int translate_op(SwsUOpList *uops, SwsUOpFlags flags, const SwsOp *op,
|
||||
const SwsComps *input)
|
||||
static int translate_op(SwsContext *ctx, SwsUOpList *uops, SwsUOpFlags flags,
|
||||
const SwsOp *op, const SwsComps *input)
|
||||
{
|
||||
switch (op->op) {
|
||||
case SWS_OP_FILTER_H:
|
||||
@@ -641,11 +641,12 @@ static int translate_op(SwsUOpList *uops, SwsUOpFlags flags, const SwsOp *op,
|
||||
return ff_sws_uop_list_append(uops, &uop);
|
||||
}
|
||||
|
||||
int ff_sws_ops_translate(const SwsOpList *ops, SwsUOpFlags flags, SwsUOpList *uops)
|
||||
int ff_sws_ops_translate(SwsContext *ctx, const SwsOpList *ops,
|
||||
SwsUOpFlags flags, SwsUOpList *uops)
|
||||
{
|
||||
SwsComps input = ops->comps_src;
|
||||
for (int i = 0; i < ops->num_ops; i++) {
|
||||
int ret = translate_op(uops, flags, &ops->ops[i], &input);
|
||||
int ret = translate_op(ctx, uops, flags, &ops->ops[i], &input);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
input = ops->ops[i].comps;
|
||||
@@ -680,7 +681,7 @@ static int register_flags(SwsContext *ctx, SwsOpList *ops, SwsUOpFlags flags)
|
||||
if (!uops)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
int ret = ff_sws_ops_translate(ops, flags, uops);
|
||||
int ret = ff_sws_ops_translate(ctx, ops, flags, uops);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
|
||||
+3
-2
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
|
||||
typedef struct SwsContext SwsContext;
|
||||
typedef struct SwsFilterWeights SwsFilterWeights;
|
||||
typedef struct SwsOpList SwsOpList;
|
||||
|
||||
@@ -225,8 +226,8 @@ int ff_sws_uop_list_append(SwsUOpList *uops, SwsUOp *uop);
|
||||
*
|
||||
* Return 0 or a negative error code.
|
||||
*/
|
||||
int ff_sws_ops_translate(const SwsOpList *ops, SwsUOpFlags flags,
|
||||
SwsUOpList *uops);
|
||||
int ff_sws_ops_translate(SwsContext *ctx, const SwsOpList *ops,
|
||||
SwsUOpFlags flags, SwsUOpList *uops);
|
||||
|
||||
/**
|
||||
* Generate a set of boilerplate C preprocessor macros for describing and
|
||||
|
||||
@@ -149,7 +149,7 @@ static int compile(SwsContext *ctx, SwsOpList *ops, SwsCompiledOp *out)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = ff_sws_ops_translate(ops, 0, uops);
|
||||
ret = ff_sws_ops_translate(ctx, ops, 0, uops);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user