@@ -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
@@ -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);
+}