swscale/graph: only prefer unstable backends with SWS_UNSTABLE
If the user passes `-backends all` but without `-flags unstable`, then the default/legacy backend will be picked unless it doesn't support a given pixel format. This allows gradually opting into the new code to handle more pixel formats than what the legacy backend currently supports, without disturbing the predictable output/behavior. Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
+11
-2
@@ -658,11 +658,20 @@ static int add_convert_pass(SwsGraph *graph, const SwsFormat *src,
|
||||
const SwsFormat *dst, SwsPass *input,
|
||||
SwsPass **output)
|
||||
{
|
||||
SwsContext *ctx = graph->ctx;
|
||||
int ret;
|
||||
|
||||
ret = add_ops_convert_pass(graph, src, dst, input, output);
|
||||
if (ret == AVERROR(ENOTSUP))
|
||||
if (ctx->flags & SWS_UNSTABLE) {
|
||||
/* Prefer unstable ops backend over legacy backend */
|
||||
ret = add_ops_convert_pass(graph, src, dst, input, output);
|
||||
if (ret == AVERROR(ENOTSUP))
|
||||
ret = add_legacy_sws_pass(graph, src, dst, input, output);
|
||||
} else {
|
||||
/* Prefer legacy backend for stability reasons */
|
||||
ret = add_legacy_sws_pass(graph, src, dst, input, output);
|
||||
if (ret == AVERROR(ENOTSUP))
|
||||
ret = add_ops_convert_pass(graph, src, dst, input, output);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -180,9 +180,9 @@ typedef enum SwsFlags {
|
||||
SWS_BITEXACT = 1 << 19,
|
||||
|
||||
/**
|
||||
* Allow using experimental new code paths. This may be faster, slower,
|
||||
* or produce different output, with semantics subject to change at any
|
||||
* point in time. For testing and debugging purposes only.
|
||||
* Allow/prefer using experimental new code paths. This may be faster,
|
||||
* slower, or produce different output, with semantics subject to change
|
||||
* at any point in time. For testing and debugging purposes only.
|
||||
*/
|
||||
SWS_UNSTABLE = 1 << 20,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user