MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / sws_init_context

Function sws_init_context

libswscale/utils.c:1897–1930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1895}
1896
1897av_cold int sws_init_context(SwsContext *sws, SwsFilter *srcFilter,
1898 SwsFilter *dstFilter)
1899{
1900 SwsInternal *c = sws_internal(sws);
1901 static AVOnce rgb2rgb_once = AV_ONCE_INIT;
1902 enum AVPixelFormat src_format, dst_format;
1903 int ret;
1904
1905 c->is_legacy_init = 1;
1906 c->frame_src = av_frame_alloc();
1907 c->frame_dst = av_frame_alloc();
1908 if (!c->frame_src || !c->frame_dst)
1909 return AVERROR(ENOMEM);
1910
1911 if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0)
1912 return AVERROR_UNKNOWN;
1913
1914 src_format = sws->src_format;
1915 dst_format = sws->dst_format;
1916 sws->src_range |= handle_jpeg(&sws->src_format);
1917 sws->dst_range |= handle_jpeg(&sws->dst_format);
1918
1919 if (src_format != sws->src_format || dst_format != sws->dst_format)
1920 av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");
1921
1922 if (sws->threads != 1) {
1923 ret = context_init_threaded(sws, srcFilter, dstFilter);
1924 if (ret < 0 || sws->threads > 1)
1925 return ret;
1926 // threading disabled in this build, init as single-threaded
1927 }
1928
1929 return ff_sws_init_single_context(sws, srcFilter, dstFilter);
1930}
1931
1932SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
1933 int dstW, int dstH, enum AVPixelFormat dstFormat,

Callers 15

LLVMFuzzerTestOneInputFunction · 0.85
sws_setColorspaceDetailsFunction · 0.85
sws_getContextFunction · 0.85
sws_getCachedContextFunction · 0.85
add_legacy_sws_passFunction · 0.85
scale_legacyFunction · 0.85
draw_qrcodeFunction · 0.85
output_single_frameFunction · 0.85
check_lumConvertRangeFunction · 0.85
check_chrConvertRangeFunction · 0.85
check_output_yuv2gbrpFunction · 0.85

Calls 7

sws_internalFunction · 0.85
av_frame_allocFunction · 0.85
ff_thread_onceFunction · 0.85
handle_jpegFunction · 0.85
av_logFunction · 0.85
context_init_threadedFunction · 0.85

Tested by 1

scale_legacyFunction · 0.68