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