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 E103846BC5 for ; Sun, 3 Dec 2023 23:47:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9500968CCBE; Mon, 4 Dec 2023 01:47:27 +0200 (EET) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E209068C776 for ; Mon, 4 Dec 2023 01:47:20 +0200 (EET) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-50be3eed85aso2034639e87.2 for ; Sun, 03 Dec 2023 15:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701647240; x=1702252040; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=am2GExQSQltWVjGp2Y6KlTiyhctdM5z6jzukpvYN4KE=; b=bMwsGh6Ji6AoAygGKRgcxg6NKHn437BaYJFMuKaedsSOFmuMqRMpNnjmA7/LHTOa6+ Cmym3C+zWfadepPWYj8jFe2mqSvRIgtiI8/d/XKMunJoZlFJD/AcTTx7hWKCFB9dIBss 8bUYDuJneZNbsx3D4nq+Fq2u+qWJlPhzzdQnxbYFcyJPJZczHnaw/RAV3m+592qF2vCB 4HXl+BMpDQ/OI5qT94IahiB0C1tyk70AZ1GPsWaNa8TZCf2eWgOCuTRNWBuOs4wguvYY bNA6IAxksK/sntcXRZeeMYxbCt/ra9VECjPr4pZ2GKjg2m/2JQ5GtjceZy0YvMv9qR2K vDKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701647240; x=1702252040; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=am2GExQSQltWVjGp2Y6KlTiyhctdM5z6jzukpvYN4KE=; b=CNUVHztUqmYHy46GSclUdHY5eDlp8Lat1tgUttj1eSGZEL6TBXPpBQBM4r0lB5ZB4m W+YYxGThb05f9yWp1GsE7TCVFBwX/VWqXZUEW5GACO68/uLNnJSv2rmwkXJCDibDGLrs 9BqYL8uhzxDCJ1wdhDOMzXynrskRCz9XEc+HWrqbyWNcjERSoZcboVLMB8EvjdsDlhjc 6hmfwJbM7cOy/Iws42+USpqnqVrToKsK7ahNKMEo7S9Wj+Ihi5vDGlF+sPsWxSSj/gkc uq3DK+dRCinvUe/REmVSaVqgYBvcOrlwsWsr9b9jNGRN5ZSdNA0a9yzVPZdj8c8r12pM XKDQ== X-Gm-Message-State: AOJu0Yzr/4v4K62G7kfVdwY8wvvwBIAjGbqzgRxxjWTJC4HsSNor4+Ky RiJHtHpMW6+qikszUNrsckzvL/lwyF4= X-Google-Smtp-Source: AGHT+IGmY6nqAJH+cuwhHF/Ogb8laZ/WKDv/1+3IprGbs/togWb9UwJ3sTyUpN2dCkhlbk4j1mk5qg== X-Received: by 2002:a05:6512:3e0c:b0:50b:f9ca:17b with SMTP id i12-20020a0565123e0c00b0050bf9ca017bmr149539lfv.80.1701647239495; Sun, 03 Dec 2023 15:47:19 -0800 (PST) Received: from mariano (dynamic-adsl-84-220-189-10.clienti.tiscali.it. [84.220.189.10]) by smtp.gmail.com with ESMTPSA id m2-20020a056402430200b0054cd6346685sm337501edc.35.2023.12.03.15.47.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 15:47:19 -0800 (PST) Received: by mariano (Postfix, from userid 1000) id B8162BFCDA; Mon, 4 Dec 2023 00:47:17 +0100 (CET) Date: Mon, 4 Dec 2023 00:47:17 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20231203002726.29683-1-cus@passwd.hu> <20231203002726.29683-2-cus@passwd.hu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231203002726.29683-2-cus@passwd.hu> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH 2/7] avutil/tests/imgutils: add tests for av_image_fill_black() 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 date Sunday 2023-12-03 01:27:21 +0100, Marton Balint wrote: > Signed-off-by: Marton Balint > --- > libavutil/tests/imgutils.c | 60 ++++++++-- > tests/ref/fate/imgutils | 217 +++++++++++++++++++++++++++++++++++++ > 2 files changed, 268 insertions(+), 9 deletions(-) > > diff --git a/libavutil/tests/imgutils.c b/libavutil/tests/imgutils.c > index f3a433ac4a..500d24fdb8 100644 > --- a/libavutil/tests/imgutils.c > +++ b/libavutil/tests/imgutils.c > @@ -17,6 +17,7 @@ > */ > > #include "libavutil/imgutils.c" > +#include "libavutil/crc.h" > > #undef printf > static int basic_tests(enum AVPixelFormat pix_fmt, int w, int h) { > @@ -55,9 +56,43 @@ static int basic_tests(enum AVPixelFormat pix_fmt, int w, int h) { > return 0; > } > > +static int black_tests(const AVPixFmtDescriptor *desc, enum AVPixelFormat pix_fmt, int w, int h) nit: check_image_fill_black ? > +{ > + uint8_t *data[4]; > + ptrdiff_t linesizes1[4]; > + int ret, total_size, linesizes[4]; > + > + if (av_image_fill_linesizes(linesizes, pix_fmt, w) < 0) > + return -1; nit: maybe we could store and return ret to give more information > + total_size = av_image_alloc(data, linesizes, w, h, pix_fmt, 4); > + if (total_size < 0) { > + printf("alloc failure"); > + return -1; ditto > + } > + printf("total_size: %6d", total_size); > + if (desc->flags & AV_PIX_FMT_FLAG_PAL) > + total_size -= 256 * 4; > + // Make it non-black by default... > + memset(data[0], 0xA3, total_size); > + for (int i = 0; i < 4; i++) > + linesizes1[i] = linesizes[i]; > + for (enum AVColorRange range = 0; range < AVCOL_RANGE_NB; range++) { > + ret = av_image_fill_black(data, linesizes1, pix_fmt, range, w, h); > + printf(", black_%s_crc: ", av_color_range_name(range)); > + if (ret < 0) { > + printf("----------"); > + } else { > + const AVCRC *ctx = av_crc_get_table(AV_CRC_32_IEEE_LE); nit: crc? > + printf("0x%08"PRIx32, av_crc(ctx, 0, data[0], total_size)); > + } > + } > + av_freep(&data[0]); > + > + return 0; > +} > + > int main(void) > { > - const AVPixFmtDescriptor *desc = NULL; > int64_t x, y; > > for (y = -1; y @@ -69,15 +104,22 @@ int main(void) > } > printf("\n"); > > - while (desc = av_pix_fmt_desc_next(desc)) { > - int w = 64, h = 48; > - enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc); > + for (int i = 0; i < 2; i++) { > + printf(i ? "\nblack tests\n" : "basic tests\n"); > + for (const AVPixFmtDescriptor *desc = NULL; desc = av_pix_fmt_desc_next(desc);) { > + int w = 64, h = 48; > + enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc); > > - if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) > - continue; > - printf("%-16s", desc->name); > - basic_tests(pix_fmt, w, h); > - printf("\n"); > + if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) > + continue; > + > + printf("%-16s", desc->name); > + if (i == 0) > + basic_tests(pix_fmt, w, h); > + else > + black_tests(desc, pix_fmt, w, h); > + printf("\n"); > + } > } LGTM otherwise. _______________________________________________ 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".