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 15B394A96D for ; Wed, 5 Jun 2024 15:37:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D613968D699; Wed, 5 Jun 2024 18:37:26 +0300 (EEST) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9155C68D5C9 for ; Wed, 5 Jun 2024 18:37:20 +0300 (EEST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1f47f07aceaso46965425ad.0 for ; Wed, 05 Jun 2024 08:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717601838; x=1718206638; 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=VjxZ5pRponiK9XxZFGeZL6JQGdA0x65tGFejkXThBfo=; b=afvmUf0s+yV3Yc9wHsNQHWBJ006YsS/rbbxfYbUEwCdK2ia6gzp/yhSRdNJUuDJpwx Ae6JNoNWRpltMwCZEW26pm8/hZMiy6HDcYR8XNmcFc1EwQGqWf6VGmtgVQ34zJ2Qnnfb xpVKsD9kb6oWtWXwNbUY2Ftaf7Z0ulrtAgBiKgXQCKRKsPFy5zPPyOiAsC/gFRF74UZD xPMbqeYcvfsl8rl0dFMPfJqjpiNOQpzrehzSKUfzzyUvhPl9VmC8YiMccuOloOTYv6ti Yu9kqmbPiVEwFsIPCVhkypdWlMGOBVaBpzIFEtbNsB1UAcUN3apBLh2yXu2cxzvvV17T pTuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717601838; x=1718206638; 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=VjxZ5pRponiK9XxZFGeZL6JQGdA0x65tGFejkXThBfo=; b=kR4qqgJDXhW6mvCDvYGH6LR2SPrGmE+XMlZmjR8WgBfcXpoql8wOc1jrLQFxtEW4d7 VpcX5bW8/KO1+2vYRdaRVtglfhkLf/Y4f7D76sCDb0xIT8zi46XWJUYgT8RLAPEOkpiV /8ne4iB+aH8kwZid1Tw/P8iWQON6lJpmchYYqRZRFmGwSVChuoW9IS6l3DZ4XlO7lM1I sKgP1EpnvmlORzxLJPouDqrrpNpwE4T9ZlB70b2bTwHIfSpw5y1ApWTpgQBZoEw0tkM7 H2I7cWOMctLO6zQwyqewKDWx1eFwto2ZPH1U2bZOVyKoCrfaQVBEjD34TGzJg/ZKrFiz YeTw== X-Gm-Message-State: AOJu0YxQ4Of8f8yKGxGSV9mwGb/CdHM05Ds+KFGnKgmU2NqwiNE1ZUsm DaAfF1PRBURVh9fzN0Pas1Y3ll6+kV4zkiet0CMpZprd3rnJfUxbKc7vWw== X-Google-Smtp-Source: AGHT+IHnAKIE49w9u9HFEbqHUhjsIVLhjIQVonTTNPQp4RFWoQZ8qzNG5B+h8oJs4YsyMDtLFbr08A== X-Received: by 2002:a17:902:e744:b0:1f4:75e8:2e9c with SMTP id d9443c01a7336-1f6a590b485mr36364975ad.11.1717601837761; Wed, 05 Jun 2024 08:37:17 -0700 (PDT) Received: from [192.168.0.16] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f656b6e7edsm82438165ad.97.2024.06.05.08.37.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jun 2024 08:37:17 -0700 (PDT) Message-ID: <9d6672a0-c309-487d-8740-559b030526b3@gmail.com> Date: Wed, 5 Jun 2024 12:37:26 -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 11:06 AM, Zhao Zhili wrote: > > >> 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. Will you send a new version with other changes, or just this? If the latter, i can amend it and push it now. _______________________________________________ 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".