You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
libswscale: Make sws_init_context thread safe.
Call ff_sws_rgb2rgb_init via ff_thread_once instead of checking one of the variables it updates. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
de8e6e67e7
commit
da0abbbb01
@@ -49,6 +49,7 @@
|
|||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
|
#include "libavutil/thread.h"
|
||||||
#include "libavutil/aarch64/cpu.h"
|
#include "libavutil/aarch64/cpu.h"
|
||||||
#include "libavutil/ppc/cpu.h"
|
#include "libavutil/ppc/cpu.h"
|
||||||
#include "libavutil/x86/asm.h"
|
#include "libavutil/x86/asm.h"
|
||||||
@@ -1189,12 +1190,13 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
enum AVPixelFormat tmpFmt;
|
enum AVPixelFormat tmpFmt;
|
||||||
static const float float_mult = 1.0f / 255.0f;
|
static const float float_mult = 1.0f / 255.0f;
|
||||||
|
static AVOnce rgb2rgb_once = AV_ONCE_INIT;
|
||||||
|
|
||||||
cpu_flags = av_get_cpu_flags();
|
cpu_flags = av_get_cpu_flags();
|
||||||
flags = c->flags;
|
flags = c->flags;
|
||||||
emms_c();
|
emms_c();
|
||||||
if (!rgb15to16)
|
if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0)
|
||||||
ff_sws_rgb2rgb_init();
|
return AVERROR_UNKNOWN;
|
||||||
|
|
||||||
unscaled = (srcW == dstW && srcH == dstH);
|
unscaled = (srcW == dstW && srcH == dstH);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user