swscale/ops_dispatch: allow forcing specific ops backend
This will be used eventually when I rewrite checkasm/sw_ops to re-use the code in ops_dispatch.c instead of hand-rolling the execution layer. Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
+1
-1
@@ -593,7 +593,7 @@ static int add_convert_pass(SwsGraph *graph, const SwsFormat *src,
|
||||
av_log(ctx, AV_LOG_DEBUG, "Unoptimized operation list:\n");
|
||||
ff_sws_op_list_print(ctx, AV_LOG_DEBUG, AV_LOG_TRACE, ops);
|
||||
|
||||
ret = ff_sws_compile_pass(graph, &ops, SWS_OP_FLAG_OPTIMIZE, input, output);
|
||||
ret = ff_sws_compile_pass(graph, NULL, &ops, SWS_OP_FLAG_OPTIMIZE, input, output);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
|
||||
@@ -470,15 +470,15 @@ static void align_pass(SwsPass *pass, int block_size, int over_rw, int pixel_bit
|
||||
buf->width_pad = FFMAX(buf->width_pad, pad);
|
||||
}
|
||||
|
||||
static int compile(SwsGraph *graph, const SwsOpList *ops, SwsPass *input,
|
||||
SwsPass **output)
|
||||
static int compile(SwsGraph *graph, const SwsOpBackend *backend,
|
||||
const SwsOpList *ops, SwsPass *input, SwsPass **output)
|
||||
{
|
||||
SwsContext *ctx = graph->ctx;
|
||||
SwsOpPass *p = av_mallocz(sizeof(*p));
|
||||
if (!p)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
int ret = ff_sws_ops_compile(ctx, NULL, ops, &p->comp);
|
||||
int ret = ff_sws_ops_compile(ctx, backend, ops, &p->comp);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -580,8 +580,9 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ff_sws_compile_pass(SwsGraph *graph, SwsOpList **pops, int flags,
|
||||
SwsPass *input, SwsPass **output)
|
||||
int ff_sws_compile_pass(SwsGraph *graph, const SwsOpBackend *backend,
|
||||
SwsOpList **pops, int flags, SwsPass *input,
|
||||
SwsPass **output)
|
||||
{
|
||||
const int passes_orig = graph->num_passes;
|
||||
SwsContext *ctx = graph->ctx;
|
||||
@@ -611,7 +612,7 @@ int ff_sws_compile_pass(SwsGraph *graph, SwsOpList **pops, int flags,
|
||||
ff_sws_op_list_print(ctx, AV_LOG_DEBUG, AV_LOG_TRACE, ops);
|
||||
}
|
||||
|
||||
ret = compile(graph, ops, input, output);
|
||||
ret = compile(graph, backend, ops, input, output);
|
||||
if (ret != AVERROR(ENOTSUP))
|
||||
goto out;
|
||||
|
||||
@@ -629,7 +630,7 @@ int ff_sws_compile_pass(SwsGraph *graph, SwsOpList **pops, int flags,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = compile(graph, ops, prev, &prev);
|
||||
ret = compile(graph, backend, ops, prev, &prev);
|
||||
if (ret < 0) {
|
||||
ff_sws_op_list_free(&rest);
|
||||
goto out;
|
||||
|
||||
@@ -162,11 +162,14 @@ int ff_sws_ops_compile(SwsContext *ctx, const SwsOpBackend *backend,
|
||||
* Resolves an operation list to a graph pass. The first and last operations
|
||||
* must be a read/write respectively. `flags` is a list of SwsOpCompileFlags.
|
||||
*
|
||||
* @param backend Force the use of a specific backend (Optional)
|
||||
*
|
||||
* Takes over ownership of `ops` and sets it to NULL, even on failure.
|
||||
*
|
||||
* Note: `ops` may be modified by this function.
|
||||
*/
|
||||
int ff_sws_compile_pass(SwsGraph *graph, SwsOpList **ops, int flags,
|
||||
SwsPass *input, SwsPass **output);
|
||||
int ff_sws_compile_pass(SwsGraph *graph, const SwsOpBackend *backend,
|
||||
SwsOpList **ops, int flags, SwsPass *input,
|
||||
SwsPass **output);
|
||||
|
||||
#endif /* SWSCALE_OPS_DISPATCH_H */
|
||||
|
||||
Reference in New Issue
Block a user