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 153644A702 for ; Tue, 4 Jun 2024 14:07:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57B6768D6FC; Tue, 4 Jun 2024 17:07:20 +0300 (EEST) Received: from out203-205-221-245.mail.qq.com (out203-205-221-245.mail.qq.com [203.205.221.245]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0580868D50E for ; Tue, 4 Jun 2024 17:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1717510026; bh=KT1vGp40+OhpWWytlKsIyUWKea0fkcW0mbdFIwwqxjo=; h=From:Subject:Date:References:To:In-Reply-To; b=IqXQDe7moHZQ0w4hnS7TaO5+ujscxzyUQGWwAUKr7Wd1+EjQI93OOhzRzp2TktN+k wgTb+PaTlK1TBDg+2uLM/rkED7NKXewCgBjVMdILP00qQZRsec7BrsiMl/zvSxUBZs 55Prlg5InmqEncbhT8ekKBF3nZKJmTKa0wDj++l4= Received: from smtpclient.apple ([113.108.77.51]) by newxmesmtplogicsvrszc19-0.qq.com (NewEsmtp) with SMTP id 1C514015; Tue, 04 Jun 2024 22:07:05 +0800 X-QQ-mid: xmsmtpt1717510025t4i6puflb Message-ID: X-QQ-XMAILINFO: Nd/Exl7W9DK5Xvq6IU8X3W3dpHzuCkdInKACQghmElsI7HXYADQJmfkAHkWgvw 2KQEWQzYLztp0NedkspnBmETIXr7GeiHuAGT7M+UzmsOBllFsubpv1lIZ02t+VoNrEnu7k9pBaEL RXCDWdGUyt7m4NW13as++0WvVm18HjFKsni0n8084Yuj9rr8jKzcbmXib0LN8ZataXT5iKADTdfo zMtEhPjNgagn5aWlK/dD1HQvYubHnuMaSEPWKizhosqxPN7TaMyo90HK+5o49cscxBWLAQEBPQ9h H4HiSCo389HDDUbt3BhQYNvuxB2fxN4/tCGiUNv2ITYbf7lqnwVXC021tm7iv7szkYMJOizqtv8b exFw77ZF7sAzjXFos5d/f+z2yaT3lJ+V1I40X8MAXSoESoLHAuuQeKCRS0RyEaJDt4SJaHZuPNce pSarncIyx9p8avWl0L0arDUzFExnUspKVUUmTCr3ZNDDtMwoPmXzy78TfIDnZ8bvAYXYTu2DHVlp oBv+jNAxiXvswSfTlkcmHw1Zs7KeimpFhDU18RPRAv/6CragCAqB5irbauafVM2Dvd+sKudXSzR0 ULOFtcxef1O2mTSJ43KVJptv/vPY1oAEmDKMphEbJrkxcJHvCcl3EY/gXJAx6A1zwp0CjGVKexIk MVkps/8mdgozSjOTxk8PD3BRk4HlCzzjQ+uoK6FNeEJjg1TzFbSHCWsj5PPVA+oFWxIl4uIVjXU0 FWGMgSHh0E1muhj1DHIUboqcDtDrYIo3gbNWhkVa+yyc6AknOVa292O6haubBaM7p9aQ30O27Acl Xgxvt0bwbc9+K9RP5pQXD3WYdMgTdF/KlCkvcrLsCik5bmVoTmCVPdGstEVKv/7kNnIifAUch2DE nOFqEbSotsp0Wl2SvtPOj/MgbSdX/l9QHKPZuYGFW7hSrTXolhnMi4x0SMDx6l3p/nCjgYmGC473 yMVlQVKljHAbgWdDoCKHXMDnwzVxmNYsUEBMbTPMUrSchasYBkpZUhArrg2foZn+yEVNskDg4jm3 9Xv9H3yAq83UkNOfsR X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: Zhao Zhili Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Date: Tue, 4 Jun 2024 22:06:55 +0800 References: To: FFmpeg development discussions and patches In-Reply-To: X-OQ-MSGID: <70F1CF98-C02D-43EE-BCBF-C9E061EE9E87@foxmail.com> X-Mailer: Apple Mail (2.3774.500.171.1.1) X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > On Jun 4, 2024, at 21:58, James Almer wrote: > > 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. Yes, will remove in next version. > >> + 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". _______________________________________________ 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".