History

swscale/swscale: don't reject scaling when color parameters are not supported but conversion is not required

Values in csp, prim, trc, etc, are irrelevant if there's no conversion needed.

James Almer committed 1 year ago

Commit e20ee9f1 parent abdc2072 files · +12 −6Browse files

Unified · Split

2 files
  1. libswscale/swscale.c +1 −1
  2. libswscale/utils.h +11 −5
libswscale/swscale.c+1−1
@@ -1452,7 +1452,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 1451 unmodified lines
1452 1452
1453 src_ok = ff_test_fmt(&src_fmt, 0);1453 src_ok = ff_test_fmt(&src_fmt, 0);
1454 dst_ok = ff_test_fmt(&dst_fmt, 1);1454 dst_ok = ff_test_fmt(&dst_fmt, 1);
1455 if ((!src_ok || !dst_ok)) {1455 if ((!src_ok || !dst_ok) && !ff_props_equal(&src_fmt, &dst_fmt)) {
1456 err_msg = src_ok ? "Unsupported output" : "Unsupported input";1456 err_msg = src_ok ? "Unsupported output" : "Unsupported input";
1457 ret = AVERROR(ENOTSUP);1457 ret = AVERROR(ENOTSUP);
1458 goto fail;1458 goto fail;
libswscale/utils.h+11−5
@@ -98,12 +98,10 @@ static inline int ff_color_equal(const SwsColor *c1, const SwsColor *c2) · 97 unmodified lines
98 ff_prim_equal(&c1->gamut, &c2->gamut);98 ff_prim_equal(&c1->gamut, &c2->gamut);
99}99}
100 100
101/* Tests only the static components of a colorspace, ignoring per-frame data */101/* Tests only the static components of a colorspace, ignoring dimensions and per-frame data */
102static inline int ff_fmt_equal(const SwsFormat *fmt1, const SwsFormat *fmt2)102static inline int ff_props_equal(const SwsFormat *fmt1, const SwsFormat *fmt2)
103{103{
104 return fmt1->width == fmt2->width &&104 return fmt1->interlaced == fmt2->interlaced &&
105 fmt1->height == fmt2->height &&
106 fmt1->interlaced == fmt2->interlaced &&
107 fmt1->format == fmt2->format &&105 fmt1->format == fmt2->format &&
108 fmt1->range == fmt2->range &&106 fmt1->range == fmt2->range &&
109 fmt1->csp == fmt2->csp &&107 fmt1->csp == fmt2->csp &&
@@ -111,6 +109,14 @@ static inline int ff_fmt_equal(const SwsFormat *fmt1, const SwsFormat *fmt2) · 1 unmodified line
111 ff_color_equal(&fmt1->color, &fmt2->color);109 ff_color_equal(&fmt1->color, &fmt2->color);
112}110}
113 111
112/* Tests only the static components of a colorspace, ignoring per-frame data */
113static inline int ff_fmt_equal(const SwsFormat *fmt1, const SwsFormat *fmt2)
114{
115 return fmt1->width == fmt2->width &&
116 fmt1->height == fmt2->height &&
117 ff_props_equal(fmt1, fmt2);
118}
119
114static inline int ff_fmt_align(enum AVPixelFormat fmt)120static inline int ff_fmt_align(enum AVPixelFormat fmt)
115{121{
116 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);122 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);

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