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
45 const uint8_t *_src, const int16_t *filter,45 const uint8_t *_src, const int16_t *filter,
46 const int32_t *filterPos, int filterSize)46 const int32_t *filterPos, int filterSize)
47{47{
48 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);48 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
49 int sh = desc->comp[0].depth - 1;49 int sh = desc->comp[0].depth - 1;
50 50
51 if (sh<15) {51 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);
53 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */53 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
54 sh = 16 - 1;54 sh = 16 - 1;
55 }55 }
@@ -61,11 +61,11 @@ static void ff_hscale16to15_X8_neon(SwsInternal *c, int16_t *_dst, int dstW, · 5 unmodified lines
61 const uint8_t *_src, const int16_t *filter,61 const uint8_t *_src, const int16_t *filter,
62 const int32_t *filterPos, int filterSize)62 const int32_t *filterPos, int filterSize)
63{63{
64 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);64 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
65 int sh = desc->comp[0].depth - 1;65 int sh = desc->comp[0].depth - 1;
66 66
67 if (sh<15) {67 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);
69 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */69 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
70 sh = 16 - 1;70 sh = 16 - 1;
71 }71 }
@@ -77,11 +77,11 @@ static void ff_hscale16to15_X4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 5 unmodified lines
77 const uint8_t *_src, const int16_t *filter,77 const uint8_t *_src, const int16_t *filter,
78 const int32_t *filterPos, int filterSize)78 const int32_t *filterPos, int filterSize)
79{79{
80 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);80 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
81 int sh = desc->comp[0].depth - 1;81 int sh = desc->comp[0].depth - 1;
82 82
83 if (sh<15) {83 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);
85 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */85 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
86 sh = 16 - 1;86 sh = 16 - 1;
87 }87 }
@@ -92,11 +92,11 @@ static void ff_hscale16to19_4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 4 unmodified lines
92 const uint8_t *_src, const int16_t *filter,92 const uint8_t *_src, const int16_t *filter,
93 const int32_t *filterPos, int filterSize)93 const int32_t *filterPos, int filterSize)
94{94{
95 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);95 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
96 int bits = desc->comp[0].depth - 1;96 int bits = desc->comp[0].depth - 1;
97 int sh = bits - 4;97 int sh = bits - 4;
98 98
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) {
100 sh = 9;100 sh = 9;
101 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */101 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
102 sh = 16 - 1 - 4;102 sh = 16 - 1 - 4;
@@ -110,11 +110,11 @@ static void ff_hscale16to19_X8_neon(SwsInternal *c, int16_t *_dst, int dstW, · 7 unmodified lines
110 const uint8_t *_src, const int16_t *filter,110 const uint8_t *_src, const int16_t *filter,
111 const int32_t *filterPos, int filterSize)111 const int32_t *filterPos, int filterSize)
112{112{
113 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);113 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
114 int bits = desc->comp[0].depth - 1;114 int bits = desc->comp[0].depth - 1;
115 int sh = bits - 4;115 int sh = bits - 4;
116 116
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) {
118 sh = 9;118 sh = 9;
119 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */119 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
120 sh = 16 - 1 - 4;120 sh = 16 - 1 - 4;
@@ -128,11 +128,11 @@ static void ff_hscale16to19_X4_neon(SwsInternal *c, int16_t *_dst, int dstW, · 7 unmodified lines
128 const uint8_t *_src, const int16_t *filter,128 const uint8_t *_src, const int16_t *filter,
129 const int32_t *filterPos, int filterSize)129 const int32_t *filterPos, int filterSize)
130{130{
131 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);131 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
132 int bits = desc->comp[0].depth - 1;132 int bits = desc->comp[0].depth - 1;
133 int sh = bits - 4;133 int sh = bits - 4;
134 134
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) {
136 sh = 9;136 sh = 9;
137 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */137 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
138 sh = 16 - 1 - 4;138 sh = 16 - 1 - 4;
@@ -229,7 +229,7 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c) · 90 unmodified lines
229 229
230 if (have_neon(cpu_flags)) {230 if (have_neon(cpu_flags)) {
231 if (c->dstBpc <= 14) {231 if (c->dstBpc <= 14) {
232 if (c->srcRange) {232 if (c->opts.src_range) {
233 c->lumConvertRange = ff_lumRangeFromJpeg_neon;233 c->lumConvertRange = ff_lumRangeFromJpeg_neon;
234 c->chrConvertRange = ff_chrRangeFromJpeg_neon;234 c->chrConvertRange = ff_chrRangeFromJpeg_neon;
235 } else {235 } else {
@@ -251,7 +251,7 @@ av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c) · 15 unmodified lines
251 if (c->dstBpc == 8) {251 if (c->dstBpc == 8) {
252 c->yuv2planeX = ff_yuv2planeX_8_neon;252 c->yuv2planeX = ff_yuv2planeX_8_neon;
253 }253 }
254 switch (c->srcFormat) {254 switch (c->opts.src_format) {
255 case AV_PIX_FMT_ABGR:255 case AV_PIX_FMT_ABGR:
256 c->lumToYV12 = ff_abgr32ToY_neon;256 c->lumToYV12 = ff_abgr32ToY_neon;
257 if (c->chrSrcHSubSample)257 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
43 const int dstStride[]) { \43 const int dstStride[]) { \
44 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \44 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
45 \45 \
46 return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \46 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
47 dst[0] + srcSliceY * dstStride[0], dstStride[0], \47 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
48 src[0], srcStride[0], \48 src[0], srcStride[0], \
49 src[1], srcStride[1], \49 src[1], srcStride[1], \
@@ -71,7 +71,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 21 unmodified lines
71 const int dstStride[]) { \71 const int dstStride[]) { \
72 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \72 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
73 \73 \
74 return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \74 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
75 dst[0] + srcSliceY * dstStride[0], dstStride[0], \75 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
76 src[0], srcStride[0], \76 src[0], srcStride[0], \
77 src[1], srcStride[1], \77 src[1], srcStride[1], \
@@ -108,7 +108,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 30 unmodified lines
108 const int dstStride[]) { \108 const int dstStride[]) { \
109 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \109 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
110 \110 \
111 return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \111 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
112 dst[0] + srcSliceY * dstStride[0], dstStride[0], \112 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
113 src[0], srcStride[0], src[1], srcStride[1], \113 src[0], srcStride[0], src[1], srcStride[1], \
114 yuv2rgb_table, \114 yuv2rgb_table, \
@@ -133,7 +133,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 18 unmodified lines
133 const int dstStride[]) { \133 const int dstStride[]) { \
134 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \134 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
135 \135 \
136 return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \136 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
137 dst[0] + srcSliceY * dstStride[0], dstStride[0], \137 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
138 src[0], srcStride[0], src[1], srcStride[1], \138 src[0], srcStride[0], src[1], srcStride[1], \
139 yuv2rgb_table, \139 yuv2rgb_table, \
@@ -155,15 +155,17 @@ static int nv24_to_yuv420p_neon_wrapper(SwsInternal *c, const uint8_t *const src · 15 unmodified lines
155 uint8_t *dst1 = dst[1] + dstStride[1] * srcSliceY / 2;155 uint8_t *dst1 = dst[1] + dstStride[1] * srcSliceY / 2;
156 uint8_t *dst2 = dst[2] + dstStride[2] * srcSliceY / 2;156 uint8_t *dst2 = dst[2] + dstStride[2] * srcSliceY / 2;
157 157
158 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,158 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
159 dst[0], dstStride[0]);159 dst[0], dstStride[0]);
160 160
161 if (c->srcFormat == AV_PIX_FMT_NV24)161 if (c->opts.src_format == AV_PIX_FMT_NV24)
162 ff_nv24_to_yuv420p_chroma_neon(dst1, dstStride[1], dst2, dstStride[2],162 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);
164 else165 else
165 ff_nv24_to_yuv420p_chroma_neon(dst2, dstStride[2], dst1, dstStride[1],166 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);
167 169
168 return srcSliceH;170 return srcSliceH;
169}171}
@@ -183,10 +185,10 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 13 unmodified lines
183 * assembly might be writing as much as 4*15=60 extra bytes at the end of the185 * assembly might be writing as much as 4*15=60 extra bytes at the end of the
184 * line, which won't fit the 32-bytes buffer alignment. */186 * line, which won't fit the 32-bytes buffer alignment. */
185#define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \187#define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \
186 if (c->srcFormat == AV_PIX_FMT_##IFMT \188 if (c->opts.src_format == AV_PIX_FMT_##IFMT \
187 && c->dstFormat == AV_PIX_FMT_##OFMT \189 && c->opts.dst_format == AV_PIX_FMT_##OFMT \
188 && !(c->srcH & 1) \190 && !(c->opts.src_h & 1) \
189 && !(c->srcW & 15) \191 && !(c->opts.src_w & 15) \
190 && !accurate_rnd) \192 && !accurate_rnd) \
191 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \193 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \
192} while (0)194} while (0)
@@ -200,16 +202,16 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 7 unmodified lines
200} while (0)202} while (0)
201 203
202static void get_unscaled_swscale_neon(SwsInternal *c) {204static 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;
204 206
205 SET_FF_NVX_TO_ALL_RGBX_FUNC(nv12, NV12, accurate_rnd);207 SET_FF_NVX_TO_ALL_RGBX_FUNC(nv12, NV12, accurate_rnd);
206 SET_FF_NVX_TO_ALL_RGBX_FUNC(nv21, NV21, accurate_rnd);208 SET_FF_NVX_TO_ALL_RGBX_FUNC(nv21, NV21, accurate_rnd);
207 SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv420p, YUV420P, accurate_rnd);209 SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv420p, YUV420P, accurate_rnd);
208 SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv422p, YUV422P, accurate_rnd);210 SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv422p, YUV422P, accurate_rnd);
209 211
210 if (c->dstFormat == AV_PIX_FMT_YUV420P &&212 if (c->opts.dst_format == AV_PIX_FMT_YUV420P &&
211 (c->srcFormat == AV_PIX_FMT_NV24 || c->srcFormat == AV_PIX_FMT_NV42) &&213 (c->opts.src_format == AV_PIX_FMT_NV24 || c->opts.src_format == AV_PIX_FMT_NV42) &&
212 !(c->srcH & 1) && !(c->srcW & 15) && !accurate_rnd)214 !(c->opts.src_h & 1) && !(c->opts.src_w & 15) && !accurate_rnd)
213 c->convert_unscaled = nv24_to_yuv420p_neon_wrapper;215 c->convert_unscaled = nv24_to_yuv420p_neon_wrapper;
214}216}
215 217
libswscale/alphablend.c+8−8
@@ -24,10 +24,10 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 23 unmodified lines
24 const int srcStride[], int srcSliceY, int srcSliceH,24 const int srcStride[], int srcSliceY, int srcSliceH,
25 uint8_t *const dst[], const int dstStride[])25 uint8_t *const dst[], const int dstStride[])
26{26{
27 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);27 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
28 int nb_components = desc->nb_components;28 int nb_components = desc->nb_components;
29 int plane, x, ysrc;29 int plane, x, ysrc;
30 int plane_count = isGray(c->srcFormat) ? 1 : 3;30 int plane_count = isGray(c->opts.src_format) ? 1 : 3;
31 int sixteen_bits = desc->comp[0].depth >= 9;31 int sixteen_bits = desc->comp[0].depth >= 9;
32 unsigned off = 1<<(desc->comp[0].depth - 1);32 unsigned off = 1<<(desc->comp[0].depth - 1);
33 unsigned shift = desc->comp[0].depth;33 unsigned shift = desc->comp[0].depth;
@@ -36,7 +36,7 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 2 unmodified lines
36 36
37 for (plane = 0; plane < plane_count; plane++) {37 for (plane = 0; plane < plane_count; plane++) {
38 int a = 0, b = 0;38 int a = 0, b = 0;
39 if (c->alphablend == SWS_ALPHA_BLEND_CHECKERBOARD) {39 if (c->opts.alpha_blend == SWS_ALPHA_BLEND_CHECKERBOARD) {
40 a = (1<<(desc->comp[0].depth - 1))/2;40 a = (1<<(desc->comp[0].depth - 1))/2;
41 b = 3*(1<<(desc->comp[0].depth-1))/2;41 b = 3*(1<<(desc->comp[0].depth-1))/2;
42 }42 }
@@ -47,7 +47,7 @@ int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], · 4 unmodified lines
47 av_assert0(plane_count == nb_components - 1);47 av_assert0(plane_count == nb_components - 1);
48 if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) {48 if (desc->flags & AV_PIX_FMT_FLAG_PLANAR) {
49 for (plane = 0; plane < plane_count; plane++) {49 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;
51 int x_subsample = plane ? desc->log2_chroma_w: 0;51 int x_subsample = plane ? desc->log2_chroma_w: 0;
52 int y_subsample = plane ? desc->log2_chroma_h: 0;52 int y_subsample = plane ? desc->log2_chroma_h: 0;
53 for (ysrc = 0; ysrc < AV_CEIL_RSHIFT(srcSliceH, y_subsample); ysrc++) {53 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
60 const uint16_t *s = (const uint16_t *)(src[plane ] + srcStride[plane ] * ysrc);60 const uint16_t *s = (const uint16_t *)(src[plane ] + srcStride[plane ] * ysrc);
61 const uint16_t *a = (const uint16_t *)(src[plane_count] + (srcStride[plane_count] * ysrc << y_subsample));61 const uint16_t *a = (const uint16_t *)(src[plane_count] + (srcStride[plane_count] * ysrc << y_subsample));
62 uint16_t *d = ( uint16_t *)(dst[plane ] + dstStride[plane ] * y);62 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) {
64 for (x = 0; x < w; x++) {64 for (x = 0; x < w; x++) {
65 if (y_subsample) {65 if (y_subsample) {
66 alpha = (a[2*x] + a[2*x + 1] + 2 +66 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
101 const uint16_t *s = (const uint16_t *)(src[plane ] + srcStride[plane ] * ysrc);101 const uint16_t *s = (const uint16_t *)(src[plane ] + srcStride[plane ] * ysrc);
102 const uint16_t *a = (const uint16_t *)(src[plane_count] + srcStride[plane_count] * ysrc);102 const uint16_t *a = (const uint16_t *)(src[plane_count] + srcStride[plane_count] * ysrc);
103 uint16_t *d = ( uint16_t *)(dst[plane ] + dstStride[plane ] * y);103 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) {
105 for (x = 0; x < w; x++) {105 for (x = 0; x < w; x++) {
106 unsigned u = s[x]*a[x] + target_table[((x^y)>>5)&1][plane]*(max-a[x]) + off;106 unsigned u = s[x]*a[x] + target_table[((x^y)>>5)&1][plane]*(max-a[x]) + off;
107 d[x] = av_clip((u + (u >> shift)) >> shift, 0, max);107 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
127 }127 }
128 } else {128 } else {
129 int alpha_pos = desc->comp[plane_count].offset;129 int alpha_pos = desc->comp[plane_count].offset;
130 int w = c->srcW;130 int w = c->opts.src_w;
131 for (ysrc = 0; ysrc < srcSliceH; ysrc++) {131 for (ysrc = 0; ysrc < srcSliceH; ysrc++) {
132 int y = ysrc + srcSliceY;132 int y = ysrc + srcSliceY;
133 if (sixteen_bits) {133 if (sixteen_bits) {
134 const uint16_t *s = (const uint16_t *)(src[0] + srcStride[0] * ysrc + 2*!alpha_pos);134 const uint16_t *s = (const uint16_t *)(src[0] + srcStride[0] * ysrc + 2*!alpha_pos);
135 const uint16_t *a = (const uint16_t *)(src[0] + srcStride[0] * ysrc + alpha_pos);135 const uint16_t *a = (const uint16_t *)(src[0] + srcStride[0] * ysrc + alpha_pos);
136 uint16_t *d = ( uint16_t *)(dst[0] + dstStride[0] * y);136 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) {
138 for (x = 0; x < w; x++) {138 for (x = 0; x < w; x++) {
139 for (plane = 0; plane < plane_count; plane++) {139 for (plane = 0; plane < plane_count; plane++) {
140 int x_index = (plane_count + 1) * x;140 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
41 rgbx_to_nv12_neon_32(src[0] + srcSliceY * srcStride[0],41 rgbx_to_nv12_neon_32(src[0] + srcSliceY * srcStride[0],
42 dst[0] + srcSliceY * dstStride[0],42 dst[0] + srcSliceY * dstStride[0],
43 dst[1] + (srcSliceY / 2) * dstStride[1],43 dst[1] + (srcSliceY / 2) * dstStride[1],
44 context->srcW, srcSliceH,44 context->opts.src_w, srcSliceH,
45 dstStride[0], dstStride[1], srcStride[0],45 dstStride[0], dstStride[1], srcStride[0],
46 context->input_rgb2yuv_table);46 context->input_rgb2yuv_table);
47 47
@@ -55,7 +55,7 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsInternal *context, const uint8_t *con · 7 unmodified lines
55 rgbx_to_nv12_neon_16(src[0] + srcSliceY * srcStride[0],55 rgbx_to_nv12_neon_16(src[0] + srcSliceY * srcStride[0],
56 dst[0] + srcSliceY * dstStride[0],56 dst[0] + srcSliceY * dstStride[0],
57 dst[1] + (srcSliceY / 2) * dstStride[1],57 dst[1] + (srcSliceY / 2) * dstStride[1],
58 context->srcW, srcSliceH,58 context->opts.src_w, srcSliceH,
59 dstStride[0], dstStride[1], srcStride[0],59 dstStride[0], dstStride[1], srcStride[0],
60 context->input_rgb2yuv_table);60 context->input_rgb2yuv_table);
61 61
@@ -84,7 +84,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 22 unmodified lines
84 const int dstStride[]) { \84 const int dstStride[]) { \
85 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \85 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
86 \86 \
87 ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \87 ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
88 dst[0] + srcSliceY * dstStride[0], dstStride[0], \88 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
89 src[0], srcStride[0], \89 src[0], srcStride[0], \
90 src[1], srcStride[1], \90 src[1], srcStride[1], \
@@ -120,7 +120,7 @@ static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const · 29 unmodified lines
120 const int dstStride[]) { \120 const int dstStride[]) { \
121 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \121 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
122 \122 \
123 ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \123 ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
124 dst[0] + srcSliceY * dstStride[0], dstStride[0], \124 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
125 src[0], srcStride[0], src[1], srcStride[1], \125 src[0], srcStride[0], src[1], srcStride[1], \
126 yuv2rgb_table, \126 yuv2rgb_table, \
@@ -144,10 +144,10 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 17 unmodified lines
144 * assembly might be writing as much as 4*15=60 extra bytes at the end of the144 * assembly might be writing as much as 4*15=60 extra bytes at the end of the
145 * line, which won't fit the 32-bytes buffer alignment. */145 * line, which won't fit the 32-bytes buffer alignment. */
146#define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \146#define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \
147 if (c->srcFormat == AV_PIX_FMT_##IFMT \147 if (c->opts.src_format == AV_PIX_FMT_##IFMT \
148 && c->dstFormat == AV_PIX_FMT_##OFMT \148 && c->opts.dst_format == AV_PIX_FMT_##OFMT \
149 && !(c->srcH & 1) \149 && !(c->opts.src_h & 1) \
150 && !(c->srcW & 15) \150 && !(c->opts.src_w & 15) \
151 && !accurate_rnd) { \151 && !accurate_rnd) { \
152 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \152 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \
153 } \153 } \
@@ -161,10 +161,10 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) · 7 unmodified lines
161} while (0)161} while (0)
162 162
163static void get_unscaled_swscale_neon(SwsInternal *c) {163static void get_unscaled_swscale_neon(SwsInternal *c) {
164 int accurate_rnd = c->flags & SWS_ACCURATE_RND;164 int accurate_rnd = c->opts.flags & SWS_ACCURATE_RND;
165 if (c->srcFormat == AV_PIX_FMT_RGBA165 if (c->opts.src_format == AV_PIX_FMT_RGBA
166 && c->dstFormat == AV_PIX_FMT_NV12166 && c->opts.dst_format == AV_PIX_FMT_NV12
167 && (c->srcW >= 16)) {167 && (c->opts.src_w >= 16)) {
168 c->convert_unscaled = accurate_rnd ? rgbx_to_nv12_neon_32_wrapper168 c->convert_unscaled = accurate_rnd ? rgbx_to_nv12_neon_32_wrapper
169 : rgbx_to_nv12_neon_16_wrapper;169 : rgbx_to_nv12_neon_16_wrapper;
170 }170 }
libswscale/input.c+1−1
@@ -1563,7 +1563,7 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c, · 1562 unmodified lines
1563 planarX_YV12_fn *readAlpPlanar,1563 planarX_YV12_fn *readAlpPlanar,
1564 planarX2_YV12_fn *readChrPlanar)1564 planarX2_YV12_fn *readChrPlanar)
1565{1565{
1566 enum AVPixelFormat srcFormat = c->srcFormat;1566 enum AVPixelFormat srcFormat = c->opts.src_format;
1567 1567
1568 *chrToYV12 = NULL;1568 *chrToYV12 = NULL;
1569 switch (srcFormat) {1569 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
203 203
204av_cold void ff_sws_init_input_lasx(SwsInternal *c)204av_cold void ff_sws_init_input_lasx(SwsInternal *c)
205{205{
206 enum AVPixelFormat srcFormat = c->srcFormat;206 enum AVPixelFormat srcFormat = c->opts.src_format;
207 207
208 switch (srcFormat) {208 switch (srcFormat) {
209 case AV_PIX_FMT_YUYV422:209 case AV_PIX_FMT_YUYV422:
libswscale/loongarch/input_lsx.c+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
23 23
24av_cold void ff_sws_init_input_lsx(SwsInternal *c)24av_cold void ff_sws_init_input_lsx(SwsInternal *c)
25{25{
26 enum AVPixelFormat srcFormat = c->srcFormat;26 enum AVPixelFormat srcFormat = c->opts.src_format;
27 27
28 switch (srcFormat) {28 switch (srcFormat) {
29 case AV_PIX_FMT_YUYV422:29 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
888 {888 {
889 int r,g,b;889 int r,g,b;
890 890
891 switch (c->dither) {891 switch (c->opts.dither) {
892 default:892 default:
893 case SWS_DITHER_AUTO:893 case SWS_DITHER_AUTO:
894 case SWS_DITHER_ED:894 case SWS_DITHER_ED:
@@ -1784,7 +1784,7 @@ av_cold void ff_sws_init_output_lasx(SwsInternal *c, · 889 unmodified lines
1784 yuv2packedX_fn *yuv2packedX,1784 yuv2packedX_fn *yuv2packedX,
1785 yuv2anyX_fn *yuv2anyX)1785 yuv2anyX_fn *yuv2anyX)
1786{1786{
1787 enum AVPixelFormat dstFormat = c->dstFormat;1787 enum AVPixelFormat dstFormat = c->opts.dst_format;
1788 1788
1789 /* Add initialization once optimized */1789 /* Add initialization once optimized */
1790 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {1790 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
@@ -1797,8 +1797,8 @@ av_cold void ff_sws_init_output_lasx(SwsInternal *c, · 6 unmodified lines
1797 *yuv2planeX = yuv2planeX_8_lasx;1797 *yuv2planeX = yuv2planeX_8_lasx;
1798 }1798 }
1799 1799
1800 if(c->flags & SWS_FULL_CHR_H_INT) {1800 if(c->opts.flags & SWS_FULL_CHR_H_INT) {
1801 switch (c->dstFormat) {1801 switch (c->opts.dst_format) {
1802 case AV_PIX_FMT_RGBA:1802 case AV_PIX_FMT_RGBA:
1803#if CONFIG_SMALL1803#if CONFIG_SMALL
1804 c->yuv2packedX = yuv2rgba32_full_X_lasx;1804 c->yuv2packedX = yuv2rgba32_full_X_lasx;
@@ -1911,7 +1911,7 @@ av_cold void ff_sws_init_output_lasx(SwsInternal *c, · 106 unmodified lines
1911 break;1911 break;
1912 }1912 }
1913 } else {1913 } else {
1914 switch (c->dstFormat) {1914 switch (c->opts.dst_format) {
1915 case AV_PIX_FMT_RGB32:1915 case AV_PIX_FMT_RGB32:
1916 case AV_PIX_FMT_BGR32:1916 case AV_PIX_FMT_BGR32:
1917#if CONFIG_SMALL1917#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
838 {838 {
839 int r,g,b;839 int r,g,b;
840 840
841 switch (c->dither) {841 switch (c->opts.dither) {
842 default:842 default:
843 case SWS_DITHER_AUTO:843 case SWS_DITHER_AUTO:
844 case SWS_DITHER_ED:844 case SWS_DITHER_ED:
@@ -1633,7 +1633,7 @@ av_cold void ff_sws_init_output_lsx(SwsInternal *c, · 788 unmodified lines
1633 yuv2packedX_fn *yuv2packedX,1633 yuv2packedX_fn *yuv2packedX,
1634 yuv2anyX_fn *yuv2anyX)1634 yuv2anyX_fn *yuv2anyX)
1635{1635{
1636 enum AVPixelFormat dstFormat = c->dstFormat;1636 enum AVPixelFormat dstFormat = c->opts.dst_format;
1637 1637
1638 /* Add initialization once optimized */1638 /* Add initialization once optimized */
1639 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {1639 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
@@ -1646,8 +1646,8 @@ av_cold void ff_sws_init_output_lsx(SwsInternal *c, · 6 unmodified lines
1646 *yuv2planeX = yuv2planeX_8_lsx;1646 *yuv2planeX = yuv2planeX_8_lsx;
1647 }1647 }
1648 1648
1649 if(c->flags & SWS_FULL_CHR_H_INT) {1649 if(c->opts.flags & SWS_FULL_CHR_H_INT) {
1650 switch (c->dstFormat) {1650 switch (c->opts.dst_format) {
1651 case AV_PIX_FMT_RGBA:1651 case AV_PIX_FMT_RGBA:
1652#if CONFIG_SMALL1652#if CONFIG_SMALL
1653 c->yuv2packedX = yuv2rgba32_full_X_lsx;1653 c->yuv2packedX = yuv2rgba32_full_X_lsx;
@@ -1760,7 +1760,7 @@ av_cold void ff_sws_init_output_lsx(SwsInternal *c, · 106 unmodified lines
1760 break;1760 break;
1761 }1761 }
1762 } else {1762 } else {
1763 switch (c->dstFormat) {1763 switch (c->opts.dst_format) {
1764 case AV_PIX_FMT_RGB32:1764 case AV_PIX_FMT_RGB32:
1765 case AV_PIX_FMT_BGR32:1765 case AV_PIX_FMT_BGR32:
1766#if CONFIG_SMALL1766#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
30 30
31 if (have_lsx(cpu_flags)) {31 if (have_lsx(cpu_flags)) {
32 if (c->dstBpc <= 14) {32 if (c->dstBpc <= 14) {
33 if (c->srcRange) {33 if (c->opts.src_range) {
34 c->lumConvertRange = lumRangeFromJpeg_lsx;34 c->lumConvertRange = lumRangeFromJpeg_lsx;
35 c->chrConvertRange = chrRangeFromJpeg_lsx;35 c->chrConvertRange = chrRangeFromJpeg_lsx;
36 } else {36 } else {
@@ -42,7 +42,7 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c) · 5 unmodified lines
42#if HAVE_LASX42#if HAVE_LASX
43 if (have_lasx(cpu_flags)) {43 if (have_lasx(cpu_flags)) {
44 if (c->dstBpc <= 14) {44 if (c->dstBpc <= 14) {
45 if (c->srcRange) {45 if (c->opts,src_range) {
46 c->lumConvertRange = lumRangeFromJpeg_lasx;46 c->lumConvertRange = lumRangeFromJpeg_lasx;
47 c->chrConvertRange = chrRangeFromJpeg_lasx;47 c->chrConvertRange = chrRangeFromJpeg_lasx;
48 } else {48 } else {
@@ -107,29 +107,29 @@ av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c) · 58 unmodified lines
107 int cpu_flags = av_get_cpu_flags();107 int cpu_flags = av_get_cpu_flags();
108#if HAVE_LASX108#if HAVE_LASX
109 if (have_lasx(cpu_flags)) {109 if (have_lasx(cpu_flags)) {
110 if (c->srcFormat == AV_PIX_FMT_YUV420P) {110 if (c->opts.src_format == AV_PIX_FMT_YUV420P) {
111 switch (c->dstFormat) {111 switch (c->opts.dst_format) {
112 case AV_PIX_FMT_RGB24:112 case AV_PIX_FMT_RGB24:
113 return yuv420_rgb24_lasx;113 return yuv420_rgb24_lasx;
114 case AV_PIX_FMT_BGR24:114 case AV_PIX_FMT_BGR24:
115 return yuv420_bgr24_lasx;115 return yuv420_bgr24_lasx;
116 case AV_PIX_FMT_RGBA:116 case AV_PIX_FMT_RGBA:
117 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {117 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
118 break;118 break;
119 } else119 } else
120 return yuv420_rgba32_lasx;120 return yuv420_rgba32_lasx;
121 case AV_PIX_FMT_ARGB:121 case AV_PIX_FMT_ARGB:
122 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {122 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
123 break;123 break;
124 } else124 } else
125 return yuv420_argb32_lasx;125 return yuv420_argb32_lasx;
126 case AV_PIX_FMT_BGRA:126 case AV_PIX_FMT_BGRA:
127 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {127 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
128 break;128 break;
129 } else129 } else
130 return yuv420_bgra32_lasx;130 return yuv420_bgra32_lasx;
131 case AV_PIX_FMT_ABGR:131 case AV_PIX_FMT_ABGR:
132 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {132 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
133 break;133 break;
134 } else134 } else
135 return yuv420_abgr32_lasx;135 return yuv420_abgr32_lasx;
@@ -138,29 +138,29 @@ av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c) · 2 unmodified lines
138 }138 }
139#endif // #if HAVE_LASX139#endif // #if HAVE_LASX
140 if (have_lsx(cpu_flags)) {140 if (have_lsx(cpu_flags)) {
141 if (c->srcFormat == AV_PIX_FMT_YUV420P) {141 if (c->opts.src_format == AV_PIX_FMT_YUV420P) {
142 switch (c->dstFormat) {142 switch (c->opts.dst_format) {
143 case AV_PIX_FMT_RGB24:143 case AV_PIX_FMT_RGB24:
144 return yuv420_rgb24_lsx;144 return yuv420_rgb24_lsx;
145 case AV_PIX_FMT_BGR24:145 case AV_PIX_FMT_BGR24:
146 return yuv420_bgr24_lsx;146 return yuv420_bgr24_lsx;
147 case AV_PIX_FMT_RGBA:147 case AV_PIX_FMT_RGBA:
148 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {148 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
149 break;149 break;
150 } else150 } else
151 return yuv420_rgba32_lsx;151 return yuv420_rgba32_lsx;
152 case AV_PIX_FMT_ARGB:152 case AV_PIX_FMT_ARGB:
153 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {153 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
154 break;154 break;
155 } else155 } else
156 return yuv420_argb32_lsx;156 return yuv420_argb32_lsx;
157 case AV_PIX_FMT_BGRA:157 case AV_PIX_FMT_BGRA:
158 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {158 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
159 break;159 break;
160 } else160 } else
161 return yuv420_bgra32_lsx;161 return yuv420_bgra32_lsx;
162 case AV_PIX_FMT_ABGR:162 case AV_PIX_FMT_ABGR:
163 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat)) {163 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format)) {
164 break;164 break;
165 } else165 } else
166 return yuv420_abgr32_lsx;166 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
677 const uint8_t *_src, const int16_t *filter,677 const uint8_t *_src, const int16_t *filter,
678 const int32_t *filterPos, int filterSize)678 const int32_t *filterPos, int filterSize)
679{679{
680 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);680 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
681 int i;681 int i;
682 const uint16_t *src = (const uint16_t *) _src;682 const uint16_t *src = (const uint16_t *) _src;
683 int sh = desc->comp[0].depth - 1;683 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
688 __m256i zero = __lasx_xvldi(0);688 __m256i zero = __lasx_xvldi(0);
689 689
690 if (sh < 15) {690 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 :
692 (desc->comp[0].depth - 1);692 (desc->comp[0].depth - 1);
693 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {693 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {
694 sh = 15;694 sh = 15;
@@ -824,7 +824,7 @@ void ff_hscale_16_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, · 129 unmodified lines
824 const uint8_t *_src, const int16_t *filter,824 const uint8_t *_src, const int16_t *filter,
825 const int32_t *filterPos, int filterSize)825 const int32_t *filterPos, int filterSize)
826{826{
827 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);827 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
828 int i;828 int i;
829 int32_t *dst = (int32_t *) _dst;829 int32_t *dst = (int32_t *) _dst;
830 const uint16_t *src = (const uint16_t *) _src;830 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
835 __m256i shift;835 __m256i shift;
836 __m256i zero = __lasx_xvldi(0);836 __m256i zero = __lasx_xvldi(0);
837 837
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)
839 && desc->comp[0].depth<16) {839 && desc->comp[0].depth<16) {
840 sh = 9;840 sh = 9;
841 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) {841 } 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
27 const uint8_t *_src, const int16_t *filter,27 const uint8_t *_src, const int16_t *filter,
28 const int32_t *filterPos, int filterSize)28 const int32_t *filterPos, int filterSize)
29{29{
30 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);30 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
31 int sh = desc->comp[0].depth - 1;31 int sh = desc->comp[0].depth - 1;
32 32
33 if (sh < 15) {33 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 :
35 (desc->comp[0].depth - 1);35 (desc->comp[0].depth - 1);
36 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {36 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {
37 sh = 15;37 sh = 15;
@@ -43,11 +43,11 @@ void ff_hscale_16_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW, · 5 unmodified lines
43 const uint8_t *_src, const int16_t *filter,43 const uint8_t *_src, const int16_t *filter,
44 const int32_t *filterPos, int filterSize)44 const int32_t *filterPos, int filterSize)
45{45{
46 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);46 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
47 int bits = desc->comp[0].depth - 1;47 int bits = desc->comp[0].depth - 1;
48 int sh = bits - 4;48 int sh = bits - 4;
49 49
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) {
51 51
52 sh = 9;52 sh = 9;
53 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */53 } 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
173 __m256i shuf3 = {0x1E0F0E1C0D0C1A0B, 0x0101010101010101, \173 __m256i shuf3 = {0x1E0F0E1C0D0C1A0B, 0x0101010101010101, \
174 0x1E0F0E1C0D0C1A0B, 0x0101010101010101}; \174 0x1E0F0E1C0D0C1A0B, 0x0101010101010101}; \
175 YUV2RGB_LOAD_COE \175 YUV2RGB_LOAD_COE \
176 y = (c->dstW + 7) & ~7; \176 y = (c->opts.dst_w + 7) & ~7; \
177 h_size = y >> 4; \177 h_size = y >> 4; \
178 res = y & 15; \178 res = y & 15; \
179 \179 \
180 vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \180 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
181 for (y = 0; y < srcSliceH; y += 2) { \181 for (y = 0; y < srcSliceH; y += 2) { \
182 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\182 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\
183 dst_type *image2 = (dst_type *)(image1 + dstStride[0]);\183 dst_type *image2 = (dst_type *)(image1 + dstStride[0]);\
@@ -199,11 +199,11 @@ · 15 unmodified lines
199 __m256i a = __lasx_xvldi(0xFF); \199 __m256i a = __lasx_xvldi(0xFF); \
200 \200 \
201 YUV2RGB_LOAD_COE \201 YUV2RGB_LOAD_COE \
202 y = (c->dstW + 7) & ~7; \202 y = (c->opts.dst_w + 7) & ~7; \
203 h_size = y >> 4; \203 h_size = y >> 4; \
204 res = y & 15; \204 res = y & 15; \
205 \205 \
206 vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \206 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
207 for (y = 0; y < srcSliceH; y += 2) { \207 for (y = 0; y < srcSliceH; y += 2) { \
208 int yd = y + srcSliceY; \208 int yd = y + srcSliceY; \
209 dst_type av_unused *r, *g, *b; \209 dst_type av_unused *r, *g, *b; \
libswscale/loongarch/yuv2rgb_lsx.c+6−6
@@ -128,9 +128,9 @@ · 127 unmodified lines
128 \128 \
129 YUV2RGB_LOAD_COE \129 YUV2RGB_LOAD_COE \
130 \130 \
131 h_size = c->dstW >> 4; \131 h_size = c->opts.dst_w >> 4; \
132 res = (c->dstW & 15) >> 1; \132 res = (c->opts.dst_w & 15) >> 1; \
133 vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \133 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
134 for (y = 0; y < srcSliceH; y += 2) { \134 for (y = 0; y < srcSliceH; y += 2) { \
135 dst_type av_unused *r, *g, *b; \135 dst_type av_unused *r, *g, *b; \
136 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\136 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\
@@ -156,9 +156,9 @@ · 19 unmodified lines
156 \156 \
157 YUV2RGB_LOAD_COE \157 YUV2RGB_LOAD_COE \
158 \158 \
159 h_size = c->dstW >> 4; \159 h_size = c->opts.dst_w >> 4; \
160 res = (c->dstW & 15) >> 1; \160 res = (c->opts.dst_w & 15) >> 1; \
161 vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \161 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
162 for (y = 0; y < srcSliceH; y += 2) { \162 for (y = 0; y < srcSliceH; y += 2) { \
163 int yd = y + srcSliceY; \163 int yd = y + srcSliceY; \
164 dst_type av_unused *r, *g, *b; \164 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
27 return "swscaler";27 return "swscaler";
28}28}
29 29
30#define OFFSET(x) offsetof(SwsInternal, x)30#define OFFSET(x) offsetof(SwsInternal, opts.x)
31#define DEFAULT 031#define DEFAULT 0
32#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM32#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
33 33
@@ -51,18 +51,18 @@ static const AVOption swscale_options[] = { · 17 unmodified lines
51 { "bitexact", "bit-exact mode", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BITEXACT }, .flags = VE, .unit = "sws_flags" },51 { "bitexact", "bit-exact mode", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BITEXACT }, .flags = VE, .unit = "sws_flags" },
52 { "error_diffusion", "error diffusion dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ERROR_DIFFUSION}, .flags = VE, .unit = "sws_flags" },52 { "error_diffusion", "error diffusion dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ERROR_DIFFUSION}, .flags = VE, .unit = "sws_flags" },
53 53
54 { "param0", "scaler param 0", OFFSET(param[0]), 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(param[1]), 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 },
56 56
57 { "srcw", "source width", OFFSET(srcW), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },57 { "srcw", "source width", OFFSET(src_w), 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 },58 { "srch", "source height", OFFSET(src_h), 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 },59 { "dstw", "destination width", OFFSET(dst_w), 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 },60 { "dsth", "destination height", OFFSET(dst_h), 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 },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(dstFormat), 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(srcRange), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT }, 0, 1, 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(dstRange), 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 },65 { "gamma", "gamma correct scaling", OFFSET(gamma_flag), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
66 66
67 { "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 },67 { "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 },
68 { "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 },68 { "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
76 { "a_dither", "arithmetic addition dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_A_DITHER }, .flags = VE, .unit = "sws_dither" },76 { "a_dither", "arithmetic addition dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_A_DITHER }, .flags = VE, .unit = "sws_dither" },
77 { "x_dither", "arithmetic xor dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_X_DITHER }, .flags = VE, .unit = "sws_dither" },77 { "x_dither", "arithmetic xor dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_X_DITHER }, .flags = VE, .unit = "sws_dither" },
78 78
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 },
80 { "none", "ignore alpha", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_NONE}, .flags = VE, .unit = "alphablend" },80 { "none", "ignore alpha", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_NONE}, .flags = VE, .unit = "alphablend" },
81 { "uniform_color", "blend onto a uniform color", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_UNIFORM}, .flags = VE, .unit = "alphablend" },81 { "uniform_color", "blend onto a uniform color", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_UNIFORM}, .flags = VE, .unit = "alphablend" },
82 { "checkerboard", "blend onto a checkerboard", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_CHECKERBOARD}, .flags = VE, .unit = "alphablend" },82 { "checkerboard", "blend onto a checkerboard", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_CHECKERBOARD}, .flags = VE, .unit = "alphablend" },
83 83
84 { "threads", "number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, 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" },85 { "auto", "automatic selection", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = VE, .unit = "threads" },
86 86
87 { NULL }87 { NULL }
88};88};
@@ -91,7 +91,7 @@ const AVClass ff_sws_context_class = { · 2 unmodified lines
91 .class_name = "SWScaler",91 .class_name = "SWScaler",
92 .item_name = sws_context_to_name,92 .item_name = sws_context_to_name,
93 .option = swscale_options,93 .option = swscale_options,
94 .parent_log_context_offset = OFFSET(parent),94 .parent_log_context_offset = offsetof(SwsInternal, parent),
95 .category = AV_CLASS_CATEGORY_SWSCALER,95 .category = AV_CLASS_CATEGORY_SWSCALER,
96 .version = LIBAVUTIL_VERSION_INT,96 .version = LIBAVUTIL_VERSION_INT,
97};97};
libswscale/output.c+12−12
@@ -624,7 +624,7 @@ yuv2mono_X_c_template(SwsInternal *c, const int16_t *lumFilter, · 623 unmodified lines
624 Y1 = av_clip_uint8(Y1);624 Y1 = av_clip_uint8(Y1);
625 Y2 = av_clip_uint8(Y2);625 Y2 = av_clip_uint8(Y2);
626 }626 }
627 if (c->dither == SWS_DITHER_ED) {627 if (c->opts.dither == SWS_DITHER_ED) {
628 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;628 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;
629 c->dither_error[0][i] = err;629 c->dither_error[0][i] = err;
630 acc = 2*acc + (Y1 >= 128);630 acc = 2*acc + (Y1 >= 128);
@@ -662,7 +662,7 @@ yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2], · 31 unmodified lines
662 int i;662 int i;
663 av_assert2(yalpha <= 4096U);663 av_assert2(yalpha <= 4096U);
664 664
665 if (c->dither == SWS_DITHER_ED) {665 if (c->opts.dither == SWS_DITHER_ED) {
666 int err = 0;666 int err = 0;
667 unsigned acc = 0;667 unsigned acc = 0;
668 for (i = 0; i < dstW; i +=2) {668 for (i = 0; i < dstW; i +=2) {
@@ -720,7 +720,7 @@ yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0, · 51 unmodified lines
720 const uint8_t * const d128 = ff_dither_8x8_220[y & 7];720 const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
721 int i;721 int i;
722 722
723 if (c->dither == SWS_DITHER_ED) {723 if (c->opts.dither == SWS_DITHER_ED) {
724 int err = 0;724 int err = 0;
725 unsigned acc = 0;725 unsigned acc = 0;
726 for (i = 0; i < dstW; i +=2) {726 for (i = 0; i < dstW; i +=2) {
@@ -1989,7 +1989,7 @@ static av_always_inline void yuv2rgb_write_full(SwsInternal *c, · 1262 unmodified lines
1989 {1989 {
1990 int r,g,b;1990 int r,g,b;
1991 1991
1992 switch (c->dither) {1992 switch (c->opts.dither) {
1993 case SWS_DITHER_NONE:1993 case SWS_DITHER_NONE:
1994 if (isrgb8) {1994 if (isrgb8) {
1995 r = av_clip_uintp2(R >> 27, 3);1995 r = av_clip_uintp2(R >> 27, 3);
@@ -2265,7 +2265,7 @@ yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 269 unmodified lines
2265 const int16_t **alpSrc, uint8_t **dest,2265 const int16_t **alpSrc, uint8_t **dest,
2266 int dstW, int y)2266 int dstW, int y)
2267{2267{
2268 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);2268 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2269 int i;2269 int i;
2270 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc;2270 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc;
2271 uint16_t **dest16 = (uint16_t**)dest;2271 uint16_t **dest16 = (uint16_t**)dest;
@@ -2328,7 +2328,7 @@ yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 56 unmodified lines
2328 dest[3][i] = A >> 19;2328 dest[3][i] = A >> 19;
2329 }2329 }
2330 }2330 }
2331 if (SH != 22 && (!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {2331 if (SH != 22 && (!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2332 for (i = 0; i < dstW; i++) {2332 for (i = 0; i < dstW; i++) {
2333 dest16[0][i] = av_bswap16(dest16[0][i]);2333 dest16[0][i] = av_bswap16(dest16[0][i]);
2334 dest16[1][i] = av_bswap16(dest16[1][i]);2334 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
2347 const int16_t **alpSrcx, uint8_t **dest,2347 const int16_t **alpSrcx, uint8_t **dest,
2348 int dstW, int y)2348 int dstW, int y)
2349{2349{
2350 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);2350 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2351 int i;2351 int i;
2352 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;2352 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
2353 uint16_t **dest16 = (uint16_t**)dest;2353 uint16_t **dest16 = (uint16_t**)dest;
@@ -2400,7 +2400,7 @@ yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 46 unmodified lines
2400 if (hasAlpha)2400 if (hasAlpha)
2401 dest16[3][i] = av_clip_uintp2(A, 30) >> 14;2401 dest16[3][i] = av_clip_uintp2(A, 30) >> 14;
2402 }2402 }
2403 if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {2403 if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2404 for (i = 0; i < dstW; i++) {2404 for (i = 0; i < dstW; i++) {
2405 dest16[0][i] = av_bswap16(dest16[0][i]);2405 dest16[0][i] = av_bswap16(dest16[0][i]);
2406 dest16[1][i] = av_bswap16(dest16[1][i]);2406 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
2419 const int16_t **alpSrcx, uint8_t **dest,2419 const int16_t **alpSrcx, uint8_t **dest,
2420 int dstW, int y)2420 int dstW, int y)
2421{2421{
2422 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);2422 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2423 int i;2423 int i;
2424 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;2424 int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
2425 uint32_t **dest32 = (uint32_t**)dest;2425 uint32_t **dest32 = (uint32_t**)dest;
@@ -2476,7 +2476,7 @@ yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, · 50 unmodified lines
2476 if (hasAlpha)2476 if (hasAlpha)
2477 dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14));2477 dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14));
2478 }2478 }
2479 if ((!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {2479 if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2480 for (i = 0; i < dstW; i++) {2480 for (i = 0; i < dstW; i++) {
2481 dest32[0][i] = av_bswap32(dest32[0][i]);2481 dest32[0][i] = av_bswap32(dest32[0][i]);
2482 dest32[1][i] = av_bswap32(dest32[1][i]);2482 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
3175 yuv2packedX_fn *yuv2packedX,3175 yuv2packedX_fn *yuv2packedX,
3176 yuv2anyX_fn *yuv2anyX)3176 yuv2anyX_fn *yuv2anyX)
3177{3177{
3178 enum AVPixelFormat dstFormat = c->dstFormat;3178 enum AVPixelFormat dstFormat = c->opts.dst_format;
3179 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);3179 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
3180 3180
3181 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {3181 if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
@@ -3223,7 +3223,7 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c, · 41 unmodified lines
3223 *yuv2nv12cX = yuv2nv12cX_c;3223 *yuv2nv12cX = yuv2nv12cX_c;
3224 }3224 }
3225 3225
3226 if(c->flags & SWS_FULL_CHR_H_INT) {3226 if(c->opts.flags & SWS_FULL_CHR_H_INT) {
3227 switch (dstFormat) {3227 switch (dstFormat) {
3228 case AV_PIX_FMT_RGBA:3228 case AV_PIX_FMT_RGBA:
3229#if CONFIG_SMALL3229#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
232av_cold void ff_sws_init_swscale_ppc(SwsInternal *c)232av_cold void ff_sws_init_swscale_ppc(SwsInternal *c)
233{233{
234#if HAVE_ALTIVEC234#if HAVE_ALTIVEC
235 enum AVPixelFormat dstFormat = c->dstFormat;235 enum AVPixelFormat dstFormat = c->opts.dst_format;
236 236
237 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))237 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
238 return;238 return;
@@ -256,8 +256,8 @@ av_cold void ff_sws_init_swscale_ppc(SwsInternal *c) · 17 unmodified lines
256 256
257 /* The following list of supported dstFormat values should257 /* The following list of supported dstFormat values should
258 * match what's found in the body of ff_yuv2packedX_altivec() */258 * match what's found in the body of ff_yuv2packedX_altivec() */
259 if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {259 if (!(c->opts.flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {
260 switch (c->dstFormat) {260 switch (c->opts.dst_format) {
261 case AV_PIX_FMT_ABGR:261 case AV_PIX_FMT_ABGR:
262 c->yuv2packedX = ff_yuv2abgr_X_altivec;262 c->yuv2packedX = ff_yuv2abgr_X_altivec;
263 break;263 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
1862 const uint8_t *_src, const int16_t *filter,1862 const uint8_t *_src, const int16_t *filter,
1863 const int32_t *filterPos, int filterSize)1863 const int32_t *filterPos, int filterSize)
1864{1864{
1865 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);1865 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
1866 int i, j;1866 int i, j;
1867 int32_t *dst = (int32_t *) _dst;1867 int32_t *dst = (int32_t *) _dst;
1868 const uint16_t *src = (const uint16_t *) _src;1868 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
1891 };1891 };
1892 const vec_u8 vunused = vunusedtab[filterSize % 8];1892 const vec_u8 vunused = vunusedtab[filterSize % 8];
1893 1893
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) {
1895 sh = 9;1895 sh = 9;
1896 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */1896 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
1897 sh = 16 - 1 - 4;1897 sh = 16 - 1 - 4;
@@ -1940,7 +1940,7 @@ static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW, · 42 unmodified lines
1940 const uint8_t *_src, const int16_t *filter,1940 const uint8_t *_src, const int16_t *filter,
1941 const int32_t *filterPos, int filterSize)1941 const int32_t *filterPos, int filterSize)
1942{1942{
1943 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);1943 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
1944 int i, j;1944 int i, j;
1945 const uint16_t *src = (const uint16_t *) _src;1945 const uint16_t *src = (const uint16_t *) _src;
1946 int sh = desc->comp[0].depth - 1;1946 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
1968 const vec_u8 vunused = vunusedtab[filterSize % 8];1968 const vec_u8 vunused = vunusedtab[filterSize % 8];
1969 1969
1970 if (sh<15) {1970 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);
1972 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */1972 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
1973 sh = 16 - 1;1973 sh = 16 - 1;
1974 }1974 }
@@ -2019,7 +2019,7 @@ static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW, · 44 unmodified lines
2019av_cold void ff_sws_init_swscale_vsx(SwsInternal *c)2019av_cold void ff_sws_init_swscale_vsx(SwsInternal *c)
2020{2020{
2021#if HAVE_VSX2021#if HAVE_VSX
2022 enum AVPixelFormat dstFormat = c->dstFormat;2022 enum AVPixelFormat dstFormat = c->opts.dst_format;
2023 const int cpu_flags = av_get_cpu_flags();2023 const int cpu_flags = av_get_cpu_flags();
2024 const unsigned char power8 = HAVE_POWER8 && cpu_flags & AV_CPU_FLAG_POWER8;2024 const unsigned char power8 = HAVE_POWER8 && cpu_flags & AV_CPU_FLAG_POWER8;
2025 2025
@@ -2030,7 +2030,7 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) · 4 unmodified lines
2030 if (c->srcBpc == 8) {2030 if (c->srcBpc == 8) {
2031 if (c->dstBpc <= 14) {2031 if (c->dstBpc <= 14) {
2032 c->hyScale = c->hcScale = hScale_real_vsx;2032 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) {
2034 c->hyscale_fast = hyscale_fast_vsx;2034 c->hyscale_fast = hyscale_fast_vsx;
2035 c->hcscale_fast = hcscale_fast_vsx;2035 c->hcscale_fast = hcscale_fast_vsx;
2036 }2036 }
@@ -2048,7 +2048,7 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) · 11 unmodified lines
2048 }2048 }
2049#endif2049#endif
2050 2050
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) {
2052 switch (c->dstBpc) {2052 switch (c->dstBpc) {
2053 case 8:2053 case 8:
2054 c->yuv2plane1 = yuv2plane1_8_vsx;2054 c->yuv2plane1 = yuv2plane1_8_vsx;
@@ -2082,11 +2082,11 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) · 27 unmodified lines
2082 }2082 }
2083 }2083 }
2084 2084
2085 if (c->flags & SWS_BITEXACT)2085 if (c->opts.flags & SWS_BITEXACT)
2086 return;2086 return;
2087 2087
2088#if !HAVE_BIGENDIAN2088#if !HAVE_BIGENDIAN
2089 if (c->flags & SWS_FULL_CHR_H_INT) {2089 if (c->opts.flags & SWS_FULL_CHR_H_INT) {
2090 switch (dstFormat) {2090 switch (dstFormat) {
2091 case AV_PIX_FMT_RGB24:2091 case AV_PIX_FMT_RGB24:
2092 if (power8) {2092 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
299 const int *instrides, int srcSliceY, int srcSliceH, \299 const int *instrides, int srcSliceY, int srcSliceH, \
300 unsigned char *const *oplanes, const int *outstrides) \300 unsigned char *const *oplanes, const int *outstrides) \
301{ \301{ \
302 int w = c->srcW; \302 int w = c->opts.src_w; \
303 int h = srcSliceH; \303 int h = srcSliceH; \
304 int i, j; \304 int i, j; \
305 int instrides_scl[3]; \305 int instrides_scl[3]; \
@@ -475,7 +475,7 @@ static int altivec_uyvy_rgb32(SwsInternal *c, const unsigned char *const *in, · 169 unmodified lines
475 const int *instrides, int srcSliceY, int srcSliceH,475 const int *instrides, int srcSliceY, int srcSliceH,
476 unsigned char *const *oplanes, const int *outstrides)476 unsigned char *const *oplanes, const int *outstrides)
477{477{
478 int w = c->srcW;478 int w = c->opts.src_w;
479 int h = srcSliceH;479 int h = srcSliceH;
480 int i, j;480 int i, j;
481 vector unsigned char uyvy;481 vector unsigned char uyvy;
@@ -545,20 +545,20 @@ av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c) · 63 unmodified lines
545 * boom with X11 bad match.545 * boom with X11 bad match.
546 *546 *
547 */547 */
548 if ((c->srcW & 0xf) != 0)548 if ((c->opts.src_w & 0xf) != 0)
549 return NULL;549 return NULL;
550 550
551 switch (c->srcFormat) {551 switch (c->opts.src_format) {
552 case AV_PIX_FMT_YUV410P:552 case AV_PIX_FMT_YUV410P:
553 case AV_PIX_FMT_YUV420P:553 case AV_PIX_FMT_YUV420P:
554 /*case IMGFMT_CLPL: ??? */554 /*case IMGFMT_CLPL: ??? */
555 case AV_PIX_FMT_GRAY8:555 case AV_PIX_FMT_GRAY8:
556 case AV_PIX_FMT_NV12:556 case AV_PIX_FMT_NV12:
557 case AV_PIX_FMT_NV21:557 case AV_PIX_FMT_NV21:
558 if ((c->srcH & 0x1) != 0)558 if ((c->opts.src_h & 0x1) != 0)
559 return NULL;559 return NULL;
560 560
561 switch (c->dstFormat) {561 switch (c->opts.dst_format) {
562 case AV_PIX_FMT_RGB24:562 case AV_PIX_FMT_RGB24:
563 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n");563 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n");
564 return altivec_yuv2_rgb24;564 return altivec_yuv2_rgb24;
@@ -582,7 +582,7 @@ av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c) · 17 unmodified lines
582 break;582 break;
583 583
584 case AV_PIX_FMT_UYVY422:584 case AV_PIX_FMT_UYVY422:
585 switch (c->dstFormat) {585 switch (c->opts.dst_format) {
586 case AV_PIX_FMT_BGR32:586 case AV_PIX_FMT_BGR32:
587 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n");587 av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n");
588 return altivec_uyvy_rgb32;588 return altivec_uyvy_rgb32;
@@ -742,7 +742,7 @@ static av_always_inline void yuv2packedX_altivec(SwsInternal *c, · 153 unmodified lines
742 if (!printed_error_message) {742 if (!printed_error_message) {
743 av_log(c, AV_LOG_ERROR,743 av_log(c, AV_LOG_ERROR,
744 "altivec_yuv2packedX doesn't support %s output\n",744 "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));
746 printed_error_message = 1;746 printed_error_message = 1;
747 }747 }
748 return;748 return;
@@ -830,7 +830,7 @@ static av_always_inline void yuv2packedX_altivec(SwsInternal *c, · 81 unmodified lines
830 /* Unreachable, I think. */830 /* Unreachable, I think. */
831 av_log(c, AV_LOG_ERROR,831 av_log(c, AV_LOG_ERROR,
832 "altivec_yuv2packedX doesn't support %s output\n",832 "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));
834 return;834 return;
835 }835 }
836 836
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
37 const int dstStride_a[])37 const int dstStride_a[])
38{38{
39 uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;39 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,
41 // srcStride[0], srcStride[1], dstStride[0]);41 // srcStride[0], srcStride[1], dstStride[0]);
42 const uint8_t *ysrc = src[0];42 const uint8_t *ysrc = src[0];
43 const uint8_t *usrc = src[1];43 const uint8_t *usrc = src[1];
44 const uint8_t *vsrc = src[2];44 const uint8_t *vsrc = src[2];
45 const int width = c->srcW;45 const int width = c->opts.src_w;
46 const int height = srcSliceH;46 const int height = srcSliceH;
47 const int lumStride = srcStride[0];47 const int lumStride = srcStride[0];
48 const int chromStride = srcStride[1];48 const int chromStride = srcStride[1];
@@ -113,12 +113,12 @@ static int yv12touyvy_unscaled_altivec(SwsInternal *c, const uint8_t *const src[ · 64 unmodified lines
113 const int dstStride_a[])113 const int dstStride_a[])
114{114{
115 uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;115 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,
117 // srcStride[0], srcStride[1], dstStride[0]);117 // srcStride[0], srcStride[1], dstStride[0]);
118 const uint8_t *ysrc = src[0];118 const uint8_t *ysrc = src[0];
119 const uint8_t *usrc = src[1];119 const uint8_t *usrc = src[1];
120 const uint8_t *vsrc = src[2];120 const uint8_t *vsrc = src[2];
121 const int width = c->srcW;121 const int width = c->opts.src_w;
122 const int height = srcSliceH;122 const int height = srcSliceH;
123 const int lumStride = srcStride[0];123 const int lumStride = srcStride[0];
124 const int chromStride = srcStride[1];124 const int chromStride = srcStride[1];
@@ -190,9 +190,9 @@ av_cold void ff_get_unscaled_swscale_ppc(SwsInternal *c) · 65 unmodified lines
190 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))190 if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
191 return;191 return;
192 192
193 if (!(c->srcW & 15) && !(c->flags & SWS_BITEXACT) &&193 if (!(c->opts.src_w & 15) && !(c->opts.flags & SWS_BITEXACT) &&
194 c->srcFormat == AV_PIX_FMT_YUV420P) {194 c->opts.src_format == AV_PIX_FMT_YUV420P) {
195 enum AVPixelFormat dstFormat = c->dstFormat;195 enum AVPixelFormat dstFormat = c->opts.dst_format;
196 196
197 // unscaled YV12 -> packed YUV, we want speed197 // unscaled YV12 -> packed YUV, we want speed
198 if (dstFormat == AV_PIX_FMT_YUYV422)198 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
41 41
42 if (c->dstBpc <= 14 &&42 if (c->dstBpc <= 14 &&
43 (flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {43 (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;
45 45
46 c->lumConvertRange = convs[from].lum;46 c->lumConvertRange = convs[from].lum;
47 c->chrConvertRange = convs[from].chr;47 c->chrConvertRange = convs[from].chr;
@@ -72,7 +72,7 @@ av_cold void ff_sws_init_swscale_riscv(SwsInternal *c) · 24 unmodified lines
72 int flags = av_get_cpu_flags();72 int flags = av_get_cpu_flags();
73 73
74 if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {74 if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
75 switch (c->srcFormat) {75 switch (c->opts.src_format) {
76 case AV_PIX_FMT_ABGR:76 case AV_PIX_FMT_ABGR:
77 c->lumToYV12 = ff_abgr32ToY_rvv;77 c->lumToYV12 = ff_abgr32ToY_rvv;
78 if (c->chrSrcHSubSample)78 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
221static void get_min_buffer_size(SwsInternal *c, int *out_lum_size, int *out_chr_size)221static void get_min_buffer_size(SwsInternal *c, int *out_lum_size, int *out_chr_size)
222{222{
223 int lumY;223 int lumY;
224 int dstH = c->dstH;224 int dstH = c->opts.dst_h;
225 int chrDstH = c->chrDstH;225 int chrDstH = c->chrDstH;
226 int *lumFilterPos = c->vLumFilterPos;226 int *lumFilterPos = c->vLumFilterPos;
227 int *chrFilterPos = c->vChrFilterPos;227 int *chrFilterPos = c->vChrFilterPos;
@@ -253,14 +253,14 @@ int ff_init_filters(SwsInternal * c) · 25 unmodified lines
253 int index;253 int index;
254 int num_ydesc;254 int num_ydesc;
255 int num_cdesc;255 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;
257 int need_lum_conv = c->lumToYV12 || c->readLumPlanar || c->alpToYV12 || c->readAlpPlanar;257 int need_lum_conv = c->lumToYV12 || c->readLumPlanar || c->alpToYV12 || c->readAlpPlanar;
258 int need_chr_conv = c->chrToYV12 || c->readChrPlanar;258 int need_chr_conv = c->chrToYV12 || c->readChrPlanar;
259 int need_gamma = c->is_internal_gamma;259 int need_gamma = c->is_internal_gamma;
260 int srcIdx, dstIdx;260 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);
262 262
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;
264 int res = 0;264 int res = 0;
265 265
266 int lumBufSize;266 int lumBufSize;
@@ -284,7 +284,7 @@ int ff_init_filters(SwsInternal * c) · 17 unmodified lines
284 c->descIndex[0] = num_ydesc + (need_gamma ? 1 : 0);284 c->descIndex[0] = num_ydesc + (need_gamma ? 1 : 0);
285 c->descIndex[1] = num_ydesc + num_cdesc + (need_gamma ? 1 : 0);285 c->descIndex[1] = num_ydesc + num_cdesc + (need_gamma ? 1 : 0);
286 286
287 if (isFloat16(c->srcFormat)) {287 if (isFloat16(c->opts.src_format)) {
288 c->h2f_tables = av_malloc(sizeof(*c->h2f_tables));288 c->h2f_tables = av_malloc(sizeof(*c->h2f_tables));
289 if (!c->h2f_tables)289 if (!c->h2f_tables)
290 return AVERROR(ENOMEM);290 return AVERROR(ENOMEM);
@@ -301,25 +301,25 @@ int ff_init_filters(SwsInternal * c) · 10 unmodified lines
301 goto cleanup;301 goto cleanup;
302 }302 }
303 303
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);
305 if (res < 0) goto cleanup;305 if (res < 0) goto cleanup;
306 for (i = 1; i < c->numSlice-2; ++i) {306 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);
308 if (res < 0) goto cleanup;308 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);
310 if (res < 0) goto cleanup;310 if (res < 0) goto cleanup;
311 }311 }
312 // horizontal scaler output312 // 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);
314 if (res < 0) goto cleanup;314 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);
316 if (res < 0) goto cleanup;316 if (res < 0) goto cleanup;
317 317
318 fill_ones(&c->slice[i], dst_stride>>1, c->dstBpc);318 fill_ones(&c->slice[i], dst_stride>>1, c->dstBpc);
319 319
320 // vertical scaler output320 // vertical scaler output
321 ++i;321 ++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);
323 if (res < 0) goto cleanup;323 if (res < 0) goto cleanup;
324 324
325 index = 0;325 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
66 const uint8_t *_src, const int16_t *filter,66 const uint8_t *_src, const int16_t *filter,
67 const int32_t *filterPos, int filterSize)67 const int32_t *filterPos, int filterSize)
68{68{
69 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);69 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
70 int i;70 int i;
71 int32_t *dst = (int32_t *) _dst;71 int32_t *dst = (int32_t *) _dst;
72 const uint16_t *src = (const uint16_t *) _src;72 const uint16_t *src = (const uint16_t *) _src;
73 int bits = desc->comp[0].depth - 1;73 int bits = desc->comp[0].depth - 1;
74 int sh = bits - 4;74 int sh = bits - 4;
75 75
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) {
77 sh = 9;77 sh = 9;
78 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */78 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
79 sh = 16 - 1 - 4;79 sh = 16 - 1 - 4;
@@ -96,13 +96,13 @@ static void hScale16To15_c(SwsInternal *c, int16_t *dst, int dstW, · 16 unmodified lines
96 const uint8_t *_src, const int16_t *filter,96 const uint8_t *_src, const int16_t *filter,
97 const int32_t *filterPos, int filterSize)97 const int32_t *filterPos, int filterSize)
98{98{
99 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);99 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
100 int i;100 int i;
101 const uint16_t *src = (const uint16_t *) _src;101 const uint16_t *src = (const uint16_t *) _src;
102 int sh = desc->comp[0].depth - 1;102 int sh = desc->comp[0].depth - 1;
103 103
104 if (sh<15) {104 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);
106 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */106 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
107 sh = 16 - 1;107 sh = 16 - 1;
108 }108 }
@@ -237,15 +237,15 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 128 unmodified lines
237 int srcSliceY, int srcSliceH, uint8_t *const dst[],237 int srcSliceY, int srcSliceH, uint8_t *const dst[],
238 const int dstStride[], int dstSliceY, int dstSliceH)238 const int dstStride[], int dstSliceY, int dstSliceH)
239{239{
240 const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH;240 const int scale_dst = dstSliceY > 0 || dstSliceH < c->opts.dst_h;
241 241
242 /* load a few things into local vars to make the code more readable?242 /* load a few things into local vars to make the code more readable?
243 * and faster */243 * and faster */
244 const int dstW = c->dstW;244 const int dstW = c->opts.dst_w;
245 int dstH = c->dstH;245 int dstH = c->opts.dst_h;
246 246
247 const enum AVPixelFormat dstFormat = c->dstFormat;247 const enum AVPixelFormat dstFormat = c->opts.dst_format;
248 const int flags = c->flags;248 const int flags = c->opts.flags;
249 int32_t *vLumFilterPos = c->vLumFilterPos;249 int32_t *vLumFilterPos = c->vLumFilterPos;
250 int32_t *vChrFilterPos = c->vChrFilterPos;250 int32_t *vChrFilterPos = c->vChrFilterPos;
251 251
@@ -261,8 +261,8 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 9 unmodified lines
261 yuv2anyX_fn yuv2anyX = c->yuv2anyX;261 yuv2anyX_fn yuv2anyX = c->yuv2anyX;
262 const int chrSrcSliceY = srcSliceY >> c->chrSrcVSubSample;262 const int chrSrcSliceY = srcSliceY >> c->chrSrcVSubSample;
263 const int chrSrcSliceH = AV_CEIL_RSHIFT(srcSliceH, c->chrSrcVSubSample);263 const int chrSrcSliceH = AV_CEIL_RSHIFT(srcSliceH, c->chrSrcVSubSample);
264 int should_dither = isNBPS(c->srcFormat) ||264 int should_dither = isNBPS(c->opts.src_format) ||
265 is16BPS(c->srcFormat);265 is16BPS(c->opts.src_format);
266 int lastDstY;266 int lastDstY;
267 267
268 /* vars which will change and which we need to store back in the context */268 /* 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
289 const uint8_t *src2[4];289 const uint8_t *src2[4];
290 int srcStride2[4];290 int srcStride2[4];
291 291
292 if (isPacked(c->srcFormat)) {292 if (isPacked(c->opts.src_format)) {
293 src2[0] =293 src2[0] =
294 src2[1] =294 src2[1] =
295 src2[2] =295 src2[2] =
@@ -364,10 +364,10 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 68 unmodified lines
364 ff_init_vscale_pfn(c, yuv2plane1, yuv2planeX, yuv2nv12cX,364 ff_init_vscale_pfn(c, yuv2plane1, yuv2planeX, yuv2nv12cX,
365 yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, c->use_mmx_vfilter);365 yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, c->use_mmx_vfilter);
366 366
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,
368 srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH, 1);368 srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH, 1);
369 369
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,
371 dstY, dstSliceH, dstY >> c->chrDstVSubSample,371 dstY, dstSliceH, dstY >> c->chrDstVSubSample,
372 AV_CEIL_RSHIFT(dstSliceH, c->chrDstVSubSample), scale_dst);372 AV_CEIL_RSHIFT(dstSliceH, c->chrDstVSubSample), scale_dst);
373 if (srcSliceY == 0) {373 if (srcSliceY == 0) {
@@ -389,13 +389,13 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 15 unmodified lines
389 389
390 // First line needed as input390 // First line needed as input
391 const int firstLumSrcY = FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]);391 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)]);
393 // First line needed as input393 // First line needed as input
394 const int firstChrSrcY = FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]);394 const int firstChrSrcY = FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]);
395 395
396 // Last line needed as input396 // Last line needed as input
397 int lastLumSrcY = FFMIN(c->srcH, firstLumSrcY + vLumFilterSize) - 1;397 int lastLumSrcY = FFMIN(c->opts.src_h, firstLumSrcY + vLumFilterSize) - 1;
398 int lastLumSrcY2 = FFMIN(c->srcH, firstLumSrcY2 + vLumFilterSize) - 1;398 int lastLumSrcY2 = FFMIN(c->opts.src_h, firstLumSrcY2 + vLumFilterSize) - 1;
399 int lastChrSrcY = FFMIN(c->chrSrcH, firstChrSrcY + vChrFilterSize) - 1;399 int lastChrSrcY = FFMIN(c->chrSrcH, firstChrSrcY + vChrFilterSize) - 1;
400 int enough_lines;400 int enough_lines;
401 401
@@ -488,13 +488,13 @@ int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[] · 86 unmodified lines
488 488
489#if HAVE_MMX_INLINE489#if HAVE_MMX_INLINE
490 ff_updateMMXDitherTables(c, dstY);490 ff_updateMMXDitherTables(c, dstY);
491 c->dstW_mmx = c->dstW;491 c->dstW_mmx = c->opts.dst_w;
492#endif492#endif
493 if (should_dither) {493 if (should_dither) {
494 c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];494 c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];
495 c->lumDither8 = ff_dither_8x8_128[dstY & 7];495 c->lumDither8 = ff_dither_8x8_128[dstY & 7];
496 }496 }
497 if (dstY >= c->dstH - 2) {497 if (dstY >= c->opts.dst_h - 2) {
498 /* hmm looks like we can't use MMX here without overwriting498 /* hmm looks like we can't use MMX here without overwriting
499 * this array's tail */499 * this array's tail */
500 ff_sws_init_output_funcs(c, &yuv2plane1, &yuv2planeX, &yuv2nv12cX,500 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
544{544{
545 c->lumConvertRange = NULL;545 c->lumConvertRange = NULL;
546 c->chrConvertRange = NULL;546 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)) {
548 if (c->dstBpc <= 14) {548 if (c->dstBpc <= 14) {
549 if (c->srcRange) {549 if (c->opts.src_range) {
550 c->lumConvertRange = lumRangeFromJpeg_c;550 c->lumConvertRange = lumRangeFromJpeg_c;
551 c->chrConvertRange = chrRangeFromJpeg_c;551 c->chrConvertRange = chrRangeFromJpeg_c;
552 } else {552 } else {
@@ -554,7 +554,7 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c) · 1 unmodified line
554 c->chrConvertRange = chrRangeToJpeg_c;554 c->chrConvertRange = chrRangeToJpeg_c;
555 }555 }
556 } else {556 } else {
557 if (c->srcRange) {557 if (c->opts.src_range) {
558 c->lumConvertRange = lumRangeFromJpeg16_c;558 c->lumConvertRange = lumRangeFromJpeg16_c;
559 c->chrConvertRange = chrRangeFromJpeg16_c;559 c->chrConvertRange = chrRangeFromJpeg16_c;
560 } else {560 } else {
@@ -577,7 +577,7 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c) · 16 unmodified lines
577 577
578static av_cold void sws_init_swscale(SwsInternal *c)578static av_cold void sws_init_swscale(SwsInternal *c)
579{579{
580 enum AVPixelFormat srcFormat = c->srcFormat;580 enum AVPixelFormat srcFormat = c->opts.src_format;
581 581
582 ff_sws_init_output_funcs(c, &c->yuv2plane1, &c->yuv2planeX,582 ff_sws_init_output_funcs(c, &c->yuv2plane1, &c->yuv2planeX,
583 &c->yuv2nv12cX, &c->yuv2packed1,583 &c->yuv2nv12cX, &c->yuv2packed1,
@@ -589,7 +589,7 @@ static av_cold void sws_init_swscale(SwsInternal *c) · 5 unmodified lines
589 if (c->srcBpc == 8) {589 if (c->srcBpc == 8) {
590 if (c->dstBpc <= 14) {590 if (c->dstBpc <= 14) {
591 c->hyScale = c->hcScale = hScale8To15_c;591 c->hyScale = c->hcScale = hScale8To15_c;
592 if (c->flags & SWS_FAST_BILINEAR) {592 if (c->opts.flags & SWS_FAST_BILINEAR) {
593 c->hyscale_fast = ff_hyscale_fast_c;593 c->hyscale_fast = ff_hyscale_fast_c;
594 c->hcscale_fast = ff_hcscale_fast_c;594 c->hcscale_fast = ff_hcscale_fast_c;
595 }595 }
@@ -603,7 +603,7 @@ static av_cold void sws_init_swscale(SwsInternal *c) · 7 unmodified lines
603 603
604 ff_sws_init_range_convert(c);604 ff_sws_init_range_convert(c);
605 605
606 if (!(isGray(srcFormat) || isGray(c->dstFormat) ||606 if (!(isGray(srcFormat) || isGray(c->opts.dst_format) ||
607 srcFormat == AV_PIX_FMT_MONOBLACK || srcFormat == AV_PIX_FMT_MONOWHITE))607 srcFormat == AV_PIX_FMT_MONOBLACK || srcFormat == AV_PIX_FMT_MONOWHITE))
608 c->needs_hcscale = 1;608 c->needs_hcscale = 1;
609}609}
@@ -659,7 +659,7 @@ static int check_image_pointers(const uint8_t * const data[4], enum AVPixelForma · 49 unmodified lines
659void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride,659void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride,
660 const uint8_t *src, int src_stride, int w, int h)660 const uint8_t *src, int src_stride, int w, int h)
661{661{
662 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);662 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
663 663
664 for (int yp = 0; yp < h; yp++) {664 for (int yp = 0; yp < h; yp++) {
665 const uint16_t *src16 = (const uint16_t *) src;665 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
718void ff_rgb48Toxyz12(const SwsInternal *c, uint8_t *dst, int dst_stride,718void ff_rgb48Toxyz12(const SwsInternal *c, uint8_t *dst, int dst_stride,
719 const uint8_t *src, int src_stride, int w, int h)719 const uint8_t *src, int src_stride, int w, int h)
720{720{
721 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);721 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
722 722
723 for (int yp = 0; yp < h; yp++) {723 for (int yp = 0; yp < h; yp++) {
724 uint16_t *src16 = (uint16_t *) src;724 uint16_t *src16 = (uint16_t *) src;
@@ -778,28 +778,28 @@ void ff_update_palette(SwsInternal *c, const uint32_t *pal) · 53 unmodified lines
778{778{
779 for (int i = 0; i < 256; i++) {779 for (int i = 0; i < 256; i++) {
780 int r, g, b, y, u, v, a = 0xff;780 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) {
782 uint32_t p = pal[i];782 uint32_t p = pal[i];
783 a = (p >> 24) & 0xFF;783 a = (p >> 24) & 0xFF;
784 r = (p >> 16) & 0xFF;784 r = (p >> 16) & 0xFF;
785 g = (p >> 8) & 0xFF;785 g = (p >> 8) & 0xFF;
786 b = p & 0xFF;786 b = p & 0xFF;
787 } else if (c->srcFormat == AV_PIX_FMT_RGB8) {787 } else if (c->opts.src_format == AV_PIX_FMT_RGB8) {
788 r = ( i >> 5 ) * 36;788 r = ( i >> 5 ) * 36;
789 g = ((i >> 2) & 7) * 36;789 g = ((i >> 2) & 7) * 36;
790 b = ( i & 3) * 85;790 b = ( i & 3) * 85;
791 } else if (c->srcFormat == AV_PIX_FMT_BGR8) {791 } else if (c->opts.src_format == AV_PIX_FMT_BGR8) {
792 b = ( i >> 6 ) * 85;792 b = ( i >> 6 ) * 85;
793 g = ((i >> 3) & 7) * 36;793 g = ((i >> 3) & 7) * 36;
794 r = ( i & 7) * 36;794 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) {
796 r = ( i >> 3 ) * 255;796 r = ( i >> 3 ) * 255;
797 g = ((i >> 1) & 3) * 85;797 g = ((i >> 1) & 3) * 85;
798 b = ( i & 1) * 255;798 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) {
800 r = g = b = i;800 r = g = b = i;
801 } else {801 } else {
802 av_assert1(c->srcFormat == AV_PIX_FMT_BGR4_BYTE);802 av_assert1(c->opts.src_format == AV_PIX_FMT_BGR4_BYTE);
803 b = ( i >> 3 ) * 255;803 b = ( i >> 3 ) * 255;
804 g = ((i >> 1) & 3) * 85;804 g = ((i >> 1) & 3) * 85;
805 r = ( i & 1) * 255;805 r = ( i & 1) * 255;
@@ -820,7 +820,7 @@ void ff_update_palette(SwsInternal *c, const uint32_t *pal) · 14 unmodified lines
820 v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);820 v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
821 c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24);821 c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24);
822 822
823 switch (c->dstFormat) {823 switch (c->opts.dst_format) {
824 case AV_PIX_FMT_BGR32:824 case AV_PIX_FMT_BGR32:
825#if !HAVE_BIGENDIAN825#if !HAVE_BIGENDIAN
826 case AV_PIX_FMT_RGB24:826 case AV_PIX_FMT_RGB24:
@@ -863,7 +863,7 @@ static int scale_gamma(SwsInternal *c, · 36 unmodified lines
863{863{
864 int ret = scale_internal(c->cascaded_context[0],864 int ret = scale_internal(c->cascaded_context[0],
865 srcSlice, srcStride, srcSliceY, srcSliceH,865 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);
867 867
868 if (ret < 0)868 if (ret < 0)
869 return ret;869 return ret;
@@ -871,7 +871,7 @@ static int scale_gamma(SwsInternal *c, · 1 unmodified line
871 if (c->cascaded_context[2])871 if (c->cascaded_context[2])
872 ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],872 ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],
873 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,873 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);
875 else875 else
876 ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],876 ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0],
877 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,877 c->cascaded_tmpStride[0], srcSliceY, srcSliceH,
@@ -895,7 +895,7 @@ static int scale_cascaded(SwsInternal *c, · 17 unmodified lines
895 uint8_t * const dstSlice[], const int dstStride[],895 uint8_t * const dstSlice[], const int dstStride[],
896 int dstSliceY, int dstSliceH)896 int dstSliceY, int dstSliceH)
897{897{
898 const int dstH0 = sws_internal(c->cascaded_context[0])->dstH;898 const int dstH0 = sws_internal(c->cascaded_context[0])->opts.dst_h;
899 int ret = scale_internal(c->cascaded_context[0],899 int ret = scale_internal(c->cascaded_context[0],
900 srcSlice, srcStride, srcSliceY, srcSliceH,900 srcSlice, srcStride, srcSliceY, srcSliceH,
901 c->cascaded_tmp[0], c->cascaded_tmpStride[0],901 c->cascaded_tmp[0], c->cascaded_tmpStride[0],
@@ -915,13 +915,13 @@ static int scale_internal(SwsContext *sws, · 13 unmodified lines
915 int dstSliceY, int dstSliceH)915 int dstSliceY, int dstSliceH)
916{916{
917 SwsInternal *c = sws_internal(sws);917 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;
919 const int frame_start = scale_dst || !c->sliceDir;919 const int frame_start = scale_dst || !c->sliceDir;
920 int i, ret;920 int i, ret;
921 const uint8_t *src2[4];921 const uint8_t *src2[4];
922 uint8_t *dst2[4];922 uint8_t *dst2[4];
923 int macro_height_src = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample);923 int macro_height_src = isBayer(c->opts.src_format) ? 2 : (1 << c->chrSrcVSubSample);
924 int macro_height_dst = isBayer(c->dstFormat) ? 2 : (1 << c->chrDstVSubSample);924 int macro_height_dst = isBayer(c->opts.dst_format) ? 2 : (1 << c->chrDstVSubSample);
925 // copy strides, so they can safely be modified925 // copy strides, so they can safely be modified
926 int srcStride2[4];926 int srcStride2[4];
927 int dstStride2[4];927 int dstStride2[4];
@@ -933,25 +933,25 @@ static int scale_internal(SwsContext *sws, · 5 unmodified lines
933 }933 }
934 934
935 if ((srcSliceY & (macro_height_src - 1)) ||935 if ((srcSliceY & (macro_height_src - 1)) ||
936 ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != c->srcH) ||936 ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != c->opts.src_h) ||
937 srcSliceY + srcSliceH > c->srcH ||937 srcSliceY + srcSliceH > c->opts.src_h ||
938 (isBayer(c->srcFormat) && srcSliceH <= 1)) {938 (isBayer(c->opts.src_format) && srcSliceH <= 1)) {
939 av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);939 av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
940 return AVERROR(EINVAL);940 return AVERROR(EINVAL);
941 }941 }
942 942
943 if ((dstSliceY & (macro_height_dst - 1)) ||943 if ((dstSliceY & (macro_height_dst - 1)) ||
944 ((dstSliceH & (macro_height_dst - 1)) && dstSliceY + dstSliceH != c->dstH) ||944 ((dstSliceH & (macro_height_dst - 1)) && dstSliceY + dstSliceH != c->opts.dst_h) ||
945 dstSliceY + dstSliceH > c->dstH) {945 dstSliceY + dstSliceH > c->opts.dst_h) {
946 av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", dstSliceY, dstSliceH);946 av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", dstSliceY, dstSliceH);
947 return AVERROR(EINVAL);947 return AVERROR(EINVAL);
948 }948 }
949 949
950 if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {950 if (!check_image_pointers(srcSlice, c->opts.src_format, srcStride)) {
951 av_log(c, AV_LOG_ERROR, "bad src image pointers\n");951 av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
952 return AVERROR(EINVAL);952 return AVERROR(EINVAL);
953 }953 }
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)) {
955 av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");955 av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
956 return AVERROR(EINVAL);956 return AVERROR(EINVAL);
957 }957 }
@@ -960,22 +960,22 @@ static int scale_internal(SwsContext *sws, · 2 unmodified lines
960 if (srcSliceH == 0)960 if (srcSliceH == 0)
961 return 0;961 return 0;
962 962
963 if (c->gamma_flag && c->cascaded_context[0])963 if (c->opts.gamma_flag && c->cascaded_context[0])
964 return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH,964 return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH,
965 dstSlice, dstStride, dstSliceY, dstSliceH);965 dstSlice, dstStride, dstSliceY, dstSliceH);
966 966
967 if (c->cascaded_context[0] && srcSliceY == 0 &&967 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)
969 {969 {
970 return scale_cascaded(c, srcSlice, srcStride, srcSliceY, srcSliceH,970 return scale_cascaded(c, srcSlice, srcStride, srcSliceY, srcSliceH,
971 dstSlice, dstStride, dstSliceY, dstSliceH);971 dstSlice, dstStride, dstSliceY, dstSliceH);
972 }972 }
973 973
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])
975 for (i = 0; i < 4; i++)975 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));
977 977
978 if (usePal(c->srcFormat))978 if (usePal(c->opts.src_format))
979 ff_update_palette(c, (const uint32_t *)srcSlice[1]);979 ff_update_palette(c, (const uint32_t *)srcSlice[1]);
980 980
981 memcpy(src2, srcSlice, sizeof(src2));981 memcpy(src2, srcSlice, sizeof(src2));
@@ -984,7 +984,7 @@ static int scale_internal(SwsContext *sws, · 2 unmodified lines
984 memcpy(dstStride2, dstStride, sizeof(dstStride2));984 memcpy(dstStride2, dstStride, sizeof(dstStride2));
985 985
986 if (frame_start && !scale_dst) {986 if (frame_start && !scale_dst) {
987 if (srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {987 if (srcSliceY != 0 && srcSliceY + srcSliceH != c->opts.src_h) {
988 av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");988 av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
989 return AVERROR(EINVAL);989 return AVERROR(EINVAL);
990 }990 }
@@ -993,7 +993,7 @@ static int scale_internal(SwsContext *sws, · 2 unmodified lines
993 } else if (scale_dst)993 } else if (scale_dst)
994 c->sliceDir = 1;994 c->sliceDir = 1;
995 995
996 if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) {996 if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->opts.dst_format)) {
997 uint8_t *base;997 uint8_t *base;
998 int x,y;998 int x,y;
999 999
@@ -1005,15 +1005,15 @@ static int scale_internal(SwsContext *sws, · 5 unmodified lines
1005 base = srcStride[0] < 0 ? c->rgb0_scratch - srcStride[0] * (srcSliceH-1) :1005 base = srcStride[0] < 0 ? c->rgb0_scratch - srcStride[0] * (srcSliceH-1) :
1006 c->rgb0_scratch;1006 c->rgb0_scratch;
1007 for (y=0; y<srcSliceH; y++){1007 for (y=0; y<srcSliceH; y++){
1008 memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW);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->srcW; x+=4) {1009 for (x=c->src0Alpha-1; x<4*c->opts.src_w; x+=4) {
1010 base[ srcStride[0]*y + x] = 0xFF;1010 base[ srcStride[0]*y + x] = 0xFF;
1011 }1011 }
1012 }1012 }
1013 src2[0] = base;1013 src2[0] = base;
1014 }1014 }
1015 1015
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)) {
1017 uint8_t *base;1017 uint8_t *base;
1018 1018
1019 av_fast_malloc(&c->xyz_scratch, &c->xyz_scratch_allocated,1019 av_fast_malloc(&c->xyz_scratch, &c->xyz_scratch_allocated,
@@ -1024,7 +1024,7 @@ static int scale_internal(SwsContext *sws, · 4 unmodified lines
1024 base = srcStride[0] < 0 ? c->xyz_scratch - srcStride[0] * (srcSliceH-1) :1024 base = srcStride[0] < 0 ? c->xyz_scratch - srcStride[0] * (srcSliceH-1) :
1025 c->xyz_scratch;1025 c->xyz_scratch;
1026 1026
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);
1028 src2[0] = base;1028 src2[0] = base;
1029 }1029 }
1030 1030
@@ -1036,19 +1036,19 @@ static int scale_internal(SwsContext *sws, · 5 unmodified lines
1036 }1036 }
1037 1037
1038 src2[0] += (srcSliceH - 1) * srcStride[0];1038 src2[0] += (srcSliceH - 1) * srcStride[0];
1039 if (!usePal(c->srcFormat))1039 if (!usePal(c->opts.src_format))
1040 src2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1];1040 src2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1];
1041 src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2];1041 src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2];
1042 src2[3] += (srcSliceH - 1) * srcStride[3];1042 src2[3] += (srcSliceH - 1) * srcStride[3];
1043 dst2[0] += ( c->dstH - 1) * dstStride[0];1043 dst2[0] += ( c->opts.dst_h - 1) * dstStride[0];
1044 dst2[1] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[1];1044 dst2[1] += ((c->opts.dst_h >> c->chrDstVSubSample) - 1) * dstStride[1];
1045 dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2];1045 dst2[2] += ((c->opts.dst_h >> c->chrDstVSubSample) - 1) * dstStride[2];
1046 dst2[3] += ( c->dstH - 1) * dstStride[3];1046 dst2[3] += ( c->opts.dst_h - 1) * dstStride[3];
1047 1047
1048 srcSliceY_internal = c->srcH-srcSliceY-srcSliceH;1048 srcSliceY_internal = c->opts.src_h-srcSliceY-srcSliceH;
1049 }1049 }
1050 reset_ptr(src2, c->srcFormat);1050 reset_ptr(src2, c->opts.src_format);
1051 reset_ptr((void*)dst2, c->dstFormat);1051 reset_ptr((void*)dst2, c->opts.dst_format);
1052 1052
1053 if (c->convert_unscaled) {1053 if (c->convert_unscaled) {
1054 int offset = srcSliceY_internal;1054 int offset = srcSliceY_internal;
@@ -1058,13 +1058,13 @@ static int scale_internal(SwsContext *sws, · 3 unmodified lines
1058 if (scale_dst) {1058 if (scale_dst) {
1059 av_assert0(offset == 0);1059 av_assert0(offset == 0);
1060 for (i = 0; i < 4 && src2[i]; i++) {1060 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)))
1062 break;1062 break;
1063 src2[i] += (dstSliceY >> ((i == 1 || i == 2) ? c->chrSrcVSubSample : 0)) * srcStride2[i];1063 src2[i] += (dstSliceY >> ((i == 1 || i == 2) ? c->chrSrcVSubSample : 0)) * srcStride2[i];
1064 }1064 }
1065 1065
1066 for (i = 0; i < 4 && dst2[i]; i++) {1066 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)))
1068 break;1068 break;
1069 dst2[i] -= (dstSliceY >> ((i == 1 || i == 2) ? c->chrDstVSubSample : 0)) * dstStride2[i];1069 dst2[i] -= (dstSliceY >> ((i == 1 || i == 2) ? c->chrDstVSubSample : 0)) * dstStride2[i];
1070 }1070 }
@@ -1081,7 +1081,7 @@ static int scale_internal(SwsContext *sws, · 10 unmodified lines
1081 dst2, dstStride2, dstSliceY, dstSliceH);1081 dst2, dstStride2, dstSliceY, dstSliceH);
1082 }1082 }
1083 1083
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)) {
1085 uint8_t *dst;1085 uint8_t *dst;
1086 1086
1087 if (scale_dst) {1087 if (scale_dst) {
@@ -1091,16 +1091,16 @@ static int scale_internal(SwsContext *sws, · 3 unmodified lines
1091 1091
1092 av_assert0(dstY >= ret);1092 av_assert0(dstY >= ret);
1093 av_assert0(ret >= 0);1093 av_assert0(ret >= 0);
1094 av_assert0(c->dstH >= dstY);1094 av_assert0(c->opts.dst_h >= dstY);
1095 dst = dst2[0] + (dstY - ret) * dstStride2[0];1095 dst = dst2[0] + (dstY - ret) * dstStride2[0];
1096 }1096 }
1097 1097
1098 /* replace on the same data */1098 /* 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);
1100 }1100 }
1101 1101
1102 /* reset slice direction at end of frame */1102 /* 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)
1104 c->sliceDir = 0;1104 c->sliceDir = 0;
1105 1105
1106 return ret;1106 return ret;
@@ -1124,9 +1124,9 @@ int sws_frame_start(SwsContext *sws, AVFrame *dst, const AVFrame *src) · 17 unmodified lines
1124 return ret;1124 return ret;
1125 1125
1126 if (!dst->buf[0]) {1126 if (!dst->buf[0]) {
1127 dst->width = c->dstW;1127 dst->width = c->opts.dst_w;
1128 dst->height = c->dstH;1128 dst->height = c->opts.dst_h;
1129 dst->format = c->dstFormat;1129 dst->format = c->opts.dst_format;
1130 1130
1131 ret = av_frame_get_buffer(dst, 0);1131 ret = av_frame_get_buffer(dst, 0);
1132 if (ret < 0)1132 if (ret < 0)
@@ -1177,10 +1177,10 @@ int sws_receive_slice(SwsContext *sws, unsigned int slice_start, · 44 unmodified lines
1177 /* wait until complete input has been received */1177 /* wait until complete input has been received */
1178 if (!(c->src_ranges.nb_ranges == 1 &&1178 if (!(c->src_ranges.nb_ranges == 1 &&
1179 c->src_ranges.ranges[0].start == 0 &&1179 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))
1181 return AVERROR(EAGAIN);1181 return AVERROR(EAGAIN);
1182 1182
1183 if ((slice_start > 0 || slice_height < c->dstH) &&1183 if ((slice_start > 0 || slice_height < c->opts.dst_h) &&
1184 (slice_start % align || slice_height % align)) {1184 (slice_start % align || slice_height % align)) {
1185 av_log(c, AV_LOG_ERROR,1185 av_log(c, AV_LOG_ERROR,
1186 "Incorrectly aligned output: %u/%u not multiples of %u\n",1186 "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
1192 int nb_jobs = c->nb_slice_ctx;1192 int nb_jobs = c->nb_slice_ctx;
1193 int ret = 0;1193 int ret = 0;
1194 1194
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)
1196 nb_jobs = 1;1196 nb_jobs = 1;
1197 1197
1198 c->dst_slice_start = slice_start;1198 c->dst_slice_start = slice_start;
@@ -1218,7 +1218,7 @@ int sws_receive_slice(SwsContext *sws, unsigned int slice_start, · 19 unmodified lines
1218 }1218 }
1219 1219
1220 return scale_internal(sws, (const uint8_t * const *)c->frame_src->data,1220 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,
1222 dst, c->frame_dst->linesize, slice_start, slice_height);1222 dst, c->frame_dst->linesize, slice_start, slice_height);
1223}1223}
1224 1224
@@ -1256,7 +1256,7 @@ int attribute_align_arg sws_scale(SwsContext *sws, · 31 unmodified lines
1256 }1256 }
1257 1257
1258 return scale_internal(sws, srcSlice, srcStride, srcSliceY, srcSliceH,1258 return scale_internal(sws, srcSlice, srcStride, srcSliceY, srcSliceH,
1259 dst, dstStride, 0, c->dstH);1259 dst, dstStride, 0, c->opts.dst_h);
1260}1260}
1261 1261
1262void ff_sws_slice_worker(void *priv, int jobnr, int threadnr,1262void 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
1284 }1284 }
1285 1285
1286 err = scale_internal(sws, (const uint8_t * const *)parent->frame_src->data,1286 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,
1288 dst, parent->frame_dst->linesize,1288 dst, parent->frame_dst->linesize,
1289 parent->dst_slice_start + slice_start, slice_end - slice_start);1289 parent->dst_slice_start + slice_start, slice_end - slice_start);
1290 }1290 }
libswscale/swscale_internal.h+26−25
@@ -329,10 +329,31 @@ struct SwsFilterDescriptor; · 328 unmodified lines
329 329
330/* This struct should be aligned on at least a 32-byte boundary. */330/* This struct should be aligned on at least a 32-byte boundary. */
331struct SwsInternal {331struct SwsInternal {
332 /**332 /* Currently active user-facing options. */
333 * info on struct for av_log333 struct {
334 */334 const AVClass *av_class;
335 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;
336 357
337 SwsContext *parent;358 SwsContext *parent;
338 359
@@ -350,18 +371,12 @@ struct SwsInternal { · 11 unmodified lines
350 * sws_scale() wrapper so they can be freely modified here.371 * sws_scale() wrapper so they can be freely modified here.
351 */372 */
352 SwsFunc convert_unscaled;373 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.
357 int chrSrcW; ///< Width of source chroma planes.374 int chrSrcW; ///< Width of source chroma planes.
358 int chrSrcH; ///< Height of source chroma planes.375 int chrSrcH; ///< Height of source chroma planes.
359 int chrDstW; ///< Width of destination chroma planes.376 int chrDstW; ///< Width of destination chroma planes.
360 int chrDstH; ///< Height of destination chroma planes.377 int chrDstH; ///< Height of destination chroma planes.
361 int lumXInc, chrXInc;378 int lumXInc, chrXInc;
362 int lumYInc, chrYInc;379 int lumYInc, chrYInc;
363 enum AVPixelFormat dstFormat; ///< Destination pixel format.
364 enum AVPixelFormat srcFormat; ///< Source pixel format.
365 int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.380 int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.
366 int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.381 int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.
367 int dstBpc, srcBpc;382 int dstBpc, srcBpc;
@@ -371,8 +386,6 @@ struct SwsInternal { · 3 unmodified lines
371 int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image.386 int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image.
372 int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.387 int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
373 int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).388 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.
376 389
377 AVFrame *frame_src;390 AVFrame *frame_src;
378 AVFrame *frame_dst;391 AVFrame *frame_dst;
@@ -389,7 +402,6 @@ struct SwsInternal { · 10 unmodified lines
389 int cascaded_mainindex;402 int cascaded_mainindex;
390 403
391 double gamma_value;404 double gamma_value;
392 int gamma_flag;
393 int is_internal_gamma;405 int is_internal_gamma;
394 uint16_t *gamma;406 uint16_t *gamma;
395 uint16_t *inv_gamma;407 uint16_t *inv_gamma;
@@ -459,7 +471,6 @@ struct SwsInternal { · 63 unmodified lines
459 int warned_unuseable_bilinear;471 int warned_unuseable_bilinear;
460 472
461 int dstY; ///< Last destination vertical line output from last slice.473 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...
463 void *yuvTable; // pointer to the yuv->rgb table start so it can be freed()474 void *yuvTable; // pointer to the yuv->rgb table start so it can be freed()
464 // alignment ensures the offset can be added in a single475 // alignment ensures the offset can be added in a single
465 // instruction on e.g. ARM476 // instruction on e.g. ARM
@@ -485,16 +496,10 @@ struct SwsInternal { · 19 unmodified lines
485 int contrast, brightness, saturation; // for sws_getColorspaceDetails496 int contrast, brightness, saturation; // for sws_getColorspaceDetails
486 int srcColorspaceTable[4];497 int srcColorspaceTable[4];
487 int dstColorspaceTable[4];498 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).
490 int src0Alpha;499 int src0Alpha;
491 int dst0Alpha;500 int dst0Alpha;
492 int srcXYZ;501 int srcXYZ;
493 int dstXYZ;502 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;
498 int yuv2rgb_y_offset;503 int yuv2rgb_y_offset;
499 int yuv2rgb_y_coeff;504 int yuv2rgb_y_coeff;
500 int yuv2rgb_v2r_coeff;505 int yuv2rgb_v2r_coeff;
@@ -682,10 +687,6 @@ struct SwsInternal { · 181 unmodified lines
682 687
683 int needs_hcscale; ///< Set if there are chroma planes to be converted.688 int needs_hcscale; ///< Set if there are chroma planes to be converted.
684 689
685 SwsDither dither;
686
687 SwsAlphaBlend alphablend;
688
689 // scratch buffer for converting packed rgb0 sources690 // scratch buffer for converting packed rgb0 sources
690 // filled with a copy of the input frame + fully opaque alpha,691 // filled with a copy of the input frame + fully opaque alpha,
691 // then passed as input to further conversion692 // then passed as input to further conversion
@@ -712,7 +713,7 @@ static_assert(offsetof(SwsInternal, redDither) + DITHER32_INT == offsetof(SwsInt · 20 unmodified lines
712#if ARCH_X86_64713#if ARCH_X86_64
713/* x86 yuv2gbrp uses the SwsInternal for yuv coefficients714/* x86 yuv2gbrp uses the SwsInternal for yuv coefficients
714 if struct offsets change the asm needs to be updated too */715 if struct offsets change the asm needs to be updated too */
715static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40292,716static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40316,
716 "yuv2rgb_y_offset must be updated in x86 asm");717 "yuv2rgb_y_offset must be updated in x86 asm");
717#endif718#endif
718 719
libswscale/swscale_unscaled.c+154−154
@@ -146,10 +146,10 @@ static int planarToNv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 145 unmodified lines
146{146{
147 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2;147 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2;
148 148
149 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,149 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
150 dstParam[0], dstStride[0]);150 dstParam[0], dstStride[0]);
151 151
152 if (c->dstFormat == AV_PIX_FMT_NV12)152 if (c->opts.dst_format == AV_PIX_FMT_NV12)
153 interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2,153 interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2,
154 srcStride[1], srcStride[2], dstStride[1]);154 srcStride[1], srcStride[2], dstStride[1]);
155 else155 else
@@ -167,10 +167,10 @@ static int nv12ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], · 11 unmodified lines
167 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;167 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
168 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;168 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
169 169
170 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,170 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
171 dstParam[0], dstStride[0]);171 dstParam[0], dstStride[0]);
172 172
173 if (c->srcFormat == AV_PIX_FMT_NV12)173 if (c->opts.src_format == AV_PIX_FMT_NV12)
174 deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, (srcSliceH + 1) / 2,174 deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, (srcSliceH + 1) / 2,
175 srcStride[1], dstStride[1], dstStride[2]);175 srcStride[1], dstStride[1], dstStride[2]);
176 else176 else
@@ -187,10 +187,10 @@ static int planarToNv24Wrapper(SwsInternal *c, const uint8_t *const src[], · 10 unmodified lines
187{187{
188 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY;188 uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY;
189 189
190 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,190 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
191 dstParam[0], dstStride[0]);191 dstParam[0], dstStride[0]);
192 192
193 if (c->dstFormat == AV_PIX_FMT_NV24)193 if (c->opts.dst_format == AV_PIX_FMT_NV24)
194 interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH,194 interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH,
195 srcStride[1], srcStride[2], dstStride[1]);195 srcStride[1], srcStride[2], dstStride[1]);
196 else196 else
@@ -208,10 +208,10 @@ static int nv24ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], · 11 unmodified lines
208 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY;208 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY;
209 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY;209 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY;
210 210
211 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,211 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
212 dstParam[0], dstStride[0]);212 dstParam[0], dstStride[0]);
213 213
214 if (c->srcFormat == AV_PIX_FMT_NV24)214 if (c->opts.src_format == AV_PIX_FMT_NV24)
215 deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH,215 deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH,
216 srcStride[1], dstStride[1], dstStride[2]);216 srcStride[1], dstStride[1], dstStride[2]);
217 else217 else
@@ -250,15 +250,15 @@ static int nv24ToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], · 32 unmodified lines
250 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;250 uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
251 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;251 uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
252 252
253 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,253 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
254 dstParam[0], dstStride[0]);254 dstParam[0], dstStride[0]);
255 255
256 if (c->srcFormat == AV_PIX_FMT_NV24)256 if (c->opts.src_format == AV_PIX_FMT_NV24)
257 nv24_to_yuv420p_chroma(dst1, dstStride[1], dst2, dstStride[2],257 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);
259 else259 else
260 nv24_to_yuv420p_chroma(dst2, dstStride[2], dst1, dstStride[1],260 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);
262 262
263 return srcSliceH;263 return srcSliceH;
264}264}
@@ -268,8 +268,8 @@ static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], · 3 unmodified lines
268 int srcSliceH, uint8_t *const dstParam8[],268 int srcSliceH, uint8_t *const dstParam8[],
269 const int dstStride[])269 const int dstStride[])
270{270{
271 const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);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->dstFormat);272 const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format);
273 const uint16_t **src = (const uint16_t**)src8;273 const uint16_t **src = (const uint16_t**)src8;
274 uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY);274 uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY);
275 uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2);275 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
291 for (y = 0; y < srcSliceH; y++) {291 for (y = 0; y < srcSliceH; y++) {
292 uint16_t *tdstY = dstY;292 uint16_t *tdstY = dstY;
293 const uint16_t *tsrc0 = src[0];293 const uint16_t *tsrc0 = src[0];
294 for (x = c->srcW; x > 0; x--) {294 for (x = c->opts.src_w; x > 0; x--) {
295 *tdstY++ = *tsrc0++ << shift[0];295 *tdstY++ = *tsrc0++ << shift[0];
296 }296 }
297 src[0] += srcStride[0] / 2;297 src[0] += srcStride[0] / 2;
@@ -301,7 +301,7 @@ static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], · 3 unmodified lines
301 uint16_t *tdstUV = dstUV;301 uint16_t *tdstUV = dstUV;
302 const uint16_t *tsrc1 = src[1];302 const uint16_t *tsrc1 = src[1];
303 const uint16_t *tsrc2 = src[2];303 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--) {
305 *tdstUV++ = *tsrc1++ << shift[1];305 *tdstUV++ = *tsrc1++ << shift[1];
306 *tdstUV++ = *tsrc2++ << shift[2];306 *tdstUV++ = *tsrc2++ << shift[2];
307 }307 }
@@ -338,7 +338,7 @@ static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], · 30 unmodified lines
338 for (y = 0; y < srcSliceH; y++) {338 for (y = 0; y < srcSliceH; y++) {
339 uint16_t *tdstY = dstY;339 uint16_t *tdstY = dstY;
340 const uint8_t *tsrc0 = src0;340 const uint8_t *tsrc0 = src0;
341 for (x = c->srcW; x > 0; x--) {341 for (x = c->opts.src_w; x > 0; x--) {
342 t = *tsrc0++;342 t = *tsrc0++;
343 output_pixel(tdstY++, t << 8);343 output_pixel(tdstY++, t << 8);
344 }344 }
@@ -349,7 +349,7 @@ static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], · 4 unmodified lines
349 uint16_t *tdstUV = dstUV;349 uint16_t *tdstUV = dstUV;
350 const uint8_t *tsrc1 = src1;350 const uint8_t *tsrc1 = src1;
351 const uint8_t *tsrc2 = src2;351 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--) {
353 t = *tsrc1++;353 t = *tsrc1++;
354 output_pixel(tdstUV++, t << 8);354 output_pixel(tdstUV++, t << 8);
355 t = *tsrc2++;355 t = *tsrc2++;
@@ -372,7 +372,7 @@ static int planarToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
372{372{
373 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;373 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
374 374
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],
376 srcStride[1], dstStride[0]);376 srcStride[1], dstStride[0]);
377 377
378 return srcSliceH;378 return srcSliceH;
@@ -384,7 +384,7 @@ static int planarToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
384{384{
385 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;385 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
386 386
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],
388 srcStride[1], dstStride[0]);388 srcStride[1], dstStride[0]);
389 389
390 return srcSliceH;390 return srcSliceH;
@@ -396,7 +396,7 @@ static int yuv422pToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
396{396{
397 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;397 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
398 398
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],
400 srcStride[1], dstStride[0]);400 srcStride[1], dstStride[0]);
401 401
402 return srcSliceH;402 return srcSliceH;
@@ -408,7 +408,7 @@ static int yuv422pToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], · 5 unmodified lines
408{408{
409 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;409 uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
410 410
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],
412 srcStride[1], dstStride[0]);412 srcStride[1], dstStride[0]);
413 413
414 return srcSliceH;414 return srcSliceH;
@@ -422,11 +422,11 @@ static int yuyvToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
422 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;422 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;
423 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;423 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;
424 424
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],
426 dstStride[1], srcStride[0]);426 dstStride[1], srcStride[0]);
427 427
428 if (dstParam[3])428 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);
430 430
431 return srcSliceH;431 return srcSliceH;
432}432}
@@ -439,7 +439,7 @@ static int yuyvToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], · 6 unmodified lines
439 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;439 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;
440 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;440 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;
441 441
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],
443 dstStride[1], srcStride[0]);443 dstStride[1], srcStride[0]);
444 444
445 return srcSliceH;445 return srcSliceH;
@@ -453,11 +453,11 @@ static int uyvyToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
453 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;453 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2;
454 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;454 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2;
455 455
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],
457 dstStride[1], srcStride[0]);457 dstStride[1], srcStride[0]);
458 458
459 if (dstParam[3])459 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);
461 461
462 return srcSliceH;462 return srcSliceH;
463}463}
@@ -470,7 +470,7 @@ static int uyvyToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], · 6 unmodified lines
470 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;470 uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY;
471 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;471 uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY;
472 472
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],
474 dstStride[1], srcStride[0]);474 dstStride[1], srcStride[0]);
475 475
476 return srcSliceH;476 return srcSliceH;
@@ -566,8 +566,8 @@ static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 89 unmodified lines
566 int srcSliceY, int srcSliceH, uint8_t *const dst[],566 int srcSliceY, int srcSliceH, uint8_t *const dst[],
567 const int dstStride[])567 const int dstStride[])
568{568{
569 const enum AVPixelFormat srcFormat = c->srcFormat;569 const enum AVPixelFormat srcFormat = c->opts.src_format;
570 const enum AVPixelFormat dstFormat = c->dstFormat;570 const enum AVPixelFormat dstFormat = c->opts.dst_format;
571 void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels,571 void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels,
572 const uint8_t *palette) = NULL;572 const uint8_t *palette) = NULL;
573 int i;573 int i;
@@ -599,7 +599,7 @@ static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 25 unmodified lines
599 av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));599 av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
600 else {600 else {
601 for (i = 0; i < srcSliceH; i++) {601 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);
603 srcPtr += srcStride[0];603 srcPtr += srcStride[0];
604 dstPtr += dstStride[0];604 dstPtr += dstStride[0];
605 }605 }
@@ -821,8 +821,8 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 215 unmodified lines
821 uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] };821 uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] };
822 int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] };822 int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] };
823 int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] };823 int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] };
824 const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);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->dstFormat);825 const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format);
826 int bpc = dst_format->comp[0].depth;826 int bpc = dst_format->comp[0].depth;
827 int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA;827 int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA;
828 int swap = 0;828 int swap = 0;
@@ -847,20 +847,20 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 18 unmodified lines
847 dst1023[i] += stride1023[i] * srcSliceY / 2;847 dst1023[i] += stride1023[i] * srcSliceY / 2;
848 }848 }
849 849
850 switch (c->srcFormat) {850 switch (c->opts.src_format) {
851 case AV_PIX_FMT_RGB48LE:851 case AV_PIX_FMT_RGB48LE:
852 case AV_PIX_FMT_RGB48BE:852 case AV_PIX_FMT_RGB48BE:
853 case AV_PIX_FMT_RGBA64LE:853 case AV_PIX_FMT_RGBA64LE:
854 case AV_PIX_FMT_RGBA64BE:854 case AV_PIX_FMT_RGBA64BE:
855 packed16togbra16(src[0], srcStride[0],855 packed16togbra16(src[0], srcStride[0],
856 dst2013, stride2013, srcSliceH, alpha, swap,856 dst2013, stride2013, srcSliceH, alpha, swap,
857 16 - bpc, c->srcW);857 16 - bpc, c->opts.src_w);
858 break;858 break;
859 case AV_PIX_FMT_X2RGB10LE:859 case AV_PIX_FMT_X2RGB10LE:
860 av_assert0(bpc >= 10);860 av_assert0(bpc >= 10);
861 packed30togbra10(src[0], srcStride[0],861 packed30togbra10(src[0], srcStride[0],
862 dst2013, stride2013, srcSliceH, swap,862 dst2013, stride2013, srcSliceH, swap,
863 bpc, c->srcW);863 bpc, c->opts.src_w);
864 break;864 break;
865 case AV_PIX_FMT_BGR48LE:865 case AV_PIX_FMT_BGR48LE:
866 case AV_PIX_FMT_BGR48BE:866 case AV_PIX_FMT_BGR48BE:
@@ -868,13 +868,13 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
868 case AV_PIX_FMT_BGRA64BE:868 case AV_PIX_FMT_BGRA64BE:
869 packed16togbra16(src[0], srcStride[0],869 packed16togbra16(src[0], srcStride[0],
870 dst1023, stride1023, srcSliceH, alpha, swap,870 dst1023, stride1023, srcSliceH, alpha, swap,
871 16 - bpc, c->srcW);871 16 - bpc, c->opts.src_w);
872 break;872 break;
873 case AV_PIX_FMT_X2BGR10LE:873 case AV_PIX_FMT_X2BGR10LE:
874 av_assert0(bpc >= 10);874 av_assert0(bpc >= 10);
875 packed30togbra10(src[0], srcStride[0],875 packed30togbra10(src[0], srcStride[0],
876 dst1023, stride1023, srcSliceH, swap,876 dst1023, stride1023, srcSliceH, swap,
877 bpc, c->srcW);877 bpc, c->opts.src_w);
878 break;878 break;
879 default:879 default:
880 av_log(c, AV_LOG_ERROR,880 av_log(c, AV_LOG_ERROR,
@@ -1047,8 +1047,8 @@ static int planarRgb16ToRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], · 166 unmodified lines
1047 const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] };1047 const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] };
1048 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };1048 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };
1049 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };1049 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };
1050 const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat);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->dstFormat);1051 const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format);
1052 int bits_per_sample = src_format->comp[0].depth;1052 int bits_per_sample = src_format->comp[0].depth;
1053 int swap = 0;1053 int swap = 0;
1054 if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) ||1054 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
1065 src_format->name, dst_format->name);1065 src_format->name, dst_format->name);
1066 return srcSliceH;1066 return srcSliceH;
1067 }1067 }
1068 switch (c->dstFormat) {1068 switch (c->opts.dst_format) {
1069 case AV_PIX_FMT_BGR48LE:1069 case AV_PIX_FMT_BGR48LE:
1070 case AV_PIX_FMT_BGR48BE:1070 case AV_PIX_FMT_BGR48BE:
1071 gbr16ptopacked16(src102, stride102,1071 gbr16ptopacked16(src102, stride102,
1072 dst[0] + srcSliceY * dstStride[0], dstStride[0],1072 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);
1074 break;1074 break;
1075 case AV_PIX_FMT_RGB48LE:1075 case AV_PIX_FMT_RGB48LE:
1076 case AV_PIX_FMT_RGB48BE:1076 case AV_PIX_FMT_RGB48BE:
1077 gbr16ptopacked16(src201, stride201,1077 gbr16ptopacked16(src201, stride201,
1078 dst[0] + srcSliceY * dstStride[0], dstStride[0],1078 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);
1080 break;1080 break;
1081 case AV_PIX_FMT_RGBA64LE:1081 case AV_PIX_FMT_RGBA64LE:
1082 case AV_PIX_FMT_RGBA64BE:1082 case AV_PIX_FMT_RGBA64BE:
1083 gbr16ptopacked16(src201, stride201,1083 gbr16ptopacked16(src201, stride201,
1084 dst[0] + srcSliceY * dstStride[0], dstStride[0],1084 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);
1086 break;1086 break;
1087 case AV_PIX_FMT_BGRA64LE:1087 case AV_PIX_FMT_BGRA64LE:
1088 case AV_PIX_FMT_BGRA64BE:1088 case AV_PIX_FMT_BGRA64BE:
1089 gbr16ptopacked16(src102, stride102,1089 gbr16ptopacked16(src102, stride102,
1090 dst[0] + srcSliceY * dstStride[0], dstStride[0],1090 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);
1092 break;1092 break;
1093 case AV_PIX_FMT_X2RGB10LE:1093 case AV_PIX_FMT_X2RGB10LE:
1094 gbr16ptopacked30(src201, stride201,1094 gbr16ptopacked30(src201, stride201,
1095 dst[0] + srcSliceY * dstStride[0], dstStride[0],1095 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);
1097 break;1097 break;
1098 case AV_PIX_FMT_X2BGR10LE:1098 case AV_PIX_FMT_X2BGR10LE:
1099 gbr16ptopacked30(src102, stride102,1099 gbr16ptopacked30(src102, stride102,
1100 dst[0] + srcSliceY * dstStride[0], dstStride[0],1100 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);
1102 break;1102 break;
1103 default:1103 default:
1104 av_log(c, AV_LOG_ERROR,1104 av_log(c, AV_LOG_ERROR,
@@ -1195,24 +1195,24 @@ static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 90 unmodified lines
1195 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };1195 int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] };
1196 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };1196 int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] };
1197 1197
1198 if (c->srcFormat != AV_PIX_FMT_GBRAP) {1198 if (c->opts.src_format != AV_PIX_FMT_GBRAP) {
1199 av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",1199 av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",
1200 av_get_pix_fmt_name(c->srcFormat),1200 av_get_pix_fmt_name(c->opts.src_format),
1201 av_get_pix_fmt_name(c->dstFormat));1201 av_get_pix_fmt_name(c->opts.dst_format));
1202 return srcSliceH;1202 return srcSliceH;
1203 }1203 }
1204 1204
1205 switch (c->dstFormat) {1205 switch (c->opts.dst_format) {
1206 case AV_PIX_FMT_BGR24:1206 case AV_PIX_FMT_BGR24:
1207 gbr24ptopacked24(src102, stride102,1207 gbr24ptopacked24(src102, stride102,
1208 dst[0] + srcSliceY * dstStride[0], dstStride[0],1208 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1209 srcSliceH, c->srcW);1209 srcSliceH, c->opts.src_w);
1210 break;1210 break;
1211 1211
1212 case AV_PIX_FMT_RGB24:1212 case AV_PIX_FMT_RGB24:
1213 gbr24ptopacked24(src201, stride201,1213 gbr24ptopacked24(src201, stride201,
1214 dst[0] + srcSliceY * dstStride[0], dstStride[0],1214 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1215 srcSliceH, c->srcW);1215 srcSliceH, c->opts.src_w);
1216 break;1216 break;
1217 1217
1218 case AV_PIX_FMT_ARGB:1218 case AV_PIX_FMT_ARGB:
@@ -1220,7 +1220,7 @@ static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
1220 case AV_PIX_FMT_RGBA:1220 case AV_PIX_FMT_RGBA:
1221 gbraptopacked32(src201, stride201,1221 gbraptopacked32(src201, stride201,
1222 dst[0] + srcSliceY * dstStride[0], dstStride[0],1222 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1223 srcSliceH, alpha_first, c->srcW);1223 srcSliceH, alpha_first, c->opts.src_w);
1224 break;1224 break;
1225 1225
1226 case AV_PIX_FMT_ABGR:1226 case AV_PIX_FMT_ABGR:
@@ -1228,14 +1228,14 @@ static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
1228 case AV_PIX_FMT_BGRA:1228 case AV_PIX_FMT_BGRA:
1229 gbraptopacked32(src102, stride102,1229 gbraptopacked32(src102, stride102,
1230 dst[0] + srcSliceY * dstStride[0], dstStride[0],1230 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1231 srcSliceH, alpha_first, c->srcW);1231 srcSliceH, alpha_first, c->opts.src_w);
1232 break;1232 break;
1233 1233
1234 default:1234 default:
1235 av_log(c, AV_LOG_ERROR,1235 av_log(c, AV_LOG_ERROR,
1236 "unsupported planar RGB conversion %s -> %s\n",1236 "unsupported planar RGB conversion %s -> %s\n",
1237 av_get_pix_fmt_name(c->srcFormat),1237 av_get_pix_fmt_name(c->opts.src_format),
1238 av_get_pix_fmt_name(c->dstFormat));1238 av_get_pix_fmt_name(c->opts.dst_format));
1239 }1239 }
1240 1240
1241 return srcSliceH;1241 return srcSliceH;
@@ -1251,24 +1251,24 @@ static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 9 unmodified lines
1251 int stride102[] = { srcStride[1], srcStride[0], srcStride[2] };1251 int stride102[] = { srcStride[1], srcStride[0], srcStride[2] };
1252 int stride201[] = { srcStride[2], srcStride[0], srcStride[1] };1252 int stride201[] = { srcStride[2], srcStride[0], srcStride[1] };
1253 1253
1254 if (c->srcFormat != AV_PIX_FMT_GBRP) {1254 if (c->opts.src_format != AV_PIX_FMT_GBRP) {
1255 av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",1255 av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",
1256 av_get_pix_fmt_name(c->srcFormat),1256 av_get_pix_fmt_name(c->opts.src_format),
1257 av_get_pix_fmt_name(c->dstFormat));1257 av_get_pix_fmt_name(c->opts.dst_format));
1258 return srcSliceH;1258 return srcSliceH;
1259 }1259 }
1260 1260
1261 switch (c->dstFormat) {1261 switch (c->opts.dst_format) {
1262 case AV_PIX_FMT_BGR24:1262 case AV_PIX_FMT_BGR24:
1263 gbr24ptopacked24(src102, stride102,1263 gbr24ptopacked24(src102, stride102,
1264 dst[0] + srcSliceY * dstStride[0], dstStride[0],1264 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1265 srcSliceH, c->srcW);1265 srcSliceH, c->opts.src_w);
1266 break;1266 break;
1267 1267
1268 case AV_PIX_FMT_RGB24:1268 case AV_PIX_FMT_RGB24:
1269 gbr24ptopacked24(src201, stride201,1269 gbr24ptopacked24(src201, stride201,
1270 dst[0] + srcSliceY * dstStride[0], dstStride[0],1270 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1271 srcSliceH, c->srcW);1271 srcSliceH, c->opts.src_w);
1272 break;1272 break;
1273 1273
1274 case AV_PIX_FMT_ARGB:1274 case AV_PIX_FMT_ARGB:
@@ -1276,7 +1276,7 @@ static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
1276 case AV_PIX_FMT_RGBA:1276 case AV_PIX_FMT_RGBA:
1277 gbr24ptopacked32(src201, stride201,1277 gbr24ptopacked32(src201, stride201,
1278 dst[0] + srcSliceY * dstStride[0], dstStride[0],1278 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1279 srcSliceH, alpha_first, c->srcW);1279 srcSliceH, alpha_first, c->opts.src_w);
1280 break;1280 break;
1281 1281
1282 case AV_PIX_FMT_ABGR:1282 case AV_PIX_FMT_ABGR:
@@ -1284,14 +1284,14 @@ static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
1284 case AV_PIX_FMT_BGRA:1284 case AV_PIX_FMT_BGRA:
1285 gbr24ptopacked32(src102, stride102,1285 gbr24ptopacked32(src102, stride102,
1286 dst[0] + srcSliceY * dstStride[0], dstStride[0],1286 dst[0] + srcSliceY * dstStride[0], dstStride[0],
1287 srcSliceH, alpha_first, c->srcW);1287 srcSliceH, alpha_first, c->opts.src_w);
1288 break;1288 break;
1289 1289
1290 default:1290 default:
1291 av_log(c, AV_LOG_ERROR,1291 av_log(c, AV_LOG_ERROR,
1292 "unsupported planar RGB conversion %s -> %s\n",1292 "unsupported planar RGB conversion %s -> %s\n",
1293 av_get_pix_fmt_name(c->srcFormat),1293 av_get_pix_fmt_name(c->opts.src_format),
1294 av_get_pix_fmt_name(c->dstFormat));1294 av_get_pix_fmt_name(c->opts.dst_format));
1295 }1295 }
1296 1296
1297 return srcSliceH;1297 return srcSliceH;
@@ -1302,14 +1302,14 @@ static int planarRgbToplanarRgbWrapper(SwsInternal *c, · 4 unmodified lines
1302 int srcSliceY, int srcSliceH,1302 int srcSliceY, int srcSliceH,
1303 uint8_t *const dst[], const int dstStride[])1303 uint8_t *const dst[], const int dstStride[])
1304{1304{
1305 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,1305 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
1306 dst[0], dstStride[0]);1306 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,
1308 dst[1], dstStride[1]);1308 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,
1310 dst[2], dstStride[2]);1310 dst[2], dstStride[2]);
1311 if (dst[3])1311 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);
1313 1313
1314 return srcSliceH;1314 return srcSliceH;
1315}1315}
@@ -1357,32 +1357,32 @@ static int rgbToPlanarRgbWrapper(SwsInternal *c, const uint8_t *const src[], · 41 unmodified lines
1357 dst[0] + srcSliceY * dstStride[0],1357 dst[0] + srcSliceY * dstStride[0],
1358 dst[1] + srcSliceY * dstStride[1] };1358 dst[1] + srcSliceY * dstStride[1] };
1359 1359
1360 switch (c->srcFormat) {1360 switch (c->opts.src_format) {
1361 case AV_PIX_FMT_RGB24:1361 case AV_PIX_FMT_RGB24:
1362 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201,1362 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);
1364 break;1364 break;
1365 case AV_PIX_FMT_BGR24:1365 case AV_PIX_FMT_BGR24:
1366 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102,1366 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);
1368 break;1368 break;
1369 case AV_PIX_FMT_ARGB:1369 case AV_PIX_FMT_ARGB:
1370 alpha_first = 1;1370 alpha_first = 1;
1371 case AV_PIX_FMT_RGBA:1371 case AV_PIX_FMT_RGBA:
1372 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201,1372 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);
1374 break;1374 break;
1375 case AV_PIX_FMT_ABGR:1375 case AV_PIX_FMT_ABGR:
1376 alpha_first = 1;1376 alpha_first = 1;
1377 case AV_PIX_FMT_BGRA:1377 case AV_PIX_FMT_BGRA:
1378 packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102,1378 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);
1380 break;1380 break;
1381 default:1381 default:
1382 av_log(c, AV_LOG_ERROR,1382 av_log(c, AV_LOG_ERROR,
1383 "unsupported planar RGB conversion %s -> %s\n",1383 "unsupported planar RGB conversion %s -> %s\n",
1384 av_get_pix_fmt_name(c->srcFormat),1384 av_get_pix_fmt_name(c->opts.src_format),
1385 av_get_pix_fmt_name(c->dstFormat));1385 av_get_pix_fmt_name(c->opts.dst_format));
1386 }1386 }
1387 1387
1388 return srcSliceH;1388 return srcSliceH;
@@ -1467,32 +1467,32 @@ static int rgbToPlanarRgbaWrapper(SwsInternal *c, const uint8_t *const src[], · 78 unmodified lines
1467 dst[1] + srcSliceY * dstStride[1],1467 dst[1] + srcSliceY * dstStride[1],
1468 dst[3] + srcSliceY * dstStride[3] };1468 dst[3] + srcSliceY * dstStride[3] };
1469 1469
1470 switch (c->srcFormat) {1470 switch (c->opts.src_format) {
1471 case AV_PIX_FMT_RGB24:1471 case AV_PIX_FMT_RGB24:
1472 packed24togbrap((const uint8_t *) src[0], srcStride[0], dst201,1472 packed24togbrap((const uint8_t *) src[0], srcStride[0], dst201,
1473 stride201, srcSliceH, c->srcW);1473 stride201, srcSliceH, c->opts.src_w);
1474 break;1474 break;
1475 case AV_PIX_FMT_BGR24:1475 case AV_PIX_FMT_BGR24:
1476 packed24togbrap((const uint8_t *) src[0], srcStride[0], dst102,1476 packed24togbrap((const uint8_t *) src[0], srcStride[0], dst102,
1477 stride102, srcSliceH, c->srcW);1477 stride102, srcSliceH, c->opts.src_w);
1478 break;1478 break;
1479 case AV_PIX_FMT_ARGB:1479 case AV_PIX_FMT_ARGB:
1480 alpha_first = 1;1480 alpha_first = 1;
1481 case AV_PIX_FMT_RGBA:1481 case AV_PIX_FMT_RGBA:
1482 packed32togbrap((const uint8_t *) src[0], srcStride[0], dst201,1482 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);
1484 break;1484 break;
1485 case AV_PIX_FMT_ABGR:1485 case AV_PIX_FMT_ABGR:
1486 alpha_first = 1;1486 alpha_first = 1;
1487 case AV_PIX_FMT_BGRA:1487 case AV_PIX_FMT_BGRA:
1488 packed32togbrap((const uint8_t *) src[0], srcStride[0], dst102,1488 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);
1490 break;1490 break;
1491 default:1491 default:
1492 av_log(c, AV_LOG_ERROR,1492 av_log(c, AV_LOG_ERROR,
1493 "unsupported planar RGB conversion %s -> %s\n",1493 "unsupported planar RGB conversion %s -> %s\n",
1494 av_get_pix_fmt_name(c->srcFormat),1494 av_get_pix_fmt_name(c->opts.src_format),
1495 av_get_pix_fmt_name(c->dstFormat));1495 av_get_pix_fmt_name(c->opts.dst_format));
1496 }1496 }
1497 1497
1498 return srcSliceH;1498 return srcSliceH;
@@ -1568,7 +1568,7 @@ static int bayer_to_rgb24_wrapper(SwsInternal *c, const uint8_t *const src[], · 69 unmodified lines
1568 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);1568 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
1569 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);1569 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
1570 1570
1571 switch(c->srcFormat) {1571 switch(c->opts.src_format) {
1572#define CASE(pixfmt, prefix) \1572#define CASE(pixfmt, prefix) \
1573 case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \1573 case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \
1574 interpolate = bayer_##prefix##_to_rgb24_interpolate; \1574 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
1591 1591
1592 av_assert0(srcSliceH > 1);1592 av_assert0(srcSliceH > 1);
1593 1593
1594 copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);1594 copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
1595 srcPtr += 2 * srcStride[0];1595 srcPtr += 2 * srcStride[0];
1596 dstPtr += 2 * dstStride[0];1596 dstPtr += 2 * dstStride[0];
1597 1597
1598 for (i = 2; i < srcSliceH - 2; i += 2) {1598 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);
1600 srcPtr += 2 * srcStride[0];1600 srcPtr += 2 * srcStride[0];
1601 dstPtr += 2 * dstStride[0];1601 dstPtr += 2 * dstStride[0];
1602 }1602 }
1603 1603
1604 if (i + 1 == srcSliceH) {1604 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);
1606 } else if (i < srcSliceH)1606 } 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);
1608 return srcSliceH;1608 return srcSliceH;
1609}1609}
1610 1610
@@ -1618,7 +1618,7 @@ static int bayer_to_rgb48_wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
1618 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);1618 void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
1619 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);1619 void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width);
1620 1620
1621 switch(c->srcFormat) {1621 switch(c->opts.src_format) {
1622#define CASE(pixfmt, prefix) \1622#define CASE(pixfmt, prefix) \
1623 case pixfmt: copy = bayer_##prefix##_to_rgb48_copy; \1623 case pixfmt: copy = bayer_##prefix##_to_rgb48_copy; \
1624 interpolate = bayer_##prefix##_to_rgb48_interpolate; \1624 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
1641 1641
1642 av_assert0(srcSliceH > 1);1642 av_assert0(srcSliceH > 1);
1643 1643
1644 copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);1644 copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w);
1645 srcPtr += 2 * srcStride[0];1645 srcPtr += 2 * srcStride[0];
1646 dstPtr += 2 * dstStride[0];1646 dstPtr += 2 * dstStride[0];
1647 1647
1648 for (i = 2; i < srcSliceH - 2; i += 2) {1648 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);
1650 srcPtr += 2 * srcStride[0];1650 srcPtr += 2 * srcStride[0];
1651 dstPtr += 2 * dstStride[0];1651 dstPtr += 2 * dstStride[0];
1652 }1652 }
1653 1653
1654 if (i + 1 == srcSliceH) {1654 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);
1656 } else if (i < srcSliceH)1656 } 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);
1658 return srcSliceH;1658 return srcSliceH;
1659}1659}
1660 1660
@@ -1670,7 +1670,7 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 9 unmodified lines
1670 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);1670 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);
1671 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);1671 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);
1672 1672
1673 switch(c->srcFormat) {1673 switch(c->opts.src_format) {
1674#define CASE(pixfmt, prefix) \1674#define CASE(pixfmt, prefix) \
1675 case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \1675 case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \
1676 interpolate = bayer_##prefix##_to_yv12_interpolate; \1676 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
1693 1693
1694 av_assert0(srcSliceH > 1);1694 av_assert0(srcSliceH > 1);
1695 1695
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);
1697 srcPtr += 2 * srcStride[0];1697 srcPtr += 2 * srcStride[0];
1698 dstY += 2 * dstStride[0];1698 dstY += 2 * dstStride[0];
1699 dstU += dstStride[1];1699 dstU += dstStride[1];
1700 dstV += dstStride[1];1700 dstV += dstStride[1];
1701 1701
1702 for (i = 2; i < srcSliceH - 2; i += 2) {1702 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);
1704 srcPtr += 2 * srcStride[0];1704 srcPtr += 2 * srcStride[0];
1705 dstY += 2 * dstStride[0];1705 dstY += 2 * dstStride[0];
1706 dstU += dstStride[1];1706 dstU += dstStride[1];
@@ -1708,9 +1708,9 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
1708 }1708 }
1709 1709
1710 if (i + 1 == srcSliceH) {1710 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);
1712 } else if (i < srcSliceH)1712 } 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);
1714 return srcSliceH;1714 return srcSliceH;
1715}1715}
1716 1716
@@ -1751,8 +1751,8 @@ static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], · 34 unmodified lines
1751typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);1751typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);
1752static rgbConvFn findRgbConvFn(SwsInternal *c)1752static rgbConvFn findRgbConvFn(SwsInternal *c)
1753{1753{
1754 const enum AVPixelFormat srcFormat = c->srcFormat;1754 const enum AVPixelFormat srcFormat = c->opts.src_format;
1755 const enum AVPixelFormat dstFormat = c->dstFormat;1755 const enum AVPixelFormat dstFormat = c->opts.dst_format;
1756 const int srcId = c->srcFormatBpp;1756 const int srcId = c->srcFormatBpp;
1757 const int dstId = c->dstFormatBpp;1757 const int dstId = c->dstFormatBpp;
1758 rgbConvFn conv = NULL;1758 rgbConvFn conv = NULL;
@@ -1899,7 +1899,7 @@ static rgbConvFn findRgbConvFn(SwsInternal *c) · 140 unmodified lines
1899 return NULL;1899 return NULL;
1900 1900
1901 // Maintain symmetry between endianness1901 // Maintain symmetry between endianness
1902 if (c->flags & SWS_BITEXACT)1902 if (c->opts.flags & SWS_BITEXACT)
1903 if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0)1903 if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0)
1904 return NULL;1904 return NULL;
1905 1905
@@ -1912,10 +1912,10 @@ static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 6 unmodified lines
1912 const int dstStride[])1912 const int dstStride[])
1913 1913
1914{1914{
1915 const enum AVPixelFormat srcFormat = c->srcFormat;1915 const enum AVPixelFormat srcFormat = c->opts.src_format;
1916 const enum AVPixelFormat dstFormat = c->dstFormat;1916 const enum AVPixelFormat dstFormat = c->opts.dst_format;
1917 const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);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->dstFormat);1918 const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
1919 const int srcBpp = (c->srcFormatBpp + 7) >> 3;1919 const int srcBpp = (c->srcFormatBpp + 7) >> 3;
1920 const int dstBpp = (c->dstFormatBpp + 7) >> 3;1920 const int dstBpp = (c->dstFormatBpp + 7) >> 3;
1921 rgbConvFn conv = findRgbConvFn(c);1921 rgbConvFn conv = findRgbConvFn(c);
@@ -1945,20 +1945,20 @@ static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int · 23 unmodified lines
1945 if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 &&1945 if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 &&
1946 !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap)1946 !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap)
1947 conv(srcPtr, dstPtr + dstStride[0] * srcSliceY,1947 conv(srcPtr, dstPtr + dstStride[0] * srcSliceY,
1948 (srcSliceH - 1) * srcStride[0] + c->srcW * srcBpp);1948 (srcSliceH - 1) * srcStride[0] + c->opts.src_w * srcBpp);
1949 else {1949 else {
1950 int i, j;1950 int i, j;
1951 dstPtr += dstStride[0] * srcSliceY;1951 dstPtr += dstStride[0] * srcSliceY;
1952 1952
1953 for (i = 0; i < srcSliceH; i++) {1953 for (i = 0; i < srcSliceH; i++) {
1954 if(src_bswap) {1954 if(src_bswap) {
1955 for(j=0; j<c->srcW; j++)1955 for(j=0; j<c->opts.src_w; j++)
1956 ((uint16_t*)c->formatConvBuffer)[j] = av_bswap16(((uint16_t*)srcPtr)[j]);1956 ((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);
1958 }else1958 }else
1959 conv(srcPtr, dstPtr, c->srcW * srcBpp);1959 conv(srcPtr, dstPtr, c->opts.src_w * srcBpp);
1960 if(dst_bswap)1960 if(dst_bswap)
1961 for(j=0; j<c->srcW; j++)1961 for(j=0; j<c->opts.src_w; j++)
1962 ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]);1962 ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]);
1963 srcPtr += srcStride[0];1963 srcPtr += srcStride[0];
1964 dstPtr += dstStride[0];1964 dstPtr += dstStride[0];
@@ -1977,11 +1977,11 @@ static int bgr24ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 12 unmodified lines
1977 dst[0] + srcSliceY * dstStride[0],1977 dst[0] + srcSliceY * dstStride[0],
1978 dst[1] + (srcSliceY >> 1) * dstStride[1],1978 dst[1] + (srcSliceY >> 1) * dstStride[1],
1979 dst[2] + (srcSliceY >> 1) * dstStride[2],1979 dst[2] + (srcSliceY >> 1) * dstStride[2],
1980 c->srcW, srcSliceH,1980 c->opts.src_w, srcSliceH,
1981 dstStride[0], dstStride[1], srcStride[0],1981 dstStride[0], dstStride[1], srcStride[0],
1982 c->input_rgb2yuv_table);1982 c->input_rgb2yuv_table);
1983 if (dst[3])1983 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);
1985 return srcSliceH;1985 return srcSliceH;
1986}1986}
1987 1987
@@ -1989,7 +1989,7 @@ static int yvu9ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
1989 const int srcStride[], int srcSliceY, int srcSliceH,1989 const int srcStride[], int srcSliceY, int srcSliceH,
1990 uint8_t *const dst[], const int dstStride[])1990 uint8_t *const dst[], const int dstStride[])
1991{1991{
1992 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,1992 ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w,
1993 dst[0], dstStride[0]);1993 dst[0], dstStride[0]);
1994 1994
1995 planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->chrSrcW,1995 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
1997 planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->chrSrcW,1997 planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->chrSrcW,
1998 srcSliceH >> 2, srcStride[2], dstStride[2]);1998 srcSliceH >> 2, srcStride[2], dstStride[2]);
1999 if (dst[3])1999 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);
2001 return srcSliceH;2001 return srcSliceH;
2002}2002}
2003 2003
@@ -2011,7 +2011,7 @@ static int uint_y_to_float_y_wrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
2011 float *dstPtr = (float *)(dst[0] + dstStride[0] * srcSliceY);2011 float *dstPtr = (float *)(dst[0] + dstStride[0] * srcSliceY);
2012 2012
2013 for (y = 0; y < srcSliceH; ++y){2013 for (y = 0; y < srcSliceH; ++y){
2014 for (x = 0; x < c->srcW; ++x){2014 for (x = 0; x < c->opts.src_w; ++x){
2015 dstPtr[x] = c->uint2float_lut[srcPtr[x]];2015 dstPtr[x] = c->uint2float_lut[srcPtr[x]];
2016 }2016 }
2017 srcPtr += srcStride[0];2017 srcPtr += srcStride[0];
@@ -2033,7 +2033,7 @@ static int float_y_to_uint_y_wrapper(SwsInternal *c, · 15 unmodified lines
2033 uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;2033 uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
2034 2034
2035 for (y = 0; y < srcSliceH; ++y){2035 for (y = 0; y < srcSliceH; ++y){
2036 for (x = 0; x < c->srcW; ++x){2036 for (x = 0; x < c->opts.src_w; ++x){
2037 dstPtr[x] = av_clip_uint8(lrintf(255.0f * srcPtr[x]));2037 dstPtr[x] = av_clip_uint8(lrintf(255.0f * srcPtr[x]));
2038 }2038 }
2039 srcPtr += srcStrideFloat;2039 srcPtr += srcStrideFloat;
@@ -2057,9 +2057,9 @@ static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 17 unmodified lines
2057 int length = 0;2057 int length = 0;
2058 2058
2059 /* universal length finder */2059 /* universal length finder */
2060 while (length + c->srcW <= FFABS(dstStride[0]) &&2060 while (length + c->opts.src_w <= FFABS(dstStride[0]) &&
2061 length + c->srcW <= FFABS(srcStride[0]))2061 length + c->opts.src_w <= FFABS(srcStride[0]))
2062 length += c->srcW;2062 length += c->opts.src_w;
2063 av_assert1(length != 0);2063 av_assert1(length != 0);
2064 2064
2065 for (i = 0; i < srcSliceH; i++) {2065 for (i = 0; i < srcSliceH; i++) {
@@ -2073,7 +2073,7 @@ static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 7 unmodified lines
2073 2073
2074#define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\2074#define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\
2075 unsigned shift= src_depth-dst_depth, tmp;\2075 unsigned shift= src_depth-dst_depth, tmp;\
2076 if (c->dither == SWS_DITHER_NONE) {\2076 if (c->opts.dither == SWS_DITHER_NONE) {\
2077 for (i = 0; i < height; i++) {\2077 for (i = 0; i < height; i++) {\
2078 for (j = 0; j < length-7; j+=8) {\2078 for (j = 0; j < length-7; j+=8) {\
2079 dst[j+0] = dbswap(bswap(src[j+0])>>shift);\2079 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
2135 const int srcStride[], int srcSliceY, int srcSliceH,2135 const int srcStride[], int srcSliceY, int srcSliceH,
2136 uint8_t *const dst[], const int dstStride[])2136 uint8_t *const dst[], const int dstStride[])
2137{2137{
2138 const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);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->dstFormat);2139 const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
2140 int plane, i, j;2140 int plane, i, j;
2141 for (plane = 0; plane < 4 && dst[plane] != NULL; plane++) {2141 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);
2143 int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample);2143 int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample);
2144 int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample);2144 int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample);
2145 const uint8_t *srcPtr = src[plane];2145 const uint8_t *srcPtr = src[plane];
2146 uint8_t *dstPtr = dst[plane] + dstStride[plane] * y;2146 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);
2148 2148
2149 // ignore palette for GRAY82149 // ignore palette for GRAY8
2150 if (plane == 1 && !dst[2]) continue;2150 if (plane == 1 && !dst[2]) continue;
2151 if (!src[plane] || (plane == 1 && !src[2])) {2151 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)) {
2153 fillPlane16(dst[plane], dstStride[plane], length, height, y,2153 fillPlane16(dst[plane], dstStride[plane], length, height, y,
2154 plane == 3, desc_dst->comp[plane].depth,2154 plane == 3, desc_dst->comp[plane].depth,
2155 isBE(c->dstFormat));2155 isBE(c->opts.dst_format));
2156 } else {2156 } else {
2157 fillPlane(dst[plane], dstStride[plane], length, height, y,2157 fillPlane(dst[plane], dstStride[plane], length, height, y,
2158 (plane == 3) ? 255 : 128);2158 (plane == 3) ? 255 : 128);
2159 }2159 }
2160 } else {2160 } else {
2161 if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat)2161 if(isNBPS(c->opts.src_format) || isNBPS(c->opts.dst_format)
2162 || (is16BPS(c->srcFormat) != is16BPS(c->dstFormat))2162 || (is16BPS(c->opts.src_format) != is16BPS(c->opts.dst_format))
2163 ) {2163 ) {
2164 const int src_depth = desc_src->comp[plane].depth;2164 const int src_depth = desc_src->comp[plane].depth;
2165 const int dst_depth = desc_dst->comp[plane].depth;2165 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
2167 uint16_t *dstPtr2 = (uint16_t*)dstPtr;2167 uint16_t *dstPtr2 = (uint16_t*)dstPtr;
2168 2168
2169 if (dst_depth == 8) {2169 if (dst_depth == 8) {
2170 if(isBE(c->srcFormat) == HAVE_BIGENDIAN){2170 if(isBE(c->opts.src_format) == HAVE_BIGENDIAN){
2171 DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , )2171 DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , )
2172 } else {2172 } else {
2173 DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16, )2173 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
2183 w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |\2183 w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |\
2184 (srcPtr[j]>>(2*8-dst_depth)));\2184 (srcPtr[j]>>(2*8-dst_depth)));\
2185 }2185 }
2186 if(isBE(c->dstFormat)){2186 if(isBE(c->opts.dst_format)){
2187 COPY816(AV_WB16)2187 COPY816(AV_WB16)
2188 } else {2188 } else {
2189 COPY816(AV_WL16)2189 COPY816(AV_WL16)
@@ -2194,8 +2194,8 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 4 unmodified lines
2194 } else if (src_depth <= dst_depth) {2194 } else if (src_depth <= dst_depth) {
2195 for (i = 0; i < height; i++) {2195 for (i = 0; i < height; i++) {
2196 j = 0;2196 j = 0;
2197 if(isBE(c->srcFormat) == HAVE_BIGENDIAN &&2197 if(isBE(c->opts.src_format) == HAVE_BIGENDIAN &&
2198 isBE(c->dstFormat) == HAVE_BIGENDIAN &&2198 isBE(c->opts.dst_format) == HAVE_BIGENDIAN &&
2199 shiftonly) {2199 shiftonly) {
2200 unsigned shift = dst_depth - src_depth;2200 unsigned shift = dst_depth - src_depth;
2201#if HAVE_FAST_64BIT2201#if HAVE_FAST_64BIT
@@ -2230,14 +2230,14 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 28 unmodified lines
2230 (v>>(2*src_depth-dst_depth)));\2230 (v>>(2*src_depth-dst_depth)));\
2231 }\2231 }\
2232 }2232 }
2233 if(isBE(c->srcFormat)){2233 if(isBE(c->opts.src_format)){
2234 if(isBE(c->dstFormat)){2234 if(isBE(c->opts.dst_format)){
2235 COPY_UP(AV_RB16, AV_WB16)2235 COPY_UP(AV_RB16, AV_WB16)
2236 } else {2236 } else {
2237 COPY_UP(AV_RB16, AV_WL16)2237 COPY_UP(AV_RB16, AV_WL16)
2238 }2238 }
2239 } else {2239 } else {
2240 if(isBE(c->dstFormat)){2240 if(isBE(c->opts.dst_format)){
2241 COPY_UP(AV_RL16, AV_WB16)2241 COPY_UP(AV_RL16, AV_WB16)
2242 } else {2242 } else {
2243 COPY_UP(AV_RL16, AV_WL16)2243 COPY_UP(AV_RL16, AV_WL16)
@@ -2247,22 +2247,22 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 3 unmodified lines
2247 srcPtr2 += srcStride[plane]/2;2247 srcPtr2 += srcStride[plane]/2;
2248 }2248 }
2249 } else {2249 } else {
2250 if(isBE(c->srcFormat) == HAVE_BIGENDIAN){2250 if(isBE(c->opts.src_format) == HAVE_BIGENDIAN){
2251 if(isBE(c->dstFormat) == HAVE_BIGENDIAN){2251 if(isBE(c->opts.dst_format) == HAVE_BIGENDIAN){
2252 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , )2252 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , )
2253 } else {2253 } else {
2254 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16)2254 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16)
2255 }2255 }
2256 }else{2256 }else{
2257 if(isBE(c->dstFormat) == HAVE_BIGENDIAN){2257 if(isBE(c->opts.dst_format) == HAVE_BIGENDIAN){
2258 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, )2258 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, )
2259 } else {2259 } else {
2260 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16)2260 DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16)
2261 }2261 }
2262 }2262 }
2263 }2263 }
2264 } else if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat) &&2264 } else if (is16BPS(c->opts.src_format) && is16BPS(c->opts.dst_format) &&
2265 isBE(c->srcFormat) != isBE(c->dstFormat)) {2265 isBE(c->opts.src_format) != isBE(c->opts.dst_format)) {
2266 2266
2267 for (i = 0; i < height; i++) {2267 for (i = 0; i < height; i++) {
2268 for (j = 0; j < length; j++)2268 for (j = 0; j < length; j++)
@@ -2270,8 +2270,8 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 1 unmodified line
2270 srcPtr += srcStride[plane];2270 srcPtr += srcStride[plane];
2271 dstPtr += dstStride[plane];2271 dstPtr += dstStride[plane];
2272 }2272 }
2273 } else if (isFloat(c->srcFormat) && isFloat(c->dstFormat) &&2273 } else if (isFloat(c->opts.src_format) && isFloat(c->opts.dst_format) &&
2274 isBE(c->srcFormat) != isBE(c->dstFormat)) { /* swap float plane */2274 isBE(c->opts.src_format) != isBE(c->opts.dst_format)) { /* swap float plane */
2275 for (i = 0; i < height; i++) {2275 for (i = 0; i < height; i++) {
2276 for (j = 0; j < length; j++)2276 for (j = 0; j < length; j++)
2277 ((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]);2277 ((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
2283 memcpy(dst[plane] + dstStride[plane] * y, src[plane],2283 memcpy(dst[plane] + dstStride[plane] * y, src[plane],
2284 height * dstStride[plane]);2284 height * dstStride[plane]);
2285 } else {2285 } else {
2286 if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat))2286 if (is16BPS(c->opts.src_format) && is16BPS(c->opts.dst_format))
2287 length *= 2;2287 length *= 2;
2288 else if (desc_src->comp[0].depth == 1)2288 else if (desc_src->comp[0].depth == 1)
2289 length >>= 3; // monowhite/black2289 length >>= 3; // monowhite/black
@@ -2306,11 +2306,11 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], · 16 unmodified lines
2306 2306
2307void ff_get_unscaled_swscale(SwsInternal *c)2307void ff_get_unscaled_swscale(SwsInternal *c)
2308{2308{
2309 const enum AVPixelFormat srcFormat = c->srcFormat;2309 const enum AVPixelFormat srcFormat = c->opts.src_format;
2310 const enum AVPixelFormat dstFormat = c->dstFormat;2310 const enum AVPixelFormat dstFormat = c->opts.dst_format;
2311 const int flags = c->flags;2311 const int flags = c->opts.flags;
2312 const int dstH = c->dstH;2312 const int dstH = c->opts.dst_h;
2313 const int dstW = c->dstW;2313 const int dstW = c->opts.dst_w;
2314 int needsDither;2314 int needsDither;
2315 2315
2316 needsDither = isAnyRGB(dstFormat) &&2316 needsDither = isAnyRGB(dstFormat) &&
@@ -2340,7 +2340,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 23 unmodified lines
2340 /* yuv2bgr */2340 /* yuv2bgr */
2341 if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P ||2341 if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P ||
2342 srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) &&2342 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)) {
2344 c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c);2344 c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c);
2345 c->dst_slice_align = 2;2345 c->dst_slice_align = 2;
2346 }2346 }
@@ -2377,7 +2377,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 30 unmodified lines
2377 2377
2378 /* RGB/BGR -> RGB/BGR (no dither needed forms) */2378 /* RGB/BGR -> RGB/BGR (no dither needed forms) */
2379 if (isAnyRGB(srcFormat) && isAnyRGB(dstFormat) && findRgbConvFn(c)2379 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))))
2381 c->convert_unscaled = rgbToRgbWrapper;2381 c->convert_unscaled = rgbToRgbWrapper;
2382 2382
2383 /* RGB to planar RGB */2383 /* RGB to planar RGB */
@@ -2548,7 +2548,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 164 unmodified lines
2548 }2548 }
2549 2549
2550 /* LQ converters if -sws 0 or -sws 4*/2550 /* 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)) {
2552 /* yv12_to_yuy2 */2552 /* yv12_to_yuy2 */
2553 if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) {2553 if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) {
2554 if (dstFormat == AV_PIX_FMT_YUYV422)2554 if (dstFormat == AV_PIX_FMT_YUYV422)
@@ -2584,7 +2584,7 @@ void ff_get_unscaled_swscale(SwsInternal *c) · 29 unmodified lines
2584 c->chrDstVSubSample == c->chrSrcVSubSample &&2584 c->chrDstVSubSample == c->chrSrcVSubSample &&
2585 !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat))))2585 !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat))))
2586 {2586 {
2587 if (isPacked(c->srcFormat))2587 if (isPacked(c->opts.src_format))
2588 c->convert_unscaled = packedCopyWrapper;2588 c->convert_unscaled = packedCopyWrapper;
2589 else /* Planar YUV or gray */2589 else /* Planar YUV or gray */
2590 c->convert_unscaled = planarCopyWrapper;2590 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
298 if (!c)298 if (!c)
299 return NULL;299 return NULL;
300 300
301 c->flags = flags;301 c->opts.flags = flags;
302 c->srcW = srcW;302 c->opts.src_w = srcW;
303 c->srcH = srcH;303 c->opts.src_h = srcH;
304 c->dstW = dstW;304 c->opts.dst_w = dstW;
305 c->dstH = dstH;305 c->opts.dst_h = dstH;
306 c->srcFormat = srcFormat;306 c->opts.src_format = srcFormat;
307 c->dstFormat = dstFormat;307 c->opts.dst_format = dstFormat;
308 308
309 if (param) {309 if (param) {
310 c->param[0] = param[0];310 c->opts.scaler_params[0] = param[0];
311 c->param[1] = param[1];311 c->opts.scaler_params[1] = param[1];
312 }312 }
313 313
314 return sws;314 return sws;
@@ -1030,10 +1030,10 @@ static int handle_xyz(enum AVPixelFormat *format) · 715 unmodified lines
1030 1030
1031static void handle_formats(SwsInternal *c)1031static void handle_formats(SwsInternal *c)
1032{1032{
1033 c->src0Alpha |= handle_0alpha(&c->srcFormat);1033 c->src0Alpha |= handle_0alpha(&c->opts.src_format);
1034 c->dst0Alpha |= handle_0alpha(&c->dstFormat);1034 c->dst0Alpha |= handle_0alpha(&c->opts.dst_format);
1035 c->srcXYZ |= handle_xyz(&c->srcFormat);1035 c->srcXYZ |= handle_xyz(&c->opts.src_format);
1036 c->dstXYZ |= handle_xyz(&c->dstFormat);1036 c->dstXYZ |= handle_xyz(&c->opts.dst_format);
1037 if (c->srcXYZ || c->dstXYZ)1037 if (c->srcXYZ || c->dstXYZ)
1038 fill_xyztables(c);1038 fill_xyztables(c);
1039}1039}
@@ -1066,16 +1066,16 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 26 unmodified lines
1066 }1066 }
1067 1067
1068 handle_formats(c);1068 handle_formats(c);
1069 desc_dst = av_pix_fmt_desc_get(c->dstFormat);1069 desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
1070 desc_src = av_pix_fmt_desc_get(c->srcFormat);1070 desc_src = av_pix_fmt_desc_get(c->opts.src_format);
1071 1071
1072 if(range_override_needed(c->dstFormat))1072 if(range_override_needed(c->opts.dst_format))
1073 dstRange = 0;1073 dstRange = 0;
1074 if(range_override_needed(c->srcFormat))1074 if(range_override_needed(c->opts.src_format))
1075 srcRange = 0;1075 srcRange = 0;
1076 1076
1077 if (c->srcRange != srcRange ||1077 if (c->opts.src_range != srcRange ||
1078 c->dstRange != dstRange ||1078 c->opts.dst_range != dstRange ||
1079 c->brightness != brightness ||1079 c->brightness != brightness ||
1080 c->contrast != contrast ||1080 c->contrast != contrast ||
1081 c->saturation != saturation ||1081 c->saturation != saturation ||
@@ -1092,8 +1092,8 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 10 unmodified lines
1092 c->brightness = brightness;1092 c->brightness = brightness;
1093 c->contrast = contrast;1093 c->contrast = contrast;
1094 c->saturation = saturation;1094 c->saturation = saturation;
1095 c->srcRange = srcRange;1095 c->opts.src_range = srcRange;
1096 c->dstRange = dstRange;1096 c->opts.dst_range = dstRange;
1097 1097
1098 if (need_reinit)1098 if (need_reinit)
1099 ff_sws_init_range_convert(c);1099 ff_sws_init_range_convert(c);
@@ -1107,27 +1107,27 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 7 unmodified lines
1107 if (!need_reinit)1107 if (!need_reinit)
1108 return 0;1108 return 0;
1109 1109
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))) {
1111 if (!c->cascaded_context[0] &&1111 if (!c->cascaded_context[0] &&
1112 memcmp(c->dstColorspaceTable, c->srcColorspaceTable, sizeof(int) * 4) &&1112 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) {
1114 enum AVPixelFormat tmp_format;1114 enum AVPixelFormat tmp_format;
1115 int tmp_width, tmp_height;1115 int tmp_width, tmp_height;
1116 int srcW = c->srcW;1116 int srcW = c->opts.src_w;
1117 int srcH = c->srcH;1117 int srcH = c->opts.src_h;
1118 int dstW = c->dstW;1118 int dstW = c->opts.dst_w;
1119 int dstH = c->dstH;1119 int dstH = c->opts.dst_h;
1120 int ret;1120 int ret;
1121 av_log(c, AV_LOG_VERBOSE, "YUV color matrix differs for YUV->YUV, using intermediate RGB to convert\n");1121 av_log(c, AV_LOG_VERBOSE, "YUV color matrix differs for YUV->YUV, using intermediate RGB to convert\n");
1122 1122
1123 if (isNBPS(c->dstFormat) || is16BPS(c->dstFormat)) {1123 if (isNBPS(c->opts.dst_format) || is16BPS(c->opts.dst_format)) {
1124 if (isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) {1124 if (isALPHA(c->opts.src_format) && isALPHA(c->opts.dst_format)) {
1125 tmp_format = AV_PIX_FMT_BGRA64;1125 tmp_format = AV_PIX_FMT_BGRA64;
1126 } else {1126 } else {
1127 tmp_format = AV_PIX_FMT_BGR48;1127 tmp_format = AV_PIX_FMT_BGR48;
1128 }1128 }
1129 } else {1129 } else {
1130 if (isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) {1130 if (isALPHA(c->opts.src_format) && isALPHA(c->opts.dst_format)) {
1131 tmp_format = AV_PIX_FMT_BGRA;1131 tmp_format = AV_PIX_FMT_BGRA;
1132 } else {1132 } else {
1133 tmp_format = AV_PIX_FMT_BGR24;1133 tmp_format = AV_PIX_FMT_BGR24;
@@ -1147,13 +1147,14 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 13 unmodified lines
1147 if (ret < 0)1147 if (ret < 0)
1148 return ret;1148 return ret;
1149 1149
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,
1151 tmp_width, tmp_height, tmp_format,1151 tmp_width, tmp_height, tmp_format,
1152 c->flags, c->param);1152 c->opts.flags,
1153 c->opts.scaler_params);
1153 if (!c->cascaded_context[0])1154 if (!c->cascaded_context[0])
1154 return -1;1155 return -1;
1155 1156
1156 sws_internal(c->cascaded_context[0])->alphablend = c->alphablend;1157 sws_internal(c->cascaded_context[0])->opts.alpha_blend = c->opts.alpha_blend;
1157 ret = sws_init_context(c->cascaded_context[0], NULL , NULL);1158 ret = sws_init_context(c->cascaded_context[0], NULL , NULL);
1158 if (ret < 0)1159 if (ret < 0)
1159 return ret;1160 return ret;
@@ -1163,12 +1164,13 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 3 unmodified lines
1163 brightness, contrast, saturation);1164 brightness, contrast, saturation);
1164 1165
1165 c->cascaded_context[1] = alloc_set_opts(tmp_width, tmp_height, tmp_format,1166 c->cascaded_context[1] = alloc_set_opts(tmp_width, tmp_height, tmp_format,
1166 dstW, dstH, c->dstFormat,1167 dstW, dstH, c->opts.dst_format,
1167 c->flags, c->param);1168 c->opts.flags,
1169 c->opts.scaler_params);
1168 if (!c->cascaded_context[1])1170 if (!c->cascaded_context[1])
1169 return -1;1171 return -1;
1170 sws_internal(c->cascaded_context[1])->srcRange = srcRange;1172 sws_internal(c->cascaded_context[1])->opts.src_range = srcRange;
1171 sws_internal(c->cascaded_context[1])->dstRange = dstRange;1173 sws_internal(c->cascaded_context[1])->opts.dst_range = dstRange;
1172 ret = sws_init_context(c->cascaded_context[1], NULL , NULL);1174 ret = sws_init_context(c->cascaded_context[1], NULL , NULL);
1173 if (ret < 0)1175 if (ret < 0)
1174 return ret;1176 return ret;
@@ -1183,7 +1185,7 @@ int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], · 8 unmodified lines
1183 return 0;1185 return 0;
1184 }1186 }
1185 1187
1186 if (!isYUV(c->dstFormat) && !isGray(c->dstFormat)) {1188 if (!isYUV(c->opts.dst_format) && !isGray(c->opts.dst_format)) {
1187 ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness,1189 ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness,
1188 contrast, saturation);1190 contrast, saturation);
1189 // FIXME factorize1191 // FIXME factorize
@@ -1215,8 +1217,8 @@ int sws_getColorspaceDetails(SwsContext *sws, int **inv_table, · 25 unmodified lines
1215 1217
1216 *inv_table = c->srcColorspaceTable;1218 *inv_table = c->srcColorspaceTable;
1217 *table = c->dstColorspaceTable;1219 *table = c->dstColorspaceTable;
1218 *srcRange = range_override_needed(c->srcFormat) ? 1 : c->srcRange;1220 *srcRange = range_override_needed(c->opts.src_format) ? 1 : c->opts.src_range;
1219 *dstRange = range_override_needed(c->dstFormat) ? 1 : c->dstRange;1221 *dstRange = range_override_needed(c->opts.dst_format) ? 1 : c->opts.dst_range;
1220 *brightness = c->brightness;1222 *brightness = c->brightness;
1221 *contrast = c->contrast;1223 *contrast = c->contrast;
1222 *saturation = c->saturation;1224 *saturation = c->saturation;
@@ -1229,7 +1231,7 @@ SwsContext *sws_alloc_context(void) · 6 unmodified lines
1229 SwsInternal *c = av_mallocz(sizeof(SwsInternal));1231 SwsInternal *c = av_mallocz(sizeof(SwsInternal));
1230 1232
1231 if (c) {1233 if (c) {
1232 c->av_class = &ff_sws_context_class;1234 c->opts.av_class = &ff_sws_context_class;
1233 av_opt_set_defaults(c);1235 av_opt_set_defaults(c);
1234 atomic_init(&c->stride_unaligned_warned, 0);1236 atomic_init(&c->stride_unaligned_warned, 0);
1235 atomic_init(&c->data_unaligned_warned, 0);1237 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
1321 int unscaled;1323 int unscaled;
1322 SwsInternal *c = sws_internal(sws);1324 SwsInternal *c = sws_internal(sws);
1323 SwsFilter dummyFilter = { NULL, NULL, NULL, NULL };1325 SwsFilter dummyFilter = { NULL, NULL, NULL, NULL };
1324 int srcW = c->srcW;1326 int srcW = c->opts.src_w;
1325 int srcH = c->srcH;1327 int srcH = c->opts.src_h;
1326 int dstW = c->dstW;1328 int dstW = c->opts.dst_w;
1327 int dstH = c->dstH;1329 int dstH = c->opts.dst_h;
1328 int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 66, 16);1330 int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 66, 16);
1329 int flags, cpu_flags;1331 int flags, cpu_flags;
1330 enum AVPixelFormat srcFormat, dstFormat;1332 enum AVPixelFormat srcFormat, dstFormat;
@@ -1335,25 +1337,25 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 4 unmodified lines
1335 static const float float_mult = 1.0f / 255.0f;1337 static const float float_mult = 1.0f / 255.0f;
1336 1338
1337 cpu_flags = av_get_cpu_flags();1339 cpu_flags = av_get_cpu_flags();
1338 flags = c->flags;1340 flags = c->opts.flags;
1339 emms_c();1341 emms_c();
1340 1342
1341 unscaled = (srcW == dstW && srcH == dstH);1343 unscaled = (srcW == dstW && srcH == dstH);
1342 1344
1343 if (!c->contrast && !c->saturation && !c->dstFormatBpp)1345 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,
1345 ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],1347 ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],
1346 c->dstRange, 0, 1 << 16, 1 << 16);1348 c->opts.dst_range, 0, 1 << 16, 1 << 16);
1347 1349
1348 handle_formats(c);1350 handle_formats(c);
1349 srcFormat = c->srcFormat;1351 srcFormat = c->opts.src_format;
1350 dstFormat = c->dstFormat;1352 dstFormat = c->opts.dst_format;
1351 desc_src = av_pix_fmt_desc_get(srcFormat);1353 desc_src = av_pix_fmt_desc_get(srcFormat);
1352 desc_dst = av_pix_fmt_desc_get(dstFormat);1354 desc_dst = av_pix_fmt_desc_get(dstFormat);
1353 1355
1354 // If the source has no alpha then disable alpha blendaway1356 // If the source has no alpha then disable alpha blendaway
1355 if (c->src0Alpha)1357 if (c->src0Alpha)
1356 c->alphablend = SWS_ALPHA_BLEND_NONE;1358 c->opts.alpha_blend = SWS_ALPHA_BLEND_NONE;
1357 1359
1358 if (!(unscaled && sws_isSupportedEndiannessConversion(srcFormat) &&1360 if (!(unscaled && sws_isSupportedEndiannessConversion(srcFormat) &&
1359 av_pix_fmt_swap_endianness(srcFormat) == dstFormat)) {1361 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
1390 flags |= SWS_BICUBIC;1392 flags |= SWS_BICUBIC;
1391 else1393 else
1392 flags |= SWS_BICUBIC;1394 flags |= SWS_BICUBIC;
1393 c->flags = flags;1395 c->opts.flags = flags;
1394 } else if (i & (i - 1)) {1396 } else if (i & (i - 1)) {
1395 av_log(c, AV_LOG_ERROR,1397 av_log(c, AV_LOG_ERROR,
1396 "Exactly one scaler algorithm must be chosen, got %X\n", i);1398 "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
1407 if (flags & SWS_FAST_BILINEAR) {1409 if (flags & SWS_FAST_BILINEAR) {
1408 if (srcW < 8 || dstW < 8) {1410 if (srcW < 8 || dstW < 8) {
1409 flags ^= SWS_FAST_BILINEAR | SWS_BILINEAR;1411 flags ^= SWS_FAST_BILINEAR | SWS_BILINEAR;
1410 c->flags = flags;1412 c->opts.flags = flags;
1411 }1413 }
1412 }1414 }
1413 1415
@@ -1440,46 +1442,46 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 26 unmodified lines
1440 if (dstW&1) {1442 if (dstW&1) {
1441 av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n");1443 av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n");
1442 flags |= SWS_FULL_CHR_H_INT;1444 flags |= SWS_FULL_CHR_H_INT;
1443 c->flags = flags;1445 c->opts.flags = flags;
1444 }1446 }
1445 1447
1446 if ( c->chrSrcHSubSample == 01448 if ( c->chrSrcHSubSample == 0
1447 && c->chrSrcVSubSample == 01449 && c->chrSrcVSubSample == 0
1448 && c->dither != SWS_DITHER_BAYER //SWS_FULL_CHR_H_INT is currently not supported with SWS_DITHER_BAYER1450 && c->opts.dither != SWS_DITHER_BAYER //SWS_FULL_CHR_H_INT is currently not supported with SWS_DITHER_BAYER
1449 && !(c->flags & SWS_FAST_BILINEAR)1451 && !(c->opts.flags & SWS_FAST_BILINEAR)
1450 ) {1452 ) {
1451 av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to input having non subsampled chroma\n");1453 av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to input having non subsampled chroma\n");
1452 flags |= SWS_FULL_CHR_H_INT;1454 flags |= SWS_FULL_CHR_H_INT;
1453 c->flags = flags;1455 c->opts.flags = flags;
1454 }1456 }
1455 }1457 }
1456 1458
1457 if (c->dither == SWS_DITHER_AUTO) {1459 if (c->opts.dither == SWS_DITHER_AUTO) {
1458 if (flags & SWS_ERROR_DIFFUSION)1460 if (flags & SWS_ERROR_DIFFUSION)
1459 c->dither = SWS_DITHER_ED;1461 c->opts.dither = SWS_DITHER_ED;
1460 }1462 }
1461 1463
1462 if(dstFormat == AV_PIX_FMT_BGR4_BYTE ||1464 if(dstFormat == AV_PIX_FMT_BGR4_BYTE ||
1463 dstFormat == AV_PIX_FMT_RGB4_BYTE ||1465 dstFormat == AV_PIX_FMT_RGB4_BYTE ||
1464 dstFormat == AV_PIX_FMT_BGR8 ||1466 dstFormat == AV_PIX_FMT_BGR8 ||
1465 dstFormat == AV_PIX_FMT_RGB8) {1467 dstFormat == AV_PIX_FMT_RGB8) {
1466 if (c->dither == SWS_DITHER_AUTO)1468 if (c->opts.dither == SWS_DITHER_AUTO)
1467 c->dither = (flags & SWS_FULL_CHR_H_INT) ? SWS_DITHER_ED : SWS_DITHER_BAYER;1469 c->opts.dither = (flags & SWS_FULL_CHR_H_INT) ? SWS_DITHER_ED : SWS_DITHER_BAYER;
1468 if (!(flags & SWS_FULL_CHR_H_INT)) {1470 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) {
1470 av_log(c, AV_LOG_DEBUG,1472 av_log(c, AV_LOG_DEBUG,
1471 "Desired dithering only supported in full chroma interpolation for destination format '%s'\n",1473 "Desired dithering only supported in full chroma interpolation for destination format '%s'\n",
1472 av_get_pix_fmt_name(dstFormat));1474 av_get_pix_fmt_name(dstFormat));
1473 flags |= SWS_FULL_CHR_H_INT;1475 flags |= SWS_FULL_CHR_H_INT;
1474 c->flags = flags;1476 c->opts.flags = flags;
1475 }1477 }
1476 }1478 }
1477 if (flags & SWS_FULL_CHR_H_INT) {1479 if (flags & SWS_FULL_CHR_H_INT) {
1478 if (c->dither == SWS_DITHER_BAYER) {1480 if (c->opts.dither == SWS_DITHER_BAYER) {
1479 av_log(c, AV_LOG_DEBUG,1481 av_log(c, AV_LOG_DEBUG,
1480 "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n",1482 "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n",
1481 av_get_pix_fmt_name(dstFormat));1483 av_get_pix_fmt_name(dstFormat));
1482 c->dither = SWS_DITHER_ED;1484 c->opts.dither = SWS_DITHER_ED;
1483 }1485 }
1484 }1486 }
1485 }1487 }
@@ -1489,7 +1491,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 3 unmodified lines
1489 "%s output is not supported with half chroma resolution, switching to full\n",1491 "%s output is not supported with half chroma resolution, switching to full\n",
1490 av_get_pix_fmt_name(dstFormat));1492 av_get_pix_fmt_name(dstFormat));
1491 flags |= SWS_FULL_CHR_H_INT;1493 flags |= SWS_FULL_CHR_H_INT;
1492 c->flags = flags;1494 c->opts.flags = flags;
1493 }1495 }
1494 }1496 }
1495 1497
@@ -1523,7 +1525,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 27 unmodified lines
1523 "full chroma interpolation for destination format '%s' not yet implemented\n",1525 "full chroma interpolation for destination format '%s' not yet implemented\n",
1524 av_get_pix_fmt_name(dstFormat));1526 av_get_pix_fmt_name(dstFormat));
1525 flags &= ~SWS_FULL_CHR_H_INT;1527 flags &= ~SWS_FULL_CHR_H_INT;
1526 c->flags = flags;1528 c->opts.flags = flags;
1527 }1529 }
1528 if (isAnyRGB(dstFormat) && !(flags & SWS_FULL_CHR_H_INT))1530 if (isAnyRGB(dstFormat) && !(flags & SWS_FULL_CHR_H_INT))
1529 c->chrDstHSubSample = 1;1531 c->chrDstHSubSample = 1;
@@ -1585,7 +1587,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 55 unmodified lines
1585 av_log(c, AV_LOG_INFO,1587 av_log(c, AV_LOG_INFO,
1586 "output width is not a multiple of 32 -> no MMXEXT scaler\n");1588 "output width is not a multiple of 32 -> no MMXEXT scaler\n");
1587 }1589 }
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))
1589 c->canMMXEXTBeUsed = 0;1591 c->canMMXEXTBeUsed = 0;
1590 } else1592 } else
1591 c->canMMXEXTBeUsed = 0;1593 c->canMMXEXTBeUsed = 0;
@@ -1617,7 +1619,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 25 unmodified lines
1617 tmpFmt = AV_PIX_FMT_RGBA64LE;1619 tmpFmt = AV_PIX_FMT_RGBA64LE;
1618 1620
1619 1621
1620 if (!unscaled && c->gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) {1622 if (!unscaled && c->opts.gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) {
1621 SwsInternal *c2;1623 SwsInternal *c2;
1622 c->cascaded_context[0] = NULL;1624 c->cascaded_context[0] = NULL;
1623 1625
@@ -1628,14 +1630,16 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 4 unmodified lines
1628 1630
1629 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,1631 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
1630 srcW, srcH, tmpFmt,1632 srcW, srcH, tmpFmt,
1631 flags, NULL, NULL, c->param);1633 flags, NULL, NULL,
1634 c->opts.scaler_params);
1632 if (!c->cascaded_context[0]) {1635 if (!c->cascaded_context[0]) {
1633 return AVERROR(ENOMEM);1636 return AVERROR(ENOMEM);
1634 }1637 }
1635 1638
1636 c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFmt,1639 c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFmt,
1637 dstW, dstH, tmpFmt,1640 dstW, dstH, tmpFmt,
1638 flags, srcFilter, dstFilter, c->param);1641 flags, srcFilter, dstFilter,
1642 c->opts.scaler_params);
1639 1643
1640 if (!c->cascaded_context[1])1644 if (!c->cascaded_context[1])
1641 return AVERROR(ENOMEM);1645 return AVERROR(ENOMEM);
@@ -1665,8 +1669,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 23 unmodified lines
1665 return ret;1669 return ret;
1666 1670
1667 c->cascaded_context[2] = sws_getContext(dstW, dstH, tmpFmt,1671 c->cascaded_context[2] = sws_getContext(dstW, dstH, tmpFmt,
1668 dstW, dstH, dstFormat,1672 dstW, dstH, dstFormat,
1669 flags, NULL, NULL, c->param);1673 flags, NULL, NULL,
1674 c->opts.scaler_params);
1670 if (!c->cascaded_context[2])1675 if (!c->cascaded_context[2])
1671 return AVERROR(ENOMEM);1676 return AVERROR(ENOMEM);
1672 }1677 }
@@ -1686,13 +1691,15 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 13 unmodified lines
1686 1691
1687 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,1692 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
1688 srcW, srcH, tmpFormat,1693 srcW, srcH, tmpFormat,
1689 flags, srcFilter, NULL, c->param);1694 flags, srcFilter, NULL,
1695 c->opts.scaler_params);
1690 if (!c->cascaded_context[0])1696 if (!c->cascaded_context[0])
1691 return AVERROR(ENOMEM);1697 return AVERROR(ENOMEM);
1692 1698
1693 c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFormat,1699 c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFormat,
1694 dstW, dstH, dstFormat,1700 dstW, dstH, dstFormat,
1695 flags, NULL, dstFilter, c->param);1701 flags, NULL, dstFilter,
1702 c->opts.scaler_params);
1696 if (!c->cascaded_context[1])1703 if (!c->cascaded_context[1])
1697 return AVERROR(ENOMEM);1704 return AVERROR(ENOMEM);
1698 return 0;1705 return 0;
@@ -1715,11 +1722,11 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 16 unmodified lines
1715 if (CONFIG_SWSCALE_ALPHA && isALPHA(srcFormat) && !isALPHA(dstFormat)) {1722 if (CONFIG_SWSCALE_ALPHA && isALPHA(srcFormat) && !isALPHA(dstFormat)) {
1716 enum AVPixelFormat tmpFormat = alphaless_fmt(srcFormat);1723 enum AVPixelFormat tmpFormat = alphaless_fmt(srcFormat);
1717 1724
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) {
1719 if (!unscaled ||1726 if (!unscaled ||
1720 dstFormat != tmpFormat ||1727 dstFormat != tmpFormat ||
1721 usesHFilter || usesVFilter ||1728 usesHFilter || usesVFilter ||
1722 c->srcRange != c->dstRange1729 c->opts.src_range != c->opts.dst_range
1723 ) {1730 ) {
1724 c->cascaded_mainindex = 1;1731 c->cascaded_mainindex = 1;
1725 ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0],1732 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
1729 1736
1730 c->cascaded_context[0] = alloc_set_opts(srcW, srcH, srcFormat,1737 c->cascaded_context[0] = alloc_set_opts(srcW, srcH, srcFormat,
1731 srcW, srcH, tmpFormat,1738 srcW, srcH, tmpFormat,
1732 flags, c->param);1739 flags, c->opts.scaler_params);
1733 if (!c->cascaded_context[0])1740 if (!c->cascaded_context[0])
1734 return AVERROR(EINVAL);1741 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;
1736 ret = sws_init_context(c->cascaded_context[0], NULL , NULL);1743 ret = sws_init_context(c->cascaded_context[0], NULL , NULL);
1737 if (ret < 0)1744 if (ret < 0)
1738 return ret;1745 return ret;
1739 1746
1740 c->cascaded_context[1] = alloc_set_opts(srcW, srcH, tmpFormat,1747 c->cascaded_context[1] = alloc_set_opts(srcW, srcH, tmpFormat,
1741 dstW, dstH, dstFormat,1748 dstW, dstH, dstFormat,
1742 flags, c->param);1749 flags, c->opts.scaler_params);
1743 if (!c->cascaded_context[1])1750 if (!c->cascaded_context[1])
1744 return AVERROR(EINVAL);1751 return AVERROR(EINVAL);
1745 1752
1746 sws_internal(c->cascaded_context[1])->srcRange = c->srcRange;1753 sws_internal(c->cascaded_context[1])->opts.src_range = c->opts.src_range;
1747 sws_internal(c->cascaded_context[1])->dstRange = c->dstRange;1754 sws_internal(c->cascaded_context[1])->opts.dst_range = c->opts.dst_range;
1748 ret = sws_init_context(c->cascaded_context[1], srcFilter , dstFilter);1755 ret = sws_init_context(c->cascaded_context[1], srcFilter , dstFilter);
1749 if (ret < 0)1756 if (ret < 0)
1750 return ret;1757 return ret;
@@ -1756,9 +1763,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 5 unmodified lines
1756 1763
1757 /* alpha blend special case, note this has been split via cascaded contexts if its scaled */1764 /* alpha blend special case, note this has been split via cascaded contexts if its scaled */
1758 if (unscaled && !usesHFilter && !usesVFilter &&1765 if (unscaled && !usesHFilter && !usesVFilter &&
1759 c->alphablend != SWS_ALPHA_BLEND_NONE &&1766 c->opts.alpha_blend != SWS_ALPHA_BLEND_NONE &&
1760 isALPHA(srcFormat) &&1767 isALPHA(srcFormat) &&
1761 (c->srcRange == c->dstRange || isAnyRGB(dstFormat)) &&1768 (c->opts.src_range == c->opts.dst_range || isAnyRGB(dstFormat)) &&
1762 alphaless_fmt(srcFormat) == dstFormat1769 alphaless_fmt(srcFormat) == dstFormat
1763 ) {1770 ) {
1764 c->convert_unscaled = ff_sws_alphablendaway;1771 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
1772 1779
1773 /* unscaled special cases */1780 /* unscaled special cases */
1774 if (unscaled && !usesHFilter && !usesVFilter &&1781 if (unscaled && !usesHFilter && !usesVFilter &&
1775 (c->srcRange == c->dstRange || isAnyRGB(dstFormat) ||1782 (c->opts.src_range == c->opts.dst_range || isAnyRGB(dstFormat) ||
1776 isFloat(srcFormat) || isFloat(dstFormat) || isBayer(srcFormat))){1783 isFloat(srcFormat) || isFloat(dstFormat) || isBayer(srcFormat))){
1777 1784
1778 ff_get_unscaled_swscale(c);1785 ff_get_unscaled_swscale(c);
@@ -1868,7 +1875,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 89 unmodified lines
1868 srcW, dstW, filterAlign, 1 << 14,1875 srcW, dstW, filterAlign, 1 << 14,
1869 (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,1876 (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
1870 cpu_flags, srcFilter->lumH, dstFilter->lumH,1877 cpu_flags, srcFilter->lumH, dstFilter->lumH,
1871 c->param,1878 c->opts.scaler_params,
1872 get_local_pos(c, 0, 0, 0),1879 get_local_pos(c, 0, 0, 0),
1873 get_local_pos(c, 0, 0, 0))) < 0)1880 get_local_pos(c, 0, 0, 0))) < 0)
1874 goto fail;1881 goto fail;
@@ -1879,9 +1886,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 4 unmodified lines
1879 c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,1886 c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,
1880 (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,1887 (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
1881 cpu_flags, srcFilter->chrH, dstFilter->chrH,1888 cpu_flags, srcFilter->chrH, dstFilter->chrH,
1882 c->param,1889 c->opts.scaler_params,
1883 get_local_pos(c, c->chrSrcHSubSample, c->src_h_chr_pos, 0),1890 get_local_pos(c, c->chrSrcHSubSample, c->opts.src_h_chr_pos, 0),
1884 get_local_pos(c, c->chrDstHSubSample, c->dst_h_chr_pos, 0))) < 0)1891 get_local_pos(c, c->chrDstHSubSample, c->opts.dst_h_chr_pos, 0))) < 0)
1885 goto fail;1892 goto fail;
1886 if (ff_shuffle_filter_coefficients(c, c->hChrFilterPos, c->hChrFilterSize, c->hChrFilter, c->chrDstW) < 0)1893 if (ff_shuffle_filter_coefficients(c, c->hChrFilterPos, c->hChrFilterSize, c->hChrFilter, c->chrDstW) < 0)
1887 goto nomem;1894 goto nomem;
@@ -1898,7 +1905,7 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 10 unmodified lines
1898 c->lumYInc, srcH, dstH, filterAlign, (1 << 12),1905 c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
1899 (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,1906 (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
1900 cpu_flags, srcFilter->lumV, dstFilter->lumV,1907 cpu_flags, srcFilter->lumV, dstFilter->lumV,
1901 c->param,1908 c->opts.scaler_params,
1902 get_local_pos(c, 0, 0, 1),1909 get_local_pos(c, 0, 0, 1),
1903 get_local_pos(c, 0, 0, 1))) < 0)1910 get_local_pos(c, 0, 0, 1))) < 0)
1904 goto fail;1911 goto fail;
@@ -1907,18 +1914,18 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter · 2 unmodified lines
1907 filterAlign, (1 << 12),1914 filterAlign, (1 << 12),
1908 (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,1915 (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
1909 cpu_flags, srcFilter->chrV, dstFilter->chrV,1916 cpu_flags, srcFilter->chrV, dstFilter->chrV,
1910 c->param,1917 c->opts.scaler_params,
1911 get_local_pos(c, c->chrSrcVSubSample, c->src_v_chr_pos, 1),1918 get_local_pos(c, c->chrSrcVSubSample, c->opts.src_v_chr_pos, 1),
1912 get_local_pos(c, c->chrDstVSubSample, c->dst_v_chr_pos, 1))) < 0)1919 get_local_pos(c, c->chrDstVSubSample, c->opts.dst_v_chr_pos, 1))) < 0)
1913 1920
1914 goto fail;1921 goto fail;
1915 1922
1916#if HAVE_ALTIVEC1923#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) ||
1918 !FF_ALLOC_TYPED_ARRAY(c->vCCoeffsBank, c->vChrFilterSize * c->chrDstH))1925 !FF_ALLOC_TYPED_ARRAY(c->vCCoeffsBank, c->vChrFilterSize * c->chrDstH))
1919 goto nomem;1926 goto nomem;
1920 1927
1921 for (i = 0; i < c->vLumFilterSize * c->dstH; i++) {1928 for (i = 0; i < c->vLumFilterSize * c->opts.dst_h; i++) {
1922 int j;1929 int j;
1923 short *p = (short *)&c->vYCoeffsBank[i];1930 short *p = (short *)&c->vYCoeffsBank[i];
1924 for (j = 0; j < 8; j++)1931 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
1935 }1942 }
1936 1943
1937 for (i = 0; i < 4; i++)1944 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))
1939 goto nomem;1946 goto nomem;
1940 1947
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;
1942 1949
1943 // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate)1950 // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate)
1944 c->uv_off = (dst_stride>>1) + 64 / (c->dstBpc &~ 7);1951 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
1980 av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);1987 av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
1981 av_log(c, AV_LOG_DEBUG,1988 av_log(c, AV_LOG_DEBUG,
1982 "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",1989 "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);
1984 av_log(c, AV_LOG_DEBUG,1991 av_log(c, AV_LOG_DEBUG,
1985 "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",1992 "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
1986 c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH,1993 c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH,
@@ -2011,13 +2018,15 @@ fail: // FIXME replace things by appropriate error codes · 24 unmodified lines
2011 2018
2012 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,2019 c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
2013 tmpW, tmpH, tmpFormat,2020 tmpW, tmpH, tmpFormat,
2014 flags, srcFilter, NULL, c->param);2021 flags, srcFilter, NULL,
2022 c->opts.scaler_params);
2015 if (!c->cascaded_context[0])2023 if (!c->cascaded_context[0])
2016 return AVERROR(ENOMEM);2024 return AVERROR(ENOMEM);
2017 2025
2018 c->cascaded_context[1] = sws_getContext(tmpW, tmpH, tmpFormat,2026 c->cascaded_context[1] = sws_getContext(tmpW, tmpH, tmpFormat,
2019 dstW, dstH, dstFormat,2027 dstW, dstH, dstFormat,
2020 flags, NULL, dstFilter, c->param);2028 flags, NULL, dstFilter,
2029 c->opts.scaler_params);
2021 if (!c->cascaded_context[1])2030 if (!c->cascaded_context[1])
2022 return AVERROR(ENOMEM);2031 return AVERROR(ENOMEM);
2023 return 0;2032 return 0;
@@ -2032,21 +2041,21 @@ static int context_init_threaded(SwsContext *sws, · 8 unmodified lines
2032 int ret;2041 int ret;
2033 2042
2034 ret = avpriv_slicethread_create(&c->slicethread, (void*) sws,2043 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);
2036 if (ret == AVERROR(ENOSYS)) {2045 if (ret == AVERROR(ENOSYS)) {
2037 c->nb_threads = 1;2046 c->opts.threads = 1;
2038 return 0;2047 return 0;
2039 } else if (ret < 0)2048 } else if (ret < 0)
2040 return ret;2049 return ret;
2041 2050
2042 c->nb_threads = ret;2051 c->opts.threads = ret;
2043 2052
2044 c->slice_ctx = av_calloc(c->nb_threads, sizeof(*c->slice_ctx));2053 c->slice_ctx = av_calloc(c->opts.threads, sizeof(*c->slice_ctx));
2045 c->slice_err = av_calloc(c->nb_threads, sizeof(*c->slice_err));2054 c->slice_err = av_calloc(c->opts.threads, sizeof(*c->slice_err));
2046 if (!c->slice_ctx || !c->slice_err)2055 if (!c->slice_ctx || !c->slice_err)
2047 return AVERROR(ENOMEM);2056 return AVERROR(ENOMEM);
2048 2057
2049 for (int i = 0; i < c->nb_threads; i++) {2058 for (int i = 0; i < c->opts.threads; i++) {
2050 SwsInternal *c2;2059 SwsInternal *c2;
2051 c->slice_ctx[i] = sws_alloc_context();2060 c->slice_ctx[i] = sws_alloc_context();
2052 if (!c->slice_ctx[i])2061 if (!c->slice_ctx[i])
@@ -2060,13 +2069,13 @@ static int context_init_threaded(SwsContext *sws, · 7 unmodified lines
2060 if (ret < 0)2069 if (ret < 0)
2061 return ret;2070 return ret;
2062 2071
2063 c2->nb_threads = 1;2072 c2->opts.threads = 1;
2064 2073
2065 ret = sws_init_single_context(c->slice_ctx[i], src_filter, dst_filter);2074 ret = sws_init_single_context(c->slice_ctx[i], src_filter, dst_filter);
2066 if (ret < 0)2075 if (ret < 0)
2067 return ret;2076 return ret;
2068 2077
2069 if (c2->dither == SWS_DITHER_ED) {2078 if (c2->opts.dither == SWS_DITHER_ED) {
2070 av_log(c, AV_LOG_VERBOSE,2079 av_log(c, AV_LOG_VERBOSE,
2071 "Error-diffusion dither is in use, scaling will be single-threaded.");2080 "Error-diffusion dither is in use, scaling will be single-threaded.");
2072 break;2081 break;
@@ -2092,17 +2101,17 @@ av_cold int sws_init_context(SwsContext *sws, SwsFilter *srcFilter, · 19 unmodified lines
2092 if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0)2101 if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0)
2093 return AVERROR_UNKNOWN;2102 return AVERROR_UNKNOWN;
2094 2103
2095 src_format = c->srcFormat;2104 src_format = c->opts.src_format;
2096 dst_format = c->dstFormat;2105 dst_format = c->opts.dst_format;
2097 c->srcRange |= handle_jpeg(&c->srcFormat);2106 c->opts.src_range |= handle_jpeg(&c->opts.src_format);
2098 c->dstRange |= handle_jpeg(&c->dstFormat);2107 c->opts.dst_range |= handle_jpeg(&c->opts.dst_format);
2099 2108
2100 if (src_format != c->srcFormat || dst_format != c->dstFormat)2109 if (src_format != c->opts.src_format || dst_format != c->opts.dst_format)
2101 av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");2110 av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");
2102 2111
2103 if (c->nb_threads != 1) {2112 if (c->opts.threads != 1) {
2104 ret = context_init_threaded(sws, srcFilter, dstFilter);2113 ret = context_init_threaded(sws, srcFilter, dstFilter);
2105 if (ret < 0 || c->nb_threads > 1)2114 if (ret < 0 || c->opts.threads > 1)
2106 return ret;2115 return ret;
2107 // threading disabled in this build, init as single-threaded2116 // threading disabled in this build, init as single-threaded
2108 }2117 }
@@ -2546,15 +2555,15 @@ SwsContext *sws_getCachedContext(SwsContext *sws, int srcW, · 437 unmodified lines
2546 param = default_param;2555 param = default_param;
2547 2556
2548 if ((context = sws_internal(sws)) &&2557 if ((context = sws_internal(sws)) &&
2549 (context->srcW != srcW ||2558 (context->opts.src_w != srcW ||
2550 context->srcH != srcH ||2559 context->opts.src_h != srcH ||
2551 context->srcFormat != srcFormat ||2560 context->opts.src_format != srcFormat ||
2552 context->dstW != dstW ||2561 context->opts.dst_w != dstW ||
2553 context->dstH != dstH ||2562 context->opts.dst_h != dstH ||
2554 context->dstFormat != dstFormat ||2563 context->opts.dst_format != dstFormat ||
2555 context->flags != flags ||2564 context->opts.flags != flags ||
2556 context->param[0] != param[0] ||2565 context->opts.scaler_params[0] != param[0] ||
2557 context->param[1] != param[1])) {2566 context->opts.scaler_params[1] != param[1])) {
2558 2567
2559 av_opt_get_int(context, "src_h_chr_pos", 0, &src_h_chr_pos);2568 av_opt_get_int(context, "src_h_chr_pos", 0, &src_h_chr_pos);
2560 av_opt_get_int(context, "src_v_chr_pos", 0, &src_v_chr_pos);2569 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
2568 if (!(sws = sws_alloc_context()))2577 if (!(sws = sws_alloc_context()))
2569 return NULL;2578 return NULL;
2570 context = sws_internal(sws);2579 context = sws_internal(sws);
2571 context->srcW = srcW;2580 context->opts.src_w = srcW;
2572 context->srcH = srcH;2581 context->opts.src_h = srcH;
2573 context->srcFormat = srcFormat;2582 context->opts.src_format = srcFormat;
2574 context->dstW = dstW;2583 context->opts.dst_w = dstW;
2575 context->dstH = dstH;2584 context->opts.dst_h = dstH;
2576 context->dstFormat = dstFormat;2585 context->opts.dst_format = dstFormat;
2577 context->flags = flags;2586 context->opts.flags = flags;
2578 context->param[0] = param[0];2587 context->opts.scaler_params[0] = param[0];
2579 context->param[1] = param[1];2588 context->opts.scaler_params[1] = param[1];
2580 2589
2581 av_opt_set_int(context, "src_h_chr_pos", src_h_chr_pos, 0);2590 av_opt_set_int(context, "src_h_chr_pos", src_h_chr_pos, 0);
2582 av_opt_set_int(context, "src_v_chr_pos", src_v_chr_pos, 0);2591 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
93 uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * inst->filter_size);93 uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * inst->filter_size);
94 94
95 if (c->yuv2nv12cX) {95 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);
97 } else if (inst->filter_size == 1) {97 } else if (inst->filter_size == 1) {
98 inst->pfn.yuv2planar1((const int16_t*)src1[0], dst1[0], dstW, c->chrDither8, 0);98 inst->pfn.yuv2planar1((const int16_t*)src1[0], dst1[0], dstW, c->chrDither8, 0);
99 inst->pfn.yuv2planar1((const int16_t*)src2[0], dst2[0], dstW, c->chrDither8, 3);99 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
216 VScalerContext *lumCtx = NULL;216 VScalerContext *lumCtx = NULL;
217 VScalerContext *chrCtx = NULL;217 VScalerContext *chrCtx = NULL;
218 218
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))) {
220 lumCtx = av_mallocz(sizeof(VScalerContext));220 lumCtx = av_mallocz(sizeof(VScalerContext));
221 if (!lumCtx)221 if (!lumCtx)
222 return AVERROR(ENOMEM);222 return AVERROR(ENOMEM);
@@ -228,7 +228,7 @@ int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, Sws · 5 unmodified lines
228 desc[0].dst = dst;228 desc[0].dst = dst;
229 desc[0].alpha = c->needAlpha;229 desc[0].alpha = c->needAlpha;
230 230
231 if (!isGray(c->dstFormat)) {231 if (!isGray(c->opts.dst_format)) {
232 chrCtx = av_mallocz(sizeof(VScalerContext));232 chrCtx = av_mallocz(sizeof(VScalerContext));
233 if (!chrCtx)233 if (!chrCtx)
234 return AVERROR(ENOMEM);234 return AVERROR(ENOMEM);
@@ -268,8 +268,8 @@ void ff_init_vscale_pfn(SwsInternal *c, · 33 unmodified lines
268 VScalerContext *chrCtx = NULL;268 VScalerContext *chrCtx = NULL;
269 int idx = c->numDesc - (c->is_internal_gamma ? 2 : 1); //FIXME avoid hardcoding indexes269 int idx = c->numDesc - (c->is_internal_gamma ? 2 : 1); //FIXME avoid hardcoding indexes
270 270
271 if (isPlanarYUV(c->dstFormat) || (isGray(c->dstFormat) && !isALPHA(c->dstFormat))) {271 if (isPlanarYUV(c->opts.dst_format) || (isGray(c->opts.dst_format) && !isALPHA(c->opts.dst_format))) {
272 if (!isGray(c->dstFormat)) {272 if (!isGray(c->opts.dst_format)) {
273 chrCtx = c->desc[idx].instance;273 chrCtx = c->desc[idx].instance;
274 274
275 chrCtx->filter[0] = use_mmx ? (int16_t*)c->chrMmxFilter : c->vChrFilter;275 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
582 582
583%if ARCH_X86_64583%if ARCH_X86_64
584struc SwsInternal584struc SwsInternal
585 .padding: resb 40292 ; offsetof(SwsInternal, yuv2rgb_y_offset)585 .padding: resb 40316 ; offsetof(SwsInternal, yuv2rgb_y_offset)
586 .yuv2rgb_y_offset: resd 1586 .yuv2rgb_y_offset: resd 1
587 .yuv2rgb_y_coeff: resd 1587 .yuv2rgb_y_coeff: resd 1
588 .yuv2rgb_v2r_coeff: resd 1588 .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
63 63
64void ff_updateMMXDitherTables(SwsInternal *c, int dstY)64void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
65{65{
66 const int dstH= c->dstH;66 const int dstH= c->opts.dst_h;
67 const int flags= c->flags;67 const int flags= c->opts.flags;
68 68
69 SwsPlane *lumPlane = &c->slice[c->numSlice-2].plane[0];69 SwsPlane *lumPlane = &c->slice[c->numSlice-2].plane[0];
70 SwsPlane *chrUPlane = &c->slice[c->numSlice-2].plane[1];70 SwsPlane *chrUPlane = &c->slice[c->numSlice-2].plane[1];
@@ -85,7 +85,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY) · 14 unmodified lines
85 const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input85 const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
86 86
87 c->blueDither= ff_dither8[dstY&1];87 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)
89 c->greenDither= ff_dither8[dstY&1];89 c->greenDither= ff_dither8[dstY&1];
90 else90 else
91 c->greenDither= ff_dither4[dstY&1];91 c->greenDither= ff_dither4[dstY&1];
@@ -96,10 +96,10 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY) · 4 unmodified lines
96 const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;96 const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;
97 97
98 int i;98 int i;
99 if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {99 if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->opts.src_h) {
100 const int16_t **tmpY = (const int16_t **) lumPlane->tmp;100 const int16_t **tmpY = (const int16_t **) lumPlane->tmp;
101 101
102 int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);102 int neg = -firstLumSrcY, i, end = FFMIN(c->opts.src_h - firstLumSrcY, vLumFilterSize);
103 for (i = 0; i < neg; i++)103 for (i = 0; i < neg; i++)
104 tmpY[i] = lumSrcPtr[neg];104 tmpY[i] = lumSrcPtr[neg];
105 for ( ; i < end; i++)105 for ( ; i < end; i++)
@@ -453,7 +453,7 @@ INPUT_PLANAR_RGB_A_ALL_DECL(avx2); · 347 unmodified lines
453 453
454#define RANGE_CONVERT_FUNCS(opt) do { \454#define RANGE_CONVERT_FUNCS(opt) do { \
455 if (c->dstBpc <= 14) { \455 if (c->dstBpc <= 14) { \
456 if (c->srcRange) { \456 if (c->opts.src_range) { \
457 c->lumConvertRange = ff_lumRangeFromJpeg_ ##opt; \457 c->lumConvertRange = ff_lumRangeFromJpeg_ ##opt; \
458 c->chrConvertRange = ff_chrRangeFromJpeg_ ##opt; \458 c->chrConvertRange = ff_chrRangeFromJpeg_ ##opt; \
459 } else { \459 } else { \
@@ -490,7 +490,7 @@ av_cold void ff_sws_init_swscale_x86(SwsInternal *c) · 30 unmodified lines
490 if (INLINE_MMXEXT(cpu_flags))490 if (INLINE_MMXEXT(cpu_flags))
491 sws_init_swscale_mmxext(c);491 sws_init_swscale_mmxext(c);
492#endif492#endif
493 if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)) {493 if(c->use_mmx_vfilter && !(c->opts.flags & SWS_ACCURATE_RND)) {
494#if HAVE_MMXEXT_EXTERNAL494#if HAVE_MMXEXT_EXTERNAL
495 if (EXTERNAL_MMXEXT(cpu_flags))495 if (EXTERNAL_MMXEXT(cpu_flags))
496 c->yuv2planeX = yuv2yuvX_mmxext;496 c->yuv2planeX = yuv2yuvX_mmxext;
@@ -526,7 +526,7 @@ av_cold void ff_sws_init_swscale_x86(SwsInternal *c) · 29 unmodified lines
526 } else if (c->srcBpc == 12) { \526 } else if (c->srcBpc == 12) { \
527 hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \527 hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
528 ff_hscale12to19_ ## filtersize ## _ ## opt1; \528 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)) { \
530 hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \530 hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
531 ff_hscale14to19_ ## filtersize ## _ ## opt1; \531 ff_hscale14to19_ ## filtersize ## _ ## opt1; \
532 } else { /* c->srcBpc == 16 */ \532 } else { /* c->srcBpc == 16 */ \
@@ -538,15 +538,15 @@ av_cold void ff_sws_init_swscale_x86(SwsInternal *c) · 5 unmodified lines
538#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \538#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
539switch(c->dstBpc){ \539switch(c->dstBpc){ \
540 case 16: do_16_case; break; \540 case 16: do_16_case; break; \
541 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## 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->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \542 case 9: if (!isBE(c->opts.dst_format)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
543 case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \543 case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
544 }544 }
545#define ASSIGN_VSCALE_FUNC(vscalefn, opt) \545#define ASSIGN_VSCALE_FUNC(vscalefn, opt) \
546 switch(c->dstBpc){ \546 switch(c->dstBpc){ \
547 case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \547 case 16: if (!isBE(c->opts.dst_format)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \
548 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2plane1_10_ ## 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->dstFormat)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \549 case 9: if (!isBE(c->opts.dst_format)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \
550 case 8: vscalefn = ff_yuv2plane1_8_ ## opt; break; \550 case 8: vscalefn = ff_yuv2plane1_8_ ## opt; break; \
551 default: av_assert0(c->dstBpc>8); \551 default: av_assert0(c->dstBpc>8); \
552 }552 }
@@ -569,10 +569,10 @@ switch(c->dstBpc){ \ · 16 unmodified lines
569 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);569 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
570 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,570 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
571 HAVE_ALIGNED_STACK || ARCH_X86_64);571 HAVE_ALIGNED_STACK || ARCH_X86_64);
572 if (!(c->flags & SWS_ACCURATE_RND))572 if (!(c->opts.flags & SWS_ACCURATE_RND))
573 ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2);573 ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2);
574 574
575 switch (c->srcFormat) {575 switch (c->opts.src_format) {
576 case AV_PIX_FMT_YA8:576 case AV_PIX_FMT_YA8:
577 c->lumToYV12 = ff_yuyvToY_sse2;577 c->lumToYV12 = ff_yuyvToY_sse2;
578 if (c->needAlpha)578 if (c->needAlpha)
@@ -605,7 +605,7 @@ switch(c->dstBpc){ \ · 26 unmodified lines
605 if (EXTERNAL_SSSE3(cpu_flags)) {605 if (EXTERNAL_SSSE3(cpu_flags)) {
606 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);606 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
607 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);607 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
608 switch (c->srcFormat) {608 switch (c->opts.src_format) {
609 case_rgb(rgb24, RGB24, ssse3);609 case_rgb(rgb24, RGB24, ssse3);
610 case_rgb(bgr24, BGR24, ssse3);610 case_rgb(bgr24, BGR24, ssse3);
611 default:611 default:
@@ -617,19 +617,19 @@ switch(c->dstBpc){ \ · 5 unmodified lines
617 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);617 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
618 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);618 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
619 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,619 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,
621 HAVE_ALIGNED_STACK || ARCH_X86_64);621 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))
623 c->yuv2plane1 = ff_yuv2plane1_16_sse4;623 c->yuv2plane1 = ff_yuv2plane1_16_sse4;
624 }624 }
625 625
626 if (EXTERNAL_AVX(cpu_flags)) {626 if (EXTERNAL_AVX(cpu_flags)) {
627 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,627 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
628 HAVE_ALIGNED_STACK || ARCH_X86_64);628 HAVE_ALIGNED_STACK || ARCH_X86_64);
629 if (!(c->flags & SWS_ACCURATE_RND))629 if (!(c->opts.flags & SWS_ACCURATE_RND))
630 ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx);630 ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx);
631 631
632 switch (c->srcFormat) {632 switch (c->opts.src_format) {
633 case AV_PIX_FMT_YUYV422:633 case AV_PIX_FMT_YUYV422:
634 c->chrToYV12 = ff_yuyvToUV_avx;634 c->chrToYV12 = ff_yuyvToUV_avx;
635 break;635 break;
@@ -670,7 +670,7 @@ switch(c->dstBpc){ \ · 34 unmodified lines
670 670
671 if (EXTERNAL_AVX2_FAST(cpu_flags)) {671 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
672 if (ARCH_X86_64)672 if (ARCH_X86_64)
673 switch (c->srcFormat) {673 switch (c->opts.src_format) {
674 case_rgb(rgb24, RGB24, avx2);674 case_rgb(rgb24, RGB24, avx2);
675 case_rgb(bgr24, BGR24, avx2);675 case_rgb(bgr24, BGR24, avx2);
676 case_rgb(bgra, BGRA, avx2);676 case_rgb(bgra, BGRA, avx2);
@@ -678,8 +678,8 @@ switch(c->dstBpc){ \ · 1 unmodified line
678 case_rgb(abgr, ABGR, avx2);678 case_rgb(abgr, ABGR, avx2);
679 case_rgb(argb, ARGB, avx2);679 case_rgb(argb, ARGB, avx2);
680 }680 }
681 if (!(c->flags & SWS_ACCURATE_RND)) // FIXME681 if (!(c->opts.flags & SWS_ACCURATE_RND)) // FIXME
682 switch (c->dstFormat) {682 switch (c->opts.dst_format) {
683 case AV_PIX_FMT_NV12:683 case AV_PIX_FMT_NV12:
684 case AV_PIX_FMT_NV24:684 case AV_PIX_FMT_NV24:
685 c->yuv2nv12cX = ff_yuv2nv12cX_avx2;685 c->yuv2nv12cX = ff_yuv2nv12cX_avx2;
@@ -752,7 +752,7 @@ switch(c->dstBpc){ \ · 66 unmodified lines
752 752
753 753
754 if (EXTERNAL_SSE2(cpu_flags)) {754 if (EXTERNAL_SSE2(cpu_flags)) {
755 switch (c->srcFormat) {755 switch (c->opts.src_format) {
756 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, sse2);756 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, sse2);
757 INPUT_PLANER_RGB_UV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse2);757 INPUT_PLANER_RGB_UV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse2);
758 INPUT_PLANER_RGBXX_UV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse2);758 INPUT_PLANER_RGBXX_UV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse2);
@@ -767,7 +767,7 @@ switch(c->dstBpc){ \ · 8 unmodified lines
767 }767 }
768 768
769 if (EXTERNAL_SSE4(cpu_flags)) {769 if (EXTERNAL_SSE4(cpu_flags)) {
770 switch (c->srcFormat) {770 switch (c->opts.src_format) {
771 case AV_PIX_FMT_GBRAP:771 case AV_PIX_FMT_GBRAP:
772 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse4);772 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse4);
773 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse4);773 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse4);
@@ -782,14 +782,14 @@ switch(c->dstBpc){ \ · 8 unmodified lines
782 }782 }
783 783
784 if (EXTERNAL_AVX2_FAST(cpu_flags)) {784 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
785 switch (c->srcFormat) {785 switch (c->opts.src_format) {
786 INPUT_PLANER_RGB_YUVA_ALL_CASES(avx2)786 INPUT_PLANER_RGB_YUVA_ALL_CASES(avx2)
787 default:787 default:
788 break;788 break;
789 }789 }
790 }790 }
791 791
792 if(c->flags & SWS_FULL_CHR_H_INT) {792 if(c->opts.flags & SWS_FULL_CHR_H_INT) {
793 793
794#define YUV2ANYX_FUNC_CASE(fmt, name, opt) \794#define YUV2ANYX_FUNC_CASE(fmt, name, opt) \
795 case fmt: \795 case fmt: \
@@ -821,7 +821,7 @@ switch(c->dstBpc){ \ · 25 unmodified lines
821 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32BE, gbrapf32be, opt)821 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32BE, gbrapf32be, opt)
822 822
823 if (EXTERNAL_SSE2(cpu_flags)) {823 if (EXTERNAL_SSE2(cpu_flags)) {
824 switch (c->dstFormat) {824 switch (c->opts.dst_format) {
825 YUV2ANYX_GBRAP_CASES(sse2)825 YUV2ANYX_GBRAP_CASES(sse2)
826 default:826 default:
827 break;827 break;
@@ -829,7 +829,7 @@ switch(c->dstBpc){ \ · 1 unmodified line
829 }829 }
830 830
831 if (EXTERNAL_SSE4(cpu_flags)) {831 if (EXTERNAL_SSE4(cpu_flags)) {
832 switch (c->dstFormat) {832 switch (c->opts.dst_format) {
833 YUV2ANYX_GBRAP_CASES(sse4)833 YUV2ANYX_GBRAP_CASES(sse4)
834 default:834 default:
835 break;835 break;
@@ -837,7 +837,7 @@ switch(c->dstBpc){ \ · 1 unmodified line
837 }837 }
838 838
839 if (EXTERNAL_AVX2_FAST(cpu_flags)) {839 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
840 switch (c->dstFormat) {840 switch (c->opts.dst_format) {
841 YUV2ANYX_GBRAP_CASES(avx2)841 YUV2ANYX_GBRAP_CASES(avx2)
842 default:842 default:
843 break;843 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
1384}1384}
1385static av_cold void RENAME(sws_init_swscale)(SwsInternal *c)1385static av_cold void RENAME(sws_init_swscale)(SwsInternal *c)
1386{1386{
1387 enum AVPixelFormat dstFormat = c->dstFormat;1387 enum AVPixelFormat dstFormat = c->opts.dst_format;
1388 1388
1389 c->use_mmx_vfilter= 0;1389 c->use_mmx_vfilter= 0;
1390 if (!is16BPS(dstFormat) && !isNBPS(dstFormat) && !isSemiPlanarYUV(dstFormat)1390 if (!is16BPS(dstFormat) && !isNBPS(dstFormat) && !isSemiPlanarYUV(dstFormat)
1391 && dstFormat != AV_PIX_FMT_GRAYF32BE && dstFormat != AV_PIX_FMT_GRAYF32LE1391 && dstFormat != AV_PIX_FMT_GRAYF32BE && dstFormat != AV_PIX_FMT_GRAYF32LE
1392 && !(c->flags & SWS_BITEXACT)) {1392 && !(c->opts.flags & SWS_BITEXACT)) {
1393 if (c->flags & SWS_ACCURATE_RND) {1393 if (c->opts.flags & SWS_ACCURATE_RND) {
1394 if (!(c->flags & SWS_FULL_CHR_H_INT)) {1394 if (!(c->opts.flags & SWS_FULL_CHR_H_INT)) {
1395 switch (c->dstFormat) {1395 switch (c->opts.dst_format) {
1396 case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;1396 case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;
1397#if HAVE_6REGS1397#if HAVE_6REGS
1398 case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break;1398 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
1405 }1405 }
1406 } else {1406 } else {
1407 c->use_mmx_vfilter= 1;1407 c->use_mmx_vfilter= 1;
1408 if (!(c->flags & SWS_FULL_CHR_H_INT)) {1408 if (!(c->opts.flags & SWS_FULL_CHR_H_INT)) {
1409 switch (c->dstFormat) {1409 switch (c->opts.dst_format) {
1410 case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break;1410 case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break;
1411 case AV_PIX_FMT_BGR32: c->yuv2packedX = RENAME(yuv2bgr32_X); break;1411 case AV_PIX_FMT_BGR32: c->yuv2packedX = RENAME(yuv2bgr32_X); break;
1412#if HAVE_6REGS1412#if HAVE_6REGS
@@ -1419,8 +1419,8 @@ static av_cold void RENAME(sws_init_swscale)(SwsInternal *c) · 6 unmodified lines
1419 }1419 }
1420 }1420 }
1421 }1421 }
1422 if (!(c->flags & SWS_FULL_CHR_H_INT)) {1422 if (!(c->opts.flags & SWS_FULL_CHR_H_INT)) {
1423 switch (c->dstFormat) {1423 switch (c->opts.dst_format) {
1424 case AV_PIX_FMT_RGB32:1424 case AV_PIX_FMT_RGB32:
1425 c->yuv2packed1 = RENAME(yuv2rgb32_1);1425 c->yuv2packed1 = RENAME(yuv2rgb32_1);
1426 c->yuv2packed2 = RENAME(yuv2rgb32_2);1426 c->yuv2packed2 = RENAME(yuv2rgb32_2);
@@ -1449,7 +1449,7 @@ static av_cold void RENAME(sws_init_swscale)(SwsInternal *c) · 22 unmodified lines
1449 1449
1450 if (c->srcBpc == 8 && c->dstBpc <= 14) {1450 if (c->srcBpc == 8 && c->dstBpc <= 14) {
1451 // Use the new MMX scaler if the MMXEXT one can't be used (it is faster than the x86 ASM one).1451 // 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) {
1453 c->hyscale_fast = ff_hyscale_fast_mmxext;1453 c->hyscale_fast = ff_hyscale_fast_mmxext;
1454 c->hcscale_fast = ff_hcscale_fast_mmxext;1454 c->hcscale_fast = ff_hcscale_fast_mmxext;
1455 } else {1455 } else {
libswscale/x86/yuv2rgb.c+7−7
@@ -41,11 +41,11 @@ · 40 unmodified lines
41#if HAVE_X86ASM41#if HAVE_X86ASM
42 42
43#define YUV2RGB_LOOP(depth) \43#define YUV2RGB_LOOP(depth) \
44 h_size = (c->dstW + 7) & ~7; \44 h_size = (c->opts.dst_w + 7) & ~7; \
45 if (h_size * depth > FFABS(dstStride[0])) \45 if (h_size * depth > FFABS(dstStride[0])) \
46 h_size -= 8; \46 h_size -= 8; \
47 \47 \
48 vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \48 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
49 \49 \
50 for (y = 0; y < srcSliceH; y++) { \50 for (y = 0; y < srcSliceH; y++) { \
51 uint8_t *image = dst[0] + (y + srcSliceY) * dstStride[0]; \51 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
215{215{
216 int y, h_size, vshift;216 int y, h_size, vshift;
217 217
218 h_size = (c->dstW + 7) & ~7;218 h_size = (c->opts.dst_w + 7) & ~7;
219 if (h_size * 3 > FFABS(dstStride[0]))219 if (h_size * 3 > FFABS(dstStride[0]))
220 h_size -= 8;220 h_size -= 8;
221 221
222 vshift = c->srcFormat != AV_PIX_FMT_YUV422P;222 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P;
223 223
224 for (y = 0; y < srcSliceH; y++) {224 for (y = 0; y < srcSliceH; y++) {
225 uint8_t *dst_g = dst[0] + (y + srcSliceY) * dstStride[0];225 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
244 int cpu_flags = av_get_cpu_flags();244 int cpu_flags = av_get_cpu_flags();
245 245
246 if (EXTERNAL_SSSE3(cpu_flags)) {246 if (EXTERNAL_SSSE3(cpu_flags)) {
247 switch (c->dstFormat) {247 switch (c->opts.dst_format) {
248 case AV_PIX_FMT_RGB32:248 case AV_PIX_FMT_RGB32:
249 if (c->srcFormat == AV_PIX_FMT_YUVA420P) {249 if (c->opts.src_format == AV_PIX_FMT_YUVA420P) {
250#if CONFIG_SWSCALE_ALPHA250#if CONFIG_SWSCALE_ALPHA
251 return yuva420_rgb32_ssse3;251 return yuva420_rgb32_ssse3;
252#endif252#endif
@@ -254,7 +254,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c) · 1 unmodified line
254 } else254 } else
255 return yuv420_rgb32_ssse3;255 return yuv420_rgb32_ssse3;
256 case AV_PIX_FMT_BGR32:256 case AV_PIX_FMT_BGR32:
257 if (c->srcFormat == AV_PIX_FMT_YUVA420P) {257 if (c->opts.src_format == AV_PIX_FMT_YUVA420P) {
258#if CONFIG_SWSCALE_ALPHA258#if CONFIG_SWSCALE_ALPHA
259 return yuva420_bgr32_ssse3;259 return yuva420_bgr32_ssse3;
260#endif260#endif
libswscale/yuv2rgb.c+40−40
@@ -155,7 +155,7 @@ const int *sws_getCoefficients(int colorspace) · 154 unmodified lines
155 const uint8_t av_unused *pv_1 = src[2] + (y >> !yuv422) * srcStride[2]; \155 const uint8_t av_unused *pv_1 = src[2] + (y >> !yuv422) * srcStride[2]; \
156 const uint8_t av_unused *pu_2, *pv_2; \156 const uint8_t av_unused *pu_2, *pv_2; \
157 const uint8_t av_unused *pa_1, *pa_2; \157 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; \
159 if (nb_dst_planes > 1) { \159 if (nb_dst_planes > 1) { \
160 dst1_1 = (dst_type *)(dst[1] + (yd) * dstStride[1]); \160 dst1_1 = (dst_type *)(dst[1] + (yd) * dstStride[1]); \
161 dst1_2 = (dst_type *)(dst[1] + (yd + 1) * dstStride[1]); \161 dst1_2 = (dst_type *)(dst[1] + (yd + 1) * dstStride[1]); \
@@ -195,7 +195,7 @@ const int *sws_getCoefficients(int colorspace) · 33 unmodified lines
195 dst2_2 += dst_delta >> ss; \195 dst2_2 += dst_delta >> ss; \
196 } \196 } \
197 } \197 } \
198 if (c->dstW & (4 >> ss)) { \198 if (c->opts.dst_w & (4 >> ss)) { \
199 int av_unused Y, U, V; \199 int av_unused Y, U, V; \
200 200
201#define ENDYUV2RGBFUNC() \201#define ENDYUV2RGBFUNC() \
@@ -485,9 +485,9 @@ YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0, 1) · 283 unmodified lines
485 dst_1 += 1;485 dst_1 += 1;
486 dst_2 += 1;486 dst_2 += 1;
487 }487 }
488 if (c->dstW & 7) {488 if (c->opts.dst_w & 7) {
489 int av_unused Y, U, V;489 int av_unused Y, U, V;
490 int pixels_left = c->dstW & 7;490 int pixels_left = c->opts.dst_w & 7;
491 const uint8_t *d128 = ff_dither_8x8_220[yd & 7];491 const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
492 char out_1 = 0, out_2 = 0;492 char out_1 = 0, out_2 = 0;
493 g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM];493 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
575 575
576 av_log(c, AV_LOG_WARNING,576 av_log(c, AV_LOG_WARNING,
577 "No accelerated colorspace conversion found from %s to %s.\n",577 "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));
579 579
580 if (c->srcFormat == AV_PIX_FMT_YUV422P) {580 if (c->opts.src_format == AV_PIX_FMT_YUV422P) {
581 switch (c->dstFormat) {581 switch (c->opts.dst_format) {
582 case AV_PIX_FMT_BGR48BE:582 case AV_PIX_FMT_BGR48BE:
583 case AV_PIX_FMT_BGR48LE:583 case AV_PIX_FMT_BGR48LE:
584 return yuv422p_bgr48_c;584 return yuv422p_bgr48_c;
@@ -587,11 +587,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 2 unmodified lines
587 return yuv422p_rgb48_c;587 return yuv422p_rgb48_c;
588 case AV_PIX_FMT_ARGB:588 case AV_PIX_FMT_ARGB:
589 case AV_PIX_FMT_ABGR:589 case AV_PIX_FMT_ABGR:
590 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat))590 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format))
591 return yuva422p_argb_c;591 return yuva422p_argb_c;
592 case AV_PIX_FMT_RGBA:592 case AV_PIX_FMT_RGBA:
593 case AV_PIX_FMT_BGRA:593 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;
595 case AV_PIX_FMT_RGB24:595 case AV_PIX_FMT_RGB24:
596 return yuv422p_rgb24_c;596 return yuv422p_rgb24_c;
597 case AV_PIX_FMT_BGR24:597 case AV_PIX_FMT_BGR24:
@@ -620,7 +620,7 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 22 unmodified lines
620 return yuv422p_gbrp_c;620 return yuv422p_gbrp_c;
621 }621 }
622 } else {622 } else {
623 switch (c->dstFormat) {623 switch (c->opts.dst_format) {
624 case AV_PIX_FMT_BGR48BE:624 case AV_PIX_FMT_BGR48BE:
625 case AV_PIX_FMT_BGR48LE:625 case AV_PIX_FMT_BGR48LE:
626 return yuv2rgb_c_bgr48;626 return yuv2rgb_c_bgr48;
@@ -629,11 +629,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) · 2 unmodified lines
629 return yuv2rgb_c_48;629 return yuv2rgb_c_48;
630 case AV_PIX_FMT_ARGB:630 case AV_PIX_FMT_ARGB:
631 case AV_PIX_FMT_ABGR:631 case AV_PIX_FMT_ABGR:
632 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat))632 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format))
633 return yuva2argb_c;633 return yuva2argb_c;
634 case AV_PIX_FMT_RGBA:634 case AV_PIX_FMT_RGBA:
635 case AV_PIX_FMT_BGRA:635 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;
637 case AV_PIX_FMT_RGB24:637 case AV_PIX_FMT_RGB24:
638 return yuv2rgb_c_24_rgb;638 return yuv2rgb_c_24_rgb;
639 case AV_PIX_FMT_BGR24:639 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
706 int fullRange, int brightness,706 int fullRange, int brightness,
707 int contrast, int saturation)707 int contrast, int saturation)
708{708{
709 const int isRgb = c->dstFormat == AV_PIX_FMT_RGB32 ||709 const int isRgb = c->opts.dst_format == AV_PIX_FMT_RGB32 ||
710 c->dstFormat == AV_PIX_FMT_RGB32_1 ||710 c->opts.dst_format == AV_PIX_FMT_RGB32_1 ||
711 c->dstFormat == AV_PIX_FMT_BGR24 ||711 c->opts.dst_format == AV_PIX_FMT_BGR24 ||
712 c->dstFormat == AV_PIX_FMT_RGB565BE ||712 c->opts.dst_format == AV_PIX_FMT_RGB565BE ||
713 c->dstFormat == AV_PIX_FMT_RGB565LE ||713 c->opts.dst_format == AV_PIX_FMT_RGB565LE ||
714 c->dstFormat == AV_PIX_FMT_RGB555BE ||714 c->opts.dst_format == AV_PIX_FMT_RGB555BE ||
715 c->dstFormat == AV_PIX_FMT_RGB555LE ||715 c->opts.dst_format == AV_PIX_FMT_RGB555LE ||
716 c->dstFormat == AV_PIX_FMT_RGB444BE ||716 c->opts.dst_format == AV_PIX_FMT_RGB444BE ||
717 c->dstFormat == AV_PIX_FMT_RGB444LE ||717 c->opts.dst_format == AV_PIX_FMT_RGB444LE ||
718 c->dstFormat == AV_PIX_FMT_X2RGB10BE ||718 c->opts.dst_format == AV_PIX_FMT_X2RGB10BE ||
719 c->dstFormat == AV_PIX_FMT_X2RGB10LE ||719 c->opts.dst_format == AV_PIX_FMT_X2RGB10LE ||
720 c->dstFormat == AV_PIX_FMT_RGB8 ||720 c->opts.dst_format == AV_PIX_FMT_RGB8 ||
721 c->dstFormat == AV_PIX_FMT_RGB4 ||721 c->opts.dst_format == AV_PIX_FMT_RGB4 ||
722 c->dstFormat == AV_PIX_FMT_RGB4_BYTE ||722 c->opts.dst_format == AV_PIX_FMT_RGB4_BYTE ||
723 c->dstFormat == AV_PIX_FMT_MONOBLACK;723 c->opts.dst_format == AV_PIX_FMT_MONOBLACK;
724 const int isNotNe = c->dstFormat == AV_PIX_FMT_NE(RGB565LE, RGB565BE) ||724 const int isNotNe = c->opts.dst_format == AV_PIX_FMT_NE(RGB565LE, RGB565BE) ||
725 c->dstFormat == AV_PIX_FMT_NE(RGB555LE, RGB555BE) ||725 c->opts.dst_format == AV_PIX_FMT_NE(RGB555LE, RGB555BE) ||
726 c->dstFormat == AV_PIX_FMT_NE(RGB444LE, RGB444BE) ||726 c->opts.dst_format == AV_PIX_FMT_NE(RGB444LE, RGB444BE) ||
727 c->dstFormat == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||727 c->opts.dst_format == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||
728 c->dstFormat == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||728 c->opts.dst_format == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||
729 c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE) ||729 c->opts.dst_format == AV_PIX_FMT_NE(BGR444LE, BGR444BE) ||
730 c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE) ||730 c->opts.dst_format == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE) ||
731 c->dstFormat == AV_PIX_FMT_NE(X2BGR10LE, X2BGR10BE);731 c->opts.dst_format == AV_PIX_FMT_NE(X2BGR10LE, X2BGR10BE);
732 const int bpp = c->dstFormatBpp;732 const int bpp = c->dstFormatBpp;
733 uint8_t *y_table;733 uint8_t *y_table;
734 uint16_t *y_table16;734 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
904 rbase = isRgb ? 20 : 0;904 rbase = isRgb ? 20 : 0;
905 gbase = 10;905 gbase = 10;
906 bbase = isRgb ? 0 : 20;906 bbase = isRgb ? 0 : 20;
907 needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);907 needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format);
908 if (!needAlpha)908 if (!needAlpha)
909 abase = 30;909 abase = 30;
910 ALLOC_YUV_TABLE(table_plane_size * 3 * 4);910 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
928 break;928 break;
929 case 32:929 case 32:
930 case 64:930 case 64:
931 base = (c->dstFormat == AV_PIX_FMT_RGB32_1 ||931 base = (c->opts.dst_format == AV_PIX_FMT_RGB32_1 ||
932 c->dstFormat == AV_PIX_FMT_BGR32_1) ? 8 : 0;932 c->opts.dst_format == AV_PIX_FMT_BGR32_1) ? 8 : 0;
933 rbase = base + (isRgb ? 16 : 0);933 rbase = base + (isRgb ? 16 : 0);
934 gbase = base + 8;934 gbase = base + 8;
935 bbase = base + (isRgb ? 0 : 16);935 bbase = base + (isRgb ? 0 : 16);
936 needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);936 needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->opts.src_format);
937 if (!needAlpha)937 if (!needAlpha)
938 abase = (base + 24) & 31;938 abase = (base + 24) & 31;
939 ALLOC_YUV_TABLE(table_plane_size * 3 * 4);939 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
953 fill_gv_table(c->table_gV, 4, cgv);953 fill_gv_table(c->table_gV, 4, cgv);
954 break;954 break;
955 default:955 default:
956 if(!isPlanar(c->dstFormat) || bpp <= 24)956 if(!isPlanar(c->opts.dst_format) || bpp <= 24)
957 av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);957 av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
958 return AVERROR(EINVAL);958 return AVERROR(EINVAL);
959 }959 }
tests/checkasm/sw_gbrp.c+8−8
@@ -135,13 +135,13 @@ static void check_output_yuv2gbrp(void) · 134 unmodified lines
135 fail();135 fail();
136 136
137 c = sws_internal(sws);137 c = sws_internal(sws);
138 c->flags |= SWS_FULL_CHR_H_INT;138 c->opts.flags |= SWS_FULL_CHR_H_INT;
139 139
140 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {140 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
141 for (fsi = 0; fsi < FILTER_SIZES; fsi++) {141 for (fsi = 0; fsi < FILTER_SIZES; fsi++) {
142 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {142 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
143 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);143 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
144 c->dstFormat = planar_fmts[fmi];144 c->opts.dst_format = planar_fmts[fmi];
145 145
146 dstW = input_sizes[isi];146 dstW = input_sizes[isi];
147 luma_filter_size = filter_sizes[fsi];147 luma_filter_size = filter_sizes[fsi];
@@ -229,8 +229,8 @@ static void check_input_planar_rgb_to_y(void) · 81 unmodified lines
229 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {229 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
230 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {230 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
231 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);231 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
232 c->srcFormat = planar_fmts[fmi];232 c->opts.src_format = planar_fmts[fmi];
233 c->dstFormat = AV_PIX_FMT_YUVA444P16;233 c->opts.dst_format = AV_PIX_FMT_YUVA444P16;
234 byte_size = 2;234 byte_size = 2;
235 dstW = input_sizes[isi];235 dstW = input_sizes[isi];
236 236
@@ -300,8 +300,8 @@ static void check_input_planar_rgb_to_uv(void) · 63 unmodified lines
300 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {300 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
301 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {301 for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
302 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);302 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
303 c->srcFormat = planar_fmts[fmi];303 c->opts.src_format = planar_fmts[fmi];
304 c->dstFormat = AV_PIX_FMT_YUVA444P16;304 c->opts.dst_format = AV_PIX_FMT_YUVA444P16;
305 byte_size = 2;305 byte_size = 2;
306 dstW = input_sizes[isi];306 dstW = input_sizes[isi];
307 307
@@ -373,8 +373,8 @@ static void check_input_planar_rgb_to_a(void) · 65 unmodified lines
373 if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA))373 if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA))
374 continue;374 continue;
375 375
376 c->srcFormat = planar_fmts[fmi];376 c->opts.src_format = planar_fmts[fmi];
377 c->dstFormat = AV_PIX_FMT_YUVA444P16;377 c->opts.dst_format = AV_PIX_FMT_YUVA444P16;
378 byte_size = 2;378 byte_size = 2;
379 dstW = input_sizes[isi];379 dstW = input_sizes[isi];
380 380
tests/checkasm/sw_range_convert.c+8−8
@@ -73,16 +73,16 @@ static void check_lumConvertRange(int from) · 72 unmodified lines
73 fail();73 fail();
74 74
75 c = sws_internal(sws);75 c = sws_internal(sws);
76 c->srcRange = from;76 c->opts.src_range = from;
77 c->dstRange = !from;77 c->opts.dst_range = !from;
78 78
79 for (int pfi = 0; pfi < FF_ARRAY_ELEMS(pixel_formats); pfi++) {79 for (int pfi = 0; pfi < FF_ARRAY_ELEMS(pixel_formats); pfi++) {
80 enum AVPixelFormat pix_fmt = pixel_formats[pfi];80 enum AVPixelFormat pix_fmt = pixel_formats[pfi];
81 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);81 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
82 int bit_depth = desc->comp[0].depth;82 int bit_depth = desc->comp[0].depth;
83 int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);83 int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);
84 c->srcFormat = pix_fmt;84 c->opts.src_format = pix_fmt;
85 c->dstFormat = pix_fmt;85 c->opts.dst_format = pix_fmt;
86 c->dstBpc = bit_depth;86 c->dstBpc = bit_depth;
87 ff_sws_init_scale(c);87 ff_sws_init_scale(c);
88 for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {88 for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {
@@ -123,16 +123,16 @@ static void check_chrConvertRange(int from) · 34 unmodified lines
123 fail();123 fail();
124 124
125 c = sws_internal(sws);125 c = sws_internal(sws);
126 c->srcRange = from;126 c->opts.src_range = from;
127 c->dstRange = !from;127 c->opts.dst_range = !from;
128 128
129 for (int pfi = 0; pfi < FF_ARRAY_ELEMS(pixel_formats); pfi++) {129 for (int pfi = 0; pfi < FF_ARRAY_ELEMS(pixel_formats); pfi++) {
130 enum AVPixelFormat pix_fmt = pixel_formats[pfi];130 enum AVPixelFormat pix_fmt = pixel_formats[pfi];
131 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);131 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
132 int bit_depth = desc->comp[0].depth;132 int bit_depth = desc->comp[0].depth;
133 int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);133 int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);
134 c->srcFormat = pix_fmt;134 c->opts.src_format = pix_fmt;
135 c->dstFormat = pix_fmt;135 c->opts.dst_format = pix_fmt;
136 c->dstBpc = bit_depth;136 c->dstBpc = bit_depth;
137 ff_sws_init_scale(c);137 ff_sws_init_scale(c);
138 for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {138 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
370 for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {370 for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {
371 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]);371 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]);
372 372
373 ctx->srcFormat = rgb_formats[i];373 ctx->opts.src_format = rgb_formats[i];
374 ff_sws_init_scale(ctx);374 ff_sws_init_scale(ctx);
375 375
376 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {376 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
389 389
390 if (desc->nb_components == 3 ||390 if (desc->nb_components == 3 ||
391 // only bench native endian formats391 // 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))
393 bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);393 bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
394 }394 }
395 }395 }
@@ -417,8 +417,8 @@ static void check_rgb_to_uv(SwsInternal *ctx) · 21 unmodified lines
417 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt);417 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt);
418 418
419 ctx->chrSrcHSubSample = (i % 2) ? 0 : 1;419 ctx->chrSrcHSubSample = (i % 2) ? 0 : 1;
420 ctx->srcFormat = src_fmt;420 ctx->opts.src_format = src_fmt;
421 ctx->dstFormat = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;421 ctx->opts.dst_format = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;
422 ff_sws_init_scale(ctx);422 ff_sws_init_scale(ctx);
423 423
424 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {424 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
441 441
442 if (desc->nb_components == 3 ||442 if (desc->nb_components == 3 ||
443 // only bench native endian formats443 // 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))
445 bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);445 bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
446 }446 }
447 }447 }
tests/checkasm/sw_scale.c+9−9
@@ -125,7 +125,7 @@ static void check_yuv2yuv1(int accurate) · 124 unmodified lines
125 sws = sws_alloc_context();125 sws = sws_alloc_context();
126 c = sws_internal(sws);126 c = sws_internal(sws);
127 if (accurate)127 if (accurate)
128 c->flags |= SWS_ACCURATE_RND;128 c->opts.flags |= SWS_ACCURATE_RND;
129 if (sws_init_context(sws, NULL, NULL) < 0)129 if (sws_init_context(sws, NULL, NULL) < 0)
130 fail();130 fail();
131 131
@@ -192,7 +192,7 @@ static void check_yuv2yuvX(int accurate) · 60 unmodified lines
192 sws = sws_alloc_context();192 sws = sws_alloc_context();
193 c = sws_internal(sws);193 c = sws_internal(sws);
194 if (accurate)194 if (accurate)
195 c->flags |= SWS_ACCURATE_RND;195 c->opts.flags |= SWS_ACCURATE_RND;
196 if (sws_init_context(sws, NULL, NULL) < 0)196 if (sws_init_context(sws, NULL, NULL) < 0)
197 fail();197 fail();
198 198
@@ -341,20 +341,20 @@ static void check_hscale(void) · 142 unmodified lines
341 341
342 filter[SRC_PIXELS * width + i] = rnd();342 filter[SRC_PIXELS * width + i] = rnd();
343 }343 }
344 c->dstW = c->chrDstW = input_sizes[dstWi];344 c->opts.dst_w = c->chrDstW = input_sizes[dstWi];
345 ff_sws_init_scale(c);345 ff_sws_init_scale(c);
346 memcpy(filterAvx2, filter, sizeof(uint16_t) * (SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH));346 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);
348 348
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)) {
350 memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));350 memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));
351 memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0]));351 memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0]));
352 352
353 call_ref(NULL, dst0, c->dstW, src, filter, filterPos, width);353 call_ref(NULL, dst0, c->opts.dst_w, src, filter, filterPos, width);
354 call_new(NULL, dst1, c->dstW, src, filterAvx2, filterPosAvx, width);354 call_new(NULL, dst1, c->opts.dst_w, src, filterAvx2, filterPosAvx, width);
355 if (memcmp(dst0, dst1, c->dstW * sizeof(dst0[0])))355 if (memcmp(dst0, dst1, c->opts.dst_w * sizeof(dst0[0])))
356 fail();356 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);
358 }358 }
359 }359 }
360 }360 }

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