swscale: add sws_is_noop()

Exactly what it says on the tin.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
master
Niklas Haas 1 month ago
parent 5e50a56b9c
commit b03c758600
  1. 3
      doc/APIchanges
  2. 6
      libswscale/swscale.h
  3. 14
      libswscale/utils.c
  4. 2
      libswscale/version.h

@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
2024-10-23 - xxxxxxxxxx - lsws 8.9.100 - swscale.h
Add sws_is_noop().
2024-10-23 - xxxxxxxxxx - lsws 8.8.100 - swscale.h
Add frame property testing API:
- sws_test_format()

@ -140,6 +140,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

@ -2777,3 +2777,17 @@ int sws_test_frame(const AVFrame *frame, int output)
return 1;
}
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
{
for (int field = 0; field < 2; field++) {
SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
SwsFormat src_fmt = ff_fmt_from_frame(src, field);
if (!ff_fmt_equal(&dst_fmt, &src_fmt))
return 0;
if (!dst_fmt.interlaced)
break;
}
return 1;
}

@ -28,7 +28,7 @@
#include "version_major.h"
#define LIBSWSCALE_VERSION_MINOR 8
#define LIBSWSCALE_VERSION_MINOR 9
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \

Loading…
Cancel
Save