From patchwork Wed Aug 17 20:31:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 37331 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp301897pzh; Wed, 17 Aug 2022 13:32:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR78dCbLiHaIHkkeuDjM2SWYpWku/HM8GIRzwpBH2lgQbN8P0tJWoupybyuTCJYqbv8D+yxD X-Received: by 2002:a17:907:9707:b0:731:5ddc:30f3 with SMTP id jg7-20020a170907970700b007315ddc30f3mr17539302ejc.338.1660768351970; Wed, 17 Aug 2022 13:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660768351; cv=none; d=google.com; s=arc-20160816; b=p90roavOq3igFirEVFPab8MZfXznqKeTykFifxI1YdkXBs7SlsYeZvQbMyPRn1kFwb aZAzHfKPylVX80CjdvhFywdV7S3R8LLTQLlOxrMQrRCdw5Rr0ujmS1p/X1vaHJJ0jdfn FLmdQmyzln0h0IbIn9mwMM6kILOc3vk7bYkD7wApvZQwK/v7+xg9OsjxUp/f3n4XfzKx 6qbNlTgAyE/57NZBZGrkZSs6iHl9S+PqbQNm0euyk7PDMQZNxatydBgeXUMuHMf/PFTS IOAnd/f7WKwgn7OWjGFbbMgzbLDGqAY6tcTikH2CzBHI4+08hgDyO5LX+uLkRQa++HLs sv2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=eTU7WeLVPc76XIgF+R4ezQGDNY99YP8Xm2MGB/aQasQ=; b=Iq2SFnVnWXxgw5Ksmjea8UTPRoFq5C3myU3bXeqgyXjibIaKSsEyLs5SzLFjHmueyp WqNzmDDb7KD5bDtFSjDC52AZIHDDb4wIDWtF1xUUE9qwlLBeR8v2pd/35Bg9ObpIB7mm PndsidvtRb7n9iJ1gjm11CLjl3gRJH1nyWnRl5rU/v20LbLBuJmPFPbrFgJ3i96Wq6Gy qOHe9uc2UhBNhUieo9TCs+S4T7uAYfx3M91AUbAnEFupk4REYbz1Xyu17IenMShdJNBf +6YnTRW3MHxb29/iUatNT/8vl7tCbphjU6b29fHIF8/YbbJGI1WeKrFKkbzhM4Meg+Nx 9fyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20210112.gappssmtp.com header.s=20210112 header.b=skDatFdx; 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 q9-20020a170906a08900b007315a1c65b8si13078709ejy.329.2022.08.17.13.32.23; Wed, 17 Aug 2022 13:32:31 -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=@martin-st.20210112.gappssmtp.com header.s=20210112 header.b=skDatFdx; 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 1858D68B91B; Wed, 17 Aug 2022 23:32:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D1B8668B900 for ; Wed, 17 Aug 2022 23:31:53 +0300 (EEST) Received: by mail-lf1-f42.google.com with SMTP id z6so20428651lfu.9 for ; Wed, 17 Aug 2022 13:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=sH8eTR4gKtRL0DipZm6UabaGiusxmRB6MjgS+ceqrzs=; b=skDatFdxj0h9Rn/pxlqvh6qR8ea6VrBe6E6Vgiwzr5ewqbAzi4McQX4bRDkDJYzvC+ jSuoL63FL/jgCEJtU7RAB3zZdBMsdMDiOINTYmAW2ED63oR1A0iX9ErP5QwMZyJDhyQC Y86Ln2GMrFx672+PX6XnJGT/DoMFPdUxCpqrHGYMCTa04NIcimOwkcLW3+W29Z3yXTi3 I/C+BW6dPBX4QQnzAP0E9oG/Mq+/nqglOygJbqusj84T2HZB6nRn8PgNHlsd6Nj8wyeu Y2Sy1jYDyzy60O5k1N/ny/+v7cmcmG2z2zez2H+AJ+LB9oj8XHJh1UxSUj3XYVifeUge Tuqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=sH8eTR4gKtRL0DipZm6UabaGiusxmRB6MjgS+ceqrzs=; b=2Ryfks8sF1L8GGTbqDh0bVLVML9tY2SaWvM4nXnpe83hvjrgATik3qJxeMtBcaX9fn w933n4w8Smockl7lfQBKNnLY4D2a7CDx9EH6Mi8l4nhpJgh4KK5l7gqN5uSKKEZ2wEeZ TwxhUeiVs4x++3aIu5saurbjkrC+pARmpfn6vCl/UBLHlGMHdjPNibmuAILMhCulRqO4 6dNwPVgnj5uthyZTGUrD/G7DfXfDfqAFYqaRCFFyMXsKg5GjvKyPq51uzeMlJsWA7UT0 MroGqUq29ip0j1C+0vPHgNuvp1/udOoDINAlR5NZBREhqwzp35PQpXEGTVppjiSP+ocA g6cA== X-Gm-Message-State: ACgBeo3rvHa582vfZjN3EGFigNXZ8im2KQAah26mkdev0PDsaS0cs7hg kgrlERfh0sKljbmi8bIB/WyExulI4UTTf5c+ X-Received: by 2002:ac2:50cf:0:b0:48a:f4ef:788b with SMTP id h15-20020ac250cf000000b0048af4ef788bmr8900175lfm.527.1660768313116; Wed, 17 Aug 2022 13:31:53 -0700 (PDT) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id h6-20020a2ea486000000b0025e57b40009sm2378363lji.89.2022.08.17.13.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:31:52 -0700 (PDT) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Aug 2022 23:31:47 +0300 Message-Id: <20220817203147.1957322-2-martin@martin.st> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220817203147.1957322-1-martin@martin.st> References: <20220817203147.1957322-1-martin@martin.st> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] checkasm: sw_scale: Reduce range of test data in the yuv2yuvX test to get closer to real data 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: =?utf-8?q?Martin_Storsj=C3=B6?= , Alan Kelly Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: MpUcUQs6zh7J This avoids overflows on some inputs in the x86 case, where the assembly version would clip/overflow differently from the C reference function. This doesn't seem to be a real issue with actual input data, but only with the previous fully random input data. This also makes the test produce a bit more realistic output pixel values, instead of having essentially all pixels clipped to either 0 or 255. Signed-off-by: Martin Storsjö --- tests/checkasm/sw_scale.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c index d72506ed86..89403da317 100644 --- a/tests/checkasm/sw_scale.c +++ b/tests/checkasm/sw_scale.c @@ -187,8 +187,16 @@ static void check_yuv2yuvX(int accurate) } *vFilterData; 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)); randomize_buffers((uint8_t*)filter_coeff, LARGEST_FILTER * sizeof(int16_t)); + // Limit the range of the filter coefficients and intermediate + // pixel values, to avoid risk of clipping filter intermediates on x86. + for (i = 0; i < LARGEST_FILTER; i++) + filter_coeff[i] >>= 2; + for (i = 0; i < LARGEST_FILTER * LARGEST_INPUT_SIZE; i++) + src_pixels[i] >>= 2; + ctx = sws_alloc_context(); if (accurate) ctx->flags |= SWS_ACCURATE_RND;