aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-21 00:03:01 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-24 20:59:03 +0100
commitb2d1a258162a619187bbb0a72f7e8eb94f91cfa4 (patch)
tree42d66479e8cfb0a2e8ba0393b5b57c5fa1292857 /libswscale
parentff39dcb129806477e9a05c30dfdefb96f7fb0a25 (diff)
downloadffmpeg-b2d1a258162a619187bbb0a72f7e8eb94f91cfa4.tar.gz
swscale/utils: Derive range from YUVJ-pix-fmt only once
Currently, it is done once per slice-thread, leading to one warning per slice-thread in case a YUVJ pixel format has been originally used. This also fixes the anomaly that said parameter are only updated for the user-facing context (whose values are retrievable via av_opt_get()) if slice-threading is not in use. Fixes ticket #9860. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/utils.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index cdd89e4b58..5a728afd89 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1277,8 +1277,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
int dstH = c->dstH;
int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 66, 16);
int flags, cpu_flags;
- enum AVPixelFormat srcFormat = c->srcFormat;
- enum AVPixelFormat dstFormat = c->dstFormat;
+ enum AVPixelFormat srcFormat, dstFormat;
const AVPixFmtDescriptor *desc_src;
const AVPixFmtDescriptor *desc_dst;
int ret = 0;
@@ -1291,12 +1290,6 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
unscaled = (srcW == dstW && srcH == dstH);
- c->srcRange |= handle_jpeg(&c->srcFormat);
- c->dstRange |= handle_jpeg(&c->dstFormat);
-
- if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat)
- av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");
-
if (!c->contrast && !c->saturation && !c->dstFormatBpp)
sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange,
ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],
@@ -2034,6 +2027,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
SwsFilter *dstFilter)
{
static AVOnce rgb2rgb_once = AV_ONCE_INIT;
+ enum AVPixelFormat src_format, dst_format;
int ret;
c->frame_src = av_frame_alloc();
@@ -2044,6 +2038,14 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0)
return AVERROR_UNKNOWN;
+ src_format = c->srcFormat;
+ dst_format = c->dstFormat;
+ c->srcRange |= handle_jpeg(&c->srcFormat);
+ c->dstRange |= handle_jpeg(&c->dstFormat);
+
+ if (src_format != c->srcFormat || dst_format != c->dstFormat)
+ av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");
+
if (c->nb_threads != 1) {
ret = context_init_threaded(c, srcFilter, dstFilter);
if (ret < 0 || c->nb_threads > 1)