From patchwork Sun Oct 20 20:05:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 52418 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:143:b0:48e:c0f8:d0de with SMTP id h3csp2246468vqi; Sun, 20 Oct 2024 13:34:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXTRaHLk3Nb/vFqCyxAmSFDDUud6tjJqExA/gQcfETeb4U/N9aOUbN4KF/8FcHLfwAD5hC2u85gcYOqtVDKHhJI@gmail.com X-Google-Smtp-Source: AGHT+IHvS9t3ZVHNLg6ukgqa60lAX0rmUJRv5v9za269luHIaZLxRs2xkzchhbowCU2gy77SAiuD X-Received: by 2002:a05:651c:888:b0:2fa:ce18:9e4 with SMTP id 38308e7fff4ca-2fb82ea1d2fmr13879841fa.6.1729456444345; Sun, 20 Oct 2024 13:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729456444; cv=none; d=google.com; s=arc-20240605; b=RGGYA3v4Jw7/ou77WE6zsiUyQpyuRTZcQynDyI55S+/i2GuI0qrbAsuI6t8MjpQqi6 t6eSYiJacXrdsPyBN9WUtom9Ha9zAWLx/TLMjoS4TvLTdrUYpeqxTjOPS/h5hIW/Zo8o lHMdMotgRhr24dW/TceXVwSds9sKu2etFR60JEBH3Wz7xKKVq/OsGz26Nh/HHOQ842/R mhfwuQ2NyMPWYXy/c0T5UGFIko2Ty7JzWjF3uHjk9AIUPfNntC4UJaMnGrh/gHKYuCAd +afO11B9ON4RxYAd6mkyM0w5Tcaneu7DItmvxiJiBJZhXPCKqRxSV3X8inOqOqrpkIHw xTEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=P1Xr+NZVxFnxJ4mdVec1Fd2M92BYqhgLNjawRcTUzYQ=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=jVL898BC1QIRSSwSOCnrkdnu5j5rSdXdUc6lLPScpVjF23l2hFsHDEZzx0gJHJumHe aC7978h6UYggPZp9RiM222s+0WWOulXFlDw9/Lhiq+E4/ifPSmWXGKNqzkPx1+ot2LUr EmlIk5e8GRDOghbNarHJXLbztU83BKFRMat76xcW7TUoMc9Blfd0krN0MoraYnZp3LvN oW71llxJJhLz4WpMGfsx5FlksZF9CBWqjhlmqP9LgaHRPCBQLczcGK6tWPwmsVfE0U5E lUOQjDx9a3aE/HomQkuMOT8J29UWov+9Wu+4JzSOm4rpBYsS4mR6e7N/zvJHo3xpiXEx Yeew==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=fXGyxpZi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2fb9adc260bsi5304261fa.94.2024.10.20.13.34.03; Sun, 20 Oct 2024 13:34:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=fXGyxpZi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A98868DB94; Sun, 20 Oct 2024 23:09:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0263D68D9E8 for ; Sun, 20 Oct 2024 23:08:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1729454934; bh=hgh7WOBihCHeZ4GtCiQKvXcVn3sxgECYGk7lYL2lxHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXGyxpZifE9jFyz3NEvcdNzlWcpXnXC5qCG4S2mzI+LdoS7xVEoZmYW9bsvqX8SvZ kp5lCWLhe9NUvxUehqB+2L6tLIxrVOwR8A3p7QaTPwPKIrxP5BdmNp5CEt3zWjzjvd vxWrH9gyF+pZwXYlUjEnwgGLojTs2lj0nXxyOFrc= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 8F6B144608; Sun, 20 Oct 2024 22:08:54 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Oct 2024 22:05:11 +0200 Message-ID: <20241020200851.1414766-3-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241020200851.1414766-1-ffmpeg@haasn.xyz> References: <20241020200851.1414766-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 02/18] swscale: rename SwsContext to SwsInternal X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5rDGG4SPKY4n From: Niklas Haas And preserve the public SwsContext as separate name. The motivation here is that I want to turn SwsContext into a public struct, while keeping the internal implementation hidden. Additionally, I also want to be able to use multiple internal implementations, e.g. for GPU devices. This commit does not include any functional changes. For the most part, it is a simple rename. The only complications arise from the public facing API functions, which preserve their current type (and hence require an additional unwrapping step internally), and the checkasm test framework, which directly accesses SwsInternal. For consistency, the affected functions that need to maintain a distionction have generally been changed to refer to the SwsContext as *sws, and the SwsInternal as *c. In an upcoming commit, I will provide a backing definition for the public SwsContext, and update `sws_internal()` to dereference the internal struct instead of merely casting it. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/aarch64/hscale.S | 10 +- libswscale/aarch64/swscale.c | 18 +-- libswscale/aarch64/swscale_unscaled.c | 14 +- libswscale/alphablend.c | 2 +- libswscale/arm/swscale.c | 4 +- libswscale/arm/swscale_unscaled.c | 14 +- libswscale/gamma.c | 3 +- libswscale/hscale.c | 10 +- libswscale/hscale_fast_bilinear.c | 4 +- libswscale/input.c | 2 +- libswscale/loongarch/input_lasx.c | 2 +- libswscale/loongarch/input_lsx.c | 2 +- libswscale/loongarch/output_lasx.c | 22 +-- libswscale/loongarch/output_lsx.c | 22 +-- libswscale/loongarch/swscale.S | 8 +- libswscale/loongarch/swscale_init_loongarch.c | 6 +- libswscale/loongarch/swscale_lasx.c | 8 +- libswscale/loongarch/swscale_loongarch.h | 52 +++---- libswscale/loongarch/swscale_lsx.c | 4 +- libswscale/loongarch/yuv2rgb_lasx.c | 4 +- libswscale/loongarch/yuv2rgb_lsx.c | 4 +- libswscale/options.c | 2 +- libswscale/output.c | 108 +++++++-------- libswscale/ppc/swscale_altivec.c | 2 +- libswscale/ppc/swscale_ppc_template.c | 2 +- libswscale/ppc/swscale_vsx.c | 38 +++--- libswscale/ppc/yuv2rgb_altivec.c | 14 +- libswscale/ppc/yuv2rgb_altivec.h | 2 +- libswscale/ppc/yuv2yuv_altivec.c | 6 +- libswscale/riscv/swscale.c | 4 +- libswscale/slice.c | 6 +- libswscale/swscale.c | 104 ++++++++------ libswscale/swscale_internal.h | 128 ++++++++--------- libswscale/swscale_unscaled.c | 72 +++++----- libswscale/tests/floatimg_cmp.c | 2 +- libswscale/tests/swscale.c | 6 +- libswscale/utils.c | 129 ++++++++++-------- libswscale/vscale.c | 14 +- libswscale/x86/hscale_fast_bilinear_simd.c | 4 +- libswscale/x86/output.asm | 18 +-- libswscale/x86/scale.asm | 2 +- libswscale/x86/scale_avx2.asm | 2 +- libswscale/x86/swscale.c | 14 +- libswscale/x86/swscale_template.c | 44 +++--- libswscale/x86/w64xmmtest.c | 2 +- libswscale/x86/yuv2rgb.c | 20 +-- libswscale/yuv2rgb.c | 6 +- tests/checkasm/sw_gbrp.c | 80 ++++++----- tests/checkasm/sw_range_convert.c | 44 +++--- tests/checkasm/sw_rgb.c | 22 +-- tests/checkasm/sw_scale.c | 66 +++++---- tests/checkasm/sw_yuv2rgb.c | 20 +-- tests/checkasm/sw_yuv2yuv.c | 20 +-- 53 files changed, 635 insertions(+), 583 deletions(-) diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S index b3873fc4b7..435460c1af 100644 --- a/libswscale/aarch64/hscale.S +++ b/libswscale/aarch64/hscale.S @@ -27,7 +27,7 @@ ; horizontal line scaling ; ; void hscaleto__ -; (SwsContext *c, int{16,32}_t *dst, +; (SwsInternal *c, int{16,32}_t *dst, ; int dstW, const uint{8,16}_t *src, ; const int16_t *filter, ; const int32_t *filterPos, int filterSize); @@ -92,7 +92,7 @@ function ff_hscale8to15_X8_neon, export=1 endfunc function ff_hscale8to15_X4_neon, export=1 -// x0 SwsContext *c (not used) +// x0 SwsInternal *c (not used) // x1 int16_t *dst // w2 int dstW // x3 const uint8_t *src @@ -199,7 +199,7 @@ function ff_hscale8to15_X4_neon, export=1 endfunc function ff_hscale8to15_4_neon, export=1 -// x0 SwsContext *c (not used) +// x0 SwsInternal *c (not used) // x1 int16_t *dst // x2 int dstW // x3 const uint8_t *src @@ -349,7 +349,7 @@ function ff_hscale8to15_4_neon, export=1 endfunc function ff_hscale8to19_4_neon, export=1 - // x0 SwsContext *c (unused) + // x0 SwsInternal *c (unused) // x1 int32_t *dst // w2 int dstW // x3 const uint8_t *src // treat it as uint16_t *src @@ -542,7 +542,7 @@ function ff_hscale8to19_X8_neon, export=1 endfunc function ff_hscale8to19_X4_neon, export=1 - // x0 SwsContext *c (not used) + // x0 SwsInternal *c (not used) // x1 int16_t *dst // w2 int dstW // x3 const uint8_t *src diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c index eb907284e7..4c31b78ed8 100644 --- a/libswscale/aarch64/swscale.c +++ b/libswscale/aarch64/swscale.c @@ -41,7 +41,7 @@ void ff_hscale16to19_X4_neon_asm(int shift, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize); -static void ff_hscale16to15_4_neon(SwsContext *c, int16_t *_dst, int dstW, +static void ff_hscale16to15_4_neon(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -57,7 +57,7 @@ static void ff_hscale16to15_4_neon(SwsContext *c, int16_t *_dst, int dstW, } -static void ff_hscale16to15_X8_neon(SwsContext *c, int16_t *_dst, int dstW, +static void ff_hscale16to15_X8_neon(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -73,7 +73,7 @@ static void ff_hscale16to15_X8_neon(SwsContext *c, int16_t *_dst, int dstW, } -static void ff_hscale16to15_X4_neon(SwsContext *c, int16_t *_dst, int dstW, +static void ff_hscale16to15_X4_neon(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -88,7 +88,7 @@ static void ff_hscale16to15_X4_neon(SwsContext *c, int16_t *_dst, int dstW, ff_hscale16to15_X4_neon_asm(sh, _dst, dstW, _src, filter, filterPos, filterSize); } -static void ff_hscale16to19_4_neon(SwsContext *c, int16_t *_dst, int dstW, +static void ff_hscale16to19_4_neon(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -106,7 +106,7 @@ static void ff_hscale16to19_4_neon(SwsContext *c, int16_t *_dst, int dstW, } -static void ff_hscale16to19_X8_neon(SwsContext *c, int16_t *_dst, int dstW, +static void ff_hscale16to19_X8_neon(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -124,7 +124,7 @@ static void ff_hscale16to19_X8_neon(SwsContext *c, int16_t *_dst, int dstW, } -static void ff_hscale16to19_X4_neon(SwsContext *c, int16_t *_dst, int dstW, +static void ff_hscale16to19_X4_neon(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -144,7 +144,7 @@ static void ff_hscale16to19_X4_neon(SwsContext *c, int16_t *_dst, int dstW, #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ - SwsContext *c, int16_t *data, \ + SwsInternal *c, int16_t *data, \ int dstW, const uint8_t *src, \ const int16_t *filter, \ const int32_t *filterPos, int filterSize) @@ -223,7 +223,7 @@ void ff_chrRangeFromJpeg_neon(int16_t *dstU, int16_t *dstV, int width); void ff_lumRangeToJpeg_neon(int16_t *dst, int width); void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, int width); -av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c) +av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c) { if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) { if (c->dstBpc <= 14) { @@ -238,7 +238,7 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c) } } -av_cold void ff_sws_init_swscale_aarch64(SwsContext *c) +av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); diff --git a/libswscale/aarch64/swscale_unscaled.c b/libswscale/aarch64/swscale_unscaled.c index a7db4c033d..4f54120445 100644 --- a/libswscale/aarch64/swscale_unscaled.c +++ b/libswscale/aarch64/swscale_unscaled.c @@ -37,7 +37,7 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t *const dst[], \ const int dstStride[]) { \ @@ -65,7 +65,7 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, uint8_t *dst1, int linesize1, \ uint8_t *dst2, int linesize2); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t *const dst[], \ const int dstStride[]) { \ @@ -102,7 +102,7 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t *const dst[], \ const int dstStride[]) { \ @@ -127,7 +127,7 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, uint8_t *dst1, int linesize1, \ uint8_t *dst2, int linesize2); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t *const dst[], \ const int dstStride[]) { \ @@ -148,7 +148,7 @@ void ff_nv24_to_yuv420p_chroma_neon(uint8_t *dst1, int dstStride1, const uint8_t *src, int srcStride, int w, int h); -static int nv24_to_yuv420p_neon_wrapper(SwsContext *c, const uint8_t *const src[], +static int nv24_to_yuv420p_neon_wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -199,7 +199,7 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, gbrp, GBRP, accurate_rnd); \ } while (0) -static void get_unscaled_swscale_neon(SwsContext *c) { +static void get_unscaled_swscale_neon(SwsInternal *c) { int accurate_rnd = c->flags & SWS_ACCURATE_RND; SET_FF_NVX_TO_ALL_RGBX_FUNC(nv12, NV12, accurate_rnd); @@ -213,7 +213,7 @@ static void get_unscaled_swscale_neon(SwsContext *c) { c->convert_unscaled = nv24_to_yuv420p_neon_wrapper; } -void ff_get_unscaled_swscale_aarch64(SwsContext *c) +void ff_get_unscaled_swscale_aarch64(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); if (have_neon(cpu_flags)) diff --git a/libswscale/alphablend.c b/libswscale/alphablend.c index 8993a5bcd0..4ee23d3aee 100644 --- a/libswscale/alphablend.c +++ b/libswscale/alphablend.c @@ -20,7 +20,7 @@ #include "swscale_internal.h" -int ff_sws_alphablendaway(SwsContext *c, const uint8_t *const src[], +int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { diff --git a/libswscale/arm/swscale.c b/libswscale/arm/swscale.c index 5f2fd2ce49..f4a96292eb 100644 --- a/libswscale/arm/swscale.c +++ b/libswscale/arm/swscale.c @@ -22,7 +22,7 @@ #include "libswscale/swscale_internal.h" #include "libavutil/arm/cpu.h" -void ff_hscale_8_to_15_neon(SwsContext *c, int16_t *dst, int dstW, +void ff_hscale_8_to_15_neon(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); @@ -30,7 +30,7 @@ void ff_yuv2planeX_8_neon(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset); -av_cold void ff_sws_init_swscale_arm(SwsContext *c) +av_cold void ff_sws_init_swscale_arm(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index 10216aaa4c..14685dbc50 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -34,7 +34,7 @@ extern void rgbx_to_nv12_neon_16(const uint8_t *src, uint8_t *y, uint8_t *chroma int y_stride, int c_stride, int src_stride, int32_t coeff_tbl[9]); -static int rgbx_to_nv12_neon_32_wrapper(SwsContext *context, const uint8_t *const src[], +static int rgbx_to_nv12_neon_32_wrapper(SwsInternal *context, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -48,7 +48,7 @@ static int rgbx_to_nv12_neon_32_wrapper(SwsContext *context, const uint8_t *cons return 0; } -static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *const src[], +static int rgbx_to_nv12_neon_16_wrapper(SwsInternal *context, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], int dstStride[]) { @@ -78,7 +78,7 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t *const dst[], \ const int dstStride[]) { \ @@ -114,7 +114,7 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t *const dst[], \ const int dstStride[]) { \ @@ -160,7 +160,7 @@ DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, bgra, BGRA, accurate_rnd); \ } while (0) -static void get_unscaled_swscale_neon(SwsContext *c) { +static void get_unscaled_swscale_neon(SwsInternal *c) { int accurate_rnd = c->flags & SWS_ACCURATE_RND; if (c->srcFormat == AV_PIX_FMT_RGBA && c->dstFormat == AV_PIX_FMT_NV12 @@ -175,14 +175,14 @@ static void get_unscaled_swscale_neon(SwsContext *c) { SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv422p, YUV422P, accurate_rnd); } -void ff_get_unscaled_swscale_arm(SwsContext *c) +void ff_get_unscaled_swscale_arm(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); if (have_neon(cpu_flags)) get_unscaled_swscale_neon(c); } #else -void ff_get_unscaled_swscale_arm(SwsContext *c) +void ff_get_unscaled_swscale_arm(SwsInternal *c) { } #endif diff --git a/libswscale/gamma.c b/libswscale/gamma.c index 7c5534e1b7..7fb1b7763f 100644 --- a/libswscale/gamma.c +++ b/libswscale/gamma.c @@ -28,7 +28,7 @@ typedef struct GammaContext // gamma_convert expects 16 bit rgb format // it writes directly in src slice thus it must be modifiable (done through cascade context) -static int gamma_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int gamma_convert(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { GammaContext *instance = desc->instance; uint16_t *table = instance->table; @@ -70,4 +70,3 @@ int ff_init_gamma_convert(SwsFilterDescriptor *desc, SwsSlice * src, uint16_t *t return 0; } - diff --git a/libswscale/hscale.c b/libswscale/hscale.c index 5a949732bf..6cf910bf6e 100644 --- a/libswscale/hscale.c +++ b/libswscale/hscale.c @@ -36,7 +36,7 @@ typedef struct ColorContext uint32_t *pal; } ColorContext; -static int lum_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int lum_h_scale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { FilterContext *instance = desc->instance; int srcW = desc->src->width; @@ -84,7 +84,7 @@ static int lum_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int return sliceH; } -static int lum_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int lum_convert(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { int srcW = desc->src->width; ColorContext * instance = desc->instance; @@ -164,7 +164,7 @@ int ff_init_desc_hscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, return 0; } -static int chr_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int chr_h_scale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { FilterContext *instance = desc->instance; int srcW = AV_CEIL_RSHIFT(desc->src->width, desc->src->h_chr_sub_sample); @@ -200,7 +200,7 @@ static int chr_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int return sliceH; } -static int chr_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int chr_convert(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { int srcW = AV_CEIL_RSHIFT(desc->src->width, desc->src->h_chr_sub_sample); ColorContext * instance = desc->instance; @@ -270,7 +270,7 @@ int ff_init_desc_chscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst return 0; } -static int no_chr_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int no_chr_scale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { desc->dst->plane[1].sliceY = sliceY + sliceH - desc->dst->plane[1].available_lines; desc->dst->plane[1].sliceH = desc->dst->plane[1].available_lines; diff --git a/libswscale/hscale_fast_bilinear.c b/libswscale/hscale_fast_bilinear.c index 82d6177bde..abcfb95e2c 100644 --- a/libswscale/hscale_fast_bilinear.c +++ b/libswscale/hscale_fast_bilinear.c @@ -20,7 +20,7 @@ #include "swscale_internal.h" -void ff_hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, +void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc) { int i; @@ -35,7 +35,7 @@ void ff_hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, dst[i] = src[srcW-1]*128; } -void ff_hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, +void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc) { diff --git a/libswscale/input.c b/libswscale/input.c index bb5e31a428..a733ef35f8 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1538,7 +1538,7 @@ static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const rgbaf16_funcs_endian(le, 0) rgbaf16_funcs_endian(be, 1) -av_cold void ff_sws_init_input_funcs(SwsContext *c, +av_cold void ff_sws_init_input_funcs(SwsInternal *c, planar1_YV12_fn *lumToYV12, planar1_YV12_fn *alpToYV12, planar2_YV12_fn *chrToYV12, diff --git a/libswscale/loongarch/input_lasx.c b/libswscale/loongarch/input_lasx.c index 0f1d954880..b682179c6e 100644 --- a/libswscale/loongarch/input_lasx.c +++ b/libswscale/loongarch/input_lasx.c @@ -201,7 +201,7 @@ void planar_rgb_to_y_lasx(uint8_t *_dst, const uint8_t *src[4], int width, } } -av_cold void ff_sws_init_input_lasx(SwsContext *c) +av_cold void ff_sws_init_input_lasx(SwsInternal *c) { enum AVPixelFormat srcFormat = c->srcFormat; diff --git a/libswscale/loongarch/input_lsx.c b/libswscale/loongarch/input_lsx.c index 1bb04457bb..2bc7577961 100644 --- a/libswscale/loongarch/input_lsx.c +++ b/libswscale/loongarch/input_lsx.c @@ -21,7 +21,7 @@ #include "swscale_loongarch.h" -av_cold void ff_sws_init_input_lsx(SwsContext *c) +av_cold void ff_sws_init_input_lsx(SwsInternal *c) { enum AVPixelFormat srcFormat = c->srcFormat; diff --git a/libswscale/loongarch/output_lasx.c b/libswscale/loongarch/output_lasx.c index bc8ab8cf36..4e5ad3d802 100644 --- a/libswscale/loongarch/output_lasx.c +++ b/libswscale/loongarch/output_lasx.c @@ -227,7 +227,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, } static void -yuv2rgb_X_template_lasx(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_X_template_lasx(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -515,7 +515,7 @@ yuv2rgb_X_template_lasx(SwsContext *c, const int16_t *lumFilter, } static void -yuv2rgb_2_template_lasx(SwsContext *c, const int16_t *buf[2], +yuv2rgb_2_template_lasx(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -625,7 +625,7 @@ yuv2rgb_2_template_lasx(SwsContext *c, const int16_t *buf[2], } static void -yuv2rgb_1_template_lasx(SwsContext *c, const int16_t *buf0, +yuv2rgb_1_template_lasx(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -782,7 +782,7 @@ yuv2rgb_1_template_lasx(SwsContext *c, const int16_t *buf0, } #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _X_lasx(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_lasx(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -796,7 +796,7 @@ static void name ## ext ## _X_lasx(SwsContext *c, const int16_t *lumFilter, #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _2_lasx(SwsContext *c, const int16_t *buf[2], \ +static void name ## ext ## _2_lasx(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -807,7 +807,7 @@ static void name ## ext ## _2_lasx(SwsContext *c, const int16_t *buf[2], #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _1_lasx(SwsContext *c, const int16_t *buf0, \ +static void name ## ext ## _1_lasx(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -834,7 +834,7 @@ YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0) YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0) // This function is copied from libswscale/output.c -static av_always_inline void yuv2rgb_write_full(SwsContext *c, +static av_always_inline void yuv2rgb_write_full(SwsInternal *c, uint8_t *dest, int i, int R, int A, int G, int B, int y, enum AVPixelFormat target, int hasAlpha, int err[4]) { @@ -1015,7 +1015,7 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c, } static void -yuv2rgb_full_X_template_lasx(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_full_X_template_lasx(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -1222,7 +1222,7 @@ yuv2rgb_full_X_template_lasx(SwsContext *c, const int16_t *lumFilter, } static void -yuv2rgb_full_2_template_lasx(SwsContext *c, const int16_t *buf[2], +yuv2rgb_full_2_template_lasx(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -1435,7 +1435,7 @@ yuv2rgb_full_2_template_lasx(SwsContext *c, const int16_t *buf[2], } static void -yuv2rgb_full_1_template_lasx(SwsContext *c, const int16_t *buf0, +yuv2rgb_full_1_template_lasx(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1775,7 +1775,7 @@ YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0) YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) -av_cold void ff_sws_init_output_lasx(SwsContext *c, +av_cold void ff_sws_init_output_lasx(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, diff --git a/libswscale/loongarch/output_lsx.c b/libswscale/loongarch/output_lsx.c index de9b1534ee..29fe30758a 100644 --- a/libswscale/loongarch/output_lsx.c +++ b/libswscale/loongarch/output_lsx.c @@ -148,7 +148,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, } static void -yuv2rgb_X_template_lsx(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_X_template_lsx(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -476,7 +476,7 @@ yuv2rgb_X_template_lsx(SwsContext *c, const int16_t *lumFilter, } static void -yuv2rgb_2_template_lsx(SwsContext *c, const int16_t *buf[2], +yuv2rgb_2_template_lsx(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -583,7 +583,7 @@ yuv2rgb_2_template_lsx(SwsContext *c, const int16_t *buf[2], } static void -yuv2rgb_1_template_lsx(SwsContext *c, const int16_t *buf0, +yuv2rgb_1_template_lsx(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -733,7 +733,7 @@ yuv2rgb_1_template_lsx(SwsContext *c, const int16_t *buf0, } #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _X_lsx(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_lsx(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -747,7 +747,7 @@ static void name ## ext ## _X_lsx(SwsContext *c, const int16_t *lumFilter, #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _2_lsx(SwsContext *c, const int16_t *buf[2], \ +static void name ## ext ## _2_lsx(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -758,7 +758,7 @@ static void name ## ext ## _2_lsx(SwsContext *c, const int16_t *buf[2], #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _1_lsx(SwsContext *c, const int16_t *buf0, \ +static void name ## ext ## _1_lsx(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -784,7 +784,7 @@ YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0) YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0) // This function is copied from libswscale/output.c -static av_always_inline void yuv2rgb_write_full(SwsContext *c, +static av_always_inline void yuv2rgb_write_full(SwsInternal *c, uint8_t *dest, int i, int R, int A, int G, int B, int y, enum AVPixelFormat target, int hasAlpha, int err[4]) { @@ -964,7 +964,7 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c, } static void -yuv2rgb_full_X_template_lsx(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_full_X_template_lsx(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -1143,7 +1143,7 @@ yuv2rgb_full_X_template_lsx(SwsContext *c, const int16_t *lumFilter, } static void -yuv2rgb_full_2_template_lsx(SwsContext *c, const int16_t *buf[2], +yuv2rgb_full_2_template_lsx(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -1332,7 +1332,7 @@ yuv2rgb_full_2_template_lsx(SwsContext *c, const int16_t *buf[2], } static void -yuv2rgb_full_1_template_lsx(SwsContext *c, const int16_t *buf0, +yuv2rgb_full_1_template_lsx(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1624,7 +1624,7 @@ YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0) YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) -av_cold void ff_sws_init_output_lsx(SwsContext *c, +av_cold void ff_sws_init_output_lsx(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, diff --git a/libswscale/loongarch/swscale.S b/libswscale/loongarch/swscale.S index 67b1bc834d..a7e8513192 100644 --- a/libswscale/loongarch/swscale.S +++ b/libswscale/loongarch/swscale.S @@ -23,7 +23,7 @@ #include "libavcodec/loongarch/loongson_asm.S" -/* void ff_hscale_8_to_15_lsx(SwsContext *c, int16_t *dst, int dstW, +/* void ff_hscale_8_to_15_lsx(SwsInternal *c, int16_t *dst, int dstW, * const uint8_t *src, const int16_t *filter, * const int32_t *filterPos, int filterSize) */ @@ -470,7 +470,7 @@ function ff_hscale_8_to_15_lsx addi.d sp, sp, 72 endfunc -/* void ff_hscale_8_to_19_lsx(SwsContext *c, int16_t *dst, int dstW, +/* void ff_hscale_8_to_19_lsx(SwsInternal *c, int16_t *dst, int dstW, * const uint8_t *src, const int16_t *filter, * const int32_t *filterPos, int filterSize) */ @@ -917,7 +917,7 @@ function ff_hscale_8_to_19_lsx addi.d sp, sp, 72 endfunc -/* void ff_hscale_16_to_15_sub_lsx(SwsContext *c, int16_t *dst, int dstW, +/* void ff_hscale_16_to_15_sub_lsx(SwsInternal *c, int16_t *dst, int dstW, * const uint8_t *src, const int16_t *filter, * const int32_t *filterPos, int filterSize, int sh) */ @@ -1392,7 +1392,7 @@ function ff_hscale_16_to_15_sub_lsx addi.d sp, sp, 72 endfunc -/* void ff_hscale_16_to_19_sub_lsx(SwsContext *c, int16_t *dst, int dstW, +/* void ff_hscale_16_to_19_sub_lsx(SwsInternal *c, int16_t *dst, int dstW, * const uint8_t *src, const int16_t *filter, * const int32_t *filterPos, int filterSize, int sh) */ diff --git a/libswscale/loongarch/swscale_init_loongarch.c b/libswscale/loongarch/swscale_init_loongarch.c index 2a95ede6d9..7cc92be216 100644 --- a/libswscale/loongarch/swscale_init_loongarch.c +++ b/libswscale/loongarch/swscale_init_loongarch.c @@ -24,7 +24,7 @@ #include "libswscale/rgb2rgb.h" #include "libavutil/loongarch/cpu.h" -av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c) +av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); @@ -58,7 +58,7 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c) #endif // #if HAVE_LASX } -av_cold void ff_sws_init_swscale_loongarch(SwsContext *c) +av_cold void ff_sws_init_swscale_loongarch(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); if (have_lsx(cpu_flags)) { @@ -107,7 +107,7 @@ av_cold void rgb2rgb_init_loongarch(void) #endif // #if HAVE_LASX } -av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsContext *c) +av_cold SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); #if HAVE_LASX diff --git a/libswscale/loongarch/swscale_lasx.c b/libswscale/loongarch/swscale_lasx.c index 3e0bae2cc2..79fa4c64b0 100644 --- a/libswscale/loongarch/swscale_lasx.c +++ b/libswscale/loongarch/swscale_lasx.c @@ -311,7 +311,7 @@ out = __lasx_xvadd_w(out, out0); \ } -void ff_hscale_8_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, +void ff_hscale_8_to_15_lasx(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -471,7 +471,7 @@ void ff_hscale_8_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, } } -void ff_hscale_8_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_8_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -673,7 +673,7 @@ void ff_hscale_8_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, out = __lasx_xvadd_w(out, out0); \ } -void ff_hscale_16_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, +void ff_hscale_16_to_15_lasx(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -820,7 +820,7 @@ void ff_hscale_16_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, } } -void ff_hscale_16_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { diff --git a/libswscale/loongarch/swscale_loongarch.h b/libswscale/loongarch/swscale_loongarch.h index a8f2a3214f..15aa983f20 100644 --- a/libswscale/loongarch/swscale_loongarch.h +++ b/libswscale/loongarch/swscale_loongarch.h @@ -26,27 +26,27 @@ #include "libswscale/swscale_internal.h" #include "config.h" -void ff_hscale_8_to_15_lsx(SwsContext *c, int16_t *dst, int dstW, +void ff_hscale_8_to_15_lsx(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_8_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_8_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_16_to_15_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_15_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_16_to_15_sub_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_15_sub_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize, int sh); -void ff_hscale_16_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_16_to_19_sub_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_19_sub_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize, int sh); @@ -89,9 +89,9 @@ void abgrToA_lsx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, void rgbaToA_lsx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq); -av_cold void ff_sws_init_input_lsx(SwsContext *c); +av_cold void ff_sws_init_input_lsx(SwsInternal *c); -av_cold void ff_sws_init_output_lsx(SwsContext *c, +av_cold void ff_sws_init_output_lsx(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, @@ -100,38 +100,38 @@ av_cold void ff_sws_init_output_lsx(SwsContext *c, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX); -int yuv420_rgb24_lsx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_rgb24_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_bgr24_lsx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_bgr24_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_rgba32_lsx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_rgba32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_bgra32_lsx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_bgra32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_argb32_lsx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_argb32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_abgr32_lsx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_abgr32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); #if HAVE_LASX -void ff_hscale_8_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, +void ff_hscale_8_to_15_lasx(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_8_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_8_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_16_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_19_lasx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize); -void ff_hscale_16_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, +void ff_hscale_16_to_15_lasx(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize); @@ -146,22 +146,22 @@ void planar_rgb_to_uv_lasx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4] void planar_rgb_to_y_lasx(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq); -int yuv420_rgb24_lasx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_rgb24_lasx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_bgr24_lasx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_bgr24_lasx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_rgba32_lasx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_rgba32_lasx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_bgra32_lasx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_bgra32_lasx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_argb32_lasx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_argb32_lasx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); -int yuv420_abgr32_lasx(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int yuv420_abgr32_lasx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); void ff_interleave_bytes_lasx(const uint8_t *src1, const uint8_t *src2, @@ -196,9 +196,9 @@ void abgrToA_lasx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, void rgbaToA_lasx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq); -av_cold void ff_sws_init_input_lasx(SwsContext *c); +av_cold void ff_sws_init_input_lasx(SwsInternal *c); -av_cold void ff_sws_init_output_lasx(SwsContext *c, +av_cold void ff_sws_init_output_lasx(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, diff --git a/libswscale/loongarch/swscale_lsx.c b/libswscale/loongarch/swscale_lsx.c index da8eabfca3..dbdaf18de6 100644 --- a/libswscale/loongarch/swscale_lsx.c +++ b/libswscale/loongarch/swscale_lsx.c @@ -23,7 +23,7 @@ #include "swscale_loongarch.h" -void ff_hscale_16_to_15_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_15_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -39,7 +39,7 @@ void ff_hscale_16_to_15_lsx(SwsContext *c, int16_t *_dst, int dstW, ff_hscale_16_to_15_sub_lsx(c, _dst, dstW, _src, filter, filterPos, filterSize, sh); } -void ff_hscale_16_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW, +void ff_hscale_16_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { diff --git a/libswscale/loongarch/yuv2rgb_lasx.c b/libswscale/loongarch/yuv2rgb_lasx.c index 8bf6a7955a..1b36d617b5 100644 --- a/libswscale/loongarch/yuv2rgb_lasx.c +++ b/libswscale/loongarch/yuv2rgb_lasx.c @@ -160,7 +160,7 @@ } #define YUV2RGBFUNC(func_name, dst_type, alpha) \ - int func_name(SwsContext *c, const uint8_t *const src[], \ + int func_name(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *const dst[], const int dstStride[]) \ { \ @@ -188,7 +188,7 @@ for(x = 0; x < h_size; x++) { \ #define YUV2RGBFUNC32(func_name, dst_type, alpha) \ - int func_name(SwsContext *c, const uint8_t *const src[], \ + int func_name(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *const dst[], const int dstStride[]) \ { \ diff --git a/libswscale/loongarch/yuv2rgb_lsx.c b/libswscale/loongarch/yuv2rgb_lsx.c index 31f22a764f..f2f424265f 100644 --- a/libswscale/loongarch/yuv2rgb_lsx.c +++ b/libswscale/loongarch/yuv2rgb_lsx.c @@ -113,7 +113,7 @@ } #define YUV2RGBFUNC(func_name, dst_type, alpha) \ - int func_name(SwsContext *c, const uint8_t *const src[], \ + int func_name(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *const dst[], const int dstStride[]) \ { \ @@ -142,7 +142,7 @@ for(x = 0; x < h_size; x++) { \ #define YUV2RGBFUNC32(func_name, dst_type, alpha) \ - int func_name(SwsContext *c, const uint8_t *const src[], \ + int func_name(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *const dst[], const int dstStride[]) \ { \ diff --git a/libswscale/options.c b/libswscale/options.c index 6337a9f28d..56b1d2235d 100644 --- a/libswscale/options.c +++ b/libswscale/options.c @@ -27,7 +27,7 @@ static const char *sws_context_to_name(void *ptr) return "swscaler"; } -#define OFFSET(x) offsetof(SwsContext, x) +#define OFFSET(x) offsetof(SwsInternal, x) #define DEFAULT 0 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM diff --git a/libswscale/output.c b/libswscale/output.c index c95ccdfc36..56f16dfd34 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -597,7 +597,7 @@ yuv2p01x_wrapper(12) } static av_always_inline void -yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2mono_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -650,7 +650,7 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], +yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -711,7 +711,7 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], } static av_always_inline void -yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0, +yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target) @@ -762,7 +762,7 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0, #undef accumulate_bit #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \ -static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -774,7 +774,7 @@ static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ alpSrc, dest, dstW, y, fmt); \ } \ \ -static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \ +static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -783,7 +783,7 @@ static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \ dest, dstW, yalpha, uvalpha, y, fmt); \ } \ \ -static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \ +static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -815,7 +815,7 @@ YUV2PACKEDWRAPPER(yuv2mono,, black, AV_PIX_FMT_MONOBLACK) } static av_always_inline void -yuv2422_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2422_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -854,7 +854,7 @@ yuv2422_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2], +yuv2422_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -887,7 +887,7 @@ yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2], } static av_always_inline void -yuv2422_1_c_template(SwsContext *c, const int16_t *buf0, +yuv2422_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target) @@ -947,7 +947,7 @@ YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) } static av_always_inline void -yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2ya16_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **unused_chrUSrc, const int32_t **unused_chrVSrc, int unused_chrFilterSize, @@ -986,7 +986,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2ya16_2_c_template(SwsContext *c, const int32_t *buf[2], +yuv2ya16_2_c_template(SwsInternal *c, const int32_t *buf[2], const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int unused_uvalpha, int y, @@ -1019,7 +1019,7 @@ yuv2ya16_2_c_template(SwsContext *c, const int32_t *buf[2], } static av_always_inline void -yuv2ya16_1_c_template(SwsContext *c, const int32_t *buf0, +yuv2ya16_1_c_template(SwsInternal *c, const int32_t *buf0, const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int unused_uvalpha, int y, enum AVPixelFormat target, @@ -1046,7 +1046,7 @@ yuv2ya16_1_c_template(SwsContext *c, const int32_t *buf0, } static av_always_inline void -yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2rgba64_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **chrUSrc, const int32_t **chrVSrc, int chrFilterSize, @@ -1129,7 +1129,7 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2], +yuv2rgba64_2_c_template(SwsInternal *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -1195,7 +1195,7 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2], } static av_always_inline void -yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0, +yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1299,7 +1299,7 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0, } static av_always_inline void -yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2rgba64_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int32_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int32_t **chrUSrc, const int32_t **chrVSrc, int chrFilterSize, @@ -1364,7 +1364,7 @@ yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2rgba64_full_2_c_template(SwsContext *c, const int32_t *buf[2], +yuv2rgba64_full_2_c_template(SwsInternal *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -1417,7 +1417,7 @@ yuv2rgba64_full_2_c_template(SwsContext *c, const int32_t *buf[2], } static av_always_inline void -yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0, +yuv2rgba64_full_1_c_template(SwsInternal *c, const int32_t *buf0, const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf0, uint16_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1499,7 +1499,7 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0, #undef b_r #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \ -static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **_lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **_chrUSrc, \ const int16_t **_chrVSrc, int chrFilterSize, \ @@ -1516,7 +1516,7 @@ static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \ } \ \ -static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ +static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \ const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ const int16_t *_abuf[2], uint8_t *_dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -1530,7 +1530,7 @@ static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ } \ \ -static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \ +static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \ const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ const int16_t *_abuf0, uint8_t *_dest, int dstW, \ int uvalpha, int y) \ @@ -1709,7 +1709,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, } static av_always_inline void -yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -1763,7 +1763,7 @@ yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2], +yuv2rgb_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -1803,7 +1803,7 @@ yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2], } static av_always_inline void -yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, +yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1859,7 +1859,7 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, } #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -1873,7 +1873,7 @@ static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \ +static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -1884,7 +1884,7 @@ static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \ #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \ +static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -1915,7 +1915,7 @@ YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0) YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0) YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0) -static av_always_inline void yuv2rgb_write_full(SwsContext *c, +static av_always_inline void yuv2rgb_write_full(SwsInternal *c, uint8_t *dest, int i, int Y, int A, int U, int V, int y, enum AVPixelFormat target, int hasAlpha, int err[4]) { @@ -2066,7 +2066,7 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c, } static av_always_inline void -yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -2116,7 +2116,7 @@ yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2rgb_full_2_c_template(SwsContext *c, const int16_t *buf[2], +yuv2rgb_full_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -2161,7 +2161,7 @@ yuv2rgb_full_2_c_template(SwsContext *c, const int16_t *buf[2], } static av_always_inline void -yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0, +yuv2rgb_full_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -2242,7 +2242,7 @@ YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0) YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) static void -yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -2324,7 +2324,7 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter, } static void -yuv2gbrp16_full_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrcx, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrcx, const int16_t **chrVSrcx, int chrFilterSize, @@ -2396,7 +2396,7 @@ yuv2gbrp16_full_X_c(SwsContext *c, const int16_t *lumFilter, } static void -yuv2gbrpf32_full_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrcx, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrcx, const int16_t **chrVSrcx, int chrFilterSize, @@ -2472,7 +2472,7 @@ yuv2gbrpf32_full_X_c(SwsContext *c, const int16_t *lumFilter, } static void -yuv2ya8_1_c(SwsContext *c, const int16_t *buf0, +yuv2ya8_1_c(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -2498,7 +2498,7 @@ yuv2ya8_1_c(SwsContext *c, const int16_t *buf0, } static void -yuv2ya8_2_c(SwsContext *c, const int16_t *buf[2], +yuv2ya8_2_c(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -2529,7 +2529,7 @@ yuv2ya8_2_c(SwsContext *c, const int16_t *buf[2], } static void -yuv2ya8_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2ya8_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -2572,7 +2572,7 @@ yuv2ya8_X_c(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2ayuv64_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2ayuv64_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **_lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **_chrUSrc, const int16_t **_chrVSrc, int chrFilterSize, @@ -2624,7 +2624,7 @@ yuv2ayuv64_X_c(SwsContext *c, const int16_t *lumFilter, #define YUV2AYUV64(BE_LE, is_be) \ static void \ -yuv2ayuv64 ## BE_LE ##_X_c(SwsContext *c, const int16_t *lumFilter, \ +yuv2ayuv64 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -2639,7 +2639,7 @@ YUV2AYUV64(le, 0) YUV2AYUV64(be, 1) static av_always_inline void -yuv2v30_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2v30_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -2671,7 +2671,7 @@ yuv2v30_X_c_template(SwsContext *c, const int16_t *lumFilter, } #define V30LE_WRAPPER(name, shift) \ -static void yuv2 ## name ## _X_c(SwsContext *c, const int16_t *lumFilter, \ +static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -2694,7 +2694,7 @@ V30LE_WRAPPER(v30xle, 2) } static void -yuv2xv36_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2xv36_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -2724,7 +2724,7 @@ yuv2xv36_X_c(SwsContext *c, const int16_t *lumFilter, #define YUV2XV36(BE_LE, is_be) \ static void \ -yuv2xv36 ## BE_LE ##_X_c(SwsContext *c, const int16_t *lumFilter, \ +yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -2757,7 +2757,7 @@ YUV2XV36(be, 1) } static av_always_inline void -yuv2ayuv_1_c_template(SwsContext *c, const int16_t *buf0, +yuv2ayuv_1_c_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target) @@ -2813,7 +2813,7 @@ yuv2ayuv_1_c_template(SwsContext *c, const int16_t *buf0, } static av_always_inline void -yuv2ayuv_2_c_template(SwsContext *c, const int16_t *buf[2], +yuv2ayuv_2_c_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -2855,7 +2855,7 @@ yuv2ayuv_2_c_template(SwsContext *c, const int16_t *buf[2], } static av_always_inline void -yuv2ayuv_X_c_template(SwsContext *c, const int16_t *lumFilter, +yuv2ayuv_X_c_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -2908,7 +2908,7 @@ yuv2ayuv_X_c_template(SwsContext *c, const int16_t *lumFilter, #undef output_pixels #define AYUVPACKEDWRAPPER(name, fmt) \ -static void yuv2 ## name ## _X_c(SwsContext *c, const int16_t *lumFilter, \ +static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -2920,7 +2920,7 @@ static void yuv2 ## name ## _X_c(SwsContext *c, const int16_t *lumFilter, \ alpSrc, dest, dstW, y, fmt); \ } \ \ -static void yuv2 ## name ## _2_c(SwsContext *c, const int16_t *buf[2], \ +static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -2929,7 +2929,7 @@ static void yuv2 ## name ## _2_c(SwsContext *c, const int16_t *buf[2], \ dest, dstW, yalpha, uvalpha, y, fmt); \ } \ \ -static void yuv2 ## name ## _1_c(SwsContext *c, const int16_t *buf0, \ +static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -2948,7 +2948,7 @@ AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA) #define yuv2y2xx_wrapper(bits) \ static void \ - yuv2y2 ## bits ## le_X_c(SwsContext *c, const int16_t *lumFilter, \ + yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, \ const int16_t **chrUSrc, \ @@ -2984,7 +2984,7 @@ yuv2y2xx_wrapper(10) yuv2y2xx_wrapper(12) static void -yuv2vyu444_1_c(SwsContext *c, const int16_t *buf0, +yuv2vyu444_1_c(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -3029,7 +3029,7 @@ yuv2vyu444_1_c(SwsContext *c, const int16_t *buf0, } static void -yuv2vyu444_2_c(SwsContext *c, const int16_t *buf[2], +yuv2vyu444_2_c(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -3063,7 +3063,7 @@ yuv2vyu444_2_c(SwsContext *c, const int16_t *buf[2], } static void -yuv2vyu444_X_c(SwsContext *c, const int16_t *lumFilter, +yuv2vyu444_X_c(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -3104,7 +3104,7 @@ yuv2vyu444_X_c(SwsContext *c, const int16_t *lumFilter, #undef output_pixel -av_cold void ff_sws_init_output_funcs(SwsContext *c, +av_cold void ff_sws_init_output_funcs(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index 9bf72738df..836aaab1f8 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -229,7 +229,7 @@ yuv2plane1_float(yuv2plane1_float_bswap_altivec, uint32_t, BE) #endif /* HAVE_ALTIVEC */ -av_cold void ff_sws_init_swscale_ppc(SwsContext *c) +av_cold void ff_sws_init_swscale_ppc(SwsInternal *c) { #if HAVE_ALTIVEC enum AVPixelFormat dstFormat = c->dstFormat; diff --git a/libswscale/ppc/swscale_ppc_template.c b/libswscale/ppc/swscale_ppc_template.c index 3c2addd4a4..46fd2bee62 100644 --- a/libswscale/ppc/swscale_ppc_template.c +++ b/libswscale/ppc/swscale_ppc_template.c @@ -97,7 +97,7 @@ static void FUNC(yuv2planeX)(const int16_t *filter, int filterSize, yuv2planeX_u(filter, filterSize, src, dest, dstW, dither, offset, i); } -static void FUNC(hScale_real)(SwsContext *c, int16_t *dst, int dstW, +static void FUNC(hScale_real)(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize) { diff --git a/libswscale/ppc/swscale_vsx.c b/libswscale/ppc/swscale_vsx.c index 7080a16aee..f83bb96ec9 100644 --- a/libswscale/ppc/swscale_vsx.c +++ b/libswscale/ppc/swscale_vsx.c @@ -526,7 +526,7 @@ yuv2NBPSX(16, LE, 0, 16, int32_t) } static av_always_inline void -yuv2rgb_full_X_vsx_template(SwsContext *c, const int16_t *lumFilter, +yuv2rgb_full_X_vsx_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -677,7 +677,7 @@ yuv2rgb_full_X_vsx_template(SwsContext *c, const int16_t *lumFilter, static av_always_inline void -yuv2rgb_full_2_vsx_template(SwsContext *c, const int16_t *buf[2], +yuv2rgb_full_2_vsx_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -799,7 +799,7 @@ yuv2rgb_full_2_vsx_template(SwsContext *c, const int16_t *buf[2], } static av_always_inline void -yuv2rgb_2_vsx_template(SwsContext *c, const int16_t *buf[2], +yuv2rgb_2_vsx_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -975,7 +975,7 @@ yuv2rgb_2_vsx_template(SwsContext *c, const int16_t *buf[2], #undef SETUP static av_always_inline void -yuv2rgb_full_1_vsx_template(SwsContext *c, const int16_t *buf0, +yuv2rgb_full_1_vsx_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1104,7 +1104,7 @@ yuv2rgb_full_1_vsx_template(SwsContext *c, const int16_t *buf0, } static av_always_inline void -yuv2rgb_1_vsx_template(SwsContext *c, const int16_t *buf0, +yuv2rgb_1_vsx_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target, @@ -1290,7 +1290,7 @@ yuv2rgb_1_vsx_template(SwsContext *c, const int16_t *buf0, #undef WRITERGB #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _X_vsx(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_vsx(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -1303,7 +1303,7 @@ static void name ## ext ## _X_vsx(SwsContext *c, const int16_t *lumFilter, \ } #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _2_vsx(SwsContext *c, const int16_t *buf[2], \ +static void name ## ext ## _2_vsx(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -1313,7 +1313,7 @@ static void name ## ext ## _2_vsx(SwsContext *c, const int16_t *buf[2], \ } #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ -static void name ## ext ## _1_vsx(SwsContext *c, const int16_t *buf0, \ +static void name ## ext ## _1_vsx(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -1425,7 +1425,7 @@ write422(const vec_s16 vy1, const vec_s16 vy2, } static av_always_inline void -yuv2422_X_vsx_template(SwsContext *c, const int16_t *lumFilter, +yuv2422_X_vsx_template(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, @@ -1533,7 +1533,7 @@ yuv2422_X_vsx_template(SwsContext *c, const int16_t *lumFilter, } static av_always_inline void -yuv2422_2_vsx_template(SwsContext *c, const int16_t *buf[2], +yuv2422_2_vsx_template(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, @@ -1567,7 +1567,7 @@ yuv2422_2_vsx_template(SwsContext *c, const int16_t *buf[2], #undef SETUP static av_always_inline void -yuv2422_1_vsx_template(SwsContext *c, const int16_t *buf0, +yuv2422_1_vsx_template(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum AVPixelFormat target) @@ -1627,7 +1627,7 @@ yuv2422_1_vsx_template(SwsContext *c, const int16_t *buf0, } #define YUV2PACKEDWRAPPERX(name, base, ext, fmt) \ -static void name ## ext ## _X_vsx(SwsContext *c, const int16_t *lumFilter, \ +static void name ## ext ## _X_vsx(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrc, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrc, \ const int16_t **chrVSrc, int chrFilterSize, \ @@ -1641,7 +1641,7 @@ static void name ## ext ## _X_vsx(SwsContext *c, const int16_t *lumFilter, \ #define YUV2PACKEDWRAPPER2(name, base, ext, fmt) \ YUV2PACKEDWRAPPERX(name, base, ext, fmt) \ -static void name ## ext ## _2_vsx(SwsContext *c, const int16_t *buf[2], \ +static void name ## ext ## _2_vsx(SwsInternal *c, const int16_t *buf[2], \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf[2], uint8_t *dest, int dstW, \ int yalpha, int uvalpha, int y) \ @@ -1652,7 +1652,7 @@ static void name ## ext ## _2_vsx(SwsContext *c, const int16_t *buf[2], \ #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \ YUV2PACKEDWRAPPER2(name, base, ext, fmt) \ -static void name ## ext ## _1_vsx(SwsContext *c, const int16_t *buf0, \ +static void name ## ext ## _1_vsx(SwsInternal *c, const int16_t *buf0, \ const int16_t *ubuf[2], const int16_t *vbuf[2], \ const int16_t *abuf0, uint8_t *dest, int dstW, \ int uvalpha, int y) \ @@ -1666,7 +1666,7 @@ YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422) YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422) YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) -static void hyscale_fast_vsx(SwsContext *c, int16_t *dst, int dstWidth, +static void hyscale_fast_vsx(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc) { int i; @@ -1781,7 +1781,7 @@ static void hyscale_fast_vsx(SwsContext *c, int16_t *dst, int dstWidth, vec_st((vec_s16) vd_l, 0, &out[i]); \ vec_st((vec_s16) vd_r, 0, &out[i + 8]) -static void hcscale_fast_vsx(SwsContext *c, int16_t *dst1, int16_t *dst2, +static void hcscale_fast_vsx(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc) { @@ -1858,7 +1858,7 @@ static void hcscale_fast_vsx(SwsContext *c, int16_t *dst1, int16_t *dst2, #undef HCSCALE -static void hScale16To19_vsx(SwsContext *c, int16_t *_dst, int dstW, +static void hScale16To19_vsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -1936,7 +1936,7 @@ static void hScale16To19_vsx(SwsContext *c, int16_t *_dst, int dstW, } } -static void hScale16To15_vsx(SwsContext *c, int16_t *dst, int dstW, +static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -2016,7 +2016,7 @@ static void hScale16To15_vsx(SwsContext *c, int16_t *dst, int dstW, #endif /* HAVE_VSX */ -av_cold void ff_sws_init_swscale_vsx(SwsContext *c) +av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) { #if HAVE_VSX enum AVPixelFormat dstFormat = c->dstFormat; diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c index 3ba6461dfb..9db305f43f 100644 --- a/libswscale/ppc/yuv2rgb_altivec.c +++ b/libswscale/ppc/yuv2rgb_altivec.c @@ -252,7 +252,7 @@ static const vector unsigned char (vector unsigned short) \ vec_max(y, ((vector signed short) { 0 }))) -static inline void cvtyuvtoRGB(SwsContext *c, vector signed short Y, +static inline void cvtyuvtoRGB(SwsInternal *c, vector signed short Y, vector signed short U, vector signed short V, vector signed short *R, vector signed short *G, vector signed short *B) @@ -295,7 +295,7 @@ static inline vector unsigned char vec_xl(signed long long offset, const ubyte * #endif /* !HAVE_VSX */ #define DEFCSP420_CVT(name, out_pixels) \ -static int altivec_ ## name(SwsContext *c, const unsigned char *const *in, \ +static int altivec_ ## name(SwsInternal *c, const unsigned char *const *in, \ const int *instrides, int srcSliceY, int srcSliceH, \ unsigned char *const *oplanes, const int *outstrides) \ { \ @@ -471,7 +471,7 @@ static const vector unsigned char /* * this is so I can play live CCIR raw video */ -static int altivec_uyvy_rgb32(SwsContext *c, const unsigned char *const *in, +static int altivec_uyvy_rgb32(SwsInternal *c, const unsigned char *const *in, const int *instrides, int srcSliceY, int srcSliceH, unsigned char *const *oplanes, const int *outstrides) { @@ -532,7 +532,7 @@ static int altivec_uyvy_rgb32(SwsContext *c, const unsigned char *const *in, * * So we just fall back to the C codes for this. */ -av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c) +av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c) { #if HAVE_ALTIVEC if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) @@ -595,7 +595,7 @@ av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c) return NULL; } -av_cold void ff_yuv2rgb_init_tables_ppc(SwsContext *c, +av_cold void ff_yuv2rgb_init_tables_ppc(SwsInternal *c, const int inv_table[4], int brightness, int contrast, @@ -630,7 +630,7 @@ av_cold void ff_yuv2rgb_init_tables_ppc(SwsContext *c, #if HAVE_ALTIVEC -static av_always_inline void yuv2packedX_altivec(SwsContext *c, +static av_always_inline void yuv2packedX_altivec(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, @@ -839,7 +839,7 @@ static av_always_inline void yuv2packedX_altivec(SwsContext *c, } #define YUV2PACKEDX_WRAPPER(suffix, pixfmt) \ -void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, \ +void ff_yuv2 ## suffix ## _X_altivec(SwsInternal *c, \ const int16_t *lumFilter, \ const int16_t **lumSrc, \ int lumFilterSize, \ diff --git a/libswscale/ppc/yuv2rgb_altivec.h b/libswscale/ppc/yuv2rgb_altivec.h index aa52a4743e..b57194a813 100644 --- a/libswscale/ppc/yuv2rgb_altivec.h +++ b/libswscale/ppc/yuv2rgb_altivec.h @@ -29,7 +29,7 @@ #include "libswscale/swscale_internal.h" #define YUV2PACKEDX_HEADER(suffix) \ - void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, \ + void ff_yuv2 ## suffix ## _X_altivec(SwsInternal *c, \ const int16_t *lumFilter, \ const int16_t **lumSrc, \ int lumFilterSize, \ diff --git a/libswscale/ppc/yuv2yuv_altivec.c b/libswscale/ppc/yuv2yuv_altivec.c index d63feb6012..0ae5223760 100644 --- a/libswscale/ppc/yuv2yuv_altivec.c +++ b/libswscale/ppc/yuv2yuv_altivec.c @@ -31,7 +31,7 @@ #if HAVE_ALTIVEC -static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *const src[], +static int yv12toyuy2_unscaled_altivec(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride_a[]) @@ -107,7 +107,7 @@ static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *const src[] return srcSliceH; } -static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *const src[], +static int yv12touyvy_unscaled_altivec(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride_a[]) @@ -184,7 +184,7 @@ static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *const src[] #endif /* HAVE_ALTIVEC */ -av_cold void ff_get_unscaled_swscale_ppc(SwsContext *c) +av_cold void ff_get_unscaled_swscale_ppc(SwsInternal *c) { #if HAVE_ALTIVEC if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) diff --git a/libswscale/riscv/swscale.c b/libswscale/riscv/swscale.c index c452d93e5d..8ed9ce969e 100644 --- a/libswscale/riscv/swscale.c +++ b/libswscale/riscv/swscale.c @@ -26,7 +26,7 @@ void ff_range_chr_to_jpeg_16_rvv(int16_t *, int16_t *, int); void ff_range_lum_from_jpeg_16_rvv(int16_t *, int); void ff_range_chr_from_jpeg_16_rvv(int16_t *, int16_t *, int); -av_cold static void ff_sws_init_range_convert_riscv(SwsContext *c, int flags) +av_cold static void ff_sws_init_range_convert_riscv(SwsInternal *c, int flags) { #if HAVE_RVV static const struct { @@ -65,7 +65,7 @@ RVV_INPUT(bgra32); RVV_INPUT(rgb24); RVV_INPUT(rgba32); -av_cold void ff_sws_init_swscale_riscv(SwsContext *c) +av_cold void ff_sws_init_swscale_riscv(SwsInternal *c) { int flags = av_get_cpu_flags(); diff --git a/libswscale/slice.c b/libswscale/slice.c index 119bfbdb8d..f13a839f98 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -218,7 +218,7 @@ static void fill_ones(SwsSlice *s, int n, int bpc) The n lines are needed only when there is not enough src lines to output a single dst line, then we should buffer these lines to process them on the next call to scale. */ -static void get_min_buffer_size(SwsContext *c, int *out_lum_size, int *out_chr_size) +static void get_min_buffer_size(SwsInternal *c, int *out_lum_size, int *out_chr_size) { int lumY; int dstH = c->dstH; @@ -247,7 +247,7 @@ static void get_min_buffer_size(SwsContext *c, int *out_lum_size, int *out_chr_s -int ff_init_filters(SwsContext * c) +int ff_init_filters(SwsInternal * c) { int i; int index; @@ -387,7 +387,7 @@ cleanup: return res; } -int ff_free_filters(SwsContext *c) +int ff_free_filters(SwsInternal *c) { int i; if (c->desc) { diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 0f5e520515..c368c68fea 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -62,7 +62,7 @@ static av_always_inline void fillPlane(uint8_t *plane, int stride, int width, } } -static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, +static void hScale16To19_c(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -92,7 +92,7 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, } } -static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, +static void hScale16To15_c(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -121,7 +121,7 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, } // bilinear / bicubic scaling -static void hScale8To15_c(SwsContext *c, int16_t *dst, int dstW, +static void hScale8To15_c(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -137,7 +137,7 @@ static void hScale8To15_c(SwsContext *c, int16_t *dst, int dstW, } } -static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW, +static void hScale8To19_c(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize) { @@ -233,7 +233,7 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width) if (DEBUG_SWSCALE_BUFFERS) \ av_log(c, AV_LOG_DEBUG, __VA_ARGS__) -int ff_swscale(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[], int dstSliceY, int dstSliceH) { @@ -318,7 +318,7 @@ int ff_swscale(SwsContext *c, const uint8_t *const src[], const int srcStride[], if (dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || dstStride[3]&15) { - SwsContext *const ctx = c->parent ? c->parent : c; + SwsInternal *const ctx = c->parent ? sws_internal(c->parent) : c; if (flags & SWS_PRINT_INFO && !atomic_exchange_explicit(&ctx->stride_unaligned_warned, 1, memory_order_relaxed)) { av_log(c, AV_LOG_WARNING, @@ -333,7 +333,7 @@ int ff_swscale(SwsContext *c, const uint8_t *const src[], const int srcStride[], || dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || dstStride[3]&15 || srcStride2[0]&15 || srcStride2[1]&15 || srcStride2[2]&15 || srcStride2[3]&15 ) { - SwsContext *const ctx = c->parent ? c->parent : c; + SwsInternal *const ctx = c->parent ? sws_internal(c->parent) : c; int cpu_flags = av_get_cpu_flags(); if (flags & SWS_PRINT_INFO && HAVE_MMXEXT && (cpu_flags & AV_CPU_FLAG_SSE2) && !atomic_exchange_explicit(&ctx->stride_unaligned_warned,1, memory_order_relaxed)) { @@ -539,7 +539,7 @@ int ff_swscale(SwsContext *c, const uint8_t *const src[], const int srcStride[], return dstY - lastDstY; } -av_cold void ff_sws_init_range_convert(SwsContext *c) +av_cold void ff_sws_init_range_convert(SwsInternal *c) { c->lumConvertRange = NULL; c->chrConvertRange = NULL; @@ -564,7 +564,7 @@ av_cold void ff_sws_init_range_convert(SwsContext *c) } } -static av_cold void sws_init_swscale(SwsContext *c) +static av_cold void sws_init_swscale(SwsInternal *c) { enum AVPixelFormat srcFormat = c->srcFormat; @@ -597,7 +597,7 @@ static av_cold void sws_init_swscale(SwsContext *c) c->needs_hcscale = 1; } -void ff_sws_init_scale(SwsContext *c) +void ff_sws_init_scale(SwsInternal *c) { sws_init_swscale(c); @@ -645,7 +645,7 @@ static int check_image_pointers(const uint8_t * const data[4], enum AVPixelForma return 1; } -void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, +void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat); @@ -704,7 +704,7 @@ void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, } } -void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride, +void ff_rgb48Toxyz12(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat); @@ -763,7 +763,7 @@ void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride, } } -void ff_update_palette(SwsContext *c, const uint32_t *pal) +void ff_update_palette(SwsInternal *c, const uint32_t *pal) { for (int i = 0; i < 256; i++) { int r, g, b, y, u, v, a = 0xff; @@ -838,13 +838,13 @@ void ff_update_palette(SwsContext *c, const uint32_t *pal) } } -static int scale_internal(SwsContext *c, +static int scale_internal(SwsContext *sws, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstSlice[], const int dstStride[], int dstSliceY, int dstSliceH); -static int scale_gamma(SwsContext *c, +static int scale_gamma(SwsInternal *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t * const dstSlice[], const int dstStride[], @@ -870,39 +870,40 @@ static int scale_gamma(SwsContext *c, return ret; if (c->cascaded_context[2]) { + const int dstY1 = sws_internal(c->cascaded_context[1])->dstY; ret = scale_internal(c->cascaded_context[2], (const uint8_t * const *)c->cascaded_tmp[1], - c->cascaded_tmpStride[1], c->cascaded_context[1]->dstY - ret, - c->cascaded_context[1]->dstY, + c->cascaded_tmpStride[1], dstY1 - ret, dstY1, dstSlice, dstStride, dstSliceY, dstSliceH); } return ret; } -static int scale_cascaded(SwsContext *c, +static int scale_cascaded(SwsInternal *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t * const dstSlice[], const int dstStride[], int dstSliceY, int dstSliceH) { + const int dstH0 = sws_internal(c->cascaded_context[0])->dstH; int ret = scale_internal(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp[0], c->cascaded_tmpStride[0], - 0, c->cascaded_context[0]->dstH); + 0, dstH0); if (ret < 0) return ret; ret = scale_internal(c->cascaded_context[1], (const uint8_t * const * )c->cascaded_tmp[0], c->cascaded_tmpStride[0], - 0, c->cascaded_context[0]->dstH, - dstSlice, dstStride, dstSliceY, dstSliceH); + 0, dstH0, dstSlice, dstStride, dstSliceY, dstSliceH); return ret; } -static int scale_internal(SwsContext *c, +static int scale_internal(SwsContext *sws, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstSlice[], const int dstStride[], int dstSliceY, int dstSliceH) { + SwsInternal *c = sws_internal(sws); const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH; const int frame_start = scale_dst || !c->sliceDir; int i, ret; @@ -952,9 +953,12 @@ static int scale_internal(SwsContext *c, return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH, dstSlice, dstStride, dstSliceY, dstSliceH); - if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) + if (c->cascaded_context[0] && srcSliceY == 0 && + srcSliceH == sws_internal(c->cascaded_context[0])->srcH) + { return scale_cascaded(c, srcSlice, srcStride, srcSliceY, srcSliceH, dstSlice, dstStride, dstSliceY, dstSliceH); + } if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0]) for (i = 0; i < 4; i++) @@ -1091,15 +1095,17 @@ static int scale_internal(SwsContext *c, return ret; } -void sws_frame_end(struct SwsContext *c) +void sws_frame_end(SwsContext *sws) { + SwsInternal *c = sws_internal(sws); av_frame_unref(c->frame_src); av_frame_unref(c->frame_dst); c->src_ranges.nb_ranges = 0; } -int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src) +int sws_frame_start(SwsContext *sws, AVFrame *dst, const AVFrame *src) { + SwsInternal *c = sws_internal(sws); int ret, allocated = 0; ret = av_frame_ref(c->frame_src, src); @@ -1128,9 +1134,10 @@ int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src) return 0; } -int sws_send_slice(struct SwsContext *c, unsigned int slice_start, +int sws_send_slice(SwsContext *sws, unsigned int slice_start, unsigned int slice_height) { + SwsInternal *c = sws_internal(sws); int ret; ret = ff_range_add(&c->src_ranges, slice_start, slice_height); @@ -1140,18 +1147,20 @@ int sws_send_slice(struct SwsContext *c, unsigned int slice_start, return 0; } -unsigned int sws_receive_slice_alignment(const struct SwsContext *c) +unsigned int sws_receive_slice_alignment(const SwsContext *sws) { + SwsInternal *c = sws_internal(sws); if (c->slice_ctx) - return c->slice_ctx[0]->dst_slice_align; + return sws_internal(c->slice_ctx[0])->dst_slice_align; return c->dst_slice_align; } -int sws_receive_slice(struct SwsContext *c, unsigned int slice_start, +int sws_receive_slice(SwsContext *sws, unsigned int slice_start, unsigned int slice_height) { - unsigned int align = sws_receive_slice_alignment(c); + SwsInternal *c = sws_internal(sws); + unsigned int align = sws_receive_slice_alignment(sws); uint8_t *dst[4]; /* wait until complete input has been received */ @@ -1169,9 +1178,12 @@ int sws_receive_slice(struct SwsContext *c, unsigned int slice_start, } if (c->slicethread) { - int nb_jobs = c->slice_ctx[0]->dither == SWS_DITHER_ED ? 1 : c->nb_slice_ctx; + int nb_jobs = c->nb_slice_ctx; int ret = 0; + if (sws_internal(c->slice_ctx[0])->dither == SWS_DITHER_ED) + nb_jobs = 1; + c->dst_slice_start = slice_start; c->dst_slice_height = slice_height; @@ -1194,24 +1206,24 @@ int sws_receive_slice(struct SwsContext *c, unsigned int slice_start, dst[i] = FF_PTR_ADD(c->frame_dst->data[i], offset); } - return scale_internal(c, (const uint8_t * const *)c->frame_src->data, + return scale_internal(sws, (const uint8_t * const *)c->frame_src->data, c->frame_src->linesize, 0, c->srcH, dst, c->frame_dst->linesize, slice_start, slice_height); } -int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src) +int sws_scale_frame(SwsContext *sws, AVFrame *dst, const AVFrame *src) { int ret; - ret = sws_frame_start(c, dst, src); + ret = sws_frame_start(sws, dst, src); if (ret < 0) return ret; - ret = sws_send_slice(c, 0, src->height); + ret = sws_send_slice(sws, 0, src->height); if (ret >= 0) - ret = sws_receive_slice(c, 0, dst->height); + ret = sws_receive_slice(sws, 0, dst->height); - sws_frame_end(c); + sws_frame_end(sws); return ret; } @@ -1220,24 +1232,28 @@ int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src) * swscale wrapper, so we don't need to export the SwsContext. * Assumes planar YUV to be in YUV order instead of YVU. */ -int attribute_align_arg sws_scale(struct SwsContext *c, +int attribute_align_arg sws_scale(SwsContext *sws, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { - if (c->nb_slice_ctx) - c = c->slice_ctx[0]; + SwsInternal *c = sws_internal(sws); + if (c->nb_slice_ctx) { + sws = c->slice_ctx[0]; + c = sws_internal(sws); + } - return scale_internal(c, srcSlice, srcStride, srcSliceY, srcSliceH, + return scale_internal(sws, srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride, 0, c->dstH); } void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads) { - SwsContext *parent = priv; - SwsContext *c = parent->slice_ctx[threadnr]; + SwsInternal *parent = priv; + SwsContext *sws = parent->slice_ctx[threadnr]; + SwsInternal *c = sws_internal(sws); const int slice_height = FFALIGN(FFMAX((parent->dst_slice_height + nb_jobs - 1) / nb_jobs, 1), c->dst_slice_align); @@ -1256,7 +1272,7 @@ void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, dst[i] = parent->frame_dst->data[i] + offset; } - err = scale_internal(c, (const uint8_t * const *)parent->frame_src->data, + err = scale_internal(sws, (const uint8_t * const *)parent->frame_src->data, parent->frame_src->linesize, 0, c->srcH, dst, parent->frame_dst->linesize, parent->dst_slice_start + slice_start, slice_end - slice_start); diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index ce71f7c096..1817815b01 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -24,6 +24,7 @@ #include #include "config.h" +#include "swscale.h" #include "libavutil/avassert.h" #include "libavutil/common.h" @@ -64,7 +65,12 @@ #define RETCODE_USE_CASCADE -12345 -typedef struct SwsContext SwsContext; +typedef struct SwsInternal SwsInternal; + +static inline SwsInternal *sws_internal(const SwsContext *sws) +{ + return (SwsInternal *) sws; +} typedef enum SwsDither { SWS_DITHER_NONE = 0, @@ -96,7 +102,7 @@ typedef struct RangeList { int ff_range_add(RangeList *r, unsigned int start, unsigned int len); -typedef int (*SwsFunc)(SwsContext *c, const uint8_t *const src[], +typedef int (*SwsFunc)(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); @@ -185,7 +191,7 @@ typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, * but can be used to generate comfort noise using dithering * for some output formats. */ -typedef void (*yuv2packed1_fn)(struct SwsContext *c, const int16_t *lumSrc, +typedef void (*yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, @@ -218,7 +224,7 @@ typedef void (*yuv2packed1_fn)(struct SwsContext *c, const int16_t *lumSrc, * but can be used to generate comfort noise using dithering * for some output formats. */ -typedef void (*yuv2packed2_fn)(struct SwsContext *c, const int16_t *lumSrc[2], +typedef void (*yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], @@ -250,7 +256,7 @@ typedef void (*yuv2packed2_fn)(struct SwsContext *c, const int16_t *lumSrc[2], * but can be used to generate comfort noise using dithering * or some output formats. */ -typedef void (*yuv2packedX_fn)(struct SwsContext *c, const int16_t *lumFilter, +typedef void (*yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, @@ -284,7 +290,7 @@ typedef void (*yuv2packedX_fn)(struct SwsContext *c, const int16_t *lumFilter, * but can be used to generate comfort noise using dithering * or some output formats. */ -typedef void (*yuv2anyX_fn)(struct SwsContext *c, const int16_t *lumFilter, +typedef void (*yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, @@ -321,16 +327,16 @@ struct SwsSlice; struct SwsFilterDescriptor; /* This struct should be aligned on at least a 32-byte boundary. */ -struct SwsContext { +struct SwsInternal { /** * info on struct for av_log */ const AVClass *av_class; - struct SwsContext *parent; + SwsContext *parent; AVSliceThread *slicethread; - struct SwsContext **slice_ctx; + SwsContext **slice_ctx; int *slice_err; int nb_slice_ctx; @@ -375,7 +381,7 @@ struct SwsContext { * sequential steps, this is for example used to limit the maximum * downscaling factor that needs to be supported in one scaler. */ - struct SwsContext *cascaded_context[3]; + SwsContext *cascaded_context[3]; int cascaded_tmpStride[2][4]; uint8_t *cascaded_tmp[2][4]; int cascaded_mainindex; @@ -602,7 +608,7 @@ struct SwsContext { /** * Scale one horizontal line of input data using a bilinear filter - * to produce one line of output data. Compared to SwsContext->hScale(), + * to produce one line of output data. Compared to SwsInternal->hScale(), * please take note of the following caveats when using these: * - Scaling is done using only 7 bits instead of 14-bit coefficients. * - You can use no more than 5 input pixels to produce 4 output @@ -616,13 +622,13 @@ struct SwsContext { * two input pixels per output pixel in bilinear scaling, this is * impossible and thus downscaling by any size will create artifacts. * To enable this type of scaling, set SWS_FLAG_FAST_BILINEAR - * in SwsContext->flags. + * in SwsInternal->flags. */ /** @{ */ - void (*hyscale_fast)(struct SwsContext *c, + void (*hyscale_fast)(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc); - void (*hcscale_fast)(struct SwsContext *c, + void (*hcscale_fast)(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc); @@ -634,15 +640,15 @@ struct SwsContext { * * @param dst pointer to destination buffer for horizontally scaled * data. If the number of bits per component of one - * destination pixel (SwsContext->dstBpc) is <= 10, data + * destination pixel (SwsInternal->dstBpc) is <= 10, data * will be 15 bpc in 16 bits (int16_t) width. Else (i.e. - * SwsContext->dstBpc == 16), data will be 19bpc in + * SwsInternal->dstBpc == 16), data will be 19bpc in * 32 bits (int32_t) width. * @param dstW width of destination image * @param src pointer to source data to be scaled. If the number of - * bits per component of a source pixel (SwsContext->srcBpc) + * bits per component of a source pixel (SwsInternal->srcBpc) * is 8, this is 8bpc in 8 bits (uint8_t) width. Else - * (i.e. SwsContext->dstBpc > 8), this is native depth + * (i.e. SwsInternal->dstBpc > 8), this is native depth * in 16 bits (uint16_t) width. In other words, for 9-bit * YUV input, this is 9bpc, for 10-bit YUV input, this is * 10bpc, and for 16-bit RGB or YUV, this is 16bpc. @@ -659,10 +665,10 @@ struct SwsContext { * to simplify creating SIMD code. */ /** @{ */ - void (*hyScale)(struct SwsContext *c, int16_t *dst, int dstW, + void (*hyScale)(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); - void (*hcScale)(struct SwsContext *c, int16_t *dst, int dstW, + void (*hcScale)(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); /** @} */ @@ -698,25 +704,25 @@ struct SwsContext { }; //FIXME check init (where 0) -SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c); -int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], +SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c); +int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation); -void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4], +void ff_yuv2rgb_init_tables_ppc(SwsInternal *c, const int inv_table[4], int brightness, int contrast, int saturation); -void ff_updateMMXDitherTables(SwsContext *c, int dstY); +void ff_updateMMXDitherTables(SwsInternal *c, int dstY); -void ff_update_palette(SwsContext *c, const uint32_t *pal); +void ff_update_palette(SwsInternal *c, const uint32_t *pal); -av_cold void ff_sws_init_range_convert(SwsContext *c); -av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c); -av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c); -av_cold void ff_sws_init_range_convert_x86(SwsContext *c); +av_cold void ff_sws_init_range_convert(SwsInternal *c); +av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c); +av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c); +av_cold void ff_sws_init_range_convert_x86(SwsInternal *c); -SwsFunc ff_yuv2rgb_init_x86(SwsContext *c); -SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c); -SwsFunc ff_yuv2rgb_init_loongarch(SwsContext *c); +SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c); +SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c); +SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c); static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt) { @@ -981,21 +987,21 @@ extern const AVClass ff_sws_context_class; * Set c->convert_unscaled to an unscaled converter if one exists for the * specific source and destination formats, bit depths, flags, etc. */ -void ff_get_unscaled_swscale(SwsContext *c); -void ff_get_unscaled_swscale_ppc(SwsContext *c); -void ff_get_unscaled_swscale_arm(SwsContext *c); -void ff_get_unscaled_swscale_aarch64(SwsContext *c); +void ff_get_unscaled_swscale(SwsInternal *c); +void ff_get_unscaled_swscale_ppc(SwsInternal *c); +void ff_get_unscaled_swscale_arm(SwsInternal *c); +void ff_get_unscaled_swscale_aarch64(SwsInternal *c); -void ff_sws_init_scale(SwsContext *c); +void ff_sws_init_scale(SwsInternal *c); -void ff_sws_init_input_funcs(SwsContext *c, +void ff_sws_init_input_funcs(SwsInternal *c, planar1_YV12_fn *lumToYV12, planar1_YV12_fn *alpToYV12, planar2_YV12_fn *chrToYV12, planarX_YV12_fn *readLumPlanar, planarX_YV12_fn *readAlpPlanar, planarX2_YV12_fn *readChrPlanar); -void ff_sws_init_output_funcs(SwsContext *c, +void ff_sws_init_output_funcs(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, @@ -1003,30 +1009,30 @@ void ff_sws_init_output_funcs(SwsContext *c, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX); -void ff_sws_init_swscale_ppc(SwsContext *c); -void ff_sws_init_swscale_vsx(SwsContext *c); -void ff_sws_init_swscale_x86(SwsContext *c); -void ff_sws_init_swscale_aarch64(SwsContext *c); -void ff_sws_init_swscale_arm(SwsContext *c); -void ff_sws_init_swscale_loongarch(SwsContext *c); -void ff_sws_init_swscale_riscv(SwsContext *c); - -void ff_hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, +void ff_sws_init_swscale_ppc(SwsInternal *c); +void ff_sws_init_swscale_vsx(SwsInternal *c); +void ff_sws_init_swscale_x86(SwsInternal *c); +void ff_sws_init_swscale_aarch64(SwsInternal *c); +void ff_sws_init_swscale_arm(SwsInternal *c); +void ff_sws_init_swscale_loongarch(SwsInternal *c); +void ff_sws_init_swscale_riscv(SwsInternal *c); + +void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc); -void ff_hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, +void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc); int ff_init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits); -void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst, +void ff_hyscale_fast_mmxext(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc); -void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, int16_t *dst2, +void ff_hcscale_fast_mmxext(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc); -int ff_sws_alphablendaway(SwsContext *c, const uint8_t *const src[], +int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); @@ -1034,10 +1040,10 @@ void ff_copyPlane(const uint8_t *src, int srcStride, int srcSliceY, int srcSliceH, int width, uint8_t *dst, int dstStride); -void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, +void ff_xyz12Torgb48(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h); -void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride, +void ff_rgb48Toxyz12(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h); static inline void fillPlane16(uint8_t *plane, int stride, int width, int height, int y, @@ -1116,7 +1122,7 @@ typedef struct SwsFilterDescriptor void *instance; ///< Filter instance data /// Function for processing input slice sliceH lines starting from line sliceY - int (*process)(SwsContext *c, struct SwsFilterDescriptor *desc, int sliceY, int sliceH); + int (*process)(SwsInternal *c, struct SwsFilterDescriptor *desc, int sliceY, int sliceH); } SwsFilterDescriptor; // warp input lines in the form (src + width*i + j) to slice format (line[i][j]) @@ -1125,10 +1131,10 @@ int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride int srcW, int lumY, int lumH, int chrY, int chrH, int relative); // Initialize scaler filter descriptor chain -int ff_init_filters(SwsContext *c); +int ff_init_filters(SwsInternal *c); // Free all filter data -int ff_free_filters(SwsContext *c); +int ff_free_filters(SwsInternal *c); /* function for applying ring buffer logic into slice s @@ -1156,17 +1162,17 @@ int ff_init_desc_chscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst int ff_init_desc_no_chr(SwsFilterDescriptor *desc, SwsSlice * src, SwsSlice *dst); /// initializes vertical scaling descriptors -int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst); +int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst); /// setup vertical scaler functions -void ff_init_vscale_pfn(SwsContext *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX, +void ff_init_vscale_pfn(SwsInternal *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX, yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2, yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx); void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads); -int ff_swscale(SwsContext *c, const uint8_t *const src[], const int srcStride[], +int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[], int dstSliceY, int dstSliceH); @@ -1175,5 +1181,5 @@ int ff_swscale(SwsContext *c, const uint8_t *const src[], const int srcStride[], #define MAX_LINES_AHEAD 4 //shuffle filter and filterPos for hyScale and hcScale filters in avx2 -int ff_shuffle_filter_coefficients(SwsContext *c, int* filterPos, int filterSize, int16_t *filter, int dstW); +int ff_shuffle_filter_coefficients(SwsInternal *c, int* filterPos, int filterSize, int16_t *filter, int dstW); #endif /* SWSCALE_SWSCALE_INTERNAL_H */ diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index edb51a8250..1a293483c4 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -139,7 +139,7 @@ void ff_copyPlane(const uint8_t *src, int srcStride, } } -static int planarToNv12Wrapper(SwsContext *c, const uint8_t *const src[], +static int planarToNv12Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) @@ -159,7 +159,7 @@ static int planarToNv12Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *const src[], +static int nv12ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) @@ -180,7 +180,7 @@ static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int planarToNv24Wrapper(SwsContext *c, const uint8_t *const src[], +static int planarToNv24Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) @@ -200,7 +200,7 @@ static int planarToNv24Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int nv24ToPlanarWrapper(SwsContext *c, const uint8_t *const src[], +static int nv24ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) @@ -243,7 +243,7 @@ static void nv24_to_yuv420p_chroma(uint8_t *dst1, int dstStride1, } } -static int nv24ToYuv420Wrapper(SwsContext *c, const uint8_t *const src[], +static int nv24ToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -263,7 +263,7 @@ static int nv24ToYuv420Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int planarToP01xWrapper(SwsContext *c, const uint8_t *const src8[], +static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam8[], const int dstStride[]) @@ -323,7 +323,7 @@ static int planarToP01xWrapper(SwsContext *c, const uint8_t *const src8[], #define output_pixel(p, v) (*p) = (v) #endif -static int planar8ToP01xleWrapper(SwsContext *c, const uint8_t *const src[], +static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam8[], const int dstStride[]) @@ -366,7 +366,7 @@ static int planar8ToP01xleWrapper(SwsContext *c, const uint8_t *const src[], #undef output_pixel -static int planarToYuy2Wrapper(SwsContext *c, const uint8_t *const src[], +static int planarToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -378,7 +378,7 @@ static int planarToYuy2Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int planarToUyvyWrapper(SwsContext *c, const uint8_t *const src[], +static int planarToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -390,7 +390,7 @@ static int planarToUyvyWrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t *const src[], +static int yuv422pToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -402,7 +402,7 @@ static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t *const src[], +static int yuv422pToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -414,7 +414,7 @@ static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t *const src[], +static int yuyvToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -431,7 +431,7 @@ static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t *const src[], +static int yuyvToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -445,7 +445,7 @@ static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t *const src[], +static int uyvyToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -462,7 +462,7 @@ static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int uyvyToYuv422Wrapper(SwsContext *c, const uint8_t *const src[], +static int uyvyToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dstParam[], const int dstStride[]) { @@ -507,7 +507,7 @@ static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, } } -static int bswap_16bpc(SwsContext *c, const uint8_t *const src[], +static int bswap_16bpc(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -534,7 +534,7 @@ static int bswap_16bpc(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int bswap_32bpc(SwsContext *c, const uint8_t *const src[], +static int bswap_32bpc(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -562,7 +562,7 @@ static int bswap_32bpc(SwsContext *c, const uint8_t *const src[], } -static int palToRgbWrapper(SwsContext *c, const uint8_t *const src[], const int srcStride[], +static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -742,7 +742,7 @@ static void packed16togbra16(const uint8_t *src, int srcStride, } } -static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *const src[], +static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -921,7 +921,7 @@ static void gbr16ptopacked16(const uint16_t *src[], const int srcStride[], } } -static int planarRgb16ToRgb16Wrapper(SwsContext *c, const uint8_t *const src[], +static int planarRgb16ToRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1057,7 +1057,7 @@ static void gbraptopacked32(const uint8_t *src[], const int srcStride[], } } -static int planarRgbaToRgbWrapper(SwsContext *c, const uint8_t *const src[], +static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1113,7 +1113,7 @@ static int planarRgbaToRgbWrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *const src[], +static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1169,7 +1169,7 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int planarRgbToplanarRgbWrapper(SwsContext *c, +static int planarRgbToplanarRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -1215,7 +1215,7 @@ static void packedtogbr24p(const uint8_t *src, int srcStride, } } -static int rgbToPlanarRgbWrapper(SwsContext *c, const uint8_t *const src[], +static int rgbToPlanarRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1320,7 +1320,7 @@ static int rgbToPlanarRgbWrapper(SwsContext *c, const uint8_t *const src[], #define BAYER_RENAME(x) bayer_rggb16be_to_##x #include "bayer_template.c" -static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t *const src[], +static int bayer_to_rgb24_wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1370,7 +1370,7 @@ static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int bayer_to_rgb48_wrapper(SwsContext *c, const uint8_t *const src[], +static int bayer_to_rgb48_wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1420,7 +1420,7 @@ static int bayer_to_rgb48_wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t *const src[], +static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1499,7 +1499,7 @@ static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t *const src[], /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int); -static rgbConvFn findRgbConvFn(SwsContext *c) +static rgbConvFn findRgbConvFn(SwsInternal *c) { const enum AVPixelFormat srcFormat = c->srcFormat; const enum AVPixelFormat dstFormat = c->dstFormat; @@ -1622,7 +1622,7 @@ static rgbConvFn findRgbConvFn(SwsContext *c) } /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ -static int rgbToRgbWrapper(SwsContext *c, const uint8_t *const src[], const int srcStride[], +static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -1683,7 +1683,7 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *const src[], const int return srcSliceH; } -static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t *const src[], +static int bgr24ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1700,7 +1700,7 @@ static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t *const src[], +static int yvu9ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1716,7 +1716,7 @@ static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int uint_y_to_float_y_wrapper(SwsContext *c, const uint8_t *const src[], +static int uint_y_to_float_y_wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1736,7 +1736,7 @@ static int uint_y_to_float_y_wrapper(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static int float_y_to_uint_y_wrapper(SwsContext *c, +static int float_y_to_uint_y_wrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], @@ -1759,7 +1759,7 @@ static int float_y_to_uint_y_wrapper(SwsContext *c, } /* unscaled copy like stuff (assumes nearly identical formats) */ -static int packedCopyWrapper(SwsContext *c, const uint8_t *const src[], +static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -1846,7 +1846,7 @@ static int packedCopyWrapper(SwsContext *c, const uint8_t *const src[], }\ } -static int planarCopyWrapper(SwsContext *c, const uint8_t *const src[], +static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { @@ -2019,7 +2019,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *const src[], (src_fmt == pix_fmt ## LE && dst_fmt == pix_fmt ## BE)) -void ff_get_unscaled_swscale(SwsContext *c) +void ff_get_unscaled_swscale(SwsInternal *c) { const enum AVPixelFormat srcFormat = c->srcFormat; const enum AVPixelFormat dstFormat = c->dstFormat; diff --git a/libswscale/tests/floatimg_cmp.c b/libswscale/tests/floatimg_cmp.c index 5c67594fb6..0744e64f8e 100644 --- a/libswscale/tests/floatimg_cmp.c +++ b/libswscale/tests/floatimg_cmp.c @@ -83,7 +83,7 @@ int main(int argc, char **argv) double sum; float minimum, maximum, diff; - struct SwsContext *sws = NULL; + SwsContext *sws = NULL; AVLFG rand; FILE *fp = NULL; diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c index 8e57c0a7cf..af8069f728 100644 --- a/libswscale/tests/swscale.c +++ b/libswscale/tests/swscale.c @@ -117,7 +117,7 @@ static int doTest(const uint8_t * const ref[4], int refStride[4], int w, int h, int dstStride[4] = {0}; int i; uint64_t ssdY, ssdU = 0, ssdV = 0, ssdA = 0; - struct SwsContext *dstContext = NULL, *outContext = NULL; + SwsContext *dstContext = NULL, *outContext = NULL; uint32_t crc = 0; int res = 0; @@ -125,7 +125,7 @@ static int doTest(const uint8_t * const ref[4], int refStride[4], int w, int h, return 0; if (cur_srcFormat != srcFormat || cur_srcW != srcW || cur_srcH != srcH) { - struct SwsContext *srcContext = NULL; + SwsContext *srcContext = NULL; int p; for (p = 0; p < 4; p++) @@ -427,7 +427,7 @@ int main(int argc, char **argv) const uint8_t * const src[4] = { data, data + W * H, data + W * H * 2, data + W * H * 3 }; int stride[4] = { W, W, W, W }; int x, y; - struct SwsContext *sws; + SwsContext *sws; AVLFG rand; int res = -1; int i; diff --git a/libswscale/utils.c b/libswscale/utils.c index 9b23df4dbb..4b5106cb57 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -287,7 +287,8 @@ static SwsContext *alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcForm int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, const double *param) { - SwsContext *c = sws_alloc_context(); + SwsContext *sws = sws_alloc_context(); + SwsInternal *c = sws_internal(sws); if (!c) return NULL; @@ -305,10 +306,10 @@ static SwsContext *alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcForm c->param[1] = param[1]; } - return c; + return sws; } -int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, +int ff_shuffle_filter_coefficients(SwsInternal *c, int *filterPos, int filterSize, int16_t *filter, int dstW) { @@ -396,7 +397,7 @@ static double getSplineCoeff(double a, double b, double c, double d, dist - 1.0); } -static av_cold int get_local_pos(SwsContext *s, int chr_subsample, int pos, int dir) +static av_cold int get_local_pos(SwsInternal *s, int chr_subsample, int pos, int dir) { if (pos == -1 || pos <= -513) { pos = (128 << chr_subsample) - 128; @@ -834,7 +835,7 @@ done: return ret; } -static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange) +static void fill_rgb2yuv_table(SwsInternal *c, const int table[4], int dstRange) { int64_t W, V, Z, Cy, Cu, Cv; int64_t vr = table[0]; @@ -928,7 +929,7 @@ static void fill_rgb2yuv_table(SwsContext *c, const int table[4], int dstRange) AV_WL16(p + 16*4 + 2*i, map[i] >= 0 ? c->input_rgb2yuv_table[map[i]] : 0); } -static void fill_xyztables(struct SwsContext *c) +static void fill_xyztables(SwsInternal *c) { int i; double xyzgamma = XYZ_GAMMA; @@ -1022,7 +1023,7 @@ static int handle_xyz(enum AVPixelFormat *format) } } -static void handle_formats(SwsContext *c) +static void handle_formats(SwsInternal *c) { c->src0Alpha |= handle_0alpha(&c->srcFormat); c->dst0Alpha |= handle_0alpha(&c->dstFormat); @@ -1037,10 +1038,11 @@ static int range_override_needed(enum AVPixelFormat format) return !isYUV(format) && !isGray(format); } -int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], +int sws_setColorspaceDetails(SwsContext *sws, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) { + SwsInternal *c = sws_internal(sws); const AVPixFmtDescriptor *desc_dst; const AVPixFmtDescriptor *desc_src; int need_reinit = 0; @@ -1154,7 +1156,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], if (!c->cascaded_context[0]) return -1; - c->cascaded_context[0]->alphablend = c->alphablend; + sws_internal(c->cascaded_context[0])->alphablend = c->alphablend; ret = sws_init_context(c->cascaded_context[0], NULL , NULL); if (ret < 0) return ret; @@ -1168,8 +1170,8 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], c->flags, c->param); if (!c->cascaded_context[1]) return -1; - c->cascaded_context[1]->srcRange = srcRange; - c->cascaded_context[1]->dstRange = dstRange; + sws_internal(c->cascaded_context[1])->srcRange = srcRange; + sws_internal(c->cascaded_context[1])->dstRange = dstRange; ret = sws_init_context(c->cascaded_context[1], NULL , NULL); if (ret < 0) return ret; @@ -1200,11 +1202,12 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], return 0; } -int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, +int sws_getColorspaceDetails(SwsContext *sws, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation) { - if (!c ) + SwsInternal *c = sws_internal(sws); + if (!c) return -1; if (c->nb_slice_ctx) { @@ -1226,9 +1229,9 @@ int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, SwsContext *sws_alloc_context(void) { - SwsContext *c = av_mallocz(sizeof(SwsContext)); + SwsInternal *c = av_mallocz(sizeof(SwsInternal)); - av_assert0(offsetof(SwsContext, redDither) + DITHER32_INT == offsetof(SwsContext, dither32)); + av_assert0(offsetof(SwsInternal, redDither) + DITHER32_INT == offsetof(SwsInternal, dither32)); if (c) { c->av_class = &ff_sws_context_class; @@ -1237,7 +1240,7 @@ SwsContext *sws_alloc_context(void) atomic_init(&c->data_unaligned_warned, 0); } - return c; + return (SwsContext *) c; } static uint16_t * alloc_gamma_tbl(double e) @@ -1315,15 +1318,13 @@ static enum AVPixelFormat alphaless_fmt(enum AVPixelFormat fmt) } } -static int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, - SwsFilter *dstFilter); - -static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, +static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter, SwsFilter *dstFilter) { int i; int usesVFilter, usesHFilter; int unscaled; + SwsInternal *c = sws_internal(sws); SwsFilter dummyFilter = { NULL, NULL, NULL, NULL }; int srcW = c->srcW; int srcH = c->srcH; @@ -1345,7 +1346,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, unscaled = (srcW == dstW && srcH == dstH); if (!c->contrast && !c->saturation && !c->dstFormatBpp) - sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, + sws_setColorspaceDetails(sws, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->dstRange, 0, 1 << 16, 1 << 16); @@ -1620,7 +1621,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, if (!unscaled && c->gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) { - SwsContext *c2; + SwsInternal *c2; c->cascaded_context[0] = NULL; ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0], @@ -1642,7 +1643,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, if (!c->cascaded_context[1]) return AVERROR(ENOMEM); - c2 = c->cascaded_context[1]; + c2 = sws_internal(c->cascaded_context[1]); c2->is_internal_gamma = 1; c2->gamma = alloc_gamma_tbl( c->gamma_value); c2->inv_gamma = alloc_gamma_tbl(1.f/c->gamma_value); @@ -1654,7 +1655,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, // we have to re-initialize it ff_free_filters(c2); if ((ret = ff_init_filters(c2)) < 0) { - sws_freeContext(c2); + sws_freeContext(c->cascaded_context[1]); c->cascaded_context[1] = NULL; return ret; } @@ -1734,7 +1735,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, flags, c->param); if (!c->cascaded_context[0]) return AVERROR(EINVAL); - c->cascaded_context[0]->alphablend = c->alphablend; + sws_internal(c->cascaded_context[0])->alphablend = c->alphablend; ret = sws_init_context(c->cascaded_context[0], NULL , NULL); if (ret < 0) return ret; @@ -1745,8 +1746,8 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, if (!c->cascaded_context[1]) return AVERROR(EINVAL); - c->cascaded_context[1]->srcRange = c->srcRange; - c->cascaded_context[1]->dstRange = c->dstRange; + sws_internal(c->cascaded_context[1])->srcRange = c->srcRange; + sws_internal(c->cascaded_context[1])->dstRange = c->dstRange; ret = sws_init_context(c->cascaded_context[1], srcFilter , dstFilter); if (ret < 0) return ret; @@ -2027,12 +2028,13 @@ fail: // FIXME replace things by appropriate error codes return ret; } -static int context_init_threaded(SwsContext *c, +static int context_init_threaded(SwsContext *sws, SwsFilter *src_filter, SwsFilter *dst_filter) { + SwsInternal *c = sws_internal(sws); int ret; - ret = avpriv_slicethread_create(&c->slicethread, (void*)c, + ret = avpriv_slicethread_create(&c->slicethread, (void*) sws, ff_sws_slice_worker, NULL, c->nb_threads); if (ret == AVERROR(ENOSYS)) { c->nb_threads = 1; @@ -2048,24 +2050,26 @@ static int context_init_threaded(SwsContext *c, return AVERROR(ENOMEM); for (int i = 0; i < c->nb_threads; i++) { + SwsInternal *c2; c->slice_ctx[i] = sws_alloc_context(); if (!c->slice_ctx[i]) return AVERROR(ENOMEM); + c2 = sws_internal(c->slice_ctx[i]); c->nb_slice_ctx++; - c->slice_ctx[i]->parent = c; + c2->parent = sws; ret = av_opt_copy((void*)c->slice_ctx[i], (void*)c); if (ret < 0) return ret; - c->slice_ctx[i]->nb_threads = 1; + c2->nb_threads = 1; ret = sws_init_single_context(c->slice_ctx[i], src_filter, dst_filter); if (ret < 0) return ret; - if (c->slice_ctx[i]->dither == SWS_DITHER_ED) { + if (c2->dither == SWS_DITHER_ED) { av_log(c, AV_LOG_VERBOSE, "Error-diffusion dither is in use, scaling will be single-threaded."); break; @@ -2075,9 +2079,10 @@ static int context_init_threaded(SwsContext *c, return 0; } -av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, +av_cold int sws_init_context(SwsContext *sws, SwsFilter *srcFilter, SwsFilter *dstFilter) { + SwsInternal *c = sws_internal(sws); static AVOnce rgb2rgb_once = AV_ONCE_INIT; enum AVPixelFormat src_format, dst_format; int ret; @@ -2099,13 +2104,13 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, 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); + ret = context_init_threaded(sws, srcFilter, dstFilter); if (ret < 0 || c->nb_threads > 1) return ret; // threading disabled in this build, init as single-threaded } - return sws_init_single_context(c, srcFilter, dstFilter); + return sws_init_single_context(sws, srcFilter, dstFilter); } SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, @@ -2113,20 +2118,20 @@ SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param) { - SwsContext *c; + SwsContext *sws; - c = alloc_set_opts(srcW, srcH, srcFormat, - dstW, dstH, dstFormat, - flags, param); - if (!c) + sws = alloc_set_opts(srcW, srcH, srcFormat, + dstW, dstH, dstFormat, + flags, param); + if (!sws) return NULL; - if (sws_init_context(c, srcFilter, dstFilter) < 0) { - sws_freeContext(c); + if (sws_init_context(sws, srcFilter, dstFilter) < 0) { + sws_freeContext(sws); return NULL; } - return c; + return sws; } static int isnan_vec(SwsVector *a) @@ -2439,8 +2444,9 @@ fail: return NULL; } -void sws_freeContext(SwsContext *c) +void sws_freeContext(SwsContext *sws) { + SwsInternal *c = sws_internal(sws); int i; if (!c) return; @@ -2511,17 +2517,19 @@ void sws_freeContext(SwsContext *c) ff_free_filters(c); - av_free(c); + av_free(sws); } -struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, - int srcH, enum AVPixelFormat srcFormat, - int dstW, int dstH, - enum AVPixelFormat dstFormat, int flags, - SwsFilter *srcFilter, - SwsFilter *dstFilter, - const double *param) +SwsContext *sws_getCachedContext(SwsContext *sws, int srcW, + int srcH, enum AVPixelFormat srcFormat, + int dstW, int dstH, + enum AVPixelFormat dstFormat, int flags, + SwsFilter *srcFilter, + SwsFilter *dstFilter, + const double *param) { + SwsInternal *context; + static const double default_param[2] = { SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT }; int64_t src_h_chr_pos = -513, dst_h_chr_pos = -513, @@ -2530,7 +2538,7 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, if (!param) param = default_param; - if (context && + if ((context = sws_internal(sws)) && (context->srcW != srcW || context->srcH != srcH || context->srcFormat != srcFormat || @@ -2545,13 +2553,14 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, av_opt_get_int(context, "src_v_chr_pos", 0, &src_v_chr_pos); av_opt_get_int(context, "dst_h_chr_pos", 0, &dst_h_chr_pos); av_opt_get_int(context, "dst_v_chr_pos", 0, &dst_v_chr_pos); - sws_freeContext(context); - context = NULL; + sws_freeContext(sws); + sws = NULL; } - if (!context) { - if (!(context = sws_alloc_context())) + if (!sws) { + if (!(sws = sws_alloc_context())) return NULL; + context = sws_internal(sws); context->srcW = srcW; context->srcH = srcH; context->srcFormat = srcFormat; @@ -2567,12 +2576,12 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, av_opt_set_int(context, "dst_h_chr_pos", dst_h_chr_pos, 0); av_opt_set_int(context, "dst_v_chr_pos", dst_v_chr_pos, 0); - if (sws_init_context(context, srcFilter, dstFilter) < 0) { - sws_freeContext(context); + if (sws_init_context(sws, srcFilter, dstFilter) < 0) { + sws_freeContext(sws); return NULL; } } - return context; + return sws; } int ff_range_add(RangeList *rl, unsigned int start, unsigned int len) diff --git a/libswscale/vscale.c b/libswscale/vscale.c index 5b3234198d..9b700ec58e 100644 --- a/libswscale/vscale.c +++ b/libswscale/vscale.c @@ -38,7 +38,7 @@ typedef struct VScalerContext } VScalerContext; -static int lum_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int lum_planar_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { VScalerContext *inst = desc->instance; int dstW = desc->dst->width; @@ -71,7 +71,7 @@ static int lum_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice return 1; } -static int chr_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int chr_planar_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { const int chrSkipMask = (1 << desc->dst->v_chr_sub_sample) - 1; if (sliceY & chrSkipMask) @@ -106,7 +106,7 @@ static int chr_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice return 1; } -static int packed_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int packed_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { VScalerContext *inst = desc->instance; int dstW = desc->dst->width; @@ -170,7 +170,7 @@ static int packed_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, i return 1; } -static int any_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) +static int any_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH) { VScalerContext *inst = desc->instance; int dstW = desc->dst->width; @@ -211,7 +211,7 @@ static int any_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int } -int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst) +int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst) { VScalerContext *lumCtx = NULL; VScalerContext *chrCtx = NULL; @@ -255,7 +255,7 @@ int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsS return 0; } -void ff_init_vscale_pfn(SwsContext *c, +void ff_init_vscale_pfn(SwsInternal *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX, yuv2interleavedX_fn yuv2nv12cX, @@ -319,5 +319,3 @@ void ff_init_vscale_pfn(SwsContext *c, lumCtx->pfn.yuv2anyX = yuv2anyX; } } - - diff --git a/libswscale/x86/hscale_fast_bilinear_simd.c b/libswscale/x86/hscale_fast_bilinear_simd.c index f6409b4fc5..47ca020004 100644 --- a/libswscale/x86/hscale_fast_bilinear_simd.c +++ b/libswscale/x86/hscale_fast_bilinear_simd.c @@ -190,7 +190,7 @@ av_cold int ff_init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode, return fragmentPos + 1; } -void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst, +void ff_hyscale_fast_mmxext(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc) { @@ -280,7 +280,7 @@ void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst, dst[i] = src[srcW-1]*128; } -void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, int16_t *dst2, +void ff_hcscale_fast_mmxext(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc) { diff --git a/libswscale/x86/output.asm b/libswscale/x86/output.asm index 95ec2fa885..0f854e521d 100644 --- a/libswscale/x86/output.asm +++ b/libswscale/x86/output.asm @@ -572,7 +572,7 @@ yuv2nv12cX_fn yuv2nv21 ;----------------------------------------------------------------------------- ; planar grb yuv2anyX functions -; void ff_yuv2_full_X_(SwsContext *c, const int16_t *lumFilter, +; void ff_yuv2_full_X_(SwsInternal *c, const int16_t *lumFilter, ; const int16_t **lumSrcx, int lumFilterSize, ; const int16_t *chrFilter, const int16_t **chrUSrcx, ; const int16_t **chrVSrcx, int chrFilterSize, @@ -581,8 +581,8 @@ yuv2nv12cX_fn yuv2nv21 ;----------------------------------------------------------------------------- %if ARCH_X86_64 -struc SwsContext - .padding: resb 40292 ; offsetof(SwsContext, yuv2rgb_y_offset) +struc SwsInternal + .padding: resb 40292 ; offsetof(SwsInternal, yuv2rgb_y_offset) .yuv2rgb_y_offset: resd 1 .yuv2rgb_y_coeff: resd 1 .yuv2rgb_v2r_coeff: resd 1 @@ -795,12 +795,12 @@ endstruc %endif cglobal yuv2%1_full_X, 12, 14, 16, ptr, lumFilter, lumSrcx, lumFilterSize, chrFilter, chrUSrcx, chrVSrcx, chrFilterSize, alpSrcx, dest, dstW, y, x, j - VBROADCASTSS m10, dword [ptrq + SwsContext.yuv2rgb_y_offset] - VBROADCASTSS m11, dword [ptrq + SwsContext.yuv2rgb_y_coeff] - VBROADCASTSS m12, dword [ptrq + SwsContext.yuv2rgb_v2r_coeff] - VBROADCASTSS m13, dword [ptrq + SwsContext.yuv2rgb_v2g_coeff] - VBROADCASTSS m14, dword [ptrq + SwsContext.yuv2rgb_u2g_coeff] - VBROADCASTSS m15, dword [ptrq + SwsContext.yuv2rgb_u2b_coeff] + VBROADCASTSS m10, dword [ptrq + SwsInternal.yuv2rgb_y_offset] + VBROADCASTSS m11, dword [ptrq + SwsInternal.yuv2rgb_y_coeff] + VBROADCASTSS m12, dword [ptrq + SwsInternal.yuv2rgb_v2r_coeff] + VBROADCASTSS m13, dword [ptrq + SwsInternal.yuv2rgb_v2g_coeff] + VBROADCASTSS m14, dword [ptrq + SwsInternal.yuv2rgb_u2g_coeff] + VBROADCASTSS m15, dword [ptrq + SwsInternal.yuv2rgb_u2b_coeff] %if DEPTH >= 16 movu m9, [pd_yuv2gbrp16_start] diff --git a/libswscale/x86/scale.asm b/libswscale/x86/scale.asm index baf03d52fa..85a96dc57e 100644 --- a/libswscale/x86/scale.asm +++ b/libswscale/x86/scale.asm @@ -33,7 +33,7 @@ SECTION .text ; horizontal line scaling ; ; void hscaleto__ -; (SwsContext *c, int{16,32}_t *dst, +; (SwsInternal *c, int{16,32}_t *dst, ; int dstW, const uint{8,16}_t *src, ; const int16_t *filter, ; const int32_t *filterPos, int filterSize); diff --git a/libswscale/x86/scale_avx2.asm b/libswscale/x86/scale_avx2.asm index 179895666a..b4b852d60b 100644 --- a/libswscale/x86/scale_avx2.asm +++ b/libswscale/x86/scale_avx2.asm @@ -33,7 +33,7 @@ SECTION .text ; horizontal line scaling ; ; void hscale8to15__ -; (SwsContext *c, int16_t *dst, +; (SwsInternal *c, int16_t *dst, ; int dstW, const uint8_t *src, ; const int16_t *filter, ; const int32_t *filterPos, int filterSize); diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 43319fd6b2..16182124c0 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -61,7 +61,7 @@ DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL; #include "swscale_template.c" #endif -void ff_updateMMXDitherTables(SwsContext *c, int dstY) +void ff_updateMMXDitherTables(SwsInternal *c, int dstY) { const int dstH= c->dstH; const int flags= c->flags; @@ -226,7 +226,7 @@ YUV2YUVX_FUNC(avx2, 64) #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ - SwsContext *c, int16_t *data, \ + SwsInternal *c, int16_t *data, \ int dstW, const uint8_t *src, \ const int16_t *filter, \ const int32_t *filterPos, int filterSize) @@ -337,7 +337,7 @@ YUV2NV_DECL(nv12, avx2); YUV2NV_DECL(nv21, avx2); #define YUV2GBRP_FN_DECL(fmt, opt) \ -void ff_yuv2##fmt##_full_X_ ##opt(SwsContext *c, const int16_t *lumFilter, \ +void ff_yuv2##fmt##_full_X_ ##opt(SwsInternal *c, const int16_t *lumFilter, \ const int16_t **lumSrcx, int lumFilterSize, \ const int16_t *chrFilter, const int16_t **chrUSrcx, \ const int16_t **chrVSrcx, int chrFilterSize, \ @@ -472,7 +472,7 @@ void ff_chrRangeToJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \ RANGE_CONVERT_FUNCS_DECL(sse2); RANGE_CONVERT_FUNCS_DECL(avx2); -av_cold void ff_sws_init_range_convert_x86(SwsContext *c) +av_cold void ff_sws_init_range_convert_x86(SwsInternal *c) { if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) { int cpu_flags = av_get_cpu_flags(); @@ -484,7 +484,7 @@ av_cold void ff_sws_init_range_convert_x86(SwsContext *c) } } -av_cold void ff_sws_init_swscale_x86(SwsContext *c) +av_cold void ff_sws_init_swscale_x86(SwsInternal *c) { int cpu_flags = av_get_cpu_flags(); @@ -792,9 +792,9 @@ switch(c->dstBpc){ \ if(c->flags & SWS_FULL_CHR_H_INT) { - /* yuv2gbrp uses the SwsContext for yuv coefficients + /* yuv2gbrp uses the SwsInternal for yuv coefficients if struct offsets change the asm needs to be updated too */ - av_assert0(offsetof(SwsContext, yuv2rgb_y_offset) == 40292); + av_assert0(offsetof(SwsInternal, yuv2rgb_y_offset) == 40292); #define YUV2ANYX_FUNC_CASE(fmt, name, opt) \ case fmt: \ diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 6bff2a44aa..cffafccb24 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -250,7 +250,7 @@ " jb 1b \n\t" #define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) -static void RENAME(yuv2rgb32_X_ar)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2rgb32_X_ar)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -283,7 +283,7 @@ static void RENAME(yuv2rgb32_X_ar)(SwsContext *c, const int16_t *lumFilter, } } -static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2rgb32_X)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -312,7 +312,7 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter, } } -static void RENAME(yuv2bgr32_X)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2bgr32_X)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -369,7 +369,7 @@ static void RENAME(yuv2bgr32_X)(SwsContext *c, const int16_t *lumFilter, " jb 1b \n\t" #define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index) -static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2rgb565_X_ar)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -391,7 +391,7 @@ static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2PACKEDX_END } -static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2rgb565_X)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -442,7 +442,7 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter, " jb 1b \n\t" #define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index) -static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2rgb555_X_ar)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -464,7 +464,7 @@ static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2PACKEDX_END } -static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2rgb555_X)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -591,7 +591,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMXEXT(dst, dstw, index) #if HAVE_6REGS -static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2bgr24_X_ar)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -616,7 +616,7 @@ static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter, ); } -static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2bgr24_X)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -659,7 +659,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter, " jb 1b \n\t" #define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index) -static void RENAME(yuv2yuyv422_X_ar)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2yuyv422_X_ar)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -680,7 +680,7 @@ static void RENAME(yuv2yuyv422_X_ar)(SwsContext *c, const int16_t *lumFilter, YSCALEYUV2PACKEDX_END } -static void RENAME(yuv2yuyv422_X)(SwsContext *c, const int16_t *lumFilter, +static void RENAME(yuv2yuyv422_X)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, @@ -781,7 +781,7 @@ static void RENAME(yuv2yuyv422_X)(SwsContext *c, const int16_t *lumFilter, /** * vertical bilinear scale YV12 to RGB */ -static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2], +static void RENAME(yuv2rgb32_2)(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -845,7 +845,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2], } } -static void RENAME(yuv2bgr24_2)(SwsContext *c, const int16_t *buf[2], +static void RENAME(yuv2bgr24_2)(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -868,7 +868,7 @@ static void RENAME(yuv2bgr24_2)(SwsContext *c, const int16_t *buf[2], ); } -static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2], +static void RENAME(yuv2rgb555_2)(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -895,7 +895,7 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2], ); } -static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2], +static void RENAME(yuv2rgb565_2)(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -962,7 +962,7 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2], #define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c) -static void RENAME(yuv2yuyv422_2)(SwsContext *c, const int16_t *buf[2], +static void RENAME(yuv2yuyv422_2)(SwsInternal *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) @@ -1101,7 +1101,7 @@ static void RENAME(yuv2yuyv422_2)(SwsContext *c, const int16_t *buf[2], /** * YV12 to RGB without scaling or interpolating */ -static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, +static void RENAME(yuv2rgb32_1)(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -1170,7 +1170,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, } } -static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0, +static void RENAME(yuv2bgr24_1)(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -1211,7 +1211,7 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0, } } -static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0, +static void RENAME(yuv2rgb555_1)(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -1260,7 +1260,7 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0, } } -static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0, +static void RENAME(yuv2rgb565_1)(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -1346,7 +1346,7 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0, "psraw $7, %%mm7 \n\t" #define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c) -static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0, +static void RENAME(yuv2yuyv422_1)(SwsInternal *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) @@ -1382,7 +1382,7 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0, ); } } -static av_cold void RENAME(sws_init_swscale)(SwsContext *c) +static av_cold void RENAME(sws_init_swscale)(SwsInternal *c) { enum AVPixelFormat dstFormat = c->dstFormat; diff --git a/libswscale/x86/w64xmmtest.c b/libswscale/x86/w64xmmtest.c index 88143d9687..d405a0eab4 100644 --- a/libswscale/x86/w64xmmtest.c +++ b/libswscale/x86/w64xmmtest.c @@ -22,7 +22,7 @@ #include "libavutil/x86/w64xmmtest.h" #include "libswscale/swscale.h" -wrap(sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], +wrap(sws_scale(SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])) { diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c index 3ee13304fd..93a6b9a6e2 100644 --- a/libswscale/x86/yuv2rgb.c +++ b/libswscale/x86/yuv2rgb.c @@ -86,7 +86,7 @@ extern void ff_yuv_420_gbrp24_ssse3(x86_reg index, uint8_t *image, uint8_t *dst_ const uint8_t *py_2index); #endif -static inline int yuv420_rgb15_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_rgb15_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -104,7 +104,7 @@ static inline int yuv420_rgb15_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuv420_rgb16_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_rgb16_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -122,7 +122,7 @@ static inline int yuv420_rgb16_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuv420_rgb32_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_rgb32_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -136,7 +136,7 @@ static inline int yuv420_rgb32_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuv420_bgr32_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_bgr32_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -150,7 +150,7 @@ static inline int yuv420_bgr32_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuva420_rgb32_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuva420_rgb32_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -164,7 +164,7 @@ static inline int yuva420_rgb32_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuva420_bgr32_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuva420_bgr32_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -179,7 +179,7 @@ static inline int yuva420_bgr32_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuv420_rgb24_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_rgb24_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -193,7 +193,7 @@ static inline int yuv420_rgb24_ssse3(SwsContext *c, const uint8_t *const src[], return srcSliceH; } -static inline int yuv420_bgr24_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_bgr24_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -208,7 +208,7 @@ static inline int yuv420_bgr24_ssse3(SwsContext *c, const uint8_t *const src[], } #if ARCH_X86_64 -static inline int yuv420_gbrp_ssse3(SwsContext *c, const uint8_t *const src[], +static inline int yuv420_gbrp_ssse3(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) @@ -238,7 +238,7 @@ static inline int yuv420_gbrp_ssse3(SwsContext *c, const uint8_t *const src[], #endif /* HAVE_X86ASM */ -av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c) +av_cold SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c) { #if HAVE_X86ASM int cpu_flags = av_get_cpu_flags(); diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 941971d1ab..f4fa1c0549 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -135,7 +135,7 @@ const int *sws_getCoefficients(int colorspace) dst2_##l[2 * i + 1] = r[Y]; #define YUV2RGBFUNC(func_name, dst_type, alpha, yuv422, nb_dst_planes) \ - static int func_name(SwsContext *c, const uint8_t *const src[], \ + static int func_name(SwsInternal *c, const uint8_t *const src[], \ const int srcStride[], int srcSliceY, int srcSliceH, \ uint8_t *const dst[], const int dstStride[]) \ { \ @@ -558,7 +558,7 @@ YUV422FUNC_DITHER(yuv422p_bgr8, uint8_t, LOADDITHER8, PUTRGB8, 8) YUV422FUNC_DITHER(yuv422p_bgr4, uint8_t, LOADDITHER4D, PUTRGB4D, 4) YUV422FUNC_DITHER(yuv422p_bgr4_byte, uint8_t, LOADDITHER4DB, PUTRGB4DB, 8) -SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) +SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c) { SwsFunc t = NULL; @@ -702,7 +702,7 @@ static uint16_t roundToInt16(int64_t f) return r; } -av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], +av_cold int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) { diff --git a/tests/checkasm/sw_gbrp.c b/tests/checkasm/sw_gbrp.c index d843730f3e..039be8006b 100644 --- a/tests/checkasm/sw_gbrp.c +++ b/tests/checkasm/sw_gbrp.c @@ -63,7 +63,8 @@ static const int planar_fmts[] = { static void check_output_yuv2gbrp(void) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; const AVPixFmtDescriptor *desc; int fmi, fsi, isi, i; int dstW, byte_size, luma_filter_size, chr_filter_size; @@ -76,7 +77,7 @@ static void check_output_yuv2gbrp(void) uint8_t *dst0[4]; uint8_t *dst1[4]; - declare_func(void, struct SwsContext *c, const int16_t *lumFilter, + declare_func(void, SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrcx, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrcx, const int16_t **chrVSrcx, int chrFilterSize, @@ -130,17 +131,18 @@ static void check_output_yuv2gbrp(void) alpha[i] = (int16_t *)(src_a + i*LARGEST_INPUT_SIZE); } - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); - ctx->flags |= SWS_FULL_CHR_H_INT; + c = sws_internal(sws); + c->flags |= SWS_FULL_CHR_H_INT; for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { for (fsi = 0; fsi < FILTER_SIZES; fsi++) { for (isi = 0; isi < INPUT_SIZES; isi++ ) { desc = av_pix_fmt_desc_get(planar_fmts[fmi]); - ctx->dstFormat = planar_fmts[fmi]; + c->dstFormat = planar_fmts[fmi]; dstW = input_sizes[isi]; luma_filter_size = filter_sizes[fsi]; @@ -154,17 +156,17 @@ static void check_output_yuv2gbrp(void) byte_size = 1; } - ff_sws_init_scale(ctx); - if (check_func(ctx->yuv2anyX, "yuv2%s_full_X_%d_%d", desc->name, luma_filter_size, dstW)) { + ff_sws_init_scale(c); + if (check_func(c->yuv2anyX, "yuv2%s_full_X_%d_%d", desc->name, luma_filter_size, dstW)) { for (i = 0; i < 4; i ++) { memset(dst0[i], 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); memset(dst1[i], 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); } - call_ref(ctx, luma_filter, luma, luma_filter_size, + call_ref(c, luma_filter, luma, luma_filter_size, chr_filter, chru, chrv, chr_filter_size, alpha, dst0, dstW, 0); - call_new(ctx, luma_filter, luma, luma_filter_size, + call_new(c, luma_filter, luma, luma_filter_size, chr_filter, chru, chrv, chr_filter_size, alpha, dst1, dstW, 0); @@ -174,14 +176,14 @@ static void check_output_yuv2gbrp(void) memcmp(dst0[3], dst1[3], dstW * byte_size) ) fail(); - bench_new(ctx, luma_filter, luma, luma_filter_size, + bench_new(c, luma_filter, luma, luma_filter_size, chr_filter, chru, chrv, chr_filter_size, alpha, dst1, dstW, 0); } } } } - sws_freeContext(ctx); + sws_freeContext(sws); } #undef LARGEST_INPUT_SIZE @@ -189,7 +191,8 @@ static void check_output_yuv2gbrp(void) static void check_input_planar_rgb_to_y(void) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; const AVPixFmtDescriptor *desc; int fmi, isi; int dstW, byte_size; @@ -221,20 +224,21 @@ static void check_input_planar_rgb_to_y(void) src[2] = (uint8_t*)src_r; src[3] = (uint8_t*)src_a; - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); + c = sws_internal(sws); for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { for (isi = 0; isi < INPUT_SIZES; isi++ ) { desc = av_pix_fmt_desc_get(planar_fmts[fmi]); - ctx->srcFormat = planar_fmts[fmi]; - ctx->dstFormat = AV_PIX_FMT_YUVA444P16; + c->srcFormat = planar_fmts[fmi]; + c->dstFormat = AV_PIX_FMT_YUVA444P16; byte_size = 2; dstW = input_sizes[isi]; - ff_sws_init_scale(ctx); - if(check_func(ctx->readLumPlanar, "planar_%s_to_y_%d", desc->name, dstW)) { + ff_sws_init_scale(c); + if(check_func(c->readLumPlanar, "planar_%s_to_y_%d", desc->name, dstW)) { memset(dst0_y, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); memset(dst1_y, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); @@ -249,7 +253,7 @@ static void check_input_planar_rgb_to_y(void) } } } - sws_freeContext(ctx); + sws_freeContext(sws); } #undef LARGEST_INPUT_SIZE @@ -257,7 +261,8 @@ static void check_input_planar_rgb_to_y(void) static void check_input_planar_rgb_to_uv(void) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; const AVPixFmtDescriptor *desc; int fmi, isi; int dstW, byte_size; @@ -292,20 +297,21 @@ static void check_input_planar_rgb_to_uv(void) src[2] = (uint8_t*)src_r; src[3] = (uint8_t*)src_a; - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); + c = sws_internal(sws); for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { for (isi = 0; isi < INPUT_SIZES; isi++ ) { desc = av_pix_fmt_desc_get(planar_fmts[fmi]); - ctx->srcFormat = planar_fmts[fmi]; - ctx->dstFormat = AV_PIX_FMT_YUVA444P16; + c->srcFormat = planar_fmts[fmi]; + c->dstFormat = AV_PIX_FMT_YUVA444P16; byte_size = 2; dstW = input_sizes[isi]; - ff_sws_init_scale(ctx); - if(check_func(ctx->readChrPlanar, "planar_%s_to_uv_%d", desc->name, dstW)) { + ff_sws_init_scale(c); + if(check_func(c->readChrPlanar, "planar_%s_to_uv_%d", desc->name, dstW)) { memset(dst0_u, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); memset(dst0_v, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); memset(dst1_u, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t)); @@ -322,7 +328,7 @@ static void check_input_planar_rgb_to_uv(void) } } } - sws_freeContext(ctx); + sws_freeContext(sws); } #undef LARGEST_INPUT_SIZE @@ -330,7 +336,8 @@ static void check_input_planar_rgb_to_uv(void) static void check_input_planar_rgb_to_a(void) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; const AVPixFmtDescriptor *desc; int fmi, isi; int dstW, byte_size; @@ -362,23 +369,24 @@ static void check_input_planar_rgb_to_a(void) src[2] = (uint8_t*)src_r; src[3] = (uint8_t*)src_a; - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); + c = sws_internal(sws); for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) { for (isi = 0; isi < INPUT_SIZES; isi++ ) { desc = av_pix_fmt_desc_get(planar_fmts[fmi]); if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)) continue; - ctx->srcFormat = planar_fmts[fmi]; - ctx->dstFormat = AV_PIX_FMT_YUVA444P16; + c->srcFormat = planar_fmts[fmi]; + c->dstFormat = AV_PIX_FMT_YUVA444P16; byte_size = 2; dstW = input_sizes[isi]; - ff_sws_init_scale(ctx); - if(check_func(ctx->readAlpPlanar, "planar_%s_to_a_%d", desc->name, dstW)) { + ff_sws_init_scale(c); + if(check_func(c->readAlpPlanar, "planar_%s_to_a_%d", desc->name, dstW)) { memset(dst0_a, 0x00, LARGEST_INPUT_SIZE * sizeof(int32_t)); memset(dst1_a, 0x00, LARGEST_INPUT_SIZE * sizeof(int32_t)); @@ -391,7 +399,7 @@ static void check_input_planar_rgb_to_a(void) } } } - sws_freeContext(ctx); + sws_freeContext(sws); } void checkasm_check_sw_gbrp(void) diff --git a/tests/checkasm/sw_range_convert.c b/tests/checkasm/sw_range_convert.c index 08029103d1..7da29b896e 100644 --- a/tests/checkasm/sw_range_convert.c +++ b/tests/checkasm/sw_range_convert.c @@ -34,21 +34,23 @@ static void check_lumConvertRange(int from) #define LARGEST_INPUT_SIZE 512 #define INPUT_SIZES 6 static const int input_sizes[] = {8, 24, 128, 144, 256, 512}; - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; LOCAL_ALIGNED_32(int16_t, dst0, [LARGEST_INPUT_SIZE]); LOCAL_ALIGNED_32(int16_t, dst1, [LARGEST_INPUT_SIZE]); declare_func(void, int16_t *dst, int width); - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); - ctx->srcFormat = from ? AV_PIX_FMT_YUVJ444P : AV_PIX_FMT_YUV444P; - ctx->dstFormat = from ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; - ctx->srcRange = from; - ctx->dstRange = !from; + c = sws_internal(sws); + c->srcFormat = from ? AV_PIX_FMT_YUVJ444P : AV_PIX_FMT_YUV444P; + c->dstFormat = from ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; + c->srcRange = from; + c->dstRange = !from; for (int dstWi = 0; dstWi < INPUT_SIZES; dstWi++) { int width = input_sizes[dstWi]; @@ -57,8 +59,8 @@ static void check_lumConvertRange(int from) dst0[i] = (int16_t) r << 7; dst1[i] = (int16_t) r << 7; } - ff_sws_init_scale(ctx); - if (check_func(ctx->lumConvertRange, "%s_%d", func_str, width)) { + ff_sws_init_scale(c); + if (check_func(c->lumConvertRange, "%s_%d", func_str, width)) { call_ref(dst0, width); call_new(dst1, width); if (memcmp(dst0, dst1, width * sizeof(int16_t))) @@ -67,7 +69,7 @@ static void check_lumConvertRange(int from) } } - sws_freeContext(ctx); + sws_freeContext(sws); } #undef LARGEST_INPUT_SIZE #undef INPUT_SIZES @@ -78,7 +80,8 @@ static void check_chrConvertRange(int from) #define LARGEST_INPUT_SIZE 512 #define INPUT_SIZES 6 static const int input_sizes[] = {8, 24, 128, 144, 256, 512}; - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; LOCAL_ALIGNED_32(int16_t, dstU0, [LARGEST_INPUT_SIZE]); LOCAL_ALIGNED_32(int16_t, dstV0, [LARGEST_INPUT_SIZE]); @@ -87,14 +90,15 @@ static void check_chrConvertRange(int from) declare_func(void, int16_t *dstU, int16_t *dstV, int width); - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); - ctx->srcFormat = from ? AV_PIX_FMT_YUVJ444P : AV_PIX_FMT_YUV444P; - ctx->dstFormat = from ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; - ctx->srcRange = from; - ctx->dstRange = !from; + c = sws_internal(sws); + c->srcFormat = from ? AV_PIX_FMT_YUVJ444P : AV_PIX_FMT_YUV444P; + c->dstFormat = from ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; + c->srcRange = from; + c->dstRange = !from; for (int dstWi = 0; dstWi < INPUT_SIZES; dstWi++) { int width = input_sizes[dstWi]; @@ -105,8 +109,8 @@ static void check_chrConvertRange(int from) dstU1[i] = (int16_t) r << 7; dstV1[i] = (int16_t) r << 7; } - ff_sws_init_scale(ctx); - if (check_func(ctx->chrConvertRange, "%s_%d", func_str, width)) { + ff_sws_init_scale(c); + if (check_func(c->chrConvertRange, "%s_%d", func_str, width)) { call_ref(dstU0, dstV0, width); call_new(dstU1, dstV1, width); if (memcmp(dstU0, dstU1, width * sizeof(int16_t)) || @@ -116,7 +120,7 @@ static void check_chrConvertRange(int from) } } - sws_freeContext(ctx); + sws_freeContext(sws); } #undef LARGEST_INPUT_SIZE #undef INPUT_SIZES diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c index cdd43df8ba..7af82f0fc7 100644 --- a/tests/checkasm/sw_rgb.c +++ b/tests/checkasm/sw_rgb.c @@ -127,7 +127,7 @@ static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int a return 0; } -static void check_rgb24toyv12(struct SwsContext *ctx) +static void check_rgb24toyv12(SwsInternal *ctx) { static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, -MAX_LINE_SIZE}; @@ -353,7 +353,7 @@ static const enum AVPixelFormat rgb_formats[] = { AV_PIX_FMT_ARGB, }; -static void check_rgb_to_y(struct SwsContext *ctx) +static void check_rgb_to_y(SwsInternal *ctx) { LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]); LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]); @@ -396,7 +396,7 @@ static void check_rgb_to_y(struct SwsContext *ctx) } } -static void check_rgb_to_uv(struct SwsContext *ctx) +static void check_rgb_to_uv(SwsInternal *ctx) { LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]); LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]); @@ -450,7 +450,8 @@ static void check_rgb_to_uv(struct SwsContext *ctx) void checkasm_check_sw_rgb(void) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; ff_sws_rgb2rgb_init(); @@ -478,20 +479,21 @@ void checkasm_check_sw_rgb(void) check_deinterleave_bytes(); report("deinterleave_bytes"); - ctx = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_RGB24, + sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_RGB24, MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P, SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL); - if (!ctx) + if (!sws) fail(); - check_rgb_to_y(ctx); + c = sws_internal(sws); + check_rgb_to_y(c); report("rgb_to_y"); - check_rgb_to_uv(ctx); + check_rgb_to_uv(c); report("rgb_to_uv"); - check_rgb24toyv12(ctx); + check_rgb24toyv12(c); report("rgb24toyv12"); - sws_freeContext(ctx); + sws_freeContext(sws); } diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c index 32a5d1c1ac..b383fa0930 100644 --- a/tests/checkasm/sw_scale.c +++ b/tests/checkasm/sw_scale.c @@ -99,7 +99,8 @@ static size_t show_differences(uint8_t *a, uint8_t *b, size_t len) static void check_yuv2yuv1(int accurate) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; int osi, isi; int dstW, offset; size_t fail_offset; @@ -122,18 +123,19 @@ static void check_yuv2yuv1(int accurate) randomize_buffers((uint8_t*)dither, 8); randomize_buffers((uint8_t*)src_pixels, LARGEST_INPUT_SIZE * sizeof(int16_t)); - ctx = sws_alloc_context(); + sws = sws_alloc_context(); + c = sws_internal(sws); if (accurate) - ctx->flags |= SWS_ACCURATE_RND; - if (sws_init_context(ctx, NULL, NULL) < 0) + c->flags |= SWS_ACCURATE_RND; + if (sws_init_context(sws, NULL, NULL) < 0) fail(); - ff_sws_init_scale(ctx); + ff_sws_init_scale(c); for (isi = 0; isi < INPUT_SIZES; ++isi) { dstW = input_sizes[isi]; for (osi = 0; osi < OFFSET_SIZES; osi++) { offset = offsets[osi]; - if (check_func(ctx->yuv2plane1, "yuv2yuv1_%d_%d_%s", offset, dstW, accurate_str)){ + if (check_func(c->yuv2plane1, "yuv2yuv1_%d_%d_%s", offset, dstW, accurate_str)){ memset(dst0, 0, LARGEST_INPUT_SIZE * sizeof(dst0[0])); memset(dst1, 0, LARGEST_INPUT_SIZE * sizeof(dst1[0])); @@ -154,12 +156,13 @@ static void check_yuv2yuv1(int accurate) } } } - sws_freeContext(ctx); + sws_freeContext(sws); } static void check_yuv2yuvX(int accurate) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; int fsi, osi, isi, i, j; int dstW; #define LARGEST_FILTER 16 @@ -188,13 +191,14 @@ static void check_yuv2yuvX(int accurate) uint8_t d_val = rnd(); memset(dither, d_val, LARGEST_INPUT_SIZE); randomize_buffers((uint8_t*)src_pixels, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int16_t)); - ctx = sws_alloc_context(); + sws = sws_alloc_context(); + c = sws_internal(sws); if (accurate) - ctx->flags |= SWS_ACCURATE_RND; - if (sws_init_context(ctx, NULL, NULL) < 0) + c->flags |= SWS_ACCURATE_RND; + if (sws_init_context(sws, NULL, NULL) < 0) fail(); - ff_sws_init_scale(ctx); + ff_sws_init_scale(c); for(isi = 0; isi < INPUT_SIZES; ++isi){ dstW = input_sizes[isi]; for(osi = 0; osi < 64; osi += 16){ @@ -225,9 +229,9 @@ static void check_yuv2yuvX(int accurate) for(j = 0; j < 4; ++j) vFilterData[i].coeff[j + 4] = filter_coeff[i]; } - if (check_func(ctx->yuv2planeX, "yuv2yuvX_%d_%d_%d_%s", filter_sizes[fsi], osi, dstW, accurate_str)){ + if (check_func(c->yuv2planeX, "yuv2yuvX_%d_%d_%d_%s", filter_sizes[fsi], osi, dstW, accurate_str)){ // use vFilterData for the mmx function - const int16_t *filter = ctx->use_mmx_vfilter ? (const int16_t*)vFilterData : &filter_coeff[0]; + const int16_t *filter = c->use_mmx_vfilter ? (const int16_t*)vFilterData : &filter_coeff[0]; memset(dst0, 0, LARGEST_INPUT_SIZE * sizeof(dst0[0])); memset(dst1, 0, LARGEST_INPUT_SIZE * sizeof(dst1[0])); @@ -250,7 +254,7 @@ static void check_yuv2yuvX(int accurate) } } } - sws_freeContext(ctx); + sws_freeContext(sws); #undef FILTER_SIZES } @@ -274,7 +278,8 @@ static void check_hscale(void) static const int input_sizes[INPUT_SIZES] = {8, 24, 128, 144, 256, 512}; int i, j, fsi, hpi, width, dstWi; - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; // padded LOCAL_ALIGNED_32(uint8_t, src, [FFALIGN(SRC_PIXELS + MAX_FILTER_WIDTH - 1, 4)]); @@ -293,10 +298,11 @@ static void check_hscale(void) const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); - ctx = sws_alloc_context(); - if (sws_init_context(ctx, NULL, NULL) < 0) + sws = sws_alloc_context(); + if (sws_init_context(sws, NULL, NULL) < 0) fail(); + c = sws_internal(sws); randomize_buffers(src, SRC_PIXELS + MAX_FILTER_WIDTH - 1); for (hpi = 0; hpi < HSCALE_PAIRS; hpi++) { @@ -304,9 +310,9 @@ static void check_hscale(void) for (dstWi = 0; dstWi < INPUT_SIZES; dstWi++) { width = filter_sizes[fsi]; - ctx->srcBpc = hscale_pairs[hpi][0]; - ctx->dstBpc = hscale_pairs[hpi][1]; - ctx->hLumFilterSize = ctx->hChrFilterSize = width; + c->srcBpc = hscale_pairs[hpi][0]; + c->dstBpc = hscale_pairs[hpi][1]; + c->hLumFilterSize = c->hChrFilterSize = width; for (i = 0; i < SRC_PIXELS; i++) { filterPos[i] = i; @@ -338,25 +344,25 @@ static void check_hscale(void) filter[SRC_PIXELS * width + i] = rnd(); } - ctx->dstW = ctx->chrDstW = input_sizes[dstWi]; - ff_sws_init_scale(ctx); + c->dstW = c->chrDstW = input_sizes[dstWi]; + ff_sws_init_scale(c); memcpy(filterAvx2, filter, sizeof(uint16_t) * (SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH)); - ff_shuffle_filter_coefficients(ctx, filterPosAvx, width, filterAvx2, ctx->dstW); + ff_shuffle_filter_coefficients(c, filterPosAvx, width, filterAvx2, c->dstW); - if (check_func(ctx->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", ctx->srcBpc, ctx->dstBpc + 1, width, ctx->dstW)) { + if (check_func(c->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", c->srcBpc, c->dstBpc + 1, width, c->dstW)) { memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0])); memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0])); - call_ref(NULL, dst0, ctx->dstW, src, filter, filterPos, width); - call_new(NULL, dst1, ctx->dstW, src, filterAvx2, filterPosAvx, width); - if (memcmp(dst0, dst1, ctx->dstW * sizeof(dst0[0]))) + call_ref(NULL, dst0, c->dstW, src, filter, filterPos, width); + call_new(NULL, dst1, c->dstW, src, filterAvx2, filterPosAvx, width); + if (memcmp(dst0, dst1, c->dstW * sizeof(dst0[0]))) fail(); - bench_new(NULL, dst0, ctx->dstW, src, filter, filterPosAvx, width); + bench_new(NULL, dst0, c->dstW, src, filter, filterPosAvx, width); } } } } - sws_freeContext(ctx); + sws_freeContext(sws); } void checkasm_check_sw_scale(void) diff --git a/tests/checkasm/sw_yuv2rgb.c b/tests/checkasm/sw_yuv2rgb.c index 5125f83968..c25fb99ca2 100644 --- a/tests/checkasm/sw_yuv2rgb.c +++ b/tests/checkasm/sw_yuv2rgb.c @@ -107,7 +107,7 @@ static void check_yuv2rgb(int src_pix_fmt) static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, - int, SwsContext *c, const uint8_t *src[], + int, SwsInternal *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]); @@ -147,7 +147,8 @@ static void check_yuv2rgb(int src_pix_fmt) const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt); int sample_size = av_get_padded_bits_per_pixel(dst_desc) >> 3; for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; int log_level; int width = input_sizes[isi]; int srcSliceY = 0; @@ -168,14 +169,15 @@ static void check_yuv2rgb(int src_pix_fmt) // "No accelerated colorspace conversion found from %s to %s" log_level = av_log_get_level(); av_log_set_level(AV_LOG_ERROR); - ctx = sws_getContext(width, srcSliceH, src_pix_fmt, + sws = sws_getContext(width, srcSliceH, src_pix_fmt, width, srcSliceH, dst_pix_fmt, 0, NULL, NULL, NULL); av_log_set_level(log_level); - if (!ctx) + if (!sws) fail(); - if (check_func(ctx->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) { + c = sws_internal(sws); + if (check_func(c->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) { memset(dst0_0, 0xFF, 2 * MAX_LINE_SIZE * 6); memset(dst1_0, 0xFF, 2 * MAX_LINE_SIZE * 6); if (dst_pix_fmt == AV_PIX_FMT_GBRP) { @@ -185,9 +187,9 @@ static void check_yuv2rgb(int src_pix_fmt) memset(dst1_2, 0xFF, MAX_LINE_SIZE); } - call_ref(ctx, src, srcStride, srcSliceY, + call_ref(c, src, srcStride, srcSliceY, srcSliceH, dst0, dstStride); - call_new(ctx, src, srcStride, srcSliceY, + call_new(c, src, srcStride, srcSliceY, srcSliceH, dst1, dstStride); if (dst_pix_fmt == AV_PIX_FMT_ARGB || @@ -218,10 +220,10 @@ static void check_yuv2rgb(int src_pix_fmt) fail(); } - bench_new(ctx, src, srcStride, srcSliceY, + bench_new(c, src, srcStride, srcSliceY, srcSliceH, dst0, dstStride); } - sws_freeContext(ctx); + sws_freeContext(sws); } } } diff --git a/tests/checkasm/sw_yuv2yuv.c b/tests/checkasm/sw_yuv2yuv.c index 90a51601ed..6fe8e47d19 100644 --- a/tests/checkasm/sw_yuv2yuv.c +++ b/tests/checkasm/sw_yuv2yuv.c @@ -46,7 +46,7 @@ static void check_semiplanar(int dst_pix_fmt) static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, - int, SwsContext *c, const uint8_t *src[], + int, SwsInternal *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]); @@ -71,7 +71,8 @@ static void check_semiplanar(int dst_pix_fmt) int src_pix_fmt = src_fmts[sfi]; const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt); for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) { - struct SwsContext *ctx; + SwsContext *sws; + SwsInternal *c; int log_level; int width = input_sizes[isi]; int srcSliceY = 0; @@ -90,14 +91,15 @@ static void check_semiplanar(int dst_pix_fmt) // "No accelerated colorspace conversion found from %s to %s" log_level = av_log_get_level(); av_log_set_level(AV_LOG_ERROR); - ctx = sws_getContext(width, srcSliceH, src_pix_fmt, + sws = sws_getContext(width, srcSliceH, src_pix_fmt, width, srcSliceH, dst_pix_fmt, 0, NULL, NULL, NULL); av_log_set_level(log_level); - if (!ctx) + if (!sws) fail(); - if (check_func(ctx->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) { + c = sws_internal(sws); + if (check_func(c->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) { memset(dst0_y, 0xFF, MAX_LINE_SIZE * NUM_LINES); memset(dst0_u, 0xFF, MAX_LINE_SIZE * NUM_LINES / 2); memset(dst0_v, 0xFF, MAX_LINE_SIZE * NUM_LINES / 2); @@ -105,9 +107,9 @@ static void check_semiplanar(int dst_pix_fmt) memset(dst1_u, 0xFF, MAX_LINE_SIZE * NUM_LINES / 2); memset(dst1_v, 0xFF, MAX_LINE_SIZE * NUM_LINES / 2); - call_ref(ctx, src, srcStride, srcSliceY, + call_ref(c, src, srcStride, srcSliceY, srcSliceH, dst0, dstStride); - call_new(ctx, src, srcStride, srcSliceY, + call_new(c, src, srcStride, srcSliceY, srcSliceH, dst1, dstStride); if (memcmp(dst0_y, dst1_y, MAX_LINE_SIZE * NUM_LINES) || @@ -115,10 +117,10 @@ static void check_semiplanar(int dst_pix_fmt) memcmp(dst0_v, dst1_v, MAX_LINE_SIZE * NUM_LINES / 2)) fail(); - bench_new(ctx, src, srcStride, srcSliceY, + bench_new(c, src, srcStride, srcSliceY, srcSliceH, dst0, dstStride); } - sws_freeContext(ctx); + sws_freeContext(sws); } } }