History

swscale: add sws_is_noop()

Exactly what it says on the tin.

Niklas Haas committed 2 years ago

Commit b03c7581 parent 5e50a564 files · +24 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libswscale/swscale.h +6 −0
  3. libswscale/utils.c +14 −0
  4. libswscale/version.h +1 −1
doc/APIchanges+3−0
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line
22
33 API changes, most recent first:
44
5+2024-10-23 - xxxxxxxxxx - lsws 8.9.100 - swscale.h
6+ Add sws_is_noop().
7+
58 2024-10-23 - xxxxxxxxxx - lsws 8.8.100 - swscale.h
69 Add frame property testing API:
710 - sws_test_format()
libswscale/swscale.h+6−0
@@ -140,6 +140,12 @@ int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output); · 139 unmodified lines
140140 */
141141 int sws_test_frame(const AVFrame *frame, int output);
142142
143+/**
144+ * Check if a given conversion is a noop. Returns a positive integer if
145+ * no operation needs to be performed, 0 otherwise.
146+ */
147+int sws_is_noop(const AVFrame *dst, const AVFrame *src);
148+
143149 /* values for the flags, the stuff on the command line is different */
144150 #define SWS_FAST_BILINEAR 1
145151 #define SWS_BILINEAR 2
libswscale/utils.c+14−0
@@ -2777,3 +2777,17 @@ int sws_test_frame(const AVFrame *frame, int output) · 2776 unmodified lines
27772777
27782778 return 1;
27792779 }
2780+
2781+int sws_is_noop(const AVFrame *dst, const AVFrame *src)
2782+{
2783+ for (int field = 0; field < 2; field++) {
2784+ SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
2785+ SwsFormat src_fmt = ff_fmt_from_frame(src, field);
2786+ if (!ff_fmt_equal(&dst_fmt, &src_fmt))
2787+ return 0;
2788+ if (!dst_fmt.interlaced)
2789+ break;
2790+ }
2791+
2792+ return 1;
2793+}
libswscale/version.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828
2929 #include "version_major.h"
3030
31−#define LIBSWSCALE_VERSION_MINOR 8
31+#define LIBSWSCALE_VERSION_MINOR 9
3232 #define LIBSWSCALE_VERSION_MICRO 100
3333
3434 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t