From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1E25D47F83 for ; Tue, 4 Jun 2024 13:59:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 572D868D6FB; Tue, 4 Jun 2024 16:58:59 +0300 (EEST) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5AD0968D605 for ; Tue, 4 Jun 2024 16:58:52 +0300 (EEST) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2c210d3dc6cso867469a91.3 for ; Tue, 04 Jun 2024 06:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717509530; x=1718114330; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=SdYqBnvTP2rKjR92h3DEB5pQhzckmFbmteLJENTLjSg=; b=EztShDVivP14chs1mLP0tO8NsU2jAlC+bh74LcuxBDvnRtBMojwFiAsr6CtdyUNgh1 IYX1yfeQECx2hch4ACs0WB1yyiYx4nPnpTJbwx4qKDy4davwkgizUkDH7ieEksr6U9eT OOupkiQUWzYAaCwxlo4y8exNvyUUl3QY9dbATRrmb5qxddjWCrXenwW04Vz03quuwg0N 3i7ro719u0/DpC65OpdLjFqzpF5sMlFhxS97xktV+6tcMBiOboX8BDa1dDam4BqvsYia bEKW/Kx46M57M754bjPpVCO8kYgLrqo7WA1f36DoSVR2qM1K53iu67GkdjJEbUXJnoFZ c39A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717509530; x=1718114330; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SdYqBnvTP2rKjR92h3DEB5pQhzckmFbmteLJENTLjSg=; b=k3WP9ljamxBoKC39nwyQwMI9g46tYhUdMSzPm4UhEj0R61pqI7mrd3lkiYjwe9h1Hz CtXoTpFto59U2kfXi9d+Mhvt9IGVm+Df1dy/ub3R+eqcNoKsB+L2JKjoDKPfn2qUpXPm PRw0hznVLafzPlF5JerDFHWpdNhrIxtLCDjSZsPs+j26Mld2O0uz5rquPKJFA8z9UArU y+buNJbvVAW7YhNfvEM/7bvZNiVV2kjB241RSFaq41KRaUfg1cbCx1O4KrVjCKCe9fnt Ehecn6sp9x6f22DuYuC4XzxGoES0H80N1OVIstNUezPmlnjVxppv8bgX/jwcMAmAnbx2 L9CA== X-Gm-Message-State: AOJu0Yzc56SCDnUJQxVtdJxArLKGimnQvWaYdVHxTl/cFI6uj/Ac3noB qL2BQ+BoFGfajWmShJLckPEdET3t1QtmolnCmdkW3vxsFNjGal40qD63nw== X-Google-Smtp-Source: AGHT+IEra04f2CRENJAwV/WAyLRt854vmvzpJl8sXkqsBwbWUS5Ubq11iv5xADlCOeOXbxPq5sh05w== X-Received: by 2002:a17:90a:d707:b0:2ae:78cd:59fe with SMTP id 98e67ed59e1d1-2c1dc5c867emr11094530a91.31.1717509529468; Tue, 04 Jun 2024 06:58:49 -0700 (PDT) Received: from [192.168.0.16] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1ad4e53cdsm9579069a91.26.2024.06.04.06.58.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jun 2024 06:58:49 -0700 (PDT) Message-ID: Date: Tue, 4 Jun 2024 10:58:56 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 1/5] checkasm/sw_rgb: test rgb24 to yuv 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 6/4/2024 10:55 AM, Zhao Zhili wrote: > From: Zhao Zhili > > --- > tests/checkasm/sw_rgb.c | 103 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 103 insertions(+) > > diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c > index 7cd815e5be..cc9b957461 100644 > --- a/tests/checkasm/sw_rgb.c > +++ b/tests/checkasm/sw_rgb.c > @@ -24,6 +24,8 @@ > #include "libavutil/mem_internal.h" > > #include "libswscale/rgb2rgb.h" > +#include "libswscale/swscale.h" > +#include "libswscale/swscale_internal.h" > > #include "checkasm.h" > > @@ -179,8 +181,89 @@ static void check_interleave_bytes(void) > } > } > > +#define MAX_LINE_SIZE 1920 > + > +static void check_rgb_to_y(struct SwsContext *ctx) > +{ > + static const int input_sizes[] = {8, 128, 1280, 1080, MAX_LINE_SIZE}; > + > + LOCAL_ALIGNED_32(uint8_t, src, [MAX_LINE_SIZE * 3]); > + LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]); > + LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]); > + > + declare_func(void, uint8_t *dst, const uint8_t *src, > + const uint8_t *unused1, const uint8_t *unused2, int width, > + uint32_t *rgb2yuv, void *opq); > + > + randomize_buffers(src, MAX_LINE_SIZE * 3); > + > + for (int i = 0; i < FF_ARRAY_ELEMS(input_sizes); i++) { > + int w = input_sizes[i]; > + > + if (check_func(ctx->lumToYV12, "rgb24_to_y_%d", w)) { > + memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2); > + memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2); > + > + call_ref(dst0_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); > + call_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); > + > + if (memcmp(dst0_y, dst1_y, w * 2)) > + fail(); > + > + bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL); > + } > + } > +} > + > +static void check_rgb_to_uv(struct SwsContext *ctx) > +{ > + static const int input_sizes[] = {8, 128, 1280, 1080, MAX_LINE_SIZE}; > + > + LOCAL_ALIGNED_32(uint8_t, src, [MAX_LINE_SIZE * 3]); > + LOCAL_ALIGNED_32(uint8_t, dst0_u, [MAX_LINE_SIZE * 2]); > + LOCAL_ALIGNED_32(uint8_t, dst0_v, [MAX_LINE_SIZE * 2]); > + LOCAL_ALIGNED_32(uint8_t, dst1_u, [MAX_LINE_SIZE * 2]); > + LOCAL_ALIGNED_32(uint8_t, dst1_v, [MAX_LINE_SIZE * 2]); > + > + declare_func(void, uint8_t *dstU, uint8_t *dstV, > + const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, > + int width, uint32_t *pal, void *opq); > + > + randomize_buffers(src, MAX_LINE_SIZE * 3); > + > + for (int i = 0; i < 2; i++) { > + ctx->chrSrcHSubSample = i ? 1 : 0; > + ctx->srcFormat = AV_PIX_FMT_RGB24; > + ctx->dstFormat = i ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P; > + ff_sws_init_scale(ctx); > + > + for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) { > + int w = input_sizes[j] >> i; > + > + if (check_func(ctx->chrToYV12, "rgb24_to_uv%s_%d", i ? "_half" : "", w)) { > + memset(dst0_u, 0xFF, MAX_LINE_SIZE * 2); > + memset(dst0_v, 0xFF, MAX_LINE_SIZE * 2); > + memset(dst1_u, 0xFF, MAX_LINE_SIZE * 2); > + memset(dst1_v, 0xFF, MAX_LINE_SIZE * 2); > + > + call_ref(dst0_u, dst0_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); > + call_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); > + > + if (memcmp(dst0_u, dst1_u, w * 2) || memcmp(dst0_v, dst1_v, w * 2)) > + fail(); > + > + bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL); > + } > + } > + } > +} > + > void checkasm_check_sw_rgb(void) > { > + struct SwsContext *ctx; > + int *inv_table, *table; > + int in_full, out_full, brightness, contrast, saturation; > + > ff_sws_rgb2rgb_init(); > > check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103"); > @@ -203,4 +286,24 @@ void checkasm_check_sw_rgb(void) > > check_interleave_bytes(); > report("interleave_bytes"); > + > + ctx = 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) > + fail(); > + > + sws_getColorspaceDetails(ctx, &inv_table, &in_full, > + &table, &out_full, > + &brightness, &contrast, &saturation); > + sws_setColorspaceDetails(ctx, inv_table, in_full, > + table, out_full, > + brightness, contrast, saturation); Isn't this pointless? It looks like you're setting the context with values taken from the same context. > + check_rgb_to_y(ctx); > + report("rgb_to_y"); > + > + check_rgb_to_uv(ctx); > + report("rgb_to_uv"); > + > + sws_freeContext(ctx); > } _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".