From patchwork Mon Sep 13 13:46:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30209 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4015230iov; Mon, 13 Sep 2021 06:47:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs7g/pPG1gV4BTemUZwoChYRxmmtJVtCwGv1MIp1F4F6Tla7otAYNgtXp925nUAfFh9Jwu X-Received: by 2002:a17:906:1806:: with SMTP id v6mr12999396eje.420.1631540824518; Mon, 13 Sep 2021 06:47:04 -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 g21si7362733edb.488.2021.09.13.06.47.03; Mon, 13 Sep 2021 06:47:04 -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=AHOMWGrA; 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 C9DA868ADC6; Mon, 13 Sep 2021 16:46:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2053.outbound.protection.outlook.com [40.92.90.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F0E0B68A64B for ; Mon, 13 Sep 2021 16:46:53 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ficKSl6kZwNOsg3Tnok76NLWsMnETxSqLlEE5DYjfZEQtASPfIjB1KwzjpR3UrAcnLuaOOpwA/EdBYeErLYRcSkfOI3DtByT4M5oMYs/RwS/kyNpYF9kauSN6HwpFnhQMqSQwVKII2YMUJi8j8Le3aBgl4/MK04jTB/RjqOLFr7frDcUlXrLy96JR1mUSwIf4TPcavMKAZmi2xAopOZOzwP6PAnc6PEY/pEjp1a0Z5oI/lp6cdZQU+1bDvuR3OGLsnintK8WVseNHjA7ICVdfaPYKgl6KfLgzWnwejvGkBMZ5OyS/5aS9/08VUFUK8KorQj5oeXqti8ZBAxcRAkCsA== 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; bh=vmmlr2WfGWmeIYd4kUCYFMO/f360HdHFnWjTAAyvLn0=; b=YEHweEyDqb36gRUhvK/yYqviToj7WApKRCaa72I/L+K2qLyQXJOVugz19FaW075AgSnxzCF+TLUXKtwD/P1SNe/gwGScBSzQ3V9Mg4g1npT/gB+Dd+DGCxrsM74FRWvk4EqhC1YyF5EOfEYfA3okIZw4v6tvHJcfeW5HqlqAWW4baQUKnGXmvB3D+Fb3TGDFi10bispSpgZUG0s8IuXOJlGOrMueEtaBC0dx+khGM2nZWpIvwZO0rR7U6wH7hvF42BJL03y2xBSzzeePPK8/UcvpsYYmDB1jFX1YGQhybHII9CT7eVqIH/OBj+BY5mOCohSkHko2zwHY1OuNPgqaxA== 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=vmmlr2WfGWmeIYd4kUCYFMO/f360HdHFnWjTAAyvLn0=; b=AHOMWGrANZ9rtmSechkcdkZM0DNfDxTv0kY1YoYZyJRyNjwhyDCq/wSti8s47XtHXaprv9fumFh60SHKZl9hCBA3deGuAua3MTBFQbi+7cHN6kWm5Cum7c5wV+oyQ1Y0/P7lU/pDrYryihPAD3PSXBNtSY5J1gCwcVuJpJ9JQPHkAzeopTC3i1EUEMl6dV4Bg3Jka0VdrdhSRbe4TYmQMfFgT/L8fgDrYXMML1w/lQT2gY/pwXqTmYpTctQ1uUesaap/B1StXBhclkHNUdpGhuvRoHkQzpFQXKhyMxBegIAwYhM1myjqpFJefRYrnOM8dxMw6i4uYkJWYtDE15+uyA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3832.eurprd03.prod.outlook.com (2603:10a6:20b:18::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:46:52 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:46:52 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:46:33 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [YCVju7lRRMm1qDOqXuoQ0f1smfnWjBSX] X-ClientProxiedBy: PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913134642.2727609-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by PR3P193CA0039.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 13:46:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3638bd7-d96c-43ed-d871-08d976bcf0b3 X-MS-Exchange-SLBlob-MailProps: f36zkjAOy3V/TtV3mrfogcNkFyC66tVZ1qb/dvYHp+w7MC1g4RFWtTpKHcWb4YtFKEAnxoLJeWNjyUk5KOgDi5OZ4v7QEIRpgX9hJhszdBqyo10gL+o4OH/phnzOk6Z8RRd8NnmOWwXzna3xX+57BA1lBACpBIu9FBGO5aeJJFWyzMs5ZxZlWspFAM6sbtiBp6Ppxk0//EGCAmRpKtkuwqLlUa3FaCGLCU5dEcV0O3Bh8IhQ5kWo7pMUiLEiq7nYVRmzWaFDjroIhb/SpP4qWL9egVuHtgWLTugLlNMXo0ro0gs33i2SreyaZOtjvB4naGqxzr+iQVkXwmS+v5pgFH6iipr9tgiTY9eNbk6/DF5NodmaELxqQ3coQYaOdCI0p6ImGYQne4yfobdQYIWchENMb6QKb7E7FDQ+686fcUZASF2bqQe3rjIkvYhj0VQG+KylzN5LghpJZJyJUhvaJ491ZvbTCNGNGyYhAWJRkP6NR45rGA160ZFnVl5agv1JmBkb0LusykEppUkWX1HzxDfunGmNT8ddiNC3Le78o1hRK8rHe76ykEsRUJ4qoQFctxR3MBMsdPGPH3rD2AaY1GHV7pVPOosLzWTVYqhYgHZ3egTQgUzSMgHg8oJsKRjHOaF5Y3A1BwzrdrZa9VJU8k/s3DTAlaX5DQHnzEhMSaiKkX6xWVWYBgES1kjxcAiWwt6FErM3DxNH4nDnhLrP4RVMBKdqaDlpeI4NxYo3jgc= X-MS-TrafficTypeDiagnostic: AM6PR03MB3832: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2aCz+BoTBq6lO8rizK9brlLb3yB5FLAaWPeJ2JVOi4iW5/8qzlAF6MCvq0AW2eoeaeHxouYmoKKQm8SX7qgAaoZlVg3YxiTaGxcim92OuZTdj3fB9cYjrZ/MeMvUYGAx0E/lYdriyHYFwk40l+QVcc2xkf5M04jCkNNjsG+21EnjJiyapqBuAXE/XVJo/pJ6fRs+UCLFwdPeKjD0ZEXeDmrOPS9fS2Jvh9tzCORq55+NaKi3Gx51OtRZZG1nhsGS/1VHl9H2Y8JP8eqFGnwL8BeC/UwyA9vIdVU0QlYemm10xdjuw0UHlKTtheMKqruK23g9HrOb55+5zKc/q444A2Gi4nrFyyGYD5shagSl7Z0rX2KuMsy4GYVD2uS0VysehTEEOyfi7o6kC5ASfF/ot2rdSYWx/mFCU7916Y8iMTB+h4TrzZp5siMAOO6/Ql0x X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f/mqOj6ph8DR8ZZLweBZleatIHM9ciaswnmYxxfjZRtMcbnDqBUV1txtV6InkUlxKDFKuq1nx9FPA6Hr5KE2GTaRJMyvXqLKtnp05YRDLdmxi8oKyPobE3bizlJQSim+HoXLm5EWgBUwGD0eFQPqbg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3638bd7-d96c-43ed-d871-08d976bcf0b3 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:46:52.0056 (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: AM6PR03MB3832 Subject: [FFmpeg-devel] [PATCH 01/10] avcodec/mpegvideo: Move startcodes to mpeg12.h 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: HeTU1xS/z/I2 And remove the MPEG-4-specific SLICE_START_CODE, which duplicates SLICE_STARTCODE. Signed-off-by: Andreas Rheinhardt --- I can add a commit giving these startcodes a proper MPEG12_ prefix later if desired. (Some of these startcodes are btw duplicated in lavf/mpegvideodec.c.) libavcodec/ituh263dec.c | 4 ++-- libavcodec/mpeg12.h | 10 ++++++++++ libavcodec/mpeg4videodec.c | 2 +- libavcodec/mpegvideo.h | 12 ------------ 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 565a6a1ac8..3f982f414f 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -217,11 +217,11 @@ int ff_h263_resync(MpegEncContext *s){ if(s->codec_id==AV_CODEC_ID_MPEG4 && s->studio_profile) { align_get_bits(&s->gb); - while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_START_CODE) { + while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_STARTCODE) { get_bits(&s->gb, 8); } - if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_START_CODE) + if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_STARTCODE) return get_bits_count(&s->gb); else return -1; diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h index 4cd48b5d20..a7b94c132a 100644 --- a/libavcodec/mpeg12.h +++ b/libavcodec/mpeg12.h @@ -25,6 +25,16 @@ #include "mpeg12vlc.h" #include "mpegvideo.h" +/* Start codes. */ +#define SEQ_END_CODE 0x000001b7 +#define SEQ_START_CODE 0x000001b3 +#define GOP_START_CODE 0x000001b8 +#define PICTURE_START_CODE 0x00000100 +#define SLICE_MIN_START_CODE 0x00000101 +#define SLICE_MAX_START_CODE 0x000001af +#define EXT_START_CODE 0x000001b5 +#define USER_START_CODE 0x000001b2 + void ff_mpeg12_common_init(MpegEncContext *s); #define INIT_2D_VLC_RL(rl, static_size, flags)\ diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index a6ed842ea2..fcab975a9c 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -550,7 +550,7 @@ int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx) unsigned vlc_len; uint16_t mb_num; - if (get_bits_left(gb) >= 32 && get_bits_long(gb, 32) == SLICE_START_CODE) { + if (get_bits_left(gb) >= 32 && get_bits_long(gb, 32) == SLICE_STARTCODE) { vlc_len = av_log2(s->mb_width * s->mb_height) + 1; mb_num = get_bits(gb, vlc_len); diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 76b32ea547..9f8d80df3d 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -63,18 +63,6 @@ #define MAX_B_FRAMES 16 -/* Start codes. */ -#define SEQ_END_CODE 0x000001b7 -#define SEQ_START_CODE 0x000001b3 -#define GOP_START_CODE 0x000001b8 -#define PICTURE_START_CODE 0x00000100 -#define SLICE_MIN_START_CODE 0x00000101 -#define SLICE_MAX_START_CODE 0x000001af -#define EXT_START_CODE 0x000001b5 -#define USER_START_CODE 0x000001b2 -#define SLICE_START_CODE 0x000001b7 - - /** * MpegEncContext. */ From patchwork Mon Sep 13 13:53:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30214 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4020726iov; Mon, 13 Sep 2021 06:53:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI+UyUVTfjRGatGwhg5z2B55sBqLGn0niHyw7nvMphkhe4ClIMi3YQv69uFqPRHYVJ63r6 X-Received: by 2002:a05:6402:1d56:: with SMTP id dz22mr13588163edb.69.1631541237328; Mon, 13 Sep 2021 06:53:57 -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 c19si7700792ejj.206.2021.09.13.06.53.56; Mon, 13 Sep 2021 06:53:57 -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=QxcP9zLn; 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 B02BA68ADE5; Mon, 13 Sep 2021 16:53:53 +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-db8eur05olkn2051.outbound.protection.outlook.com [40.92.89.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2575468AABC for ; Mon, 13 Sep 2021 16:53:47 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W68JWndNbWQVljCBeo/3VB8vfciXvHO29WCSnrz1jZF976+Rku7jtLbqL8JyePb6tjcLroBCwOFfX+TIXN2PVE3nX2jPwduE54Bq+2nZjszdEb94wCkNht6lnrHRsdvhL92e+Ilc79r+l6QRQa3No7FhjRt0n0KRcQtx1G1zQFPhegoiZA72dDW57zxggqrJMWlEf1KAtLkf/WBj/AMSjm0T2zOU8iH2CANfJWQky0A682rvWGjkxcaVatr4CMLyk2fhWYgNM14ipdS3K79cNKHEDfFD1HJ7zXBTbnQr33DAI12e3Mbf6UigfzrwS7dNHNEpXPYmwYz/maX6gEcS+w== 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; bh=rRHtA/NvUDnmVqjutay3KJ5y+qeiGqr2noGmyUFXFOA=; b=c8EWe1iovzsMz/VIdr8CsJ8O+0yAJPEeePVlHy9+0SI99ba4uPYkXV7Fkyw4ZyuWR7y7TvlwhiOkHBRPu1YurVFbZBFAmjJcLngrievrGQbuYZ73tJTCSCBwiUQwKJGxr+HJlGcx9leY3rDO3SK0i4mFnK3yBNFTCZ0RK0kYtr+v5kxfOcayAE/tpcRZE6dWmlUZszUymVr4x5vdRUT0NPGMd83AUqnEPPtk+sNgVea1f/00Dn4ShFN80L2KnjX2V+0UO5DygpfPbmlURdUn8ryV1+X6yYOVVo+FklxwpgWnbaBLxav2LHbGCW5c2IU4h2DqkHA+fz99sCFUZbwYYw== 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=rRHtA/NvUDnmVqjutay3KJ5y+qeiGqr2noGmyUFXFOA=; b=QxcP9zLniupUc0ohZLW/i90rIjpsWondWxR7znDjrg7DNUmSokDZ0ZCokUV35deSnT5WFlyqTlHEZl6lljf2g4riNXMyanjyrTiD7mvRb6FDv0fA7rac7yLFghjZoi0U+Z0qyT/lmzFu7IyGTjFBLDdrhiArw4CzR2QvFc88XQnwnmAo0RPqO0mKhXiIg3vSRlrHgmh7GZDrMjwmEWmi4pelxnCUkpyqu7nUrutnDY2+fQijNKDOsQCx76kakXeb1EXcpVI8wHXSt6mD2loXvu6XqX3KSoJkLSmRcaKhCpI3VWBFvNs9ZBJCHii6LjwDaCdBEvT0BblUF5FE5jEm6Q== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR0302MB3240.eurprd03.prod.outlook.com (2603:10a6:209:20::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 13 Sep 2021 13:53:45 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:53:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:28 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [YL+IN++6Etctl7nOFL1XSUO8GHzf3uaW] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:53:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0e7c595-58b0-4b80-cb28-08d976bde73f X-MS-Exchange-SLBlob-MailProps: KzxekxNgZV0suMQLWM0xRH7l7isZgM4L1aO5DsV3mMnXhfdcaqGnP65YAGJWvasWClELmZH95gtny69lxmdyaC+YTBmeElllPNwsHr9QqMTA90T4ofeR9t/OTEF5frhxtVRreMJodytKFGO713bwBu2nlzD2Ovw3nDo6w3v1kjq50S99dS11+a1fFrhRvDb1GNGMd0mZflrKkDdgDu44cJgm0yACir/gSYMLomxUATHb/wn+01v+MeiVS/ND+27N18nMu8kKx+Q4gDqiRJQcd7V1rpGpGMuFzWARzCzlBlBszVpFt7SRRhCvVrBVYwUX/NR520W9h5EYb6GHaiBlIVghvZ8jB8SOmVy6sJyjePWlwImoA320HXMVSDRz7LH06bAdDNHzmJ5REm9xDz+PathP6Y33NM7m0ARX/Cn+fEjljltACp09uPJ0MqAq7LnMBzI4e32NBIKFk+3CGJO46BN2FAk4aqiY0f3BaW2gBRzZi9/WdJhxbQsW/nnkAcgXFJ9/jW4YxdPye4xpE0NovqoRNIvoQJ+gPD0P3xi8i/ji9h9ISDF+PMiZ8qPkJKvyExEiVBKpNFGewXe5pj0md85Vrc+Xj/M63vPDNi/KzPdAHinYEJmPRCCHohhCCA+/jcQShhEw9DLxYzjE5+8xCg5BHRQZ5VX3cHOqOsAsuYh+eeA6MRVUz0aQTAlnQ9nfQqvbGSzCz31e9u6pzF8mpP7r7Ed5frTd3Lrp3Pd55keAkFEBSzSFAcdIO7X3UW4HaTxZQGxoNg/xiZ8Tp8TTpNYue3b20daitDrYoYdXWzM= X-MS-TrafficTypeDiagnostic: AM6PR0302MB3240: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bmfT2MhzUYH5LQ2mYMNS6ma4vSS79LYf/sLpTK36aL7tOroiAZpmBktXBGQ3shyn/OYhzKv0hte9cKdDVzDTIph56gi7V0yHZ77XpPqA41kIszmoQI/Xixdj0fJu5M5uJpVqN27EC1ErWbn/z0YOnOVD6DabR7ejGhaKY2UqJ7WfCkM6VpxEUP7ds25EaI1dHgxMytyrbNtiSEDNxhyaNKhYF4lcltMRlhiW4F4KBroqXeVzJYD5w1CUEzMFb8vdlECs62erpHH4/floUe103SrlhR86ZXm3tnaCLmdiriZSLl/bap6Nc2aGpfWou8TiuJ5ROQWG/bEMW3Db1biv/CueTbAE4t9YIgtfCCZcQ2zqZN63WRLnNmqGHrxjBrUb1rqAr6D257fjdcNgvuDbcpZ0DX7ncxTJYlJH/CkMMfX4OiyvzSc7zjsEVMOxHSvNo6enBU9yiSM71CGZbDH0HSbDNv6xbQFNu0mdd4kJ9AM= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XznM3pVD4xqwl1+svwuHxXEGLg7oaJqUAhzVVvS9S8kyE5kZZv61XIz3JxMVSbHMlr6VMELqtqI/2LZS9j92UqRV1Ki+7OUbFnMSRSe//hlq2/wGVv7leO8RMmUFU1CJaWrSKpqFiiIaOtAg/SM57g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0e7c595-58b0-4b80-cb28-08d976bde73f X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:53:45.2818 (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: AM6PR0302MB3240 Subject: [FFmpeg-devel] [PATCH 02/10] lavc: deprecate AV_CODEC_(FLAG|CAP)_TRUNCATED 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 , Anton Khirnov Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5VGKlhDLrSC6 From: Anton Khirnov It is supported only by a few decoders (h263, h263p, mpeg(1|2|)video and mpeg4) and is entirely redundant with parsers. Furthermore, using it leads to missing frames, as flushing the decoder at the end does not work properly. Co-authored-by: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- Anton's earlier patch is here: https://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/277365.html doc/APIchanges | 4 ++++ libavcodec/avcodec.h | 4 ++++ libavcodec/codec.h | 5 +++++ libavcodec/decode.c | 4 ++++ libavcodec/h263dec.c | 18 ++++++++++++++++-- libavcodec/mpeg12dec.c | 28 +++++++++++++++++++++++----- libavcodec/mpeg4videodec.c | 6 ++++-- libavcodec/mpegvideo.c | 6 ++++++ libavcodec/mpegvideo.h | 2 ++ libavcodec/options_table.h | 4 +++- libavcodec/pthread.c | 2 ++ libavcodec/version.h | 3 +++ 12 files changed, 76 insertions(+), 10 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index d03e3233ba..cffab2059f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-xx - xxxxxxxxxx - lavc 59.x.100 - avcodec.h codec.h + Deprecate AV_CODEC_FLAG_TRUNCATED and AV_CODEC_CAP_TRUNCATED, + as they are redundant with parsers. + 2021-09-08 - xxxxxxxxxx - lavu 57.5.100 - hwcontext_d3d11va.h Add AVD3D11VAFramesContext.texture_infos diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ffd58c333f..1b70a08980 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -245,11 +245,15 @@ typedef struct RcOverride{ * error[?] variables will be set during encoding. */ #define AV_CODEC_FLAG_PSNR (1 << 15) +#if FF_API_FLAG_TRUNCATED /** * Input bitstream might be truncated at a random location * instead of only at frame boundaries. + * + * @deprecated use codec parsers for packetizing input */ #define AV_CODEC_FLAG_TRUNCATED (1 << 16) +#endif /** * Use interlaced DCT. */ diff --git a/libavcodec/codec.h b/libavcodec/codec.h index 8f12705066..a8147ec21f 100644 --- a/libavcodec/codec.h +++ b/libavcodec/codec.h @@ -50,7 +50,12 @@ * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. */ #define AV_CODEC_CAP_DR1 (1 << 1) +#if FF_API_FLAG_TRUNCATED +/** + * @deprecated Use parsers to always send proper frames. + */ #define AV_CODEC_CAP_TRUNCATED (1 << 3) +#endif /** * Encoder or decoder requires flushing with NULL input at the end in order to * give the complete and correct output. diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 643f9d6a30..023dd3c0b2 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -455,7 +455,11 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, if (!got_frame) av_frame_unref(frame); +#if FF_API_FLAG_TRUNCATED if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)) +#else + if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO) +#endif ret = pkt->size; #if FF_API_AVCTX_TIMEBASE diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index d7ae8a0727..2682a7f43a 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -33,12 +33,16 @@ #include "error_resilience.h" #include "flv.h" #include "h263.h" +#if FF_API_FLAG_TRUNCATED #include "h263_parser.h" +#endif #include "hwconfig.h" #include "internal.h" #include "mpeg_er.h" #include "mpeg4video.h" +#if FF_API_FLAG_TRUNCATED #include "mpeg4video_parser.h" +#endif #include "mpegutils.h" #include "mpegvideo.h" #include "msmpeg4.h" @@ -170,12 +174,14 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) /* We would have to scan through the whole buf to handle the weird * reordering ... */ return buf_size; +#if FF_API_FLAG_TRUNCATED } else if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { pos -= s->parse_context.last_index; // padding is not really read so this might be -1 if (pos < 0) pos = 0; return pos; +#endif } else { // avoid infinite loops (maybe not needed...) if (pos == 0) @@ -441,6 +447,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return 0; } +#if FF_API_FLAG_TRUNCATED if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { int next; @@ -460,6 +467,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, &buf_size) < 0) return buf_size; } +#endif retry: if (s->divx_packed && s->bitstream_buffer_size) { @@ -768,7 +776,10 @@ const AVCodec ff_h263_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = ff_mpeg_flush, .max_lowres = 3, @@ -786,7 +797,10 @@ const AVCodec ff_h263p_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = ff_mpeg_flush, .max_lowres = 3, diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 49d865853b..01a7a3fc19 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1265,10 +1265,14 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) || 0) { if (s1->mpeg_enc_ctx_allocated) { +#if FF_API_FLAG_TRUNCATED ParseContext pc = s->parse_context; s->parse_context.buffer = 0; ff_mpv_common_end(s); s->parse_context = pc; +#else + ff_mpv_common_end(s); +#endif s1->mpeg_enc_ctx_allocated = 0; } @@ -2504,7 +2508,11 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, if (avctx->err_recognition & AV_EF_EXPLODE && s2->er.error_count) return AVERROR_INVALIDDATA; +#if FF_API_FLAG_TRUNCATED return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); +#else + return FFMAX(0, buf_ptr - buf); +#endif } input_size = buf_end - buf_ptr; @@ -2812,6 +2820,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, return buf_size; } +#if FF_API_FLAG_TRUNCATED if (s2->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL); @@ -2820,6 +2829,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, (const uint8_t **) &buf, &buf_size) < 0) return buf_size; } +#endif s2->codec_tag = avpriv_toupper4(avctx->codec_tag); if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2") @@ -2896,8 +2906,10 @@ const AVCodec ff_mpeg1video_decoder = { .close = mpeg_decode_end, .decode = mpeg_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | - AV_CODEC_CAP_SLICE_THREADS, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = flush, @@ -2930,8 +2942,10 @@ const AVCodec ff_mpeg2video_decoder = { .close = mpeg_decode_end, .decode = mpeg_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | - AV_CODEC_CAP_SLICE_THREADS, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = flush, @@ -2976,7 +2990,11 @@ const AVCodec ff_mpegvideo_decoder = { .init = mpeg_decode_init, .close = mpeg_decode_end, .decode = mpeg_decode_frame, - .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, + .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = flush, diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index fcab975a9c..34b050db28 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3590,8 +3590,10 @@ const AVCodec ff_mpeg4_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | - AV_CODEC_CAP_FRAME_THREADS, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_ALLOCATE_PROGRESS, .flush = ff_mpeg_flush, diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5de0719f83..5383f9dead 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -974,7 +974,9 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) if ((ret = init_context_frame(s))) goto fail; +#if FF_API_FLAG_TRUNCATED s->parse_context.state = -1; +#endif s->context_initialized = 1; memset(s->thread_context, 0, sizeof(s->thread_context)); @@ -1119,8 +1121,10 @@ void ff_mpv_common_end(MpegEncContext *s) if (s->slice_context_count > 1) s->slice_context_count = 1; +#if FF_API_FLAG_TRUNCATED av_freep(&s->parse_context.buffer); s->parse_context.buffer_size = 0; +#endif av_freep(&s->bitstream_buffer); s->allocated_bitstream_buffer_size = 0; @@ -2315,12 +2319,14 @@ void ff_mpeg_flush(AVCodecContext *avctx){ s->mb_x= s->mb_y= 0; s->closed_gop= 0; +#if FF_API_FLAG_TRUNCATED s->parse_context.state= -1; s->parse_context.frame_start_found= 0; s->parse_context.overread= 0; s->parse_context.overread_index= 0; s->parse_context.index= 0; s->parse_context.last_index= 0; +#endif s->bitstream_buffer_size=0; s->pp_time=0; } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 9f8d80df3d..8dfa904577 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -347,7 +347,9 @@ typedef struct MpegEncContext { int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) int next_p_frame_damaged; ///< set if the next p frame is damaged, to avoid showing trashed B-frames +#if FF_API_FLAG_TRUNCATED ParseContext parse_context; +#endif /* H.263 specific */ int gob_index; diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index ae42b65b7b..e740112d6a 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -59,7 +59,9 @@ static const AVOption avcodec_options[] = { {"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, {"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, -{"truncated", "Input bitstream might be randomly truncated", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, V|D, "flags"}, +#if FF_API_FLAG_TRUNCATED +{"truncated", "(Deprecated, use parsers instead.) Input bitstream might be randomly truncated", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, V|D | AV_OPT_FLAG_DEPRECATED, "flags"}, +#endif {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, {"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index e7bad19f8b..5adc3c43a3 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -48,7 +48,9 @@ static void validate_thread_parameters(AVCodecContext *avctx) { int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) +#if FF_API_FLAG_TRUNCATED && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED) +#endif && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY) && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS); if (avctx->thread_count == 1) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 4b4fe543ab..bb70d4d152 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -81,5 +81,8 @@ #ifndef FF_API_MPEGVIDEO_OPTS #define FF_API_MPEGVIDEO_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) #endif +#ifndef FF_API_FLAG_TRUNCATED +#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) +#endif #endif /* AVCODEC_VERSION_H */ From patchwork Mon Sep 13 13:53:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30210 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4020894iov; Mon, 13 Sep 2021 06:54:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSkXiAToV7Nd81orGV1Zp4gNMvbU3HdeQGu7StaS5LEUZwOU2MXuKeaxlJQc2cMAmoJeLO X-Received: by 2002:a1c:9a85:: with SMTP id c127mr11254578wme.174.1631541248138; Mon, 13 Sep 2021 06:54:08 -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 s27si7139787edy.251.2021.09.13.06.54.07; Mon, 13 Sep 2021 06:54:08 -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=YBhEAFy+; 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 A137768ADF2; Mon, 13 Sep 2021 16:53:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075032.outbound.protection.outlook.com [40.92.75.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6ABB668ADDB for ; Mon, 13 Sep 2021 16:53:51 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gcp1dr/I1iR6VY7sdD3zr019B+aP6GlOu4sIvPJXjmIbk42VXSPfyTTHRB9TSWBQ/0/R628azbJFnyAObDonTuxw6UDKBgtMeq1mhfcEe58rtCFYJxpdnlLglFhzmMmjs5duYCNZIM9Xcbaq3zq1v/+M6YEjNoWdjfIFNPIkMVA+a1dulC0gKINE8H9tVGfjGDAJ+fP3Q36YEvVHhFhHCy9LEYssG6YYQoLRbHdez+e58mHmZd7b6X0ag+e84GfDonctQFNtYy10uMGqbPF6VejrpMp3TpFA2kEBG0VP06rIFmoIMhV6v+YtlZ1exEWQKSXrX8Vr2CWnWwj+jkAYFw== 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; bh=xbvn8JRcy+0n135Ra8xHomgC5HzHgKdkguRQDtBQ51o=; b=hbRyB1GH2in7+KGI3BqN7hR1hdmHVNbcxqVPqDR8CAts2wElJkzANv0O3KXLfTQ5X2q0QTSunQP8lFT7JErmx2fp+pdAhfBoRH69Cmui2iNeF7FCOu8nWQ7J4qYksOVjU3tz9GXdH0uLcpMie+q/VCQgvhHg2HPFAbuTKpDvGZMRG9IMR4L9y2qGD//AzWSWwsk/N3SzKc3cdZjmmd39P9ycye5e+hi86bq9Ggwi1dL4kAKDw0Fzu5vbc8YGCAZ6fIKAh2+aD2BoL7CsQs3mKOUcHXS/ZgiaeREqkr5OcCqRSek3+21AAd6RjIdOf6IURoZHPf0oy6L7jal5+RCIHQ== 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=xbvn8JRcy+0n135Ra8xHomgC5HzHgKdkguRQDtBQ51o=; b=YBhEAFy+vfbaCk2D0nuhmwI8r2dbaMgQHUjIaTaWXiZijBC/hFcLc1zobKfcs1lfRWht/AlSwbrAt/dtkdTB2MmvH12TujBvwTi7tIjsTBZ0FV1n01H7VzxXOC2Gjd1ooAs+6vPiUUH+85rUvvXSqH5xXJ0ZCcftCNaYOYZGR+PHaJviyS0XUTLgMKjKHATY9tWvPzHGWXHUmToXkBYsoLVgiHeraCAHY1yKz3DfDT11rgWSNxSkUotjou2Z1WZ9adJmSwhA9CSNwAzaC37WTtAYRCLRCNMVKFuRSD9tPC2YjzGX1dHU3Jyxcf0Sp+tGcvx/K2I49YhmIXaKKXReCA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5299.eurprd03.prod.outlook.com (2603:10a6:20b:c4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 13 Sep 2021 13:53:50 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:53:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:29 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [5OnJfHB1m4d7Q4Zy2ZoLEnofgxiO9QfE] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:53:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9188c6a0-0908-47b7-5acd-08d976bdea17 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNXSr2fKdz7sYpLFthH+Nsypl+U7fg11j1qFb9w76QluIIJFHTxEn3unPwL84up6ZH4j8oIKXK6KEYcUwnh7ldjkY03JAk70n0Dj6s6pw4cVG/EAMJsqjwceg/4seKrliTsfQuFY/KCmbyRmKK9e8C0UF/6uquZ18aLSvVvuR5pi4V8GOTXYQE1wEVx4Lp1uhoQGbX1So8RaYSGXf8Q4v10ySXziRkKDgTd7GVkGF7MNgdCI18Uf2d3eTc5wjSW/WGEI1FEaONgzDHPuhoj8stUOX9rVtK1eOr68Lmm+gl/fNLnLFX9ggOhUjGurvLAqEeUy9iaCfjSuQQ/Iyzb1mZIUtpFNc76GK4gMYzoGjQyDlnn/hvjaNF5pEQS49nc+m0XUo42ibbAAsSR1BnUPnJ7OHbor4kzpH0o969pqXBjZsXpgqg6Yi62l9e48oAAFJt+f8sFjAHNuA6fGBRmLxEivalaQNB5jIlMo4UyfcPHeLcgcn81d7hm4/BUNqWaYwYyXyQClXQr2nA/las53VN5ihLl+3Qq2gRkgDEHAbNVK4oiA4y4h9wM60dsdsXLlEsYooJ3VbcRTWjSF3NCOd2Or/QOehtWvBrzND6E6kpoTPO+Q1y0nYyrw9JjqxUu+sjcsVsePi2PkVT1tu2x5pYhSes6DiFTo7mDll5bwlc32YuaNrY+jtH2XvkPobD9ehL51wfOtQLQU03F8IrcxbxVt9Ozmdap6fm0= X-MS-TrafficTypeDiagnostic: AM6PR03MB5299: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ow6/mZfIzuf7aPw90i+cBTq5fMSear2KjYX5IIEVTMTnlY77fj1l+vbcbqbS30rPI9dmXNHEFJt5d/rl5C+jRqBISr05YGpUVmF1sQ5tN6Jrvoae8N7+CsU95go27+nZCbBSFzGkjrjLQVWyXnY0lOVrbLt0rUJo/mvKVRhIwubQVcamvnvewwCbIUkEqmlNceEGIKhonnSWX9/YgjoC1atdBHz8q6xx5usq6rA34YvAlkY2rCPwmLASGxVc9w6dL7s4MQOcpeyKf+CU/EexLK9pCYQ9VVobsTsnJoQYmQ9KReVtfORimHB7CGoE0cGVZa/mTXuVmb6syBOV5UUbN3LtWErlbutEG282vtrJ+ut9WHoKscbj93fKAgYGxCUYQeo1n3CuVETDi8qNBwmjeyn9CvRIfSCIU+/ordAjv1qa50VvKwlnA8ehCrGRXWJ9 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sJ74tezm2zx43UYRwuB0nTAIzkvHeTWhwGVQvnJ7anmk0/Ez5RQ15+ZQ48BThssl0hWW5yhVukM+hSJVdrj9huAkyWfxHSMFlIWMfiQmv691UIDeyYm4ZAMXBsT/qIo1XEUj790Us48W4jnsoOCHDA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9188c6a0-0908-47b7-5acd-08d976bdea17 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:53:50.0729 (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: AM6PR03MB5299 Subject: [FFmpeg-devel] [PATCH 03/10] avcodec/(h263|mpeg4?video)_parser: Make *_find_frame_end() static 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: uGuTgphUVb0o Signed-off-by: Andreas Rheinhardt --- Could be merged into the preceding commit. libavcodec/h263_parser.c | 11 ++++++ libavcodec/mpeg12.c | 2 + libavcodec/mpeg12.h | 2 + libavcodec/mpeg4video_parser.c | 15 ++++++++ libavcodec/mpegvideo.h | 2 + libavcodec/mpegvideo_parser.c | 70 ++++++++++++++++++++++++++++++++++ 6 files changed, 102 insertions(+) diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c index e05b8a4ac4..7a742caa80 100644 --- a/libavcodec/h263_parser.c +++ b/libavcodec/h263_parser.c @@ -25,9 +25,16 @@ */ #include "parser.h" +#if FF_API_FLAG_TRUNCATED +/* Nuke this header when removing FF_API_FLAG_TRUNCATED */ #include "h263_parser.h" int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ +#else + +static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) +{ +#endif int vop_found, i; uint32_t state; @@ -73,7 +80,11 @@ static int h263_parse(AVCodecParserContext *s, if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { next = buf_size; } else { +#if FF_API_FLAG_TRUNCATED next= ff_h263_find_frame_end(pc, buf, buf_size); +#else + next = h263_find_frame_end(pc, buf, buf_size); +#endif if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 1aacd07e41..58e03c05d4 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -168,6 +168,7 @@ av_cold void ff_mpeg12_init_vlcs(void) ff_thread_once(&init_static_once, mpeg12_init_vlcs); } +#if FF_API_FLAG_TRUNCATED /** * Find the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 @@ -231,6 +232,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, pc->state = state; return END_NOT_FOUND; } +#endif #define MAX_INDEX (64 - 1) diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h index a7b94c132a..fb2b37e7c8 100644 --- a/libavcodec/mpeg12.h +++ b/libavcodec/mpeg12.h @@ -70,7 +70,9 @@ int ff_mpeg1_decode_block_intra(GetBitContext *gb, int16_t *block, int index, int qscale); void ff_mpeg1_clean_buffers(MpegEncContext *s); +#if FF_API_FLAG_TRUNCATED int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s); +#endif void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number); void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64], diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c index 1b0e2555da..c68c966259 100644 --- a/libavcodec/mpeg4video_parser.c +++ b/libavcodec/mpeg4video_parser.c @@ -26,7 +26,10 @@ #include "parser.h" #include "mpegvideo.h" #include "mpeg4video.h" +#if FF_API_FLAG_TRUNCATED +/* Nuke this header when removing FF_API_FLAG_TRUNCATED */ #include "mpeg4video_parser.h" +#endif struct Mp4vParseContext { ParseContext pc; @@ -34,7 +37,15 @@ struct Mp4vParseContext { int first_picture; }; +#if FF_API_FLAG_TRUNCATED int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) +#else +/** + * Find the end of the current frame in the bitstream. + * @return the position of the first byte of the next frame, or -1 + */ +static int mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) +#endif { int vop_found, i; uint32_t state; @@ -138,7 +149,11 @@ static int mpeg4video_parse(AVCodecParserContext *s, if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { next = buf_size; } else { +#if FF_API_FLAG_TRUNCATED next = ff_mpeg4_find_frame_end(pc, buf, buf_size); +#else + next = mpeg4_find_frame_end(pc, buf, buf_size); +#endif if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 8dfa904577..e90669b776 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -49,7 +49,9 @@ #include "pixblockdsp.h" #include "put_bits.h" #include "ratecontrol.h" +#if FF_API_FLAG_TRUNCATED #include "parser.h" +#endif #include "mpegutils.h" #include "mpeg12data.h" #include "qpeldsp.h" diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 7864224643..39b9f2e43a 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -31,6 +31,72 @@ struct MpvParseContext { int width, height; }; +#if !FF_API_FLAG_TRUNCATED +/** + * Find the end of the current frame in the bitstream. + * @return the position of the first byte of the next frame, or -1 + */ +static int mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, + int buf_size, AVCodecParserContext *s) +{ + int i; + uint32_t state = pc->state; + + /* EOF considered as end of frame */ + if (buf_size == 0) + return 0; + +/* + 0 frame start -> 1/4 + 1 first_SEQEXT -> 0/2 + 2 first field start -> 3/0 + 3 second_SEQEXT -> 2/0 + 4 searching end +*/ + + for (i = 0; i < buf_size; i++) { + av_assert1(pc->frame_start_found >= 0 && pc->frame_start_found <= 4); + if (pc->frame_start_found & 1) { + if (state == EXT_START_CODE && (buf[i] & 0xF0) != 0x80) + pc->frame_start_found--; + else if (state == EXT_START_CODE + 2) { + if ((buf[i] & 3) == 3) + pc->frame_start_found = 0; + else + pc->frame_start_found = (pc->frame_start_found + 1) & 3; + } + state++; + } else { + i = avpriv_find_start_code(buf + i, buf + buf_size, &state) - buf - 1; + if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) { + i++; + pc->frame_start_found = 4; + } + if (state == SEQ_END_CODE) { + pc->frame_start_found = 0; + pc->state = -1; + return i + 1; + } + if (pc->frame_start_found == 2 && state == SEQ_START_CODE) + pc->frame_start_found = 0; + if (pc->frame_start_found < 4 && state == EXT_START_CODE) + pc->frame_start_found++; + if (pc->frame_start_found == 4 && (state & 0xFFFFFF00) == 0x100) { + if (state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE) { + pc->frame_start_found = 0; + pc->state = -1; + return i - 3; + } + } + if (pc->frame_start_found == 0 && s && state == PICTURE_START_CODE) { + ff_fetch_timestamp(s, i - 3, 1, i > 3); + } + } + } + pc->state = state; + return END_NOT_FOUND; +} +#endif static void mpegvideo_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx, @@ -192,7 +258,11 @@ static int mpegvideo_parse(AVCodecParserContext *s, if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ next= buf_size; }else{ +#if FF_API_FLAG_TRUNCATED next= ff_mpeg1_find_frame_end(pc, buf, buf_size, s); +#else + next = mpeg1_find_frame_end(pc, buf, buf_size, s); +#endif if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; From patchwork Mon Sep 13 13:53:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30216 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021030iov; Mon, 13 Sep 2021 06:54:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAbtt0H/h0sEGuUA59EkJQILKjIrw+HgiuE4qbNAqV0Tvv1JJemn7BL3aIngkQG4OGFD6n X-Received: by 2002:a05:6402:51c9:: with SMTP id r9mr13525924edd.65.1631541258310; Mon, 13 Sep 2021 06:54:18 -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 hq16si8126372ejc.653.2021.09.13.06.54.17; Mon, 13 Sep 2021 06:54:18 -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=tfaD++5i; 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 9763C68AE13; Mon, 13 Sep 2021 16:54:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069079.outbound.protection.outlook.com [40.92.69.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 92DA268ADDC for ; Mon, 13 Sep 2021 16:53:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WidDNoJTbA8vshmfdWSxksiIPoHkyr5CPOI6IWWrETPapPeK52lf7VeQYBX3bNWm0z72s1bKVoBB4qF4oSxdXHA2r3qBCcGmeAGVFk3WRXDQe2UfehjD+hqYevK9ATrt971AvP8QP0iEeIdEUDmomwG9m0IWttlh5u3DHz6CLBqY+rO0lO3pNm+ZTUsGr7dL32YgUwuwgxHywYAj8ijKPC9E06jzbS6srHxu4Synz8lX7RFO/xNXlEprMG/BMo0sFFnqfG7lcZ0Qt6wIO4L4Qa8M+gRR2XC4sDMYmysETKNuNaKyv9n6MPweVFs1+aZjukt4c8lpCQCq36qNPgVyRw== 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; bh=MYXkK4KLhR6fRabvQ1iaMUkxrobTmzh/6Yq4W02x1JU=; b=e06hqpO0JyzdDPgBYtEBngCbEuZuF73ZFTCTwBRk9IaOFqha3lRvW3RHSDuui2/5ba26hiuqt4defxJ5ivkiuo18KnRFYiGUBGDZA8iju4Wl7wUwyYyzA9xUycQjl0EUYjKEbe2EZxLxM0izTelxUSgi8mu+aGfU8dOxxlqFzG1kJltO/NlPoXokSJAPej+6Ef2NceUDYZ7Tsu4LIKhoGVMp4FK1D7JqArApr9hyLw6lKW4ULDmfu1IU9unaGl2a/DFrwTkTXg6mO+q23NWCt8KYqmvAxTQ7Bb01vZfVPktQr+P/sWiiGhe1ylFfhx3fKjW3nqnlOJ55q0JLL0gvXA== 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=MYXkK4KLhR6fRabvQ1iaMUkxrobTmzh/6Yq4W02x1JU=; b=tfaD++5iec5sZXBHdbOnqsIofLaCH9+Ao94c34mMp4fYz9DxDTy3MdSoN+p8ODKCNLCFaF/V1j41MvAn9m68+8pSc+GWYOQevx0zIH8WXa9I3VM2zIRmy1HUicBit6oxraHqR9nGRHQ6hkq1riRBVMYNirhFqzZCL1HPvXWE/ybhnVEw8oAMbHrcTOrAM8bu1lOuy8ASS3iv7KLjR6AwtWz8GxHFkXwG22vu2/alCWZNMasPkHd2yKidhkKIZlghIbBCHI8jm24kKaSqbSVUGXajAUUuRcyvXnlJB4eK4CjEQiF9onGd3A3JMY51O8Umcy0o1LJg1+A3yGBiounh7w== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:53:55 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:53:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:30 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [4+K/9SWEZWYgbVvG40INZBuXMiYUuO60] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:53:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4a893b7-ba68-434e-55b6-08d976bded47 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEtAYsbScwzz20GBBV68Gwmx+fwf1iuqwOoSzdSANWMeAQMnGTzhYvTrnX5/J1o591x6/xhEj6/C3Tb9xpsYBjdJuXkAw51eLTlrF0INk+kS4Re0FW0BLo08yC40M+mhYO4Pj59VV5mzP72GHjZn74Qj2ltugrLquwgWHAK1R6tCyRQBWvfVsESnzUK5wmJEiL/CDU2t6KMRZtZvPyIIV9x4ZyDzQNEPxhMhsND0b4WgacgG2SnCRmYzzYqpj1w4V7t9OLWFF2DObnZYGYGIFuPhi8QY4Cm3NrQ2PaLMmetSzCXSzqGVan0UYeMjrTZPPGYkqwo8XT3hTUNRC7UQbCqnzZjeWcpE6uT+h4M5mnF3RxUQmj/1dZMqNjSOz0juReBClDiusmlIGHmLkye99UoV1aExNW+8M+vIW6Ziaj/bEfiIu52Catg2OTYDA0PEpO23lont60BbnRjeZSZYlKv1ShN81gwSuk/bzIfIxv5/zvPCUwdhEqNM7AOSfWaaQLJjB+Q9HgAtP5Myg+0AP4Gf9Z1bnsiAH5qGp+A3HeW/WabkdoewDJ7LAkgSEvtM/yJTk4KbypdfFwm0MxdqIVdZ3TNKXj2OTlOLBFLOZbK+AzLglpjB3wYLttDVkXlWgAV65kjgHXdN28ehkUEru86Harzvo4ho6FCRLEGz46H2q3GAVsdosU7AYvka4UUZO9QLj4NxlPh9jUWHKubQ4d1dgAcNR9w3uAh8kCYTaEKf7pjLAv3a9Fqed+yFQvQ7IGNAP3zCcAmR/235FQZqxufS X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9UiGzdmwSNfVMDcLQUnB+pU97RzTPPqS37PBMA+LXXTdlf0Wlz0OX1PsVKGdD8QdSSiyv84cPHHZPuekGGa16Vmc0Ol+4T6Ae9ft3HueNwp0tN/lpIdNUukQckZx6Ytgq90UGYKRJjYs0L6xEJNd3VXTyQ8Z+DH0yHrOoMYqZAxm+q/V8xskTpUC6Gj4JEuL2D0La7f1W8rEVAwLPI1hdWET7RZl/IxT50imGvwQYbGpbHFTMe7HId7NZO8woo4x53G7yJGHWaPzF0LGq7kW77mpL7wKQoVXDna0F11eew7rs7bDR4DWbTL8zSXPqU/08vxOHU3hlLyZGg1bOZlGaMlgfygf0RD6wYNYcglEDuRpSq6hL3j3/q/Yd6qfLkTlYVjg+EQO6fd2XUw4ASLBqjfQSLIlroLWKhfuMVf7VYJnTxJcgn+7Ybi4fBfjkovR X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7VEB0nIcWV1WlZTtmd+nrxyao4o7pj+Ghhxh160uO4eZBlfk6vefd4Dj767r6dgZYyxw+8vaKMaoj1/EgnuvnAg+BRc1rJAe8Lgv3ZJJyw0Fg9naE1oOkuR7+0MduJ4JsXXsD58BCrftl2yMAa5KcA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4a893b7-ba68-434e-55b6-08d976bded47 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:53:55.3428 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 04/10] fftools/cmdutils: Don't report AV_CODEC_CAP_TRUNCATED after next bump 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: Ycc88uyBGupy Signed-off-by: Andreas Rheinhardt --- Could also be removed now. fftools/cmdutils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index ac172dbd65..6a61f7a5e4 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1399,8 +1399,10 @@ static void print_codec(const AVCodec *c) printf("horizband "); if (c->capabilities & AV_CODEC_CAP_DR1) printf("dr1 "); +#if LIBAVCODEC_VERSION_MAJOR < 60 if (c->capabilities & AV_CODEC_CAP_TRUNCATED) printf("trunc "); +#endif if (c->capabilities & AV_CODEC_CAP_DELAY) printf("delay "); if (c->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME) From patchwork Mon Sep 13 13:53:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30215 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021176iov; Mon, 13 Sep 2021 06:54:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd7YFRVW3PS3s3k65M8hdxwQIoJE1pZ5u8Xx2dJB9gkEu0UhQvVjgrgnfufCLRDljR+ss0 X-Received: by 2002:a17:906:ae4f:: with SMTP id lf15mr12887068ejb.224.1631541268989; Mon, 13 Sep 2021 06:54:28 -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 m27si7309297ejl.443.2021.09.13.06.54.27; Mon, 13 Sep 2021 06:54:28 -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=Jh675847; 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 908D768AE36; Mon, 13 Sep 2021 16:54:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069079.outbound.protection.outlook.com [40.92.69.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A95B168ADE9 for ; Mon, 13 Sep 2021 16:54:01 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7RmLOozom8I5z7ktOxXpHnjZg4vMH2QaT1M1SK5ArT59um16vUJOGZoqFnGMefWVibPHeJnMG1lT8b2dXXHjzcJKoKgXNThKrma0GcuV1ajwk/MzvMlghZt4SMe1+lug3hS2by/9lkrtuxyoQpdK86q08qmyazgDYzfA0FujeJgD1y5HoIFQlTY3u9dzsCtt+neE737Dy2ggnReHkEKlIsLQegCUqnZmOgQwUKt536Lafd+FvnpozcBizm+d+8T6W7DLNq3a2F37/3XSPcNXd3DNnX3sguDEE0EyxCqDfi3na+oYi9zsFqDf5tQ8SMPu+qvQjXhuXrzWpEs5pHs2A== 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; bh=OjMa9h3Jnfh/xJRdKbD/9/R6bk1fEyPrdX35hWldqb4=; b=Vgg/b4NxW/VEmwPHXLJZhA1APPh71cka4tnOyOXWf/6U83FAOF/smeVWW0LGnJf0RrFtu2pvtwa/7f0y4gitEn6RUEHaDst2c6J4gAXLjUYs0ALBvIsv0NwLXsrMwNKt9uFG24dCdQBrybGNo7dJFnmvMmPEHDxc6I772SP4LnwFAGkMa6UGEy4o0sokGWI+i69gZ0jyzk5WXSZ/7POEONWrf5+KQH/L9o0F/WeJhtFPZBk0W7m70bM5V0NNGqIN4UdCylPmKw/1eAm43ZI6nQ9UHXMRdeb9k04+4/kMe7zundxW7T2WrHQwq5MOe7vyIpYeoch032kifbKzfYMdQg== 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=OjMa9h3Jnfh/xJRdKbD/9/R6bk1fEyPrdX35hWldqb4=; b=Jh6758479anGxsHpvhDmpTHwjPlD5nUtm8jqxtZl5rIMC6s/teJshKjjJ5UY7DljBkYPxx7k3QrZfEYq6I1VJCmvXqXjs5qMvtCwrj/WIJnhmly5MqZKSoiTZZ1sUqu9gu3ILXXf+a6fIF3ueT3FK4BRPF7LNst/nePm/b6etP5xTPodZ4ipRnssnoXUZ+21Q5iH8xD535DWM1ART7VWZoBPH3hBETQVyiIAGty93MahlK7HNbvjaIUoTjF7587EvF7/u4c7LVssCxXJ3NyqBAXHgZ3w4nWPho3jj52hZQbNV7RiZBuHGea04Gh9yrGYDyor3cG+viSurN3dVViaUQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:53:59 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:53:59 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:31 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [H03SuNVaOzd3Gjmx2vxIARj1+A9DaRgF] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:53:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d86a7e3-c6e6-4a1e-af18-08d976bdefe6 X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 191kGygntV957Hwme0MWb51OF6e58BJA7V/uYqv2IbgvtJdf3mwdv8qMff3HDilt7MG8JHg9lwsr0npTuHNqkV/p7UqzyNJKx2rZLkg+KyIjoO9FqSbGxleEp5/Ib5Y5iT78ga03NoJ4q4O3FCs2QJ2yWNVbbacDx9Sa3a7FcNpbGaA+/GUDQ0mlQVJEbqHlUfDhZINNrwoLFOoTuSmQxlbk0I1ypBnDXoU9nWNp3cbOQTEhXWqlg4EZWeiLNbX8NARHGBZivdYhkdr+CtYsslJPNUsFU3VqApJTKT+iPMNPtSUnOz0Vpad/J5KfH/GXNVqUczqL5X3hcBDkphyrgeB9BBQLBS7ThMccLEzOQ7f3NShJaqHRqm9M8Y4xgN1pSQsDGf5Zz2pDS4J47S2pfCUKkEtYX9eSdAatqFtyZEHbvajdtZlPq+QMGqhnsV7N X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 45BDlCWtrgKiIubbxu0KHjmSjWVSylC/0nU5vKjEmMiZWJFCyO6MDR2qMlM+zGJgd24YahtIkGwfdyYEwCpMI+j1MQRdKV4wWE2sE65HNPkYDLx9rtC7578bQ9uxtI2UW6qv8xdpfjcHkgDkt2YFVg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d86a7e3-c6e6-4a1e-af18-08d976bdefe6 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:53:59.7585 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 05/10] Revert "fate: Add test for ticket 6024, truncated decoding mode" 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: Anton Khirnov Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: z+sWuHpbf9lm From: Anton Khirnov This reverts commit 47cd8effea343e71c4010929ed3fb10dd3dca4b1. AV_CODEC_FLAG_TRUNCATED is now deprecated. --- tests/fate/video.mak | 3 --- tests/ref/fate/mpeg2-ticket6024 | 27 --------------------------- 2 files changed, 30 deletions(-) delete mode 100644 tests/ref/fate/mpeg2-ticket6024 diff --git a/tests/fate/video.mak b/tests/fate/video.mak index d6b5770aba..dff1f13e88 100644 --- a/tests/fate/video.mak +++ b/tests/fate/video.mak @@ -251,9 +251,6 @@ FATE_VIDEO-$(call DEMDEC, MPEGTS, MPEG2VIDEO) += fate-mpeg2-field-enc fate-mpeg2 fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an -frames:v 30 fate-mpeg2-ticket186: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg2/t.mpg -an -FATE_VIDEO-$(call DEMDEC, MPEGPS, MPEG2VIDEO) += fate-mpeg2-ticket6024 -fate-mpeg2-ticket6024: CMD = framecrc -flags +bitexact -idct simple -flags +truncated -i $(TARGET_SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg -an - FATE_VIDEO-$(call DEMDEC, MPEGVIDEO, MPEG2VIDEO) += fate-mpeg2-ticket6677 fate-mpeg2-ticket6677: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg2/sony-ct3.bs diff --git a/tests/ref/fate/mpeg2-ticket6024 b/tests/ref/fate/mpeg2-ticket6024 deleted file mode 100644 index bd416240f3..0000000000 --- a/tests/ref/fate/mpeg2-ticket6024 +++ /dev/null @@ -1,27 +0,0 @@ -#tb 0: 1/25 -#media_type 0: video -#codec_id 0: rawvideo -#dimensions 0: 716x236 -#sar 0: 1/1 -0, 2, 2, 1, 253464, 0xc51a46f9 -0, 4, 4, 1, 253464, 0xd0661651 -0, 5, 5, 1, 253464, 0x38a213b3 -0, 6, 6, 1, 253464, 0x038a5118 -0, 7, 7, 1, 253464, 0xebd8de64 -0, 8, 8, 1, 253464, 0x0b319ee0 -0, 9, 9, 1, 253464, 0x37b03a45 -0, 10, 10, 1, 253464, 0x5f9c89ae -0, 11, 11, 1, 253464, 0x88ad9c08 -0, 12, 12, 1, 253464, 0x387198bc -0, 13, 13, 1, 253464, 0xf3933eb6 -0, 14, 14, 1, 253464, 0x9bd27b98 -0, 15, 15, 1, 253464, 0x9442c538 -0, 16, 16, 1, 253464, 0x330be2a4 -0, 17, 17, 1, 253464, 0xb4b8c1df -0, 18, 18, 1, 253464, 0xc97ded34 -0, 19, 19, 1, 253464, 0xcad936e0 -0, 20, 20, 1, 253464, 0x11a2850d -0, 21, 21, 1, 253464, 0x2545ad23 -0, 22, 22, 1, 253464, 0xa5e17c47 -0, 23, 23, 1, 253464, 0x39452689 -0, 24, 24, 1, 253464, 0x1daefd72 From patchwork Mon Sep 13 13:53:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30217 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021297iov; Mon, 13 Sep 2021 06:54:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO6T5vCMtfaBYqA003kFFZrPmQYwyMfEODEtUDc1PLhcihDEgzvhO8mZYWgj9z/7DcdXH6 X-Received: by 2002:a17:907:2642:: with SMTP id ar2mr7289901ejc.175.1631541278608; Mon, 13 Sep 2021 06:54: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 n16si7456869edw.207.2021.09.13.06.54.38; Mon, 13 Sep 2021 06:54: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=s2mucvCO; 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 A0D3568AE3F; Mon, 13 Sep 2021 16:54:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069079.outbound.protection.outlook.com [40.92.69.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CFEDA68AE15 for ; Mon, 13 Sep 2021 16:54:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJhK/8AtTdiUnpkcJtwBVzfGjSvVE9i7aYUOHyXjfvU+EHId9b01dEZxq3m/3NwIR04vX/+9U8eSaizWN7IxNyLk9qh9U10tOg76m3ivKJxyWhbIQsl95/nTiMp6s70pNlOOEzv6KFtQw4y2/M7dT6tw9g9XSWgYOImFcEh05GakyTWUaUoeHOGqsC08DTHllveoogFR29nc52NrIVMxuN81s4p4fSmNKw446yxEoERgmlOsXcqpQ+vPcvqGQdJErrJ/CuksA5VyguvJxkr/gXepnCeYqmsyWcLG6PdxAbGqjqOqLuo/5ToQ99mAQ5HpQ4JO77lxUkgJz7H8Ll9zgg== 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; bh=tfsos+ytJ4lWXhvVldg+8/+nQwrAO1SfzCtEV8WgmN0=; b=bST0+9FXuxiMdjTVbkI6sWPjPivGojAEtRYQcvg7nCmU0n4OCSiZNwx4yPL4ZCRJLGFpCHpuOcM4b8zuBrMxUjbf84vLgOFOn9IewFJfIajnvgSbVLLOZmk0bp7Q9Ebc56ys3ICzrWBSSym+Ec/CA4rPS2Cmuv+RpKHwOBrTWdfuuLG/p5qtN6n63+fI+H7ge9mS0RuOFo9mJYDkjSgAVWbc2CboqkBEaZG+ojnWRQXk05GL31zorqD+5cZ6Cpy7C94tKoZC3UsVrQ2TtS1VHTkaJE6DTzePV5Z7s4Ir5d9cWn6WbDXmd/bZXCTGvbx0zgWK929kIE6zQ1f3QurT4Q== 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=tfsos+ytJ4lWXhvVldg+8/+nQwrAO1SfzCtEV8WgmN0=; b=s2mucvCOKyj5fwq5/L+/YwzCyh2SWhC7Hyb9ntdHCSvqPShPwfpGR2wd09j15RkrmT18O2YzNZpll+Gjs09qHyRnIXGf01pslOJQ6+6BGhfeTk3Ej1VrEIhUu98k6RzOriIg6laoe7h7t/CJv8CcZd037BAo/7xq9Hk6NhXaSMthhAnjbZiLG1RCqt1Dl6q0w88b4MqzuIX/LIlHTr25w4qNIRgwHMus1w422owajQw7pAUlJiDrHVQnz7YvcnKMQ05oMOpiY/IbWLd4pOl+hZvwPwUWqenTAb3R/VtYV3CkDWk+GVFc2xTxKuNmN7TmfSksOY6Q4bXiud1WkkKwRg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:54:01 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:54:01 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:32 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [HFR9xpMvQcEsNEnNOh56W9Srt2MBInPa] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:54:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 805dd707-966e-4a73-c8e6-08d976bdf0cb X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNXSr2fKdz7sYpLFthH+NsypfwkNSGN4pCA+Sb7Fz7K6WyHCw6r+6wC4BW9u9TDB1EPN0BicSlGPcWL6PJAU9QIfxGolsbN/VdCLSvO9gRJGpPVTlPihV+xvpaRPYwGVi715L1j+PLf3gmMOLbKCwrbfgd8NGpjZ7Mw+20Pv4iFFPZgGaotgTyDNY7q9bJ30y1GFTKMh/WZ+1EdKr/6IFQhuVN3cEYoyXYWtLGQRM7iIiC8IfX9QyzYBSjiZ+fF71hY10RsGcsfWl9Dx0B2Ne5Tdw0Etask2P7ec+ysPTBPO2aCdCYP4vmDJVWY9/TXoYpaKYCTayZKMhLJZ1fhNEo78l/avAmTMDmaQZpyrfYkcsqx2Ef+EieF0aOlP0cpPhkAcUs1SZuZ5euurOot42rXL+kr+cz1U3srAY4pUuT1ovbGrJBPqVFPzRuTn0w0hdi/YqcEL/8e/6aG6/4aCY5sZgUhzy5U5A+x4D1YAMqc509iA6GeutiwXi0Mb0biHvk2V+NbHcF2dNVexjTBNUyAzdt915rzcl1rLQ6LOT87LllWhq1vN67s/V8BJ6Q54Z7y2roAAeIOzhh4oWW8UlOHfaHDGmblHvwXqzVAfiNxS47/NqBg7WOyWv/85ExWL3DQ4lgVrrgprIkexIunL9owHMphtSwJaPTmXLEuOnqU2AqlqQdMfbRT2mhIGUJMyU+ShXQTf/sLyxUMnyrkhscHbpiAO4BcvX4k= X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8yt66BgDliY2yA9uW8MvQEovyQda6LJwB+bcRY7PiHqWDX1oDoDLmMF2BcJdDReiczny96ShZsL72dLC9mqUKvAd2pgjUcjgEi6xn6AXLnIi+PtqpSG60DaT/GqHkIw80WaFTa2HTKpNwHfzKZeVb/42A+IvUoxUP7YYjMZZJsao+UI3Ic84f9oUlqzqjKEziBzJGzwu9roKCC5MywbA+gkBlCllmvMOUM+3Hn9IEu/MKLsXgdQfQ6s2Q565nuNntcNulzkv3v+K9oVhrZaUQpCdVF+MCWIR46ihIuDRDuAhJeynsOK2W0TyLg0NjjxDBX0OZI3BkW0M1lfQx+aSGbh48pq2Khj0J9ymw+pDJvQCvQOtfju4nNp7o2fFVgSJuQ8q1tEzqLAS81Ar3WuUZ5m2oCrdCKURLKe7gBxiznDaGlVrX/X66LfZZBUI/zA0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 473kWDGU3jA34Id5tq/RFjOMdxD7NMCb4hxz8xz8tb/QbxpM6GJ/A2Ff30g6RyTvlD2kNIhpZK3ql+D8d6+l99hQciOvsc3jIxH1PRJyuMFVuc1DgeAiaOcAi1k9ljcVO1L1qOXTcDQMd5iQywAFdA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 805dd707-966e-4a73-c8e6-08d976bdf0cb X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:54:01.2480 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 06/10] avutil/opt: Also warn for deprecated named constants 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: e9ZXd7IjNHAz Intended for the "truncated" AVCodecContext flag. Signed-off-by: Andreas Rheinhardt --- libavutil/opt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 41284d4ecd..24b8899ca0 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -262,9 +262,12 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con const char * const_names[64]; int search_flags = (o->flags & AV_OPT_FLAG_CHILD_CONSTS) ? AV_OPT_SEARCH_CHILDREN : 0; const AVOption *o_named = av_opt_find(target_obj, i ? buf : val, o->unit, 0, search_flags); - if (o_named && o_named->type == AV_OPT_TYPE_CONST) + if (o_named && o_named->type == AV_OPT_TYPE_CONST) { d = DEFAULT_NUMVAL(o_named); - else { + if (o_named->flags & AV_OPT_FLAG_DEPRECATED) + av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", + o_named->name, o_named->help); + } else { if (o->unit) { for (o_named = NULL; o_named = av_opt_next(target_obj, o_named); ) { if (o_named->type == AV_OPT_TYPE_CONST && From patchwork Mon Sep 13 13:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30212 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021430iov; Mon, 13 Sep 2021 06:54:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy392CNkTbWqOP2YAnvQZhJkNfbLi7UIu8+OwUNV35nOc4hdFOT2F8C8MjJdVEtGmvJVonU X-Received: by 2002:a17:906:57d4:: with SMTP id u20mr5825607ejr.445.1631541288476; Mon, 13 Sep 2021 06:54:48 -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 gx11si2072496ejc.521.2021.09.13.06.54.48; Mon, 13 Sep 2021 06:54:48 -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=Y2o4pmsU; 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 93FF668AE52; Mon, 13 Sep 2021 16:54:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069079.outbound.protection.outlook.com [40.92.69.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E661368ADE9 for ; Mon, 13 Sep 2021 16:54:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E60aoxzRDDRmgKAjeafPV42ZptQMe/8Me9tYx+YUaLHh67ctcPFWB6g0IKuWEEo4dqbxGifYNRKUQ1uVv7LjTCSpDj2A5i1j8CHRNEzTIjIvsm0z+kaD+AEGCB5XPRLcQYov+V9y1H65YyyoSHoh2Cq/XurAbPYlb9CmdCU+p0n8uv7XIzLt9FYWjYkHiGfLxijuYs7pdN1iFizy6FqnsX91RIJprmAD6A+iB/KbSuWt97dMW+Sm7NvAMfI9q2sBh05Oole0YrPGklH87KbuIg8kcUM1+evpyF4DaXm4PRPUqlf15r/DE/l/GQjW/07/k9Mw7BvzioAg+uHZVonciA== 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; bh=gyLz2hAzxu1hMwvJ1u+yCX38RCnHDZY9VMrNXMN5YhI=; b=gmi0Qb+l4pupNWu88QXWwtqa8nXTQhoqXYCb4onYwbFCUUTpFxTjHcRguUXixCMvONFBDs9LmATgD2Z/DI5gHa8uP6H3yZHV1U3XF9ehWvY1fc8cqcyqTBevP8rk1MKyoPeeynrzUtlxyAit+4DGoubUUNF5OewAzC+h41+fhUnvaXGpq7+104FQH3j81WMkqXU+uNGO4FXshHIBYiQBfzr9WxwZd3zyoDBy92DV/+y01GPr4tKKFmj8ibaDoJHTtebKkNyMlFYfRhWipkZEwsnAy+TEwyzIh/kFoUjm//1Ika0MzsFlN/7w8z8V3aRr8VZIPIjsZsg3na5TGB6o+g== 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=gyLz2hAzxu1hMwvJ1u+yCX38RCnHDZY9VMrNXMN5YhI=; b=Y2o4pmsUV0sRTBv0BnAUxZpvqsIpPWi1ATjg9YRpy0FUwvO3UkWyTPmzrXNfRgM6K9MiQZNDW03am8f+yPzlFlJC7Hx5Z3aZT8bhVFmUUXHKydA2y0ES/hO5MWyDyy8LyIUCWct8FwsVNlgRtcsd+Zfb3E7IFBFpsApvsIqQdcJ6AZli3/r2WH6T4YnLMVPC0h/znz5h5gKS0WrCzNAz8vAx4QWfehfZxenrVGHonE6HbPfj8Yu+KI1pyvkZQTP7VokzI6ohTt13s8WcH1xn6+6DCjiRLtVFLuqAZA2gvFLHHbLDU8IgDd7Cp/SBVJgAPzGtsknZZmsCslCM7ie+mg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:54:02 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:54:02 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:33 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [UzEsWaTIOVrBnBnh9Yue5GZ/xTeDYi+q] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:54:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d184b72-71ae-4209-a86c-08d976bdf1b6 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNXSr2fKdz7sYpLFthH+NsypPAI3RoazAC6DlKkRlr6Ynmbs5EJPMUFDHNtnWi/3Hwn+1ba/Mc20gY9+zPcTsnFQK3A5+ke1VfgPGdMhmP9qBluJz/nKrbM2o/SBv5rN9qwdXjojpSZKSo11AschkMjZgcXaQQkcMIr6IK69gx9BJJHdJvmDV+gjtjuOMRnkpMm6LAaxKgJsmX036PwkYPyphsOIoCbJNQHYkSP05dEMAD45m3FKoNQ2Ra2+rfJzszE+YjdvX6DyRm3q/4bm0Lrf7KgsXbNdXQ8Ay7R3aeemC6I9nWhjLUZeYq1zRKwtPrj5EiV2aDeqsmGuRMNcWUkiAfob7kjCA+7SI85UIYKPqDOicxzsb8bGx+bLfEthPzctvDPgL+udPFuCh6oBcLcJL0u+8eWB7mIKgYlUN5BbZGuUyfKk13FhrtgewBy9rQNog7spzKcen8+sosrVTTjQyuar9BSzvZhZ4/c4aZjb5iMv6H69LroKUCY/2bv/ANx1ELERT3msk4E0G+jsUJZogSfedEMkShschB4RwkDSXw54GdQV+V5GcXaBcDdPHUZLMJS9rYmja6IrkbQw7uMqlTdm/2tLY36jlfB2xe1ORScmVK/tmx+dl34xoCPPwZsnhNs1oZ4LwkAevDS9IrPz8BGSY690PFEw2IyE9T1BqYMAGFtdnD3XCEUTlUe95ZYCcwvATv3F3eYQrmYOoocBr07ni55qngc= X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aEhixnAlygTgyCI/fkSDvzwRlmGSbp4JDD2b8ZrOE2d5zQXA2rcJn7720luAhF47KpdB0Q/txVsPR98Sp0oBXYcMxP41eUfWjKJgEvDNf+9qHFl5KBFi6/ItkEaq4hW5VMHTNIROYf027+zmi0Y3sMeIGPUTIDz/stmm0cOzdHTVmVXaId1SjX68FjSjPMDflg+PAE9sOdfj7RhqQMSuEFzJdq2g2236pSGbIhGg4QgY8UI60GKe2yme2USDNiqTkzcnoNSkirTVD+wIA+wK5HEnM1OsCMb5+DXqycfNEkiyfyZyCWqveY7pBx0pLXkhMTpFpFWXkO2ojzy11KHlSjnbXmWIZ4SW4UABY89YDV/Dv0xT8t9QC3s/R3iAlxHXsL5a2INJqEpOiNpdz0N8TQjzbKf/9yxOmbYUTojuCcV+qzX8TYdiHUm+ciQeUItp X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AIVdOh/lWAxs3XITKJElUncjNjWPMMc/mCP9WfKCmx9can/EOQxwtKwD71tcTTWJahs96Bc9VPdbqbBY6TT7LyxmkVHjSbh21EyVucM3dpR37X4V/71jD9ArzlAq/m6ec7uYbtnuSn5TTqbuMR53Iw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d184b72-71ae-4209-a86c-08d976bdf1b6 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:54:02.8241 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 07/10] avutil/opt: Simplify av_opt_set_dict2() 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: ZKXdkRkOmWzW Make it clearer that the ordinary exit always returns 0. Signed-off-by: Andreas Rheinhardt --- libavutil/opt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 24b8899ca0..f05283d610 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1635,7 +1635,7 @@ int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) { AVDictionaryEntry *t = NULL; AVDictionary *tmp = NULL; - int ret = 0; + int ret; if (!options) return 0; @@ -1649,11 +1649,10 @@ int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) av_dict_free(&tmp); return ret; } - ret = 0; } av_dict_free(options); *options = tmp; - return ret; + return 0; } int av_opt_set_dict(void *obj, AVDictionary **options) From patchwork Mon Sep 13 13:53:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30218 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021546iov; Mon, 13 Sep 2021 06:54:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDj4Ez+kV7oAx+C0buulZx//Kts9u4J/Ji7kmUgYnW2LqXwFnrF3h5FcO7kcK+WHPYGPhA X-Received: by 2002:a05:6402:21e6:: with SMTP id ce6mr13040201edb.153.1631541298374; Mon, 13 Sep 2021 06:54:58 -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 v4si7278302edq.329.2021.09.13.06.54.57; Mon, 13 Sep 2021 06:54:58 -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=mNe1uuli; 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 9828468AE5C; Mon, 13 Sep 2021 16:54:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069079.outbound.protection.outlook.com [40.92.69.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 14F9868AE15 for ; Mon, 13 Sep 2021 16:54:07 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fz7PWLRlsJcHcwpVeN/X1W+RQLnuS05CRlsozQZJpvTI0LhZ+Rd4MdrcGLcmVNrA7wZWesi6mDApN/SZjXdRRSiYSZmMvKDcpC3M2hzozTnV2lunk03l4ubkQKpYPCdaYoV8+aTl8Po+eTw/0zmyz0n9kvAdZbOnjJheV6/lRS1e2FeI5k10AH35xckNOUvLW/5op9fL8Nwn/srjw49bFQ7FgrQLmZ6S/hIQaGtBgsuQmIcLqC1U/0C3BbwahmtI9sKPF0XFpDZsXNLbW7YULW2n14BFEfYcCeaYGeO/K/B9YpxhGb/FecqdHK8Xk3CkGb+13nweEAgWg1W+pfQX0g== 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; bh=Ac2j/Z81eoOhuJn/yTWf8qX+Zs0oTO2QpRKR06HE9WU=; b=Et1ZIlnYr4nmVKGoLKCIfBwBfwn5E3V+a1RNTqGApgw5IDhTeRhIc6kAF3FUNOXQ6Xkl6upUrZhYotuYJ//lYlktAZMqF6Som09BIYDLEg5fkO6OmRLuPSKRpqD8NCWahmUTOiT24PrhxOWELs3d+g8GdVczwSrPGXMpDgpBrGxBYjyXKGQF5Rg9A7MPAHxLGDZJPx8yd5QaYRgS1kOPYqZ0GD+Adk9W9LshTEH6V6cEeSyvdHfU1I/dnokOlqB204IOo4aDbFf8hxbFmJJ4OvrfBnE1rfCxwUN0/6/upGm9TgZods+bFlAC6PT5gQ6fzIdDKu8hzWg2xZu8Id97aw== 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=Ac2j/Z81eoOhuJn/yTWf8qX+Zs0oTO2QpRKR06HE9WU=; b=mNe1uulihrtiy1/YhwOB1BASw1wybBStQH+KCRl1x5yVvT4Zgr7DISrjCv0vVXYUFZF1YYKCLNktZrTlRNuSNq8PsyWHpqM6yV0uvrams6HI2Z9aLN2hv4iAN1kocXZ+J+dYXZbwvp9D4tRRi13672jz9uKcFD6WQtYkN203vz22ovd/9D8AxZ3/Y8TpjwzKqDRQz52yJcPy0Hxw/fRSXcBPUFR4hDB4ghbOgqgNTxP/rsmLc9PrQLF+igqeeqtz5TGY9oG9xf5RnfDBGJp05TfQ0N0ARvksbDzwYJacJw66pfwGtwuq1YkE7nkJrAGNzEk8VklPRlFxuizMG6TfOQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:54:03 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:54:03 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:34 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [+w/eq8FlOiB2VTm7sSy0/3JeBlokIIn6] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:54:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d77de5f-2fe3-4208-1d2c-08d976bdf255 X-MS-Exchange-SLBlob-MailProps: zswcL9HXbeV+/nHpyDOdbc6zZJeMBvuxauMyw4mXg3mtCQMlcaJgbNv2iFOFKA8fXPgbRUBWSHx2Qz1b+oR3NgSVaUMfhUXb4XVocheH90wfUXn/x3PhQX9MrXGbNbt/NQLbIjo90k6jRN45WNPcQQ/Dxk7dq8wRNAMYcFM3DRFDuqcAfcspbYLW6A4Up1KtkJ/RWI6/GxkwWZgH7gTNvOiDgcs7zp4wMs6WrHjpR+DV4gLq/DqIqxsZ+l1MyWCcp/9c/mSte35bJpJKTbjpm42lyn8iW9GlRGaptUparNUB5lkaQ6KekrbwIv9VwNgNJ2WUs3N9yq2uNuhNvwNBfM/YV/VILkfjcLiyIP7HzwKnWDS1y7K23Wji+puZLtbE/3DEkuBX8wA4N4i3tcchzsAPhI/gQoSDEUJlilaHpWhjE+/wd42rwcUi1NoXeQBIsRrkvA+mJ11PktToZ79PbHnLhxL1S+LZ06CwtGPz1C4KDGZLdrUWOuH/suHYhSHcatwAeTWA8PZafFAfnXX0HDf5aETt+N1RNyl4cO+19XoW5ENAbe9lcfW7soADOfXPC7k7GOnFa7kdpuy273kJwBSJjv6SwmQ81JTfihhChihFHgY9E7z/wzOTjRKpdb5eDndKPW7GR0ks7pIJTfvuOglRPT4xnVUKDVqGQwUgMmDQU5CijFNZSsOsVI4mLdDPp8ywGCN2JByR7kLuTqdw3ajO7owLf3XQNjp5VBTrl2BPwhAuVGpMZHZNWFSrz/jV X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eO53IB7vs+BHB+fhSrMXHLiY+4daerKksLpauGwkLbmbyTNhtmtFpDdnzZlJmYaPe4CJfmR5T5WjpetJBQUNnyg7AJfceTMvQiqcd7CUFYgXRPbv8jtJSbBzzGO5nTw4uH1CUDVOaoBTMcJulAwMzPBA7cRnUCd4T6EDfqFROOJ0fq8e0pM/NsxQ0eTqm1I806APi3NsxSRz2UOhoLm+LXKO4TXQAo0Q7gtM2N6f4iZwq5/ULnz10icHuIUc0akNVNkCKk+NdVm1eWRWh8D16pJ/p0S59zRd/KT3mdJ6EhNyY/V4y4RMqfzXQ008+5eyZ1LRI78CJn1rVTmjBefmrMVnpvQAVAAl1AxGIwv4JI/twH1SzneOgRlafKQsVEorAxI67H7LHfR8zl3dUkunqrf2wN/Vkf05pFDmVAEX2qVf2dTuOffPcPR4voopP1vo X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FSekA7rokMaQ38cQOxMfUuVNcQLEKTNfZ1sI64RlNBz2ROzCHxgeLJ1pkYnNXZqvyrJhYjJDWvx4SfIOQou7cYjNqIV3HEdoah9fWgrKoC3ZFiUTkLX7iXGmGFRrcYQRA2XpL0yL6u/Y+JMwK8t3OQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d77de5f-2fe3-4208-1d2c-08d976bdf255 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:54:03.8168 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 08/10] avfilter/vf_subtitles, fftools/ffmpeg: Don't set sub_text_format 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: Soft Works , Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: k/UZX/LfrQcs Unnecessary since 1f63665ca567fbc49fa80166d468a822c2999efa, because the value the option is set to coincides with the default value. Found-by: Soft Works Signed-off-by: Andreas Rheinhardt --- fftools/ffmpeg.c | 2 -- libavfilter/vf_subtitles.c | 1 - 2 files changed, 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index a9bb9d964d..4b6a6c7fa6 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2983,8 +2983,6 @@ FF_ENABLE_DEPRECATION_WARNINGS av_log(NULL, AV_LOG_WARNING, "Warning using DVB subtitles for filtering and output at the same time is not fully supported, also see -compute_edt [0|1]\n"); } - av_dict_set(&ist->decoder_opts, "sub_text_format", "ass", AV_DICT_DONT_OVERWRITE); - /* Useful for subtitles retiming by lavf (FIXME), skipping samples in * audio, and video decoders such as cuvid or mediacodec */ ist->dec_ctx->pkt_timebase = ist->st->time_base; diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index d0bafcd3cf..f08a7fba9d 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -395,7 +395,6 @@ static av_cold int init_subtitles(AVFilterContext *ctx) } if (ass->charenc) av_dict_set(&codec_opts, "sub_charenc", ass->charenc, 0); - av_dict_set(&codec_opts, "sub_text_format", "ass", 0); dec_ctx = avcodec_alloc_context3(dec); if (!dec_ctx) { From patchwork Mon Sep 13 13:53:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30211 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021643iov; Mon, 13 Sep 2021 06:55:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFbyM2I5yB/gi6H2bZZ2LDjgX8XKuhx3kDvBXE5WNLGOkDez8U1EbXPfm+yzx8D5fmf20s X-Received: by 2002:aa7:c408:: with SMTP id j8mr13381763edq.280.1631541308953; Mon, 13 Sep 2021 06:55:08 -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 n10si9441788edx.387.2021.09.13.06.55.08; Mon, 13 Sep 2021 06:55:08 -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=k1YiUjCn; 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 8369E68AE5D; Mon, 13 Sep 2021 16:54:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069079.outbound.protection.outlook.com [40.92.69.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C26A68AE0F for ; Mon, 13 Sep 2021 16:54:07 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HLxY2GJ9Im9pxVSdgOSPYY/pIGAkQAE7+XM90JGJCh+rKmdMEUpVbidBuBQjNaRmVNaM97bnsLAzppI6hPhSYK5SCHbr7hkLevst0yc28nizYwzDLsFmNR6sQJro/Ib+F0/l6IHHPRV3n/sfNn5JyxmwT8rOMpKjtTR61qzXjQjAp4ljAp/I+WB7+Q4Y/Bm6psMMO2GijfOBxLZXE7Y3Nt187TJ46IFDRq2PHKLdVSFaoC+2YD+5XrXviF+CHo0torvv4HqQiSk3tTe8nwoipySiYykJa8jitKd1BhOI2HAgnbrlIsNpIWPS234L+7EAWm6jEHLSPeQfGQJIOpbpxA== 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; bh=rVnqLu5uJROXbHTctLZqZatfZmKVZUkKxwdbmsD8oJc=; b=kV3nniUO0Fk8MzuRFRxOIK8G1M4gFEDSFJYihOhKNbmBfZF+sLmXuQ3dgzecW0mamXin2pZyCG7PdNHv5d/v6zToDBMwRZUDBZgKxt0Pt3yPCntnkQDtIrXMQ5cbjEcXz6ebww3iXq7M8WG5LGYdqwvtrKYinFwcxsfefHt2QhR4MjZKn9QJKzFEZQOEWyOoizmjKHkiJGiGGTX/nih1jdP2F/X4+QjzPMFTmIkWy1kQDfrAhiEN1xT76Gy7VC2wwOqVAwfsxSZplVkw7XRQWp0pHt+9lX++/mnLPgzczK+T9GAF1aF54C003D2f7GzYQ8Rb0M6YhLbpzFPTSGDMww== 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=rVnqLu5uJROXbHTctLZqZatfZmKVZUkKxwdbmsD8oJc=; b=k1YiUjCnN6WMKuA87mEQrMIVhTdBt/+wGcehx3xxsAi8nqj6z0OEJezlbqveF1amtoatZuak2G033Lk1LZQLq8W4qm0IKHctUIPPBm7lOQqllPU6JNG7w8wnAzrPgEZfJMMRuSAKcc4D9B17dzXMzMSbj6H3V/Ug4DJz42EDHsTnU9UyB1t7zbTuYoEnK/MVeFPdmqdKFHZElmN1e+QxEF+2H/P0IBsx9IIsBoRjxR5nY12Rw/R46j2bECLtRBTatfOp6lxWLNq37XMhTlVHp61YHyC4ONOwGXyZJ08LQxonmDMZziWYdh5IFBJ3W84/ZJL4OXkUJRyaC/IpdZCNLg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:54:05 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:54:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:35 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [0K5AY40w7w237fwDLgfjELlJq/htWJab] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-8-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:54:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36aba665-19e5-4a61-d07d-08d976bdf359 X-MS-Exchange-SLBlob-MailProps: Zv/SX2iM+5Wuxh+ZWr1Yb7sNHtcktfNaLdegw4IoVxcT6uCMtUXnxkdD5W+G85n3Vh/7HNKton31G104gV0runfoYC+gqkzAJawNX7W4LcFHUa/SyWBTJ83wArjxcg2oiP7UCxAUV5sku6ym2mI+ux27o5U6817RQB2Fn1L4JjiKlCzkYTjmyIWTb1on7QO52gpLjgb/X5rFvaZDRXkDi/HfrMjmDHdhvaw1dMp02Qe44YbJrUz9RyI2MbF6e1hLES8IWifQ34/aEpf33mX2w+o+kIfPkBHET7ZHdpLiv08kQ114wIzOopE4L/mkQxT7TrCzOX3V+sr7wXLdBbkWzZeyWTa2TIpqo+zVxa6dB6oUPQriJ7v5ANvw3GsPgmSoyzAgXI0XdM/gzKJKVwlKqjpBY6iOAEQPlgrvdezrsg12IJmeAHqtSlwItotadOQIzxkDT/wpHRBD53BCsCASSacVelSLzHYv1MKILP2ZyRMMX8FZh8fNWV4C4lovo7JJeRQpiJI4nLYx7wcDx5hVH3+tUaZvC8mCARQQI4HftEFOR4t5lqil6dfmwK8MkAfqsJZXtGBmnKqUDgXznpvYtubH9n23I5syLWh/wza8pWAD6uyL5ADyYGajk5195PhM5NbIkccvTBKU/5Olw52SvZ2AHDgfA4VFuqgbEBAKawt2lxR4SI4M2uNMxT/Hlgd/SoSmAksS9IQ= X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nNEw0HAvXZ/Jyp85PRlD4FA3ZK2aHlNd927Kek/xuH2ng4sVVxM9Ie1w7QqYEVW/Qca/uUkz60TZW2XaIHmjRbkGB9q2tZIq0PvVSeX5yjVckRNlJ7g5AB5ynEFQqCNP9keV2f/IJ1qu0/wNrnMfXQPZx4nsSspxv8oqwGE6qMbwuLem1rIyL57bTU7grCO73Ax+uGhNxZiwZd5Enkke/6n08J1C05UND3zMk7Qy1o1YnGRN/nKpOiUYtDwESJhExHC3yv6HikWod3Msk8i+Y8wJwDm48PQ2mMtIMTy+Q9IgviWRDCDU6opKodjY92qB4bLYb73PaMut2f14+npl1X0ppxkNeioggnrBD9l48JxTqQ+4zse2+GiOPeeOkbGG+MHon1XtuxPyOYQRDMKcdNKcQSFF/9W9mIXktOp16Oy3m1WUnAwkp3fQIVgyQaEF X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SNgCANkvImIJH45FQaQfotsivfoTU5hG3RyZdWFHLyZhhkDghZtPd1FQ0ERTAeqhANv9VLC49bw0fWmV7R1cHKyOQlvk1Ttuch6uA/jWhWT6JEPpf9suGMg5cMgBsS5qxg+KrsoMrisFKKZ8QKTLfg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36aba665-19e5-4a61-d07d-08d976bdf359 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:54:05.5800 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 09/10] avcodec/avcodec, options_table: Deprecate sub_text_format 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: Soft Works , Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: IQVD69bSwjLx Unused since 1f63665ca567fbc49fa80166d468a822c2999efa. Found-by: Soft Works Signed-off-by: Andreas Rheinhardt --- doc/APIchanges | 4 ++++ libavcodec/avcodec.h | 7 ++++--- libavcodec/options_table.h | 4 +++- libavcodec/version.h | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index cffab2059f..5c52490392 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-xx - xxxxxxxxxx - lavc 59.x.100 - avcodec.h + Deprecate AVCodecContext.sub_text_format and the corresponding + AVOptions. It is unused since the last major bump. + 2021-09-xx - xxxxxxxxxx - lavc 59.x.100 - avcodec.h codec.h Deprecate AV_CODEC_FLAG_TRUNCATED and AV_CODEC_CAP_TRUNCATED, as they are redundant with parsers. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 1b70a08980..7ee8bc2b7c 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1857,13 +1857,14 @@ typedef struct AVCodecContext { */ AVBufferRef *hw_frames_ctx; +#if FF_API_SUB_TEXT_FORMAT /** - * Control the form of AVSubtitle.rects[N]->ass - * - decoding: set by user - * - encoding: unused + * @deprecated unused */ + attribute_deprecated int sub_text_format; #define FF_SUB_TEXT_FMT_ASS 0 +#endif /** * Audio only. The amount of padding (in samples) appended by the encoder to diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index e740112d6a..130341a2ec 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -368,8 +368,10 @@ static const AVOption avcodec_options[] = { {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, {"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, {"ignore", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_IGNORE}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, -{"sub_text_format", "set decoded text subtitle format", OFFSET(sub_text_format), AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS}, 0, 1, S|D, "sub_text_format"}, +#if FF_API_SUB_TEXT_FORMAT +{"sub_text_format", "Deprecated, does nothing", OFFSET(sub_text_format), AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS}, 0, 1, S|D | AV_OPT_FLAG_DEPRECATED, "sub_text_format"}, {"ass", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_TEXT_FMT_ASS}, INT_MIN, INT_MAX, S|D, "sub_text_format"}, +#endif {"apply_cropping", NULL, OFFSET(apply_cropping), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, V | D }, {"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, V|D }, {"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" }, diff --git a/libavcodec/version.h b/libavcodec/version.h index bb70d4d152..8da80a3670 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -84,5 +84,8 @@ #ifndef FF_API_FLAG_TRUNCATED #define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) #endif +#ifndef FF_API_SUB_TEXT_FORMAT +#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) +#endif #endif /* AVCODEC_VERSION_H */ From patchwork Mon Sep 13 13:53:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30213 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4021779iov; Mon, 13 Sep 2021 06:55:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+MP86kYHjSL9WBLX6d/Kpthezs/xkdr7C6Qz2nT0TKVz9RRWJaIrjLrpebvWWPJnuINIB X-Received: by 2002:a05:6402:2050:: with SMTP id bc16mr12929761edb.270.1631541320679; Mon, 13 Sep 2021 06:55:20 -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 b14si7345687edd.76.2021.09.13.06.55.18; Mon, 13 Sep 2021 06:55:20 -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=tU9d3KD4; 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 A253B68AE6F; Mon, 13 Sep 2021 16:54:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069050.outbound.protection.outlook.com [40.92.69.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDF6A68AE2B for ; Mon, 13 Sep 2021 16:54:13 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lhABi+XACU/KgNkT5oUQ+zB659wEhFZtG8G/pEh3UoaPNQ+654KuDoKnB5jSJ6faOCtvjVOLZ6BfP2nFK3zWgbFQuTYHGs6pCrBae4tLl+YdJgmXUn0gEKWKxwJQmdlkmN6A0ulX/7b1qh29b6L8mPLmbCLJNxp3iAHQ8K9zbQZJa3DPxL4vnschDJ2yerL9g34Sogv8UeuQ7PDJ1vvxgtwV/KaNJl+lfHf7FTHt5TnaUibAA89P1eGXu1bke3eAUKUT3OBOuwHQ4MjQWzo5l7DqrdEOBiHOBCfEjvwsW4cfwHGuuVxWsd6Bi0YnVhdpWlS2oC6PjUw5CrxOcLnACQ== 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; bh=RU6z4wf6XpUH7A8r0Nf/gZ1rXJ9FKTUh1IlJ7XEVCbI=; b=XM9vZ9AnrSF7YeTjGotoAKC8R5IopoM8BXEE++DnXO15HJ31/tg8RGiPSzq8ZaQBA5sUJFjbJ7+5oGOjlCdZcJ2VsvVu+XJ+/ft9rgRGKE5u6DYeD3fKz5cG+EU0+NAHRYhTyPv8zEWn85zlnEH2EYJBvCvpnCeetziy2emmBVpMGOW5sDgC8CTH8QC+yqVWxscVaOKu7ICnL/vysDPG7B6VqfNFuhz8CQARJjrq5/s3j8z+5/jR5iq0YiTAyR3fgQQrXsmMmj9lqBXD/1nDZGiwTlcUYJunIhuPbOFqE4dbLwwbzpFt2cLJDvC4KwJKxdOU0kNNKEJsrinS1iuKEw== 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=RU6z4wf6XpUH7A8r0Nf/gZ1rXJ9FKTUh1IlJ7XEVCbI=; b=tU9d3KD4MlxRsPlFwPhTyVdKHccQ3U0hKjDBgqiT9lOZW4TuSX35AvWgwzW8fCkkxAaXUb+SOJX0GeA+tpjFSWB8P2TrrZhy1l3EmNSQqmio5yGtaoaAJYgLGZEn88pr5akbfvtC85ap/K4ZC0QLKTlpcaEIikntJNfU1Sk1DbGdl9MA0GtyvcuTAx7rdE7r3KM2T3b07ZKa+VXOfT433kxcxt62y/2nY8m6+6zUQiCGqk9kxXguvxc6obDfzsNMvAt1+HlIa0nVmkUirnpdJiLCiBV+XtXZUURmltgoELy681uCy1WXfoLwbnl3VaNx1njulKSna5KqDOtPXaD41g== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6627.eurprd03.prod.outlook.com (2603:10a6:20b:1be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 13:54:12 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 13:54:12 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Sep 2021 15:53:36 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [4Cu3w3HDBRwxuUF6sEeV24dTA1BPshf9] X-ClientProxiedBy: AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913135336.2804405-9-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR07CA0023.eurprd07.prod.outlook.com (2603:10a6:205:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Mon, 13 Sep 2021 13:54:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b25ca33-24d1-4570-7cbe-08d976bdf75e X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNXSr2fKdz7sYpLFthH+NsypHSPHF9e/9KxQPkSAB99xkBH9xJ6EmgPWkZcWbMwH1vrGxCSWNezHJPUQ0Jdp9f0bk29Z/y+JI1bbloguMH+U6sQQ6RlbjDpo4lNH3WJdzSeOK2sGuo0E5wWnPcHnDuHHFrgSWbwFc2btqWD350TOY7geUa5da6GZ0JYp0xWwxwD6qndpDWvfPqzIMMqBwC6hdvMvGqd1uYVhAaCWLzcOkza09rBVL3UdxS1wg480uiTkYjF1SJAasuINODQIeTErWQAZjdM54VPa0IQz+I8VUniHem1Ecp8+FehF03pNLXZ0ldkyzRP0btYuywe1Kso4V2aatr06T0pT82yKFaNUooU7ZZ+pUXOSIKOeh3X4aOZMXmuyN95RvNdW+W9icKLYuyAaVb0PoGV1uEUk62kTsdp/pnQkoY1RSG3s/ctuDHO+hp+Xvk2TVABTCRU03SQ3dd83yemnZV7SF0TreemMvhOVlCjrGXrazasOjBmit0kEhcEnuOL7FK7e1Eo/xGFqG9PWkIXCroeMtAzTVaDML2GGtVcRgCLFMZ+a6bpby14S5Qgl+02BTPMsDe9R9F9wBZjnO7tAAMgWQWr4eYWuGwbn85e7kJqqMGqJ1yGxgoTwuyYH9PnrhhxTuWOEKZaPBOd9aW7Zwc35omJ2zQTwdg4kHLY6nTNjcEZxMC8dV3oOgB1Fi4nF/cbVPRDoy1qGZHLhhY8zJBI= X-MS-TrafficTypeDiagnostic: AM7PR03MB6627: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h06tOKjMNnPDrMBAsf/lcUGAss2aoSOWwfhinG62UjUnpJRgCo9C2an9jFpffU5x+GHLux22wZIagtcBZMRr1BLjzVBBf84ezABJQzAgZC/bUyN3qL8nDmPOitAR7FZhVYtsVnypgvb47pcFZWx+34QQEitUUf8Bxwi5Wnkhx5cs58K5F/XwbrPOq5sKFVIX05kGtiEqEErN1E9oXwFiHJhYJjXMbieVlGIsHrZJMWf9rQviGpSXIZnuW2DSYFCLofixVRGcvAlfJvIuSGM0huFgLnTSnnYr8AczMpJulqPOAjBNcKVOO7sWKFl76GsRRvUeXWVRUQCSWnvbss/s7FpZga563HyF//EdPal/H4+M3EPB22WD87wcS/67QUVUkehYas0tx1whVS/ZSw9jfAzcGhzaV9iqRfYUEqYfx2CxUtA6IVGeZQGGNAS2CFVv X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /A7JShl0bNiZC0wQpgqwdzMCJzuzB6Qlc26bT07dT02sKK13+oOa3sT0UhOGfR7hrvmdLmdZDGJ2oWpTk4XZSZv79O4jXoxa4VTYci8D9PqqVUVE5Vu2Yy8zhlR8dGtNXjvdociCnHfrGAatwH8Kfg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b25ca33-24d1-4570-7cbe-08d976bdf75e X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 13:54:12.2827 (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: AM7PR03MB6627 Subject: [FFmpeg-devel] [PATCH 10/10] avcodec/opus_silk: Remove wrong size information in function declaration 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: pd6c+KQS+vJ1 silk_lsp2poly()'s declaration contained arrays with array sizes; yet these array sizes exceeded the number of actually accessed array elements (which is related to another parameter) and this leads to -Wstringop-overflow= warnings from GCC 11, because the arrays provided by callers are only large enough for the actually used elements. So replace the incorrect array sizes with comments containing the correct array sizes. Given that these sizes are not compile-time constants, they can only be communicated via a comment. Reported by Paul B Mahol. Signed-off-by: Andreas Rheinhardt --- libavcodec/opus_silk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index 913053c5e2..8523b55ada 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -198,7 +198,8 @@ static inline int silk_is_lpc_stable(const int16_t lpc[16], int order) } } -static void silk_lsp2poly(const int32_t lsp[16], int32_t pol[16], int half_order) +static void silk_lsp2poly(const int32_t lsp[/* 2 * half_order - 1 */], + int32_t pol[/* half_order + 1 */], int half_order) { int i, j; From patchwork Wed Sep 15 00:57:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30253 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5489593iov; Tue, 14 Sep 2021 17:58:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX3DxI1poYDnJCqLekJFhCCswdpvnVjgT9PxiAaGWoqjkLEWIUIS4e1IVrabsnQe1lWVFr X-Received: by 2002:a05:6402:319a:: with SMTP id di26mr5157100edb.84.1631667490598; Tue, 14 Sep 2021 17:58:10 -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 j11si13116397ejj.109.2021.09.14.17.58.09; Tue, 14 Sep 2021 17:58:10 -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=bhoThD9E; 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 5116568AF89; Wed, 15 Sep 2021 03:58:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072107.outbound.protection.outlook.com [40.92.72.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AEEAF68AEA6 for ; Wed, 15 Sep 2021 03:57:57 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JuRb3BQhnQ0GNfUHOebwfrqVLjCHwZb6qJXkj7RFAiAbn8AnqnsRv6B6O7zqwruxkjVYT0xogHQL0reHGyicVhoquX8dEM6RtGaOSVhafc7br4SiD8lwV8qSQHYd5ukZ4YzTysp2NSx9N4HhJ556yycPLQmgCJmwuKKdG/qAb3uVy7iBk4zJXXu4YRo3db4mEvZd5swAuda1322Knsv6xtKLjZ/nXthjlr5pTn/vG9ZHfZ2FHXKsrLRU/zJbMfkQ6l7/TBdcaMPSTmlLqD/rBg/N/kncFMwgEP+36k7OV1lXpFnLnqlYJ9dxiSAbd3HBEg5sLzml2voTKm8tC0gvUQ== 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; bh=GbDicCNSWDKFL4JdKSFwHRBvQaa1psC84uVSKJT4vuU=; b=L7AwkEGzJhBJYt6OlYxvWrxqmLzNH87HHW4OEPsFUW11ZTqg+qOzJBOiIpTrrPCvp92MeNb07TnamQKV1lgGFrpQBXzs9XTFfV2ezTA6gs09YUgHDsY4WeSGV+rooJIb2lfYIRILh6UjDLMO1MVzL66mh3GhRpXldXFlMH5gYOkFtC60zEJYs/PyOeJp8LY63tItqz0eTR3rCBt2BTnAgXpnZiPsKduJrE9j46dU+CwYLiEwmlXA+TR+xblsW3cUWppTr47nadculYePmApN2xAFNfaQiqIhH1YEqsjn7AlJDKVg3UtY0tdGJDvObeoWHwrdnm+PS4qwt1D4N/XwGw== 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=GbDicCNSWDKFL4JdKSFwHRBvQaa1psC84uVSKJT4vuU=; b=bhoThD9EWdTuWR5+fDA+3c69N+86++Q6Q/q/R7qc1xV5IHR0odu2XNcoHFsFy+gc2u/+/Pb6xGNfATUyUL3mxHxDWlC+y+j6f5nrMDGIa4resnvrsWq+z/4WGRouR+O/JEN7mqecSramEMQZMvHhN4G6adkjJ/ZTMHXw6c7r6M3f7CwIYTL4oQRd9GHEumlr63E95AEdkcRofs2ihMnkQNhWt2ljPmCPwoz352OzfqeQnjUq+A/nGlSMfVq8Ex0GJeBNGZGIcDZE+HDimVN2fdUy673ZD/hjSYCL+ogQf15Oa8NcBkVa6ctIfDZpI1R4kZcu9xc5AsfHTPQz1t84eg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6354.eurprd03.prod.outlook.com (2603:10a6:20b:1b0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 00:57:54 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 00:57:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 02:57:44 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [CiYetCQKWXdYnKVQcL8NYWFAQCm5Qr6H] X-ClientProxiedBy: FR0P281CA0066.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::12) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915005745.3770937-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by FR0P281CA0066.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Wed, 15 Sep 2021 00:57:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65ffe6be-51a3-4333-4d9d-08d977e3d95e X-MS-Exchange-SLBlob-MailProps: Fv08Uec/qWVApB6MrMwU8fJz8k28FMibRzQY+pesDOT8lSNx6WZ6FoZ9hizQavlwEhmXQPRwgaOunnL7wqzFvJLZUuHD/bdRG2HGAEyLAQNiiXj4ee87bNJbBfetvbLdmkBR1kVLxeDm2IF5Il7BCcMcVQsLQ39iHCl4mjfG434cDY0CZFZpA/l7sjMP06CUtUy4EwJNLhe9Ns/O4RdXG7UaNEebtq4v5OPs0pZPGALZq5jyrqZMGiJccJ2q/d3guC6sow+kRwLoSbaJvWW5OsycTIODzX9+SOy1kfQ+6MHpiEPRLxuXJcF+hME1rfGiOhqFJzl+QcJbN4E+D4UY7UuofAViOPZ2piJZwCddBEPOLaSE/FrFpg2Ucaw3mvQDupnJIXbiL2NRB5rJaLiKPOVbBWMma7+dA/JWBFFUiNzUQCaMnxOZs1p3Z7LUASTv07th61E5KKg9tWD0I0tXNoqt2UJiHo8wQ8eRnOJl3kPlN9V2H8dmM2gP5xyyzItJX0SUl/G7iodz0RPmaRbsHzq12+7Q2x74xwcnoG/A5IrUvJro+38LsNyU7A4kLqnChGtP5Ap99aLpPKz19LRRtjlX+i8O6uFP+0fAfjcIh3vqWfa9gG25hNq22XSF/ppmDHSdj1aCIavSRvdh361WxickJBWPaDfu8u64sUrme2tloXUvOSoRLBCmfKnr1ZXpHDRp6nD1WU7lSqVk94zM4lTINpt3edjKZZQCaQTvGMoZ70E8D6EDv4nOjG4OeLu7bAwmIiHDgMIa9E06TGLso/HDIkNo0zh/nmqIlFfzTzU46vavvDY9oGYj4zloclxCUwK0PgfrTK9/xp+solghKA== X-MS-TrafficTypeDiagnostic: AM7PR03MB6354: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4+j2/AUeLMDNgfd5d+kefWDgjAOVXVgM8WTRmSG1SN0/IA1ln7pUFyV3sSXqLkbgsyVBf2HweBgdLTFWiRDtiJf0VWHx5PYh8kGTbrXyhbONvm+kMUZFJJs7zEDz28WjVdSPiyJpEdXSZc4pVov9AuLmEPkB4O9ad9LaQVHU6k+oIuqhLzymNADG6qymTzms1lg0XV/IHs12VQv53MrbqyddDmobw0Wi0pdbVPfKB6OrmDurjQkxTJjgflB+vd0qY+0EEf83eM8AWsqYW8wBCYezDr4Y9uZeWUgyatrxNMDPrdLE3ouWKxXb4/F/yxou4Yq1PpoB/3DNxMcUBNRIQ5JrmCpA3ybAGFxUipigh6EunAlHUt/IDOQNMUTguBl5WAxpgElrSSbt86tbJiy4VdCRE1XRbCt37ezzTN2IRMGofVqJd9lx/8bDfPPtR+2K X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vyJRmQIiHI8+Gara6rcUKqNVSKTqVfCT1Yp6HrskB9vjSzG/W+cJ+y0trCFGUnJQiZNT4DxcVJyPeMDQRYsWXUE8kMIfSKR7lTKBbioamQ6MjjeHD1WgHEDq0MKhwSBVJgjBLyINhvcKcZ0RHLTBPA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65ffe6be-51a3-4333-4d9d-08d977e3d95e X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 00:57:54.6395 (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: AM7PR03MB6354 Subject: [FFmpeg-devel] [PATCH 11/12] Replace all occurences of av_mallocz_array() by av_calloc() 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: +EIdTHKvT+HG They do the same. Signed-off-by: Andreas Rheinhardt --- compat/w32dlfcn.h | 2 +- doc/examples/remuxing.c | 2 +- doc/examples/transcoding.c | 2 +- fftools/cmdutils.c | 4 +-- fftools/ffmpeg_opt.c | 8 +++--- fftools/ffprobe.c | 3 +-- libavcodec/a64multienc.c | 4 +-- libavcodec/aacpsy.c | 2 +- libavcodec/alsdec.c | 15 +++++------ libavcodec/atrac3.c | 2 +- libavcodec/atrac3plusdec.c | 2 +- libavcodec/cavs.c | 16 +++++------ libavcodec/cfhd.c | 4 +-- libavcodec/cfhdenc.c | 2 +- libavcodec/cngdec.c | 10 +++---- libavcodec/decode.c | 4 +-- libavcodec/diracdec.c | 2 +- libavcodec/dnxhddec.c | 2 +- libavcodec/dvbsubdec.c | 2 +- libavcodec/dxva2.c | 2 +- libavcodec/exr.c | 2 +- libavcodec/ffv1.c | 2 +- libavcodec/g2meet.c | 2 +- libavcodec/h264dec.c | 2 +- libavcodec/hevcdec.c | 8 +++--- libavcodec/ivi.c | 6 ++--- libavcodec/j2kenc.c | 4 +-- libavcodec/jpeg2000.c | 16 +++++------ libavcodec/jpeg2000dec.c | 4 +-- libavcodec/libopencore-amr.c | 4 +-- libavcodec/libopusenc.c | 2 +- libavcodec/libvpxenc.c | 2 +- libavcodec/libx264.c | 2 +- libavcodec/libx265.c | 2 +- libavcodec/libxavs.c | 2 +- libavcodec/mjpegdec.c | 4 +-- libavcodec/mlz.c | 2 +- libavcodec/motionpixels.c | 6 ++--- libavcodec/nvenc.c | 2 +- libavcodec/omx.c | 2 +- libavcodec/opus.c | 2 +- libavcodec/opusdec.c | 2 +- libavcodec/pgssubdec.c | 2 +- libavcodec/png.c | 2 +- libavcodec/proresdec2.c | 2 +- libavcodec/psymodel.c | 6 ++--- libavcodec/pthread_frame.c | 2 +- libavcodec/pthread_slice.c | 2 +- libavcodec/qsv.c | 4 +-- libavcodec/qsvenc.c | 4 +-- libavcodec/qtrleenc.c | 2 +- libavcodec/roqvideoenc.c | 4 +-- libavcodec/snow.c | 5 ++-- libavcodec/snow_dwt.c | 2 +- libavcodec/snowenc.c | 6 ++--- libavcodec/svq3.c | 2 +- libavcodec/tests/snowenc.c | 4 +-- libavcodec/tiff.c | 2 +- libavcodec/tta.c | 3 ++- libavcodec/utils.c | 3 +-- libavcodec/vaapi_encode.c | 4 +-- libavcodec/vorbisdec.c | 8 +++--- libavcodec/vorbisenc.c | 4 +-- libavcodec/vp3.c | 16 +++++------ libavcodec/vp9.c | 2 +- libavcodec/webp.c | 10 +++---- libavfilter/af_amix.c | 8 +++--- libavfilter/af_channelmap.c | 2 +- libavfilter/af_compand.c | 4 +-- libavfilter/af_join.c | 14 +++++----- libavfilter/af_silencedetect.c | 3 ++- libavfilter/avf_showwaves.c | 4 +-- libavfilter/avfilter.c | 4 +-- libavfilter/dnn/dnn_backend_tf.c | 2 +- libavfilter/dnn_filter_common.c | 2 +- libavfilter/ebur128.c | 6 ++--- libavfilter/framepool.c | 8 +++--- libavfilter/qsvvpp.c | 12 ++++----- libavfilter/tests/integral.c | 4 +-- libavfilter/vf_colorconstancy.c | 5 ++-- libavfilter/vf_coreimage.m | 2 +- libavfilter/vf_curves.c | 2 +- libavfilter/vf_deinterlace_qsv.c | 8 +++--- libavfilter/vf_dejudder.c | 2 +- libavfilter/vf_libopencv.c | 2 +- libavfilter/vf_mestimate.c | 2 +- libavfilter/vf_minterpolate.c | 14 +++++----- libavfilter/vf_nlmeans.c | 2 +- libavfilter/vf_overlay_qsv.c | 4 +-- libavfilter/vf_program_opencl.c | 3 +-- libavfilter/vf_scale_qsv.c | 16 +++++------ libavfilter/vf_ssim.c | 2 +- libavfilter/vf_unsharp.c | 2 +- libavfilter/vf_yaepblur.c | 4 +-- libavfilter/vsrc_cellauto.c | 4 +-- libavformat/avidec.c | 2 +- libavformat/hashenc.c | 6 ++--- libavformat/hdsenc.c | 2 +- libavformat/icoenc.c | 2 +- libavformat/matroskaenc.c | 2 +- libavformat/mov.c | 6 ++--- libavformat/movenc.c | 2 +- libavformat/mxfdec.c | 8 +++--- libavformat/protocols.c | 2 +- libavformat/rtspdec.c | 2 +- libavformat/sapenc.c | 2 +- libavformat/smoothstreamingenc.c | 2 +- libavformat/tee.c | 2 +- libavformat/utils.c | 4 +-- libavformat/wavenc.c | 4 +-- libavformat/xmv.c | 2 +- libavutil/audio_fifo.c | 2 +- libavutil/encryption_info.c | 4 +-- libavutil/frame.c | 8 +++--- libavutil/hwcontext.c | 2 +- libavutil/hwcontext_d3d11va.c | 2 +- libavutil/hwcontext_dxva2.c | 4 +-- libavutil/hwcontext_opencl.c | 8 +++--- libavutil/hwcontext_qsv.c | 43 ++++++++++++++++-------------- libavutil/hwcontext_vulkan.c | 4 +-- libavutil/internal.h | 2 +- libavutil/wchar_filename.h | 2 +- libswresample/swresample.c | 2 +- libswresample/x86/rematrix_init.c | 4 +-- libswscale/slice.c | 6 ++--- libswscale/utils.c | 4 +-- libswscale/vscale.c | 2 +- tests/api/api-threadmessage-test.c | 4 +-- tests/checkasm/llviddsp.c | 24 ++++++++--------- tests/checkasm/vf_nlmeans.c | 6 ++--- tools/ismindex.c | 2 +- 131 files changed, 302 insertions(+), 301 deletions(-) diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h index c83bdc9333..52a94efafb 100644 --- a/compat/w32dlfcn.h +++ b/compat/w32dlfcn.h @@ -42,7 +42,7 @@ static inline HMODULE win32_dlopen(const char *name) DWORD pathlen; if (utf8towchar(name, &name_w)) goto exit; - path = (wchar_t *)av_mallocz_array(MAX_PATH, sizeof(wchar_t)); + path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t)); // Try local directory first pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); pathlen = wcsrchr(path, '\\') - path; diff --git a/doc/examples/remuxing.c b/doc/examples/remuxing.c index 13313a1748..fbf6de0cae 100644 --- a/doc/examples/remuxing.c +++ b/doc/examples/remuxing.c @@ -85,7 +85,7 @@ int main(int argc, char **argv) } stream_mapping_size = ifmt_ctx->nb_streams; - stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping)); + stream_mapping = av_calloc(stream_mapping_size, sizeof(*stream_mapping)); if (!stream_mapping) { ret = AVERROR(ENOMEM); goto end; diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index 51c120dfb7..badfba62cb 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -72,7 +72,7 @@ static int open_input_file(const char *filename) return ret; } - stream_ctx = av_mallocz_array(ifmt_ctx->nb_streams, sizeof(*stream_ctx)); + stream_ctx = av_calloc(ifmt_ctx->nb_streams, sizeof(*stream_ctx)); if (!stream_ctx) return AVERROR(ENOMEM); diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index abf56c4567..ff50577a74 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -689,7 +689,7 @@ static void init_parse_context(OptionParseContext *octx, memset(octx, 0, sizeof(*octx)); octx->nb_groups = nb_groups; - octx->groups = av_mallocz_array(octx->nb_groups, sizeof(*octx->groups)); + octx->groups = av_calloc(octx->nb_groups, sizeof(*octx->groups)); if (!octx->groups) exit_program(1); @@ -2168,7 +2168,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, if (!s->nb_streams) return NULL; - opts = av_mallocz_array(s->nb_streams, sizeof(*opts)); + opts = av_calloc(s->nb_streams, sizeof(*opts)); if (!opts) { av_log(NULL, AV_LOG_ERROR, "Could not alloc memory for stream options.\n"); diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 6ca28cf974..8c1d96ccf8 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -2591,7 +2591,7 @@ loop_end: count = 0; while (ost->enc->pix_fmts[count] != AV_PIX_FMT_NONE) count++; - f->formats = av_mallocz_array(count + 1, sizeof(*f->formats)); + f->formats = av_calloc(count + 1, sizeof(*f->formats)); if (!f->formats) exit_program(1); memcpy(f->formats, ost->enc->pix_fmts, (count + 1) * sizeof(*f->formats)); @@ -2604,7 +2604,7 @@ loop_end: count = 0; while (ost->enc->sample_fmts[count] != AV_SAMPLE_FMT_NONE) count++; - f->formats = av_mallocz_array(count + 1, sizeof(*f->formats)); + f->formats = av_calloc(count + 1, sizeof(*f->formats)); if (!f->formats) exit_program(1); memcpy(f->formats, ost->enc->sample_fmts, (count + 1) * sizeof(*f->formats)); @@ -2615,7 +2615,7 @@ loop_end: count = 0; while (ost->enc->supported_samplerates[count]) count++; - f->sample_rates = av_mallocz_array(count + 1, sizeof(*f->sample_rates)); + f->sample_rates = av_calloc(count + 1, sizeof(*f->sample_rates)); if (!f->sample_rates) exit_program(1); memcpy(f->sample_rates, ost->enc->supported_samplerates, @@ -2627,7 +2627,7 @@ loop_end: count = 0; while (ost->enc->channel_layouts[count]) count++; - f->channel_layouts = av_mallocz_array(count + 1, sizeof(*f->channel_layouts)); + f->channel_layouts = av_calloc(count + 1, sizeof(*f->channel_layouts)); if (!f->channel_layouts) exit_program(1); memcpy(f->channel_layouts, ost->enc->channel_layouts, diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index d8e968321e..90e895bbf9 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3003,8 +3003,7 @@ static int open_input_file(InputFile *ifile, const char *filename, av_dump_format(fmt_ctx, 0, filename, 0); - ifile->streams = av_mallocz_array(fmt_ctx->nb_streams, - sizeof(*ifile->streams)); + ifile->streams = av_calloc(fmt_ctx->nb_streams, sizeof(*ifile->streams)); if (!ifile->streams) exit(1); ifile->nb_streams = fmt_ctx->nb_streams; diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index e2dd85b756..99df55dc7b 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -227,9 +227,9 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx) a64_palette[mc_colors[a]][2] * 0.11; } - if (!(c->mc_meta_charset = av_mallocz_array(c->mc_lifetime, 32000 * sizeof(int))) || + if (!(c->mc_meta_charset = av_calloc(c->mc_lifetime, 32000 * sizeof(int))) || !(c->mc_best_cb = av_malloc(CHARSET_CHARS * 32 * sizeof(int))) || - !(c->mc_charmap = av_mallocz_array(c->mc_lifetime, 1000 * sizeof(int))) || + !(c->mc_charmap = av_calloc(c->mc_lifetime, 1000 * sizeof(int))) || !(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t)))) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate buffer memory.\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 487b84fd85..0c64f2c7b0 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -370,7 +370,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { } } - pctx->ch = av_mallocz_array(ctx->avctx->channels, sizeof(AacPsyChannel)); + pctx->ch = av_calloc(ctx->avctx->channels, sizeof(*pctx->ch)); if (!pctx->ch) { av_freep(&ctx->model_priv_data); return AVERROR(ENOMEM); diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index ba873ec53a..9e1aaf065a 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -2059,7 +2059,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->shift_lsbs = av_malloc_array(num_buffers, sizeof(*ctx->shift_lsbs)); ctx->opt_order = av_malloc_array(num_buffers, sizeof(*ctx->opt_order)); ctx->store_prev_samples = av_malloc_array(num_buffers, sizeof(*ctx->store_prev_samples)); - ctx->use_ltp = av_mallocz_array(num_buffers, sizeof(*ctx->use_ltp)); + ctx->use_ltp = av_calloc(num_buffers, sizeof(*ctx->use_ltp)); ctx->ltp_lag = av_malloc_array(num_buffers, sizeof(*ctx->ltp_lag)); ctx->ltp_gain = av_malloc_array(num_buffers, sizeof(*ctx->ltp_gain)); ctx->ltp_gain_buffer = av_malloc_array(num_buffers * 5, sizeof(*ctx->ltp_gain_buffer)); @@ -2078,10 +2078,9 @@ static av_cold int decode_init(AVCodecContext *avctx) // allocate and assign channel data buffer for mcc mode if (sconf->mc_coding) { - ctx->chan_data_buffer = av_mallocz_array(num_buffers * num_buffers, - sizeof(*ctx->chan_data_buffer)); - ctx->chan_data = av_mallocz_array(num_buffers, - sizeof(*ctx->chan_data)); + ctx->chan_data_buffer = av_calloc(num_buffers * num_buffers, + sizeof(*ctx->chan_data_buffer)); + ctx->chan_data = av_calloc(num_buffers, sizeof(*ctx->chan_data)); ctx->reverted_channels = av_malloc_array(num_buffers, sizeof(*ctx->reverted_channels)); @@ -2102,7 +2101,7 @@ static av_cold int decode_init(AVCodecContext *avctx) channel_size = sconf->frame_length + sconf->max_order; ctx->prev_raw_samples = av_malloc_array(sconf->max_order, sizeof(*ctx->prev_raw_samples)); - ctx->raw_buffer = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer)); + ctx->raw_buffer = av_calloc(avctx->channels * channel_size, sizeof(*ctx->raw_buffer)); ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples)); if (sconf->floating) { @@ -2110,7 +2109,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value)); ctx->last_shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value)); ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa)); - ctx->raw_mantissa = av_mallocz_array(avctx->channels, sizeof(*ctx->raw_mantissa)); + ctx->raw_mantissa = av_calloc(avctx->channels, sizeof(*ctx->raw_mantissa)); ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, sizeof(*ctx->larray)); ctx->nbits = av_malloc_array(ctx->cur_frame_length, sizeof(*ctx->nbits)); @@ -2127,7 +2126,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_mlz_flush_dict(ctx->mlz); for (c = 0; c < avctx->channels; ++c) { - ctx->raw_mantissa[c] = av_mallocz_array(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa)); + ctx->raw_mantissa[c] = av_calloc(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa)); } } diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index b4809111f8..2376a7cd02 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -1004,7 +1004,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) q->vector_fmul = fdsp->vector_fmul; av_free(fdsp); - q->units = av_mallocz_array(avctx->channels, sizeof(*q->units)); + q->units = av_calloc(avctx->channels, sizeof(*q->units)); if (!q->units) return AVERROR(ENOMEM); diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c index 9917f2d819..e342f09fdb 100644 --- a/libavcodec/atrac3plusdec.c +++ b/libavcodec/atrac3plusdec.c @@ -175,7 +175,7 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) ctx->my_channel_layout = avctx->channel_layout; - ctx->ch_units = av_mallocz_array(ctx->num_channel_blocks, sizeof(*ctx->ch_units)); + ctx->ch_units = av_calloc(ctx->num_channel_blocks, sizeof(*ctx->ch_units)); ctx->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!ctx->ch_units || !ctx->fdsp) { diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 74b8371501..e29d9c659b 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -762,16 +762,16 @@ int ff_cavs_init_top_lines(AVSContext *h) { /* alloc top line of predictors */ h->top_qp = av_mallocz(h->mb_width); - h->top_mv[0] = av_mallocz_array(h->mb_width * 2 + 1, sizeof(cavs_vector)); - h->top_mv[1] = av_mallocz_array(h->mb_width * 2 + 1, sizeof(cavs_vector)); - h->top_pred_Y = av_mallocz_array(h->mb_width * 2, sizeof(*h->top_pred_Y)); - h->top_border_y = av_mallocz_array(h->mb_width + 1, 16); - h->top_border_u = av_mallocz_array(h->mb_width, 10); - h->top_border_v = av_mallocz_array(h->mb_width, 10); + h->top_mv[0] = av_calloc(h->mb_width * 2 + 1, sizeof(cavs_vector)); + h->top_mv[1] = av_calloc(h->mb_width * 2 + 1, sizeof(cavs_vector)); + h->top_pred_Y = av_calloc(h->mb_width * 2, sizeof(*h->top_pred_Y)); + h->top_border_y = av_calloc(h->mb_width + 1, 16); + h->top_border_u = av_calloc(h->mb_width, 10); + h->top_border_v = av_calloc(h->mb_width, 10); /* alloc space for co-located MVs and types */ - h->col_mv = av_mallocz_array(h->mb_width * h->mb_height, - 4 * sizeof(cavs_vector)); + h->col_mv = av_calloc(h->mb_width * h->mb_height, + 4 * sizeof(*h->col_mv)); h->col_type_base = av_mallocz(h->mb_width * h->mb_height); h->block = av_mallocz(64 * sizeof(int16_t)); diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 66e1695ec9..008a6360b6 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -290,13 +290,13 @@ static int alloc_buffers(AVCodecContext *avctx) if (s->transform_type == 0) { s->plane[i].idwt_size = FFALIGN(height, 8) * stride; s->plane[i].idwt_buf = - av_mallocz_array(s->plane[i].idwt_size, sizeof(*s->plane[i].idwt_buf)); + av_calloc(s->plane[i].idwt_size, sizeof(*s->plane[i].idwt_buf)); s->plane[i].idwt_tmp = av_malloc_array(s->plane[i].idwt_size, sizeof(*s->plane[i].idwt_tmp)); } else { s->plane[i].idwt_size = FFALIGN(height, 8) * stride * 2; s->plane[i].idwt_buf = - av_mallocz_array(s->plane[i].idwt_size, sizeof(*s->plane[i].idwt_buf)); + av_calloc(s->plane[i].idwt_size, sizeof(*s->plane[i].idwt_buf)); s->plane[i].idwt_tmp = av_malloc_array(s->plane[i].idwt_size, sizeof(*s->plane[i].idwt_tmp)); } diff --git a/libavcodec/cfhdenc.c b/libavcodec/cfhdenc.c index 38e4acb4f0..3d87064a40 100644 --- a/libavcodec/cfhdenc.c +++ b/libavcodec/cfhdenc.c @@ -280,7 +280,7 @@ static av_cold int cfhd_encode_init(AVCodecContext *avctx) h2 = h4 * 2; s->plane[i].dwt_buf = - av_mallocz_array(height * stride, sizeof(*s->plane[i].dwt_buf)); + av_calloc(height * stride, sizeof(*s->plane[i].dwt_buf)); s->plane[i].dwt_tmp = av_malloc_array(height * stride, sizeof(*s->plane[i].dwt_tmp)); if (!s->plane[i].dwt_buf || !s->plane[i].dwt_tmp) diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c index 57cb620179..ecfd4abfc9 100644 --- a/libavcodec/cngdec.c +++ b/libavcodec/cngdec.c @@ -61,12 +61,12 @@ static av_cold int cng_decode_init(AVCodecContext *avctx) p->order = 12; avctx->frame_size = 640; - p->refl_coef = av_mallocz_array(p->order, sizeof(*p->refl_coef)); - p->target_refl_coef = av_mallocz_array(p->order, sizeof(*p->target_refl_coef)); - p->lpc_coef = av_mallocz_array(p->order, sizeof(*p->lpc_coef)); - p->filter_out = av_mallocz_array(avctx->frame_size + p->order, + p->refl_coef = av_calloc(p->order, sizeof(*p->refl_coef)); + p->target_refl_coef = av_calloc(p->order, sizeof(*p->target_refl_coef)); + p->lpc_coef = av_calloc(p->order, sizeof(*p->lpc_coef)); + p->filter_out = av_calloc(avctx->frame_size + p->order, sizeof(*p->filter_out)); - p->excitation = av_mallocz_array(avctx->frame_size, sizeof(*p->excitation)); + p->excitation = av_calloc(avctx->frame_size, sizeof(*p->excitation)); if (!p->refl_coef || !p->target_refl_coef || !p->lpc_coef || !p->filter_out || !p->excitation) { return AVERROR(ENOMEM); diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 023dd3c0b2..294c040716 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1370,9 +1370,9 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) frame->linesize[0] = pool->linesize[0]; if (planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz_array(planes, sizeof(*frame->extended_data)); + frame->extended_data = av_calloc(planes, sizeof(*frame->extended_data)); frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS; - frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, + frame->extended_buf = av_calloc(frame->nb_extended_buf, sizeof(*frame->extended_buf)); if (!frame->extended_data || !frame->extended_buf) { av_freep(&frame->extended_data); diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 1113517880..7ffb8a3496 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -304,7 +304,7 @@ static int alloc_sequence_buffers(DiracContext *s) w = FFALIGN(CALC_PADDING(w, MAX_DWT_LEVELS), 8); /* FIXME: Should this be 16 for SSE??? */ h = top_padding + CALC_PADDING(h, MAX_DWT_LEVELS) + max_yblen/2; - s->plane[i].idwt.buf_base = av_mallocz_array((w+max_xblen), h * (2 << s->pshift)); + s->plane[i].idwt.buf_base = av_calloc(w + max_xblen, h * (2 << s->pshift)); s->plane[i].idwt.tmp = av_malloc_array((w+16), 2 << s->pshift); s->plane[i].idwt.buf = s->plane[i].idwt.buf_base + (top_padding*w)*(2 << s->pshift); if (!s->plane[i].idwt.buf_base || !s->plane[i].idwt.tmp) diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index d113c1db7b..9ecd220e7f 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -103,7 +103,7 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx) avctx->coded_width = FFALIGN(avctx->width, 16); avctx->coded_height = FFALIGN(avctx->height, 16); - ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext)); + ctx->rows = av_calloc(avctx->thread_count, sizeof(*ctx->rows)); if (!ctx->rows) return AVERROR(ENOMEM); diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index e45c14e878..d192f3251d 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -764,7 +764,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou } if (sub->num_rects > 0) { - sub->rects = av_mallocz_array(sizeof(*sub->rects), sub->num_rects); + sub->rects = av_calloc(sub->num_rects, sizeof(*sub->rects)); if (!sub->rects) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index b57ea21941..568d686f39 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -515,7 +515,7 @@ static int d3d11va_create_decoder(AVCodecContext *avctx) if (ret < 0) return AVERROR(EINVAL); - sctx->d3d11_views = av_mallocz_array(texdesc.ArraySize, sizeof(sctx->d3d11_views[0])); + sctx->d3d11_views = av_calloc(texdesc.ArraySize, sizeof(sctx->d3d11_views[0])); if (!sctx->d3d11_views) return AVERROR(ENOMEM); sctx->nb_d3d11_views = texdesc.ArraySize; diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 66b7e258ee..0d5b3467d1 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -2253,7 +2253,7 @@ static av_cold int decode_init(AVCodecContext *avctx) } // allocate thread data, used for non EXR_RAW compression types - s->thread_data = av_mallocz_array(avctx->thread_count, sizeof(EXRThreadData)); + s->thread_data = av_calloc(avctx->thread_count, sizeof(*s->thread_data)); if (!s->thread_data) return AVERROR(ENOMEM); diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 1c580c3b49..a27eca5ae3 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -80,7 +80,7 @@ av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) return AVERROR(ENOMEM); } else { if (!p->vlc_state) { - p->vlc_state = av_mallocz_array(p->context_count, sizeof(VlcState)); + p->vlc_state = av_calloc(p->context_count, sizeof(*p->vlc_state)); if (!p->vlc_state) return AVERROR(ENOMEM); for (i = 0; i < p->context_count; i++) { diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 66f4557f06..c9e8d11ab8 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -1164,7 +1164,7 @@ static int g2m_init_buffers(G2MContext *c) c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3; aligned_height = c->height + 15; av_free(c->framebuf); - c->framebuf = av_mallocz_array(c->framebuf_stride, aligned_height); + c->framebuf = av_calloc(c->framebuf_stride, aligned_height); if (!c->framebuf) return AVERROR(ENOMEM); } diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index c7e8b2827b..5ca41cc91c 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -314,7 +314,7 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) ff_h264_sei_uninit(&h->sei); h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ? avctx->thread_count : 1; - h->slice_ctx = av_mallocz_array(h->nb_slice_ctx, sizeof(*h->slice_ctx)); + h->slice_ctx = av_calloc(h->nb_slice_ctx, sizeof(*h->slice_ctx)); if (!h->slice_ctx) { h->nb_slice_ctx = 0; return AVERROR(ENOMEM); diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index eafb883429..57a61752a3 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -99,8 +99,8 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) s->bs_width = (width >> 2) + 1; s->bs_height = (height >> 2) + 1; - s->sao = av_mallocz_array(ctb_count, sizeof(*s->sao)); - s->deblock = av_mallocz_array(ctb_count, sizeof(*s->deblock)); + s->sao = av_calloc(ctb_count, sizeof(*s->sao)); + s->deblock = av_calloc(ctb_count, sizeof(*s->deblock)); if (!s->sao || !s->deblock) goto fail; @@ -123,8 +123,8 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) if (!s->qp_y_tab || !s->filter_slice_edges || !s->tab_slice_address) goto fail; - s->horizontal_bs = av_mallocz_array(s->bs_width, s->bs_height); - s->vertical_bs = av_mallocz_array(s->bs_width, s->bs_height); + s->horizontal_bs = av_calloc(s->bs_width, s->bs_height); + s->vertical_bs = av_calloc(s->bs_width, s->bs_height); if (!s->horizontal_bs || !s->vertical_bs) goto fail; diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c index cefaf77bfd..77979d04e7 100644 --- a/libavcodec/ivi.c +++ b/libavcodec/ivi.c @@ -313,7 +313,7 @@ av_cold int ff_ivi_init_planes(AVCodecContext *avctx, IVIPlaneDesc *planes, cons planes[1].num_bands = planes[2].num_bands = cfg->chroma_bands; for (p = 0; p < 3; p++) { - planes[p].bands = av_mallocz_array(planes[p].num_bands, sizeof(IVIBandDesc)); + planes[p].bands = av_calloc(planes[p].num_bands, sizeof(*planes[p].bands)); if (!planes[p].bands) return AVERROR(ENOMEM); @@ -372,7 +372,7 @@ static int ivi_init_tiles(const IVIBandDesc *band, IVITile *ref_tile, band->mb_size); av_freep(&tile->mbs); - tile->mbs = av_mallocz_array(tile->num_MBs, sizeof(IVIMbInfo)); + tile->mbs = av_calloc(tile->num_MBs, sizeof(*tile->mbs)); if (!tile->mbs) return AVERROR(ENOMEM); @@ -428,7 +428,7 @@ av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, band->num_tiles = x_tiles * y_tiles; av_freep(&band->tiles); - band->tiles = av_mallocz_array(band->num_tiles, sizeof(IVITile)); + band->tiles = av_calloc(band->num_tiles, sizeof(*band->tiles)); if (!band->tiles) { band->num_tiles = 0; return AVERROR(ENOMEM); diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index 83f7d6efbf..7ebd6856e0 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -468,11 +468,11 @@ static int init_tiles(Jpeg2000EncoderContext *s) for (tilex = 0; tilex < s->numXtiles; tilex++, tileno++){ Jpeg2000Tile *tile = s->tile + tileno; - tile->comp = av_mallocz_array(s->ncomponents, sizeof(Jpeg2000Component)); + tile->comp = av_calloc(s->ncomponents, sizeof(*tile->comp)); if (!tile->comp) return AVERROR(ENOMEM); - tile->layer_rates = av_mallocz_array(s->nlayers, sizeof(*tile->layer_rates)); + tile->layer_rates = av_calloc(s->nlayers, sizeof(*tile->layer_rates)); if (!tile->layer_rates) return AVERROR(ENOMEM); diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 2fbdb64280..0aa984bc53 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -60,7 +60,7 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h) tt_size = tag_tree_size(w, h); - t = res = av_mallocz_array(tt_size, sizeof(*t)); + t = res = av_calloc(tt_size, sizeof(*t)); if (!res) return NULL; @@ -333,7 +333,7 @@ static int init_prec(AVCodecContext *avctx, return AVERROR(ENOMEM); } nb_codeblocks = prec->nb_codeblocks_width * prec->nb_codeblocks_height; - prec->cblk = av_mallocz_array(nb_codeblocks, sizeof(*prec->cblk)); + prec->cblk = av_calloc(nb_codeblocks, sizeof(*prec->cblk)); if (!prec->cblk) return AVERROR(ENOMEM); for (cblkno = 0; cblkno < nb_codeblocks; cblkno++) { @@ -376,7 +376,7 @@ static int init_prec(AVCodecContext *avctx, cblk->length = 0; cblk->npasses = 0; if (av_codec_is_encoder(avctx->codec)) { - cblk->layers = av_mallocz_array(codsty->nlayers, sizeof(*cblk->layers)); + cblk->layers = av_calloc(codsty->nlayers, sizeof(*cblk->layers)); if (!cblk->layers) return AVERROR(ENOMEM); } @@ -448,7 +448,7 @@ static int init_band(AVCodecContext *avctx, return AVERROR(ENOMEM); } nb_precincts = reslevel->num_precincts_x * reslevel->num_precincts_y; - band->prec = av_mallocz_array(nb_precincts, sizeof(*band->prec)); + band->prec = av_calloc(nb_precincts, sizeof(*band->prec)); if (!band->prec) return AVERROR(ENOMEM); @@ -496,17 +496,17 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, if (codsty->transform == FF_DWT97) { csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data); comp->i_data = NULL; - comp->f_data = av_mallocz_array(csize, sizeof(*comp->f_data)); + comp->f_data = av_calloc(csize, sizeof(*comp->f_data)); if (!comp->f_data) return AVERROR(ENOMEM); } else { csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->i_data); comp->f_data = NULL; - comp->i_data = av_mallocz_array(csize, sizeof(*comp->i_data)); + comp->i_data = av_calloc(csize, sizeof(*comp->i_data)); if (!comp->i_data) return AVERROR(ENOMEM); } - comp->reslevel = av_mallocz_array(codsty->nreslevels, sizeof(*comp->reslevel)); + comp->reslevel = av_calloc(codsty->nreslevels, sizeof(*comp->reslevel)); if (!comp->reslevel) return AVERROR(ENOMEM); /* LOOP on resolution levels */ @@ -554,7 +554,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, reslevel->log2_prec_height) - (reslevel->coord[1][0] >> reslevel->log2_prec_height); - reslevel->band = av_mallocz_array(reslevel->nbands, sizeof(*reslevel->band)); + reslevel->band = av_calloc(reslevel->nbands, sizeof(*reslevel->band)); if (!reslevel->band) return AVERROR(ENOMEM); diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index c95f22bc90..80b2e2d627 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -361,7 +361,7 @@ static int get_siz(Jpeg2000DecoderContext *s) return AVERROR(EINVAL); } - s->tile = av_mallocz_array(s->numXtiles * s->numYtiles, sizeof(*s->tile)); + s->tile = av_calloc(s->numXtiles * s->numYtiles, sizeof(*s->tile)); if (!s->tile) { s->numXtiles = s->numYtiles = 0; return AVERROR(ENOMEM); @@ -1176,7 +1176,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, cblk->nb_lengthinc = 0; cblk->nb_terminationsinc = 0; av_free(cblk->lengthinc); - cblk->lengthinc = av_mallocz_array(newpasses , sizeof(*cblk->lengthinc)); + cblk->lengthinc = av_calloc(newpasses, sizeof(*cblk->lengthinc)); if (!cblk->lengthinc) return AVERROR(ENOMEM); tmp = av_realloc_array(cblk->data_start, cblk->nb_terminations + newpasses + 1, sizeof(*cblk->data_start)); diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index f2cbc6eeb1..2df1c5090f 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -249,7 +249,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (frame) { if (frame->nb_samples < avctx->frame_size) { - flush_buf = av_mallocz_array(avctx->frame_size, sizeof(*flush_buf)); + flush_buf = av_calloc(avctx->frame_size, sizeof(*flush_buf)); if (!flush_buf) return AVERROR(ENOMEM); memcpy(flush_buf, samples, frame->nb_samples * sizeof(*flush_buf)); @@ -264,7 +264,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } else { if (s->enc_last_frame < 0) return 0; - flush_buf = av_mallocz_array(avctx->frame_size, sizeof(*flush_buf)); + flush_buf = av_calloc(avctx->frame_size, sizeof(*flush_buf)); if (!flush_buf) return AVERROR(ENOMEM); samples = flush_buf; diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index 82002ac346..45b23fcbb5 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -409,7 +409,7 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx) } avctx->extradata_size = header_size; - opus->samples = av_mallocz_array(frame_size, avctx->channels * + opus->samples = av_calloc(frame_size, avctx->channels * av_get_bytes_per_sample(avctx->sample_fmt)); if (!opus->samples) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate samples buffer.\n"); diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index f66345e998..10e5a22fa9 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1492,7 +1492,7 @@ static int set_roi_map(AVCodecContext *avctx, const AVFrameSideData *sd, int fra roi_map->rows = (frame_height + block_size - 1) / block_size; roi_map->cols = (frame_width + block_size - 1) / block_size; - roi_map->roi_map = av_mallocz_array(roi_map->rows * roi_map->cols, sizeof(*roi_map->roi_map)); + roi_map->roi_map = av_calloc(roi_map->rows * roi_map->cols, sizeof(*roi_map->roi_map)); if (!roi_map->roi_map) { av_log(avctx, AV_LOG_ERROR, "roi_map alloc failed.\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 379c167e6f..0f886713e3 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -397,7 +397,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, } nb_rois = sd->size / roi_size; - qoffsets = av_mallocz_array(mbx * mby, sizeof(*qoffsets)); + qoffsets = av_calloc(mbx * mby, sizeof(*qoffsets)); if (!qoffsets) return AVERROR(ENOMEM); diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 839b6ce9de..7dd70a3450 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -460,7 +460,7 @@ static av_cold int libx265_encode_set_roi(libx265Context *ctx, const AVFrame *fr } nb_rois = sd->size / roi_size; - qoffsets = av_mallocz_array(mbx * mby, sizeof(*qoffsets)); + qoffsets = av_calloc(mbx * mby, sizeof(*qoffsets)); if (!qoffsets) return AVERROR(ENOMEM); diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index 15bb8e5c1c..20b3b0f804 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -347,7 +347,7 @@ static av_cold int XAVS_init(AVCodecContext *avctx) if (!x4->enc) return AVERROR_EXTERNAL; - if (!(x4->pts_buffer = av_mallocz_array((avctx->max_b_frames+1), sizeof(*x4->pts_buffer)))) + if (!FF_ALLOCZ_TYPED_ARRAY(x4->pts_buffer, avctx->max_b_frames + 1)) return AVERROR(ENOMEM); /* TAG: Do we have GLOBAL HEADER in AVS */ diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 2a5868fe1d..69f6b08ed6 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -761,8 +761,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) int size = bw * bh * s->h_count[i] * s->v_count[i]; av_freep(&s->blocks[i]); av_freep(&s->last_nnz[i]); - s->blocks[i] = av_mallocz_array(size, sizeof(**s->blocks)); - s->last_nnz[i] = av_mallocz_array(size, sizeof(**s->last_nnz)); + s->blocks[i] = av_calloc(size, sizeof(**s->blocks)); + s->last_nnz[i] = av_calloc(size, sizeof(**s->last_nnz)); if (!s->blocks[i] || !s->last_nnz[i]) return AVERROR(ENOMEM); s->block_stride[i] = bw * s->h_count[i]; diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c index ebce796ba5..dbeb7dcad9 100644 --- a/libavcodec/mlz.c +++ b/libavcodec/mlz.c @@ -21,7 +21,7 @@ #include "mlz.h" av_cold void ff_mlz_init_dict(void* context, MLZ *mlz) { - mlz->dict = av_mallocz_array(TABLE_SIZE, sizeof(*mlz->dict)); + mlz->dict = av_mallocz(TABLE_SIZE * sizeof(*mlz->dict)); mlz->flush_code = FLUSH_CODE; mlz->current_dic_index_max = DIC_INDEX_INIT; diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 1896330fe1..7ac9634538 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -80,10 +80,10 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) mp->avctx = avctx; ff_bswapdsp_init(&mp->bdsp); - mp->changes_map = av_mallocz_array(avctx->width, h4); + mp->changes_map = av_calloc(avctx->width, h4); mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1; - mp->vpt = av_mallocz_array(avctx->height, sizeof(YuvPixel)); - mp->hpt = av_mallocz_array(h4 / 4, w4 / 4 * sizeof(YuvPixel)); + mp->vpt = av_calloc(avctx->height, sizeof(*mp->vpt)); + mp->hpt = av_calloc(h4 / 4, w4 / 4 * sizeof(*mp->hpt)); if (!mp->changes_map || !mp->vpt || !mp->hpt) return AVERROR(ENOMEM); avctx->pix_fmt = AV_PIX_FMT_RGB555; diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index ae25afd7f8..edc46ed33a 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1578,7 +1578,7 @@ static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx) NvencContext *ctx = avctx->priv_data; int i, res = 0, res2; - ctx->surfaces = av_mallocz_array(ctx->nb_surfaces, sizeof(*ctx->surfaces)); + ctx->surfaces = av_calloc(ctx->nb_surfaces, sizeof(*ctx->surfaces)); if (!ctx->surfaces) return AVERROR(ENOMEM); diff --git a/libavcodec/omx.c b/libavcodec/omx.c index 4078ac84a4..cec0d04b8a 100644 --- a/libavcodec/omx.c +++ b/libavcodec/omx.c @@ -360,7 +360,7 @@ static av_cold int find_component(OMXContext *omx_context, void *logctx, av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role); return AVERROR_ENCODER_NOT_FOUND; } - components = av_mallocz_array(num, sizeof(*components)); + components = av_calloc(num, sizeof(*components)); if (!components) return AVERROR(ENOMEM); for (i = 0; i < num; i++) { diff --git a/libavcodec/opus.c b/libavcodec/opus.c index 5ca6ca92f3..df8ba93fa9 100644 --- a/libavcodec/opus.c +++ b/libavcodec/opus.c @@ -400,7 +400,7 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx, return AVERROR_PATCHWELCOME; } - s->channel_maps = av_mallocz_array(channels, sizeof(*s->channel_maps)); + s->channel_maps = av_calloc(channels, sizeof(*s->channel_maps)); if (!s->channel_maps) return AVERROR(ENOMEM); diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c index 3ebf199219..b063e0efeb 100644 --- a/libavcodec/opusdec.c +++ b/libavcodec/opusdec.c @@ -634,7 +634,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx) return ret; /* allocate and init each independent decoder */ - c->streams = av_mallocz_array(c->nb_streams, sizeof(*c->streams)); + c->streams = av_calloc(c->nb_streams, sizeof(*c->streams)); if (!c->streams) { c->nb_streams = 0; return AVERROR(ENOMEM); diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 55eda4c2a9..388639a110 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -518,7 +518,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data, // Blank if last object_count was 0. if (!ctx->presentation.object_count) return 1; - sub->rects = av_mallocz_array(ctx->presentation.object_count, sizeof(*sub->rects)); + sub->rects = av_calloc(ctx->presentation.object_count, sizeof(*sub->rects)); if (!sub->rects) { return AVERROR(ENOMEM); } diff --git a/libavcodec/png.c b/libavcodec/png.c index 4ea286075d..e772eaad26 100644 --- a/libavcodec/png.c +++ b/libavcodec/png.c @@ -40,7 +40,7 @@ static const uint8_t ff_png_pass_xshift[NB_PASSES] = { void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size) { - return av_mallocz_array(items, size); + return av_calloc(items, size); } void ff_png_zfree(void *opaque, void *ptr) diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index fe1f3a28bd..7750620b22 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -340,7 +340,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons if (ctx->slice_count != slice_count || !ctx->slices) { av_freep(&ctx->slices); ctx->slice_count = 0; - ctx->slices = av_mallocz_array(slice_count, sizeof(*ctx->slices)); + ctx->slices = av_calloc(slice_count, sizeof(*ctx->slices)); if (!ctx->slices) return AVERROR(ENOMEM); ctx->slice_count = slice_count; diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c index 2b5f111fbe..93c8408297 100644 --- a/libavcodec/psymodel.c +++ b/libavcodec/psymodel.c @@ -35,8 +35,8 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, int i, j, k = 0; ctx->avctx = avctx; - ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2); - ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups); + ctx->ch = av_calloc(avctx->channels, 2 * sizeof(ctx->ch[0])); + ctx->group = av_calloc(num_groups, sizeof(ctx->group[0])); ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens); ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens); ctx->cutoff = avctx->cutoff; @@ -120,7 +120,7 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { - ctx->fstate = av_mallocz_array(sizeof(ctx->fstate[0]), avctx->channels); + ctx->fstate = av_calloc(avctx->channels, sizeof(ctx->fstate[0])); if (!ctx->fstate) { av_free(ctx->fcoeffs); av_free(ctx); diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 9c5d66c0d4..73b1b7d7d9 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -878,7 +878,7 @@ int ff_frame_thread_init(AVCodecContext *avctx) if (codec->type == AVMEDIA_TYPE_VIDEO) avctx->delay = src->thread_count - 1; - fctx->threads = av_mallocz_array(thread_count, sizeof(PerThreadContext)); + fctx->threads = av_calloc(thread_count, sizeof(*fctx->threads)); if (!fctx->threads) { err = AVERROR(ENOMEM); goto error; diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c index 80c4579fc0..86411b21be 100644 --- a/libavcodec/pthread_slice.c +++ b/libavcodec/pthread_slice.c @@ -211,7 +211,7 @@ int ff_alloc_entries(AVCodecContext *avctx, int count) } p->thread_count = avctx->thread_count; - p->entries = av_mallocz_array(count, sizeof(int)); + p->entries = av_calloc(count, sizeof(*p->entries)); if (!p->progress_mutex) { p->progress_mutex = av_malloc_array(p->thread_count, sizeof(pthread_mutex_t)); diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 2f332092a1..9d08485c92 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -452,7 +452,7 @@ static AVBufferRef *qsv_create_mids(AVBufferRef *hw_frames_ref) if (!hw_frames_ref1) return NULL; - mids = av_mallocz_array(nb_surfaces, sizeof(*mids)); + mids = av_calloc(nb_surfaces, sizeof(*mids)); if (!mids) { av_buffer_unref(&hw_frames_ref1); return NULL; @@ -487,7 +487,7 @@ static int qsv_setup_mids(mfxFrameAllocResponse *resp, AVBufferRef *hw_frames_re // the allocated size of the array is two larger than the number of // surfaces, we store the references to the frames context and the // QSVMid array there - resp->mids = av_mallocz_array(nb_surfaces + 2, sizeof(*resp->mids)); + resp->mids = av_calloc(nb_surfaces + 2, sizeof(*resp->mids)); if (!resp->mids) return AVERROR(ENOMEM); diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 090fdbe75e..f7bb3f5eff 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1181,8 +1181,8 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) AVQSVContext *qsv = avctx->hwaccel_context; int i, j; - q->extparam = av_mallocz_array(qsv->nb_ext_buffers + q->nb_extparam_internal, - sizeof(*q->extparam)); + q->extparam = av_calloc(qsv->nb_ext_buffers + q->nb_extparam_internal, + sizeof(*q->extparam)); if (!q->extparam) return AVERROR(ENOMEM); diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c index 4089157d47..fd131995b3 100644 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@ -111,7 +111,7 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx) s->rlecode_table = av_mallocz(s->logical_width); s->skip_table = av_mallocz(s->logical_width); - s->length_table = av_mallocz_array(s->logical_width + 1, sizeof(int)); + s->length_table = av_calloc(s->logical_width + 1, sizeof(*s->length_table)); if (!s->skip_table || !s->length_table || !s->rlecode_table) { av_log(avctx, AV_LOG_ERROR, "Error allocating memory.\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index f8e363ada7..3eac96f25e 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -1003,13 +1003,13 @@ static av_cold int roq_encode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); enc->this_motion4 = - av_mallocz_array(roq->width * roq->height / 16, sizeof(motion_vect)); + av_calloc(roq->width * roq->height / 16, sizeof(*enc->this_motion4)); enc->last_motion4 = av_malloc_array (roq->width * roq->height / 16, sizeof(motion_vect)); enc->this_motion8 = - av_mallocz_array(roq->width * roq->height / 64, sizeof(motion_vect)); + av_calloc(roq->width * roq->height / 64, sizeof(*enc->this_motion8)); enc->last_motion8 = av_malloc_array (roq->width * roq->height / 64, sizeof(motion_vect)); diff --git a/libavcodec/snow.c b/libavcodec/snow.c index a037e36873..e0fb58042c 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -116,7 +116,7 @@ int ff_snow_alloc_blocks(SnowContext *s){ s->b_height= h; av_free(s->block); - s->block= av_mallocz_array(w * h, sizeof(BlockNode) << (s->block_max_depth*2)); + s->block = av_calloc(w * h, sizeof(*s->block) << (s->block_max_depth*2)); if (!s->block) return AVERROR(ENOMEM); @@ -567,7 +567,8 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { b->parent= &s->plane[plane_index].band[level-1][orientation]; //FIXME avoid this realloc av_freep(&b->x_coeff); - b->x_coeff=av_mallocz_array(((b->width+1) * b->height+1), sizeof(x_and_coeff)); + b->x_coeff = av_calloc((b->width + 1) * b->height + 1, + sizeof(*b->x_coeff)); if (!b->x_coeff) return AVERROR(ENOMEM); } diff --git a/libavcodec/snow_dwt.c b/libavcodec/snow_dwt.c index 3dca3c6d30..c093ebff07 100644 --- a/libavcodec/snow_dwt.c +++ b/libavcodec/snow_dwt.c @@ -35,7 +35,7 @@ int ff_slice_buffer_init(slice_buffer *buf, int line_count, buf->line_count = line_count; buf->line_width = line_width; buf->data_count = max_allocated_lines; - buf->line = av_mallocz_array(line_count, sizeof(IDWTELEM *)); + buf->line = av_calloc(line_count, sizeof(*buf->line)); if (!buf->line) return AVERROR(ENOMEM); buf->data_stack = av_malloc_array(max_allocated_lines, sizeof(IDWTELEM *)); diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index d2c0beb1aa..55ebfba50f 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -79,7 +79,7 @@ static av_cold int encode_init(AVCodecContext *avctx) s->m.mb_num = (avctx->width * avctx->height + 255) / 256; // For ratecontrol s->m.me.temp = - s->m.me.scratchpad= av_mallocz_array((avctx->width+64), 2*16*2*sizeof(uint8_t)); + s->m.me.scratchpad = av_calloc(avctx->width + 64, 2*16*2*sizeof(uint8_t)); s->m.me.map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t)); s->m.me.score_map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t)); s->m.sc.obmc_scratchpad= av_mallocz(MB_SIZE*MB_SIZE*12*sizeof(uint32_t)); @@ -145,8 +145,8 @@ static av_cold int encode_init(AVCodecContext *avctx) if(s->motion_est == FF_ME_ITER){ int size= s->b_width * s->b_height << 2*s->block_max_depth; for(i=0; imax_ref_frames; i++){ - s->ref_mvs[i]= av_mallocz_array(size, sizeof(int16_t[2])); - s->ref_scores[i]= av_mallocz_array(size, sizeof(uint32_t)); + s->ref_mvs[i] = av_calloc(size, sizeof(*s->ref_mvs[i])); + s->ref_scores[i] = av_calloc(size, sizeof(*s->ref_scores[i])); if (!s->ref_mvs[i] || !s->ref_scores[i]) return AVERROR(ENOMEM); } diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index b2c8215002..e329578af0 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -1364,7 +1364,7 @@ static int get_buffer(AVCodecContext *avctx, SVQ3Frame *pic) goto fail; if (!s->edge_emu_buffer) { - s->edge_emu_buffer = av_mallocz_array(pic->f->linesize[0], 17); + s->edge_emu_buffer = av_calloc(pic->f->linesize[0], 17); if (!s->edge_emu_buffer) return AVERROR(ENOMEM); } diff --git a/libavcodec/tests/snowenc.c b/libavcodec/tests/snowenc.c index d5f94e8a61..07af1f2cf9 100644 --- a/libavcodec/tests/snowenc.c +++ b/libavcodec/tests/snowenc.c @@ -37,8 +37,8 @@ int main(void){ s.spatial_decomposition_count=6; s.spatial_decomposition_type=1; - s.temp_dwt_buffer = av_mallocz_array(width, sizeof(DWTELEM)); - s.temp_idwt_buffer = av_mallocz_array(width, sizeof(IDWTELEM)); + s.temp_dwt_buffer = av_calloc(width, sizeof(*s.temp_dwt_buffer)); + s.temp_idwt_buffer = av_calloc(width, sizeof(*s.temp_idwt_buffer)); if (!s.temp_dwt_buffer || !s.temp_idwt_buffer) { fprintf(stderr, "Failed to allocate memory\n"); diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 8566f7ba74..870e0666aa 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1588,7 +1588,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) s->geotag_count = 0; return -1; } - s->geotags = av_mallocz_array(s->geotag_count, sizeof(TiffGeoTag)); + s->geotags = av_calloc(s->geotag_count, sizeof(*s->geotags)); if (!s->geotags) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); s->geotag_count = 0; diff --git a/libavcodec/tta.c b/libavcodec/tta.c index d9ff45fad6..17b4ca9032 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -107,7 +107,8 @@ static int allocate_buffers(AVCodecContext *avctx) TTAContext *s = avctx->priv_data; if (s->bps < 3) { - s->decode_buffer = av_mallocz_array(sizeof(int32_t)*s->frame_length, s->channels); + s->decode_buffer = av_calloc(s->frame_length, + sizeof(*s->decode_buffer) * s->channels); if (!s->decode_buffer) return AVERROR(ENOMEM); } else diff --git a/libavcodec/utils.c b/libavcodec/utils.c index cfc07cbcb8..387d285633 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -379,8 +379,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, planar = av_sample_fmt_is_planar(sample_fmt); if (planar && nb_channels > AV_NUM_DATA_POINTERS) { - if (!(frame->extended_data = av_mallocz_array(nb_channels, - sizeof(*frame->extended_data)))) + if (!FF_ALLOCZ_TYPED_ARRAY(frame->extended_data, nb_channels)) return AVERROR(ENOMEM); } else { frame->extended_data = frame->data; diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 7510816ec1..ec054ae701 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -429,7 +429,7 @@ static int vaapi_encode_issue(AVCodecContext *avctx, if (pic->nb_slices == 0) pic->nb_slices = ctx->nb_slices; if (pic->nb_slices > 0) { - pic->slices = av_mallocz_array(pic->nb_slices, sizeof(*pic->slices)); + pic->slices = av_calloc(pic->nb_slices, sizeof(*pic->slices)); if (!pic->slices) { err = AVERROR(ENOMEM); goto fail; @@ -511,7 +511,7 @@ static int vaapi_encode_issue(AVCodecContext *avctx, nb_roi = ctx->roi_max_regions; } - pic->roi = av_mallocz_array(nb_roi, sizeof(*pic->roi)); + pic->roi = av_calloc(nb_roi, sizeof(*pic->roi)); if (!pic->roi) { err = AVERROR(ENOMEM); goto fail; diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index dac2b6841c..6e07bc5a8a 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -379,7 +379,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) // Weed out unused vlcs and build codevector vector if (used_entries) { codebook_setup->codevectors = - av_mallocz_array(used_entries, codebook_setup->dimensions * + av_calloc(used_entries, codebook_setup->dimensions * sizeof(*codebook_setup->codevectors)); if (!codebook_setup->codevectors) { ret = AVERROR(ENOMEM); @@ -567,7 +567,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) for (j = 0; j < floor_setup->data.t1.partitions; ++j) floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; - floor_setup->data.t1.list = av_mallocz_array(floor_setup->data.t1.x_list_dim, + floor_setup->data.t1.list = av_calloc(floor_setup->data.t1.x_list_dim, sizeof(*floor_setup->data.t1.list)); if (!floor_setup->data.t1.list) return AVERROR(ENOMEM); @@ -823,7 +823,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) } if (mapping_setup->submaps>1) { - mapping_setup->mux = av_mallocz_array(vc->audio_channels, + mapping_setup->mux = av_calloc(vc->audio_channels, sizeof(*mapping_setup->mux)); if (!mapping_setup->mux) return AVERROR(ENOMEM); @@ -1000,7 +1000,7 @@ static int vorbis_parse_id_hdr(vorbis_context *vc) } vc->channel_residues = av_malloc_array(vc->blocksize[1] / 2, vc->audio_channels * sizeof(*vc->channel_residues)); - vc->saved = av_mallocz_array(vc->blocksize[1] / 4, vc->audio_channels * sizeof(*vc->saved)); + vc->saved = av_calloc(vc->blocksize[1] / 4, vc->audio_channels * sizeof(*vc->saved)); if (!vc->channel_residues || !vc->saved) return AVERROR(ENOMEM); diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c index 72c6ba1130..858c6ac6dd 100644 --- a/libavcodec/vorbisenc.c +++ b/libavcodec/vorbisenc.c @@ -182,7 +182,7 @@ static int ready_codebook(vorbis_enc_codebook *cb) } else { int vals = cb_lookup_vals(cb->lookup, cb->ndimensions, cb->nentries); cb->dimensions = av_malloc_array(cb->nentries, sizeof(float) * cb->ndimensions); - cb->pow2 = av_mallocz_array(cb->nentries, sizeof(float)); + cb->pow2 = av_calloc(cb->nentries, sizeof(*cb->pow2)); if (!cb->dimensions || !cb->pow2) return AVERROR(ENOMEM); for (i = 0; i < cb->nentries; i++) { @@ -212,7 +212,7 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc) { int i; av_assert0(rc->type == 2); - rc->maxes = av_mallocz_array(rc->classifications, sizeof(float[2])); + rc->maxes = av_calloc(rc->classifications, sizeof(*rc->maxes)); if (!rc->maxes) return AVERROR(ENOMEM); for (i = 0; i < rc->classifications; i++) { diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 166c1bf60d..16726080b3 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2277,19 +2277,19 @@ static av_cold int allocate_tables(AVCodecContext *avctx) /* superblock_coding is used by unpack_superblocks (VP3/Theora) and vp4_unpack_macroblocks (VP4) */ s->superblock_coding = av_mallocz(FFMAX(s->superblock_count, s->yuv_macroblock_count)); - s->all_fragments = av_mallocz_array(s->fragment_count, sizeof(Vp3Fragment)); + s->all_fragments = av_calloc(s->fragment_count, sizeof(*s->all_fragments)); - s-> kf_coded_fragment_list = av_mallocz_array(s->fragment_count, sizeof(int)); - s->nkf_coded_fragment_list = av_mallocz_array(s->fragment_count, sizeof(int)); + s-> kf_coded_fragment_list = av_calloc(s->fragment_count, sizeof(int)); + s->nkf_coded_fragment_list = av_calloc(s->fragment_count, sizeof(int)); memset(s-> num_kf_coded_fragment, -1, sizeof(s-> num_kf_coded_fragment)); - s->dct_tokens_base = av_mallocz_array(s->fragment_count, - 64 * sizeof(*s->dct_tokens_base)); - s->motion_val[0] = av_mallocz_array(y_fragment_count, sizeof(*s->motion_val[0])); - s->motion_val[1] = av_mallocz_array(c_fragment_count, sizeof(*s->motion_val[1])); + s->dct_tokens_base = av_calloc(s->fragment_count, + 64 * sizeof(*s->dct_tokens_base)); + s->motion_val[0] = av_calloc(y_fragment_count, sizeof(*s->motion_val[0])); + s->motion_val[1] = av_calloc(c_fragment_count, sizeof(*s->motion_val[1])); /* work out the block mapping tables */ - s->superblock_fragments = av_mallocz_array(s->superblock_count, 16 * sizeof(int)); + s->superblock_fragments = av_calloc(s->superblock_count, 16 * sizeof(int)); s->macroblock_coding = av_mallocz(s->macroblock_count + 1); s->dc_pred_row = av_malloc_array(s->y_superblock_width * 4, sizeof(*s->dc_pred_row)); diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index c1b58d4752..8317ac6bd8 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -793,7 +793,7 @@ static int decode_frame_header(AVCodecContext *avctx, } else { n_range_coders = s->s.h.tiling.tile_cols; } - s->td = av_mallocz_array(s->active_tile_cols, sizeof(VP9TileData) + + s->td = av_calloc(s->active_tile_cols, sizeof(VP9TileData) + n_range_coders * sizeof(VP56RangeCoder)); if (!s->td) return AVERROR(ENOMEM); diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 3efd4438d9..8b19ba4e64 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -581,8 +581,8 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, img->color_cache_bits); return AVERROR_INVALIDDATA; } - img->color_cache = av_mallocz_array(1 << img->color_cache_bits, - sizeof(*img->color_cache)); + img->color_cache = av_calloc(1 << img->color_cache_bits, + sizeof(*img->color_cache)); if (!img->color_cache) return AVERROR(ENOMEM); } else { @@ -596,9 +596,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, return ret; img->nb_huffman_groups = s->nb_huffman_groups; } - img->huffman_groups = av_mallocz_array(img->nb_huffman_groups * - HUFFMAN_CODES_PER_META_CODE, - sizeof(*img->huffman_groups)); + img->huffman_groups = av_calloc(img->nb_huffman_groups, + HUFFMAN_CODES_PER_META_CODE * + sizeof(*img->huffman_groups)); if (!img->huffman_groups) return AVERROR(ENOMEM); diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 41212d922a..92557713c4 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -257,7 +257,7 @@ static int config_output(AVFilterLink *outlink) if (!s->frame_list) return AVERROR(ENOMEM); - s->fifos = av_mallocz_array(s->nb_inputs, sizeof(*s->fifos)); + s->fifos = av_calloc(s->nb_inputs, sizeof(*s->fifos)); if (!s->fifos) return AVERROR(ENOMEM); @@ -274,8 +274,8 @@ static int config_output(AVFilterLink *outlink) memset(s->input_state, INPUT_ON, s->nb_inputs); s->active_inputs = s->nb_inputs; - s->input_scale = av_mallocz_array(s->nb_inputs, sizeof(*s->input_scale)); - s->scale_norm = av_mallocz_array(s->nb_inputs, sizeof(*s->scale_norm)); + s->input_scale = av_calloc(s->nb_inputs, sizeof(*s->input_scale)); + s->scale_norm = av_calloc(s->nb_inputs, sizeof(*s->scale_norm)); if (!s->input_scale || !s->scale_norm) return AVERROR(ENOMEM); for (i = 0; i < s->nb_inputs; i++) @@ -561,7 +561,7 @@ static av_cold int init(AVFilterContext *ctx) if (!s->fdsp) return AVERROR(ENOMEM); - s->weights = av_mallocz_array(s->nb_inputs, sizeof(*s->weights)); + s->weights = av_calloc(s->nb_inputs, sizeof(*s->weights)); if (!s->weights) return AVERROR(ENOMEM); diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index c1eac79c98..f5a57539fe 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -310,7 +310,7 @@ static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf) if (nch_out > nch_in) { if (nch_out > FF_ARRAY_ELEMS(buf->data)) { uint8_t **new_extended_data = - av_mallocz_array(nch_out, sizeof(*buf->extended_data)); + av_calloc(nch_out, sizeof(*buf->extended_data)); if (!new_extended_data) { av_frame_free(&buf); return AVERROR(ENOMEM); diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c index 1df28d5590..0172b5f876 100644 --- a/libavfilter/af_compand.c +++ b/libavfilter/af_compand.c @@ -344,9 +344,9 @@ static int config_output(AVFilterLink *outlink) uninit(ctx); - s->channels = av_mallocz_array(channels, sizeof(*s->channels)); + s->channels = av_calloc(channels, sizeof(*s->channels)); s->nb_segments = (nb_points + 4) * 2; - s->segments = av_mallocz_array(s->nb_segments, sizeof(*s->segments)); + s->segments = av_calloc(s->nb_segments, sizeof(*s->segments)); if (!s->channels || !s->segments) { uninit(ctx); diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index c8e58260da..2fe1fc9429 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -172,9 +172,9 @@ static av_cold int join_init(AVFilterContext *ctx) } s->nb_channels = av_get_channel_layout_nb_channels(s->channel_layout); - s->channels = av_mallocz_array(s->nb_channels, sizeof(*s->channels)); - s->buffers = av_mallocz_array(s->nb_channels, sizeof(*s->buffers)); - s->input_frames = av_mallocz_array(s->inputs, sizeof(*s->input_frames)); + s->channels = av_calloc(s->nb_channels, sizeof(*s->channels)); + s->buffers = av_calloc(s->nb_channels, sizeof(*s->buffers)); + s->input_frames = av_calloc(s->inputs, sizeof(*s->input_frames)); if (!s->channels || !s->buffers|| !s->input_frames) return AVERROR(ENOMEM); @@ -283,7 +283,7 @@ static int join_config_output(AVFilterLink *outlink) int i, ret = 0; /* initialize inputs to user-specified mappings */ - if (!(inputs = av_mallocz_array(ctx->nb_inputs, sizeof(*inputs)))) + if (!(inputs = av_calloc(ctx->nb_inputs, sizeof(*inputs)))) return AVERROR(ENOMEM); for (i = 0; i < s->nb_channels; i++) { ChannelMap *ch = &s->channels[i]; @@ -383,7 +383,7 @@ static int try_push_frame(AVFilterContext *ctx) if (!frame) return AVERROR(ENOMEM); if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) { - frame->extended_data = av_mallocz_array(s->nb_channels, + frame->extended_data = av_calloc(s->nb_channels, sizeof(*frame->extended_data)); if (!frame->extended_data) { ret = AVERROR(ENOMEM); @@ -417,8 +417,8 @@ static int try_push_frame(AVFilterContext *ctx) /* create references to the buffers we copied to output */ if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) { frame->nb_extended_buf = nb_buffers - FF_ARRAY_ELEMS(frame->buf); - frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, - sizeof(*frame->extended_buf)); + frame->extended_buf = av_calloc(frame->nb_extended_buf, + sizeof(*frame->extended_buf)); if (!frame->extended_buf) { frame->nb_extended_buf = 0; ret = AVERROR(ENOMEM); diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 93ec5f7171..eb38d2811c 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -169,7 +169,8 @@ static int config_input(AVFilterLink *inlink) s->channels = inlink->channels; s->duration = av_rescale(s->duration, inlink->sample_rate, AV_TIME_BASE); s->independent_channels = s->mono ? s->channels : 1; - s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), s->independent_channels); + s->nb_null_samples = av_calloc(s->independent_channels, + sizeof(*s->nb_null_samples)); if (!s->nb_null_samples) return AVERROR(ENOMEM); s->start = av_malloc_array(sizeof(*s->start), s->independent_channels); diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c index e75ed88729..90180309dd 100644 --- a/libavfilter/avf_showwaves.c +++ b/libavfilter/avf_showwaves.c @@ -427,7 +427,7 @@ static int config_output(AVFilterLink *outlink) showwaves->n = FFMAX(1, av_rescale_q(inlink->sample_rate, av_make_q(1, showwaves->w), showwaves->rate)); showwaves->buf_idx = 0; - if (!(showwaves->buf_idy = av_mallocz_array(nb_channels, sizeof(*showwaves->buf_idy)))) { + if (!FF_ALLOCZ_TYPED_ARRAY(showwaves->buf_idy, nb_channels)) { av_log(ctx, AV_LOG_ERROR, "Could not allocate showwaves buffer\n"); return AVERROR(ENOMEM); } @@ -820,7 +820,7 @@ static int showwavespic_config_input(AVFilterLink *inlink) ShowWavesContext *showwaves = ctx->priv; if (showwaves->single_pic) { - showwaves->sum = av_mallocz_array(inlink->channels, sizeof(*showwaves->sum)); + showwaves->sum = av_calloc(inlink->channels, sizeof(*showwaves->sum)); if (!showwaves->sum) return AVERROR(ENOMEM); } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c614eb0740..6916dbb24c 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -702,7 +702,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) ret->input_pads = av_memdup(filter->inputs, ret->nb_inputs * sizeof(*filter->inputs)); if (!ret->input_pads) goto err; - ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*)); + ret->inputs = av_calloc(ret->nb_inputs, sizeof(*ret->inputs)); if (!ret->inputs) goto err; } @@ -712,7 +712,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) ret->output_pads = av_memdup(filter->outputs, ret->nb_outputs * sizeof(*filter->outputs)); if (!ret->output_pads) goto err; - ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*)); + ret->outputs = av_calloc(ret->nb_outputs, sizeof(*ret->outputs)); if (!ret->outputs) goto err; } diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index c95cad7944..7dd48fb612 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -1006,7 +1006,7 @@ static DNNReturnType fill_model_input_tf(TFModel *tf_model, TFRequestItem *reque goto err; } - infer_request->output_tensors = av_mallocz_array(task->nb_output, sizeof(*infer_request->output_tensors)); + infer_request->output_tensors = av_calloc(task->nb_output, sizeof(*infer_request->output_tensors)); if (!infer_request->output_tensors) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output tensor\n"); goto err; diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c index 3045ce0131..3c7a962b3a 100644 --- a/libavfilter/dnn_filter_common.c +++ b/libavfilter/dnn_filter_common.c @@ -29,7 +29,7 @@ static char **separate_output_names(const char *expr, const char *val_sep, int * return NULL; } - parsed_vals = av_mallocz_array(MAX_SUPPORTED_OUTPUTS_NB, sizeof(*parsed_vals)); + parsed_vals = av_calloc(MAX_SUPPORTED_OUTPUTS_NB, sizeof(*parsed_vals)); if (!parsed_vals) { return NULL; } diff --git a/libavfilter/ebur128.c b/libavfilter/ebur128.c index d93500ef3e..1a85a90360 100644 --- a/libavfilter/ebur128.c +++ b/libavfilter/ebur128.c @@ -232,7 +232,7 @@ FFEBUR128State *ff_ebur128_init(unsigned int channels, CHECK_ERROR(errcode, 0, free_internal) st->d->sample_peak = - (double *) av_mallocz_array(channels, sizeof(*st->d->sample_peak)); + (double *) av_calloc(channels, sizeof(*st->d->sample_peak)); CHECK_ERROR(!st->d->sample_peak, 0, free_channel_map) st->samplerate = samplerate; @@ -253,8 +253,8 @@ FFEBUR128State *ff_ebur128_init(unsigned int channels, - (st->d->audio_data_frames % st->d->samples_in_100ms); } st->d->audio_data = - (double *) av_mallocz_array(st->d->audio_data_frames, - st->channels * sizeof(*st->d->audio_data)); + (double *) av_calloc(st->d->audio_data_frames, + st->channels * sizeof(*st->d->audio_data)); CHECK_ERROR(!st->d->audio_data, 0, free_sample_peak) ebur128_init_filter(st); diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 9123403c40..7c63807df3 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -243,11 +243,11 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) frame->linesize[0] = pool->linesize[0]; if (pool->planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz_array(pool->planes, - sizeof(*frame->extended_data)); + frame->extended_data = av_calloc(pool->planes, + sizeof(*frame->extended_data)); frame->nb_extended_buf = pool->planes - AV_NUM_DATA_POINTERS; - frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, - sizeof(*frame->extended_buf)); + frame->extended_buf = av_calloc(frame->nb_extended_buf, + sizeof(*frame->extended_buf)); if (!frame->extended_data || !frame->extended_buf) goto fail; } else { diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 135d4c4e36..d1218355c7 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -499,8 +499,8 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) s->in_mem_mode = in_frames_hwctx->frame_type; - s->surface_ptrs_in = av_mallocz_array(in_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_in)); + s->surface_ptrs_in = av_calloc(in_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_in)); if (!s->surface_ptrs_in) return AVERROR(ENOMEM); @@ -548,8 +548,8 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) return ret; } - s->surface_ptrs_out = av_mallocz_array(out_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_out)); + s->surface_ptrs_out = av_calloc(out_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_out)); if (!s->surface_ptrs_out) { av_buffer_unref(&out_frames_ref); return AVERROR(ENOMEM); @@ -672,7 +672,7 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p if (ret < 0) goto failed; - s->frame_infos = av_mallocz_array(avctx->nb_inputs, sizeof(*s->frame_infos)); + s->frame_infos = av_calloc(avctx->nb_inputs, sizeof(*s->frame_infos)); if (!s->frame_infos) { ret = AVERROR(ENOMEM); goto failed; @@ -708,7 +708,7 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) { s->nb_ext_buffers = param->num_ext_buf + 1; - s->ext_buffers = av_mallocz_array(s->nb_ext_buffers, sizeof(*s->ext_buffers)); + s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers)); if (!s->ext_buffers) { ret = AVERROR(ENOMEM); goto failed; diff --git a/libavfilter/tests/integral.c b/libavfilter/tests/integral.c index 03b1e77367..6bdf0fd7fa 100644 --- a/libavfilter/tests/integral.c +++ b/libavfilter/tests/integral.c @@ -54,8 +54,8 @@ int main(void) const int ii_lz_32 = ((ii_w + 1) + 3) & ~3; // "+1" is for the space of the top 0-line - uint32_t *ii = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii)); - uint32_t *ii2 = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii2)); + uint32_t *ii = av_calloc(ii_h + 1, ii_lz_32 * sizeof(*ii)); + uint32_t *ii2 = av_calloc(ii_h + 1, ii_lz_32 * sizeof(*ii2)); if (!ii || !ii2) return -1; diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c index 25a17788c3..8c54f7c238 100644 --- a/libavfilter/vf_colorconstancy.c +++ b/libavfilter/vf_colorconstancy.c @@ -116,7 +116,7 @@ static int set_gauss(AVFilterContext *ctx) int i; for (i = 0; i <= difford; ++i) { - s->gauss[i] = av_mallocz_array(filtersize, sizeof(*s->gauss[i])); + s->gauss[i] = av_calloc(filtersize, sizeof(*s->gauss[i])); if (!s->gauss[i]) { for (; i >= 0; --i) { av_freep(&s->gauss[i]); @@ -219,7 +219,8 @@ static int setup_derivative_buffers(AVFilterContext* ctx, ThreadData *td) av_log(ctx, AV_LOG_TRACE, "Allocating %d buffer(s) for grey edge.\n", nb_buff); for (b = 0; b <= nb_buff; ++b) { // We need difford + 1 buffers for (p = 0; p < NUM_PLANES; ++p) { - td->data[b][p] = av_mallocz_array(s->planeheight[p] * s->planewidth[p], sizeof(*td->data[b][p])); + td->data[b][p] = av_calloc(s->planeheight[p] * s->planewidth[p], + sizeof(*td->data[b][p])); if (!td->data[b][p]) { cleanup_derivative_buffers(td, b + 1, p); return AVERROR(ENOMEM); diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m index 5642d0cd28..028cda8291 100644 --- a/libavfilter/vf_coreimage.m +++ b/libavfilter/vf_coreimage.m @@ -494,7 +494,7 @@ static av_cold int init(AVFilterContext *fctx) av_log(ctx, AV_LOG_DEBUG, "Filter count: %i\n", ctx->num_filters); // allocate CIFilter array - ctx->filters = av_mallocz_array(ctx->num_filters, sizeof(CIFilter*)); + ctx->filters = av_calloc(ctx->num_filters, sizeof(CIFilter*)); if (!ctx->filters) { av_log(ctx, AV_LOG_ERROR, "Could not allocate filter array.\n"); return AVERROR(ENOMEM); diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c index 570e8bded2..7d7773419e 100644 --- a/libavfilter/vf_curves.c +++ b/libavfilter/vf_curves.c @@ -666,7 +666,7 @@ static int config_input(AVFilterLink *inlink) for (i = 0; i < NB_COMP + 1; i++) { if (!curves->graph[i]) - curves->graph[i] = av_mallocz_array(curves->lut_size, sizeof(*curves->graph[0])); + curves->graph[i] = av_calloc(curves->lut_size, sizeof(*curves->graph[0])); if (!curves->graph[i]) return AVERROR(ENOMEM); ret = parse_points_str(ctx, comp_points + i, curves->comp_points_str[i], curves->lut_size); diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index 18b9a17760..173c314bb8 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -233,8 +233,8 @@ static int init_out_session(AVFilterContext *ctx) s->ext_buffers[s->num_ext_buffers++] = (mfxExtBuffer *)&s->deint_conf; if (opaque) { - s->surface_ptrs = av_mallocz_array(hw_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs)); + s->surface_ptrs = av_calloc(hw_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs)); if (!s->surface_ptrs) return AVERROR(ENOMEM); for (i = 0; i < hw_frames_hwctx->nb_surfaces; i++) @@ -263,8 +263,8 @@ static int init_out_session(AVFilterContext *ctx) .Free = frame_free, }; - s->mem_ids = av_mallocz_array(hw_frames_hwctx->nb_surfaces, - sizeof(*s->mem_ids)); + s->mem_ids = av_calloc(hw_frames_hwctx->nb_surfaces, + sizeof(*s->mem_ids)); if (!s->mem_ids) return AVERROR(ENOMEM); for (i = 0; i < hw_frames_hwctx->nb_surfaces; i++) diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c index 0aa8ab7a1e..d74cd7b159 100644 --- a/libavfilter/vf_dejudder.c +++ b/libavfilter/vf_dejudder.c @@ -95,7 +95,7 @@ static av_cold int dejudder_init(AVFilterContext *ctx) { DejudderContext *s = ctx->priv; - s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff)); + s->ringbuff = av_calloc(s->cycle + 2, sizeof(*s->ringbuff)); if (!s->ringbuff) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 4a5bc06871..f886395ab7 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -172,7 +172,7 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char * ret = AVERROR_INVALIDDATA; goto end; } - if (!(*values = av_mallocz_array(sizeof(int) * *rows, *cols))) { + if (!(*values = av_calloc(sizeof(int) * *rows, *cols))) { ret = AVERROR(ENOMEM); goto end; } diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c index 582da48568..578c3be812 100644 --- a/libavfilter/vf_mestimate.c +++ b/libavfilter/vf_mestimate.c @@ -100,7 +100,7 @@ static int config_input(AVFilterLink *inlink) return AVERROR(EINVAL); for (i = 0; i < 3; i++) { - s->mv_table[i] = av_mallocz_array(s->b_count, sizeof(*s->mv_table[0])); + s->mv_table[i] = av_calloc(s->b_count, sizeof(*s->mv_table[0])); if (!s->mv_table[i]) return AVERROR(ENOMEM); } diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index 33a4059042..f4e791a19e 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -353,7 +353,7 @@ static int config_input(AVFilterLink *inlink) for (i = 0; i < NB_FRAMES; i++) { Frame *frame = &mi_ctx->frames[i]; - frame->blocks = av_mallocz_array(mi_ctx->b_count, sizeof(Block)); + frame->blocks = av_calloc(mi_ctx->b_count, sizeof(*frame->blocks)); if (!frame->blocks) return AVERROR(ENOMEM); } @@ -373,19 +373,19 @@ static int config_input(AVFilterLink *inlink) else if (mi_ctx->me_mode == ME_MODE_BILAT) me_ctx->get_cost = &get_sbad_ob; - mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS)); - mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights)); - mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs)); + mi_ctx->pixel_mvs = av_calloc(width * height, sizeof(*mi_ctx->pixel_mvs)); + mi_ctx->pixel_weights = av_calloc(width * height, sizeof(*mi_ctx->pixel_weights)); + mi_ctx->pixel_refs = av_calloc(width * height, sizeof(*mi_ctx->pixel_refs)); if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs) return AVERROR(ENOMEM); if (mi_ctx->me_mode == ME_MODE_BILAT) - if (!(mi_ctx->int_blocks = av_mallocz_array(mi_ctx->b_count, sizeof(Block)))) + if (!FF_ALLOCZ_TYPED_ARRAY(mi_ctx->int_blocks, mi_ctx->b_count)) return AVERROR(ENOMEM); if (mi_ctx->me_method == AV_ME_METHOD_EPZS) { for (i = 0; i < 3; i++) { - mi_ctx->mv_table[i] = av_mallocz_array(mi_ctx->b_count, sizeof(*mi_ctx->mv_table[0])); + mi_ctx->mv_table[i] = av_calloc(mi_ctx->b_count, sizeof(*mi_ctx->mv_table[0])); if (!mi_ctx->mv_table[i]) return AVERROR(ENOMEM); } @@ -601,7 +601,7 @@ static int var_size_bme(MIContext *mi_ctx, Block *block, int x_mb, int y_mb, int } if (!block->subs) { - block->subs = av_mallocz_array(4, sizeof(Block)); + block->subs = av_mallocz(4 * sizeof(*block->subs)); if (!block->subs) return AVERROR(ENOMEM); } diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index 39ed37368a..20107022c4 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -312,7 +312,7 @@ static int config_input(AVFilterLink *inlink) s->ii_lz_32 = FFALIGN(s->ii_w + 1, 4); // "+1" is for the space of the top 0-line - s->ii_orig = av_mallocz_array(s->ii_h + 1, s->ii_lz_32 * sizeof(*s->ii_orig)); + s->ii_orig = av_calloc(s->ii_h + 1, s->ii_lz_32 * sizeof(*s->ii_orig)); if (!s->ii_orig) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c index 578ef47e88..76bad4a984 100644 --- a/libavfilter/vf_overlay_qsv.c +++ b/libavfilter/vf_overlay_qsv.c @@ -325,8 +325,8 @@ static int overlay_qsv_init(AVFilterContext *ctx) vpp->comp_conf.Header.BufferId = MFX_EXTBUFF_VPP_COMPOSITE; vpp->comp_conf.Header.BufferSz = sizeof(vpp->comp_conf); vpp->comp_conf.NumInputStream = ctx->nb_inputs; - vpp->comp_conf.InputStream = av_mallocz_array(ctx->nb_inputs, - sizeof(*vpp->comp_conf.InputStream)); + vpp->comp_conf.InputStream = av_calloc(ctx->nb_inputs, + sizeof(*vpp->comp_conf.InputStream)); if (!vpp->comp_conf.InputStream) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_program_opencl.c b/libavfilter/vf_program_opencl.c index fdc6b4dcd1..1ffb18bde1 100644 --- a/libavfilter/vf_program_opencl.c +++ b/libavfilter/vf_program_opencl.c @@ -271,8 +271,7 @@ static av_cold int program_opencl_init(AVFilterContext *avctx) } else { int i; - ctx->frames = av_mallocz_array(ctx->nb_inputs, - sizeof(*ctx->frames)); + ctx->frames = av_calloc(ctx->nb_inputs, sizeof(*ctx->frames)); if (!ctx->frames) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 2ab04457a9..5a37cef63d 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -343,16 +343,16 @@ static int init_out_session(AVFilterContext *ctx) memset(&par, 0, sizeof(par)); if (opaque) { - s->surface_ptrs_in = av_mallocz_array(in_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_in)); + s->surface_ptrs_in = av_calloc(in_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_in)); if (!s->surface_ptrs_in) return AVERROR(ENOMEM); for (i = 0; i < in_frames_hwctx->nb_surfaces; i++) s->surface_ptrs_in[i] = in_frames_hwctx->surfaces + i; s->nb_surface_ptrs_in = in_frames_hwctx->nb_surfaces; - s->surface_ptrs_out = av_mallocz_array(out_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_out)); + s->surface_ptrs_out = av_calloc(out_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_out)); if (!s->surface_ptrs_out) return AVERROR(ENOMEM); for (i = 0; i < out_frames_hwctx->nb_surfaces; i++) @@ -383,16 +383,16 @@ static int init_out_session(AVFilterContext *ctx) .Free = frame_free, }; - s->mem_ids_in = av_mallocz_array(in_frames_hwctx->nb_surfaces, - sizeof(*s->mem_ids_in)); + s->mem_ids_in = av_calloc(in_frames_hwctx->nb_surfaces, + sizeof(*s->mem_ids_in)); if (!s->mem_ids_in) return AVERROR(ENOMEM); for (i = 0; i < in_frames_hwctx->nb_surfaces; i++) s->mem_ids_in[i] = in_frames_hwctx->surfaces[i].Data.MemId; s->nb_mem_ids_in = in_frames_hwctx->nb_surfaces; - s->mem_ids_out = av_mallocz_array(out_frames_hwctx->nb_surfaces, - sizeof(*s->mem_ids_out)); + s->mem_ids_out = av_calloc(out_frames_hwctx->nb_surfaces, + sizeof(*s->mem_ids_out)); if (!s->mem_ids_out) return AVERROR(ENOMEM); for (i = 0; i < out_frames_hwctx->nb_surfaces; i++) diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index 41e35ac6ee..61a84ff990 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -478,7 +478,7 @@ static int config_input_ref(AVFilterLink *inlink) return AVERROR(ENOMEM); for (int t = 0; t < s->nb_threads; t++) { - s->temp[t] = av_mallocz_array(2 * SUM_LEN(inlink->w), (desc->comp[0].depth > 8) ? sizeof(int64_t[4]) : sizeof(int[4])); + s->temp[t] = av_calloc(2 * SUM_LEN(inlink->w), (desc->comp[0].depth > 8) ? sizeof(int64_t[4]) : sizeof(int[4])); if (!s->temp[t]) return AVERROR(ENOMEM); } diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 98399b804a..b413133e41 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -229,7 +229,7 @@ static int init_filter_param(AVFilterContext *ctx, UnsharpFilterParam *fp, const effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0); fp->sr = av_malloc_array((MAX_MATRIX_SIZE - 1) * s->nb_threads, sizeof(uint32_t)); - fp->sc = av_mallocz_array(2 * fp->steps_y * s->nb_threads, sizeof(uint32_t *)); + fp->sc = av_calloc(fp->steps_y * s->nb_threads, 2 * sizeof(*fp->sc)); if (!fp->sr || !fp->sc) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c index 983a2fec4f..c4e4a1f82d 100644 --- a/libavfilter/vf_yaepblur.c +++ b/libavfilter/vf_yaepblur.c @@ -294,11 +294,11 @@ static int config_input(AVFilterLink *inlink) // padding one row on the top, and padding one col on the left, that is why + 1 below s->sat_linesize = inlink->w + 1; - s->sat = av_mallocz_array(inlink->h + 1, s->sat_linesize*sizeof(*s->sat)); + s->sat = av_calloc(inlink->h + 1, s->sat_linesize * sizeof(*s->sat)); if (!s->sat) return AVERROR(ENOMEM); - s->square_sat = av_mallocz_array(inlink->h + 1, s->sat_linesize*sizeof(*s->square_sat)); + s->square_sat = av_calloc(inlink->h + 1, s->sat_linesize * sizeof(*s->square_sat)); if (!s->square_sat) return AVERROR(ENOMEM); diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 9a62cfedc3..b22e8be836 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -123,7 +123,7 @@ static int init_pattern_from_string(AVFilterContext *ctx) s->h = (double)s->w * M_PHI; } - s->buf = av_mallocz_array(sizeof(uint8_t) * s->w, s->h); + s->buf = av_calloc(s->w, s->h * sizeof(*s->buf)); if (!s->buf) return AVERROR(ENOMEM); @@ -183,7 +183,7 @@ static av_cold int init(AVFilterContext *ctx) /* fill the first row randomly */ int i; - s->buf = av_mallocz_array(sizeof(uint8_t) * s->w, s->h); + s->buf = av_calloc(s->w, s->h * sizeof(*s->buf)); if (!s->buf) return AVERROR(ENOMEM); if (s->random_seed == -1) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index b1dea1362e..c4fac5eab2 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1665,7 +1665,7 @@ static int check_stream_max_drift(AVFormatContext *s) { int64_t min_pos, pos; int i; - int *idx = av_mallocz_array(s->nb_streams, sizeof(*idx)); + int *idx = av_calloc(s->nb_streams, sizeof(*idx)); if (!idx) return AVERROR(ENOMEM); for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) { diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index a3b4a2e11e..622491d2e5 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -84,7 +84,7 @@ static int hash_init(struct AVFormatContext *s) int res; struct HashContext *c = s->priv_data; c->per_stream = 0; - c->hashes = av_mallocz_array(1, sizeof(*c->hashes)); + c->hashes = av_mallocz(sizeof(*c->hashes)); if (!c->hashes) return AVERROR(ENOMEM); res = av_hash_alloc(&c->hashes[0], c->hash_name); @@ -101,7 +101,7 @@ static int streamhash_init(struct AVFormatContext *s) int res, i; struct HashContext *c = s->priv_data; c->per_stream = 1; - c->hashes = av_mallocz_array(s->nb_streams, sizeof(*c->hashes)); + c->hashes = av_calloc(s->nb_streams, sizeof(*c->hashes)); if (!c->hashes) return AVERROR(ENOMEM); for (i = 0; i < s->nb_streams; i++) { @@ -254,7 +254,7 @@ static int framehash_init(struct AVFormatContext *s) int res; struct HashContext *c = s->priv_data; c->per_stream = 0; - c->hashes = av_mallocz_array(1, sizeof(*c->hashes)); + c->hashes = av_mallocz(sizeof(*c->hashes)); if (!c->hashes) return AVERROR(ENOMEM); res = av_hash_alloc(&c->hashes[0], c->hash_name); diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 1793fb69d5..12365ad21f 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -326,7 +326,7 @@ static int hds_write_header(AVFormatContext *s) return AVERROR_MUXER_NOT_FOUND; } - c->streams = av_mallocz_array(s->nb_streams, sizeof(*c->streams)); + c->streams = av_calloc(s->nb_streams, sizeof(*c->streams)); if (!c->streams) { return AVERROR(ENOMEM); } diff --git a/libavformat/icoenc.c b/libavformat/icoenc.c index a1ca15155f..ee793137fd 100644 --- a/libavformat/icoenc.c +++ b/libavformat/icoenc.c @@ -106,7 +106,7 @@ static int ico_write_header(AVFormatContext *s) avio_skip(pb, 16); } - ico->images = av_mallocz_array(ico->nb_images, sizeof(IcoMuxContext)); + ico->images = av_calloc(ico->nb_images, sizeof(*ico->images)); if (!ico->images) return AVERROR(ENOMEM); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 6e34243f6b..7899601bac 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2686,7 +2686,7 @@ static int mkv_init(struct AVFormatContext *s) mkv->cur_audio_pkt = av_packet_alloc(); if (!mkv->cur_audio_pkt) return AVERROR(ENOMEM); - mkv->tracks = av_mallocz_array(s->nb_streams, sizeof(*mkv->tracks)); + mkv->tracks = av_calloc(s->nb_streams, sizeof(*mkv->tracks)); if (!mkv->tracks) return AVERROR(ENOMEM); diff --git a/libavformat/mov.c b/libavformat/mov.c index 4bc42d6b20..e484ada060 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2596,11 +2596,11 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) } /* Prepare space for hosting multiple extradata. */ - sc->extradata = av_mallocz_array(entries, sizeof(*sc->extradata)); + sc->extradata = av_calloc(entries, sizeof(*sc->extradata)); if (!sc->extradata) return AVERROR(ENOMEM); - sc->extradata_size = av_mallocz_array(entries, sizeof(*sc->extradata_size)); + sc->extradata_size = av_calloc(entries, sizeof(*sc->extradata_size)); if (!sc->extradata_size) { ret = AVERROR(ENOMEM); goto fail; @@ -5998,7 +5998,7 @@ static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVSt if (use_subsamples) { subsample_count = avio_rb16(pb); av_free((*sample)->subsamples); - (*sample)->subsamples = av_mallocz_array(subsample_count, sizeof(*subsamples)); + (*sample)->subsamples = av_calloc(subsample_count, sizeof(*subsamples)); if (!(*sample)->subsamples) { av_encryption_info_free(*sample); *sample = NULL; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d5929e6395..cfb5a5c725 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6670,7 +6670,7 @@ static int mov_init(AVFormatContext *s) // Reserve an extra stream for chapters for the case where chapters // are written in the trailer - mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks)); + mov->tracks = av_calloc(mov->nb_streams + 1, sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index ebe411b04d..876142d3a0 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1872,8 +1872,8 @@ static int mxf_compute_index_tables(MXFContext *mxf) } } - mxf->index_tables = av_mallocz_array(mxf->nb_index_tables, - sizeof(*mxf->index_tables)); + mxf->index_tables = av_calloc(mxf->nb_index_tables, + sizeof(*mxf->index_tables)); if (!mxf->index_tables) { av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n"); ret = AVERROR(ENOMEM); @@ -1894,9 +1894,7 @@ static int mxf_compute_index_tables(MXFContext *mxf) MXFIndexTable *t = &mxf->index_tables[j]; MXFTrack *mxf_track = NULL; - t->segments = av_mallocz_array(t->nb_segments, - sizeof(*t->segments)); - + t->segments = av_calloc(t->nb_segments, sizeof(*t->segments)); if (!t->segments) { av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment" " pointer array\n"); diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 7f08f151b6..b108aa6c7e 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -122,7 +122,7 @@ const URLProtocol **ffurl_get_protocols(const char *whitelist, const URLProtocol **ret; int i, ret_idx = 0; - ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret)); + ret = av_calloc(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret)); if (!ret) return NULL; diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 6e97c23330..0e91e3e315 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -748,7 +748,7 @@ static int rtsp_read_header(AVFormatContext *s) return ret; rt->real_setup_cache = !s->nb_streams ? NULL : - av_mallocz_array(s->nb_streams, 2 * sizeof(*rt->real_setup_cache)); + av_calloc(s->nb_streams, 2 * sizeof(*rt->real_setup_cache)); if (!rt->real_setup_cache && s->nb_streams) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 1374a09906..9319ee6f80 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -133,7 +133,7 @@ static int sap_write_header(AVFormatContext *s) freeaddrinfo(ai); } - contexts = av_mallocz_array(s->nb_streams, sizeof(AVFormatContext*)); + contexts = av_calloc(s->nb_streams, sizeof(*contexts)); if (!contexts) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 65ef942367..28ef2f4e80 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -295,7 +295,7 @@ static int ism_write_header(AVFormatContext *s) return AVERROR_MUXER_NOT_FOUND; } - c->streams = av_mallocz_array(s->nb_streams, sizeof(*c->streams)); + c->streams = av_calloc(s->nb_streams, sizeof(*c->streams)); if (!c->streams) { return AVERROR(ENOMEM); } diff --git a/libavformat/tee.c b/libavformat/tee.c index 759535bdea..bb31218ac5 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -475,7 +475,7 @@ static int tee_write_header(AVFormatContext *avf) filename++; } - if (!(tee->slaves = av_mallocz_array(nb_slaves, sizeof(*tee->slaves)))) { + if (!FF_ALLOCZ_TYPED_ARRAY(tee->slaves, nb_slaves)) { ret = AVERROR(ENOMEM); goto fail; } diff --git a/libavformat/utils.c b/libavformat/utils.c index a322137fcf..8d998815ac 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4207,8 +4207,8 @@ int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src) /* Copy side data if present */ if (src->nb_side_data) { - dst->side_data = av_mallocz_array(src->nb_side_data, - sizeof(AVPacketSideData)); + dst->side_data = av_calloc(src->nb_side_data, + sizeof(*dst->side_data)); if (!dst->side_data) return AVERROR(ENOMEM); dst->nb_side_data = src->nb_side_data; diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c index 06e6047032..2317700be1 100644 --- a/libavformat/wavenc.c +++ b/libavformat/wavenc.c @@ -174,8 +174,8 @@ static av_cold int peak_init_writer(AVFormatContext *s) return AVERROR(ERANGE); wav->size_increment = par->channels * wav->peak_bps * wav->peak_ppv; - wav->peak_maxpos = av_mallocz_array(par->channels, sizeof(*wav->peak_maxpos)); - wav->peak_maxneg = av_mallocz_array(par->channels, sizeof(*wav->peak_maxneg)); + wav->peak_maxpos = av_calloc(par->channels, sizeof(*wav->peak_maxpos)); + wav->peak_maxneg = av_calloc(par->channels, sizeof(*wav->peak_maxneg)); if (!wav->peak_maxpos || !wav->peak_maxneg) goto nomem; diff --git a/libavformat/xmv.c b/libavformat/xmv.c index fbe0f484e2..ec21a4f853 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -175,7 +175,7 @@ static int xmv_read_header(AVFormatContext *s) avio_skip(pb, 2); /* Unknown (padding?) */ - xmv->audio = av_mallocz_array(xmv->audio_track_count, sizeof(XMVAudioPacket)); + xmv->audio = av_calloc(xmv->audio_track_count, sizeof(*xmv->audio)); if (!xmv->audio) return AVERROR(ENOMEM); diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c index 1bf75ced54..243efc39e4 100644 --- a/libavutil/audio_fifo.c +++ b/libavutil/audio_fifo.c @@ -75,7 +75,7 @@ AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, af->sample_size = buf_size / nb_samples; af->nb_buffers = av_sample_fmt_is_planar(sample_fmt) ? channels : 1; - af->buf = av_mallocz_array(af->nb_buffers, sizeof(*af->buf)); + af->buf = av_calloc(af->nb_buffers, sizeof(*af->buf)); if (!af->buf) goto error; diff --git a/libavutil/encryption_info.c b/libavutil/encryption_info.c index dd3fa71a44..09486c4c85 100644 --- a/libavutil/encryption_info.c +++ b/libavutil/encryption_info.c @@ -48,7 +48,7 @@ AVEncryptionInfo *av_encryption_info_alloc(uint32_t subsample_count, uint32_t ke info->key_id_size = key_id_size; info->iv = av_mallocz(iv_size); info->iv_size = iv_size; - info->subsamples = av_mallocz_array(subsample_count, sizeof(*info->subsamples)); + info->subsamples = av_calloc(subsample_count, sizeof(*info->subsamples)); info->subsample_count = subsample_count; // Allow info->subsamples to be NULL if there are no subsamples. @@ -185,7 +185,7 @@ AVEncryptionInitInfo *av_encryption_init_info_alloc( info->system_id = av_mallocz(system_id_size); info->system_id_size = system_id_size; - info->key_ids = key_id_size ? av_mallocz_array(num_key_ids, sizeof(*info->key_ids)) : NULL; + info->key_ids = key_id_size ? av_calloc(num_key_ids, sizeof(*info->key_ids)) : NULL; info->num_key_ids = num_key_ids; info->key_id_size = key_id_size; info->data = av_mallocz(data_size); diff --git a/libavutil/frame.c b/libavutil/frame.c index b0ceaf7145..2617cda2b5 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -210,9 +210,9 @@ static int get_audio_buffer(AVFrame *frame, int align) } if (planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz_array(planes, + frame->extended_data = av_calloc(planes, sizeof(*frame->extended_data)); - frame->extended_buf = av_mallocz_array((planes - AV_NUM_DATA_POINTERS), + frame->extended_buf = av_calloc(planes - AV_NUM_DATA_POINTERS, sizeof(*frame->extended_buf)); if (!frame->extended_data || !frame->extended_buf) { av_freep(&frame->extended_data); @@ -367,8 +367,8 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src) } if (src->extended_buf) { - dst->extended_buf = av_mallocz_array(sizeof(*dst->extended_buf), - src->nb_extended_buf); + dst->extended_buf = av_calloc(src->nb_extended_buf, + sizeof(*dst->extended_buf)); if (!dst->extended_buf) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index d13d0f7c9b..31c7840dba 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -308,7 +308,7 @@ static int hwframe_pool_prealloc(AVBufferRef *ref) AVFrame **frames; int i, ret = 0; - frames = av_mallocz_array(ctx->initial_pool_size, sizeof(*frames)); + frames = av_calloc(ctx->initial_pool_size, sizeof(*frames)); if (!frames) return AVERROR(ENOMEM); diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 272a19da47..8ab96bad25 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -284,7 +284,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) } } - hwctx->texture_infos = av_mallocz_array(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); + hwctx->texture_infos = av_calloc(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); if (!hwctx->texture_infos) return AVERROR(ENOMEM); s->nb_surfaces = ctx->initial_pool_size; diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 63b037da4a..f3e578fc10 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -179,8 +179,8 @@ static int dxva2_init_pool(AVHWFramesContext *ctx) return AVERROR(EINVAL); } - s->surfaces_internal = av_mallocz_array(ctx->initial_pool_size, - sizeof(*s->surfaces_internal)); + s->surfaces_internal = av_calloc(ctx->initial_pool_size, + sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 41fac43229..26a3a24593 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -2441,8 +2441,8 @@ static int opencl_frames_derive_from_dxva2(AVHWFramesContext *dst_fc, frames_priv->nb_mapped_frames = src_hwctx->nb_surfaces; frames_priv->mapped_frames = - av_mallocz_array(frames_priv->nb_mapped_frames, - sizeof(*frames_priv->mapped_frames)); + av_calloc(frames_priv->nb_mapped_frames, + sizeof(*frames_priv->mapped_frames)); if (!frames_priv->mapped_frames) return AVERROR(ENOMEM); @@ -2596,8 +2596,8 @@ static int opencl_frames_derive_from_d3d11(AVHWFramesContext *dst_fc, frames_priv->nb_mapped_frames = src_fc->initial_pool_size; frames_priv->mapped_frames = - av_mallocz_array(frames_priv->nb_mapped_frames, - sizeof(*frames_priv->mapped_frames)); + av_calloc(frames_priv->nb_mapped_frames, + sizeof(*frames_priv->mapped_frames)); if (!frames_priv->mapped_frames) return AVERROR(ENOMEM); diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index d431e71eab..225ae768a9 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -437,13 +437,13 @@ static int qsv_init_pool(AVHWFramesContext *ctx, uint32_t fourcc) return AVERROR(EINVAL); } - s->handle_pairs_internal = av_mallocz_array(ctx->initial_pool_size, - sizeof(*s->handle_pairs_internal)); + s->handle_pairs_internal = av_calloc(ctx->initial_pool_size, + sizeof(*s->handle_pairs_internal)); if (!s->handle_pairs_internal) return AVERROR(ENOMEM); - s->surfaces_internal = av_mallocz_array(ctx->initial_pool_size, - sizeof(*s->surfaces_internal)); + s->surfaces_internal = av_calloc(ctx->initial_pool_size, + sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); @@ -626,8 +626,8 @@ static int qsv_frames_init(AVHWFramesContext *ctx) } if (opaque) { - s->surface_ptrs = av_mallocz_array(frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs)); + s->surface_ptrs = av_calloc(frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs)); if (!s->surface_ptrs) return AVERROR(ENOMEM); @@ -645,7 +645,7 @@ static int qsv_frames_init(AVHWFramesContext *ctx) s->ext_buffers[0] = (mfxExtBuffer*)&s->opaque_alloc; } else { - s->mem_ids = av_mallocz_array(frames_hwctx->nb_surfaces, sizeof(*s->mem_ids)); + s->mem_ids = av_calloc(frames_hwctx->nb_surfaces, sizeof(*s->mem_ids)); if (!s->mem_ids) return AVERROR(ENOMEM); @@ -710,8 +710,8 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, case AV_HWDEVICE_TYPE_VAAPI: { AVVAAPIFramesContext *dst_hwctx = dst_ctx->hwctx; - dst_hwctx->surface_ids = av_mallocz_array(src_hwctx->nb_surfaces, - sizeof(*dst_hwctx->surface_ids)); + dst_hwctx->surface_ids = av_calloc(src_hwctx->nb_surfaces, + sizeof(*dst_hwctx->surface_ids)); if (!dst_hwctx->surface_ids) return AVERROR(ENOMEM); for (i = 0; i < src_hwctx->nb_surfaces; i++) { @@ -738,8 +738,8 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, case AV_HWDEVICE_TYPE_DXVA2: { AVDXVA2FramesContext *dst_hwctx = dst_ctx->hwctx; - dst_hwctx->surfaces = av_mallocz_array(src_hwctx->nb_surfaces, - sizeof(*dst_hwctx->surfaces)); + dst_hwctx->surfaces = av_calloc(src_hwctx->nb_surfaces, + sizeof(*dst_hwctx->surfaces)); if (!dst_hwctx->surfaces) return AVERROR(ENOMEM); for (i = 0; i < src_hwctx->nb_surfaces; i++) { @@ -1119,11 +1119,12 @@ static int qsv_frames_derive_to(AVHWFramesContext *dst_ctx, case AV_HWDEVICE_TYPE_VAAPI: { AVVAAPIFramesContext *src_hwctx = src_ctx->hwctx; - s->handle_pairs_internal = av_mallocz_array(src_ctx->initial_pool_size, sizeof(*s->handle_pairs_internal)); + s->handle_pairs_internal = av_calloc(src_ctx->initial_pool_size, + sizeof(*s->handle_pairs_internal)); if (!s->handle_pairs_internal) return AVERROR(ENOMEM); - s->surfaces_internal = av_mallocz_array(src_hwctx->nb_surfaces, - sizeof(*s->surfaces_internal)); + s->surfaces_internal = av_calloc(src_hwctx->nb_surfaces, + sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); for (i = 0; i < src_hwctx->nb_surfaces; i++) { @@ -1141,11 +1142,12 @@ static int qsv_frames_derive_to(AVHWFramesContext *dst_ctx, case AV_HWDEVICE_TYPE_D3D11VA: { AVD3D11VAFramesContext *src_hwctx = src_ctx->hwctx; - s->handle_pairs_internal = av_mallocz_array(src_ctx->initial_pool_size, sizeof(*s->handle_pairs_internal)); + s->handle_pairs_internal = av_calloc(src_ctx->initial_pool_size, + sizeof(*s->handle_pairs_internal)); if (!s->handle_pairs_internal) return AVERROR(ENOMEM); - s->surfaces_internal = av_mallocz_array(src_ctx->initial_pool_size, - sizeof(*s->surfaces_internal)); + s->surfaces_internal = av_calloc(src_ctx->initial_pool_size, + sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); for (i = 0; i < src_ctx->initial_pool_size; i++) { @@ -1171,11 +1173,12 @@ static int qsv_frames_derive_to(AVHWFramesContext *dst_ctx, case AV_HWDEVICE_TYPE_DXVA2: { AVDXVA2FramesContext *src_hwctx = src_ctx->hwctx; - s->handle_pairs_internal = av_mallocz_array(src_ctx->initial_pool_size, sizeof(*s->handle_pairs_internal)); + s->handle_pairs_internal = av_calloc(src_ctx->initial_pool_size, + sizeof(*s->handle_pairs_internal)); if (!s->handle_pairs_internal) return AVERROR(ENOMEM); - s->surfaces_internal = av_mallocz_array(src_hwctx->nb_surfaces, - sizeof(*s->surfaces_internal)); + s->surfaces_internal = av_calloc(src_hwctx->nb_surfaces, + sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); for (i = 0; i < src_hwctx->nb_surfaces; i++) { diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 94fdad7f06..2c3216857a 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -804,13 +804,13 @@ static int find_device(AVHWDeviceContext *ctx, VulkanDeviceSelection *select) goto end; } - prop = av_mallocz_array(num, sizeof(*prop)); + prop = av_calloc(num, sizeof(*prop)); if (!prop) { err = AVERROR(ENOMEM); goto end; } - idp = av_mallocz_array(num, sizeof(*idp)); + idp = av_calloc(num, sizeof(*idp)); if (!idp) { err = AVERROR(ENOMEM); goto end; diff --git a/libavutil/internal.h b/libavutil/internal.h index b032e7540a..0a7f1c6257 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -95,7 +95,7 @@ #define FF_ALLOC_TYPED_ARRAY(p, nelem) (p = av_malloc_array(nelem, sizeof(*p))) -#define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_mallocz_array(nelem, sizeof(*p))) +#define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_calloc(nelem, sizeof(*p))) #define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr)) diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index 142d50e7c3..90f082452c 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -32,7 +32,7 @@ static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) *filename_w = NULL; return 0; } - *filename_w = (wchar_t *)av_mallocz_array(num_chars, sizeof(wchar_t)); + *filename_w = (wchar_t *)av_calloc(num_chars, sizeof(wchar_t)); if (!*filename_w) { errno = ENOMEM; return -1; diff --git a/libswresample/swresample.c b/libswresample/swresample.c index a7bb69dd4f..22c2c33673 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -415,7 +415,7 @@ int swri_realloc_audio(AudioData *a, int count){ av_assert0(a->bps); av_assert0(a->ch_count); - a->data= av_mallocz_array(countb, a->ch_count); + a->data = av_calloc(countb, a->ch_count); if(!a->data) return AVERROR(ENOMEM); for(i=0; ich_count; i++){ diff --git a/libswresample/x86/rematrix_init.c b/libswresample/x86/rematrix_init.c index e515e4bcff..0608c74e7f 100644 --- a/libswresample/x86/rematrix_init.c +++ b/libswresample/x86/rematrix_init.c @@ -51,7 +51,7 @@ av_cold int swri_rematrix_init_x86(struct SwrContext *s){ s->mix_1_1_simd = ff_mix_1_1_a_int16_sse2; s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2; } - s->native_simd_matrix = av_mallocz_array(num, 2 * sizeof(int16_t)); + s->native_simd_matrix = av_calloc(num, 2 * sizeof(int16_t)); s->native_simd_one = av_mallocz(2 * sizeof(int16_t)); if (!s->native_simd_matrix || !s->native_simd_one) return AVERROR(ENOMEM); @@ -78,7 +78,7 @@ av_cold int swri_rematrix_init_x86(struct SwrContext *s){ s->mix_1_1_simd = ff_mix_1_1_a_float_avx; s->mix_2_1_simd = ff_mix_2_1_a_float_avx; } - s->native_simd_matrix = av_mallocz_array(num, sizeof(float)); + s->native_simd_matrix = av_calloc(num, sizeof(float)); s->native_simd_one = av_mallocz(sizeof(float)); if (!s->native_simd_matrix || !s->native_simd_one) return AVERROR(ENOMEM); diff --git a/libswscale/slice.c b/libswscale/slice.c index b185b4aa18..b3ee06d632 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -91,7 +91,7 @@ static int alloc_slice(SwsSlice *s, enum AVPixelFormat fmt, int lumLines, int ch for (i = 0; i < 4; ++i) { int n = size[i] * ( ring == 0 ? 1 : 3); - s->plane[i].line = av_mallocz_array(sizeof(uint8_t*), n); + s->plane[i].line = av_calloc(n, sizeof(*s->plane[i].line)); if (!s->plane[i].line) return AVERROR(ENOMEM); @@ -284,10 +284,10 @@ int ff_init_filters(SwsContext * c) - c->desc = av_mallocz_array(sizeof(SwsFilterDescriptor), c->numDesc); + c->desc = av_calloc(c->numDesc, sizeof(*c->desc)); if (!c->desc) return AVERROR(ENOMEM); - c->slice = av_mallocz_array(sizeof(SwsSlice), c->numSlice); + c->slice = av_calloc(c->numSlice, sizeof(*c->slice)); if (!c->slice) { res = AVERROR(ENOMEM); goto cleanup; diff --git a/libswscale/utils.c b/libswscale/utils.c index 25051ead72..dab43b5d76 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1204,8 +1204,8 @@ static int context_init_threaded(SwsContext *c, c->nb_threads = ret; - c->slice_ctx = av_mallocz_array(c->nb_threads, sizeof(*c->slice_ctx)); - c->slice_err = av_mallocz_array(c->nb_threads, sizeof(*c->slice_err)); + c->slice_ctx = av_calloc(c->nb_threads, sizeof(*c->slice_ctx)); + c->slice_err = av_calloc(c->nb_threads, sizeof(*c->slice_err)); if (!c->slice_ctx || !c->slice_err) return AVERROR(ENOMEM); diff --git a/libswscale/vscale.c b/libswscale/vscale.c index 500217239c..9216112b87 100644 --- a/libswscale/vscale.c +++ b/libswscale/vscale.c @@ -237,7 +237,7 @@ int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsS desc[1].dst = dst; } } else { - lumCtx = av_mallocz_array(sizeof(VScalerContext), 2); + lumCtx = av_calloc(2, sizeof(*lumCtx)); if (!lumCtx) return AVERROR(ENOMEM); chrCtx = &lumCtx[1]; diff --git a/tests/api/api-threadmessage-test.c b/tests/api/api-threadmessage-test.c index b6a74f678b..c96b473c43 100644 --- a/tests/api/api-threadmessage-test.c +++ b/tests/api/api-threadmessage-test.c @@ -198,8 +198,8 @@ int main(int ac, char **av) nb_senders, sender_min_load, sender_max_load, nb_receivers, receiver_min_load, receiver_max_load); - senders = av_mallocz_array(nb_senders, sizeof(*senders)); - receivers = av_mallocz_array(nb_receivers, sizeof(*receivers)); + senders = av_calloc(nb_senders, sizeof(*senders)); + receivers = av_calloc(nb_receivers, sizeof(*receivers)); if (!senders || !receivers) { ret = AVERROR(ENOMEM); goto end; diff --git a/tests/checkasm/llviddsp.c b/tests/checkasm/llviddsp.c index 4f75ffc459..66e08c8099 100644 --- a/tests/checkasm/llviddsp.c +++ b/tests/checkasm/llviddsp.c @@ -46,8 +46,8 @@ static void check_add_bytes(LLVidDSPContext c, int width) { uint8_t *dst0 = av_mallocz(width); uint8_t *dst1 = av_mallocz(width); - uint8_t *src0 = av_mallocz_array(width, sizeof(uint8_t)); - uint8_t *src1 = av_mallocz_array(width, sizeof(uint8_t)); + uint8_t *src0 = av_calloc(width, sizeof(*src0)); + uint8_t *src1 = av_calloc(width, sizeof(*src1)); declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, ptrdiff_t w); init_buffer(src0, src1, uint8_t, width); @@ -74,10 +74,10 @@ static void check_add_median_pred(LLVidDSPContext c, int width) { int A0, A1, B0, B1; uint8_t *dst0 = av_mallocz(width); uint8_t *dst1 = av_mallocz(width); - uint8_t *src0 = av_mallocz_array(width, sizeof(uint8_t)); - uint8_t *src1 = av_mallocz_array(width, sizeof(uint8_t)); - uint8_t *diff0 = av_mallocz_array(width, sizeof(uint8_t)); - uint8_t *diff1 = av_mallocz_array(width, sizeof(uint8_t)); + uint8_t *src0 = av_calloc(width, sizeof(*src0)); + uint8_t *src1 = av_calloc(width, sizeof(*src1)); + uint8_t *diff0 = av_calloc(width, sizeof(*diff0)); + uint8_t *diff1 = av_calloc(width, sizeof(*diff1)); declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src1, const uint8_t *diff, ptrdiff_t w, int *left, int *left_top); @@ -112,8 +112,8 @@ static void check_add_left_pred(LLVidDSPContext c, int width, int acc, const cha int res0, res1; uint8_t *dst0 = av_mallocz(width); uint8_t *dst1 = av_mallocz(width); - uint8_t *src0 = av_mallocz_array(width, sizeof(uint8_t)); - uint8_t *src1 = av_mallocz_array(width, sizeof(uint8_t)); + uint8_t *src0 = av_calloc(width, sizeof(*src0)); + uint8_t *src1 = av_calloc(width, sizeof(*src1)); declare_func_emms(AV_CPU_FLAG_MMX, int, uint8_t *dst, uint8_t *src, ptrdiff_t w, int acc); init_buffer(src0, src1, uint8_t, width); @@ -139,10 +139,10 @@ static void check_add_left_pred(LLVidDSPContext c, int width, int acc, const cha static void check_add_left_pred_16(LLVidDSPContext c, unsigned mask, int width, unsigned acc, const char * report) { int res0, res1; - uint16_t *dst0 = av_mallocz_array(width, sizeof(uint16_t)); - uint16_t *dst1 = av_mallocz_array(width, sizeof(uint16_t)); - uint16_t *src0 = av_mallocz_array(width, sizeof(uint16_t)); - uint16_t *src1 = av_mallocz_array(width, sizeof(uint16_t)); + uint16_t *dst0 = av_calloc(width, sizeof(*dst0)); + uint16_t *dst1 = av_calloc(width, sizeof(*dst1)); + uint16_t *src0 = av_calloc(width, sizeof(*src0)); + uint16_t *src1 = av_calloc(width, sizeof(*src1)); declare_func_emms(AV_CPU_FLAG_MMX, int, uint16_t *dst, uint16_t *src, unsigned mask, ptrdiff_t w, unsigned acc); init_buffer(src0, src1, uint16_t, width); diff --git a/tests/checkasm/vf_nlmeans.c b/tests/checkasm/vf_nlmeans.c index 32c6931a4b..87474d6803 100644 --- a/tests/checkasm/vf_nlmeans.c +++ b/tests/checkasm/vf_nlmeans.c @@ -46,12 +46,12 @@ void checkasm_check_nlmeans(void) const int ii_w = w + e*2; const int ii_h = h + e*2; const int ii_lz_32 = FFALIGN(ii_w + 1, 4); - uint32_t *ii_orig_ref = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii_orig_ref)); + uint32_t *ii_orig_ref = av_calloc(ii_h + 1, ii_lz_32 * sizeof(*ii_orig_ref)); uint32_t *ii_ref = ii_orig_ref + ii_lz_32 + 1; - uint32_t *ii_orig_new = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii_orig_new)); + uint32_t *ii_orig_new = av_calloc(ii_h + 1, ii_lz_32 * sizeof(*ii_orig_new)); uint32_t *ii_new = ii_orig_new + ii_lz_32 + 1; const int src_lz = FFALIGN(w, 16); - uint8_t *src = av_mallocz_array(h, src_lz); + uint8_t *src = av_calloc(h, src_lz); declare_func(void, uint32_t *dst, ptrdiff_t dst_linesize_32, const uint8_t *s1, ptrdiff_t linesize1, diff --git a/tools/ismindex.c b/tools/ismindex.c index 7601f62e06..d355cffe38 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -342,7 +342,7 @@ static int read_tfra(struct Tracks *tracks, int start_index, AVIOContext *f) } fieldlength = avio_rb32(f); track->chunks = avio_rb32(f); - track->offsets = av_mallocz_array(track->chunks, sizeof(*track->offsets)); + track->offsets = av_calloc(track->chunks, sizeof(*track->offsets)); if (!track->offsets) { track->chunks = 0; ret = AVERROR(ENOMEM); From patchwork Wed Sep 15 00:57:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30252 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5489761iov; Tue, 14 Sep 2021 17:58:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa0nFERlaacMkRfi3I/Q92eKQS/orUTcEnzdMdOhAbwSbbj0dm83PX2UV0pnN93Qb/YP48 X-Received: by 2002:a50:ff0a:: with SMTP id a10mr22840135edu.273.1631667505221; Tue, 14 Sep 2021 17:58: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 qw5si1198637ejc.383.2021.09.14.17.58.24; Tue, 14 Sep 2021 17:58: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=MdrTVl6q; 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 A275068AFA4; Wed, 15 Sep 2021 03:58:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072084.outbound.protection.outlook.com [40.92.72.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AAFC068AF76 for ; Wed, 15 Sep 2021 03:58:14 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=avCyZyzZh7YSnH8/TXTC1zdfBKYk3ExT6Hwbcud7XVkzyDpS9AFQY5LSM4KLuaQscAJmQhTM7/WgojO+s5GaMvSLcE94qyFD0COvzFhbHeBl/WnsCO+kSwYwr7MnM08i+c7H1Sq0+IONMLV2+QBRmlsbOZyAS+Dt5GTZfiuJD8fW8G/61bjyO/2lF6V08oXyBwJSFrhx3Ai1eQPINK+IOK/cDyEqHm9E0YyNnG8SGtb0QnW6ZfYfe/VM9nzqwq+iPgEilUKytsuHcG5Wj/B522Om+y5N/0n1Vi40JJqpTX6Hf8I7ch5lBTXfbO+GGP2cby0jxdLhRd1myGj4Axt1gQ== 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; bh=zd3wcLFxfhgwiNI2Nb2fhWXvIakpWQqemYXs5fnylDs=; b=eaq3vaHCLsNAHS6rAjO4cCZbwAkLKSDMu0LMPul72lRa+Yr/npOHqxoDIq9g6Mhu0Ptc7CB9MR5Tnj+PydLSnBG5YwfBunn95bqAAfDTOYJnFxICGOy/bfNw24kwl5vOtRVxk9o/qDDLWt9xARppKF1CdRWTabDEdxYNy5atoj7PwjeMrWHjoVX5pdBq/PEGVOulD0BJb4/cqTk2TKZM1VuXFs90E3FyDyo4jEt1IrjufXFXwZ8DT1EozX3TufrinsMVpTJ+zgjkcGi3Eh/aCBmRjjoDgXYIptIzoD9GzxmHy/TZIeXUxpPv6dyogQjAhiUuHQiSjJ+QztlkkOUmRQ== 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=zd3wcLFxfhgwiNI2Nb2fhWXvIakpWQqemYXs5fnylDs=; b=MdrTVl6qUTHHYItHqmaRHAQYwhc8mvc+8WWVOr9WDeL7tmO3wP2bHkz6ycLB7XS1RIfp/zcd7xM8whsCvjJc4/3I1M6btB6ck6sPlWI+jppn8ojdzMRw26gdZToYUU4WUYWvW16YURVO3WWU9KhqIJyd+7xcDMuCHd+bAxEX24lsI5fe8Yzz+wbYp94dMIHNGDIj4/PNpXi3Bh5Pjy3n5htZ0hU6NsxSz0010RA5lI9PLlAZrwvm4VbsoXVN90CdGq5t7wwX/qFCdJA+Cco9OT1IMeoUzpU0lZvBrc1MCEegVzoAqvYP0xcK7nKKkDeXNrR+t7+1PTSKS28vxouaLg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6354.eurprd03.prod.outlook.com (2603:10a6:20b:1b0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 00:58:13 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 00:58:13 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 02:57:45 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [q8nl/TD2OmNoLqrzqBHALQQsvGuAgZgN] X-ClientProxiedBy: FR0P281CA0066.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::12) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915005745.3770937-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by FR0P281CA0066.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Wed, 15 Sep 2021 00:58:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 444ba36f-67f2-4042-90f4-08d977e3e51c X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNUyNnkJffBoITXmWqz3XZegdfmrS+ibArCu7CUSaSb4kHp3N4z1j8xEPeNODleeCr9rZqxu2baEnPVirKwV62VfXnQ1QeamPcgKncJ/nA1pPqL3bL/Z+fXU3Udyh2k5og24PXw356CmUXgQ7hnmFfcuXI0H8ZoWgbvwdOFRUaEuN1+brf/v9aKPr0Ct0ijkLA7/mrFJKQ1Cr4IZl1ZRgRz8yXKQcVABItJVXYAzCn9QaZBm0Ee7PL6vM5T5mLsCDp6TLYgeYSPjvfB6CPkYyjvNVigLkw4H5F9EzCO/nwmOE6skRNHo7GlH2lNO95XUebxtZqRnnCRXf82aqzjKLakx13SU+210pOIVWg67zqvpVSu1haKJM8N3Bplz6DWr4vOGLCeT8pC8WeYw4B/c3Ey6o6A4KoPPjVUh04xXIvik6vwyMXamITrA8tV1MV1V2EZMw7bDqDAU3cRSoD9s0Ks7lR/f6Kr63kAdA/c1Xc0Jjmlrs/bKTdO4UDAB52Egoo1MIzFC68Io+5HADgegdqg76AEtYEqXklzGPd8/GIGBw78ImWFV8TVi4n6YMwvcxqdqavvHoPEFareJzptYyWBQcO+otckf5aukzI0UbPU5S9Veg/XC5rLj/pLeOsk/nw11JWVPY1V9UQ7nkwMRzgqrmwoMbSuive3mPIveMJF++jVMfg3pfe7qZruJh6U19FUESM7+ddL2IlP1HKY6fBTw2fnu+FTmS2w= X-MS-TrafficTypeDiagnostic: AM7PR03MB6354: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yzLTQG2/7QRO9R88Rl127xfeWf17Xv9jjKc/RSDfnWC6EGTeIni0JVfD+GOS2aVS3T9rsQX8/kwOdUXHIGD0EEX5bMGg620oBMyBTR5w5m6Tr0wN5/DwJ7+m7/GOymihh4TdOtMqkuUBiDUCVr9fN6DVkVvETGqzN9JM41t0xi6nJpybR4uJ+DgTEXzH/IuTQKuTnUU8uQKh2/fttYo8u0K2ZIIHD8c6bIiR2gSbG1XNfnRBRgcK4taPsSpP3BBtt35GQ7SABhBwJPaXkkSMxMjCdxl0/O8G8+nj+OhrbfS1wvQ/jsesej/p34sb0kuAZpXM3L/TyWlfXGhfb8VmKq9NzNrXIWxhVdrc+ryOGPRrqIIUkn3HhD09L3TuqK209e4w54GT1PtkSH4oRWwLjaXaajlKhvrLCmEbuFn80ANCB1EcZhZZEi91AQ4SjkNg X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mlDdhMMJfdXLSNirKN+lV6hSZaOBONKrkTHwuxVbKL3h8hqFRkDne0bZNOZWdlQvhWxRfHaDeuozw1FC06vdmaIdCBFDU6KgwLod3XFo9b77BFqzzXRmiFM5Jjz/uwh3WMzHz34jtNwocvN7eu3Dlw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 444ba36f-67f2-4042-90f4-08d977e3e51c X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 00:58:13.6653 (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: AM7PR03MB6354 Subject: [FFmpeg-devel] [PATCH 12/12] avutil/mem: Deprecate av_mallocz_array() 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: +rZZFSEmFx2Z It does the same as av_calloc(), so one of them should be removed. Given that av_calloc() has the shorter name, it is retained. Signed-off-by: Andreas Rheinhardt --- libavutil/mem.c | 2 ++ libavutil/mem.h | 11 ++++++----- libavutil/version.h | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index dcc75945d4..194d880587 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -211,6 +211,7 @@ void *av_malloc_array(size_t nmemb, size_t size) return av_malloc(result); } +#if FF_API_AV_MALLOCZ_ARRAY void *av_mallocz_array(size_t nmemb, size_t size) { size_t result; @@ -218,6 +219,7 @@ void *av_mallocz_array(size_t nmemb, size_t size) return NULL; return av_mallocz(result); } +#endif void *av_realloc_array(void *ptr, size_t nmemb, size_t size) { diff --git a/libavutil/mem.h b/libavutil/mem.h index c7f8867a13..b9fe80738c 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -237,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); * @see av_mallocz() * @see av_malloc_array() */ -av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#if FF_API_AV_MALLOCZ_ARRAY /** - * Equivalent of av_mallocz_array(). - * - * Created for symmetry with the calloc() C function. + * @deprecated use av_calloc() */ -void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; +attribute_deprecated +void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#endif /** * Allocate, reallocate, or free a block of memory. diff --git a/libavutil/version.h b/libavutil/version.h index f220e192c8..3261f1eea6 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -114,6 +114,9 @@ #ifndef FF_API_COLORSPACE_NAME #define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58) #endif +#ifndef FF_API_AV_MALLOCZ_ARRAY +#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58) +#endif /** * @}