From: Niklas Haas <g...@haasn.dev> Exactly what it says on the tin.
Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <g...@haasn.dev> --- libswscale/swscale.h | 6 ++++++ libswscale/utils.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/libswscale/swscale.h b/libswscale/swscale.h index f36efa4183..d7ea9bd714 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -139,6 +139,12 @@ int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output); */ int sws_test_frame(const AVFrame *frame, int output); +/** + * Check if a given conversion is a noop. Returns a positive integer if + * no operation needs to be performed, 0 otherwise. + */ +int sws_is_noop(const AVFrame *dst, const AVFrame *src); + /* values for the flags, the stuff on the command line is different */ #define SWS_FAST_BILINEAR 1 #define SWS_BILINEAR 2 diff --git a/libswscale/utils.c b/libswscale/utils.c index 22411d3429..01fe474020 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -2758,3 +2758,10 @@ int sws_test_frame(const AVFrame *frame, int output) const SwsFormat fmt = ff_fmt_from_frame(frame); return ff_test_fmt(&fmt, output); } + +int sws_is_noop(const AVFrame *dst, const AVFrame *src) +{ + SwsFormat dst_fmt = ff_fmt_from_frame(dst); + SwsFormat src_fmt = ff_fmt_from_frame(src); + return ff_fmt_equal(&dst_fmt, &src_fmt); +} -- 2.46.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".