From patchwork Mon Sep 26 19:58:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38373 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp49367pzh; Mon, 26 Sep 2022 12:59:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xqUqFp3vchEic3JdsCwz7Fh9c3TdVN6d7QxjAmxqy3MY5tAo4TzGG2WTzzxpoRPfr1xV4 X-Received: by 2002:a05:6402:1941:b0:457:138:1e88 with SMTP id f1-20020a056402194100b0045701381e88mr13358063edz.394.1664222365231; Mon, 26 Sep 2022 12:59:25 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f6-20020a056402150600b00457463e2dfbsi3420497edw.512.2022.09.26.12.59.24; Mon, 26 Sep 2022 12:59:25 -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=@outlook.com header.s=selector1 header.b=r1xRECim; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D08768BA4D; Mon, 26 Sep 2022 22:59:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2017.outbound.protection.outlook.com [40.92.89.17]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2707768B61C for ; Mon, 26 Sep 2022 22:59:15 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SHBc1R2Ca1mnJqWxNq3dM7zwM67ih2edlION/HztKRMxYxLHa1aOq1RYJZ9lgpyjuYTEbhO+2PuD5N0Czns7Ogj6lP+D7O3rBiLxFRcW3UB30xaKvVHpHW3CoBBonRlranlrh19TBFR88hCm9wdkzlnZUmx7ZB2LH22WtYN2WrZdpkDPwD6iujsISJ1cdmZcnJHXs1cvOnIcfZxmc0cZjpIZuNSvWJlSVy/smMBDXEdtTQI5EqOMQ8k3CCY+Q++A7haYm4C+6PjV7bAckBv/83gyFbijEq766rm41iirCpSwdzJkeXPfrOMd3CdfHqH88g11lPZBPE6LGBCSm41cxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+gl8Uligr6FuVlZL6RRGzWOqCPT/v5/XSUuzKYztsBk=; b=hm8OdVaEEokmOE/fZikRnK9BLDtmxNJ/Q71XGtON3I1q9ChJNuMMAi304DIw4UAAquKhWO3Nte45bVSFdvVEccm1E0arnottmYz3qYzEP9MfX29s5+qYBClmV4Wb2ZuhNzXGC8gLrwJiJGIgf6l6Jg2uaNiMIoRqBz/dEDySFkXZg5jvDCjUeT55Ngd7w/dw8zwRjfzZmTg6muVd6eL/DG/pPdwKP5/+xit/0R2Z1K5s+dV1vqawqtRT3xir1b5pS2NiG/HrY/lLvNark+3vN5AlohVS/8apjXcxhHX6/jiMiu21Kz2yMcFmlTI94I+WzjrTx/FfrpeOhWUDZ7e0Nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+gl8Uligr6FuVlZL6RRGzWOqCPT/v5/XSUuzKYztsBk=; b=r1xRECimTYF2ZLBy4xaX73A7qTz8ahq0qIHr03Og1rXzqbBWkkDEx+fwurZO4pCgEpChPU6lC+ODHDGBOOonFc4EeOnt1T6p7pCx968omybcn9+4wZCTEijDh5HBScwcA9D/ENFNvb+fZBpRcsXl7aOwr+HZT1fON61Xf0+P42KAbtcV4/x5i1HJVGub7XPiaORerXyIkIlbopbq89Yg/E9YDUKEREmGhH87FQ9OOa5GasKnhQfPBEsBgprFcsbSap9YT3J1ZQPYKU8nHGMGM2vaLOkGNtlT1BGE4YxWimEV6iGfBXM9v5M6y1ikNBTTWZ65hBAiTTCaEvMcmySccQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PAXP250MB0470.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:283::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Mon, 26 Sep 2022 19:59:13 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5654.025; Mon, 26 Sep 2022 19:59:13 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Sep 2022 21:58:56 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [8K6Qo03amji7W0mjGfkgdw1dQquRwV6SMN8hFE3qL20=] X-ClientProxiedBy: ZR0P278CA0038.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::7) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220926195858.3857174-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PAXP250MB0470:EE_ X-MS-Office365-Filtering-Correlation-Id: 086de836-08be-4a9c-a618-08da9ff995be X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmoDoqouQ984HdnI9yqZYxaIQz1MGz4ZioTDnm5Dv/0a5JwMdFeWTCfmhcfTGlHBBNP2XSU9T9YTG+MJ2MnsKnMMfT9XCpcqK4rn7clAdN+LJyS82SesZxfqI/1VfAgKAntZf+dNNbzYt6HFhOBx3lQ43AusNhq78+iTu8TOTwRtZlj/jnM5Td82V0YtONTukTPCg+wkYy83P2o8ul0S5ih0hL+FNE/FSk3uZQQ3+VoQ114hrWfPXHAqWUqUglIr3R1jT1p0DZ+AmoaMof+rKWd9wjmAlTQs1gd31C9GlF5RqOgI1djDYYyPhiZdM8qSizTjv5MrDfVbDABXbGAViKToBxp9hGPg+f1YeR5C68eCFk11J438tABc1tNOf9HOxCpND0nPsZCkmoUyh+6UNRz07IaRD2hzMUiP4XiwCUy/tsVw/BAnhrMuaIhGj21PrKaKYW66lGmm0zSdGdwl4LXTKXy9XfMrcbZuQD8rC0K7bZk5ehVw6Yv08SbEggcsXtv++NGDy1hx0IwrVSioHoKCeIXgBQ5H9zHcUyrqvA8qsBUOnBuoToIfLE+XJ8O31AmGeqqK31fNCrpwC8KWrx9VPgJjONobNSgyMylFvXtnoLxQYhuomP3qCblxauM0SsVB5QT/QLsiiH6PVpPI7OCGehiyGKIHsYn5TorSoRe+onT6QSntiVdOgMs4HoQ9iFi3n4pjqtZLgw3yVPtSsWoJPMIdo6g6gqGzdf1bSogxnJjqAFyY2LMEK3+1fSxFg7I= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8MU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wae9w8zvQiKXMGVNTRyZG51MZ1GsHgYl1KLapRE7Xj76EZAXMNu3xnU3JiaQoa/QNp0qCke5SRbwQNW/OW4r8FVzFUuoa9qR5+hUVFCq9wIk1Wmc9wHYRh9oHsf6LWawoSsfpb++VTH08A9ATBBj+5dxHI4muI/VCxUYQ+Sno1IqH6gFX40a7fNtaRmeAiYw6+FZ5VS1kvwK2tczXbUq+VgIHnw2Qe8SZnxmVEzKu2n1ed9mhUW20tBrPnS/9TclEM2aCa7G3SIgaT23yEQr2tjGJ9exe6HVVuu1QQHb2ig2T9lt4hwKZlt/j1aDLBa6EUos0nJp2426zainttm58/sgYuKBdg2Uqsi2Vk1JE/ofTiENVgtcpOuaM5d0jHZmZ5BuJuwRifEH7JOQXb9QOpQHL/wYrjnspjIQ6BDjlU5uW97a2reUMp0c6Edpr/8fhT4EmGqJzXxKjaPW9e/lpAkSOqqnyFuV+tA708HYKbnLJdCPnrowuB/XNhym37Raecx5nPtVpa7X6ouorHivvR+74sd05hgMC61J7gA940R9IYb9j37kzvPRf8gNbRyU+cZm4wnPvhP+y90OsKQVO4Np0NDSjObp9Nl3YQo0mBRf+PMWPCBw5GjHeqNtNaSuYVFKQZ4DSH42zk7prx9XcbKNccVyhx15UKuue9t3yEtTJMohhlvboxCgeQ4093GwwE/mNf2GrOLqm/Idens0Jj3SmFvyZFfGi8WJ0H7Juj5jFS0Qpa9EI4mbfzgNOMciWtwQbIsvB4D1zPsH6mddT0gPGS/i2HA4pPCgb5uAYqpxOSAworPFNxEwc/OcM42WaremBmBUX32L43KlOPEphkJfPIpddNu0Cvm8XlYUsMZYUOxuzJ0tUOxIJW4Wj4wvET4TDqkJFByYSi2ZDwawWJIB6Up0tvDtB9hN2Xs/wJ2o1nLt17uV9Wx9uCeK/TDzo/X+nH24wd6qW1VDgif/PUYvt X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 086de836-08be-4a9c-a618-08da9ff995be X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 19:59:13.6193 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP250MB0470 Subject: [FFmpeg-devel] [PATCH 3/5] avutil/pixdesc: Move ff_check_pixfmt_descriptors() to its only user 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Hf+g1cyidA5h Namely to lavu/tests/pixelutils.c. This way, this function will not be included into actual binaries any more. Signed-off-by: Andreas Rheinhardt --- libavutil/internal.h | 2 -- libavutil/pixdesc.c | 48 --------------------------------- libavutil/tests/pixelutils.c | 52 +++++++++++++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/libavutil/internal.h b/libavutil/internal.h index c9e30bc5e9..454c59aa50 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -187,6 +187,4 @@ static av_always_inline av_const int avpriv_mirror(int x, int w) return x; } -void ff_check_pixfmt_descriptors(void); - #endif /* AVUTIL_INTERNAL_H */ diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f6755f41df..ca3e204a0b 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -22,12 +22,10 @@ #include #include -#include "avassert.h" #include "avstring.h" #include "common.h" #include "pixfmt.h" #include "pixdesc.h" -#include "internal.h" #include "intreadwrite.h" void av_read_image_line2(void *dst, @@ -2912,52 +2910,6 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt) return ret; } -void ff_check_pixfmt_descriptors(void){ - const AVPixFmtDescriptor *d, *last = NULL; - int i; - - for (i = AV_PIX_FMT_NONE, d = NULL; i++, d = av_pix_fmt_desc_next(d);) { - uint8_t fill[4][8+6+3] = {{0}}; - uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]}; - int linesize[4] = {0,0,0,0}; - uint16_t tmp[2]; - - av_assert0(d->name && d->name[0]); - av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name); - av_assert0(d->log2_chroma_w <= 3); - av_assert0(d->log2_chroma_h <= 3); - av_assert0(d->nb_components <= 4); - av_assert2(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d)); - - /* The following two checks as well as the one after the loop - * would need to be changed if we changed the way the descriptors - * are stored. */ - av_assert0(i == av_pix_fmt_desc_get_id(d)); - av_assert0(!last || last + 1 == d); - - for (int j = 0; j < FF_ARRAY_ELEMS(d->comp); j++) { - const AVComponentDescriptor *c = &d->comp[j]; - if(j>=d->nb_components) { - av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth); - continue; - } - if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) { - av_assert0(c->step >= c->depth); - } else { - av_assert0(8*c->step >= c->depth); - } - if (d->flags & AV_PIX_FMT_FLAG_BAYER) - continue; - av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0); - av_assert0(tmp[0] == 0 && tmp[1] == 0); - tmp[0] = tmp[1] = (1ULL << c->depth) - 1; - av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2); - } - } - av_assert0(i == AV_PIX_FMT_NB); -} - - enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); diff --git a/libavutil/tests/pixelutils.c b/libavutil/tests/pixelutils.c index 927c8d9217..6e5e8cf738 100644 --- a/libavutil/tests/pixelutils.c +++ b/libavutil/tests/pixelutils.c @@ -18,15 +18,65 @@ #include +#include "libavutil/avassert.h" #include "libavutil/internal.h" +#include "libavutil/log.h" #include "libavutil/mem.h" +#include "libavutil/pixdesc.h" #include "libavutil/pixelutils.c" +#include "libavutil/pixfmt.h" #define W1 320 #define H1 240 #define W2 640 #define H2 480 +static void check_pixfmt_descriptors(void) +{ + const AVPixFmtDescriptor *d, *last = NULL; + int i; + + for (i = AV_PIX_FMT_NONE, d = NULL; i++, d = av_pix_fmt_desc_next(d);) { + uint8_t fill[4][8 + 6 + 3] = {{ 0 }}; + uint8_t *data[4] = { fill[0], fill[1], fill[2], fill[3] }; + int linesize[4] = { 0, 0, 0, 0 }; + uint16_t tmp[2]; + + av_assert0(d->name && d->name[0]); + av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name); + av_assert0(d->log2_chroma_w <= 3); + av_assert0(d->log2_chroma_h <= 3); + av_assert0(d->nb_components <= 4); + av_assert2(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d)); + + /* The following two checks as well as the one after the loop + * would need to be changed if we changed the way the descriptors + * are stored. */ + av_assert0(i == av_pix_fmt_desc_get_id(d)); + av_assert0(!last || last + 1 == d); + + for (int j = 0; j < FF_ARRAY_ELEMS(d->comp); j++) { + const AVComponentDescriptor *c = &d->comp[j]; + if (j >= d->nb_components) { + av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth); + continue; + } + if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) { + av_assert0(c->step >= c->depth); + } else { + av_assert0(8*c->step >= c->depth); + } + if (d->flags & AV_PIX_FMT_FLAG_BAYER) + continue; + av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0); + av_assert0(tmp[0] == 0 && tmp[1] == 0); + tmp[0] = tmp[1] = (1ULL << c->depth) - 1; + av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2); + } + } + av_assert0(i == AV_PIX_FMT_NB); +} + static int run_single_test(const char *test, const uint8_t *block1, ptrdiff_t stride1, const uint8_t *block2, ptrdiff_t stride2, @@ -87,7 +137,7 @@ int main(void) goto end; } - ff_check_pixfmt_descriptors(); + check_pixfmt_descriptors(); #define RANDOM_INIT(buf, size) do { \ int k; \