History

swscale/internal: group user-facing options together

This is a preliminary step to separating these into a new struct. This commit contains no functional changes, it is a pure search-and-replace.

Niklas Haas committed 2 years ago

Commit 2d077f91 parent 10d1be236 files · +692 −680Browse files

Unified · Split

36 files
  1. libswscale/aarch64/swscale.c +14 −14
  2. libswscale/aarch64/swscale_unscaled.c +18 −16
  3. libswscale/alphablend.c +8 −8
  4. libswscale/arm/swscale_unscaled.c +12 −12
  5. libswscale/input.c +1 −1
  6. libswscale/loongarch/input_lasx.c +1 −1
  7. libswscale/loongarch/input_lsx.c +1 −1
  8. libswscale/loongarch/output_lasx.c +5 −5
  9. libswscale/loongarch/output_lsx.c +5 −5
  10. libswscale/loongarch/swscale_init_loongarch.c +14 −14
  11. libswscale/loongarch/swscale_lasx.c +4 −4
  12. libswscale/loongarch/swscale_lsx.c +4 −4
  13. libswscale/loongarch/yuv2rgb_lasx.c +4 −4
  14. libswscale/loongarch/yuv2rgb_lsx.c +6 −6
  15. libswscale/options.c +16 −16
  16. libswscale/output.c +12 −12
  17. libswscale/ppc/swscale_altivec.c +3 −3
  18. libswscale/ppc/swscale_vsx.c +9 −9
  19. libswscale/ppc/yuv2rgb_altivec.c +9 −9
  20. libswscale/ppc/yuv2yuv_altivec.c +7 −7
  21. libswscale/riscv/swscale.c +2 −2
  22. libswscale/slice.c +11 −11
  23. libswscale/swscale.c +81 −81
  24. libswscale/swscale_internal.h +26 −25
  25. libswscale/swscale_unscaled.c +154 −154
  26. libswscale/utils.c +142 −133
  27. libswscale/vscale.c +5 −5
  28. libswscale/x86/output.asm +1 −1
  29. libswscale/x86/swscale.c +30 −30
  30. libswscale/x86/swscale_template.c +10 −10
  31. libswscale/x86/yuv2rgb.c +7 −7
  32. libswscale/yuv2rgb.c +40 −40
  33. tests/checkasm/sw_gbrp.c +8 −8
  34. tests/checkasm/sw_range_convert.c +8 −8
  35. tests/checkasm/sw_rgb.c +5 −5
  36. tests/checkasm/sw_scale.c +9 −9
libswscale/aarch64/swscale.c+14−14
@@ -45,11 +45,11 @@ static void ff_hscale16to15_4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 44 unmodified lines
4545 const uint8_t *_src, const int16_t *filter,
4646 const int32_t *filterPos, int filterSize)
4747 {
48− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
48+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
4949 int sh = desc->comp[0].depth - 1;
5050
5151 if (sh<15) {
52− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
52+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
5353 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
5454 sh = 16 - 1;
5555 }
@@ -61,11 +61,11 @@ static void ff_hscale16to15_X8_neon(SwsInternal *c, int16_t *_dst, int dstW, · 5 unmodified lines
6161 const uint8_t *_src, const int16_t *filter,
6262 const int32_t *filterPos, int filterSize)
6363 {
64− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
64+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
6565 int sh = desc->comp[0].depth - 1;
6666
6767 if (sh<15) {
68− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
68+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
6969 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
7070 sh = 16 - 1;
7171 }
@@ -77,11 +77,11 @@ static void ff_hscale16to15_X4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 5 unmodified lines
7777 const uint8_t *_src, const int16_t *filter,
7878 const int32_t *filterPos, int filterSize)
7979 {
80− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
80+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
8181 int sh = desc->comp[0].depth - 1;
8282
8383 if (sh<15) {
84− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
84+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
8585 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
8686 sh = 16 - 1;
8787 }
@@ -92,11 +92,11 @@ static void ff_hscale16to19_4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 4 unmodified lines
9292 const uint8_t *_src, const int16_t *filter,
9393 const int32_t *filterPos, int filterSize)
9494 {
95− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
95+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
9696 int bits = desc->comp[0].depth - 1;
9797 int sh = bits - 4;
9898
99− if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
99+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
100100 sh = 9;
101101 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
102102 sh = 16 - 1 - 4;
@@ -110,11 +110,11 @@ static void ff_hscale16to19_X8_neon(SwsInternal *c, int16_t *_dst, int dstW, · 7 unmodified lines
110110 const uint8_t *_src, const int16_t *filter,
111111 const int32_t *filterPos, int filterSize)
112112 {
113− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
113+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
114114 int bits = desc->comp[0].depth - 1;
115115 int sh = bits - 4;
116116
117− if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
117+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
118118 sh = 9;
119119 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
120120 sh = 16 - 1 - 4;
@@ -128,11 +128,11 @@ static void ff_hscale16to19_X4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 7 unmodified lines
128128 const uint8_t *_src, const int16_t *filter,
129129 const int32_t *filterPos, int filterSize)
130130 {
131− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
131+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
132132 int bits = desc->comp[0].depth - 1;
133133 int sh = bits - 4;
134134
135− if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
135+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
136136 sh = 9;
137137 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
138138 sh = 16 - 1 - 4;
@@ -229,7 +229,7 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c) · 90 unmodified lines
229229
230230 if (have_neon(cpu_flags)) {
231231 if (c->dstBpc <= 14) {
232− if (c->srcRange) {
232+ if (c->opts.src_range) {
233233 c->lumConvertRange = ff_lumRangeFromJpeg_neon;
234234 c->chrConvertRange = ff_chrRangeFromJpeg_neon;
235235 } else {
@@ -251,7 +251,7 @@ av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c) · 15 unmodified lines
251251 if (c->dstBpc == 8) {
252252 c->yuv2planeX = ff_yuv2planeX_8_neon;
253253 }
254− switch (c->srcFormat) {
254+ switch (c->opts.src_format) {
255255 case AV_PIX_FMT_ABGR:
256256 c->lumToYV12 = ff_abgr32ToY_neon;
257257 if (c->chrSrcHSubSample)
libswscale/aarch64/swscale_unscaled.c+18−16
@@ -43,7 +43,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 42 unmodified lines
4343 const int dstStride[]) { \
4444 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
4545 \
46− return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
46+ return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
4747 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
4848 src[0], srcStride[0], \
4949 src[1], srcStride[1], \
@@ -71,7 +71,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 21 unmodified lines
7171 const int dstStride[]) { \
7272 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
7373 \
74− return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
74+ return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
7575 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
7676 src[0], srcStride[0], \
7777 src[1], srcStride[1], \
@@ -108,7 +108,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 30 unmodified lines
108108 const int dstStride[]) { \
109109 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
110110 \
111− return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
111+ return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
112112 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
113113 src[0], srcStride[0], src[1], srcStride[1], \
114114 yuv2rgb_table, \
@@ -133,7 +133,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 18 unmodified lines
133133 const int dstStride[]) { \
134134 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
135135 \
136− return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
136+ return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
137137 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
138138 src[0], srcStride[0], src[1], srcStride[1], \
139139 yuv2rgb_table, \
@@ -155,15 +155,17 @@ static int nv24_to_yuv420p_neon_wrapper(SwsInternal *c, const uint8_t *const src · 15 unmodified lines
155155 uint8_t *dst1 = dst[1] + dstStride[1] * srcSliceY / 2;
156156 uint8_t *dst2 = dst[2] + dstStride[2] * srcSliceY / 2;
157157
158− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
158+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
159159 dst[0], dstStride[0]);
160160
161− if (c->srcFormat == AV_PIX_FMT_NV24)
161+ if (c->opts.src_format == AV_PIX_FMT_NV24)
162162 ff_nv24_to_yuv420p_chroma_neon(dst1, dstStride[1], dst2, dstStride[2],
163− src[1], srcStride[1], c->srcW / 2, srcSliceH);
163+ src[1], srcStride[1], c->opts.src_w / 2,
164+ srcSliceH);
164165 else
165166 ff_nv24_to_yuv420p_chroma_neon(dst2, dstStride[2], dst1, dstStride[1],
166− src[1], srcStride[1], c->srcW / 2, srcSliceH);
167+ src[1], srcStride[1], c->opts.src_w / 2,
168+ srcSliceH);
167169
168170 return srcSliceH;
169171 }
@@ -183,10 +185,10 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 13 unmodified lines
183185 * assembly might be writing as much as 4*15=60 extra bytes at the end of the
184186 * line, which won't fit the 32-bytes buffer alignment. */
185187 #define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \
186− if (c->srcFormat == AV_PIX_FMT_##IFMT \
187− && c->dstFormat == AV_PIX_FMT_##OFMT \
188− && !(c->srcH & 1) \
189− && !(c->srcW & 15) \
188+ if (c->opts.src_format == AV_PIX_FMT_##IFMT \
189+ && c->opts.dst_format == AV_PIX_FMT_##OFMT \
190+ && !(c->opts.src_h & 1) \
191+ && !(c->opts.src_w & 15) \
190192 && !accurate_rnd) \
191193 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \
192194 } while (0)
@@ -200,16 +202,16 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 7 unmodified lines
200202 } while (0)
201203
202204 static void get_unscaled_swscale_neon(SwsInternal *c) {
203− int accurate_rnd = c->flags & SWS_ACCURATE_RND;
205+ int accurate_rnd = c->opts.flags & SWS_ACCURATE_RND;
204206
205207 SET_FF_NVX_TO_ALL_RGBX_FUNC(nv12, NV12, accurate_rnd);
206208 SET_FF_NVX_TO_ALL_RGBX_FUNC(nv21, NV21, accurate_rnd);
207209 SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv420p, YUV420P, accurate_rnd);
208210 SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv422p, YUV422P, accurate_rnd);
209211
210− if (c->dstFormat == AV_PIX_FMT_YUV420P &&
211− (c->srcFormat == AV_PIX_FMT_NV24 || c->srcFormat == AV_PIX_FMT_NV42) &&
212− !(c->srcH & 1) && !(c->srcW & 15) && !accurate_rnd)
212+ if (c->opts.dst_format == AV_PIX_FMT_YUV420P &&
213+ (c->opts.src_format == AV_PIX_FMT_NV24 || c->opts.src_format == AV_PIX_FMT_NV42) &&
214+ !(c->opts.src_h & 1) && !(c->opts.src_w & 15) && !accurate_rnd)
213215 c->convert_unscaled = nv24_to_yuv420p_neon_wrapper;
214216 }
215217
libswscale/alphablend.c+8−8
@@ -24,10 +24,10 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 23 unmodified lines
2424 const int srcStride[], int srcSliceY, int srcSliceH,
2525 uint8_t *const dst[], const int dstStride[])
2626 {
27− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
27+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
2828 int nb_components = desc->nb_components;
2929 int plane, x, ysrc;
30− int plane_count = isGray(c->srcFormat) ? 1 : 3;
30+ int plane_count = isGray(c->opts.src_format) ? 1 : 3;
3131 int sixteen_bits = desc->comp[0].depth >= 9;
3232 unsigned off = 1<<(desc->comp[0].depth - 1);
3333 unsigned shift = desc->comp[0].depth;
@@ -36,7 +36,7 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 2 unmodified lines
3636
3737 for (plane = 0; plane < plane_count; plane++) {
3838 int a = 0, b = 0;
39− if (c->alphablend == SWS_ALPHA_BLEND_CHECKERBOARD) {
39+ if (c->opts.alpha_blend == SWS_ALPHA_BLEND_CHECKERBOARD) {
4040 a = (1<<(desc->comp[0].depth - 1))/2;
4141 b = 3*(1<<(desc->comp[0].depth-1))/2;
4242 }
@@ -47,7 +47,7 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 4 unmodified lines
4747 av_assert0(plane_count == nb_components - 1);
4848 if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) {
4949 for (plane = 0; plane < plane_count; plane++) {
50− int w = plane ? c->chrSrcW : c->srcW;
50+ int w = plane ? c->chrSrcW : c->opts.src_w;
5151 int x_subsample = plane ? desc->log2_chroma_w: 0;
5252 int y_subsample = plane ? desc->log2_chroma_h: 0;
5353 for (ysrc = 0; ysrc < AV_CEIL_RSHIFT(srcSliceH, y_subsample); ysrc++) {
@@ -60,7 +60,7 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 6 unmodified lines
6060 const uint16_t *s = (const uint16_t *)(src[plane ] + srcStride[plane ] * ysrc);
6161 const uint16_t *a = (const uint16_t *)(src[plane_count] + (srcStride[plane_count] * ysrc << y_subsample));
6262 uint16_t *d = ( uint16_t *)(dst[plane ] + dstStride[plane ] * y);
63− if ((!isBE(c->srcFormat)) == !HAVE_BIGENDIAN) {
63+ if ((!isBE(c->opts.src_format)) == !HAVE_BIGENDIAN) {
6464 for (x = 0; x < w; x++) {
6565 if (y_subsample) {
6666 alpha = (a[2*x] + a[2*x + 1] + 2 +
@@ -101,7 +101,7 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 34 unmodified lines
101101 const uint16_t *s = (const uint16_t *)(src[plane ] + srcStride[plane ] * ysrc);
102102 const uint16_t *a = (const uint16_t *)(src[plane_count] + srcStride[plane_count] * ysrc);
103103 uint16_t *d = ( uint16_t *)(dst[plane ] + dstStride[plane ] * y);
104− if ((!isBE(c->srcFormat)) == !HAVE_BIGENDIAN) {
104+ if ((!isBE(c->opts.src_format)) == !HAVE_BIGENDIAN) {
105105 for (x = 0; x < w; x++) {
106106 unsigned u = s[x]*a[x] + target_table[((x^y)>>5)&1][plane]*(max-a[x]) + off;
107107 d[x] = av_clip((u + (u >> shift)) >> shift, 0, max);
@@ -127,14 +127,14 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 19 unmodified lines
127127 }
128128 } else {
129129 int alpha_pos = desc->comp[plane_count].offset;
130− int w = c->srcW;
130+ int w = c->opts.src_w;
131131 for (ysrc = 0; ysrc < srcSliceH; ysrc++) {
132132 int y = ysrc + srcSliceY;
133133 if (sixteen_bits) {
134134 const uint16_t *s = (const uint16_t *)(src[0] + srcStride[0] * ysrc + 2*!alpha_pos);
135135 const uint16_t *a = (const uint16_t *)(src[0] + srcStride[0] * ysrc + alpha_pos);
136136 uint16_t *d = ( uint16_t *)(dst[0] + dstStride[0] * y);
137− if ((!isBE(c->srcFormat)) == !HAVE_BIGENDIAN) {
137+ if ((!isBE(c->opts.src_format)) == !HAVE_BIGENDIAN) {
138138 for (x = 0; x < w; x++) {
139139 for (plane = 0; plane < plane_count; plane++) {
140140 int x_index = (plane_count + 1) * x;
libswscale/arm/swscale_unscaled.c+12−12
@@ -41,7 +41,7 @@ static int rgbx_to_nv12_neon_32_wrapper(SwsInternal *context, const uint8_t *con · 40 unmodified lines
4141 rgbx_to_nv12_neon_32(src[0] + srcSliceY * srcStride[0],
4242 dst[0] + srcSliceY * dstStride[0],
4343 dst[1] + (srcSliceY / 2) * dstStride[1],
44− context->srcW, srcSliceH,
44+ context->opts.src_w, srcSliceH,
4545 dstStride[0], dstStride[1], srcStride[0],
4646 context->input_rgb2yuv_table);
4747
@@ -55,7 +55,7 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsInternal *context, const uint8_t *con · 7 unmodified lines
5555 rgbx_to_nv12_neon_16(src[0] + srcSliceY * srcStride[0],
5656 dst[0] + srcSliceY * dstStride[0],
5757 dst[1] + (srcSliceY / 2) * dstStride[1],
58− context->srcW, srcSliceH,
58+ context->opts.src_w, srcSliceH,
5959 dstStride[0], dstStride[1], srcStride[0],
6060 context->input_rgb2yuv_table);
6161
@@ -84,7 +84,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 22 unmodified lines
8484 const int dstStride[]) { \
8585 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
8686 \
87− ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
87+ ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
8888 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
8989 src[0], srcStride[0], \
9090 src[1], srcStride[1], \
@@ -120,7 +120,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 29 unmodified lines
120120 const int dstStride[]) { \
121121 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
122122 \
123− ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
123+ ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
124124 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
125125 src[0], srcStride[0], src[1], srcStride[1], \
126126 yuv2rgb_table, \
@@ -144,10 +144,10 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 17 unmodified lines
144144 * assembly might be writing as much as 4*15=60 extra bytes at the end of the
145145 * line, which won't fit the 32-bytes buffer alignment. */
146146 #define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \
147− if (c->srcFormat == AV_PIX_FMT_##IFMT \
148− && c->dstFormat == AV_PIX_FMT_##OFMT \
149− && !(c->srcH & 1) \
150− && !(c->srcW & 15) \
147+ if (c->opts.src_format == AV_PIX_FMT_##IFMT \
148+ && c->opts.dst_format == AV_PIX_FMT_##OFMT \
149+ && !(c->opts.src_h & 1) \
150+ && !(c->opts.src_w & 15) \
151151 && !accurate_rnd) { \
152152 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \
153153 } \
@@ -161,10 +161,10 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 7 unmodified lines
161161 } while (0)
162162
163163 static void get_unscaled_swscale_neon(SwsInternal *c) {
164− int accurate_rnd = c->flags & SWS_ACCURATE_RND;
165− if (c->srcFormat == AV_PIX_FMT_RGBA
166− && c->dstFormat == AV_PIX_FMT_NV12
167− && (c->srcW >= 16)) {
164+ int accurate_rnd = c->opts.flags & SWS_ACCURATE_RND;
165+ if (c->opts.src_format == AV_PIX_FMT_RGBA
166+ && c->opts.dst_format == AV_PIX_FMT_NV12
167+ && (c->opts.src_w >= 16)) {
168168 c->convert_unscaled = accurate_rnd ? rgbx_to_nv12_neon_32_wrapper
169169 : rgbx_to_nv12_neon_16_wrapper;
170170 }
libswscale/input.c+1−1
@@ -1563,7 +1563,7 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c, · 1562 unmodified lines
15631563 planarX_YV12_fn *readAlpPlanar,
15641564 planarX2_YV12_fn *readChrPlanar)
15651565 {
1566− enum AVPixelFormat srcFormat = c->srcFormat;
1566+ enum AVPixelFormat srcFormat = c->opts.src_format;
15671567
15681568 *chrToYV12 = NULL;
15691569 switch (srcFormat) {
libswscale/loongarch/input_lasx.c+1−1
@@ -203,7 +203,7 @@ void planar_rgb_to_y_lasx(uint8_t *_dst, const uint8_t *src[4], int width, · 202 unmodified lines
203203
204204 av_cold void ff_sws_init_input_lasx(SwsInternal *c)
205205 {
206− enum AVPixelFormat srcFormat = c->srcFormat;
206+ enum AVPixelFormat srcFormat = c->opts.src_format;
207207
208208 switch (srcFormat) {
209209 case AV_PIX_FMT_YUYV422:
libswscale/loongarch/input_lsx.c+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323
2424 av_cold void ff_sws_init_input_lsx(SwsInternal *c)
2525 {
26− enum AVPixelFormat srcFormat = c->srcFormat;
26+ enum AVPixelFormat srcFormat = c->opts.src_format;
2727
2828 switch (srcFormat) {
2929 case AV_PIX_FMT_YUYV422:
libswscale/loongarch/output_lasx.c+5−5
@@ -888,7 +888,7 @@ static av_always_inline void yuv2rgb_write_full(SwsInternal *c, · 887 unmodified lines
888888 {
889889 int r,g,b;
890890
891− switch (c->dither) {
891+ switch (c->opts.dither) {
892892 default:
893893 case SWS_DITHER_AUTO:
894894 case SWS_DITHER_ED:
@@ -1784,7 +1784,7 @@ av_cold void ff_sws_init_output_lasx(SwsInternal *c, · 889 unmodified lines
17841784 yuv2packedX_fn *yuv2packedX,
17851785 yuv2anyX_fn *yuv2anyX)
17861786 {
1787− enum AVPixelFormat dstFormat = c->dstFormat;
1787+ enum AVPixelFormat dstFormat = c->opts.dst_format;
17881788
17891789 /* Add initialization once optimized */
17901790 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
@@ -1797,8 +1797,8 @@ av_cold void ff_sws_init_output_lasx(SwsInternal *c, · 6 unmodified lines
17971797 *yuv2planeX = yuv2planeX_8_lasx;
17981798 }
17991799
1800− if(c->flags & SWS_FULL_CHR_H_INT) {
1801− switch (c->dstFormat) {
1800+ if(c->opts.flags & SWS_FULL_CHR_H_INT) {
1801+ switch (c->opts.dst_format) {
18021802 case AV_PIX_FMT_RGBA:
18031803 #if CONFIG_SMALL
18041804 c->yuv2packedX = yuv2rgba32_full_X_lasx;
@@ -1911,7 +1911,7 @@ av_cold void ff_sws_init_output_lasx(SwsInternal *c, · 106 unmodified lines
19111911 break;
19121912 }
19131913 } else {
1914− switch (c->dstFormat) {
1914+ switch (c->opts.dst_format) {
19151915 case AV_PIX_FMT_RGB32:
19161916 case AV_PIX_FMT_BGR32:
19171917 #if CONFIG_SMALL
libswscale/loongarch/output_lsx.c+5−5
@@ -838,7 +838,7 @@ static av_always_inline void yuv2rgb_write_full(SwsInternal *c, · 837 unmodified lines
838838 {
839839 int r,g,b;
840840
841− switch (c->dither) {
841+ switch (c->opts.dither) {
842842 default:
843843 case SWS_DITHER_AUTO:
844844 case SWS_DITHER_ED:
@@ -1633,7 +1633,7 @@ av_cold void ff_sws_init_output_lsx(SwsInternal *c, · 788 unmodified lines
16331633 yuv2packedX_fn *yuv2packedX,
16341634 yuv2anyX_fn *yuv2anyX)
16351635 {
1636− enum AVPixelFormat dstFormat = c->dstFormat;
1636+ enum AVPixelFormat dstFormat = c->opts.dst_format;
16371637
16381638 /* Add initialization once optimized */
16391639 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
@@ -1646,8 +1646,8 @@ av_cold void ff_sws_init_output_lsx(SwsInternal *c, · 6 unmodified lines
16461646 *yuv2planeX = yuv2planeX_8_lsx;
16471647 }
16481648
1649− if(c->flags & SWS_FULL_CHR_H_INT) {
1650− switch (c->dstFormat) {
1649+ if(c->opts.flags & SWS_FULL_CHR_H_INT) {
1650+ switch (c->opts.dst_format) {
16511651 case AV_PIX_FMT_RGBA:
16521652 #if CONFIG_SMALL
16531653 c->yuv2packedX = yuv2rgba32_full_X_lsx;
@@ -1760,7 +1760,7 @@ av_cold void ff_sws_init_output_lsx(SwsInternal *c, · 106 unmodified lines
17601760 break;
17611761 }
17621762 } else {
1763− switch (c->dstFormat) {
1763+ switch (c->opts.dst_format) {
17641764 case AV_PIX_FMT_RGB32:
17651765 case AV_PIX_FMT_BGR32:
17661766 #if CONFIG_SMALL
libswscale/loongarch/swscale_init_loongarch.c+14−14
@@ -30,7 +30,7 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c) · 29 unmodified lines
3030
3131 if (have_lsx(cpu_flags)) {
3232 if (c->dstBpc <= 14) {
33− if (c->srcRange) {
33+ if (c->opts.src_range) {
3434 c->lumConvertRange = lumRangeFromJpeg_lsx;
3535 c->chrConvertRange = chrRangeFromJpeg_lsx;
3636 } else {
@@ -42,7 +42,7 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c) · 5 unmodified lines
4242 #if HAVE_LASX
4343 if (have_lasx(cpu_flags)) {
4444 if (c->dstBpc <= 14) {
45− if (c->srcRange) {
45+ if (c->opts,src_range) {
4646 c->lumConvertRange = lumRangeFromJpeg_lasx;
4747 c->chrConvertRange = chrRangeFromJpeg_lasx;
4848 } else {
@@ -107,29 +107,29 @@ av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c) · 58 unmodified lines
107107 int cpu_flags = av_get_cpu_flags();
108108 #if HAVE_LASX
109109 if (have_lasx(cpu_flags)) {
110− if (c->srcFormat == AV_PIX_FMT_YUV420P) {
111− switch (c->dstFormat) {
110+ if (c->opts.src_format == AV_PIX_FMT_YUV420P) {
111+ switch (c->opts.dst_format) {
112112 case AV_PIX_FMT_RGB24:
113113 return yuv420_rgb24_lasx;
114114 case AV_PIX_FMT_BGR24:
115115 return yuv420_bgr24_lasx;
116116 case AV_PIX_FMT_RGBA:
117− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
117+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
118118 break;
119119 } else
120120 return yuv420_rgba32_lasx;
121121 case AV_PIX_FMT_ARGB:
122− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
122+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
123123 break;
124124 } else
125125 return yuv420_argb32_lasx;
126126 case AV_PIX_FMT_BGRA:
127− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
127+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
128128 break;
129129 } else
130130 return yuv420_bgra32_lasx;
131131 case AV_PIX_FMT_ABGR:
132− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
132+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
133133 break;
134134 } else
135135 return yuv420_abgr32_lasx;
@@ -138,29 +138,29 @@ av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c) · 2 unmodified lines
138138 }
139139 #endif // #if HAVE_LASX
140140 if (have_lsx(cpu_flags)) {
141− if (c->srcFormat == AV_PIX_FMT_YUV420P) {
142− switch (c->dstFormat) {
141+ if (c->opts.src_format == AV_PIX_FMT_YUV420P) {
142+ switch (c->opts.dst_format) {
143143 case AV_PIX_FMT_RGB24:
144144 return yuv420_rgb24_lsx;
145145 case AV_PIX_FMT_BGR24:
146146 return yuv420_bgr24_lsx;
147147 case AV_PIX_FMT_RGBA:
148− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
148+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
149149 break;
150150 } else
151151 return yuv420_rgba32_lsx;
152152 case AV_PIX_FMT_ARGB:
153− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
153+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
154154 break;
155155 } else
156156 return yuv420_argb32_lsx;
157157 case AV_PIX_FMT_BGRA:
158− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
158+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
159159 break;
160160 } else
161161 return yuv420_bgra32_lsx;
162162 case AV_PIX_FMT_ABGR:
163− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {
163+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
164164 break;
165165 } else
166166 return yuv420_abgr32_lsx;
libswscale/loongarch/swscale_lasx.c+4−4
@@ -677,7 +677,7 @@ void ff_hscale_16_to_15_lasx(SwsInternal *c, int16_t *dst, int dstW, · 676 unmodified lines
677677 const uint8_t *_src, const int16_t *filter,
678678 const int32_t *filterPos, int filterSize)
679679 {
680− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
680+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
681681 int i;
682682 const uint16_t *src = (const uint16_t *) _src;
683683 int sh = desc->comp[0].depth - 1;
@@ -688,7 +688,7 @@ void ff_hscale_16_to_15_lasx(SwsInternal *c, int16_t *dst, int dstW, · 4 unmodified lines
688688 __m256i zero = __lasx_xvldi(0);
689689
690690 if (sh < 15) {
691− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 :
691+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 :
692692 (desc->comp[0].depth - 1);
693693 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {
694694 sh = 15;
@@ -824,7 +824,7 @@ void ff_hscale_16_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, · 129 unmodified lines
824824 const uint8_t *_src, const int16_t *filter,
825825 const int32_t *filterPos, int filterSize)
826826 {
827− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
827+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
828828 int i;
829829 int32_t *dst = (int32_t *) _dst;
830830 const uint16_t *src = (const uint16_t *) _src;
@@ -835,7 +835,7 @@ void ff_hscale_16_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, · 4 unmodified lines
835835 __m256i shift;
836836 __m256i zero = __lasx_xvldi(0);
837837
838− if ((isAnyRGB(c->srcFormat) || c->srcFormat == AV_PIX_FMT_PAL8)
838+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format == AV_PIX_FMT_PAL8)
839839 && desc->comp[0].depth<16) {
840840 sh = 9;
841841 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) {
libswscale/loongarch/swscale_lsx.c+4−4
@@ -27,11 +27,11 @@ void ff_hscale_16_to_15_lsx(SwsInternal *c, int16_t *_dst, int dstW, · 26 unmodified lines
2727 const uint8_t *_src, const int16_t *filter,
2828 const int32_t *filterPos, int filterSize)
2929 {
30− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
30+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
3131 int sh = desc->comp[0].depth - 1;
3232
3333 if (sh < 15) {
34− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 :
34+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 :
3535 (desc->comp[0].depth - 1);
3636 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {
3737 sh = 15;
@@ -43,11 +43,11 @@ void ff_hscale_16_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW, · 5 unmodified lines
4343 const uint8_t *_src, const int16_t *filter,
4444 const int32_t *filterPos, int filterSize)
4545 {
46− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
46+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
4747 int bits = desc->comp[0].depth - 1;
4848 int sh = bits - 4;
4949
50− if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
50+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
5151
5252 sh = 9;
5353 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
libswscale/loongarch/yuv2rgb_lasx.c+4−4
@@ -173,11 +173,11 @@ · 172 unmodified lines
173173 __m256i shuf3 = {0x1E0F0E1C0D0C1A0B, 0x0101010101010101, \
174174 0x1E0F0E1C0D0C1A0B, 0x0101010101010101}; \
175175 YUV2RGB_LOAD_COE \
176− y = (c->dstW + 7) & ~7; \
176+ y = (c->opts.dst_w + 7) & ~7; \
177177 h_size = y >> 4; \
178178 res = y & 15; \
179179 \
180− vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
180+ vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
181181 for (y = 0; y < srcSliceH; y += 2) { \
182182 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\
183183 dst_type *image2 = (dst_type *)(image1 + dstStride[0]);\
@@ -199,11 +199,11 @@ · 15 unmodified lines
199199 __m256i a = __lasx_xvldi(0xFF); \
200200 \
201201 YUV2RGB_LOAD_COE \
202− y = (c->dstW + 7) & ~7; \
202+ y = (c->opts.dst_w + 7) & ~7; \
203203 h_size = y >> 4; \
204204 res = y & 15; \
205205 \
206− vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
206+ vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
207207 for (y = 0; y < srcSliceH; y += 2) { \
208208 int yd = y + srcSliceY; \
209209 dst_type av_unused *r, *g, *b; \
libswscale/loongarch/yuv2rgb_lsx.c+6−6
@@ -128,9 +128,9 @@ · 127 unmodified lines
128128 \
129129 YUV2RGB_LOAD_COE \
130130 \
131− h_size = c->dstW >> 4; \
132− res = (c->dstW & 15) >> 1; \
133− vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
131+ h_size = c->opts.dst_w >> 4; \
132+ res = (c->opts.dst_w & 15) >> 1; \
133+ vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
134134 for (y = 0; y < srcSliceH; y += 2) { \
135135 dst_type av_unused *r, *g, *b; \
136136 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\
@@ -156,9 +156,9 @@ · 19 unmodified lines
156156 \
157157 YUV2RGB_LOAD_COE \
158158 \
159− h_size = c->dstW >> 4; \
160− res = (c->dstW & 15) >> 1; \
161− vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
159+ h_size = c->opts.dst_w >> 4; \
160+ res = (c->opts.dst_w & 15) >> 1; \
161+ vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
162162 for (y = 0; y < srcSliceH; y += 2) { \
163163 int yd = y + srcSliceY; \
164164 dst_type av_unused *r, *g, *b; \
libswscale/options.c+16−16
@@ -27,7 +27,7 @@ static const char *sws_context_to_name(void *ptr) · 26 unmodified lines
2727 return "swscaler";
2828 }
2929
30−#define OFFSET(x) offsetof(SwsInternal, x)
30+#define OFFSET(x) offsetof(SwsInternal, opts.x)
3131 #define DEFAULT 0
3232 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
3333
@@ -51,18 +51,18 @@ static const AVOption swscale_options[] = { · 17 unmodified lines
5151 { "bitexact", "bit-exact mode", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BITEXACT }, .flags = VE, .unit = "sws_flags" },
5252 { "error_diffusion", "error diffusion dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ERROR_DIFFUSION}, .flags = VE, .unit = "sws_flags" },
5353
54− { "param0", "scaler param 0", OFFSET(param[0]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, VE },
55− { "param1", "scaler param 1", OFFSET(param[1]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, VE },
54+ { "param0", "scaler param 0", OFFSET(scaler_params[0]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, VE },
55+ { "param1", "scaler param 1", OFFSET(scaler_params[1]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, VE },
5656
57− { "srcw", "source width", OFFSET(srcW), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
58− { "srch", "source height", OFFSET(srcH), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
59− { "dstw", "destination width", OFFSET(dstW), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
60− { "dsth", "destination height", OFFSET(dstH), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
61− { "src_format", "source format", OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, INT_MAX, VE },
62− { "dst_format", "destination format", OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, INT_MAX, VE },
63− { "src_range", "source is full range", OFFSET(srcRange), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT }, 0, 1, VE },
64− { "dst_range", "destination is full range", OFFSET(dstRange), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT }, 0, 1, VE },
65− { "gamma", "gamma correct scaling", OFFSET(gamma_flag),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
57+ { "srcw", "source width", OFFSET(src_w), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
58+ { "srch", "source height", OFFSET(src_h), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
59+ { "dstw", "destination width", OFFSET(dst_w), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
60+ { "dsth", "destination height", OFFSET(dst_h), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
61+ { "src_format", "source format", OFFSET(src_format), AV_OPT_TYPE_PIXEL_FMT, { .i64 = DEFAULT }, 0, INT_MAX, VE },
62+ { "dst_format", "destination format", OFFSET(dst_format), AV_OPT_TYPE_PIXEL_FMT, { .i64 = DEFAULT }, 0, INT_MAX, VE },
63+ { "src_range", "source is full range", OFFSET(src_range), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT }, 0, 1, VE },
64+ { "dst_range", "destination is full range", OFFSET(dst_range), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT }, 0, 1, VE },
65+ { "gamma", "gamma correct scaling", OFFSET(gamma_flag), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
6666
6767 { "src_v_chr_pos", "source vertical chroma position in luma grid/256" , OFFSET(src_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513, 1024, VE },
6868 { "src_h_chr_pos", "source horizontal chroma position in luma grid/256", OFFSET(src_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513, 1024, VE },
@@ -76,13 +76,13 @@ static const AVOption swscale_options[] = { · 7 unmodified lines
7676 { "a_dither", "arithmetic addition dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_A_DITHER }, .flags = VE, .unit = "sws_dither" },
7777 { "x_dither", "arithmetic xor dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_X_DITHER }, .flags = VE, .unit = "sws_dither" },
7878
79− { "alphablend", "mode for alpha -> non alpha", OFFSET(alphablend), AV_OPT_TYPE_INT, { .i64 = SWS_ALPHA_BLEND_NONE}, .flags = VE, .unit = "alphablend", .max = SWS_ALPHA_BLEND_NB - 1 },
79+ { "alphablend", "mode for alpha -> non alpha", OFFSET(alpha_blend), AV_OPT_TYPE_INT, { .i64 = SWS_ALPHA_BLEND_NONE}, .flags = VE, .unit = "alphablend", .max = SWS_ALPHA_BLEND_NB - 1 },
8080 { "none", "ignore alpha", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_NONE}, .flags = VE, .unit = "alphablend" },
8181 { "uniform_color", "blend onto a uniform color", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_UNIFORM}, .flags = VE, .unit = "alphablend" },
8282 { "checkerboard", "blend onto a checkerboard", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_CHECKERBOARD}, .flags = VE, .unit = "alphablend" },
8383
84− { "threads", "number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, VE, .unit = "threads" },
85− { "auto", "automatic selection", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = VE, .unit = "threads" },
84+ { "threads", "number of threads", OFFSET(threads), AV_OPT_TYPE_INT, {.i64 = 1 }, .flags = VE, .unit = "threads", .max = INT_MAX },
85+ { "auto", "automatic selection", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = VE, .unit = "threads" },
8686
8787 { NULL }
8888 };
@@ -91,7 +91,7 @@ const AVClass ff_sws_context_class = { · 2 unmodified lines
9191 .class_name = "SWScaler",
9292 .item_name = sws_context_to_name,
9393 .option = swscale_options,
94− .parent_log_context_offset = OFFSET(parent),
94+ .parent_log_context_offset = offsetof(SwsInternal, parent),
9595 .category = AV_CLASS_CATEGORY_SWSCALER,
9696 .version = LIBAVUTIL_VERSION_INT,
9797 };
libswscale/output.c+12−12
@@ -624,7 +624,7 @@ yuv2mono_X_c_template(SwsInternal *c, const int16_t *lumFilter, · 623 unmodified lines
624624 Y1 = av_clip_uint8(Y1);
625625 Y2 = av_clip_uint8(Y2);
626626 }
627− if (c->dither == SWS_DITHER_ED) {
627+ if (c->opts.dither == SWS_DITHER_ED) {
628628 Y1 += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4;
629629 c->dither_error[0][i] = err;
630630 acc = 2*acc + (Y1 >= 128);
@@ -662,7 +662,7 @@ yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2], · 31 unmodified lines
662662 int i;
663663 av_assert2(yalpha <= 4096U);
664664
665− if (c->dither == SWS_DITHER_ED) {
665+ if (c->opts.dither == SWS_DITHER_ED) {
666666 int err = 0;
667667 unsigned acc = 0;
668668 for (i = 0; i < dstW; i +=2) {
@@ -720,7 +720,7 @@ yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0, · 51 unmodified lines
720720 const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
721721 int i;
722722
723− if (c->dither == SWS_DITHER_ED) {
723+ if (c->opts.dither == SWS_DITHER_ED) {
724724 int err = 0;
725725 unsigned acc = 0;
726726 for (i = 0; i < dstW; i +=2) {
@@ -1989,7 +1989,7 @@ static av_always_inline void yuv2rgb_write_full(SwsInternal *c, · 1262 unmodified lines
19891989 {
19901990 int r,g,b;
19911991
1992− switch (c->dither) {
1992+ switch (c->opts.dither) {
19931993 case SWS_DITHER_NONE:
19941994 if (isrgb8) {
19951995 r = av_clip_uintp2(R >> 27, 3);
@@ -2265,7 +2265,7 @@ yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 269 unmodified lines
22652265 const int16_t **alpSrc, uint8_t **dest,
22662266 int dstW, int y)
22672267 {
2268− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
2268+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
22692269 int i;
22702270 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc;
22712271 uint16_t **dest16 = (uint16_t**)dest;
@@ -2328,7 +2328,7 @@ yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 56 unmodified lines
23282328 dest[3][i] = A >> 19;
23292329 }
23302330 }
2331− if (SH != 22 && (!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {
2331+ if (SH != 22 && (!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
23322332 for (i = 0; i < dstW; i++) {
23332333 dest16[0][i] = av_bswap16(dest16[0][i]);
23342334 dest16[1][i] = av_bswap16(dest16[1][i]);
@@ -2347,7 +2347,7 @@ yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 12 unmodified lines
23472347 const int16_t **alpSrcx, uint8_t **dest,
23482348 int dstW, int y)
23492349 {
2350− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
2350+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
23512351 int i;
23522352 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
23532353 uint16_t **dest16 = (uint16_t**)dest;
@@ -2400,7 +2400,7 @@ yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 46 unmodified lines
24002400 if (hasAlpha)
24012401 dest16[3][i] = av_clip_uintp2(A, 30) >> 14;
24022402 }
2403− if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {
2403+ if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
24042404 for (i = 0; i < dstW; i++) {
24052405 dest16[0][i] = av_bswap16(dest16[0][i]);
24062406 dest16[1][i] = av_bswap16(dest16[1][i]);
@@ -2419,7 +2419,7 @@ yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 12 unmodified lines
24192419 const int16_t **alpSrcx, uint8_t **dest,
24202420 int dstW, int y)
24212421 {
2422− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
2422+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
24232423 int i;
24242424 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
24252425 uint32_t **dest32 = (uint32_t**)dest;
@@ -2476,7 +2476,7 @@ yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 50 unmodified lines
24762476 if (hasAlpha)
24772477 dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14));
24782478 }
2479− if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {
2479+ if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
24802480 for (i = 0; i < dstW; i++) {
24812481 dest32[0][i] = av_bswap32(dest32[0][i]);
24822482 dest32[1][i] = av_bswap32(dest32[1][i]);
@@ -3175,7 +3175,7 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c, · 692 unmodified lines
31753175 yuv2packedX_fn *yuv2packedX,
31763176 yuv2anyX_fn *yuv2anyX)
31773177 {
3178− enum AVPixelFormat dstFormat = c->dstFormat;
3178+ enum AVPixelFormat dstFormat = c->opts.dst_format;
31793179 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
31803180
31813181 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
@@ -3223,7 +3223,7 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c, · 41 unmodified lines
32233223 *yuv2nv12cX = yuv2nv12cX_c;
32243224 }
32253225
3226− if(c->flags & SWS_FULL_CHR_H_INT) {
3226+ if(c->opts.flags & SWS_FULL_CHR_H_INT) {
32273227 switch (dstFormat) {
32283228 case AV_PIX_FMT_RGBA:
32293229 #if CONFIG_SMALL
libswscale/ppc/swscale_altivec.c+3−3
@@ -232,7 +232,7 @@ yuv2plane1_float(yuv2plane1_float_bswap_altivec, uint32_t, BE) · 231 unmodified lines
232232 av_cold void ff_sws_init_swscale_ppc(SwsInternal *c)
233233 {
234234 #if HAVE_ALTIVEC
235− enum AVPixelFormat dstFormat = c->dstFormat;
235+ enum AVPixelFormat dstFormat = c->opts.dst_format;
236236
237237 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
238238 return;
@@ -256,8 +256,8 @@ av_cold void ff_sws_init_swscale_ppc(SwsInternal *c) · 17 unmodified lines
256256
257257 /* The following list of supported dstFormat values should
258258 * match what's found in the body of ff_yuv2packedX_altivec() */
259− if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {
260− switch (c->dstFormat) {
259+ if (!(c->opts.flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {
260+ switch (c->opts.dst_format) {
261261 case AV_PIX_FMT_ABGR:
262262 c->yuv2packedX = ff_yuv2abgr_X_altivec;
263263 break;
libswscale/ppc/swscale_vsx.c+9−9
@@ -1862,7 +1862,7 @@ static void hScale16To19_vsx(SwsInternal *c, int16_t *_dst, int dstW, · 1861 unmodified lines
18621862 const uint8_t *_src, const int16_t *filter,
18631863 const int32_t *filterPos, int filterSize)
18641864 {
1865− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
1865+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
18661866 int i, j;
18671867 int32_t *dst = (int32_t *) _dst;
18681868 const uint16_t *src = (const uint16_t *) _src;
@@ -1891,7 +1891,7 @@ static void hScale16To19_vsx(SwsInternal *c, int16_t *_dst, int dstW, · 22 unmodified lines
18911891 };
18921892 const vec_u8 vunused = vunusedtab[filterSize % 8];
18931893
1894− if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
1894+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
18951895 sh = 9;
18961896 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
18971897 sh = 16 - 1 - 4;
@@ -1940,7 +1940,7 @@ static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW, · 42 unmodified lines
19401940 const uint8_t *_src, const int16_t *filter,
19411941 const int32_t *filterPos, int filterSize)
19421942 {
1943− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
1943+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
19441944 int i, j;
19451945 const uint16_t *src = (const uint16_t *) _src;
19461946 int sh = desc->comp[0].depth - 1;
@@ -1968,7 +1968,7 @@ static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW, · 21 unmodified lines
19681968 const vec_u8 vunused = vunusedtab[filterSize % 8];
19691969
19701970 if (sh<15) {
1971− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
1971+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
19721972 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
19731973 sh = 16 - 1;
19741974 }
@@ -2019,7 +2019,7 @@ static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW, · 44 unmodified lines
20192019 av_cold void ff_sws_init_swscale_vsx(SwsInternal *c)
20202020 {
20212021 #if HAVE_VSX
2022− enum AVPixelFormat dstFormat = c->dstFormat;
2022+ enum AVPixelFormat dstFormat = c->opts.dst_format;
20232023 const int cpu_flags = av_get_cpu_flags();
20242024 const unsigned char power8 = HAVE_POWER8 && cpu_flags & AV_CPU_FLAG_POWER8;
20252025
@@ -2030,7 +2030,7 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) · 4 unmodified lines
20302030 if (c->srcBpc == 8) {
20312031 if (c->dstBpc <= 14) {
20322032 c->hyScale = c->hcScale = hScale_real_vsx;
2033− if (c->flags & SWS_FAST_BILINEAR && c->dstW >= c->srcW && c->chrDstW >= c->chrSrcW) {
2033+ if (c->opts.flags & SWS_FAST_BILINEAR && c->opts.dst_w >= c->opts.src_w && c->chrDstW >= c->chrSrcW) {
20342034 c->hyscale_fast = hyscale_fast_vsx;
20352035 c->hcscale_fast = hcscale_fast_vsx;
20362036 }
@@ -2048,7 +2048,7 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) · 11 unmodified lines
20482048 }
20492049 #endif
20502050
2051− if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {
2051+ if (!(c->opts.flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {
20522052 switch (c->dstBpc) {
20532053 case 8:
20542054 c->yuv2plane1 = yuv2plane1_8_vsx;
@@ -2082,11 +2082,11 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) · 27 unmodified lines
20822082 }
20832083 }
20842084
2085− if (c->flags & SWS_BITEXACT)
2085+ if (c->opts.flags & SWS_BITEXACT)
20862086 return;
20872087
20882088 #if !HAVE_BIGENDIAN
2089− if (c->flags & SWS_FULL_CHR_H_INT) {
2089+ if (c->opts.flags & SWS_FULL_CHR_H_INT) {
20902090 switch (dstFormat) {
20912091 case AV_PIX_FMT_RGB24:
20922092 if (power8) {
libswscale/ppc/yuv2rgb_altivec.c+9−9
@@ -299,7 +299,7 @@ static int altivec_ ## name(SwsInternal *c, const unsigned char *const *in, \ · 298 unmodified lines
299299 const int *instrides, int srcSliceY, int srcSliceH, \
300300 unsigned char *const *oplanes, const int *outstrides) \
301301 { \
302− int w = c->srcW; \
302+ int w = c->opts.src_w; \
303303 int h = srcSliceH; \
304304 int i, j; \
305305 int instrides_scl[3]; \
@@ -475,7 +475,7 @@ static int altivec_uyvy_rgb32(SwsInternal *c, const unsigned char *const *in, · 169 unmodified lines
475475 const int *instrides, int srcSliceY, int srcSliceH,
476476 unsigned char *const *oplanes, const int *outstrides)
477477 {
478− int w = c->srcW;
478+ int w = c->opts.src_w;
479479 int h = srcSliceH;
480480 int i, j;
481481 vector unsigned char uyvy;
@@ -545,20 +545,20 @@ av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c) · 63 unmodified lines
545545 * boom with X11 bad match.
546546 *
547547 */
548− if ((c->srcW & 0xf) != 0)
548+ if ((c->opts.src_w & 0xf) != 0)
549549 return NULL;
550550
551− switch (c->srcFormat) {
551+ switch (c->opts.src_format) {
552552 case AV_PIX_FMT_YUV410P:
553553 case AV_PIX_FMT_YUV420P:
554554 /*case IMGFMT_CLPL: ??? */
555555 case AV_PIX_FMT_GRAY8:
556556 case AV_PIX_FMT_NV12:
557557 case AV_PIX_FMT_NV21:
558− if ((c->srcH & 0x1) != 0)
558+ if ((c->opts.src_h & 0x1) != 0)
559559 return NULL;
560560
561− switch (c->dstFormat) {
561+ switch (c->opts.dst_format) {
562562 case AV_PIX_FMT_RGB24:
563563 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n");
564564 return altivec_yuv2_rgb24;
@@ -582,7 +582,7 @@ av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c) · 17 unmodified lines
582582 break;
583583
584584 case AV_PIX_FMT_UYVY422:
585− switch (c->dstFormat) {
585+ switch (c->opts.dst_format) {
586586 case AV_PIX_FMT_BGR32:
587587 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n");
588588 return altivec_uyvy_rgb32;
@@ -742,7 +742,7 @@ static av_always_inline void yuv2packedX_altivec(SwsInternal *c, · 153 unmodified lines
742742 if (!printed_error_message) {
743743 av_log(c, AV_LOG_ERROR,
744744 "altivec_yuv2packedX doesn't support %s output\n",
745− av_get_pix_fmt_name(c->dstFormat));
745+ av_get_pix_fmt_name(c->opts.dst_format));
746746 printed_error_message = 1;
747747 }
748748 return;
@@ -830,7 +830,7 @@ static av_always_inline void yuv2packedX_altivec(SwsInternal *c, · 81 unmodified lines
830830 /* Unreachable, I think. */
831831 av_log(c, AV_LOG_ERROR,
832832 "altivec_yuv2packedX doesn't support %s output\n",
833− av_get_pix_fmt_name(c->dstFormat));
833+ av_get_pix_fmt_name(c->opts.dst_format));
834834 return;
835835 }
836836
libswscale/ppc/yuv2yuv_altivec.c+7−7
@@ -37,12 +37,12 @@ static int yv12toyuy2_unscaled_altivec(SwsInternal *c, const uint8_t *const src[ · 36 unmodified lines
3737 const int dstStride_a[])
3838 {
3939 uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
40− // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
40+ // yv12toyuy2(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH,
4141 // srcStride[0], srcStride[1], dstStride[0]);
4242 const uint8_t *ysrc = src[0];
4343 const uint8_t *usrc = src[1];
4444 const uint8_t *vsrc = src[2];
45− const int width = c->srcW;
45+ const int width = c->opts.src_w;
4646 const int height = srcSliceH;
4747 const int lumStride = srcStride[0];
4848 const int chromStride = srcStride[1];
@@ -113,12 +113,12 @@ static int yv12touyvy_unscaled_altivec(SwsInternal *c, const uint8_t *const src[ · 64 unmodified lines
113113 const int dstStride_a[])
114114 {
115115 uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
116− // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
116+ // yv12toyuy2(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH,
117117 // srcStride[0], srcStride[1], dstStride[0]);
118118 const uint8_t *ysrc = src[0];
119119 const uint8_t *usrc = src[1];
120120 const uint8_t *vsrc = src[2];
121− const int width = c->srcW;
121+ const int width = c->opts.src_w;
122122 const int height = srcSliceH;
123123 const int lumStride = srcStride[0];
124124 const int chromStride = srcStride[1];
@@ -190,9 +190,9 @@ av_cold void ff_get_unscaled_swscale_ppc(SwsInternal *c) · 65 unmodified lines
190190 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
191191 return;
192192
193− if (!(c->srcW & 15) && !(c->flags & SWS_BITEXACT) &&
194− c->srcFormat == AV_PIX_FMT_YUV420P) {
195− enum AVPixelFormat dstFormat = c->dstFormat;
193+ if (!(c->opts.src_w & 15) && !(c->opts.flags & SWS_BITEXACT) &&
194+ c->opts.src_format == AV_PIX_FMT_YUV420P) {
195+ enum AVPixelFormat dstFormat = c->opts.dst_format;
196196
197197 // unscaled YV12 -> packed YUV, we want speed
198198 if (dstFormat == AV_PIX_FMT_YUYV422)
libswscale/riscv/swscale.c+2−2
@@ -41,7 +41,7 @@ av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c) · 40 unmodified lines
4141
4242 if (c->dstBpc <= 14 &&
4343 (flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
44− bool from = c->srcRange != 0;
44+ bool from = c->opts.src_range != 0;
4545
4646 c->lumConvertRange = convs[from].lum;
4747 c->chrConvertRange = convs[from].chr;
@@ -72,7 +72,7 @@ av_cold void ff_sws_init_swscale_riscv(SwsInternal *c) · 24 unmodified lines
7272 int flags = av_get_cpu_flags();
7373
7474 if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
75− switch (c->srcFormat) {
75+ switch (c->opts.src_format) {
7676 case AV_PIX_FMT_ABGR:
7777 c->lumToYV12 = ff_abgr32ToY_rvv;
7878 if (c->chrSrcHSubSample)
libswscale/slice.c+11−11
@@ -221,7 +221,7 @@ static void fill_ones(SwsSlice *s, int n, int bpc) · 220 unmodified lines
221221 static void get_min_buffer_size(SwsInternal *c, int *out_lum_size, int *out_chr_size)
222222 {
223223 int lumY;
224− int dstH = c->dstH;
224+ int dstH = c->opts.dst_h;
225225 int chrDstH = c->chrDstH;
226226 int *lumFilterPos = c->vLumFilterPos;
227227 int *chrFilterPos = c->vChrFilterPos;
@@ -253,14 +253,14 @@ int ff_init_filters(SwsInternal * c) · 25 unmodified lines
253253 int index;
254254 int num_ydesc;
255255 int num_cdesc;
256− int num_vdesc = isPlanarYUV(c->dstFormat) && !isGray(c->dstFormat) ? 2 : 1;
256+ int num_vdesc = isPlanarYUV(c->opts.dst_format) && !isGray(c->opts.dst_format) ? 2 : 1;
257257 int need_lum_conv = c->lumToYV12 || c->readLumPlanar || c->alpToYV12 || c->readAlpPlanar;
258258 int need_chr_conv = c->chrToYV12 || c->readChrPlanar;
259259 int need_gamma = c->is_internal_gamma;
260260 int srcIdx, dstIdx;
261− int dst_stride = FFALIGN(c->dstW * sizeof(int16_t) + 66, 16);
261+ int dst_stride = FFALIGN(c->opts.dst_w * sizeof(int16_t) + 66, 16);
262262
263− uint32_t * pal = usePal(c->srcFormat) ? c->pal_yuv : (uint32_t*)c->input_rgb2yuv_table;
263+ uint32_t * pal = usePal(c->opts.src_format) ? c->pal_yuv : (uint32_t*)c->input_rgb2yuv_table;
264264 int res = 0;
265265
266266 int lumBufSize;
@@ -284,7 +284,7 @@ int ff_init_filters(SwsInternal * c) · 17 unmodified lines
284284 c->descIndex[0] = num_ydesc + (need_gamma ? 1 : 0);
285285 c->descIndex[1] = num_ydesc + num_cdesc + (need_gamma ? 1 : 0);
286286
287− if (isFloat16(c->srcFormat)) {
287+ if (isFloat16(c->opts.src_format)) {
288288 c->h2f_tables = av_malloc(sizeof(*c->h2f_tables));
289289 if (!c->h2f_tables)
290290 return AVERROR(ENOMEM);
@@ -301,25 +301,25 @@ int ff_init_filters(SwsInternal * c) · 10 unmodified lines
301301 goto cleanup;
302302 }
303303
304− res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
304+ res = alloc_slice(&c->slice[0], c->opts.src_format, c->opts.src_h, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
305305 if (res < 0) goto cleanup;
306306 for (i = 1; i < c->numSlice-2; ++i) {
307− res = alloc_slice(&c->slice[i], c->srcFormat, lumBufSize, chrBufSize, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
307+ res = alloc_slice(&c->slice[i], c->opts.src_format, lumBufSize, chrBufSize, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
308308 if (res < 0) goto cleanup;
309− res = alloc_lines(&c->slice[i], FFALIGN(c->srcW*2+78, 16), c->srcW);
309+ res = alloc_lines(&c->slice[i], FFALIGN(c->opts.src_w*2+78, 16), c->opts.src_w);
310310 if (res < 0) goto cleanup;
311311 }
312312 // horizontal scaler output
313− res = alloc_slice(&c->slice[i], c->srcFormat, lumBufSize, chrBufSize, c->chrDstHSubSample, c->chrDstVSubSample, 1);
313+ res = alloc_slice(&c->slice[i], c->opts.src_format, lumBufSize, chrBufSize, c->chrDstHSubSample, c->chrDstVSubSample, 1);
314314 if (res < 0) goto cleanup;
315− res = alloc_lines(&c->slice[i], dst_stride, c->dstW);
315+ res = alloc_lines(&c->slice[i], dst_stride, c->opts.dst_w);
316316 if (res < 0) goto cleanup;
317317
318318 fill_ones(&c->slice[i], dst_stride>>1, c->dstBpc);
319319
320320 // vertical scaler output
321321 ++i;
322− res = alloc_slice(&c->slice[i], c->dstFormat, c->dstH, c->chrDstH, c->chrDstHSubSample, c->chrDstVSubSample, 0);
322+ res = alloc_slice(&c->slice[i], c->opts.dst_format, c->opts.dst_h, c->chrDstH, c->chrDstHSubSample, c->chrDstVSubSample, 0);
323323 if (res < 0) goto cleanup;
324324
325325 index = 0;
libswscale/swscale.c+81−81
@@ -66,14 +66,14 @@ static void hScale16To19_c(SwsInternal *c, int16_t *_dst, int dstW, · 65 unmodified lines
6666 const uint8_t *_src, const int16_t *filter,
6767 const int32_t *filterPos, int filterSize)
6868 {
69− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
69+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
7070 int i;
7171 int32_t *dst = (int32_t *) _dst;
7272 const uint16_t *src = (const uint16_t *) _src;
7373 int bits = desc->comp[0].depth - 1;
7474 int sh = bits - 4;
7575
76− if ((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
76+ if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
7777 sh = 9;
7878 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
7979 sh = 16 - 1 - 4;
@@ -96,13 +96,13 @@ static void hScale16To15_c(SwsInternal *c, int16_t *dst, int dstW, · 16 unmodified lines
9696 const uint8_t *_src, const int16_t *filter,
9797 const int32_t *filterPos, int filterSize)
9898 {
99− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
99+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
100100 int i;
101101 const uint16_t *src = (const uint16_t *) _src;
102102 int sh = desc->comp[0].depth - 1;
103103
104104 if (sh<15) {
105− sh = isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
105+ sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1);
106106 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
107107 sh = 16 - 1;
108108 }
@@ -237,15 +237,15 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 128 unmodified lines
237237 int srcSliceY, int srcSliceH, uint8_t *const dst[],
238238 const int dstStride[], int dstSliceY, int dstSliceH)
239239 {
240− const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH;
240+ const int scale_dst = dstSliceY > 0 || dstSliceH < c->opts.dst_h;
241241
242242 /* load a few things into local vars to make the code more readable?
243243 * and faster */
244− const int dstW = c->dstW;
245− int dstH = c->dstH;
244+ const int dstW = c->opts.dst_w;
245+ int dstH = c->opts.dst_h;
246246
247− const enum AVPixelFormat dstFormat = c->dstFormat;
248− const int flags = c->flags;
247+ const enum AVPixelFormat dstFormat = c->opts.dst_format;
248+ const int flags = c->opts.flags;
249249 int32_t *vLumFilterPos = c->vLumFilterPos;
250250 int32_t *vChrFilterPos = c->vChrFilterPos;
251251
@@ -261,8 +261,8 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 9 unmodified lines
261261 yuv2anyX_fn yuv2anyX = c->yuv2anyX;
262262 const int chrSrcSliceY = srcSliceY >> c->chrSrcVSubSample;
263263 const int chrSrcSliceH = AV_CEIL_RSHIFT(srcSliceH, c->chrSrcVSubSample);
264− int should_dither = isNBPS(c->srcFormat) ||
265− is16BPS(c->srcFormat);
264+ int should_dither = isNBPS(c->opts.src_format) ||
265+ is16BPS(c->opts.src_format);
266266 int lastDstY;
267267
268268 /* vars which will change and which we need to store back in the context */
@@ -289,7 +289,7 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 20 unmodified lines
289289 const uint8_t *src2[4];
290290 int srcStride2[4];
291291
292− if (isPacked(c->srcFormat)) {
292+ if (isPacked(c->opts.src_format)) {
293293 src2[0] =
294294 src2[1] =
295295 src2[2] =
@@ -364,10 +364,10 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 68 unmodified lines
364364 ff_init_vscale_pfn(c, yuv2plane1, yuv2planeX, yuv2nv12cX,
365365 yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, c->use_mmx_vfilter);
366366
367− ff_init_slice_from_src(src_slice, (uint8_t**)src2, srcStride2, c->srcW,
367+ ff_init_slice_from_src(src_slice, (uint8_t**)src2, srcStride2, c->opts.src_w,
368368 srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH, 1);
369369
370− ff_init_slice_from_src(vout_slice, (uint8_t**)dst, dstStride, c->dstW,
370+ ff_init_slice_from_src(vout_slice, (uint8_t**)dst, dstStride, c->opts.dst_w,
371371 dstY, dstSliceH, dstY >> c->chrDstVSubSample,
372372 AV_CEIL_RSHIFT(dstSliceH, c->chrDstVSubSample), scale_dst);
373373 if (srcSliceY == 0) {
@@ -389,13 +389,13 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 15 unmodified lines
389389
390390 // First line needed as input
391391 const int firstLumSrcY = FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]);
392− const int firstLumSrcY2 = FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1 << c->chrDstVSubSample) - 1), c->dstH - 1)]);
392+ const int firstLumSrcY2 = FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1 << c->chrDstVSubSample) - 1), c->opts.dst_h - 1)]);
393393 // First line needed as input
394394 const int firstChrSrcY = FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]);
395395
396396 // Last line needed as input
397− int lastLumSrcY = FFMIN(c->srcH, firstLumSrcY + vLumFilterSize) - 1;
398− int lastLumSrcY2 = FFMIN(c->srcH, firstLumSrcY2 + vLumFilterSize) - 1;
397+ int lastLumSrcY = FFMIN(c->opts.src_h, firstLumSrcY + vLumFilterSize) - 1;
398+ int lastLumSrcY2 = FFMIN(c->opts.src_h, firstLumSrcY2 + vLumFilterSize) - 1;
399399 int lastChrSrcY = FFMIN(c->chrSrcH, firstChrSrcY + vChrFilterSize) - 1;
400400 int enough_lines;
401401
@@ -488,13 +488,13 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 86 unmodified lines
488488
489489 #if HAVE_MMX_INLINE
490490 ff_updateMMXDitherTables(c, dstY);
491− c->dstW_mmx = c->dstW;
491+ c->dstW_mmx = c->opts.dst_w;
492492 #endif
493493 if (should_dither) {
494494 c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];
495495 c->lumDither8 = ff_dither_8x8_128[dstY & 7];
496496 }
497− if (dstY >= c->dstH - 2) {
497+ if (dstY >= c->opts.dst_h - 2) {
498498 /* hmm looks like we can't use MMX here without overwriting
499499 * this array's tail */
500500 ff_sws_init_output_funcs(c, &yuv2plane1, &yuv2planeX, &yuv2nv12cX,
@@ -544,9 +544,9 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c) · 43 unmodified lines
544544 {
545545 c->lumConvertRange = NULL;
546546 c->chrConvertRange = NULL;
547− if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
547+ if (c->opts.src_range != c->opts.dst_range && !isAnyRGB(c->opts.dst_format)) {
548548 if (c->dstBpc <= 14) {
549− if (c->srcRange) {
549+ if (c->opts.src_range) {
550550 c->lumConvertRange = lumRangeFromJpeg_c;
551551 c->chrConvertRange = chrRangeFromJpeg_c;
552552 } else {
@@ -554,7 +554,7 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c) · 1 unmodified line
554554 c->chrConvertRange = chrRangeToJpeg_c;
555555 }
556556 } else {
557− if (c->srcRange) {
557+ if (c->opts.src_range) {
558558 c->lumConvertRange = lumRangeFromJpeg16_c;
559559 c->chrConvertRange = chrRangeFromJpeg16_c;
560560 } else {
@@ -577,7 +577,7 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c) · 16 unmodified lines
577577
578578 static av_cold void sws_init_swscale(SwsInternal *c)
579579 {
580− enum AVPixelFormat srcFormat = c->srcFormat;
580+ enum AVPixelFormat srcFormat = c->opts.src_format;
581581
582582 ff_sws_init_output_funcs(c, &c->yuv2plane1, &c->yuv2planeX,
583583 &c->yuv2nv12cX, &c->yuv2packed1,
@@ -589,7 +589,7 @@ static av_cold void sws_init_swscale(SwsInternal *c) · 5 unmodified lines
589589 if (c->srcBpc == 8) {
590590 if (c->dstBpc <= 14) {
591591 c->hyScale = c->hcScale = hScale8To15_c;
592− if (c->flags & SWS_FAST_BILINEAR) {
592+ if (c->opts.flags & SWS_FAST_BILINEAR) {
593593 c->hyscale_fast = ff_hyscale_fast_c;
594594 c->hcscale_fast = ff_hcscale_fast_c;
595595 }
@@ -603,7 +603,7 @@ static av_cold void sws_init_swscale(SwsInternal *c) · 7 unmodified lines
603603
604604 ff_sws_init_range_convert(c);
605605
606− if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
606+ if (!(isGray(srcFormat) || isGray(c->opts.dst_format) ||
607607 srcFormat == AV_PIX_FMT_MONOBLACK || srcFormat == AV_PIX_FMT_MONOWHITE))
608608 c->needs_hcscale = 1;
609609 }
@@ -659,7 +659,7 @@ static int check_image_pointers(const uint8_t * const data[4], enum AVPixelForma · 49 unmodified lines
659659 void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride,
660660 const uint8_t *src, int src_stride, int w, int h)
661661 {
662− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
662+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
663663
664664 for (int yp = 0; yp < h; yp++) {
665665 const uint16_t *src16 = (const uint16_t *) src;
@@ -718,7 +718,7 @@ void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride, · 52 unmodified lines
718718 void ff_rgb48Toxyz12(const SwsInternal *c, uint8_t *dst, int dst_stride,
719719 const uint8_t *src, int src_stride, int w, int h)
720720 {
721− const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
721+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
722722
723723 for (int yp = 0; yp < h; yp++) {
724724 uint16_t *src16 = (uint16_t *) src;
@@ -778,28 +778,28 @@ void ff_update_palette(SwsInternal *c, const uint32_t *pal) · 53 unmodified lines
778778 {
779779 for (int i = 0; i < 256; i++) {
780780 int r, g, b, y, u, v, a = 0xff;
781− if (c->srcFormat == AV_PIX_FMT_PAL8) {
781+ if (c->opts.src_format == AV_PIX_FMT_PAL8) {
782782 uint32_t p = pal[i];
783783 a = (p >> 24) & 0xFF;
784784 r = (p >> 16) & 0xFF;
785785 g = (p >> 8) & 0xFF;
786786 b = p & 0xFF;
787− } else if (c->srcFormat == AV_PIX_FMT_RGB8) {
787+ } else if (c->opts.src_format == AV_PIX_FMT_RGB8) {
788788 r = ( i >> 5 ) * 36;
789789 g = ((i >> 2) & 7) * 36;
790790 b = ( i & 3) * 85;
791− } else if (c->srcFormat == AV_PIX_FMT_BGR8) {
791+ } else if (c->opts.src_format == AV_PIX_FMT_BGR8) {
792792 b = ( i >> 6 ) * 85;
793793 g = ((i >> 3) & 7) * 36;
794794 r = ( i & 7) * 36;
795− } else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) {
795+ } else if (c->opts.src_format == AV_PIX_FMT_RGB4_BYTE) {
796796 r = ( i >> 3 ) * 255;
797797 g = ((i >> 1) & 3) * 85;
798798 b = ( i & 1) * 255;
799− } else if (c->srcFormat == AV_PIX_FMT_GRAY8 || c->srcFormat == AV_PIX_FMT_GRAY8A) {
799+ } else if (c->opts.src_format == AV_PIX_FMT_GRAY8 || c->opts.src_format == AV_PIX_FMT_GRAY8A) {
800800 r = g = b = i;
801801 } else {
802− av_assert1(c->srcFormat == AV_PIX_FMT_BGR4_BYTE);
802+ av_assert1(c->opts.src_format == AV_PIX_FMT_BGR4_BYTE);
803803 b = ( i >> 3 ) * 255;
804804 g = ((i >> 1) & 3) * 85;
805805 r = ( i & 1) * 255;
@@ -820,7 +820,7 @@ void ff_update_palette(SwsInternal *c, const uint32_t *pal) · 14 unmodified lines
820820 v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
821821 c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24);
822822
823− switch (c->dstFormat) {
823+ switch (c->opts.dst_format) {
824824 case AV_PIX_FMT_BGR32:
825825 #if !HAVE_BIGENDIAN
826826 case AV_PIX_FMT_RGB24:
@@ -863,7 +863,7 @@ static int scale_gamma(SwsInternal *c, · 36 unmodified lines
863863 {
864864 int ret = scale_internal(c->cascaded_context[0],
865865 srcSlice, srcStride, srcSliceY, srcSliceH,
866− c->cascaded_tmp[0], c->cascaded_tmpStride[0], 0, c->srcH);
866+ c->cascaded_tmp[0], c->cascaded_tmpStride[0], 0, c->opts.src_h);
867867
868868 if (ret < 0)
869869 return ret;
@@ -871,7 +871,7 @@ static int scale_gamma(SwsInternal *c, · 1 unmodified line
871871 if (c->cascaded_context[2])
872872 ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],
873873 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
874− c->cascaded_tmp[1], c->cascaded_tmpStride[1], 0, c->dstH);
874+ c->cascaded_tmp[1], c->cascaded_tmpStride[1], 0, c->opts.dst_h);
875875 else
876876 ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],
877877 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
@@ -895,7 +895,7 @@ static int scale_cascaded(SwsInternal *c, · 17 unmodified lines
895895 uint8_t * const dstSlice[], const int dstStride[],
896896 int dstSliceY, int dstSliceH)
897897 {
898− const int dstH0 = sws_internal(c->cascaded_context[0])->dstH;
898+ const int dstH0 = sws_internal(c->cascaded_context[0])->opts.dst_h;
899899 int ret = scale_internal(c->cascaded_context[0],
900900 srcSlice, srcStride, srcSliceY, srcSliceH,
901901 c->cascaded_tmp[0], c->cascaded_tmpStride[0],
@@ -915,13 +915,13 @@ static int scale_internal(SwsContext *sws, · 13 unmodified lines
915915 int dstSliceY, int dstSliceH)
916916 {
917917 SwsInternal *c = sws_internal(sws);
918− const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH;
918+ const int scale_dst = dstSliceY > 0 || dstSliceH < c->opts.dst_h;
919919 const int frame_start = scale_dst || !c->sliceDir;
920920 int i, ret;
921921 const uint8_t *src2[4];
922922 uint8_t *dst2[4];
923− int macro_height_src = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample);
924− int macro_height_dst = isBayer(c->dstFormat) ? 2 : (1 << c->chrDstVSubSample);
923+ int macro_height_src = isBayer(c->opts.src_format) ? 2 : (1 << c->chrSrcVSubSample);
924+ int macro_height_dst = isBayer(c->opts.dst_format) ? 2 : (1 << c->chrDstVSubSample);
925925 // copy strides, so they can safely be modified
926926 int srcStride2[4];
927927 int dstStride2[4];
@@ -933,25 +933,25 @@ static int scale_internal(SwsContext *sws, · 5 unmodified lines
933933 }
934934
935935 if ((srcSliceY & (macro_height_src - 1)) ||
936− ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != c->srcH) ||
937− srcSliceY + srcSliceH > c->srcH ||
938− (isBayer(c->srcFormat) && srcSliceH <= 1)) {
936+ ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != c->opts.src_h) ||
937+ srcSliceY + srcSliceH > c->opts.src_h ||
938+ (isBayer(c->opts.src_format) && srcSliceH <= 1)) {
939939 av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
940940 return AVERROR(EINVAL);
941941 }
942942
943943 if ((dstSliceY & (macro_height_dst - 1)) ||
944− ((dstSliceH & (macro_height_dst - 1)) && dstSliceY + dstSliceH != c->dstH) ||
945− dstSliceY + dstSliceH > c->dstH) {
944+ ((dstSliceH & (macro_height_dst - 1)) && dstSliceY + dstSliceH != c->opts.dst_h) ||
945+ dstSliceY + dstSliceH > c->opts.dst_h) {
946946 av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", dstSliceY, dstSliceH);
947947 return AVERROR(EINVAL);
948948 }
949949
950− if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
950+ if (!check_image_pointers(srcSlice, c->opts.src_format, srcStride)) {
951951 av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
952952 return AVERROR(EINVAL);
953953 }
954− if (!check_image_pointers((const uint8_t* const*)dstSlice, c->dstFormat, dstStride)) {
954+ if (!check_image_pointers((const uint8_t* const*)dstSlice, c->opts.dst_format, dstStride)) {
955955 av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
956956 return AVERROR(EINVAL);
957957 }
@@ -960,22 +960,22 @@ static int scale_internal(SwsContext *sws, · 2 unmodified lines
960960 if (srcSliceH == 0)
961961 return 0;
962962
963− if (c->gamma_flag && c->cascaded_context[0])
963+ if (c->opts.gamma_flag && c->cascaded_context[0])
964964 return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH,
965965 dstSlice, dstStride, dstSliceY, dstSliceH);
966966
967967 if (c->cascaded_context[0] && srcSliceY == 0 &&
968− srcSliceH == sws_internal(c->cascaded_context[0])->srcH)
968+ srcSliceH == sws_internal(c->cascaded_context[0])->opts.src_h)
969969 {
970970 return scale_cascaded(c, srcSlice, srcStride, srcSliceY, srcSliceH,
971971 dstSlice, dstStride, dstSliceY, dstSliceH);
972972 }
973973
974− if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0])
974+ if (!srcSliceY && (c->opts.flags & SWS_BITEXACT) && c->opts.dither == SWS_DITHER_ED && c->dither_error[0])
975975 for (i = 0; i < 4; i++)
976− memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2));
976+ memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->opts.dst_w+2));
977977
978− if (usePal(c->srcFormat))
978+ if (usePal(c->opts.src_format))
979979 ff_update_palette(c, (const uint32_t *)srcSlice[1]);
980980
981981 memcpy(src2, srcSlice, sizeof(src2));
@@ -984,7 +984,7 @@ static int scale_internal(SwsContext *sws, · 2 unmodified lines
984984 memcpy(dstStride2, dstStride, sizeof(dstStride2));
985985
986986 if (frame_start && !scale_dst) {
987− if (srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
987+ if (srcSliceY != 0 && srcSliceY + srcSliceH != c->opts.src_h) {
988988 av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
989989 return AVERROR(EINVAL);
990990 }
@@ -993,7 +993,7 @@ static int scale_internal(SwsContext *sws, · 2 unmodified lines
993993 } else if (scale_dst)
994994 c->sliceDir = 1;
995995
996− if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) {
996+ if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->opts.dst_format)) {
997997 uint8_t *base;
998998 int x,y;
999999
@@ -1005,15 +1005,15 @@ static int scale_internal(SwsContext *sws, · 5 unmodified lines
10051005 base = srcStride[0] < 0 ? c->rgb0_scratch - srcStride[0] * (srcSliceH-1) :
10061006 c->rgb0_scratch;
10071007 for (y=0; y<srcSliceH; y++){
1008− memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW);
1009− for (x=c->src0Alpha-1; x<4*c->srcW; x+=4) {
1008+ memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->opts.src_w);
1009+ for (x=c->src0Alpha-1; x<4*c->opts.src_w; x+=4) {
10101010 base[ srcStride[0]*y + x] = 0xFF;
10111011 }
10121012 }
10131013 src2[0] = base;
10141014 }
10151015
1016− if (c->srcXYZ && !(c->dstXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
1016+ if (c->srcXYZ && !(c->dstXYZ && c->opts.src_w==c->opts.dst_w && c->opts.src_h==c->opts.dst_h)) {
10171017 uint8_t *base;
10181018
10191019 av_fast_malloc(&c->xyz_scratch, &c->xyz_scratch_allocated,
@@ -1024,7 +1024,7 @@ static int scale_internal(SwsContext *sws, · 4 unmodified lines
10241024 base = srcStride[0] < 0 ? c->xyz_scratch - srcStride[0] * (srcSliceH-1) :
10251025 c->xyz_scratch;
10261026
1027− ff_xyz12Torgb48(c, base, srcStride[0], src2[0], srcStride[0], c->srcW, srcSliceH);
1027+ ff_xyz12Torgb48(c, base, srcStride[0], src2[0], srcStride[0], c->opts.src_w, srcSliceH);
10281028 src2[0] = base;
10291029 }
10301030
@@ -1036,19 +1036,19 @@ static int scale_internal(SwsContext *sws, · 5 unmodified lines
10361036 }
10371037
10381038 src2[0] += (srcSliceH - 1) * srcStride[0];
1039− if (!usePal(c->srcFormat))
1039+ if (!usePal(c->opts.src_format))
10401040 src2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1];
10411041 src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2];
10421042 src2[3] += (srcSliceH - 1) * srcStride[3];
1043− dst2[0] += ( c->dstH - 1) * dstStride[0];
1044− dst2[1] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[1];
1045− dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2];
1046− dst2[3] += ( c->dstH - 1) * dstStride[3];
1043+ dst2[0] += ( c->opts.dst_h - 1) * dstStride[0];
1044+ dst2[1] += ((c->opts.dst_h >> c->chrDstVSubSample) - 1) * dstStride[1];
1045+ dst2[2] += ((c->opts.dst_h >> c->chrDstVSubSample) - 1) * dstStride[2];
1046+ dst2[3] += ( c->opts.dst_h - 1) * dstStride[3];
10471047
1048− srcSliceY_internal = c->srcH-srcSliceY-srcSliceH;
1048+ srcSliceY_internal = c->opts.src_h-srcSliceY-srcSliceH;
10491049 }
1050− reset_ptr(src2, c->srcFormat);
1051− reset_ptr((void*)dst2, c->dstFormat);
1050+ reset_ptr(src2, c->opts.src_format);
1051+ reset_ptr((void*)dst2, c->opts.dst_format);
10521052
10531053 if (c->convert_unscaled) {
10541054 int offset = srcSliceY_internal;
@@ -1058,13 +1058,13 @@ static int scale_internal(SwsContext *sws, · 3 unmodified lines
10581058 if (scale_dst) {
10591059 av_assert0(offset == 0);
10601060 for (i = 0; i < 4 && src2[i]; i++) {
1061− if (!src2[i] || (i > 0 && usePal(c->srcFormat)))
1061+ if (!src2[i] || (i > 0 && usePal(c->opts.src_format)))
10621062 break;
10631063 src2[i] += (dstSliceY >> ((i == 1 || i == 2) ? c->chrSrcVSubSample : 0)) * srcStride2[i];
10641064 }
10651065
10661066 for (i = 0; i < 4 && dst2[i]; i++) {
1067− if (!dst2[i] || (i > 0 && usePal(c->dstFormat)))
1067+ if (!dst2[i] || (i > 0 && usePal(c->opts.dst_format)))
10681068 break;
10691069 dst2[i] -= (dstSliceY >> ((i == 1 || i == 2) ? c->chrDstVSubSample : 0)) * dstStride2[i];
10701070 }
@@ -1081,7 +1081,7 @@ static int scale_internal(SwsContext *sws, · 10 unmodified lines
10811081 dst2, dstStride2, dstSliceY, dstSliceH);
10821082 }
10831083
1084− if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
1084+ if (c->dstXYZ && !(c->srcXYZ && c->opts.src_w==c->opts.dst_w && c->opts.src_h==c->opts.dst_h)) {
10851085 uint8_t *dst;
10861086
10871087 if (scale_dst) {
@@ -1091,16 +1091,16 @@ static int scale_internal(SwsContext *sws, · 3 unmodified lines
10911091
10921092 av_assert0(dstY >= ret);
10931093 av_assert0(ret >= 0);
1094− av_assert0(c->dstH >= dstY);
1094+ av_assert0(c->opts.dst_h >= dstY);
10951095 dst = dst2[0] + (dstY - ret) * dstStride2[0];
10961096 }
10971097
10981098 /* replace on the same data */
1099− ff_rgb48Toxyz12(c, dst, dstStride2[0], dst, dstStride2[0], c->dstW, ret);
1099+ ff_rgb48Toxyz12(c, dst, dstStride2[0], dst, dstStride2[0], c->opts.dst_w, ret);
11001100 }
11011101
11021102 /* reset slice direction at end of frame */
1103− if ((srcSliceY_internal + srcSliceH == c->srcH) || scale_dst)
1103+ if ((srcSliceY_internal + srcSliceH == c->opts.src_h) || scale_dst)
11041104 c->sliceDir = 0;
11051105
11061106 return ret;
@@ -1124,9 +1124,9 @@ int sws_frame_start(SwsContext *sws, AVFrame *dst, const AVFrame *src) · 17 unmodified lines
11241124 return ret;
11251125
11261126 if (!dst->buf[0]) {
1127− dst->width = c->dstW;
1128− dst->height = c->dstH;
1129− dst->format = c->dstFormat;
1127+ dst->width = c->opts.dst_w;
1128+ dst->height = c->opts.dst_h;
1129+ dst->format = c->opts.dst_format;
11301130
11311131 ret = av_frame_get_buffer(dst, 0);
11321132 if (ret < 0)
@@ -1177,10 +1177,10 @@ int sws_receive_slice(SwsContext *sws, unsigned int slice_start, · 44 unmodified lines
11771177 /* wait until complete input has been received */
11781178 if (!(c->src_ranges.nb_ranges == 1 &&
11791179 c->src_ranges.ranges[0].start == 0 &&
1180− c->src_ranges.ranges[0].len == c->srcH))
1180+ c->src_ranges.ranges[0].len == c->opts.src_h))
11811181 return AVERROR(EAGAIN);
11821182
1183− if ((slice_start > 0 || slice_height < c->dstH) &&
1183+ if ((slice_start > 0 || slice_height < c->opts.dst_h) &&
11841184 (slice_start % align || slice_height % align)) {
11851185 av_log(c, AV_LOG_ERROR,
11861186 "Incorrectly aligned output: %u/%u not multiples of %u\n",
@@ -1192,7 +1192,7 @@ int sws_receive_slice(SwsContext *sws, unsigned int slice_start, · 5 unmodified lines
11921192 int nb_jobs = c->nb_slice_ctx;
11931193 int ret = 0;
11941194
1195− if (sws_internal(c->slice_ctx[0])->dither == SWS_DITHER_ED)
1195+ if (sws_internal(c->slice_ctx[0])->opts.dither == SWS_DITHER_ED)
11961196 nb_jobs = 1;
11971197
11981198 c->dst_slice_start = slice_start;
@@ -1218,7 +1218,7 @@ int sws_receive_slice(SwsContext *sws, unsigned int slice_start, · 19 unmodified lines
12181218 }
12191219
12201220 return scale_internal(sws, (const uint8_t * const *)c->frame_src->data,
1221− c->frame_src->linesize, 0, c->srcH,
1221+ c->frame_src->linesize, 0, c->opts.src_h,
12221222 dst, c->frame_dst->linesize, slice_start, slice_height);
12231223 }
12241224
@@ -1256,7 +1256,7 @@ int attribute_align_arg sws_scale(SwsContext *sws, · 31 unmodified lines
12561256 }
12571257
12581258 return scale_internal(sws, srcSlice, srcStride, srcSliceY, srcSliceH,
1259− dst, dstStride, 0, c->dstH);
1259+ dst, dstStride, 0, c->opts.dst_h);
12601260 }
12611261
12621262 void ff_sws_slice_worker(void *priv, int jobnr, int threadnr,
@@ -1284,7 +1284,7 @@ void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, · 21 unmodified lines
12841284 }
12851285
12861286 err = scale_internal(sws, (const uint8_t * const *)parent->frame_src->data,
1287− parent->frame_src->linesize, 0, c->srcH,
1287+ parent->frame_src->linesize, 0, c->opts.src_h,
12881288 dst, parent->frame_dst->linesize,
12891289 parent->dst_slice_start + slice_start, slice_end - slice_start);
12901290 }
libswscale/swscale_internal.h+26−25
@@ -329,10 +329,31 @@ struct SwsFilterDescriptor; · 328 unmodified lines
329329
330330 /* This struct should be aligned on at least a 32-byte boundary. */
331331 struct SwsInternal {
332− /**
333− * info on struct for av_log
334− */
335− const AVClass *av_class;
332+ /* Currently active user-facing options. */
333+ struct {
334+ const AVClass *av_class;
335+
336+ double scaler_params[2]; ///< Input parameters for scaling algorithms that need them.
337+ int flags; ///< Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
338+ int threads; ///< Number of threads used for scaling
339+
340+ int src_w; ///< Width of source luma/alpha planes.
341+ int src_h; ///< Height of source luma/alpha planes.
342+ int dst_w; ///< Width of destination luma/alpha planes.
343+ int dst_h; ///< Height of destination luma/alpha planes.
344+ enum AVPixelFormat src_format; ///< Source pixel format.
345+ enum AVPixelFormat dst_format; ///< Destination pixel format.
346+ int src_range; ///< 0 = MPG YUV range, 1 = JPG YUV range (source image).
347+ int dst_range; ///< 0 = MPG YUV range, 1 = JPG YUV range (destination image).
348+ int src_h_chr_pos;
349+ int dst_h_chr_pos;
350+ int src_v_chr_pos;
351+ int dst_v_chr_pos;
352+ int gamma_flag;
353+
354+ SwsDither dither;
355+ SwsAlphaBlend alpha_blend;
356+ } opts;
336357
337358 SwsContext *parent;
338359
@@ -350,18 +371,12 @@ struct SwsInternal { · 11 unmodified lines
350371 * sws_scale() wrapper so they can be freely modified here.
351372 */
352373 SwsFunc convert_unscaled;
353− int srcW; ///< Width of source luma/alpha planes.
354− int srcH; ///< Height of source luma/alpha planes.
355− int dstW; ///< Width of destination luma/alpha planes.
356− int dstH; ///< Height of destination luma/alpha planes.
357374 int chrSrcW; ///< Width of source chroma planes.
358375 int chrSrcH; ///< Height of source chroma planes.
359376 int chrDstW; ///< Width of destination chroma planes.
360377 int chrDstH; ///< Height of destination chroma planes.
361378 int lumXInc, chrXInc;
362379 int lumYInc, chrYInc;
363− enum AVPixelFormat dstFormat; ///< Destination pixel format.
364− enum AVPixelFormat srcFormat; ///< Source pixel format.
365380 int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.
366381 int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.
367382 int dstBpc, srcBpc;
@@ -371,8 +386,6 @@ struct SwsInternal { · 3 unmodified lines
371386 int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image.
372387 int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
373388 int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
374− int nb_threads; ///< Number of threads used for scaling
375− double param[2]; ///< Input parameters for scaling algorithms that need them.
376389
377390 AVFrame *frame_src;
378391 AVFrame *frame_dst;
@@ -389,7 +402,6 @@ struct SwsInternal { · 10 unmodified lines
389402 int cascaded_mainindex;
390403
391404 double gamma_value;
392− int gamma_flag;
393405 int is_internal_gamma;
394406 uint16_t *gamma;
395407 uint16_t *inv_gamma;
@@ -459,7 +471,6 @@ struct SwsInternal { · 63 unmodified lines
459471 int warned_unuseable_bilinear;
460472
461473 int dstY; ///< Last destination vertical line output from last slice.
462− int flags; ///< Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
463474 void *yuvTable; // pointer to the yuv->rgb table start so it can be freed()
464475 // alignment ensures the offset can be added in a single
465476 // instruction on e.g. ARM
@@ -485,16 +496,10 @@ struct SwsInternal { · 19 unmodified lines
485496 int contrast, brightness, saturation; // for sws_getColorspaceDetails
486497 int srcColorspaceTable[4];
487498 int dstColorspaceTable[4];
488− int srcRange; ///< 0 = MPG YUV range, 1 = JPG YUV range (source image).
489− int dstRange; ///< 0 = MPG YUV range, 1 = JPG YUV range (destination image).
490499 int src0Alpha;
491500 int dst0Alpha;
492501 int srcXYZ;
493502 int dstXYZ;
494− int src_h_chr_pos;
495− int dst_h_chr_pos;
496− int src_v_chr_pos;
497− int dst_v_chr_pos;
498503 int yuv2rgb_y_offset;
499504 int yuv2rgb_y_coeff;
500505 int yuv2rgb_v2r_coeff;
@@ -682,10 +687,6 @@ struct SwsInternal { · 181 unmodified lines
682687
683688 int needs_hcscale; ///< Set if there are chroma planes to be converted.
684689
685− SwsDither dither;
686−
687− SwsAlphaBlend alphablend;
688−
689690 // scratch buffer for converting packed rgb0 sources
690691 // filled with a copy of the input frame + fully opaque alpha,
691692 // then passed as input to further conversion
@@ -712,7 +713,7 @@ static_assert(offsetof(SwsInternal, redDither) + DITHER32_INT == offsetof(SwsInt · 20 unmodified lines
712713 #if ARCH_X86_64
713714 /* x86 yuv2gbrp uses the SwsInternal for yuv coefficients
714715 if struct offsets change the asm needs to be updated too */
715−static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40292,
716+static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40316,
716717 "yuv2rgb_y_offset must be updated in x86 asm");
717718 #endif
718719
libswscale/swscale_unscaled.c+154−154
@@ -146,10 +146,10 @@ static int planarToNv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 145 unmodified lines
146146 {
147147 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2;
148148
149− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
149+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
150150 dstParam[0], dstStride[0]);
151151
152− if (c->dstFormat == AV_PIX_FMT_NV12)
152+ if (c->opts.dst_format == AV_PIX_FMT_NV12)
153153 interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2,
154154 srcStride[1], srcStride[2], dstStride[1]);
155155 else
@@ -167,10 +167,10 @@ static int nv12ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], · 11 unmodified lines
167167 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
168168 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
169169
170− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
170+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
171171 dstParam[0], dstStride[0]);
172172
173− if (c->srcFormat == AV_PIX_FMT_NV12)
173+ if (c->opts.src_format == AV_PIX_FMT_NV12)
174174 deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, (srcSliceH + 1) / 2,
175175 srcStride[1], dstStride[1], dstStride[2]);
176176 else
@@ -187,10 +187,10 @@ static int planarToNv24Wrapper(SwsInternal *c, const uint8_t *const src[], · 10 unmodified lines
187187 {
188188 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY;
189189
190− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
190+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
191191 dstParam[0], dstStride[0]);
192192
193− if (c->dstFormat == AV_PIX_FMT_NV24)
193+ if (c->opts.dst_format == AV_PIX_FMT_NV24)
194194 interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH,
195195 srcStride[1], srcStride[2], dstStride[1]);
196196 else
@@ -208,10 +208,10 @@ static int nv24ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], · 11 unmodified lines
208208 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY;
209209 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY;
210210
211− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
211+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
212212 dstParam[0], dstStride[0]);
213213
214− if (c->srcFormat == AV_PIX_FMT_NV24)
214+ if (c->opts.src_format == AV_PIX_FMT_NV24)
215215 deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH,
216216 srcStride[1], dstStride[1], dstStride[2]);
217217 else
@@ -250,15 +250,15 @@ static int nv24ToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], · 32 unmodified lines
250250 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
251251 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
252252
253− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
253+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
254254 dstParam[0], dstStride[0]);
255255
256− if (c->srcFormat == AV_PIX_FMT_NV24)
256+ if (c->opts.src_format == AV_PIX_FMT_NV24)
257257 nv24_to_yuv420p_chroma(dst1, dstStride[1], dst2, dstStride[2],
258− src[1], srcStride[1], c->srcW / 2, srcSliceH);
258+ src[1], srcStride[1], c->opts.src_w / 2, srcSliceH);
259259 else
260260 nv24_to_yuv420p_chroma(dst2, dstStride[2], dst1, dstStride[1],
261− src[1], srcStride[1], c->srcW / 2, srcSliceH);
261+ src[1], srcStride[1], c->opts.src_w / 2, srcSliceH);
262262
263263 return srcSliceH;
264264 }
@@ -268,8 +268,8 @@ static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], · 3 unmodified lines
268268 int srcSliceH, uint8_t *const dstParam8[],
269269 const int dstStride[])
270270 {
271− const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);
272− const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat);
271+ const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->opts.src_format);
272+ const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format);
273273 const uint16_t **src = (const uint16_t**)src8;
274274 uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY);
275275 uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2);
@@ -291,7 +291,7 @@ static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], · 15 unmodified lines
291291 for (y = 0; y < srcSliceH; y++) {
292292 uint16_t *tdstY = dstY;
293293 const uint16_t *tsrc0 = src[0];
294− for (x = c->srcW; x > 0; x--) {
294+ for (x = c->opts.src_w; x > 0; x--) {
295295 *tdstY++ = *tsrc0++ << shift[0];
296296 }
297297 src[0] += srcStride[0] / 2;
@@ -301,7 +301,7 @@ static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], · 3 unmodified lines
301301 uint16_t *tdstUV = dstUV;
302302 const uint16_t *tsrc1 = src[1];
303303 const uint16_t *tsrc2 = src[2];
304− for (x = c->srcW / 2; x > 0; x--) {
304+ for (x = c->opts.src_w / 2; x > 0; x--) {
305305 *tdstUV++ = *tsrc1++ << shift[1];
306306 *tdstUV++ = *tsrc2++ << shift[2];
307307 }
@@ -338,7 +338,7 @@ static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], · 30 unmodified lines
338338 for (y = 0; y < srcSliceH; y++) {
339339 uint16_t *tdstY = dstY;
340340 const uint8_t *tsrc0 = src0;
341− for (x = c->srcW; x > 0; x--) {
341+ for (x = c->opts.src_w; x > 0; x--) {
342342 t = *tsrc0++;
343343 output_pixel(tdstY++, t << 8);
344344 }
@@ -349,7 +349,7 @@ static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], · 4 unmodified lines
349349 uint16_t *tdstUV = dstUV;
350350 const uint8_t *tsrc1 = src1;
351351 const uint8_t *tsrc2 = src2;
352− for (x = c->srcW / 2; x > 0; x--) {
352+ for (x = c->opts.src_w / 2; x > 0; x--) {
353353 t = *tsrc1++;
354354 output_pixel(tdstUV++, t << 8);
355355 t = *tsrc2++;
@@ -372,7 +372,7 @@ static int planarToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
372372 {
373373 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
374374
375− yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0],
375+ yv12toyuy2(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0],
376376 srcStride[1], dstStride[0]);
377377
378378 return srcSliceH;
@@ -384,7 +384,7 @@ static int planarToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
384384 {
385385 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
386386
387− yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0],
387+ yv12touyvy(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0],
388388 srcStride[1], dstStride[0]);
389389
390390 return srcSliceH;
@@ -396,7 +396,7 @@ static int yuv422pToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
396396 {
397397 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
398398
399− yuv422ptoyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0],
399+ yuv422ptoyuy2(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0],
400400 srcStride[1], dstStride[0]);
401401
402402 return srcSliceH;
@@ -408,7 +408,7 @@ static int yuv422pToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
408408 {
409409 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
410410
411− yuv422ptouyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0],
411+ yuv422ptouyvy(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0],
412412 srcStride[1], dstStride[0]);
413413
414414 return srcSliceH;
@@ -422,11 +422,11 @@ static int yuyvToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
422422 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;
423423 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;
424424
425− yuyvtoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0],
425+ yuyvtoyuv420(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0],
426426 dstStride[1], srcStride[0]);
427427
428428 if (dstParam[3])
429− fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
429+ fillPlane(dstParam[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
430430
431431 return srcSliceH;
432432 }
@@ -439,7 +439,7 @@ static int yuyvToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], · 6 unmodified lines
439439 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;
440440 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;
441441
442− yuyvtoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0],
442+ yuyvtoyuv422(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0],
443443 dstStride[1], srcStride[0]);
444444
445445 return srcSliceH;
@@ -453,11 +453,11 @@ static int uyvyToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
453453 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;
454454 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;
455455
456− uyvytoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0],
456+ uyvytoyuv420(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0],
457457 dstStride[1], srcStride[0]);
458458
459459 if (dstParam[3])
460− fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
460+ fillPlane(dstParam[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
461461
462462 return srcSliceH;
463463 }
@@ -470,7 +470,7 @@ static int uyvyToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], · 6 unmodified lines
470470 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;
471471 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;
472472
473− uyvytoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0],
473+ uyvytoyuv422(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0],
474474 dstStride[1], srcStride[0]);
475475
476476 return srcSliceH;
@@ -566,8 +566,8 @@ static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 89 unmodified lines
566566 int srcSliceY, int srcSliceH, uint8_t *const dst[],
567567 const int dstStride[])
568568 {
569− const enum AVPixelFormat srcFormat = c->srcFormat;
570− const enum AVPixelFormat dstFormat = c->dstFormat;
569+ const enum AVPixelFormat srcFormat = c->opts.src_format;
570+ const enum AVPixelFormat dstFormat = c->opts.dst_format;
571571 void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels,
572572 const uint8_t *palette) = NULL;
573573 int i;
@@ -599,7 +599,7 @@ static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 25 unmodified lines
599599 av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
600600 else {
601601 for (i = 0; i < srcSliceH; i++) {
602− conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb);
602+ conv(srcPtr, dstPtr, c->opts.src_w, (uint8_t *) c->pal_rgb);
603603 srcPtr += srcStride[0];
604604 dstPtr += dstStride[0];
605605 }
@@ -821,8 +821,8 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 215 unmodified lines
821821 uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] };
822822 int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] };
823823 int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] };
824− const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);
825− const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat);
824+ const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->opts.src_format);
825+ const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format);
826826 int bpc = dst_format->comp[0].depth;
827827 int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA;
828828 int swap = 0;
@@ -847,20 +847,20 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 18 unmodified lines
847847 dst1023[i] += stride1023[i] * srcSliceY / 2;
848848 }
849849
850− switch (c->srcFormat) {
850+ switch (c->opts.src_format) {
851851 case AV_PIX_FMT_RGB48LE:
852852 case AV_PIX_FMT_RGB48BE:
853853 case AV_PIX_FMT_RGBA64LE:
854854 case AV_PIX_FMT_RGBA64BE:
855855 packed16togbra16(src[0], srcStride[0],
856856 dst2013, stride2013, srcSliceH, alpha, swap,
857− 16 - bpc, c->srcW);
857+ 16 - bpc, c->opts.src_w);
858858 break;
859859 case AV_PIX_FMT_X2RGB10LE:
860860 av_assert0(bpc >= 10);
861861 packed30togbra10(src[0], srcStride[0],
862862 dst2013, stride2013, srcSliceH, swap,
863− bpc, c->srcW);
863+ bpc, c->opts.src_w);
864864 break;
865865 case AV_PIX_FMT_BGR48LE:
866866 case AV_PIX_FMT_BGR48BE:
@@ -868,13 +868,13 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
868868 case AV_PIX_FMT_BGRA64BE:
869869 packed16togbra16(src[0], srcStride[0],
870870 dst1023, stride1023, srcSliceH, alpha, swap,
871− 16 - bpc, c->srcW);
871+ 16 - bpc, c->opts.src_w);
872872 break;
873873 case AV_PIX_FMT_X2BGR10LE:
874874 av_assert0(bpc >= 10);
875875 packed30togbra10(src[0], srcStride[0],
876876 dst1023, stride1023, srcSliceH, swap,
877− bpc, c->srcW);
877+ bpc, c->opts.src_w);
878878 break;
879879 default:
880880 av_log(c, AV_LOG_ERROR,
@@ -1047,8 +1047,8 @@ static int planarRgb16ToRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 166 unmodified lines
10471047 const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] };
10481048 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };
10491049 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };
1050− const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);
1051− const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat);
1050+ const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->opts.src_format);
1051+ const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format);
10521052 int bits_per_sample = src_format->comp[0].depth;
10531053 int swap = 0;
10541054 if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) ||
@@ -1065,40 +1065,40 @@ static int planarRgb16ToRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 10 unmodified lines
10651065 src_format->name, dst_format->name);
10661066 return srcSliceH;
10671067 }
1068− switch (c->dstFormat) {
1068+ switch (c->opts.dst_format) {
10691069 case AV_PIX_FMT_BGR48LE:
10701070 case AV_PIX_FMT_BGR48BE:
10711071 gbr16ptopacked16(src102, stride102,
10721072 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1073− srcSliceH, 0, swap, bits_per_sample, c->srcW);
1073+ srcSliceH, 0, swap, bits_per_sample, c->opts.src_w);
10741074 break;
10751075 case AV_PIX_FMT_RGB48LE:
10761076 case AV_PIX_FMT_RGB48BE:
10771077 gbr16ptopacked16(src201, stride201,
10781078 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1079− srcSliceH, 0, swap, bits_per_sample, c->srcW);
1079+ srcSliceH, 0, swap, bits_per_sample, c->opts.src_w);
10801080 break;
10811081 case AV_PIX_FMT_RGBA64LE:
10821082 case AV_PIX_FMT_RGBA64BE:
10831083 gbr16ptopacked16(src201, stride201,
10841084 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1085− srcSliceH, 1, swap, bits_per_sample, c->srcW);
1085+ srcSliceH, 1, swap, bits_per_sample, c->opts.src_w);
10861086 break;
10871087 case AV_PIX_FMT_BGRA64LE:
10881088 case AV_PIX_FMT_BGRA64BE:
10891089 gbr16ptopacked16(src102, stride102,
10901090 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1091− srcSliceH, 1, swap, bits_per_sample, c->srcW);
1091+ srcSliceH, 1, swap, bits_per_sample, c->opts.src_w);
10921092 break;
10931093 case AV_PIX_FMT_X2RGB10LE:
10941094 gbr16ptopacked30(src201, stride201,
10951095 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1096− srcSliceH, swap, bits_per_sample, c->srcW);
1096+ srcSliceH, swap, bits_per_sample, c->opts.src_w);
10971097 break;
10981098 case AV_PIX_FMT_X2BGR10LE:
10991099 gbr16ptopacked30(src102, stride102,
11001100 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1101− srcSliceH, swap, bits_per_sample, c->srcW);
1101+ srcSliceH, swap, bits_per_sample, c->opts.src_w);
11021102 break;
11031103 default:
11041104 av_log(c, AV_LOG_ERROR,
@@ -1195,24 +1195,24 @@ static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 90 unmodified lines
11951195 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };
11961196 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };
11971197
1198− if (c->srcFormat != AV_PIX_FMT_GBRAP) {
1198+ if (c->opts.src_format != AV_PIX_FMT_GBRAP) {
11991199 av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",
1200− av_get_pix_fmt_name(c->srcFormat),
1201− av_get_pix_fmt_name(c->dstFormat));
1200+ av_get_pix_fmt_name(c->opts.src_format),
1201+ av_get_pix_fmt_name(c->opts.dst_format));
12021202 return srcSliceH;
12031203 }
12041204
1205− switch (c->dstFormat) {
1205+ switch (c->opts.dst_format) {
12061206 case AV_PIX_FMT_BGR24:
12071207 gbr24ptopacked24(src102, stride102,
12081208 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1209− srcSliceH, c->srcW);
1209+ srcSliceH, c->opts.src_w);
12101210 break;
12111211
12121212 case AV_PIX_FMT_RGB24:
12131213 gbr24ptopacked24(src201, stride201,
12141214 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1215− srcSliceH, c->srcW);
1215+ srcSliceH, c->opts.src_w);
12161216 break;
12171217
12181218 case AV_PIX_FMT_ARGB:
@@ -1220,7 +1220,7 @@ static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
12201220 case AV_PIX_FMT_RGBA:
12211221 gbraptopacked32(src201, stride201,
12221222 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1223− srcSliceH, alpha_first, c->srcW);
1223+ srcSliceH, alpha_first, c->opts.src_w);
12241224 break;
12251225
12261226 case AV_PIX_FMT_ABGR:
@@ -1228,14 +1228,14 @@ static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
12281228 case AV_PIX_FMT_BGRA:
12291229 gbraptopacked32(src102, stride102,
12301230 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1231− srcSliceH, alpha_first, c->srcW);
1231+ srcSliceH, alpha_first, c->opts.src_w);
12321232 break;
12331233
12341234 default:
12351235 av_log(c, AV_LOG_ERROR,
12361236 "unsupported planar RGB conversion %s -> %s\n",
1237− av_get_pix_fmt_name(c->srcFormat),
1238− av_get_pix_fmt_name(c->dstFormat));
1237+ av_get_pix_fmt_name(c->opts.src_format),
1238+ av_get_pix_fmt_name(c->opts.dst_format));
12391239 }
12401240
12411241 return srcSliceH;
@@ -1251,24 +1251,24 @@ static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 9 unmodified lines
12511251 int stride102[] = { srcStride[1], srcStride[0], srcStride[2] };
12521252 int stride201[] = { srcStride[2], srcStride[0], srcStride[1] };
12531253
1254− if (c->srcFormat != AV_PIX_FMT_GBRP) {
1254+ if (c->opts.src_format != AV_PIX_FMT_GBRP) {
12551255 av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",
1256− av_get_pix_fmt_name(c->srcFormat),
1257− av_get_pix_fmt_name(c->dstFormat));
1256+ av_get_pix_fmt_name(c->opts.src_format),
1257+ av_get_pix_fmt_name(c->opts.dst_format));
12581258 return srcSliceH;
12591259 }
12601260
1261− switch (c->dstFormat) {
1261+ switch (c->opts.dst_format) {
12621262 case AV_PIX_FMT_BGR24:
12631263 gbr24ptopacked24(src102, stride102,
12641264 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1265− srcSliceH, c->srcW);
1265+ srcSliceH, c->opts.src_w);
12661266 break;
12671267
12681268 case AV_PIX_FMT_RGB24:
12691269 gbr24ptopacked24(src201, stride201,
12701270 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1271− srcSliceH, c->srcW);
1271+ srcSliceH, c->opts.src_w);
12721272 break;
12731273
12741274 case AV_PIX_FMT_ARGB:
@@ -1276,7 +1276,7 @@ static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
12761276 case AV_PIX_FMT_RGBA:
12771277 gbr24ptopacked32(src201, stride201,
12781278 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1279− srcSliceH, alpha_first, c->srcW);
1279+ srcSliceH, alpha_first, c->opts.src_w);
12801280 break;
12811281
12821282 case AV_PIX_FMT_ABGR:
@@ -1284,14 +1284,14 @@ static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
12841284 case AV_PIX_FMT_BGRA:
12851285 gbr24ptopacked32(src102, stride102,
12861286 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1287− srcSliceH, alpha_first, c->srcW);
1287+ srcSliceH, alpha_first, c->opts.src_w);
12881288 break;
12891289
12901290 default:
12911291 av_log(c, AV_LOG_ERROR,
12921292 "unsupported planar RGB conversion %s -> %s\n",
1293− av_get_pix_fmt_name(c->srcFormat),
1294− av_get_pix_fmt_name(c->dstFormat));
1293+ av_get_pix_fmt_name(c->opts.src_format),
1294+ av_get_pix_fmt_name(c->opts.dst_format));
12951295 }
12961296
12971297 return srcSliceH;
@@ -1302,14 +1302,14 @@ static int planarRgbToplanarRgbWrapper(SwsInternal *c, · 4 unmodified lines
13021302 int srcSliceY, int srcSliceH,
13031303 uint8_t *const dst[], const int dstStride[])
13041304 {
1305− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
1305+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
13061306 dst[0], dstStride[0]);
1307− ff_copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->srcW,
1307+ ff_copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->opts.src_w,
13081308 dst[1], dstStride[1]);
1309− ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->srcW,
1309+ ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->opts.src_w,
13101310 dst[2], dstStride[2]);
13111311 if (dst[3])
1312− fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
1312+ fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
13131313
13141314 return srcSliceH;
13151315 }
@@ -1357,32 +1357,32 @@ static int rgbToPlanarRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 41 unmodified lines
13571357 dst[0] + srcSliceY * dstStride[0],
13581358 dst[1] + srcSliceY * dstStride[1] };
13591359
1360− switch (c->srcFormat) {
1360+ switch (c->opts.src_format) {
13611361 case AV_PIX_FMT_RGB24:
13621362 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201,
1363− stride201, srcSliceH, alpha_first, 3, c->srcW);
1363+ stride201, srcSliceH, alpha_first, 3, c->opts.src_w);
13641364 break;
13651365 case AV_PIX_FMT_BGR24:
13661366 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102,
1367− stride102, srcSliceH, alpha_first, 3, c->srcW);
1367+ stride102, srcSliceH, alpha_first, 3, c->opts.src_w);
13681368 break;
13691369 case AV_PIX_FMT_ARGB:
13701370 alpha_first = 1;
13711371 case AV_PIX_FMT_RGBA:
13721372 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201,
1373− stride201, srcSliceH, alpha_first, 4, c->srcW);
1373+ stride201, srcSliceH, alpha_first, 4, c->opts.src_w);
13741374 break;
13751375 case AV_PIX_FMT_ABGR:
13761376 alpha_first = 1;
13771377 case AV_PIX_FMT_BGRA:
13781378 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102,
1379− stride102, srcSliceH, alpha_first, 4, c->srcW);
1379+ stride102, srcSliceH, alpha_first, 4, c->opts.src_w);
13801380 break;
13811381 default:
13821382 av_log(c, AV_LOG_ERROR,
13831383 "unsupported planar RGB conversion %s -> %s\n",
1384− av_get_pix_fmt_name(c->srcFormat),
1385− av_get_pix_fmt_name(c->dstFormat));
1384+ av_get_pix_fmt_name(c->opts.src_format),
1385+ av_get_pix_fmt_name(c->opts.dst_format));
13861386 }
13871387
13881388 return srcSliceH;
@@ -1467,32 +1467,32 @@ static int rgbToPlanarRgbaWrapper(SwsInternal *c, const uint8_t *const src[], · 78 unmodified lines
14671467 dst[1] + srcSliceY * dstStride[1],
14681468 dst[3] + srcSliceY * dstStride[3] };
14691469
1470− switch (c->srcFormat) {
1470+ switch (c->opts.src_format) {
14711471 case AV_PIX_FMT_RGB24:
14721472 packed24togbrap((const uint8_t *) src[0], srcStride[0], dst201,
1473− stride201, srcSliceH, c->srcW);
1473+ stride201, srcSliceH, c->opts.src_w);
14741474 break;
14751475 case AV_PIX_FMT_BGR24:
14761476 packed24togbrap((const uint8_t *) src[0], srcStride[0], dst102,
1477− stride102, srcSliceH, c->srcW);
1477+ stride102, srcSliceH, c->opts.src_w);
14781478 break;
14791479 case AV_PIX_FMT_ARGB:
14801480 alpha_first = 1;
14811481 case AV_PIX_FMT_RGBA:
14821482 packed32togbrap((const uint8_t *) src[0], srcStride[0], dst201,
1483− stride201, srcSliceH, alpha_first, c->srcW);
1483+ stride201, srcSliceH, alpha_first, c->opts.src_w);
14841484 break;
14851485 case AV_PIX_FMT_ABGR:
14861486 alpha_first = 1;
14871487 case AV_PIX_FMT_BGRA:
14881488 packed32togbrap((const uint8_t *) src[0], srcStride[0], dst102,
1489− stride102, srcSliceH, alpha_first, c->srcW);
1489+ stride102, srcSliceH, alpha_first, c->opts.src_w);
14901490 break;
14911491 default:
14921492 av_log(c, AV_LOG_ERROR,
14931493 "unsupported planar RGB conversion %s -> %s\n",
1494− av_get_pix_fmt_name(c->srcFormat),
1495− av_get_pix_fmt_name(c->dstFormat));
1494+ av_get_pix_fmt_name(c->opts.src_format),
1495+ av_get_pix_fmt_name(c->opts.dst_format));
14961496 }
14971497
14981498 return srcSliceH;
@@ -1568,7 +1568,7 @@ static int bayer_to_rgb24_wrapper(SwsInternal *c, const uint8_t *const src[], · 69 unmodified lines
15681568 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
15691569 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
15701570
1571− switch(c->srcFormat) {
1571+ switch(c->opts.src_format) {
15721572 #define CASE(pixfmt, prefix) \
15731573 case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \
15741574 interpolate = bayer_##prefix##_to_rgb24_interpolate; \
@@ -1591,20 +1591,20 @@ static int bayer_to_rgb24_wrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
15911591
15921592 av_assert0(srcSliceH > 1);
15931593
1594− copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
1594+ copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
15951595 srcPtr += 2 * srcStride[0];
15961596 dstPtr += 2 * dstStride[0];
15971597
15981598 for (i = 2; i < srcSliceH - 2; i += 2) {
1599− interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
1599+ interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
16001600 srcPtr += 2 * srcStride[0];
16011601 dstPtr += 2 * dstStride[0];
16021602 }
16031603
16041604 if (i + 1 == srcSliceH) {
1605− copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW);
1605+ copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->opts.src_w);
16061606 } else if (i < srcSliceH)
1607− copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
1607+ copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
16081608 return srcSliceH;
16091609 }
16101610
@@ -1618,7 +1618,7 @@ static int bayer_to_rgb48_wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
16181618 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
16191619 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
16201620
1621− switch(c->srcFormat) {
1621+ switch(c->opts.src_format) {
16221622 #define CASE(pixfmt, prefix) \
16231623 case pixfmt: copy = bayer_##prefix##_to_rgb48_copy; \
16241624 interpolate = bayer_##prefix##_to_rgb48_interpolate; \
@@ -1641,20 +1641,20 @@ static int bayer_to_rgb48_wrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
16411641
16421642 av_assert0(srcSliceH > 1);
16431643
1644− copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
1644+ copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
16451645 srcPtr += 2 * srcStride[0];
16461646 dstPtr += 2 * dstStride[0];
16471647
16481648 for (i = 2; i < srcSliceH - 2; i += 2) {
1649− interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
1649+ interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
16501650 srcPtr += 2 * srcStride[0];
16511651 dstPtr += 2 * dstStride[0];
16521652 }
16531653
16541654 if (i + 1 == srcSliceH) {
1655− copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW);
1655+ copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->opts.src_w);
16561656 } else if (i < srcSliceH)
1657− copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
1657+ copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
16581658 return srcSliceH;
16591659 }
16601660
@@ -1670,7 +1670,7 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 9 unmodified lines
16701670 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, const int32_t *rgb2yuv);
16711671 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, const int32_t *rgb2yuv);
16721672
1673− switch(c->srcFormat) {
1673+ switch(c->opts.src_format) {
16741674 #define CASE(pixfmt, prefix) \
16751675 case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \
16761676 interpolate = bayer_##prefix##_to_yv12_interpolate; \
@@ -1693,14 +1693,14 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
16931693
16941694 av_assert0(srcSliceH > 1);
16951695
1696− copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
1696+ copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->opts.src_w, c->input_rgb2yuv_table);
16971697 srcPtr += 2 * srcStride[0];
16981698 dstY += 2 * dstStride[0];
16991699 dstU += dstStride[1];
17001700 dstV += dstStride[1];
17011701
17021702 for (i = 2; i < srcSliceH - 2; i += 2) {
1703− interpolate(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
1703+ interpolate(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->opts.src_w, c->input_rgb2yuv_table);
17041704 srcPtr += 2 * srcStride[0];
17051705 dstY += 2 * dstStride[0];
17061706 dstU += dstStride[1];
@@ -1708,9 +1708,9 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
17081708 }
17091709
17101710 if (i + 1 == srcSliceH) {
1711− copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->srcW, c->input_rgb2yuv_table);
1711+ copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->opts.src_w, c->input_rgb2yuv_table);
17121712 } else if (i < srcSliceH)
1713− copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
1713+ copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->opts.src_w, c->input_rgb2yuv_table);
17141714 return srcSliceH;
17151715 }
17161716
@@ -1751,8 +1751,8 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 34 unmodified lines
17511751 typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);
17521752 static rgbConvFn findRgbConvFn(SwsInternal *c)
17531753 {
1754− const enum AVPixelFormat srcFormat = c->srcFormat;
1755− const enum AVPixelFormat dstFormat = c->dstFormat;
1754+ const enum AVPixelFormat srcFormat = c->opts.src_format;
1755+ const enum AVPixelFormat dstFormat = c->opts.dst_format;
17561756 const int srcId = c->srcFormatBpp;
17571757 const int dstId = c->dstFormatBpp;
17581758 rgbConvFn conv = NULL;
@@ -1899,7 +1899,7 @@ static rgbConvFn findRgbConvFn(SwsInternal *c) · 140 unmodified lines
18991899 return NULL;
19001900
19011901 // Maintain symmetry between endianness
1902− if (c->flags & SWS_BITEXACT)
1902+ if (c->opts.flags & SWS_BITEXACT)
19031903 if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0)
19041904 return NULL;
19051905
@@ -1912,10 +1912,10 @@ static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 6 unmodified lines
19121912 const int dstStride[])
19131913
19141914 {
1915− const enum AVPixelFormat srcFormat = c->srcFormat;
1916− const enum AVPixelFormat dstFormat = c->dstFormat;
1917− const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);
1918− const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat);
1915+ const enum AVPixelFormat srcFormat = c->opts.src_format;
1916+ const enum AVPixelFormat dstFormat = c->opts.dst_format;
1917+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->opts.src_format);
1918+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
19191919 const int srcBpp = (c->srcFormatBpp + 7) >> 3;
19201920 const int dstBpp = (c->dstFormatBpp + 7) >> 3;
19211921 rgbConvFn conv = findRgbConvFn(c);
@@ -1945,20 +1945,20 @@ static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 23 unmodified lines
19451945 if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 &&
19461946 !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap)
19471947 conv(srcPtr, dstPtr + dstStride[0] * srcSliceY,
1948− (srcSliceH - 1) * srcStride[0] + c->srcW * srcBpp);
1948+ (srcSliceH - 1) * srcStride[0] + c->opts.src_w * srcBpp);
19491949 else {
19501950 int i, j;
19511951 dstPtr += dstStride[0] * srcSliceY;
19521952
19531953 for (i = 0; i < srcSliceH; i++) {
19541954 if(src_bswap) {
1955− for(j=0; j<c->srcW; j++)
1955+ for(j=0; j<c->opts.src_w; j++)
19561956 ((uint16_t*)c->formatConvBuffer)[j] = av_bswap16(((uint16_t*)srcPtr)[j]);
1957− conv(c->formatConvBuffer, dstPtr, c->srcW * srcBpp);
1957+ conv(c->formatConvBuffer, dstPtr, c->opts.src_w * srcBpp);
19581958 }else
1959− conv(srcPtr, dstPtr, c->srcW * srcBpp);
1959+ conv(srcPtr, dstPtr, c->opts.src_w * srcBpp);
19601960 if(dst_bswap)
1961− for(j=0; j<c->srcW; j++)
1961+ for(j=0; j<c->opts.src_w; j++)
19621962 ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]);
19631963 srcPtr += srcStride[0];
19641964 dstPtr += dstStride[0];
@@ -1977,11 +1977,11 @@ static int bgr24ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 12 unmodified lines
19771977 dst[0] + srcSliceY * dstStride[0],
19781978 dst[1] + (srcSliceY >> 1) * dstStride[1],
19791979 dst[2] + (srcSliceY >> 1) * dstStride[2],
1980− c->srcW, srcSliceH,
1980+ c->opts.src_w, srcSliceH,
19811981 dstStride[0], dstStride[1], srcStride[0],
19821982 c->input_rgb2yuv_table);
19831983 if (dst[3])
1984− fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
1984+ fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
19851985 return srcSliceH;
19861986 }
19871987
@@ -1989,7 +1989,7 @@ static int yvu9ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
19891989 const int srcStride[], int srcSliceY, int srcSliceH,
19901990 uint8_t *const dst[], const int dstStride[])
19911991 {
1992− ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
1992+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
19931993 dst[0], dstStride[0]);
19941994
19951995 planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->chrSrcW,
@@ -1997,7 +1997,7 @@ static int yvu9ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
19971997 planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->chrSrcW,
19981998 srcSliceH >> 2, srcStride[2], dstStride[2]);
19991999 if (dst[3])
2000− fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
2000+ fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
20012001 return srcSliceH;
20022002 }
20032003
@@ -2011,7 +2011,7 @@ static int uint_y_to_float_y_wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
20112011 float *dstPtr = (float *)(dst[0] + dstStride[0] * srcSliceY);
20122012
20132013 for (y = 0; y < srcSliceH; ++y){
2014− for (x = 0; x < c->srcW; ++x){
2014+ for (x = 0; x < c->opts.src_w; ++x){
20152015 dstPtr[x] = c->uint2float_lut[srcPtr[x]];
20162016 }
20172017 srcPtr += srcStride[0];
@@ -2033,7 +2033,7 @@ static int float_y_to_uint_y_wrapper(SwsInternal *c, · 15 unmodified lines
20332033 uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
20342034
20352035 for (y = 0; y < srcSliceH; ++y){
2036− for (x = 0; x < c->srcW; ++x){
2036+ for (x = 0; x < c->opts.src_w; ++x){
20372037 dstPtr[x] = av_clip_uint8(lrintf(255.0f * srcPtr[x]));
20382038 }
20392039 srcPtr += srcStrideFloat;
@@ -2057,9 +2057,9 @@ static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 17 unmodified lines
20572057 int length = 0;
20582058
20592059 /* universal length finder */
2060− while (length + c->srcW <= FFABS(dstStride[0]) &&
2061− length + c->srcW <= FFABS(srcStride[0]))
2062− length += c->srcW;
2060+ while (length + c->opts.src_w <= FFABS(dstStride[0]) &&
2061+ length + c->opts.src_w <= FFABS(srcStride[0]))
2062+ length += c->opts.src_w;
20632063 av_assert1(length != 0);
20642064
20652065 for (i = 0; i < srcSliceH; i++) {
@@ -2073,7 +2073,7 @@ static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
20732073
20742074 #define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\
20752075 unsigned shift= src_depth-dst_depth, tmp;\
2076− if (c->dither == SWS_DITHER_NONE) {\
2076+ if (c->opts.dither == SWS_DITHER_NONE) {\
20772077 for (i = 0; i < height; i++) {\
20782078 for (j = 0; j < length-7; j+=8) {\
20792079 dst[j+0] = dbswap(bswap(src[j+0])>>shift);\
@@ -2135,31 +2135,31 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 55 unmodified lines
21352135 const int srcStride[], int srcSliceY, int srcSliceH,
21362136 uint8_t *const dst[], const int dstStride[])
21372137 {
2138− const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);
2139− const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat);
2138+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->opts.src_format);
2139+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
21402140 int plane, i, j;
21412141 for (plane = 0; plane < 4 && dst[plane] != NULL; plane++) {
2142− int length = (plane == 0 || plane == 3) ? c->srcW : AV_CEIL_RSHIFT(c->srcW, c->chrDstHSubSample);
2142+ int length = (plane == 0 || plane == 3) ? c->opts.src_w : AV_CEIL_RSHIFT(c->opts.src_w, c->chrDstHSubSample);
21432143 int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample);
21442144 int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample);
21452145 const uint8_t *srcPtr = src[plane];
21462146 uint8_t *dstPtr = dst[plane] + dstStride[plane] * y;
2147− int shiftonly = plane == 1 || plane == 2 || (!c->srcRange && plane == 0);
2147+ int shiftonly = plane == 1 || plane == 2 || (!c->opts.src_range && plane == 0);
21482148
21492149 // ignore palette for GRAY8
21502150 if (plane == 1 && !dst[2]) continue;
21512151 if (!src[plane] || (plane == 1 && !src[2])) {
2152− if (is16BPS(c->dstFormat) || isNBPS(c->dstFormat)) {
2152+ if (is16BPS(c->opts.dst_format) || isNBPS(c->opts.dst_format)) {
21532153 fillPlane16(dst[plane], dstStride[plane], length, height, y,
21542154 plane == 3, desc_dst->comp[plane].depth,
2155− isBE(c->dstFormat));
2155+ isBE(c->opts.dst_format));
21562156 } else {
21572157 fillPlane(dst[plane], dstStride[plane], length, height, y,
21582158 (plane == 3) ? 255 : 128);
21592159 }
21602160 } else {
2161− if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat)
2162− || (is16BPS(c->srcFormat) != is16BPS(c->dstFormat))
2161+ if(isNBPS(c->opts.src_format) || isNBPS(c->opts.dst_format)
2162+ || (is16BPS(c->opts.src_format) != is16BPS(c->opts.dst_format))
21632163 ) {
21642164 const int src_depth = desc_src->comp[plane].depth;
21652165 const int dst_depth = desc_dst->comp[plane].depth;
@@ -2167,7 +2167,7 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
21672167 uint16_t *dstPtr2 = (uint16_t*)dstPtr;
21682168
21692169 if (dst_depth == 8) {
2170− if(isBE(c->srcFormat) == HAVE_BIGENDIAN){
2170+ if(isBE(c->opts.src_format) == HAVE_BIGENDIAN){
21712171 DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , )
21722172 } else {
21732173 DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16, )
@@ -2183,7 +2183,7 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 9 unmodified lines
21832183 w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |\
21842184 (srcPtr[j]>>(2*8-dst_depth)));\
21852185 }
2186− if(isBE(c->dstFormat)){
2186+ if(isBE(c->opts.dst_format)){
21872187 COPY816(AV_WB16)
21882188 } else {
21892189 COPY816(AV_WL16)
@@ -2194,8 +2194,8 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 4 unmodified lines
21942194 } else if (src_depth <= dst_depth) {
21952195 for (i = 0; i < height; i++) {
21962196 j = 0;
2197− if(isBE(c->srcFormat) == HAVE_BIGENDIAN &&
2198− isBE(c->dstFormat) == HAVE_BIGENDIAN &&
2197+ if(isBE(c->opts.src_format) == HAVE_BIGENDIAN &&
2198+ isBE(c->opts.dst_format) == HAVE_BIGENDIAN &&
21992199 shiftonly) {
22002200 unsigned shift = dst_depth - src_depth;
22012201 #if HAVE_FAST_64BIT
@@ -2230,14 +2230,14 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 28 unmodified lines
22302230 (v>>(2*src_depth-dst_depth)));\
22312231 }\
22322232 }
2233− if(isBE(c->srcFormat)){
2234− if(isBE(c->dstFormat)){
2233+ if(isBE(c->opts.src_format)){
2234+ if(isBE(c->opts.dst_format)){
22352235 COPY_UP(AV_RB16, AV_WB16)
22362236 } else {
22372237 COPY_UP(AV_RB16, AV_WL16)
22382238 }
22392239 } else {
2240− if(isBE(c->dstFormat)){
2240+ if(isBE(c->opts.dst_format)){
22412241 COPY_UP(AV_RL16, AV_WB16)
22422242 } else {
22432243 COPY_UP(AV_RL16, AV_WL16)
@@ -2247,22 +2247,22 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 3 unmodified lines
22472247 srcPtr2 += srcStride[plane]/2;
22482248 }
22492249 } else {
2250− if(isBE(c->srcFormat) == HAVE_BIGENDIAN){
2251− if(isBE(c->dstFormat) == HAVE_BIGENDIAN){
2250+ if(isBE(c->opts.src_format) == HAVE_BIGENDIAN){
2251+ if(isBE(c->opts.dst_format) == HAVE_BIGENDIAN){
22522252 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , )
22532253 } else {
22542254 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16)
22552255 }
22562256 }else{
2257− if(isBE(c->dstFormat) == HAVE_BIGENDIAN){
2257+ if(isBE(c->opts.dst_format) == HAVE_BIGENDIAN){
22582258 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, )
22592259 } else {
22602260 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16)
22612261 }
22622262 }
22632263 }
2264− } else if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat) &&
2265− isBE(c->srcFormat) != isBE(c->dstFormat)) {
2264+ } else if (is16BPS(c->opts.src_format) && is16BPS(c->opts.dst_format) &&
2265+ isBE(c->opts.src_format) != isBE(c->opts.dst_format)) {
22662266
22672267 for (i = 0; i < height; i++) {
22682268 for (j = 0; j < length; j++)
@@ -2270,8 +2270,8 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
22702270 srcPtr += srcStride[plane];
22712271 dstPtr += dstStride[plane];
22722272 }
2273− } else if (isFloat(c->srcFormat) && isFloat(c->dstFormat) &&
2274− isBE(c->srcFormat) != isBE(c->dstFormat)) { /* swap float plane */
2273+ } else if (isFloat(c->opts.src_format) && isFloat(c->opts.dst_format) &&
2274+ isBE(c->opts.src_format) != isBE(c->opts.dst_format)) { /* swap float plane */
22752275 for (i = 0; i < height; i++) {
22762276 for (j = 0; j < length; j++)
22772277 ((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]);
@@ -2283,7 +2283,7 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
22832283 memcpy(dst[plane] + dstStride[plane] * y, src[plane],
22842284 height * dstStride[plane]);
22852285 } else {
2286− if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat))
2286+ if (is16BPS(c->opts.src_format) && is16BPS(c->opts.dst_format))
22872287 length *= 2;
22882288 else if (desc_src->comp[0].depth == 1)
22892289 length >>= 3; // monowhite/black
@@ -2306,11 +2306,11 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
23062306
23072307 void ff_get_unscaled_swscale(SwsInternal *c)
23082308 {
2309− const enum AVPixelFormat srcFormat = c->srcFormat;
2310− const enum AVPixelFormat dstFormat = c->dstFormat;
2311− const int flags = c->flags;
2312− const int dstH = c->dstH;
2313− const int dstW = c->dstW;
2309+ const enum AVPixelFormat srcFormat = c->opts.src_format;
2310+ const enum AVPixelFormat dstFormat = c->opts.dst_format;
2311+ const int flags = c->opts.flags;
2312+ const int dstH = c->opts.dst_h;
2313+ const int dstW = c->opts.dst_w;
23142314 int needsDither;
23152315
23162316 needsDither = isAnyRGB(dstFormat) &&
@@ -2340,7 +2340,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 23 unmodified lines
23402340 /* yuv2bgr */
23412341 if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P ||
23422342 srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) &&
2343− !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) {
2343+ !(flags & SWS_ACCURATE_RND) && (c->opts.dither == SWS_DITHER_BAYER || c->opts.dither == SWS_DITHER_AUTO) && !(dstH & 1)) {
23442344 c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c);
23452345 c->dst_slice_align = 2;
23462346 }
@@ -2377,7 +2377,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 30 unmodified lines
23772377
23782378 /* RGB/BGR -> RGB/BGR (no dither needed forms) */
23792379 if (isAnyRGB(srcFormat) && isAnyRGB(dstFormat) && findRgbConvFn(c)
2380− && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
2380+ && (!needsDither || (c->opts.flags&(SWS_FAST_BILINEAR|SWS_POINT))))
23812381 c->convert_unscaled = rgbToRgbWrapper;
23822382
23832383 /* RGB to planar RGB */
@@ -2548,7 +2548,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 164 unmodified lines
25482548 }
25492549
25502550 /* LQ converters if -sws 0 or -sws 4*/
2551− if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
2551+ if (c->opts.flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
25522552 /* yv12_to_yuy2 */
25532553 if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) {
25542554 if (dstFormat == AV_PIX_FMT_YUYV422)
@@ -2584,7 +2584,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 29 unmodified lines
25842584 c->chrDstVSubSample == c->chrSrcVSubSample &&
25852585 !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat))))
25862586 {
2587− if (isPacked(c->srcFormat))
2587+ if (isPacked(c->opts.src_format))
25882588 c->convert_unscaled = packedCopyWrapper;
25892589 else /* Planar YUV or gray */
25902590 c->convert_unscaled = planarCopyWrapper;
libswscale/utils.c+142−133
@@ -298,17 +298,17 @@ static SwsContext *alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcForm · 297 unmodified lines
298298 if (!c)
299299 return NULL;
300300
301− c->flags = flags;
302− c->srcW = srcW;
303− c->srcH = srcH;
304− c->dstW = dstW;
305− c->dstH = dstH;
306− c->srcFormat = srcFormat;
307− c->dstFormat = dstFormat;
301+ c->opts.flags = flags;
302+ c->opts.src_w = srcW;
303+ c->opts.src_h = srcH;
304+ c->opts.dst_w = dstW;
305+ c->opts.dst_h = dstH;
306+ c->opts.src_format = srcFormat;
307+ c->opts.dst_format = dstFormat;
308308
309309 if (param) {
310− c->param[0] = param[0];
311− c->param[1] = param[1];
310+ c->opts.scaler_params[0] = param[0];
311+ c->opts.scaler_params[1] = param[1];
312312 }
313313
314314 return sws;
@@ -1030,10 +1030,10 @@ static int handle_xyz(enum AVPixelFormat *format) · 715 unmodified lines
10301030
10311031 static void handle_formats(SwsInternal *c)
10321032 {
1033− c->src0Alpha |= handle_0alpha(&c->srcFormat);
1034− c->dst0Alpha |= handle_0alpha(&c->dstFormat);
1035− c->srcXYZ |= handle_xyz(&c->srcFormat);
1036− c->dstXYZ |= handle_xyz(&c->dstFormat);
1033+ c->src0Alpha |= handle_0alpha(&c->opts.src_format);
1034+ c->dst0Alpha |= handle_0alpha(&c->opts.dst_format);
1035+ c->srcXYZ |= handle_xyz(&c->opts.src_format);
1036+ c->dstXYZ |= handle_xyz(&c->opts.dst_format);
10371037 if (c->srcXYZ || c->dstXYZ)
10381038 fill_xyztables(c);
10391039 }
@@ -1066,16 +1066,16 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 26 unmodified lines
10661066 }
10671067
10681068 handle_formats(c);
1069− desc_dst = av_pix_fmt_desc_get(c->dstFormat);
1070− desc_src = av_pix_fmt_desc_get(c->srcFormat);
1069+ desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
1070+ desc_src = av_pix_fmt_desc_get(c->opts.src_format);
10711071
1072− if(range_override_needed(c->dstFormat))
1072+ if(range_override_needed(c->opts.dst_format))
10731073 dstRange = 0;
1074− if(range_override_needed(c->srcFormat))
1074+ if(range_override_needed(c->opts.src_format))
10751075 srcRange = 0;
10761076
1077− if (c->srcRange != srcRange ||
1078− c->dstRange != dstRange ||
1077+ if (c->opts.src_range != srcRange ||
1078+ c->opts.dst_range != dstRange ||
10791079 c->brightness != brightness ||
10801080 c->contrast != contrast ||
10811081 c->saturation != saturation ||
@@ -1092,8 +1092,8 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 10 unmodified lines
10921092 c->brightness = brightness;
10931093 c->contrast = contrast;
10941094 c->saturation = saturation;
1095− c->srcRange = srcRange;
1096− c->dstRange = dstRange;
1095+ c->opts.src_range = srcRange;
1096+ c->opts.dst_range = dstRange;
10971097
10981098 if (need_reinit)
10991099 ff_sws_init_range_convert(c);
@@ -1107,27 +1107,27 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 7 unmodified lines
11071107 if (!need_reinit)
11081108 return 0;
11091109
1110− if ((isYUV(c->dstFormat) || isGray(c->dstFormat)) && (isYUV(c->srcFormat) || isGray(c->srcFormat))) {
1110+ if ((isYUV(c->opts.dst_format) || isGray(c->opts.dst_format)) && (isYUV(c->opts.src_format) || isGray(c->opts.src_format))) {
11111111 if (!c->cascaded_context[0] &&
11121112 memcmp(c->dstColorspaceTable, c->srcColorspaceTable, sizeof(int) * 4) &&
1113− c->srcW && c->srcH && c->dstW && c->dstH) {
1113+ c->opts.src_w && c->opts.src_h && c->opts.dst_w && c->opts.dst_h) {
11141114 enum AVPixelFormat tmp_format;
11151115 int tmp_width, tmp_height;
1116− int srcW = c->srcW;
1117− int srcH = c->srcH;
1118− int dstW = c->dstW;
1119− int dstH = c->dstH;
1116+ int srcW = c->opts.src_w;
1117+ int srcH = c->opts.src_h;
1118+ int dstW = c->opts.dst_w;
1119+ int dstH = c->opts.dst_h;
11201120 int ret;
11211121 av_log(c, AV_LOG_VERBOSE, "YUV color matrix differs for YUV->YUV, using intermediate RGB to convert\n");
11221122
1123− if (isNBPS(c->dstFormat) || is16BPS(c->dstFormat)) {
1124− if (isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) {
1123+ if (isNBPS(c->opts.dst_format) || is16BPS(c->opts.dst_format)) {
1124+ if (isALPHA(c->opts.src_format) && isALPHA(c->opts.dst_format)) {
11251125 tmp_format = AV_PIX_FMT_BGRA64;
11261126 } else {
11271127 tmp_format = AV_PIX_FMT_BGR48;
11281128 }
11291129 } else {
1130− if (isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) {
1130+ if (isALPHA(c->opts.src_format) && isALPHA(c->opts.dst_format)) {
11311131 tmp_format = AV_PIX_FMT_BGRA;
11321132 } else {
11331133 tmp_format = AV_PIX_FMT_BGR24;
@@ -1147,13 +1147,14 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 13 unmodified lines
11471147 if (ret < 0)
11481148 return ret;
11491149
1150− c->cascaded_context[0] = alloc_set_opts(srcW, srcH, c->srcFormat,
1150+ c->cascaded_context[0] = alloc_set_opts(srcW, srcH, c->opts.src_format,
11511151 tmp_width, tmp_height, tmp_format,
1152− c->flags, c->param);
1152+ c->opts.flags,
1153+ c->opts.scaler_params);
11531154 if (!c->cascaded_context[0])
11541155 return -1;
11551156
1156− sws_internal(c->cascaded_context[0])->alphablend = c->alphablend;
1157+ sws_internal(c->cascaded_context[0])->opts.alpha_blend = c->opts.alpha_blend;
11571158 ret = sws_init_context(c->cascaded_context[0], NULL , NULL);
11581159 if (ret < 0)
11591160 return ret;
@@ -1163,12 +1164,13 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 3 unmodified lines
11631164 brightness, contrast, saturation);
11641165
11651166 c->cascaded_context[1] = alloc_set_opts(tmp_width, tmp_height, tmp_format,
1166− dstW, dstH, c->dstFormat,
1167− c->flags, c->param);
1167+ dstW, dstH, c->opts.dst_format,
1168+ c->opts.flags,
1169+ c->opts.scaler_params);
11681170 if (!c->cascaded_context[1])
11691171 return -1;
1170− sws_internal(c->cascaded_context[1])->srcRange = srcRange;
1171− sws_internal(c->cascaded_context[1])->dstRange = dstRange;
1172+ sws_internal(c->cascaded_context[1])->opts.src_range = srcRange;
1173+ sws_internal(c->cascaded_context[1])->opts.dst_range = dstRange;
11721174 ret = sws_init_context(c->cascaded_context[1], NULL , NULL);
11731175 if (ret < 0)
11741176 return ret;
@@ -1183,7 +1185,7 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 8 unmodified lines
11831185 return 0;
11841186 }
11851187
1186− if (!isYUV(c->dstFormat) && !isGray(c->dstFormat)) {
1188+ if (!isYUV(c->opts.dst_format) && !isGray(c->opts.dst_format)) {
11871189 ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness,
11881190 contrast, saturation);
11891191 // FIXME factorize
@@ -1215,8 +1217,8 @@ int sws_getColorspaceDetails(SwsContext *sws, int **inv_table, · 25 unmodified lines
12151217
12161218 *inv_table = c->srcColorspaceTable;
12171219 *table = c->dstColorspaceTable;
1218− *srcRange = range_override_needed(c->srcFormat) ? 1 : c->srcRange;
1219− *dstRange = range_override_needed(c->dstFormat) ? 1 : c->dstRange;
1220+ *srcRange = range_override_needed(c->opts.src_format) ? 1 : c->opts.src_range;
1221+ *dstRange = range_override_needed(c->opts.dst_format) ? 1 : c->opts.dst_range;
12201222 *brightness = c->brightness;
12211223 *contrast = c->contrast;
12221224 *saturation = c->saturation;
@@ -1229,7 +1231,7 @@ SwsContext *sws_alloc_context(void) · 6 unmodified lines
12291231 SwsInternal *c = av_mallocz(sizeof(SwsInternal));
12301232
12311233 if (c) {
1232− c->av_class = &ff_sws_context_class;
1234+ c->opts.av_class = &ff_sws_context_class;
12331235 av_opt_set_defaults(c);
12341236 atomic_init(&c->stride_unaligned_warned, 0);
12351237 atomic_init(&c->data_unaligned_warned, 0);
@@ -1321,10 +1323,10 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 85 unmodified lines
13211323 int unscaled;
13221324 SwsInternal *c = sws_internal(sws);
13231325 SwsFilter dummyFilter = { NULL, NULL, NULL, NULL };
1324− int srcW = c->srcW;
1325− int srcH = c->srcH;
1326− int dstW = c->dstW;
1327− int dstH = c->dstH;
1326+ int srcW = c->opts.src_w;
1327+ int srcH = c->opts.src_h;
1328+ int dstW = c->opts.dst_w;
1329+ int dstH = c->opts.dst_h;
13281330 int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 66, 16);
13291331 int flags, cpu_flags;
13301332 enum AVPixelFormat srcFormat, dstFormat;
@@ -1335,25 +1337,25 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 4 unmodified lines
13351337 static const float float_mult = 1.0f / 255.0f;
13361338
13371339 cpu_flags = av_get_cpu_flags();
1338− flags = c->flags;
1340+ flags = c->opts.flags;
13391341 emms_c();
13401342
13411343 unscaled = (srcW == dstW && srcH == dstH);
13421344
13431345 if (!c->contrast && !c->saturation && !c->dstFormatBpp)
1344− sws_setColorspaceDetails(sws, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange,
1346+ sws_setColorspaceDetails(sws, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->opts.src_range,
13451347 ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],
1346− c->dstRange, 0, 1 << 16, 1 << 16);
1348+ c->opts.dst_range, 0, 1 << 16, 1 << 16);
13471349
13481350 handle_formats(c);
1349− srcFormat = c->srcFormat;
1350− dstFormat = c->dstFormat;
1351+ srcFormat = c->opts.src_format;
1352+ dstFormat = c->opts.dst_format;
13511353 desc_src = av_pix_fmt_desc_get(srcFormat);
13521354 desc_dst = av_pix_fmt_desc_get(dstFormat);
13531355
13541356 // If the source has no alpha then disable alpha blendaway
13551357 if (c->src0Alpha)
1356− c->alphablend = SWS_ALPHA_BLEND_NONE;
1358+ c->opts.alpha_blend = SWS_ALPHA_BLEND_NONE;
13571359
13581360 if (!(unscaled && sws_isSupportedEndiannessConversion(srcFormat) &&
13591361 av_pix_fmt_swap_endianness(srcFormat) == dstFormat)) {
@@ -1390,7 +1392,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 30 unmodified lines
13901392 flags |= SWS_BICUBIC;
13911393 else
13921394 flags |= SWS_BICUBIC;
1393− c->flags = flags;
1395+ c->opts.flags = flags;
13941396 } else if (i & (i - 1)) {
13951397 av_log(c, AV_LOG_ERROR,
13961398 "Exactly one scaler algorithm must be chosen, got %X\n", i);
@@ -1407,7 +1409,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 10 unmodified lines
14071409 if (flags & SWS_FAST_BILINEAR) {
14081410 if (srcW < 8 || dstW < 8) {
14091411 flags ^= SWS_FAST_BILINEAR | SWS_BILINEAR;
1410− c->flags = flags;
1412+ c->opts.flags = flags;
14111413 }
14121414 }
14131415
@@ -1440,46 +1442,46 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 26 unmodified lines
14401442 if (dstW&1) {
14411443 av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n");
14421444 flags |= SWS_FULL_CHR_H_INT;
1443− c->flags = flags;
1445+ c->opts.flags = flags;
14441446 }
14451447
14461448 if ( c->chrSrcHSubSample == 0
14471449 && c->chrSrcVSubSample == 0
1448− && c->dither != SWS_DITHER_BAYER //SWS_FULL_CHR_H_INT is currently not supported with SWS_DITHER_BAYER
1449− && !(c->flags & SWS_FAST_BILINEAR)
1450+ && c->opts.dither != SWS_DITHER_BAYER //SWS_FULL_CHR_H_INT is currently not supported with SWS_DITHER_BAYER
1451+ && !(c->opts.flags & SWS_FAST_BILINEAR)
14501452 ) {
14511453 av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to input having non subsampled chroma\n");
14521454 flags |= SWS_FULL_CHR_H_INT;
1453− c->flags = flags;
1455+ c->opts.flags = flags;
14541456 }
14551457 }
14561458
1457− if (c->dither == SWS_DITHER_AUTO) {
1459+ if (c->opts.dither == SWS_DITHER_AUTO) {
14581460 if (flags & SWS_ERROR_DIFFUSION)
1459− c->dither = SWS_DITHER_ED;
1461+ c->opts.dither = SWS_DITHER_ED;
14601462 }
14611463
14621464 if(dstFormat == AV_PIX_FMT_BGR4_BYTE ||
14631465 dstFormat == AV_PIX_FMT_RGB4_BYTE ||
14641466 dstFormat == AV_PIX_FMT_BGR8 ||
14651467 dstFormat == AV_PIX_FMT_RGB8) {
1466− if (c->dither == SWS_DITHER_AUTO)
1467− c->dither = (flags & SWS_FULL_CHR_H_INT) ? SWS_DITHER_ED : SWS_DITHER_BAYER;
1468+ if (c->opts.dither == SWS_DITHER_AUTO)
1469+ c->opts.dither = (flags & SWS_FULL_CHR_H_INT) ? SWS_DITHER_ED : SWS_DITHER_BAYER;
14681470 if (!(flags & SWS_FULL_CHR_H_INT)) {
1469− if (c->dither == SWS_DITHER_ED || c->dither == SWS_DITHER_A_DITHER || c->dither == SWS_DITHER_X_DITHER || c->dither == SWS_DITHER_NONE) {
1471+ if (c->opts.dither == SWS_DITHER_ED || c->opts.dither == SWS_DITHER_A_DITHER || c->opts.dither == SWS_DITHER_X_DITHER || c->opts.dither == SWS_DITHER_NONE) {
14701472 av_log(c, AV_LOG_DEBUG,
14711473 "Desired dithering only supported in full chroma interpolation for destination format '%s'\n",
14721474 av_get_pix_fmt_name(dstFormat));
14731475 flags |= SWS_FULL_CHR_H_INT;
1474− c->flags = flags;
1476+ c->opts.flags = flags;
14751477 }
14761478 }
14771479 if (flags & SWS_FULL_CHR_H_INT) {
1478− if (c->dither == SWS_DITHER_BAYER) {
1480+ if (c->opts.dither == SWS_DITHER_BAYER) {
14791481 av_log(c, AV_LOG_DEBUG,
14801482 "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n",
14811483 av_get_pix_fmt_name(dstFormat));
1482− c->dither = SWS_DITHER_ED;
1484+ c->opts.dither = SWS_DITHER_ED;
14831485 }
14841486 }
14851487 }
@@ -1489,7 +1491,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 3 unmodified lines
14891491 "%s output is not supported with half chroma resolution, switching to full\n",
14901492 av_get_pix_fmt_name(dstFormat));
14911493 flags |= SWS_FULL_CHR_H_INT;
1492− c->flags = flags;
1494+ c->opts.flags = flags;
14931495 }
14941496 }
14951497
@@ -1523,7 +1525,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 27 unmodified lines
15231525 "full chroma interpolation for destination format '%s' not yet implemented\n",
15241526 av_get_pix_fmt_name(dstFormat));
15251527 flags &= ~SWS_FULL_CHR_H_INT;
1526− c->flags = flags;
1528+ c->opts.flags = flags;
15271529 }
15281530 if (isAnyRGB(dstFormat) && !(flags & SWS_FULL_CHR_H_INT))
15291531 c->chrDstHSubSample = 1;
@@ -1585,7 +1587,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 55 unmodified lines
15851587 av_log(c, AV_LOG_INFO,
15861588 "output width is not a multiple of 32 -> no MMXEXT scaler\n");
15871589 }
1588− if (usesHFilter || isNBPS(c->srcFormat) || is16BPS(c->srcFormat) || isAnyRGB(c->srcFormat))
1590+ if (usesHFilter || isNBPS(c->opts.src_format) || is16BPS(c->opts.src_format) || isAnyRGB(c->opts.src_format))
15891591 c->canMMXEXTBeUsed = 0;
15901592 } else
15911593 c->canMMXEXTBeUsed = 0;
@@ -1617,7 +1619,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 25 unmodified lines
16171619 tmpFmt = AV_PIX_FMT_RGBA64LE;
16181620
16191621
1620− if (!unscaled && c->gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) {
1622+ if (!unscaled && c->opts.gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) {
16211623 SwsInternal *c2;
16221624 c->cascaded_context[0] = NULL;
16231625
@@ -1628,14 +1630,16 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 4 unmodified lines
16281630
16291631 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
16301632 srcW, srcH, tmpFmt,
1631− flags, NULL, NULL, c->param);
1633+ flags, NULL, NULL,
1634+ c->opts.scaler_params);
16321635 if (!c->cascaded_context[0]) {
16331636 return AVERROR(ENOMEM);
16341637 }
16351638
16361639 c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFmt,
16371640 dstW, dstH, tmpFmt,
1638− flags, srcFilter, dstFilter, c->param);
1641+ flags, srcFilter, dstFilter,
1642+ c->opts.scaler_params);
16391643
16401644 if (!c->cascaded_context[1])
16411645 return AVERROR(ENOMEM);
@@ -1665,8 +1669,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 23 unmodified lines
16651669 return ret;
16661670
16671671 c->cascaded_context[2] = sws_getContext(dstW, dstH, tmpFmt,
1668− dstW, dstH, dstFormat,
1669− flags, NULL, NULL, c->param);
1672+ dstW, dstH, dstFormat,
1673+ flags, NULL, NULL,
1674+ c->opts.scaler_params);
16701675 if (!c->cascaded_context[2])
16711676 return AVERROR(ENOMEM);
16721677 }
@@ -1686,13 +1691,15 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 13 unmodified lines
16861691
16871692 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
16881693 srcW, srcH, tmpFormat,
1689− flags, srcFilter, NULL, c->param);
1694+ flags, srcFilter, NULL,
1695+ c->opts.scaler_params);
16901696 if (!c->cascaded_context[0])
16911697 return AVERROR(ENOMEM);
16921698
16931699 c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFormat,
16941700 dstW, dstH, dstFormat,
1695− flags, NULL, dstFilter, c->param);
1701+ flags, NULL, dstFilter,
1702+ c->opts.scaler_params);
16961703 if (!c->cascaded_context[1])
16971704 return AVERROR(ENOMEM);
16981705 return 0;
@@ -1715,11 +1722,11 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 16 unmodified lines
17151722 if (CONFIG_SWSCALE_ALPHA && isALPHA(srcFormat) && !isALPHA(dstFormat)) {
17161723 enum AVPixelFormat tmpFormat = alphaless_fmt(srcFormat);
17171724
1718− if (tmpFormat != AV_PIX_FMT_NONE && c->alphablend != SWS_ALPHA_BLEND_NONE) {
1725+ if (tmpFormat != AV_PIX_FMT_NONE && c->opts.alpha_blend != SWS_ALPHA_BLEND_NONE) {
17191726 if (!unscaled ||
17201727 dstFormat != tmpFormat ||
17211728 usesHFilter || usesVFilter ||
1722− c->srcRange != c->dstRange
1729+ c->opts.src_range != c->opts.dst_range
17231730 ) {
17241731 c->cascaded_mainindex = 1;
17251732 ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],
@@ -1729,22 +1736,22 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 3 unmodified lines
17291736
17301737 c->cascaded_context[0] = alloc_set_opts(srcW, srcH, srcFormat,
17311738 srcW, srcH, tmpFormat,
1732− flags, c->param);
1739+ flags, c->opts.scaler_params);
17331740 if (!c->cascaded_context[0])
17341741 return AVERROR(EINVAL);
1735− sws_internal(c->cascaded_context[0])->alphablend = c->alphablend;
1742+ sws_internal(c->cascaded_context[0])->opts.alpha_blend = c->opts.alpha_blend;
17361743 ret = sws_init_context(c->cascaded_context[0], NULL , NULL);
17371744 if (ret < 0)
17381745 return ret;
17391746
17401747 c->cascaded_context[1] = alloc_set_opts(srcW, srcH, tmpFormat,
17411748 dstW, dstH, dstFormat,
1742− flags, c->param);
1749+ flags, c->opts.scaler_params);
17431750 if (!c->cascaded_context[1])
17441751 return AVERROR(EINVAL);
17451752
1746− sws_internal(c->cascaded_context[1])->srcRange = c->srcRange;
1747− sws_internal(c->cascaded_context[1])->dstRange = c->dstRange;
1753+ sws_internal(c->cascaded_context[1])->opts.src_range = c->opts.src_range;
1754+ sws_internal(c->cascaded_context[1])->opts.dst_range = c->opts.dst_range;
17481755 ret = sws_init_context(c->cascaded_context[1], srcFilter , dstFilter);
17491756 if (ret < 0)
17501757 return ret;
@@ -1756,9 +1763,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 5 unmodified lines
17561763
17571764 /* alpha blend special case, note this has been split via cascaded contexts if its scaled */
17581765 if (unscaled && !usesHFilter && !usesVFilter &&
1759− c->alphablend != SWS_ALPHA_BLEND_NONE &&
1766+ c->opts.alpha_blend != SWS_ALPHA_BLEND_NONE &&
17601767 isALPHA(srcFormat) &&
1761− (c->srcRange == c->dstRange || isAnyRGB(dstFormat)) &&
1768+ (c->opts.src_range == c->opts.dst_range || isAnyRGB(dstFormat)) &&
17621769 alphaless_fmt(srcFormat) == dstFormat
17631770 ) {
17641771 c->convert_unscaled = ff_sws_alphablendaway;
@@ -1772,7 +1779,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 7 unmodified lines
17721779
17731780 /* unscaled special cases */
17741781 if (unscaled && !usesHFilter && !usesVFilter &&
1775− (c->srcRange == c->dstRange || isAnyRGB(dstFormat) ||
1782+ (c->opts.src_range == c->opts.dst_range || isAnyRGB(dstFormat) ||
17761783 isFloat(srcFormat) || isFloat(dstFormat) || isBayer(srcFormat))){
17771784
17781785 ff_get_unscaled_swscale(c);
@@ -1868,7 +1875,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 89 unmodified lines
18681875 srcW, dstW, filterAlign, 1 << 14,
18691876 (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
18701877 cpu_flags, srcFilter->lumH, dstFilter->lumH,
1871− c->param,
1878+ c->opts.scaler_params,
18721879 get_local_pos(c, 0, 0, 0),
18731880 get_local_pos(c, 0, 0, 0))) < 0)
18741881 goto fail;
@@ -1879,9 +1886,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 4 unmodified lines
18791886 c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,
18801887 (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
18811888 cpu_flags, srcFilter->chrH, dstFilter->chrH,
1882− c->param,
1883− get_local_pos(c, c->chrSrcHSubSample, c->src_h_chr_pos, 0),
1884− get_local_pos(c, c->chrDstHSubSample, c->dst_h_chr_pos, 0))) < 0)
1889+ c->opts.scaler_params,
1890+ get_local_pos(c, c->chrSrcHSubSample, c->opts.src_h_chr_pos, 0),
1891+ get_local_pos(c, c->chrDstHSubSample, c->opts.dst_h_chr_pos, 0))) < 0)
18851892 goto fail;
18861893 if (ff_shuffle_filter_coefficients(c, c->hChrFilterPos, c->hChrFilterSize, c->hChrFilter, c->chrDstW) < 0)
18871894 goto nomem;
@@ -1898,7 +1905,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 10 unmodified lines
18981905 c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
18991906 (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
19001907 cpu_flags, srcFilter->lumV, dstFilter->lumV,
1901− c->param,
1908+ c->opts.scaler_params,
19021909 get_local_pos(c, 0, 0, 1),
19031910 get_local_pos(c, 0, 0, 1))) < 0)
19041911 goto fail;
@@ -1907,18 +1914,18 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 2 unmodified lines
19071914 filterAlign, (1 << 12),
19081915 (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
19091916 cpu_flags, srcFilter->chrV, dstFilter->chrV,
1910− c->param,
1911− get_local_pos(c, c->chrSrcVSubSample, c->src_v_chr_pos, 1),
1912− get_local_pos(c, c->chrDstVSubSample, c->dst_v_chr_pos, 1))) < 0)
1917+ c->opts.scaler_params,
1918+ get_local_pos(c, c->chrSrcVSubSample, c->opts.src_v_chr_pos, 1),
1919+ get_local_pos(c, c->chrDstVSubSample, c->opts.dst_v_chr_pos, 1))) < 0)
19131920
19141921 goto fail;
19151922
19161923 #if HAVE_ALTIVEC
1917− if (!FF_ALLOC_TYPED_ARRAY(c->vYCoeffsBank, c->vLumFilterSize * c->dstH) ||
1924+ if (!FF_ALLOC_TYPED_ARRAY(c->vYCoeffsBank, c->vLumFilterSize * c->opts.dst_h) ||
19181925 !FF_ALLOC_TYPED_ARRAY(c->vCCoeffsBank, c->vChrFilterSize * c->chrDstH))
19191926 goto nomem;
19201927
1921− for (i = 0; i < c->vLumFilterSize * c->dstH; i++) {
1928+ for (i = 0; i < c->vLumFilterSize * c->opts.dst_h; i++) {
19221929 int j;
19231930 short *p = (short *)&c->vYCoeffsBank[i];
19241931 for (j = 0; j < 8; j++)
@@ -1935,10 +1942,10 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 10 unmodified lines
19351942 }
19361943
19371944 for (i = 0; i < 4; i++)
1938− if (!FF_ALLOCZ_TYPED_ARRAY(c->dither_error[i], c->dstW + 3))
1945+ if (!FF_ALLOCZ_TYPED_ARRAY(c->dither_error[i], c->opts.dst_w + 3))
19391946 goto nomem;
19401947
1941− c->needAlpha = (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) ? 1 : 0;
1948+ c->needAlpha = (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format) && isALPHA(c->opts.dst_format)) ? 1 : 0;
19421949
19431950 // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate)
19441951 c->uv_off = (dst_stride>>1) + 64 / (c->dstBpc &~ 7);
@@ -1980,7 +1987,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 35 unmodified lines
19801987 av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
19811988 av_log(c, AV_LOG_DEBUG,
19821989 "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
1983− c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
1990+ c->opts.src_w, c->opts.src_h, c->opts.dst_w, c->opts.dst_h, c->lumXInc, c->lumYInc);
19841991 av_log(c, AV_LOG_DEBUG,
19851992 "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
19861993 c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH,
@@ -2011,13 +2018,15 @@ fail: // FIXME replace things by appropriate error codes · 24 unmodified lines
20112018
20122019 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
20132020 tmpW, tmpH, tmpFormat,
2014− flags, srcFilter, NULL, c->param);
2021+ flags, srcFilter, NULL,
2022+ c->opts.scaler_params);
20152023 if (!c->cascaded_context[0])
20162024 return AVERROR(ENOMEM);
20172025
20182026 c->cascaded_context[1] = sws_getContext(tmpW, tmpH, tmpFormat,
20192027 dstW, dstH, dstFormat,
2020− flags, NULL, dstFilter, c->param);
2028+ flags, NULL, dstFilter,
2029+ c->opts.scaler_params);
20212030 if (!c->cascaded_context[1])
20222031 return AVERROR(ENOMEM);
20232032 return 0;
@@ -2032,21 +2041,21 @@ static int context_init_threaded(SwsContext *sws, · 8 unmodified lines
20322041 int ret;
20332042
20342043 ret = avpriv_slicethread_create(&c->slicethread, (void*) sws,
2035− ff_sws_slice_worker, NULL, c->nb_threads);
2044+ ff_sws_slice_worker, NULL, c->opts.threads);
20362045 if (ret == AVERROR(ENOSYS)) {
2037− c->nb_threads = 1;
2046+ c->opts.threads = 1;
20382047 return 0;
20392048 } else if (ret < 0)
20402049 return ret;
20412050
2042− c->nb_threads = ret;
2051+ c->opts.threads = ret;
20432052
2044− c->slice_ctx = av_calloc(c->nb_threads, sizeof(*c->slice_ctx));
2045− c->slice_err = av_calloc(c->nb_threads, sizeof(*c->slice_err));
2053+ c->slice_ctx = av_calloc(c->opts.threads, sizeof(*c->slice_ctx));
2054+ c->slice_err = av_calloc(c->opts.threads, sizeof(*c->slice_err));
20462055 if (!c->slice_ctx || !c->slice_err)
20472056 return AVERROR(ENOMEM);
20482057
2049− for (int i = 0; i < c->nb_threads; i++) {
2058+ for (int i = 0; i < c->opts.threads; i++) {
20502059 SwsInternal *c2;
20512060 c->slice_ctx[i] = sws_alloc_context();
20522061 if (!c->slice_ctx[i])
@@ -2060,13 +2069,13 @@ static int context_init_threaded(SwsContext *sws, · 7 unmodified lines
20602069 if (ret < 0)
20612070 return ret;
20622071
2063− c2->nb_threads = 1;
2072+ c2->opts.threads = 1;
20642073
20652074 ret = sws_init_single_context(c->slice_ctx[i], src_filter, dst_filter);
20662075 if (ret < 0)
20672076 return ret;
20682077
2069− if (c2->dither == SWS_DITHER_ED) {
2078+ if (c2->opts.dither == SWS_DITHER_ED) {
20702079 av_log(c, AV_LOG_VERBOSE,
20712080 "Error-diffusion dither is in use, scaling will be single-threaded.");
20722081 break;
@@ -2092,17 +2101,17 @@ av_cold int sws_init_context(SwsContext *sws, SwsFilter *srcFilter, · 19 unmodified lines
20922101 if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0)
20932102 return AVERROR_UNKNOWN;
20942103
2095− src_format = c->srcFormat;
2096− dst_format = c->dstFormat;
2097− c->srcRange |= handle_jpeg(&c->srcFormat);
2098− c->dstRange |= handle_jpeg(&c->dstFormat);
2104+ src_format = c->opts.src_format;
2105+ dst_format = c->opts.dst_format;
2106+ c->opts.src_range |= handle_jpeg(&c->opts.src_format);
2107+ c->opts.dst_range |= handle_jpeg(&c->opts.dst_format);
20992108
2100− if (src_format != c->srcFormat || dst_format != c->dstFormat)
2109+ if (src_format != c->opts.src_format || dst_format != c->opts.dst_format)
21012110 av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");
21022111
2103− if (c->nb_threads != 1) {
2112+ if (c->opts.threads != 1) {
21042113 ret = context_init_threaded(sws, srcFilter, dstFilter);
2105− if (ret < 0 || c->nb_threads > 1)
2114+ if (ret < 0 || c->opts.threads > 1)
21062115 return ret;
21072116 // threading disabled in this build, init as single-threaded
21082117 }
@@ -2546,15 +2555,15 @@ SwsContext *sws_getCachedContext(SwsContext *sws, int srcW, · 437 unmodified lines
25462555 param = default_param;
25472556
25482557 if ((context = sws_internal(sws)) &&
2549− (context->srcW != srcW ||
2550− context->srcH != srcH ||
2551− context->srcFormat != srcFormat ||
2552− context->dstW != dstW ||
2553− context->dstH != dstH ||
2554− context->dstFormat != dstFormat ||
2555− context->flags != flags ||
2556− context->param[0] != param[0] ||
2557− context->param[1] != param[1])) {
2558+ (context->opts.src_w != srcW ||
2559+ context->opts.src_h != srcH ||
2560+ context->opts.src_format != srcFormat ||
2561+ context->opts.dst_w != dstW ||
2562+ context->opts.dst_h != dstH ||
2563+ context->opts.dst_format != dstFormat ||
2564+ context->opts.flags != flags ||
2565+ context->opts.scaler_params[0] != param[0] ||
2566+ context->opts.scaler_params[1] != param[1])) {
25582567
25592568 av_opt_get_int(context, "src_h_chr_pos", 0, &src_h_chr_pos);
25602569 av_opt_get_int(context, "src_v_chr_pos", 0, &src_v_chr_pos);
@@ -2568,15 +2577,15 @@ SwsContext *sws_getCachedContext(SwsContext *sws, int srcW, · 7 unmodified lines
25682577 if (!(sws = sws_alloc_context()))
25692578 return NULL;
25702579 context = sws_internal(sws);
2571− context->srcW = srcW;
2572− context->srcH = srcH;
2573− context->srcFormat = srcFormat;
2574− context->dstW = dstW;
2575− context->dstH = dstH;
2576− context->dstFormat = dstFormat;
2577− context->flags = flags;
2578− context->param[0] = param[0];
2579− context->param[1] = param[1];
2580+ context->opts.src_w = srcW;
2581+ context->opts.src_h = srcH;
2582+ context->opts.src_format = srcFormat;
2583+ context->opts.dst_w = dstW;
2584+ context->opts.dst_h = dstH;
2585+ context->opts.dst_format = dstFormat;
2586+ context->opts.flags = flags;
2587+ context->opts.scaler_params[0] = param[0];
2588+ context->opts.scaler_params[1] = param[1];
25802589
25812590 av_opt_set_int(context, "src_h_chr_pos", src_h_chr_pos, 0);
25822591 av_opt_set_int(context, "src_v_chr_pos", src_v_chr_pos, 0);
libswscale/vscale.c+5−5
@@ -93,7 +93,7 @@ static int chr_planar_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int slic · 92 unmodified lines
9393 uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * inst->filter_size);
9494
9595 if (c->yuv2nv12cX) {
96− inst->pfn.yuv2interleavedX(c->dstFormat, c->chrDither8, filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
96+ inst->pfn.yuv2interleavedX(c->opts.dst_format, c->chrDither8, filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
9797 } else if (inst->filter_size == 1) {
9898 inst->pfn.yuv2planar1((const int16_t*)src1[0], dst1[0], dstW, c->chrDither8, 0);
9999 inst->pfn.yuv2planar1((const int16_t*)src2[0], dst2[0], dstW, c->chrDither8, 3);
@@ -216,7 +216,7 @@ int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, Sws · 116 unmodified lines
216216 VScalerContext *lumCtx = NULL;
217217 VScalerContext *chrCtx = NULL;
218218
219− if (isPlanarYUV(c->dstFormat) || (isGray(c->dstFormat) && !isALPHA(c->dstFormat))) {
219+ if (isPlanarYUV(c->opts.dst_format) || (isGray(c->opts.dst_format) && !isALPHA(c->opts.dst_format))) {
220220 lumCtx = av_mallocz(sizeof(VScalerContext));
221221 if (!lumCtx)
222222 return AVERROR(ENOMEM);
@@ -228,7 +228,7 @@ int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, Sws · 5 unmodified lines
228228 desc[0].dst = dst;
229229 desc[0].alpha = c->needAlpha;
230230
231− if (!isGray(c->dstFormat)) {
231+ if (!isGray(c->opts.dst_format)) {
232232 chrCtx = av_mallocz(sizeof(VScalerContext));
233233 if (!chrCtx)
234234 return AVERROR(ENOMEM);
@@ -268,8 +268,8 @@ void ff_init_vscale_pfn(SwsInternal *c, · 33 unmodified lines
268268 VScalerContext *chrCtx = NULL;
269269 int idx = c->numDesc - (c->is_internal_gamma ? 2 : 1); //FIXME avoid hardcoding indexes
270270
271− if (isPlanarYUV(c->dstFormat) || (isGray(c->dstFormat) && !isALPHA(c->dstFormat))) {
272− if (!isGray(c->dstFormat)) {
271+ if (isPlanarYUV(c->opts.dst_format) || (isGray(c->opts.dst_format) && !isALPHA(c->opts.dst_format))) {
272+ if (!isGray(c->opts.dst_format)) {
273273 chrCtx = c->desc[idx].instance;
274274
275275 chrCtx->filter[0] = use_mmx ? (int16_t*)c->chrMmxFilter : c->vChrFilter;
libswscale/x86/output.asm+1−1
@@ -582,7 +582,7 @@ yuv2nv12cX_fn yuv2nv21 · 581 unmodified lines
582582
583583 %if ARCH_X86_64
584584 struc SwsInternal
585− .padding: resb 40292 ; offsetof(SwsInternal, yuv2rgb_y_offset)
585+ .padding: resb 40316 ; offsetof(SwsInternal, yuv2rgb_y_offset)
586586 .yuv2rgb_y_offset: resd 1
587587 .yuv2rgb_y_coeff: resd 1
588588 .yuv2rgb_v2r_coeff: resd 1
libswscale/x86/swscale.c+30−30
@@ -63,8 +63,8 @@ DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL; · 62 unmodified lines
6363
6464 void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
6565 {
66− const int dstH= c->dstH;
67− const int flags= c->flags;
66+ const int dstH= c->opts.dst_h;
67+ const int flags= c->opts.flags;
6868
6969 SwsPlane *lumPlane = &c->slice[c->numSlice-2].plane[0];
7070 SwsPlane *chrUPlane = &c->slice[c->numSlice-2].plane[1];
@@ -85,7 +85,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY) · 14 unmodified lines
8585 const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
8686
8787 c->blueDither= ff_dither8[dstY&1];
88− if (c->dstFormat == AV_PIX_FMT_RGB555 || c->dstFormat == AV_PIX_FMT_BGR555)
88+ if (c->opts.dst_format == AV_PIX_FMT_RGB555 || c->opts.dst_format == AV_PIX_FMT_BGR555)
8989 c->greenDither= ff_dither8[dstY&1];
9090 else
9191 c->greenDither= ff_dither4[dstY&1];
@@ -96,10 +96,10 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY) · 4 unmodified lines
9696 const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;
9797
9898 int i;
99− if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
99+ if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->opts.src_h) {
100100 const int16_t **tmpY = (const int16_t **) lumPlane->tmp;
101101
102− int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
102+ int neg = -firstLumSrcY, i, end = FFMIN(c->opts.src_h - firstLumSrcY, vLumFilterSize);
103103 for (i = 0; i < neg; i++)
104104 tmpY[i] = lumSrcPtr[neg];
105105 for ( ; i < end; i++)
@@ -453,7 +453,7 @@ INPUT_PLANAR_RGB_A_ALL_DECL(avx2); · 347 unmodified lines
453453
454454 #define RANGE_CONVERT_FUNCS(opt) do { \
455455 if (c->dstBpc <= 14) { \
456− if (c->srcRange) { \
456+ if (c->opts.src_range) { \
457457 c->lumConvertRange = ff_lumRangeFromJpeg_ ##opt; \
458458 c->chrConvertRange = ff_chrRangeFromJpeg_ ##opt; \
459459 } else { \
@@ -490,7 +490,7 @@ av_cold void ff_sws_init_swscale_x86(SwsInternal *c) · 30 unmodified lines
490490 if (INLINE_MMXEXT(cpu_flags))
491491 sws_init_swscale_mmxext(c);
492492 #endif
493− if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)) {
493+ if(c->use_mmx_vfilter && !(c->opts.flags & SWS_ACCURATE_RND)) {
494494 #if HAVE_MMXEXT_EXTERNAL
495495 if (EXTERNAL_MMXEXT(cpu_flags))
496496 c->yuv2planeX = yuv2yuvX_mmxext;
@@ -526,7 +526,7 @@ av_cold void ff_sws_init_swscale_x86(SwsInternal *c) · 29 unmodified lines
526526 } else if (c->srcBpc == 12) { \
527527 hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
528528 ff_hscale12to19_ ## filtersize ## _ ## opt1; \
529− } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth<16)) { \
529+ } else if (c->srcBpc == 14 || ((c->opts.src_format==AV_PIX_FMT_PAL8||isAnyRGB(c->opts.src_format)) && av_pix_fmt_desc_get(c->opts.src_format)->comp[0].depth<16)) { \
530530 hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
531531 ff_hscale14to19_ ## filtersize ## _ ## opt1; \
532532 } else { /* c->srcBpc == 16 */ \
@@ -538,15 +538,15 @@ av_cold void ff_sws_init_swscale_x86(SwsInternal *c) · 5 unmodified lines
538538 #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
539539 switch(c->dstBpc){ \
540540 case 16: do_16_case; break; \
541− case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
542− case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
541+ case 10: if (!isBE(c->opts.dst_format) && !isSemiPlanarYUV(c->opts.dst_format)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
542+ case 9: if (!isBE(c->opts.dst_format)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
543543 case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
544544 }
545545 #define ASSIGN_VSCALE_FUNC(vscalefn, opt) \
546546 switch(c->dstBpc){ \
547− case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \
548− case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2plane1_10_ ## opt; break; \
549− case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \
547+ case 16: if (!isBE(c->opts.dst_format)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \
548+ case 10: if (!isBE(c->opts.dst_format) && !isSemiPlanarYUV(c->opts.dst_format)) vscalefn = ff_yuv2plane1_10_ ## opt; break; \
549+ case 9: if (!isBE(c->opts.dst_format)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \
550550 case 8: vscalefn = ff_yuv2plane1_8_ ## opt; break; \
551551 default: av_assert0(c->dstBpc>8); \
552552 }
@@ -569,10 +569,10 @@ switch(c->dstBpc){ \ · 16 unmodified lines
569569 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
570570 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
571571 HAVE_ALIGNED_STACK || ARCH_X86_64);
572− if (!(c->flags & SWS_ACCURATE_RND))
572+ if (!(c->opts.flags & SWS_ACCURATE_RND))
573573 ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2);
574574
575− switch (c->srcFormat) {
575+ switch (c->opts.src_format) {
576576 case AV_PIX_FMT_YA8:
577577 c->lumToYV12 = ff_yuyvToY_sse2;
578578 if (c->needAlpha)
@@ -605,7 +605,7 @@ switch(c->dstBpc){ \ · 26 unmodified lines
605605 if (EXTERNAL_SSSE3(cpu_flags)) {
606606 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
607607 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
608− switch (c->srcFormat) {
608+ switch (c->opts.src_format) {
609609 case_rgb(rgb24, RGB24, ssse3);
610610 case_rgb(bgr24, BGR24, ssse3);
611611 default:
@@ -617,19 +617,19 @@ switch(c->dstBpc){ \ · 5 unmodified lines
617617 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
618618 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
619619 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
620− if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4,
620+ if (!isBE(c->opts.dst_format)) c->yuv2planeX = ff_yuv2planeX_16_sse4,
621621 HAVE_ALIGNED_STACK || ARCH_X86_64);
622− if (c->dstBpc == 16 && !isBE(c->dstFormat) && !(c->flags & SWS_ACCURATE_RND))
622+ if (c->dstBpc == 16 && !isBE(c->opts.dst_format) && !(c->opts.flags & SWS_ACCURATE_RND))
623623 c->yuv2plane1 = ff_yuv2plane1_16_sse4;
624624 }
625625
626626 if (EXTERNAL_AVX(cpu_flags)) {
627627 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
628628 HAVE_ALIGNED_STACK || ARCH_X86_64);
629− if (!(c->flags & SWS_ACCURATE_RND))
629+ if (!(c->opts.flags & SWS_ACCURATE_RND))
630630 ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx);
631631
632− switch (c->srcFormat) {
632+ switch (c->opts.src_format) {
633633 case AV_PIX_FMT_YUYV422:
634634 c->chrToYV12 = ff_yuyvToUV_avx;
635635 break;
@@ -670,7 +670,7 @@ switch(c->dstBpc){ \ · 34 unmodified lines
670670
671671 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
672672 if (ARCH_X86_64)
673− switch (c->srcFormat) {
673+ switch (c->opts.src_format) {
674674 case_rgb(rgb24, RGB24, avx2);
675675 case_rgb(bgr24, BGR24, avx2);
676676 case_rgb(bgra, BGRA, avx2);
@@ -678,8 +678,8 @@ switch(c->dstBpc){ \ · 1 unmodified line
678678 case_rgb(abgr, ABGR, avx2);
679679 case_rgb(argb, ARGB, avx2);
680680 }
681− if (!(c->flags & SWS_ACCURATE_RND)) // FIXME
682− switch (c->dstFormat) {
681+ if (!(c->opts.flags & SWS_ACCURATE_RND)) // FIXME
682+ switch (c->opts.dst_format) {
683683 case AV_PIX_FMT_NV12:
684684 case AV_PIX_FMT_NV24:
685685 c->yuv2nv12cX = ff_yuv2nv12cX_avx2;
@@ -752,7 +752,7 @@ switch(c->dstBpc){ \ · 66 unmodified lines
752752
753753
754754 if (EXTERNAL_SSE2(cpu_flags)) {
755− switch (c->srcFormat) {
755+ switch (c->opts.src_format) {
756756 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, sse2);
757757 INPUT_PLANER_RGB_UV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse2);
758758 INPUT_PLANER_RGBXX_UV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse2);
@@ -767,7 +767,7 @@ switch(c->dstBpc){ \ · 8 unmodified lines
767767 }
768768
769769 if (EXTERNAL_SSE4(cpu_flags)) {
770− switch (c->srcFormat) {
770+ switch (c->opts.src_format) {
771771 case AV_PIX_FMT_GBRAP:
772772 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse4);
773773 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse4);
@@ -782,14 +782,14 @@ switch(c->dstBpc){ \ · 8 unmodified lines
782782 }
783783
784784 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
785− switch (c->srcFormat) {
785+ switch (c->opts.src_format) {
786786 INPUT_PLANER_RGB_YUVA_ALL_CASES(avx2)
787787 default:
788788 break;
789789 }
790790 }
791791
792− if(c->flags & SWS_FULL_CHR_H_INT) {
792+ if(c->opts.flags & SWS_FULL_CHR_H_INT) {
793793
794794 #define YUV2ANYX_FUNC_CASE(fmt, name, opt) \
795795 case fmt: \
@@ -821,7 +821,7 @@ switch(c->dstBpc){ \ · 25 unmodified lines
821821 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32BE, gbrapf32be, opt)
822822
823823 if (EXTERNAL_SSE2(cpu_flags)) {
824− switch (c->dstFormat) {
824+ switch (c->opts.dst_format) {
825825 YUV2ANYX_GBRAP_CASES(sse2)
826826 default:
827827 break;
@@ -829,7 +829,7 @@ switch(c->dstBpc){ \ · 1 unmodified line
829829 }
830830
831831 if (EXTERNAL_SSE4(cpu_flags)) {
832− switch (c->dstFormat) {
832+ switch (c->opts.dst_format) {
833833 YUV2ANYX_GBRAP_CASES(sse4)
834834 default:
835835 break;
@@ -837,7 +837,7 @@ switch(c->dstBpc){ \ · 1 unmodified line
837837 }
838838
839839 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
840− switch (c->dstFormat) {
840+ switch (c->opts.dst_format) {
841841 YUV2ANYX_GBRAP_CASES(avx2)
842842 default:
843843 break;
libswscale/x86/swscale_template.c+10−10
@@ -1384,15 +1384,15 @@ static void RENAME(yuv2yuyv422_1)(SwsInternal *c, const int16_t *buf0, · 1383 unmodified lines
13841384 }
13851385 static av_cold void RENAME(sws_init_swscale)(SwsInternal *c)
13861386 {
1387− enum AVPixelFormat dstFormat = c->dstFormat;
1387+ enum AVPixelFormat dstFormat = c->opts.dst_format;
13881388
13891389 c->use_mmx_vfilter= 0;
13901390 if (!is16BPS(dstFormat) && !isNBPS(dstFormat) && !isSemiPlanarYUV(dstFormat)
13911391 && dstFormat != AV_PIX_FMT_GRAYF32BE && dstFormat != AV_PIX_FMT_GRAYF32LE
1392− && !(c->flags & SWS_BITEXACT)) {
1393− if (c->flags & SWS_ACCURATE_RND) {
1394− if (!(c->flags & SWS_FULL_CHR_H_INT)) {
1395− switch (c->dstFormat) {
1392+ && !(c->opts.flags & SWS_BITEXACT)) {
1393+ if (c->opts.flags & SWS_ACCURATE_RND) {
1394+ if (!(c->opts.flags & SWS_FULL_CHR_H_INT)) {
1395+ switch (c->opts.dst_format) {
13961396 case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;
13971397 #if HAVE_6REGS
13981398 case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break;
@@ -1405,8 +1405,8 @@ static av_cold void RENAME(sws_init_swscale)(SwsInternal *c) · 6 unmodified lines
14051405 }
14061406 } else {
14071407 c->use_mmx_vfilter= 1;
1408− if (!(c->flags & SWS_FULL_CHR_H_INT)) {
1409− switch (c->dstFormat) {
1408+ if (!(c->opts.flags & SWS_FULL_CHR_H_INT)) {
1409+ switch (c->opts.dst_format) {
14101410 case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break;
14111411 case AV_PIX_FMT_BGR32: c->yuv2packedX = RENAME(yuv2bgr32_X); break;
14121412 #if HAVE_6REGS
@@ -1419,8 +1419,8 @@ static av_cold void RENAME(sws_init_swscale)(SwsInternal *c) · 6 unmodified lines
14191419 }
14201420 }
14211421 }
1422− if (!(c->flags & SWS_FULL_CHR_H_INT)) {
1423− switch (c->dstFormat) {
1422+ if (!(c->opts.flags & SWS_FULL_CHR_H_INT)) {
1423+ switch (c->opts.dst_format) {
14241424 case AV_PIX_FMT_RGB32:
14251425 c->yuv2packed1 = RENAME(yuv2rgb32_1);
14261426 c->yuv2packed2 = RENAME(yuv2rgb32_2);
@@ -1449,7 +1449,7 @@ static av_cold void RENAME(sws_init_swscale)(SwsInternal *c) · 22 unmodified lines
14491449
14501450 if (c->srcBpc == 8 && c->dstBpc <= 14) {
14511451 // Use the new MMX scaler if the MMXEXT one can't be used (it is faster than the x86 ASM one).
1452− if (c->flags & SWS_FAST_BILINEAR && c->canMMXEXTBeUsed) {
1452+ if (c->opts.flags & SWS_FAST_BILINEAR && c->canMMXEXTBeUsed) {
14531453 c->hyscale_fast = ff_hyscale_fast_mmxext;
14541454 c->hcscale_fast = ff_hcscale_fast_mmxext;
14551455 } else {
libswscale/x86/yuv2rgb.c+7−7
@@ -41,11 +41,11 @@ · 40 unmodified lines
4141 #if HAVE_X86ASM
4242
4343 #define YUV2RGB_LOOP(depth) \
44− h_size = (c->dstW + 7) & ~7; \
44+ h_size = (c->opts.dst_w + 7) & ~7; \
4545 if (h_size * depth > FFABS(dstStride[0])) \
4646 h_size -= 8; \
4747 \
48− vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
48+ vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
4949 \
5050 for (y = 0; y < srcSliceH; y++) { \
5151 uint8_t *image = dst[0] + (y + srcSliceY) * dstStride[0]; \
@@ -215,11 +215,11 @@ static inline int yuv420_gbrp_ssse3(SwsInternal *c, const uint8_t *const src[], · 163 unmodified lines
215215 {
216216 int y, h_size, vshift;
217217
218− h_size = (c->dstW + 7) & ~7;
218+ h_size = (c->opts.dst_w + 7) & ~7;
219219 if (h_size * 3 > FFABS(dstStride[0]))
220220 h_size -= 8;
221221
222− vshift = c->srcFormat != AV_PIX_FMT_YUV422P;
222+ vshift = c->opts.src_format != AV_PIX_FMT_YUV422P;
223223
224224 for (y = 0; y < srcSliceH; y++) {
225225 uint8_t *dst_g = dst[0] + (y + srcSliceY) * dstStride[0];
@@ -244,9 +244,9 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c) · 18 unmodified lines
244244 int cpu_flags = av_get_cpu_flags();
245245
246246 if (EXTERNAL_SSSE3(cpu_flags)) {
247− switch (c->dstFormat) {
247+ switch (c->opts.dst_format) {
248248 case AV_PIX_FMT_RGB32:
249− if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
249+ if (c->opts.src_format == AV_PIX_FMT_YUVA420P) {
250250 #if CONFIG_SWSCALE_ALPHA
251251 return yuva420_rgb32_ssse3;
252252 #endif
@@ -254,7 +254,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c) · 1 unmodified line
254254 } else
255255 return yuv420_rgb32_ssse3;
256256 case AV_PIX_FMT_BGR32:
257− if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
257+ if (c->opts.src_format == AV_PIX_FMT_YUVA420P) {
258258 #if CONFIG_SWSCALE_ALPHA
259259 return yuva420_bgr32_ssse3;
260260 #endif
libswscale/yuv2rgb.c+40−40
@@ -155,7 +155,7 @@ const int *sws_getCoefficients(int colorspace) · 154 unmodified lines
155155 const uint8_t av_unused *pv_1 = src[2] + (y >> !yuv422) * srcStride[2]; \
156156 const uint8_t av_unused *pu_2, *pv_2; \
157157 const uint8_t av_unused *pa_1, *pa_2; \
158− unsigned int h_size = c->dstW >> 3; \
158+ unsigned int h_size = c->opts.dst_w >> 3; \
159159 if (nb_dst_planes > 1) { \
160160 dst1_1 = (dst_type *)(dst[1] + (yd) * dstStride[1]); \
161161 dst1_2 = (dst_type *)(dst[1] + (yd + 1) * dstStride[1]); \
@@ -195,7 +195,7 @@ const int *sws_getCoefficients(int colorspace) · 33 unmodified lines
195195 dst2_2 += dst_delta >> ss; \
196196 } \
197197 } \
198− if (c->dstW & (4 >> ss)) { \
198+ if (c->opts.dst_w & (4 >> ss)) { \
199199 int av_unused Y, U, V; \
200200
201201 #define ENDYUV2RGBFUNC() \
@@ -485,9 +485,9 @@ YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0, 1) · 283 unmodified lines
485485 dst_1 += 1;
486486 dst_2 += 1;
487487 }
488− if (c->dstW & 7) {
488+ if (c->opts.dst_w & 7) {
489489 int av_unused Y, U, V;
490− int pixels_left = c->dstW & 7;
490+ int pixels_left = c->opts.dst_w & 7;
491491 const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
492492 char out_1 = 0, out_2 = 0;
493493 g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM];
@@ -575,10 +575,10 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 81 unmodified lines
575575
576576 av_log(c, AV_LOG_WARNING,
577577 "No accelerated colorspace conversion found from %s to %s.\n",
578− av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat));
578+ av_get_pix_fmt_name(c->opts.src_format), av_get_pix_fmt_name(c->opts.dst_format));
579579
580− if (c->srcFormat == AV_PIX_FMT_YUV422P) {
581− switch (c->dstFormat) {
580+ if (c->opts.src_format == AV_PIX_FMT_YUV422P) {
581+ switch (c->opts.dst_format) {
582582 case AV_PIX_FMT_BGR48BE:
583583 case AV_PIX_FMT_BGR48LE:
584584 return yuv422p_bgr48_c;
@@ -587,11 +587,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 2 unmodified lines
587587 return yuv422p_rgb48_c;
588588 case AV_PIX_FMT_ARGB:
589589 case AV_PIX_FMT_ABGR:
590− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat))
590+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format))
591591 return yuva422p_argb_c;
592592 case AV_PIX_FMT_RGBA:
593593 case AV_PIX_FMT_BGRA:
594− return (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) ? yuva422p_rgba_c : yuv422p_rgb32_c;
594+ return (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) ? yuva422p_rgba_c : yuv422p_rgb32_c;
595595 case AV_PIX_FMT_RGB24:
596596 return yuv422p_rgb24_c;
597597 case AV_PIX_FMT_BGR24:
@@ -620,7 +620,7 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 22 unmodified lines
620620 return yuv422p_gbrp_c;
621621 }
622622 } else {
623− switch (c->dstFormat) {
623+ switch (c->opts.dst_format) {
624624 case AV_PIX_FMT_BGR48BE:
625625 case AV_PIX_FMT_BGR48LE:
626626 return yuv2rgb_c_bgr48;
@@ -629,11 +629,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 2 unmodified lines
629629 return yuv2rgb_c_48;
630630 case AV_PIX_FMT_ARGB:
631631 case AV_PIX_FMT_ABGR:
632− if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat))
632+ if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format))
633633 return yuva2argb_c;
634634 case AV_PIX_FMT_RGBA:
635635 case AV_PIX_FMT_BGRA:
636− return (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) ? yuva2rgba_c : yuv2rgb_c_32;
636+ return (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) ? yuva2rgba_c : yuv2rgb_c_32;
637637 case AV_PIX_FMT_RGB24:
638638 return yuv2rgb_c_24_rgb;
639639 case AV_PIX_FMT_BGR24:
@@ -706,29 +706,29 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], · 66 unmodified lines
706706 int fullRange, int brightness,
707707 int contrast, int saturation)
708708 {
709− const int isRgb = c->dstFormat == AV_PIX_FMT_RGB32 ||
710− c->dstFormat == AV_PIX_FMT_RGB32_1 ||
711− c->dstFormat == AV_PIX_FMT_BGR24 ||
712− c->dstFormat == AV_PIX_FMT_RGB565BE ||
713− c->dstFormat == AV_PIX_FMT_RGB565LE ||
714− c->dstFormat == AV_PIX_FMT_RGB555BE ||
715− c->dstFormat == AV_PIX_FMT_RGB555LE ||
716− c->dstFormat == AV_PIX_FMT_RGB444BE ||
717− c->dstFormat == AV_PIX_FMT_RGB444LE ||
718− c->dstFormat == AV_PIX_FMT_X2RGB10BE ||
719− c->dstFormat == AV_PIX_FMT_X2RGB10LE ||
720− c->dstFormat == AV_PIX_FMT_RGB8 ||
721− c->dstFormat == AV_PIX_FMT_RGB4 ||
722− c->dstFormat == AV_PIX_FMT_RGB4_BYTE ||
723− c->dstFormat == AV_PIX_FMT_MONOBLACK;
724− const int isNotNe = c->dstFormat == AV_PIX_FMT_NE(RGB565LE, RGB565BE) ||
725− c->dstFormat == AV_PIX_FMT_NE(RGB555LE, RGB555BE) ||
726− c->dstFormat == AV_PIX_FMT_NE(RGB444LE, RGB444BE) ||
727− c->dstFormat == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||
728− c->dstFormat == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||
729− c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE) ||
730− c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE) ||
731− c->dstFormat == AV_PIX_FMT_NE(X2BGR10LE, X2BGR10BE);
709+ const int isRgb = c->opts.dst_format == AV_PIX_FMT_RGB32 ||
710+ c->opts.dst_format == AV_PIX_FMT_RGB32_1 ||
711+ c->opts.dst_format == AV_PIX_FMT_BGR24 ||
712+ c->opts.dst_format == AV_PIX_FMT_RGB565BE ||
713+ c->opts.dst_format == AV_PIX_FMT_RGB565LE ||
714+ c->opts.dst_format == AV_PIX_FMT_RGB555BE ||
715+ c->opts.dst_format == AV_PIX_FMT_RGB555LE ||
716+ c->opts.dst_format == AV_PIX_FMT_RGB444BE ||
717+ c->opts.dst_format == AV_PIX_FMT_RGB444LE ||
718+ c->opts.dst_format == AV_PIX_FMT_X2RGB10BE ||
719+ c->opts.dst_format == AV_PIX_FMT_X2RGB10LE ||
720+ c->opts.dst_format == AV_PIX_FMT_RGB8 ||
721+ c->opts.dst_format == AV_PIX_FMT_RGB4 ||
722+ c->opts.dst_format == AV_PIX_FMT_RGB4_BYTE ||
723+ c->opts.dst_format == AV_PIX_FMT_MONOBLACK;
724+ const int isNotNe = c->opts.dst_format == AV_PIX_FMT_NE(RGB565LE, RGB565BE) ||
725+ c->opts.dst_format == AV_PIX_FMT_NE(RGB555LE, RGB555BE) ||
726+ c->opts.dst_format == AV_PIX_FMT_NE(RGB444LE, RGB444BE) ||
727+ c->opts.dst_format == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||
728+ c->opts.dst_format == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||
729+ c->opts.dst_format == AV_PIX_FMT_NE(BGR444LE, BGR444BE) ||
730+ c->opts.dst_format == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE) ||
731+ c->opts.dst_format == AV_PIX_FMT_NE(X2BGR10LE, X2BGR10BE);
732732 const int bpp = c->dstFormatBpp;
733733 uint8_t *y_table;
734734 uint16_t *y_table16;
@@ -904,7 +904,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], · 169 unmodified lines
904904 rbase = isRgb ? 20 : 0;
905905 gbase = 10;
906906 bbase = isRgb ? 0 : 20;
907− needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
907+ needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format);
908908 if (!needAlpha)
909909 abase = 30;
910910 ALLOC_YUV_TABLE(table_plane_size * 3 * 4);
@@ -928,12 +928,12 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], · 17 unmodified lines
928928 break;
929929 case 32:
930930 case 64:
931− base = (c->dstFormat == AV_PIX_FMT_RGB32_1 ||
932− c->dstFormat == AV_PIX_FMT_BGR32_1) ? 8 : 0;
931+ base = (c->opts.dst_format == AV_PIX_FMT_RGB32_1 ||
932+ c->opts.dst_format == AV_PIX_FMT_BGR32_1) ? 8 : 0;
933933 rbase = base + (isRgb ? 16 : 0);
934934 gbase = base + 8;
935935 bbase = base + (isRgb ? 0 : 16);
936− needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
936+ needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format);
937937 if (!needAlpha)
938938 abase = (base + 24) & 31;
939939 ALLOC_YUV_TABLE(table_plane_size * 3 * 4);
@@ -953,7 +953,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], · 13 unmodified lines
953953 fill_gv_table(c->table_gV, 4, cgv);
954954 break;
955955 default:
956− if(!isPlanar(c->dstFormat) || bpp <= 24)
956+ if(!isPlanar(c->opts.dst_format) || bpp <= 24)
957957 av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
958958 return AVERROR(EINVAL);
959959 }
tests/checkasm/sw_gbrp.c+8−8
@@ -135,13 +135,13 @@ static void check_output_yuv2gbrp(void) · 134 unmodified lines
135135 fail();
136136
137137 c = sws_internal(sws);
138− c->flags |= SWS_FULL_CHR_H_INT;
138+ c->opts.flags |= SWS_FULL_CHR_H_INT;
139139
140140 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
141141 for (fsi = 0; fsi < FILTER_SIZES; fsi++) {
142142 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
143143 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
144− c->dstFormat = planar_fmts[fmi];
144+ c->opts.dst_format = planar_fmts[fmi];
145145
146146 dstW = input_sizes[isi];
147147 luma_filter_size = filter_sizes[fsi];
@@ -229,8 +229,8 @@ static void check_input_planar_rgb_to_y(void) · 81 unmodified lines
229229 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
230230 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
231231 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
232− c->srcFormat = planar_fmts[fmi];
233− c->dstFormat = AV_PIX_FMT_YUVA444P16;
232+ c->opts.src_format = planar_fmts[fmi];
233+ c->opts.dst_format = AV_PIX_FMT_YUVA444P16;
234234 byte_size = 2;
235235 dstW = input_sizes[isi];
236236
@@ -300,8 +300,8 @@ static void check_input_planar_rgb_to_uv(void) · 63 unmodified lines
300300 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
301301 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
302302 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
303− c->srcFormat = planar_fmts[fmi];
304− c->dstFormat = AV_PIX_FMT_YUVA444P16;
303+ c->opts.src_format = planar_fmts[fmi];
304+ c->opts.dst_format = AV_PIX_FMT_YUVA444P16;
305305 byte_size = 2;
306306 dstW = input_sizes[isi];
307307
@@ -373,8 +373,8 @@ static void check_input_planar_rgb_to_a(void) · 65 unmodified lines
373373 if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA))
374374 continue;
375375
376− c->srcFormat = planar_fmts[fmi];
377− c->dstFormat = AV_PIX_FMT_YUVA444P16;
376+ c->opts.src_format = planar_fmts[fmi];
377+ c->opts.dst_format = AV_PIX_FMT_YUVA444P16;
378378 byte_size = 2;
379379 dstW = input_sizes[isi];
380380
tests/checkasm/sw_range_convert.c+8−8
@@ -73,16 +73,16 @@ static void check_lumConvertRange(int from) · 72 unmodified lines
7373 fail();
7474
7575 c = sws_internal(sws);
76− c->srcRange = from;
77− c->dstRange = !from;
76+ c->opts.src_range = from;
77+ c->opts.dst_range = !from;
7878
7979 for (int pfi = 0; pfi < FF_ARRAY_ELEMS(pixel_formats); pfi++) {
8080 enum AVPixelFormat pix_fmt = pixel_formats[pfi];
8181 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
8282 int bit_depth = desc->comp[0].depth;
8383 int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);
84− c->srcFormat = pix_fmt;
85− c->dstFormat = pix_fmt;
84+ c->opts.src_format = pix_fmt;
85+ c->opts.dst_format = pix_fmt;
8686 c->dstBpc = bit_depth;
8787 ff_sws_init_scale(c);
8888 for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {
@@ -123,16 +123,16 @@ static void check_chrConvertRange(int from) · 34 unmodified lines
123123 fail();
124124
125125 c = sws_internal(sws);
126− c->srcRange = from;
127− c->dstRange = !from;
126+ c->opts.src_range = from;
127+ c->opts.dst_range = !from;
128128
129129 for (int pfi = 0; pfi < FF_ARRAY_ELEMS(pixel_formats); pfi++) {
130130 enum AVPixelFormat pix_fmt = pixel_formats[pfi];
131131 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
132132 int bit_depth = desc->comp[0].depth;
133133 int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);
134− c->srcFormat = pix_fmt;
135− c->dstFormat = pix_fmt;
134+ c->opts.src_format = pix_fmt;
135+ c->opts.dst_format = pix_fmt;
136136 c->dstBpc = bit_depth;
137137 ff_sws_init_scale(c);
138138 for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {
tests/checkasm/sw_rgb.c+5−5
@@ -370,7 +370,7 @@ static void check_rgb_to_y(SwsInternal *ctx) · 369 unmodified lines
370370 for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {
371371 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]);
372372
373− ctx->srcFormat = rgb_formats[i];
373+ ctx->opts.src_format = rgb_formats[i];
374374 ff_sws_init_scale(ctx);
375375
376376 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
@@ -389,7 +389,7 @@ static void check_rgb_to_y(SwsInternal *ctx) · 12 unmodified lines
389389
390390 if (desc->nb_components == 3 ||
391391 // only bench native endian formats
392− (ctx->srcFormat == AV_PIX_FMT_RGB32 || ctx->srcFormat == AV_PIX_FMT_RGB32_1))
392+ (ctx->opts.src_format == AV_PIX_FMT_RGB32 || ctx->opts.src_format == AV_PIX_FMT_RGB32_1))
393393 bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
394394 }
395395 }
@@ -417,8 +417,8 @@ static void check_rgb_to_uv(SwsInternal *ctx) · 21 unmodified lines
417417 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt);
418418
419419 ctx->chrSrcHSubSample = (i % 2) ? 0 : 1;
420− ctx->srcFormat = src_fmt;
421− ctx->dstFormat = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;
420+ ctx->opts.src_format = src_fmt;
421+ ctx->opts.dst_format = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;
422422 ff_sws_init_scale(ctx);
423423
424424 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
@@ -441,7 +441,7 @@ static void check_rgb_to_uv(SwsInternal *ctx) · 16 unmodified lines
441441
442442 if (desc->nb_components == 3 ||
443443 // only bench native endian formats
444− (ctx->srcFormat == AV_PIX_FMT_RGB32 || ctx->srcFormat == AV_PIX_FMT_RGB32_1))
444+ (ctx->opts.src_format == AV_PIX_FMT_RGB32 || ctx->opts.src_format == AV_PIX_FMT_RGB32_1))
445445 bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
446446 }
447447 }
tests/checkasm/sw_scale.c+9−9
@@ -125,7 +125,7 @@ static void check_yuv2yuv1(int accurate) · 124 unmodified lines
125125 sws = sws_alloc_context();
126126 c = sws_internal(sws);
127127 if (accurate)
128− c->flags |= SWS_ACCURATE_RND;
128+ c->opts.flags |= SWS_ACCURATE_RND;
129129 if (sws_init_context(sws, NULL, NULL) < 0)
130130 fail();
131131
@@ -192,7 +192,7 @@ static void check_yuv2yuvX(int accurate) · 60 unmodified lines
192192 sws = sws_alloc_context();
193193 c = sws_internal(sws);
194194 if (accurate)
195− c->flags |= SWS_ACCURATE_RND;
195+ c->opts.flags |= SWS_ACCURATE_RND;
196196 if (sws_init_context(sws, NULL, NULL) < 0)
197197 fail();
198198
@@ -341,20 +341,20 @@ static void check_hscale(void) · 142 unmodified lines
341341
342342 filter[SRC_PIXELS * width + i] = rnd();
343343 }
344− c->dstW = c->chrDstW = input_sizes[dstWi];
344+ c->opts.dst_w = c->chrDstW = input_sizes[dstWi];
345345 ff_sws_init_scale(c);
346346 memcpy(filterAvx2, filter, sizeof(uint16_t) * (SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH));
347− ff_shuffle_filter_coefficients(c, filterPosAvx, width, filterAvx2, c->dstW);
347+ ff_shuffle_filter_coefficients(c, filterPosAvx, width, filterAvx2, c->opts.dst_w);
348348
349− if (check_func(c->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", c->srcBpc, c->dstBpc + 1, width, c->dstW)) {
349+ if (check_func(c->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", c->srcBpc, c->dstBpc + 1, width, c->opts.dst_w)) {
350350 memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));
351351 memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0]));
352352
353− call_ref(NULL, dst0, c->dstW, src, filter, filterPos, width);
354− call_new(NULL, dst1, c->dstW, src, filterAvx2, filterPosAvx, width);
355− if (memcmp(dst0, dst1, c->dstW * sizeof(dst0[0])))
353+ call_ref(NULL, dst0, c->opts.dst_w, src, filter, filterPos, width);
354+ call_new(NULL, dst1, c->opts.dst_w, src, filterAvx2, filterPosAvx, width);
355+ if (memcmp(dst0, dst1, c->opts.dst_w * sizeof(dst0[0])))
356356 fail();
357− bench_new(NULL, dst0, c->dstW, src, filter, filterPosAvx, width);
357+ bench_new(NULL, dst0, c->opts.dst_w, src, filter, filterPosAvx, width);
358358 }
359359 }
360360 }

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