From patchwork Sun Mar 10 14:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46933 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp740914pzb; Sun, 10 Mar 2024 07:12:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCD++vVjougF/Y8WD38SIFCbKij7kDCVE++BuZToZapPMYX1j3Dy48fcM2m7nKO6DcfXg7MKRfJIE80FE8OkdKEVF7L4QWrWySdw== X-Google-Smtp-Source: AGHT+IF2sdf9LL+Ld6gqNHrxJcbLfTsg5pptDHnVNExowYCMnI+zAsf3ABp7BnvzaDGgg9xbrNZq X-Received: by 2002:a2e:7e0e:0:b0:2d3:fca:dae6 with SMTP id z14-20020a2e7e0e000000b002d30fcadae6mr2288330ljc.2.1710079959447; Sun, 10 Mar 2024 07:12:39 -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 c12-20020a0564021f8c00b00566e859a366si1602839edc.306.2024.03.10.07.12.39; Sun, 10 Mar 2024 07:12:39 -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=lS5Mo2pl; 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 BAA0568CCD4; Sun, 10 Mar 2024 16:12:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02olkn2058.outbound.protection.outlook.com [40.92.48.58]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A81D268BCA7 for ; Sun, 10 Mar 2024 16:12:30 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VlbRKJPgZlAIPdLgvuMuhiYSIY9rSy+iC1CvpKA3pXz1ivf+tX9EeMDSC3IQ8iXEk0GxRk5CdJtuETshyOw+foWAW5PdWu59sNqP1DfHVBaIsQ5wJXz4thb2fksSRzAlfdDcHG8F8bOqFNL7+Yl1wi/ocCLM8fK7t+ffQ0GV2GJawp8YsGzxVH/wAgRsv/J9Gza+ByKf+hgnjNCr18l3PDenVTagkuSwoYp9uFZIgVgyeQk0YSAaZAaPrrbm3Sf8QG6XSNoqXpRbVrmhM33fp8de/q+kaal3kQmhLcfdtfUIyYrFOd0uQvjbnlgHLo5sphlb7nirmCXzGvSqBxP3jA== 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=gFjwJKCEU+MXjlGpKmWusO/1Vpgt5u45nxEpq7p/8jE=; b=SeDZbZ8+upH6PufElGdRY2kM8YH1ZJw/v//tfsdo5qqEbP4HZgnlNgdUFLMzS8ll5EXgte6bn0DIWRdhWUZSPfKNpvmU0eAl2b2QiOp0MQClIDH1kEcnl6Cue29pZXmObNhURw/Yf9B8jqUgmsYTu5PyrV+IXf/W+UMzHCCc8SvCoBAkmwFWvwz6ft9/YffFgRJ6SE343UYeoQod3qFt2ugP1Jn3VopeW7BmATrqPtlED9VwsbALR2FxWLq7dZd+XAt7z57yGUZR0PE3mufsU2LQJHumDENtQBmMCvMnGO57qaA+zWz9Ouf56q9M29M2o47kZCTefRKyO6GuRkvt9w== 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=gFjwJKCEU+MXjlGpKmWusO/1Vpgt5u45nxEpq7p/8jE=; b=lS5Mo2plKy+3ca9b3cBtcs4N2+Qx6vYVov3zHg1pBJJA1tdngRUcs1oFIx91SZ6FpEKjpCAd+eZviG9lDotcPLzCrrFAbFgG8RShpDygijVzsO6nqshRYGrLRz/PPIyBddUJI11W4Lwpon9INWBxtrrTJdUgYcOmwuaQ3umJc+NbXhjRXViBHS0TgYOkMBu8XVoWd4FvWXkzwkZsZVrt8F3E0XgVUkuZXLFmXqiodo1YSPow+cPsTPMqLf3i3MrTHkf4nbz3PvqxLxj+GDCiS0HfvP0P/mfQqCumomcukwRiY7KzZhXtyoIA0W5I8tarWAe42oEp4GWuqrzwkrj+4Q== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0127.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:270::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.33; Sun, 10 Mar 2024 14:12:29 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.031; Sun, 10 Mar 2024 14:12:29 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:12:16 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [V4vl4oxnGEGHGYywzu01nDxAiYIjmAoHPW76OOBEfY0=] X-ClientProxiedBy: ZR2P278CA0053.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:53::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240310141221.439443-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0127:EE_ X-MS-Office365-Filtering-Correlation-Id: d1d4022c-7d72-4e86-a94f-08dc410c1eca X-MS-Exchange-SLBlob-MailProps: 9IecXKUgicDeTSW5Y8+cEPfAZQXqQEI0iKST3DkaQk0R1GL74X5FSL8Isdi4RqJsho+b0nb55WUADUG/jI2vBC2psTo7/JI0AmOEZkggb0tXTQg2pIXMOjR8Jd3W6H7fLeoqskrfU3pkVEHMu5z+wABftCfEam3cXdQudHpp/e+dXb8rmBFIbFR1/AueCNRra6k44kWVjJwBu5je8S9wdZuu3PKTZDqJMiwHvPAbEsnX0anozEuo8LbleKW/JmFHjiRKyBc08szRrIXEaSANjQ6n/q0BvL+G/IXUY8Gzv11yWwfCvThO+nAQ1lD84TfYYs0oAp2EkxAkE1IdRNmQFmmxwRqy7N/ud3siu6MnPXqdLvUfERUgIxviKPRdwQuyCQcal9PrbkzaZDVnvKiAcs6XEoiLEzd9mX3bjAjFHaqA++fLl7vYIMRI0f/+CygWbGev4KomHlxcoaW2Aphyg8l00LJMCg69+eL+LcCf+DWdpptGZNavz3aCUV3xrlOvXygHhmzEkbuC+5wyaWd1ICnAn29t8gsQmqmfcU47fjEQDcWp/tr3q6oOKBKtnZ866SRlhhpBuUeCHUR2hvdMwY1GkwQ9fO2TvI0bfML/qNRmhw5dufSuM3Qu++ttHVspPp67IddijyxdwzIvBNZhs2vWU+scof0p8/fmJlh1E8E6NGfwkg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Id: d1d4022c-7d72-4e86-a94f-08dc410c1eca X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2024 14:12:29.3891 (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: DU2P250MB0127 Subject: [FFmpeg-devel] [PATCH 1/6] avcodec/tiff: Fix handling of av_strdup() failures 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: qXqfvJfE7aAk For unknown geokey values, get_geokey_val() returns "Unknown-%d" with val being used for %d. This string is allocated and therefore all the known geokey values (static strings) are strdup'ed. In case this fails it is either ignored or treated as "Unknown-%d". (Furthermore it is possible to call av_strdup(NULL), although this is not documented to be legal.) This commit changes this by only returning the static strings in get_geokey_val(); the unknown handling and strdup'ing is moved out of it. Signed-off-by: Andreas Rheinhardt --- libavcodec/tiff.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index cb4d378753..4c7460cf41 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -36,6 +36,7 @@ #include #include "libavutil/attributes.h" +#include "libavutil/avstring.h" #include "libavutil/error.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" @@ -179,19 +180,17 @@ static const char *search_keyval(const TiffGeoTagKeyName *keys, int n, int id) return NULL; } -static char *get_geokey_val(int key, int val) +static const char *get_geokey_val(int key, uint16_t val) { - char *ap; - if (val == TIFF_GEO_KEY_UNDEFINED) - return av_strdup("undefined"); + return "undefined"; if (val == TIFF_GEO_KEY_USER_DEFINED) - return av_strdup("User-Defined"); + return "User-Defined"; #define RET_GEOKEY_VAL(TYPE, array)\ if (val >= TIFF_##TYPE##_OFFSET &&\ val - TIFF_##TYPE##_OFFSET < FF_ARRAY_ELEMS(tiff_##array##_codes))\ - return av_strdup(tiff_##array##_codes[val - TIFF_##TYPE##_OFFSET]); + return tiff_##array##_codes[val - TIFF_##TYPE##_OFFSET]; switch (key) { case TIFF_GT_MODEL_TYPE_GEOKEY: @@ -224,13 +223,9 @@ static char *get_geokey_val(int key, int val) RET_GEOKEY_VAL(PRIME_MERIDIAN, prime_meridian); break; case TIFF_PROJECTED_CS_TYPE_GEOKEY: - ap = av_strdup(search_keyval(tiff_proj_cs_type_codes, FF_ARRAY_ELEMS(tiff_proj_cs_type_codes), val)); - if(ap) return ap; - break; + return search_keyval(tiff_proj_cs_type_codes, FF_ARRAY_ELEMS(tiff_proj_cs_type_codes), val); case TIFF_PROJECTION_GEOKEY: - ap = av_strdup(search_keyval(tiff_projection_codes, FF_ARRAY_ELEMS(tiff_projection_codes), val)); - if(ap) return ap; - break; + return search_keyval(tiff_projection_codes, FF_ARRAY_ELEMS(tiff_projection_codes), val); case TIFF_PROJ_COORD_TRANS_GEOKEY: RET_GEOKEY_VAL(COORD_TRANS, coord_trans); break; @@ -241,10 +236,7 @@ static char *get_geokey_val(int key, int val) } - ap = av_malloc(14); - if (ap) - snprintf(ap, 14, "Unknown-%d", val); - return ap; + return NULL; } static char *doubles2str(double *dp, int count, const char *sep) @@ -1634,9 +1626,14 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) s->geotags[i].type = ff_tget_short(&s->gb, s->le); s->geotags[i].count = ff_tget_short(&s->gb, s->le); - if (!s->geotags[i].type) - s->geotags[i].val = get_geokey_val(s->geotags[i].key, ff_tget_short(&s->gb, s->le)); - else + if (!s->geotags[i].type) { + uint16_t val = ff_tget_short(&s->gb, s->le); + const char *str = get_geokey_val(s->geotags[i].key, val); + + s->geotags[i].val = str ? av_strdup(str) : av_asprintf("Unknown-%u", val); + if (!s->geotags[i].val) + return AVERROR(ENOMEM); + } else s->geotags[i].offset = ff_tget_short(&s->gb, s->le); } break; From patchwork Sun Mar 10 14:15:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46934 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp742103pzb; Sun, 10 Mar 2024 07:15:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVILqM7YXQL+LyXlf0TRTmUCOJbziekLW8Iotpzm6ihsPksjdaMmGbQRCqx860nYyRRGHnJYuhw7GJ640VwsQzPSIW1pjwolsf+Rg== X-Google-Smtp-Source: AGHT+IGshUgdzZOFqLWVhKGu2uF0+b6A4fK+NLZZmg8tni3zcL6imgApKF1qvwLX2PR0htVyVmo3 X-Received: by 2002:a50:9319:0:b0:567:698b:1d1 with SMTP id m25-20020a509319000000b00567698b01d1mr2772022eda.42.1710080121804; Sun, 10 Mar 2024 07:15:21 -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 m19-20020a056402431300b0056840dc5c54si1207823edc.267.2024.03.10.07.15.21; Sun, 10 Mar 2024 07:15:21 -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=uzOEl5NP; 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 EC63368CD6D; Sun, 10 Mar 2024 16:15:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2027.outbound.protection.outlook.com [40.92.66.27]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5FF9668ADCB for ; Sun, 10 Mar 2024 16:15:12 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KZ6xy4iSCCy+MjgZrqibbOp1i9NVp3dEUalP+Sr73AgLjF7d8RyjAjEfWP13KRxjj2xcjcCiiJaG/krBkun6/Kk7KYvFJFPgllbNRwN9ezyjSDdfKCnKCG0lxC7jQoa11MEIs8fLY1yR8h2fW7rUuXhvnFDcnhDbwMlzPdF5kXdw60by11K/T4/zLTgsOfPF13dVFuqDmj8OU7xWBzcG7ESfyPLN5gh4BY/BYqhKIqVlXNCOcUG/EJxYugIqXedfqosMupedI1AClMkP+fvmX73Yh3+UpcGNWOT0S6WLsgghbR8Zil+g+TzU98xbH+9mFxIfTDSrJ0ZfxDxbcgdxBg== 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=NHQFh/URKRt8KcBAOIpz9ZTJcDVoMMXmkL3fKbHz0I0=; b=I0KjC+vqs4kpw6d2T6wj66BoH8035vYB+76zwr2pp5gQPdemKvJ1LH+Fgg6BafRJOzdZpfYM3FAg3c9wyEI+7oJCTs6kgGj1K9fyvpfL8YtvqY+r2YWDrGYt+kuM7X9vL+AlS2Vw3IuNYTaYBL5WeYShbbqKHXzXfrPo6Ug2Hn+qVndnfji5IvLBfetnydy9uA8BqY1aneYn2pXo9KE0GtWZ/8VnazwG9mlEolYQOjZ2iXsNmsHrcwj1M4PJDcaxXAbzbh7flnqDnxygOB07kskv3NZn1qRugof4pLWmV9FhkBsBAWaQt2JphL5S/kRBFJ/qRGF/UjpXxlUET+jCUA== 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=NHQFh/URKRt8KcBAOIpz9ZTJcDVoMMXmkL3fKbHz0I0=; b=uzOEl5NPz9Y6607gs1e27QcyMdAYPbdzltm+c2SsAWwF9mlEBejxLuLizzrREKMdzkkBymNdoZikMgUALq8fXvGnvt5IDM1dsJ97zpAXD84DWDk/CGgxdyGnLFQb36cwjXyBSWiX8ZqODsm1ivpnGR2ChLsj0YPRT+TjHzPCCmn9mqkbWswmPYfFO61Tk9Hh9Vf/k/fTUPdFZPR22PySgOCJEhDrSU1xKR/cHra5yRNqiEnO0USl57MA4+Rf8wjPQ+nTtlyLxS7WhAdRefxJSD6Hx6Chc+N5ZLBLuIwyQ875N0TLbce6aai+bktU20hnxtAesm8N1TsJkVA9YXkCeQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0089.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Sun, 10 Mar 2024 14:15:10 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.031; Sun, 10 Mar 2024 14:15:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:15:00 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [JS/pnbcFzDsfV0bQy66G1Brl7OJ0g+y12/YII7daAjc=] X-ClientProxiedBy: FR3P281CA0002.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240310141504.440261-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0089:EE_ X-MS-Office365-Filtering-Correlation-Id: 76409655-21f7-4abf-5cd0-08dc410c7eff X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnrycYYMiKOh26ty8tiVyH4gFb/PX7bGPVDm59lmmPqO9GJq3aLOjifhbfIsiGtj1+LFj0Usj3rX9pU6M+yCMShgahGgSPTaAH2KEMuyVOEEBXttG+LwEDijaok5YerYv9Dp6rSLacYCpoxpQ2Vb288h8fN5agvDPMEwC8Mup2zRRZuwWgSvQ6OJFD3xpWtZoYp4Prmu/YBQec3G8iGgsRI7XYYsT6OHn9UVnJlg96wkcf7QSok0XUmQiJlHrMRnfLeHMw5JTMZ2Zes5gK37i0o0OU1kT+MrEbOOxCFLebhrO9hjYo80WERkntPDYVHEbIRR+79howr5WBWl2UmUJg7NwpMX7m/EHDSMC4Oxd/3R5pbW9LGeFSdQ2yD/S9r8vVV7wVGSLyAmqjru7+xsY5zL4XYczhrYQQlDs02+jkVZ9dKZaL8Z3lv8dNYvMfmtg6FDytK+CGt5Vy0T/+EC1MOPBFhAtZEk2/RlCWzkAH475rqP34HsSdpaq7X1YC/u0Xiom3ypBHHsam8zP3wOnlTkTY+wMrnDkz0i8jDHAFgOiLgLcrV410yEXCUNmG86a+ItjWwyiMlnUYNMBkOtUDFKr67n2fQ05+Q4sMmh3P/w6VvktVP83WLDZyJ+/w76FkRi11gOiF0FiQkU1sihoEkHUavxrrHUqXQMW7S+gNUNPyHVMrBEHFOfx0WzynPz6woa0btS1BFwe3y9u8wqoywoVQR0S2Gmxw6SfmEeSUqW01/rtf+wPzUtYqKM7WUajiA= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O0wMCAetKsTET8HkyMvjExJMMO/7Rq/8AmBRwHt8Zc9qmhAK9q39UB/dK+WaAKBUkdN5lKYENeQV3MTpXTpsXubyyBzVUS2nRcPku4ogqFtbTdccyPH1U3+j9wPCaPTA0rZKvk13wBNpDsvf//U1vGyZFeF4v2XfVCsoJ/3PmGayeH2j/tth5znN3JHtPLGn1MNdGRqZmM5eo1HA1fHlYJywyw41l5AA0boaxx6zzqG/xcy29ow/qVmJzMq6T4k/tkAAE7wvevczXTuYN1W5VgZUMSXbV5uF+eYNjOy8NmReO1g2o7i1r6YoZ6L/vgeXRt8jyTdl3nzKsQoyF3hTcqVtNEisyBlUefI6PfPXGvSviNhjkHb0dQ7GaZ3Pewa44mKIiQnz+s/ORhh5V2YsTE8rXOlbcdTFa2VOea+rexMCtdh1OP7t1WOZpSEUaalMjU+/UKEx9SbYhVa4nkJ4OTPj26NdnfY5EZZFY7+d4xX0H1ihmxkL9d3mGu3neJuqVKmbvfXEjJkS4JsfrqMx/ScsLsAdnKlc73J1I3EqeHo3teOm+qscGX91odAzY2U3DmDH2Xw6zzmb1c43CV27S7m5zEahoqZ2k1F49gE4jkW696AAbxBGfK0N60nRO2RA X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 99CHiL6I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QUU6jlNLf87LARx/gai+T3X+ID/rk703ENI6BeiKWLwMVpLFZ9JmcxxbXYtBjd1tOxA1UgmDzHr4o0e7lUA5zXH0J3q/IPttnuFhJr7ZZtTipq0NH5KiMPL+ykceZGxz58wP41fh61yvTnycUwCL0MDRI1p6Snx/h6pKS9dixTWjXfy7bDeKNCrBPvcMW7VbCHYAA79Gg5IMLl+4Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76409655-21f7-4abf-5cd0-08dc410c7eff X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2024 14:15:10.8205 (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: AM8P250MB0089 Subject: [FFmpeg-devel] [PATCH 2/6] avcodec/tiff: Avoid duplicating strings 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: DqtOQK6sUuxR Signed-off-by: Andreas Rheinhardt --- libavcodec/tiff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 4c7460cf41..afa1289e27 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -2028,7 +2028,8 @@ again: av_log(avctx, AV_LOG_WARNING, "Type of GeoTIFF key %d is wrong\n", s->geotags[i].key); continue; } - ret = av_dict_set(&p->metadata, keyname, s->geotags[i].val, 0); + ret = av_dict_set(&p->metadata, keyname, s->geotags[i].val, AV_DICT_DONT_STRDUP_VAL); + s->geotags[i].val = NULL; if (ret<0) { av_log(avctx, AV_LOG_ERROR, "Writing metadata with key '%s' failed\n", keyname); return ret; From patchwork Sun Mar 10 14:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46935 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp742170pzb; Sun, 10 Mar 2024 07:15:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhVKw2mBWrn+8BEGgEyyWcJCXPfdMQBVheUaV2l2RggTkH9Ey1qZ57W0yA8ORxbQaewqrN/Ub0exKIIyGBE/UXqodP580zDhNUYg== X-Google-Smtp-Source: AGHT+IE65luYHYwZ/YgMeNryXk16c9eg8HgT5KjHihL8M591/ktnLhsQ0wmczU28kJ0AxjUoijej X-Received: by 2002:a17:906:b886:b0:a45:bae2:7766 with SMTP id hb6-20020a170906b88600b00a45bae27766mr2645270ejb.27.1710080129758; Sun, 10 Mar 2024 07:15:29 -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 lr13-20020a170906fb8d00b00a45aba160aasi1611303ejb.549.2024.03.10.07.15.29; Sun, 10 Mar 2024 07:15:29 -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=lWMDIIyn; 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 DFC0C68CE03; Sun, 10 Mar 2024 16:15:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2047.outbound.protection.outlook.com [40.92.66.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1C1CB68CD59 for ; Sun, 10 Mar 2024 16:15:19 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Knmvd8XxcnWgkFmULOWA2pYeY+Th8pIA3ze8krc6ZRXbgVAcUTdmLTvJod+ZMSJ0Gtz67gtrtkHqjQmuIbUVpWMwtlUSDME6uIKW1aocvdIsaEr16Wc1bcvHC+M1ySQy/ckj1vJwaOcEOcdbv9koWUuNmKTYJAKc3AxSwOKp0q7bORaNwJu7zNlC+AKN/FHwDQpRbt4JKlluwKC8qKnhE0KJNhUoWq7+KDYDTjIDJwm01Iz+nP7EHpY6oC4c70uj5McLj3ekg56LoTaekW3bbudxkecnWkXonPxNcVeM1A/GtW9J6nUhoVbxKcL+5sCqtENxlbIgv3MZqMZR5vxGkg== 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=T3vEDjY4uv4NOSNUJ2kIC8neyJa24+kVJOPqliJ/pqs=; b=A5cgOSEflPO4TNgj49JNwsWgBRVO2VeG88C2sLc+p4Z3wvaCK5bOBWuiBIZer2O+cm4la69wOrfUabtDRRO07iTvkk9vSncV0UWB09WilG1UbZ8FSZiUbYj0N7nbWeD5vWbr2ABAPMDaszf5sewbK6fkjYT7PVdXkWxf9nXjUfOLchsboxGXMHJI2WOR2bt71vGhnG25lZcwWPpf/PEY40BMX2FEkK9K7OXXJdOiuGhGT9zq4uqs8PF9QtQ7wlGI9ljG/da8RE6dWzx2cEkYS4Ri+E1R4imf+DWvim/bZ/Pf8X+HLDx/YD82TGlzJuBXYTSsW4+Lcz2NltZrt6o8Vw== 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=T3vEDjY4uv4NOSNUJ2kIC8neyJa24+kVJOPqliJ/pqs=; b=lWMDIIyn1LhSLjj9oHFxXN2Bc7CIYDkOuLRj8an6oOxNeQQQKfQuyP1loKTz/AE/4m4Q/ojJWW8o22kStfJb+oR6hG2M5cETHXgldhcWJIRwXN2X5QLtQ2aDWec70ZyqGCalX7blOQOQ55WLSxgO6c+JUERlyrnPXrN7d2E1rGgWMvuU2pnA8zZnj9O60YnMWjT9iWcfs+KxaEaydtgO/nWdRqKHJbetaQD0WiwFncfm0d+gTAj5G84nrm0Z/h2zfk5NEbjTqJ7ZyaJJaqpoKshrdTh0QBYyH7W2LLeg+vdslwfR2CIzRGgbEQ8NtubAXqlbS3wvoQXhLy3L0BBDNw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0089.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Sun, 10 Mar 2024 14:15:17 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.031; Sun, 10 Mar 2024 14:15:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:15:01 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [AAzCl/60d42IqxmqAaEfkjBGbQvxqNFyRwf4+Ciz060=] X-ClientProxiedBy: FR3P281CA0002.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240310141504.440261-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0089:EE_ X-MS-Office365-Filtering-Correlation-Id: 024f11b5-016e-4df6-7411-08dc410c832f X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnrycYYMiKOh26ty8tiVyH4g+lNHMDwoXII+J/XOVljVJPSIB/YjJ3ieiXJm1iixKVS0n57p9rpQ+K+TvvszoH5Argakcm6MzKtDRjqlSrMiAlbyc3Lto9W/94l4H/SQsNlg/mEouq9GThUdcZ52+rut6nKnGcDt/g09ruEbUfEAEO4eDnd3EEgKffdjpTF/KW1KIPSjIxeaBqU2OL1mLWkhih8Z69m8f0iw42PqzL/hsHtt2pdevq1ZlO6KN8SmPoZCjso4x/pJCiSq9lYvDpV1DULot6KiuJrNd3h+NgmN/FOd+/gDmAOZXfF6YqPgLO7UP+4XkiQL+m75hFhv9abFtvnTfziIjlTPEl9x50eeMGl9Z140PVQm0+fEfm0SKVxIQ+yGnNvi4jEiM/8qSWOgayCv6BbZDxK6rEQnayIany/0jYTx5cm9L69Pxv5S+aSIHt+FO8klqo3goexTxnlZQ0XagGSk0uM3+uoiz5y+qGFVVIvnLw+By2uUrt9mQg7ovGD7yzTFsSk1BqV1tFgp+T57C04WVmGOJ7DGPy4ucOeSfVMLOTweMJVvS36k9tzNTlpz9yfU+L7+1lubSIIdpPYLWr96UiJe1I2SLQkJTV+PDcl1d1xv9YIHgfRP57+kSJlBOh4Z5yXi20Dy0Kbp86i2AMlN3lLoXuBrs+IvIFbkwMxJbT/ed4R+XD9QPJrhATKqqWShhUaG/tizwHm4AtOERtgSPSDCkM7SrIfz/uQR3Kex9A4iWE/lcuSBB5g= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qGeGO4OkZlj87WQqSnstRlSDDVeEmYmyRese7zsf4X/ODqp4q3hz9K1twAHtcyCkMNVhqnWBc7HtOSoEDCNC7t70mGcWqX5N7Hyng4WG6PevRkRIm9BdutHLfZx1EnnRlOYaSL3BcNR9dvqQk73ETusLP5wAVHqRYsHX6BPd4u920hGB7FEs0OrLu7hDO+HWRy8F7G2sx5EzPzLmww4kCeeTc98jGVyOUhxSqsoid/H25Ye0b0v0na4KGKu/HA16Rd9MlVf2v8oSh1swHvCMUyTJVes0SpOvy5tUIlzrnHtcGP+pP7h6GLFwBJDeP6B9sf1TYlCoQwy/2HoJeBttMPoLfBQ218OY81H91lRm9yaK2bVwxgz1RtKMmtTsT9vFYLjAd5tyU+lfGpoTDcBkqHYvp1zadPWulQ71z7xGill9I5eWgaIH/NjTcxcHYH/99ARI4j2PpZOso+ibylsQfY/gJdv0dApuYUiWPGgThdEKbYc0HjRSfQ1LKzMYq4dCPVHknKO0zNPQPyJXT+wamHoHnH14vKT2GS7w9KxWhmuzxc2jGy7a8y+KIFW/59KM2A9U4PZ0tkjGP8vRT3I8nu900pX+QSJWnKtq0Cz0IyM6kmpPoUhd2EpjqzS1LdLB X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VMn2uTbv6u2MzYp6vy9RXlMQczYU4d12m/VSk2xiUS311fLs8I8dJKr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zXtSFu336YkBsjxHbZyHt4jsLESxHb7y5TUbo+qaRfgAWL404VVsx06Ri3cae6xW279e7VABVrbS/YFglrjlakYs8IafrkqdA8bfRhEsAObAl37I+nc1qK+q4smsWzBtWRkGZeLGmdMWaVAlja1pKqrHRTAUre0IZgT1BvJNS+gbA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 024f11b5-016e-4df6-7411-08dc410c832f X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2024 14:15:17.8111 (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: AM8P250MB0089 Subject: [FFmpeg-devel] [PATCH 3/6] avcodec/tiff: Don't check before av_freep() 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: S6fymNH5O3hF Signed-off-by: Andreas Rheinhardt --- libavcodec/tiff.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index afa1289e27..5d350f4e7e 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -132,11 +132,8 @@ static void tiff_set_type(TiffContext *s, enum TiffType tiff_type) { static void free_geotags(TiffContext *const s) { - int i; - for (i = 0; i < s->geotag_count; i++) { - if (s->geotags[i].val) - av_freep(&s->geotags[i].val); - } + for (int i = 0; i < s->geotag_count; i++) + av_freep(&s->geotags[i].val); av_freep(&s->geotags); s->geotag_count = 0; } From patchwork Sun Mar 10 14:15:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46936 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp742237pzb; Sun, 10 Mar 2024 07:15:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUxBd+X6Zltr2JQb6A1mEACwSpVV29eg1rgio1s18ZUsy5tHtqrUkTGUETuOYEFQDtUpsMUct+B8iBr1hJ0L6l+ZkUUuA7ePDqCDw== X-Google-Smtp-Source: AGHT+IHnt7c50LS6wnBt9914hUHLsQ4s2pj5ruE+FieQ5iQJAwfQBasshpvJFKXizfpJkZuFEPFU X-Received: by 2002:a50:a45b:0:b0:568:3067:5191 with SMTP id v27-20020a50a45b000000b0056830675191mr2495841edb.38.1710080138725; Sun, 10 Mar 2024 07:15:38 -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 cz18-20020a0564021cb200b005682aab56e8si1572006edb.415.2024.03.10.07.15.38; Sun, 10 Mar 2024 07:15:38 -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=BTU31DEl; 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 0A55A68CC33; Sun, 10 Mar 2024 16:15:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2047.outbound.protection.outlook.com [40.92.66.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3849B68CE21 for ; Sun, 10 Mar 2024 16:15:24 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ue1x6y54Q6wr/DW1LmpiYaf4Gxw+ZA+DrRR4QzVEsj5HpfY6lsu0x4gWS2zsfnJgN566qglsto92ZIMnFuhQjZ3bw0mHX8KRPxSRqhxvjPZXTHbqPZE52qrzyktswcm+nOURfLtB88b4PU/dRUayfge4aMHzr8iPxalF8x6GRiAXVBZbqXkqT86axDjNpKEYZ/9sev7bcjNM0F0ge6D/RXiUXpSZcIUi3MTEWtrcVwXCZcrYLslOkOZ1DkVU/R6HYPogdUGyErHOQgh3QNr+IKB7VhI8sZcfGUAP2KhD9SQRMHC1tl1s0IG8fd2d/nM426Ejl+3BEx323uyxfF2qKA== 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=BLQlMNK/FYMzDXAE4ZLZSgJ1TrwePv1yMHp5tUL1oLo=; b=WsgVBCJyXnJBQGWR0TK8yKcXbMfdCUNg6IEYLBWWXiJo8sYoctiQEP+fw2dhWw2kInXrqhlMXK1ISAEZHRIsFs23zsh5OTopiqe4LI84B8NYiDqlE2gCOZgB23iFM9psCIwfXSN1nkiJ5p2RYpGDjZG0CBCXBlRqGj1K2pUTtOMXq1cRgg21RsTwvr1Km4zolIAC0aShuqn35jEtT15vnke4UQO2fFFSvQiBHWX8rJKcma0lo5tQZFmXhQmV+5ZMwaIhgLys6nt89D74+bEpGUJ7J6vHLeI2u0Adv07DQQqA4S4inZ7AQGFn2SmJ+RsHfVe9x4VnUNW6eucW6zDoWQ== 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=BLQlMNK/FYMzDXAE4ZLZSgJ1TrwePv1yMHp5tUL1oLo=; b=BTU31DEleggIGuE6rzBNQ2FZ6tdZiHrJpOG4yjK/nBLXsg8FZ+16iVZSu4FleH0uG4RkZVKFz48mkgP/hHHEBQIIeIioCM41h1xMLCzpMtMYJdZ5x2lzoQWyTx692G30zXBn0VxRnLJjVVaHbfvWNib5QB8TpCpc1AhW987oW+Mprg6nf2ilHyurFCjEDa68/QKyRqoMyVKJ9Lj7E3bX+3frIZrtVL6fnSAa32ukE+nLc/kQkxGUR2+I4iQZm7UIVWvr5Xlv8kdgxwziyuloLcq+OFKxFbA6WH4IvdNpjp9i4VJ4VyDS4KM/QUS4zoDSM+Dmp2QLWPg67sVKuwWHZw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0089.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Sun, 10 Mar 2024 14:15:19 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.031; Sun, 10 Mar 2024 14:15:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:15:02 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [326qc3zF+NVIy2VmrGNmewxwHfvN4SDnfQJmylL87aw=] X-ClientProxiedBy: FR3P281CA0002.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240310141504.440261-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0089:EE_ X-MS-Office365-Filtering-Correlation-Id: e048a5cd-cf6f-4186-d09e-08dc410c8431 X-MS-Exchange-SLBlob-MailProps: 9IecXKUgicDeTSW5Y8+cEPfAZQXqQEI0KW1i14nJRS+VAADKnlW57DQnukTuQ4DPwCA280Nf8/2ZZaDKoa8BGMyoH0KsUjTVyKmKPTcF+gunhkT81g/EOF5lDi1gdq1tsyKN1QEVa0kikhZNX/a3IMOZLteqIAKJnk8o6QrjbldeAVqWIaDL6HfrexQzF1b2ZHnEOHwgqXnK6qYMN89k0gM+09ZnUK9j611xbdDFFebh25D7kV8mDCSS+YJ7Nl6ZKg4RXRteqW5Mxt5i8g3qiNG4F9iRkdOGiPWjSX0Z8H+097KJHn7NhdOWCNKIjC6O4QGINct8JzjiyLtBnl2KQ5x530kM1B47JRTcLcMwZwYnUtA150wOReNE9PWIkh/9NclxSQcnlEsfD7asqpQJg/xYsQ9TEJpf7to3v9TjOe0O1kS7wQCLe59qzHzP4caWua+6VwomVlZ7TpIsiL/w8PmNP33iAFakb9eOWHt8D0jW/6D1gMmqAhEn7fBgXWpIsng7IVTb0KEgr8RLU9XlV71FMNkKcVA7YzVexd7Jp00bKriQl5hGr/9jDcsITws1a5+0ajN+DWDNY/ZkcD9isysMlg31+Pfv5nfue/qJ1pg8BXaTZHuZBylMfxP2ECQv704cX/Oodq1GYVBjVhyd+9pCEjOv5g87rdvT4vj2oX3L247Xr6ygBjR1HKj2SjE1MQzsZooHqXJbU4btCLt2jalLY4GOSqi6LQn++rG73sJ/y9JRXVk3QQ== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8YaAKSthUuDu1Wxmyg56sUMnemUZ5t5uH1b0iwujiqdZZWZSj/f7cJtb0eCRBJ09bqLpMa7dc4y92NmtUqF/jJd236SaaNrscH5eiDyhlUJx3TRwKBvo/II/V2b5gW6139nYf2UHAnvydUuuihtgP1LefKGE+8G74bm8eB1ShGdZDcfF5MEu6dFRzaagjpM0E4/RpQe2uZAnZXpbgbpI+mImLBkE/Is2d6hlbBWVHF55PY4032cwMNzKuV3UtFDXJ7+T08WaL/4YicawhQMlKx7yhe3AWFkSF8mVyWb8+8WSdp82pt8K/06ZpmSUiWJMFmZc/sLG6JbunsGXtEE2LBpkj0dqOGv3BCwl5z0tAQiQNboDiYI+AYyaoFDD7uJ0225fTMMWjQl0ui/txkbk11vDUel7NSZIwRamyPd8ga4BSCI1wsPDS/V7b0OEgVbihPkTvTSBSryiNIDKzLdqO6Fq0RdVfUju7s3t2ZIB10zwJMWCSaH24QkCSfvZVXWEcNMqkhj0wYBOzIWLipuSYCRhtg58Rhkp9UVhna77TI9QafH+HKTcAcjQ+8VH/PpufQzKPfUy/fziyndyPJa1ieaSvENr8SCiaJIlQqJfDLfv8I3J4Eq3sTuGZM9J5k0m X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t+xSRgAoN9Z7TeJLJZkBGsL0ERthX+OpOe7qOvczNIikk4oy3HulXN19ZnxDvUXI/fZ8aHK/VlNGIdQiboX5ZIYN+y3kTH3l0HgLnPwXFjlFFulQHQqXVRvBC11sAFiJ22NZAe8eSpkVSvKLb8Srcl+WuahzEoHTNF80jqvX0gg2gS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1vwPaU0QzUl1HRcTHY6XLPVgPshGCi1A2tpggpdly14e3GHKfIQIlQALepg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e048a5cd-cf6f-4186-d09e-08dc410c8431 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2024 14:15:19.4780 (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: AM8P250MB0089 Subject: [FFmpeg-devel] [PATCH 4/6] avcodec/tiff: Improve inclusions 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: DaEsqpjhvlqv Signed-off-by: Andreas Rheinhardt --- libavcodec/mjpegdec.c | 1 - libavcodec/tiff.c | 1 + libavcodec/tiff.h | 3 --- libavcodec/tiffenc.c | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 43b36d0a8f..c9409eac6c 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -52,7 +52,6 @@ #include "jpeglsdec.h" #include "profiles.h" #include "put_bits.h" -#include "tiff.h" #include "exif.h" #include "bytestream.h" #include "tiff_common.h" diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 5d350f4e7e..15e5edd93b 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -48,6 +48,7 @@ #include "faxcompr.h" #include "lzw.h" #include "tiff.h" +#include "tiff_common.h" #include "tiff_data.h" #include "mjpegdec.h" #include "thread.h" diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h index e67c59abad..2dd21dea52 100644 --- a/libavcodec/tiff.h +++ b/libavcodec/tiff.h @@ -30,9 +30,6 @@ #ifndef AVCODEC_TIFF_H #define AVCODEC_TIFF_H -#include -#include "tiff_common.h" - /** TIFF types in ascenting priority (last in the list is highest) */ enum TiffType { /** TIFF image based on the TIFF 6.0 or TIFF/EP (ISO 12234-2) specifications */ diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index dfe308ee17..7c3c03f1f3 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -30,7 +30,6 @@ #include #endif -#include "libavutil/imgutils.h" #include "libavutil/log.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" @@ -39,9 +38,9 @@ #include "codec_internal.h" #include "encode.h" #include "lzw.h" -#include "put_bits.h" #include "rle.h" #include "tiff.h" +#include "tiff_common.h" #include "version.h" #define TIFF_MAX_ENTRY 32 From patchwork Sun Mar 10 14:15:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46937 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp742308pzb; Sun, 10 Mar 2024 07:15:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+QDPgbAOk0zO0l4QpOfWX8tUd8cFikt1QMhAlc7jfiiLMmD7Dgje3Ia+bu5nSQgzecAul509zILeKONvWuyhRDkD5IMMYgbKJkQ== X-Google-Smtp-Source: AGHT+IFH9cheWUf4OYOzzXvruPU+pCFd1Q7wrg0R6u6mTTzqK1RtQ4+OqdvcBvWhTiHJbjJnuwDl X-Received: by 2002:a05:6512:38a8:b0:513:9d80:f776 with SMTP id o8-20020a05651238a800b005139d80f776mr2242897lft.30.1710080147530; Sun, 10 Mar 2024 07:15:47 -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 t1-20020a170906a10100b00a45fefe5915si1567001ejy.899.2024.03.10.07.15.47; Sun, 10 Mar 2024 07:15:47 -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="OnxpkK8/"; 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 17FA168CF0F; Sun, 10 Mar 2024 16:15:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2047.outbound.protection.outlook.com [40.92.66.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5410E68CDB9 for ; Sun, 10 Mar 2024 16:15:29 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dmv4fnrNsFXNXlbDWgXbU1QUFMlZKPSF2p+UNU3OivNUXGHEdxOyynmEs4PayhYaUu7wbB2XPshDEKovbCwZ1Xg6DLuia+0GVst38a3AC7WLX+fiOVV02UeGzNxY/kSBrIIpC+iWkUbLOcwlHnR9L3Doh1HPNqwc3/G8auTAqEdeUpa05E0Xl6KD3Ucj00s8IObNGYeEfQ4lWZ7sw015I2Yt8rgXdTUpdoeKmQYXF0efH6hg6vBc8Mv7SK3MFVZA3CrjldmRqJxiZjOVFNUKws/gZda0iX9CB8YoE19Nqf355pkW5J866BH2hz4zYFMbh8WCI9nQJNPBVEvWPxsxEQ== 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=ytIrNlDY3xXG9qZIw8TIOFoFgwojfb6DQLmnXSRN9JI=; b=hLIRDdaxv14uMqR0bKzO4C05kDf+d0ZcKW4cUpAJjOh0j5B+L7EOHtQF3DSz8DMyZv2GwUILWd7YM7AC6cpfuKjlB4v6WsAaudI+zni/tFLTpdvBR1gnOMnjmdPzU9y5uiYZ82k5QDhw5agoUvClOQn0/L5SRmKmTjgR51uJerfgCY2bnjavJkDrwQ22YpQWCWabRMY/6x4vMBqcxpM8kgHXitW1n/81ePQDN/oL3YSdDb0Fyb1lFUNQVkkmDywEme6uLLRo7qN6sp3tnqY2QxC2RE56gynIanGNVN4FJ4797Lfhj4EWZ2zAn5vdcdq5HdCY7smxRcJ9rguWgbqS2w== 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=ytIrNlDY3xXG9qZIw8TIOFoFgwojfb6DQLmnXSRN9JI=; b=OnxpkK8/154SuvdiDJhJkGJsM47C6tBZP/k2fQ675cDPrZgdaRBhWk5vxrnoHUOxOW4vqu28TD5LQFcvvoappUJQZAir3eg6WuJ26yapd6xRUH4iHhQcDhjt79bZZGPIG49+1lLOSmQp5rYThwDQckYwn0dycBO9+QC72Jw2ZFAiezVn9MiwvjseUJQO3vqXGU6aJaYKFIxL+xoear0u2gkEYMC1BZ1Ft8qmxxup0BaiK5Fv2ERzizU/JrOA1qvQx47Cu8YtLnzKf9hXfe7VRdtzLDIBvBWNg0D0iyxsghx669Ss8IfUA8rGzx0GsHTnkYvHr+zH7HN3Zxee7ISahg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0089.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Sun, 10 Mar 2024 14:15:20 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.031; Sun, 10 Mar 2024 14:15:20 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:15:03 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [vxPJ169FClP8Z5g8YjhKpUI0gsSvsGIXWSQeNe4z8HY=] X-ClientProxiedBy: FR3P281CA0002.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240310141504.440261-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0089:EE_ X-MS-Office365-Filtering-Correlation-Id: 1be143af-7e5e-4e99-ef46-08dc410c84e9 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnrycYYMiKOh26ty8ti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ZTkmuCHK20V98pIiB4fovryDUdZAZGzb5sIm+MCTqrNQlY4bDQMbyqbCthI8JU+rIi3fDhniBlVScQxVqqxmrjMmIbkX/o6uo+m30kxycFgnUME01peE58fkv21Jqemp1iKvpo+Mbs5PsxGPCI8+MuX8+r1zOeUYln9oAwJQAVGnqKbkaq5H9UwJ4Ef77v6wYXs91qNUYYsBnHSO/5jpzMcwr4z3fgM5BtKv/7S+5cRPJdKILlTsHWdiD5GXRa25aQhC/nyALOMUCD1Oo3mcqwdEaqLWWdJ5yr95X95TD9qB5myN0yW6utbSDFpF7w5guf36VQklN6TWKQb07d7eTw43bA6MiZmLlwfHv+OExWBFfbFKxWKqJHVjAMiqB62O8Uqtkodro+L6bNWkUUSO9krlyeeD8fHUZI3pvsohNMLiXaTutuIWR4QUHCuVLKIJ+WR9vp5x+Vw2dPwOwy4dFe2/xAXkzi/7Ygh84yHdDvqYKijoB88++RQ7yCWZhKgMjaYX7KfwIURjLfe3jRnXFi+Ho+tHawoK6d7xJKExtGBdlE7EvXl4b8jOBsFfwunlCdEnHCgkFT7NfKBXY7FMnsGHMR8oBOZNngtzE2/oUXkqF/sw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1be143af-7e5e-4e99-ef46-08dc410c84e9 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2024 14:15:20.6736 (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: AM8P250MB0089 Subject: [FFmpeg-devel] [PATCH 5/6] avcodec/tiff_data: Avoid relocations for TiffGeoTagNameType 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: zTLHPHwo+Ilm Instead store all the strings in one continugous string (with internal \0) and use offsets to access the actual substrings. This replaces the pointers to the strings and therefore avoids relocations (and on x64, it actually shrinks TiffGeoTagNameType by reusing padding to store the offset field). This saves 720B of .data.rel.ro and 1080B of .rela.dyn (containing the relocation records) here while increasing .rodata by 384B. Signed-off-by: Andreas Rheinhardt --- I also have patches for the remaining tables, but am not satisfied with them yet. libavcodec/tiff.c | 28 +++++---- libavcodec/tiff.h | 5 -- libavcodec/tiff_data.h | 129 ++++++++++++++++++++++++----------------- 3 files changed, 92 insertions(+), 70 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 15e5edd93b..004db89c6b 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -139,27 +139,31 @@ static void free_geotags(TiffContext *const s) s->geotag_count = 0; } -#define RET_GEOKEY(TYPE, array, element)\ +static const char *get_geokey_name(int key) +{ +#define RET_GEOKEY_STR(TYPE, array)\ if (key >= TIFF_##TYPE##_KEY_ID_OFFSET &&\ key - TIFF_##TYPE##_KEY_ID_OFFSET < FF_ARRAY_ELEMS(tiff_##array##_name_type_map))\ - return tiff_##array##_name_type_map[key - TIFF_##TYPE##_KEY_ID_OFFSET].element; + return tiff_##array##_name_type_string + tiff_##array##_name_type_map[key - TIFF_##TYPE##_KEY_ID_OFFSET].offset; -static const char *get_geokey_name(int key) -{ - RET_GEOKEY(VERT, vert, name); - RET_GEOKEY(PROJ, proj, name); - RET_GEOKEY(GEOG, geog, name); - RET_GEOKEY(CONF, conf, name); + RET_GEOKEY_STR(VERT, vert); + RET_GEOKEY_STR(PROJ, proj); + RET_GEOKEY_STR(GEOG, geog); + RET_GEOKEY_STR(CONF, conf); return NULL; } static int get_geokey_type(int key) { - RET_GEOKEY(VERT, vert, type); - RET_GEOKEY(PROJ, proj, type); - RET_GEOKEY(GEOG, geog, type); - RET_GEOKEY(CONF, conf, type); +#define RET_GEOKEY_TYPE(TYPE, array)\ + if (key >= TIFF_##TYPE##_KEY_ID_OFFSET &&\ + key - TIFF_##TYPE##_KEY_ID_OFFSET < FF_ARRAY_ELEMS(tiff_##array##_name_type_map))\ + return tiff_##array##_name_type_map[key - TIFF_##TYPE##_KEY_ID_OFFSET].type; + RET_GEOKEY_TYPE(VERT, vert); + RET_GEOKEY_TYPE(PROJ, proj); + RET_GEOKEY_TYPE(GEOG, geog); + RET_GEOKEY_TYPE(CONF, conf); return AVERROR_INVALIDDATA; } diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h index 2dd21dea52..12afcfa6e5 100644 --- a/libavcodec/tiff.h +++ b/libavcodec/tiff.h @@ -222,9 +222,4 @@ typedef struct TiffGeoTagKeyName { const char *const name; } TiffGeoTagKeyName; -typedef struct TiffGeoTagNameType { - const char *const name; - const enum TiffGeoTagType type; -} TiffGeoTagNameType; - #endif /* AVCODEC_TIFF_H */ diff --git a/libavcodec/tiff_data.h b/libavcodec/tiff_data.h index 9b123ca8df..9ed46d31af 100644 --- a/libavcodec/tiff_data.h +++ b/libavcodec/tiff_data.h @@ -32,66 +32,89 @@ #include "tiff.h" +typedef struct TiffGeoTagNameType { + enum TiffGeoTagType type; + unsigned offset; +} TiffGeoTagNameType; + #define TIFF_CONF_KEY_ID_OFFSET 1024 -static const TiffGeoTagNameType tiff_conf_name_type_map[] = { - {"GTModelTypeGeoKey", GEOTIFF_SHORT }, - {"GTRasterTypeGeoKey", GEOTIFF_SHORT }, - {"GTCitationGeoKey", GEOTIFF_STRING} -}; +#define CONF_NAME_TYPE_MAP(KEY) \ + KEY(GTModelTypeGeoKey, SHORT ) \ + KEY(GTRasterTypeGeoKey, SHORT ) \ + KEY(GTCitationGeoKey, STRING) \ #define TIFF_GEOG_KEY_ID_OFFSET 2048 -static const TiffGeoTagNameType tiff_geog_name_type_map[] = { - {"GeographicTypeGeoKey", GEOTIFF_SHORT }, - {"GeogCitationGeoKey", GEOTIFF_STRING}, - {"GeogGeodeticDatumGeoKey", GEOTIFF_SHORT }, - {"GeogPrimeMeridianGeoKey", GEOTIFF_SHORT }, - {"GeogLinearUnitsGeoKey", GEOTIFF_SHORT }, - {"GeogLinearUnitSizeGeoKey", GEOTIFF_DOUBLE}, - {"GeogAngularUnitsGeoKey", GEOTIFF_SHORT }, - {"GeogAngularUnitSizeGeoKey", GEOTIFF_DOUBLE}, - {"GeogEllipsoidGeoKey", GEOTIFF_SHORT }, - {"GeogSemiMajorAxisGeoKey", GEOTIFF_DOUBLE}, - {"GeogSemiMinorAxisGeoKey", GEOTIFF_DOUBLE}, - {"GeogInvFlatteningGeoKey", GEOTIFF_DOUBLE}, - {"GeogAzimuthUnitsGeoKey", GEOTIFF_SHORT }, - {"GeogPrimeMeridianLongGeoKey", GEOTIFF_DOUBLE} -}; +#define GEOG_NAME_TYPE_MAP(KEY) \ + KEY(GeographicTypeGeoKey, SHORT ) \ + KEY(GeogCitationGeoKey, STRING) \ + KEY(GeogGeodeticDatumGeoKey, SHORT ) \ + KEY(GeogPrimeMeridianGeoKey, SHORT ) \ + KEY(GeogLinearUnitsGeoKey, SHORT ) \ + KEY(GeogLinearUnitSizeGeoKey, DOUBLE) \ + KEY(GeogAngularUnitsGeoKey, SHORT ) \ + KEY(GeogAngularUnitSizeGeoKey, DOUBLE) \ + KEY(GeogEllipsoidGeoKey, SHORT ) \ + KEY(GeogSemiMajorAxisGeoKey, DOUBLE) \ + KEY(GeogSemiMinorAxisGeoKey, DOUBLE) \ + KEY(GeogInvFlatteningGeoKey, DOUBLE) \ + KEY(GeogAzimuthUnitsGeoKey, SHORT ) \ + KEY(GeogPrimeMeridianLongGeoKey, DOUBLE) \ #define TIFF_PROJ_KEY_ID_OFFSET 3072 -static const TiffGeoTagNameType tiff_proj_name_type_map[] = { - {"ProjectedCSTypeGeoKey", GEOTIFF_SHORT }, - {"PCSCitationGeoKey", GEOTIFF_STRING}, - {"ProjectionGeoKey", GEOTIFF_SHORT }, - {"ProjCoordTransGeoKey", GEOTIFF_SHORT }, - {"ProjLinearUnitsGeoKey", GEOTIFF_SHORT }, - {"ProjLinearUnitSizeGeoKey", GEOTIFF_DOUBLE}, - {"ProjStdParallel1GeoKey", GEOTIFF_DOUBLE}, - {"ProjStdParallel2GeoKey", GEOTIFF_DOUBLE}, - {"ProjNatOriginLongGeoKey", GEOTIFF_DOUBLE}, - {"ProjNatOriginLatGeoKey", GEOTIFF_DOUBLE}, - {"ProjFalseEastingGeoKey", GEOTIFF_DOUBLE}, - {"ProjFalseNorthingGeoKey", GEOTIFF_DOUBLE}, - {"ProjFalseOriginLongGeoKey", GEOTIFF_DOUBLE}, - {"ProjFalseOriginLatGeoKey", GEOTIFF_DOUBLE}, - {"ProjFalseOriginEastingGeoKey", GEOTIFF_DOUBLE}, - {"ProjFalseOriginNorthingGeoKey", GEOTIFF_DOUBLE}, - {"ProjCenterLongGeoKey", GEOTIFF_DOUBLE}, - {"ProjCenterLatGeoKey", GEOTIFF_DOUBLE}, - {"ProjCenterEastingGeoKey", GEOTIFF_DOUBLE}, - {"ProjCenterNorthingGeoKey", GEOTIFF_DOUBLE}, - {"ProjScaleAtNatOriginGeoKey", GEOTIFF_DOUBLE}, - {"ProjScaleAtCenterGeoKey", GEOTIFF_DOUBLE}, - {"ProjAzimuthAngleGeoKey", GEOTIFF_DOUBLE}, - {"ProjStraightVertPoleLongGeoKey", GEOTIFF_DOUBLE} -}; +#define PROJ_NAME_TYPE_MAP(KEY) \ + KEY(ProjectedCSTypeGeoKey, SHORT ) \ + KEY(PCSCitationGeoKey, STRING) \ + KEY(ProjectionGeoKey, SHORT ) \ + KEY(ProjCoordTransGeoKey, SHORT ) \ + KEY(ProjLinearUnitsGeoKey, SHORT ) \ + KEY(ProjLinearUnitSizeGeoKey, DOUBLE) \ + KEY(ProjStdParallel1GeoKey, DOUBLE) \ + KEY(ProjStdParallel2GeoKey, DOUBLE) \ + KEY(ProjNatOriginLongGeoKey, DOUBLE) \ + KEY(ProjNatOriginLatGeoKey, DOUBLE) \ + KEY(ProjFalseEastingGeoKey, DOUBLE) \ + KEY(ProjFalseNorthingGeoKey, DOUBLE) \ + KEY(ProjFalseOriginLongGeoKey, DOUBLE) \ + KEY(ProjFalseOriginLatGeoKey, DOUBLE) \ + KEY(ProjFalseOriginEastingGeoKey, DOUBLE) \ + KEY(ProjFalseOriginNorthingGeoKey, DOUBLE) \ + KEY(ProjCenterLongGeoKey, DOUBLE) \ + KEY(ProjCenterLatGeoKey, DOUBLE) \ + KEY(ProjCenterEastingGeoKey, DOUBLE) \ + KEY(ProjCenterNorthingGeoKey, DOUBLE) \ + KEY(ProjScaleAtNatOriginGeoKey, DOUBLE) \ + KEY(ProjScaleAtCenterGeoKey, DOUBLE) \ + KEY(ProjAzimuthAngleGeoKey, DOUBLE) \ + KEY(ProjStraightVertPoleLongGeoKey, DOUBLE) \ #define TIFF_VERT_KEY_ID_OFFSET 4096 -static const TiffGeoTagNameType tiff_vert_name_type_map[] = { - {"VerticalCSTypeGeoKey", GEOTIFF_SHORT }, - {"VerticalCitationGeoKey", GEOTIFF_STRING}, - {"VerticalDatumGeoKey", GEOTIFF_SHORT }, - {"VerticalUnitsGeoKey", GEOTIFF_SHORT } -}; +#define VERT_NAME_TYPE_MAP(KEY) \ + KEY(VerticalCSTypeGeoKey, SHORT ) \ + KEY(VerticalCitationGeoKey, STRING) \ + KEY(VerticalDatumGeoKey, SHORT ) \ + KEY(VerticalUnitsGeoKey, SHORT ) \ + +#define ADD_OFFSET(NAME, TYPE) \ + NAME ## _OFFSET, \ + NAME ## _END = NAME ## _OFFSET + sizeof(#NAME) - 1, \ + +#define STRING(NAME, TYPE) #NAME "\0" + +#define ENTRY(NAME, TYPE) { .type = GEOTIFF_ ## TYPE, .offset = NAME ## _OFFSET }, +#define NAME_TYPE_MAP(NAME, name) \ + enum { \ + NAME ## _NAME_TYPE_MAP(ADD_OFFSET) \ + }; \ + static const TiffGeoTagNameType tiff_ ## name ## _name_type_map[] = { \ + NAME ## _NAME_TYPE_MAP(ENTRY) \ + }; \ + static const char *const tiff_ ## name ## _name_type_string = \ + NAME ## _NAME_TYPE_MAP(STRING) + +NAME_TYPE_MAP(CONF, conf); +NAME_TYPE_MAP(GEOG, geog); +NAME_TYPE_MAP(PROJ, proj); +NAME_TYPE_MAP(VERT, vert); #define TIFF_GEO_KEY_UNDEFINED 0 #define TIFF_GEO_KEY_USER_DEFINED 32767 From patchwork Sun Mar 10 14:15:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46938 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp742374pzb; Sun, 10 Mar 2024 07:15:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUo/xgCx2csm36uqIbDDLTbHdhEZ7JNLCL0qnzySIvWFrQIJ+oAPmFMe41hns/3aREEeTi2ih2vmXheav7IO4RIRuMAz3LDtyvVOQ== X-Google-Smtp-Source: AGHT+IGlkmZNVtSMScQkUDvmep57W8NPPHCb5hfb9qX1aDF0dQwj8TASYNNp+jE97HsWJQbDnDK0 X-Received: by 2002:a17:907:970a:b0:a46:22fc:74d3 with SMTP id jg10-20020a170907970a00b00a4622fc74d3mr927491ejc.72.1710080156868; Sun, 10 Mar 2024 07:15:56 -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 jr3-20020a170906a98300b00a46275b967dsi92189ejb.869.2024.03.10.07.15.56; Sun, 10 Mar 2024 07:15:56 -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=YtyVm9BU; 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 672AB68CE33; Sun, 10 Mar 2024 16:15:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2047.outbound.protection.outlook.com [40.92.66.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A45B768CE3D for ; Sun, 10 Mar 2024 16:15:34 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GSjNaKZjpZt9Tij0HxkeCR6S+DqcoYrhLev2sHucAim7KkBcVXYI7Re63XxwXEqE9scdWCby7k9wBVqwhojmQhFEaN7g8n1qNYzSnC4yX5eJH9OZ5eu66G46Cec/H+R3b/nk4QfGFNZMXOm/N9x8gs333Rrm9AWMCPw6wHSy6cld4j43nmEcF91VObQH4UzMbT92w1azymJny9ksiN5tjkn7pCNPSqj5ThIV7QBuTJczcdNNIdqL2QhgtI/NB4gG3RrWzoXCcVYMfi0UENsqdQSJZgYxUngduMg63LdzUnG6AYIko0ZUydbnnl1UErpXyEFZo7BeDS7iXaP46zY7YQ== 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=IpMo+7a9sEgSwku6ZcaW0iaaL1hMsiePeeJyYUdNBOk=; b=D/IogUNDZYONjh2dQxfKuRQ311h03+EPW4JMxMVro+iQJL1fS5V+J7k6C+GM1L3rBxE9iDr6YM85OlzAEVSCCFSnYdnBE0Txf3dZd9w7/noOyJNVclUNQ6pBR8vxBJmZCd4HgAECXfcSNUs6bR89O+pmZHvxfZwCmJozawT/gXgpjp+wFSdc5bEVnvLDAlBVRyY4eB8EpbaDC0agKTZf8a0uUDPVCXQ1Wlle54NQfUV09yJndXn1sEST7bRDLPWGUj2nJMHH+XJ+sziP0nAViPpM9+kHrbMdBXvvF7bdHfuUK/FD7hTrNDcm3YiPehyOYTtgq2R3PZDOyl+sZFPwLA== 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=IpMo+7a9sEgSwku6ZcaW0iaaL1hMsiePeeJyYUdNBOk=; b=YtyVm9BUvp3HTkPIyAEkYe3Q9i0HIFzQvWLpR2m11CZkZQQv8IYf+A4nMzUNQUWLODSWsrmeB2ZssEE64i79vpGPsDNNchwEM+mLCjCu8fM7bXp0e3vLsYQedx5raIHOFqtO5saAxHN34su8xRVIhoEVzlsKpft3uaqWKVZl07Seeak54C4WsvLdbwwq/fArBf9dpl6TGArOZnV76lCuwHcWHQbQ0SIV2oWTwWLGc71MVaGWrBatwYA4oh54vjYjFMlDTjOf6MoE+Hfncy5UXfyO4z73vd7TbHQ5A4NznHexyxsZHs/y+IPFToUlcazJ/8j2tM7FyS4jBlma/Mgm8A== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0089.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Sun, 10 Mar 2024 14:15:22 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.031; Sun, 10 Mar 2024 14:15:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Mar 2024 15:15:04 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [tpR4wlU2UFfiT7GbbX7W6kKE7ue1hIvy+qksjLMTizA=] X-ClientProxiedBy: FR3P281CA0002.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240310141504.440261-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0089:EE_ X-MS-Office365-Filtering-Correlation-Id: 62c6a725-a4ba-478d-6958-08dc410c85a9 X-MS-Exchange-SLBlob-MailProps: quCBMN2EvO+l2vvFO1ePCYDuTB0dbhYvCtdubrVj0iKHtGP/0vwH0P7HBZfAGngEhwm0WEVZH+vMziOlfO28sbM4bDjv3PndnMB1piYRp2FkHRcF2ifxVP+rU2nrRvwMtDUFH0+1XLWTc4GENLml51DJmI0HkeHtauYWbSfwBO6McUILG1bbHBPsMAVXPeJPChSOtMfgJF0fM8Q/lAfW3x3AURm6ovKgcEHiEm09v5Brfg1Dd5VffZQQ1ckndx/I0M3Ig9q9ArhPdqg8sBqeJogpeEuwxr7WRsw2Q2mx4dQJwasVyQae8cQ0hvlKiy+O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ksKkZ2u0jNES5tGZ5qHmVaQJvKFhBua5KmjIz068NKZVVlmn+LDAQW0nofVJ/uBZBoY35xymwRo3xnbLCd/Tje+CMhxcjwe/nwQpbu3rTK8q+nTrJ28bkLIA+cFWtDmXoDiUxrG1Cb7U4bRY+xof/5GW/3+CIJLh1+YgkapaQi/Xp5VpIg37ZXbTPAIWiKev76mX2EbPF12hgjh86QclSG6XwLHOwh0Y3X3kIkvoJFUTlWnEw8icCLcbLxz4JuU04kkHhbJOqc4MXn8LYLDa+RAXEjzIbxWoORK7HJowBMBiapxRs3Bl29Oct+hfbkTq452q2u8jw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62c6a725-a4ba-478d-6958-08dc410c85a9 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2024 14:15:21.9482 (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: AM8P250MB0089 Subject: [FFmpeg-devel] [PATCH 6/6] avcodec/tiff_data: Remove incorrect GeoTIFF entries 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: EKRJg9t/s1E8 They are incorrect according to [1]. They also share keys with valid entries, so that it is unspecified which entry bsearch returns in this case. Fix this by removing the incorrect values. [1]: https://www.earthdata.nasa.gov/s3fs-public/imported/19-008r4.pdf Signed-off-by: Andreas Rheinhardt --- libavcodec/tiff_data.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libavcodec/tiff_data.h b/libavcodec/tiff_data.h index 9ed46d31af..1742ccf60f 100644 --- a/libavcodec/tiff_data.h +++ b/libavcodec/tiff_data.h @@ -804,13 +804,9 @@ static const TiffGeoTagKeyName tiff_proj_cs_type_codes[] = { {26771, "PCS_NAD27_Illinois_East"}, {26772, "PCS_NAD27_Illinois_West"}, {26773, "PCS_NAD27_Indiana_East"}, - {26774, "PCS_NAD27_BLM_14N_feet"}, {26774, "PCS_NAD27_Indiana_West"}, - {26775, "PCS_NAD27_BLM_15N_feet"}, {26775, "PCS_NAD27_Iowa_North"}, - {26776, "PCS_NAD27_BLM_16N_feet"}, {26776, "PCS_NAD27_Iowa_South"}, - {26777, "PCS_NAD27_BLM_17N_feet"}, {26777, "PCS_NAD27_Kansas_North"}, {26778, "PCS_NAD27_Kansas_South"}, {26779, "PCS_NAD27_Kentucky_North"},