From patchwork Mon Apr 11 23:49:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35266 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:671c:b0:7c:62c8:b2d1 with SMTP id q28csp1303499pzh; Mon, 11 Apr 2022 16:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq9s+yXBzftRYwYUU4LggZeXHZj6G8gufRZT+55HjvsT12+UmBiPMxhzOrk8GCMd7V1S5A X-Received: by 2002:a05:6402:1a44:b0:41d:8969:e4c9 with SMTP id bf4-20020a0564021a4400b0041d8969e4c9mr3322791edb.299.1649720984174; Mon, 11 Apr 2022 16:49:44 -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 y20-20020a50e614000000b00418e91d3b3esi8074097edm.32.2022.04.11.16.49.35; Mon, 11 Apr 2022 16:49:44 -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=C93U+xNJ; 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 4297468B300; Tue, 12 Apr 2022 02:49:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2016.outbound.protection.outlook.com [40.92.91.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D4D968B092 for ; Tue, 12 Apr 2022 02:49:25 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cw8MkEGHE8GGXjiRT0gMnhKJlW8Z4zysi928C2VzTi5QJB6sa5eG9dFNso4KV7ustXPEHszo/3Set3UitMPxT3joYG/jntqmcGIf8tXsAZsF09YHosjxz/DzpKNb2tX8k+dOd4a3I0JXZK7rfdNVxFp5DVqXNG0r+pqYUN2Tw+Ytad0RdsfEZ/4B8p9ne70FCyzXgr1//yEka6tCjWgb00atTLuIM/v99vaHW382MFZFDCVCO8TR9lgnT/TFLQ1a62R9I1p4Mxs4FGlWra7/ewaFFHNNturUJzBnn+klB7TRk98u6VrFZt0wFC8Fop6CTkqP1i+dZxUI7fdffnBwQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3/yEXydjJcHZzm1EeOjnxRv+SR+UlamX5ZHhsYs7ltc=; b=MYYJwUsRwFjzCnh9tl0XUl7yaI3Eix4FURXR31O4FWTdwcPVmd4RNxF/TGWbCH6n9FacErpHlmBrLxL5OraGwHyFkf35tJmJLN116Mq6Q6PphzNEBj+8mheVklw8z4bEKVG2M9ye5KFv/Dcw3YkbspYzxCyWl7+JZybLnrVDA4eaxUGeYhuqiX81KsuZDyBnSbYp1f1FBL2YBD4S8kOrcIxAkpWctikE5cvyPmQKpvV916ydFF48KdWNAu+7bjFdgQ6J8nbo6b1IGj4HOyN/lHbp0d2nZyL7aNFXd7Kr8jfiCXudN+gDCrQjVmlV3mpz3x+8ZFJVa2bXF6nHrZ35hw== 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=3/yEXydjJcHZzm1EeOjnxRv+SR+UlamX5ZHhsYs7ltc=; b=C93U+xNJ3J4f+QATK4kM/E9AhO6jJamvnp1CaJRh1od9DKNIPz3cIgyV5cYAcyE285n34FQhDrg910Xv4OpgzMhgtQlw5OSNqE0BSHPg1yc0uOf6Au2QhsAK/kZv1y+/QcZoRNpfIYVgt9iebMlsBr21JGC6xOXtIcTlJ2zZUI982P5f8IkPJ2Md4TNqzw5e0VYIFPOf1wjB0BikGsfEZmsUTapeZ5JpYZbBlx52NgO2UR/Ks5i9SHoUGRoXsQQPquUBeo/6ow4WtynUFvb9LbLDe9jDhgjNa5aMrBbhW6j41JqlkbfJbgJ/VwYRPAQOQaoa23DeWJhthSNV3E+x3A== Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) by DB9PR01MB9977.eurprd01.prod.exchangelabs.com (2603:10a6:10:300::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.19; Mon, 11 Apr 2022 23:49:24 +0000 Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000]) by DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000%7]) with mapi id 15.20.5144.030; Mon, 11 Apr 2022 23:49:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Apr 2022 01:49:12 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 X-TMN: [+4TC/xI6PqLqXwJUxfGON9AFCwaH4AjH] X-ClientProxiedBy: ZR0P278CA0173.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::8) To DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) X-Microsoft-Original-Message-ID: <20220411234915.316179-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d87d6e37-253b-4b59-e915-08da1c15e7fd X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiThIBhrdRr4cDPWJ93ZpY+lmYrxY55l2kEzpr4xoZ6/DtmiiAfLahmAQNciWXD9HfcpFySLVnB4HsJayh+hR39baL9BKrmoJdz1d5AlRiQsA56nYLLaI8EVUqtng1ZnBECJ4NhPlVUv0tJuhGgNYwK9jmQnZ2m4h0ADXTmsiCiIVf8edB+5392Je1TMKwtFrG/UWtbeby+ZsaWedcR9D3LMMSBQYlewZJPgw4mHMge6NvK0dwest44yrW7irFX01blhTBK1mfpwoWKQYodsQWfm+JhjRcZfI6j2hcIuqLJ+BH10YEXCfjz3VHnRvAC4RNBOdUk2tqXK4r+NJZ8eLE4rmdzzO8yeTzbSCQ82pA+/nIlpJzXMKkyqBvoux5n9daDl7sFnAFjrgrPO2F4SW2mE9TcNqcyFOg5f909264nbVErhAJJG+RTYvPljQtsNEAh04Gd5VKamZa/U77b2xiWdmc7vgx5+kNV542zNZyKg+3l1jc4xRFt2Mc/phLOnUHfKPzdaqqYmvkrhpUus6VkCWTI0Hj0wBx0rdZXKkYFsZz9uPYd+YxR+iIQwN1OzNJFXObwWf/OutW8SphHPRX0QR7rRiNhCOY0lK2KnLScpKJpeorTbKWKiFfWPdpSf+OGiuLmK3DqCz73vY0wqEJB6zXJ0weTiSXRs0gcfZIdY8xvc954B9rZJ42PgxZEBrkG3ZGkkypYi20TqS0o8XN7B8CxgvPtro1w889/PFg+o3qat1T8g8kixnxYOAJXyVUk= X-MS-TrafficTypeDiagnostic: DB9PR01MB9977:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fJVnVAawf9OoUNO1NxxQZEvfJqjBvBNdS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network-Message-Id: d87d6e37-253b-4b59-e915-08da1c15e7fd X-MS-Exchange-CrossTenant-AuthSource: DU2PR01MB7950.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2022 23:49:24.3101 (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: DB9PR01MB9977 Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/mpegvideo_enc: Ignore ICC profile size when not MJPEG 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: RutBnuCumGaG MJPEG is the only mpegvideo-based encoder making use of it. Fixes linking failures in case mpegvideo_enc.c is compiled with AMV, LJPEG and MJPEG encoders disabled. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 40bcf09c0b..4a5e5a5059 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1687,8 +1687,11 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, size_t pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - AV_INPUT_BUFFER_PADDING_SIZE : s->mb_width*s->mb_height*(MAX_MB_BYTES+100)+10000; - if ((ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_picture, &pkt_size)) < 0) - return ret; + if (CONFIG_MJPEG_ENCODER && avctx->codec_id == AV_CODEC_ID_MJPEG) { + ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_picture, &pkt_size); + if (ret < 0) + return ret; + } if ((ret = ff_alloc_packet(avctx, pkt, pkt_size)) < 0) return ret; if (s->mb_info) { From patchwork Mon Apr 11 23:50:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35267 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:671c:b0:7c:62c8:b2d1 with SMTP id q28csp1303735pzh; Mon, 11 Apr 2022 16:50:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjNIn/8QtAkiXrrgT9Cw6pnfrYnxaCyWoGXUlvdWzXOUbT848LtKtyYuxuYiZEvxvwdJim X-Received: by 2002:aa7:c790:0:b0:41d:7e0f:f15c with SMTP id n16-20020aa7c790000000b0041d7e0ff15cmr6802318eds.129.1649721036438; Mon, 11 Apr 2022 16:50:36 -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 pj9-20020a170906d78900b006e8046cba4asi8503062ejb.914.2022.04.11.16.50.36; Mon, 11 Apr 2022 16:50:36 -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=HKkkfaL2; 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 52D3768B32A; Tue, 12 Apr 2022 02:50:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064077.outbound.protection.outlook.com [40.92.64.77]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5D62968B2EE for ; Tue, 12 Apr 2022 02:50:27 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PHxS++vGFtdewzdjASkfJj4rzXVZ9J8jpNC5Bgys1muphX6QRpLRRdoDHV/6e/hoSU5nw1lhhqMShcAuTkYnDQncREkoznNKvyKAkH9lqHY2UkfSsH6DDHUqxgiAgaH54PiOY5P6fs/gXL+UMmxwG2OyNmRbRAt61aGGtgi6IzkqNza4eOc+oolI/LabM9780FtZ6bOoJ4ovjp2nDjIMUhda1bb6vqwrs9Tr4QgIG6he5oSpzIA8/Xt7qoisJQic90zgO2dr+WCJvSdPdDDinNUlqAbENxwl1ZZrK6FdiG7CVEonhkQt9cRCknZMCLkNx+hgZL80XLMQ3OXNIEDDgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+GRQecRgQOMUdGEPDWT145FiFIatrE/+n1Xw0TB31yM=; b=Nw/FtfHmZAh/lhdHW1cLmLEo+fI7jfqOJLJaGSNz6WvoEtX9I1wiRnHy1PVb+eCz6vGYUNE2oZzBPRjX6VV/drujch09cUnjuMwNKgIb7wNK13Xf1+UyDz4+EFgQR0IiAU3oT7EzM1WQWL3epC8c6zHROf3MOXL87/npHduIZ7wfAXIEbLXXS6ALHQZJgLlm72NPMIqis6KUytNskYeQcr5F2nfkU+2TTdAwsv1mhXWG6mozxTSEqhxOvvQacAx/R40pRTJhsUllOp2ZrJntkDTiVAz4QFCzqtphaX796s1M8g6OoFZDfc4VOp1V8cDunoCYj14pqhiBU3ktiZYBjQ== 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=+GRQecRgQOMUdGEPDWT145FiFIatrE/+n1Xw0TB31yM=; b=HKkkfaL2REQe2XWBRsVOYF7vWE5nP9r7Fp76pXfqDs5BoeZm3i51KcjjXooNM+IQ5zAOZXlJBvxqfjvsZ8gue6BysW/ig6Eq6TYyGMUXdjVgr2HURXbL8G+wofodf9M4VNtseLytOWtbtpJhlPqMp2LzrJvpe6T4JzZ8xzgL5ILipQECt6IznwEzSAhNBAba+6l202/YZ8Uu2hoxQIUylKVt1n0EOwaoGFEu7sveVEA/VLCjL3dpTtPR8vI6mXJMmC1Yzh8R1++vzsrU4cXvw8oUN9rV4f9/wQALmpbOTJdkYeg13koR4wwnRdNWeGA0N3cgPjiAovS8AKfYd5lkWg== Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) by DB9PR01MB9977.eurprd01.prod.exchangelabs.com (2603:10a6:10:300::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.19; Mon, 11 Apr 2022 23:50:25 +0000 Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000]) by DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000%7]) with mapi id 15.20.5144.030; Mon, 11 Apr 2022 23:50:25 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Apr 2022 01:50:15 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [tlc1J+DVDRgMLacY0exoR8hitsd7tWEk] X-ClientProxiedBy: ZR0P278CA0060.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::11) To DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) X-Microsoft-Original-Message-ID: <20220411235017.316325-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7f594add-4ea7-405d-45f6-08da1c160cbd X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiThIBhrdRr4cDPWJ93ZpY+lQbnm5c+Kw9flfnO/725VKaaneys4gcj9nF864SqyVuBpATiVFAE1q5Ws3WSz7wcXewnx+kmCCnPD7cnUK8yX/RVod7rb68tba9l7gKrewG9KcDRUlfAh+GCNAzwsyajV9hf1hR7kb2L8QgSNvtrwGLmeDIu9JxCLMxWp+gxkdxG1pfEt6TPLhmL+9Y7GFGK3OhRwz6mAaPk5KjUhzJ73ruMfNuf7wgKxso5TCtpApfX0phTvnEhjzgLc4LqoL8yX8B1acPtg57Sz2/p5eaqsloY5rV6Mx75L/j5EOV6vRMo63fJMaXmD092M4cvhendSgygz137IBNgypCoNeDm/YJZ442w506aMmZGVXuY1DQ1e5DBIubYKAWhmpmyZ+V57jQSo3sa+TphS7WwjmE0BGWbO5YCsaTkFSG6/IIF91x6kvaKlRvNy0PTHPYqBPRWXzF2KcwqY+yAsY91vV7TE5HAIWCOORThfAvRWQhMZeR0hBL6yKEpLaADUTjVvK4ZFaMKUFfKmNB9ll+IjuKtnOYqLyaM71a1hAVWxie7g9a0aKKjK7meVO2lWOxqv8wRkaet7ZaUZ53OvbW5nz4gvmCt82iV1tUo1XzS0Cfp7fGHznpbqnE7CQoRY0AzMfjLwVQ1g+rdZC8how2Gm+vzwSayD8ho8PI2Gl8jdipT8MNFVz9Ji0sKTmKtYdAyLFCsTjNuy0jzveoFIRVTz65YnZSX/Hwa+zcw4kq65X4D9vYo= X-MS-TrafficTypeDiagnostic: DB9PR01MB9977:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I5dzrvH8TbZM96XX5sFXJfesK948+k3QIGrhLA6F+ZfWPEYig4hcY32iT87LTX2qmejD9X77Ow3QPhXwAz/cOL1lMWlVdzV6FxWc5sWxysU1TMHZsYChhD6/mkJcZKnuGh/qtNr1hTQcb30vSR13xuFmBdKviAGVYav041PqosaxfX5dGm4++3FEnnQW8xVpRWnTD6d5FbYzVySNxLY6/zHYnT5dNaTMlRj5qg5Qy5u8oKm7WNfuG8h6lyUzD7dNvFvBomv1n0UhsoYlvkxwq1cYYO3uKWFQWVa8dIz2qZ6lE1RZU4hXJtKnENek5d0C6NxuVqRhk4CN2niqJbtuagytvKYG8+zt/bzDUg5+Ax2DLi6GNrmj+pbXdQF2Jcr5eVHTOgcd3hcV26JwZ9+P14l3sZdjhkXPGC40BcHxSGgAjXj/OaJOmxah2gYOyXkC4ULaWgx5b5wewbz5gWier33wSTvML+62OKtakHAVp+kn41tDOfV5N8/EoOFHbRjNV/EXrYBwVBQ9o/w8tt7DS8qQTkdRrw8FH7zuJfn69S4kFvrNS8IkTIclxiS34Vi/tsar6mt7chfyPZ0GaIVTFA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iB4uOQ9l2YFNlUWeA/Qd6XLm7Pv1/a7m5XNY/xRgSjUoxlYC1g4FeksOzkUPsVQGAlh46o7nldLmOBZMtIcIrE7sSoVhCzflgN4KHl2pexeQXFnc64jdLeMU54hMhdn1WC1wVY4yKeRDu+0EdAcTvQQR/Sr8+u1H2tWtuutfGqSiCS6ZFV/3H064Dl3HqTpSFPycoFXd8Xsk1bxpHy23o/jKFCoDCz3UByHr/3iFT85oRmSVTb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qF9Ll5YfGIOZneAznuo7Laifq+MAo2Z3nL76mTLKD1aHp0AxL5hVXeD7WmMlatSx+PLcHuv+25AFztJkJhEaFQwIE3O9xclelVObxweA6hxfVVBNVqWaBqSyCivmVe1AA4Yr0YjnP1wwj1J X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f594add-4ea7-405d-45f6-08da1c160cbd X-MS-Exchange-CrossTenant-AuthSource: DU2PR01MB7950.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2022 23:50:25.6810 (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: DB9PR01MB9977 Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/mpegvideo_enc: Fix unnecessary linear growth of buffer 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: A9ehTDdCuuEf If one encodes MJPEG with a single slice and uses input with AV_FRAME_DATA_ICC_PROFILE side data, the current allocation code in ff_mpv_encode_picture() will always increase the size of the temporary buffer used for allocating packets by the size needed for to write the ICC chunk even when the current buffer is actually large enough. This commit fixes this. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 4a5e5a5059..434bbb3a68 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1684,9 +1684,8 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, /* output? */ if (s->new_picture->data[0]) { int growing_buffer = context_count == 1 && !pkt->data && !s->data_partitioning; - size_t pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - AV_INPUT_BUFFER_PADDING_SIZE - : - s->mb_width*s->mb_height*(MAX_MB_BYTES+100)+10000; + size_t pkt_size = 10000 + s->mb_width * s->mb_height * + (growing_buffer ? 64 : (MAX_MB_BYTES + 100)); if (CONFIG_MJPEG_ENCODER && avctx->codec_id == AV_CODEC_ID_MJPEG) { ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_picture, &pkt_size); if (ret < 0) @@ -1694,6 +1693,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, } if ((ret = ff_alloc_packet(avctx, pkt, pkt_size)) < 0) return ret; + pkt->size = avctx->internal->byte_buffer_size - AV_INPUT_BUFFER_PADDING_SIZE; if (s->mb_info) { s->mb_info_ptr = av_packet_new_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, From patchwork Mon Apr 11 23:50:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35268 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:671c:b0:7c:62c8:b2d1 with SMTP id q28csp1303780pzh; Mon, 11 Apr 2022 16:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRPiAqGOOgWkfrNXlNCVdUY3g+ennR377yUj1irrZVbPCxugHV4qU61KGkQZIX/CNO5Mbw X-Received: by 2002:a17:907:7f1b:b0:6e8:558c:5ba with SMTP id qf27-20020a1709077f1b00b006e8558c05bamr16599981ejc.522.1649721044715; Mon, 11 Apr 2022 16:50:44 -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 f16-20020a50fe10000000b0041d807c9ca9si2699842edt.81.2022.04.11.16.50.44; Mon, 11 Apr 2022 16:50:44 -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=RuZXTy6i; 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 5F24C68B179; Tue, 12 Apr 2022 02:50:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064077.outbound.protection.outlook.com [40.92.64.77]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 76EB468B300 for ; Tue, 12 Apr 2022 02:50:32 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JhzB5PO8qcpeODqKxDhtvreyr8sMG0TvJ4eLhNHZBqTodnC/Yaapmy+MuBTRiMYqNpaDo0si5s/EeMhEreWw2awB2Qz38tWaq5aEmZ/gjp9GYPBaiGZuCVmQAQEetpvqNyc857DOMys6NQJ51Nk0wqocoIBI8iCb45Ex1k8bbGLN/lL00FvO7MeicoPuWpJ4Rhc2KIEf+NLRtC9g34oUNxtEszR53XnqHu3NN4kvbygbyD32nhNeDxFjMHEFck6lrNqF380P0pHxl8MCavykpE9d8j+8TaGau6vVb6hV7Mk2IlkaxRlKIuR1euc4v06q5tUBItFAl8YeBjxkQfBR1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OuJ7SJ4hPXZdMsm47jZ9N+u0ZjEz/VcZ3vVlaHPXasM=; b=arVaVxj2yNjZmbVbxx6s6P7AfcuaQTYHsAicFpIMmc2GwHhGqD1m/naH3rz3pkwfdg+kVBV56pq68dYbXOclEukzR6EnOZztdyk0kJkwTiXPo6ruRBaSmPqiJpalSMJV7iFZBBEZRE3O4B/lS1sfOODvVqvfaeEdALZ+eD9e6aSvUKuxuiSweie/o11QGYuwW5zph/YYkfEjST0S1x76OGhCd4yjcbtC88TVRoNJxD6KbNsZl1UOIUs4yraiOEzV4JoXGH8+VNwewHeJGcAjiDZmdeiub8xpKEUZ82GghjkcsGneCFoq767r8PamSxyy4NA2aLIOqGOdvlVV1jJIyg== 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=OuJ7SJ4hPXZdMsm47jZ9N+u0ZjEz/VcZ3vVlaHPXasM=; b=RuZXTy6iStXFhVBFAp2rAWzPlpAfaQ6dEU88sPhJwG8TX0OwhhWUSlQjL2xrSlijhZ/rWk7B/qvAH+/zcDsAaQuH9Zz7/FlAqIvtSVZAOF36L0svg6gquaUY4JSvwQPg6r3M8HvGL8aLryTzg4AQqXL2VYV12/WNgSzag4oO17pR6OzyCefsUnfGu34gEiEZssxZ+ino18QnyYIb8IoG4RRP+sL/DZXd8MQibxXwst74aWJhiO3vLkUAzFE6xUBfTAGMy1NzkKk6gNltVhXsd7Ub3uiDJurgYUz6751ZL0llqkI6wPuTcObpBH5JcVwZRssb0QV5l7AQho7sqrnJVw== Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) by DB9PR01MB9977.eurprd01.prod.exchangelabs.com (2603:10a6:10:300::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.19; Mon, 11 Apr 2022 23:50:27 +0000 Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000]) by DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000%7]) with mapi id 15.20.5144.030; Mon, 11 Apr 2022 23:50:27 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Apr 2022 01:50:16 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [2VHZzSL6+GiyTfP7qsbcRwBiuuz4dka1] X-ClientProxiedBy: ZR0P278CA0060.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::11) To DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) X-Microsoft-Original-Message-ID: <20220411235017.316325-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb1da734-aafc-49fe-24a8-08da1c160dec X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWTUkYsfs8LU5UR1FY/R//Y/IBNrIYWrFUBT/1J2Wto/TrUsJWv4dGOx+HnaWSZdDa8DS8NK4/Nls4n+n6W0Tx72y0ASniurmJwVeapuOjNnvSk4j92YF7rxjcIXcXg4toiNyzJ8xbrGUiBEUs9KqqWWUXcLIbzkXGF3Nwlw4GC+Xp6Qr+KoTeB83MW8Vx6utp1SjPjN5Ubys6skc2gfcy/UsZmHG/a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Zj50XGaVFHwpRuh7kKKlEsTmc1e2EKtAYv4fUvVKH6VJsUGj3EJf1hHeYSf0nRhHLN8YIGSvavn1xmwq2lEv2LqLZ28H0FH17EX6XqYZujNGITE61xHub6dgM9FXYmW/gBoFdmBo3OaAtLXYtniabWjucD0UQ8BVRqv24XJ9pEzbqn2yb2Xqvb6Z0HpPDsKManYu3iPr2ZnSwzVEiaBFuhsZInfD4vC2uQQstZiUt3VbmuEZvHJK+KwFQFeSpzrRFzeDYS26rJG7p/vkqsDHL5QzfNmldgslywqi7DGPYtwHsQAhXaTcX0cGgsg2bUJPGZNLbsgJXTrAD6XVp1kKIF08jxaQvKAasg5sYO66c7ZjFGSBRBg3OBvP3oEEjQJGbx1q5xQ9C+xmxB7Dt8cuUBBINjxcblCShIEhcesY53PouwQq9Vf/f0rmegdsUngeR91rcOyX3PfCGe1neLWCI9MCIl85FlC4C36c5C8EvAzSCHmEh2z7ewQgflSouajdlpE7E9D86jVP+NfIaxv+e/Xnc1hrz5k1yAPKJedSspwiY/SLQGKJda X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb1da734-aafc-49fe-24a8-08da1c160dec X-MS-Exchange-CrossTenant-AuthSource: DU2PR01MB7950.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2022 23:50:27.7596 (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: DB9PR01MB9977 Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/mpegvideo_enc: Remove always-true check 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: H4ed4OVfCmXN It is a remnant of the old way for user-supplied buffers; it is always-true since 93016f5d1d280f9cb7856883af287fa66affc04c. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 434bbb3a68..c9d8c48026 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1683,7 +1683,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, /* output? */ if (s->new_picture->data[0]) { - int growing_buffer = context_count == 1 && !pkt->data && !s->data_partitioning; + int growing_buffer = context_count == 1 && !s->data_partitioning; size_t pkt_size = 10000 + s->mb_width * s->mb_height * (growing_buffer ? 64 : (MAX_MB_BYTES + 100)); if (CONFIG_MJPEG_ENCODER && avctx->codec_id == AV_CODEC_ID_MJPEG) { From patchwork Mon Apr 11 23:50:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35269 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:671c:b0:7c:62c8:b2d1 with SMTP id q28csp1303828pzh; Mon, 11 Apr 2022 16:50:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0QpEz71zmDrqvzoWP38xphbVmED99VXlpig9u1B8jBqCorV4heI116ZSeNIqPlkEMM6Mu X-Received: by 2002:a17:907:6e16:b0:6e4:de0d:d93 with SMTP id sd22-20020a1709076e1600b006e4de0d0d93mr31975255ejc.29.1649721053455; Mon, 11 Apr 2022 16:50:53 -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 do4-20020a170906c10400b006df76385cfasi8618443ejc.410.2022.04.11.16.50.53; Mon, 11 Apr 2022 16:50:53 -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=I9WqIn63; 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 4EB0C68B351; Tue, 12 Apr 2022 02:50:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064077.outbound.protection.outlook.com [40.92.64.77]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90E4C68A43D for ; Tue, 12 Apr 2022 02:50:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GQi6uENrEf0h0n+ogI0zdu3LyvWl0ktUuEiXQn4586BuUlfHb97v1erT8g3o9YPPekWIpbO+CP7kqCYQznFsvALXFlAqOnjsBRoKJ6GIWwall0BYZoiULF7VIsM8zM6E2LUB3z5BEH0Csg3sUXSkZc8lfJ9wDxTDdaN8WefQg2uaRAL4rF1nLEFEUoIaIqsY2dFu3+iYruM5bGHqFVJgiFJYy4ivKQkyGiRLwBAun2wKu+kMMnrW9UOMRrNa2jlIlDAMeamyFQskVbZstCxU5tCANVv1ZYDMtSj9YPEN5twjDaj4KFfg1ugJJzBCdHOTU8VO1jBnEUF5aGLE95qIKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2hh1B/u7reltrdldvu/op8RRRBZEBsrd2Kvv+zVMZ3M=; b=G1fyqRpsiwWcLNBMDINhf3NcoJ7hrXi9no0dsmGpWyy7YrXTbCmoslgUlz5dLvRViA0AQrZkbpOnSHcfUohbA6M5qtTDxkTtyUxOkN2l8npaRD2TFe8m6SokJlutw62nslnFT16wo2Kcz8+IC4tz8OYhNtFq7MsfJWMCRO2LZBaWj1UIL4ZvAsL19EOrcL427DCLzBzllXgX5G60U++RwjtshjhH6dJaHcd6sD8RZtXXlbw4TFswwh/4XgURKoQSrgb30O/yZ06WIS0tL/fc5yJvpj+U8gDFx3RMQh3Etu5W/1sBOrwQJJDmPmO59VIGMQcioJ09EtdS0mGIPH1hDg== 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=2hh1B/u7reltrdldvu/op8RRRBZEBsrd2Kvv+zVMZ3M=; b=I9WqIn63khBR/hksY/2dXZ5nlQoIJoHSG3QN71YPVxx6wQ3r6OShAXuEXimIjodyDby9Wt1H7CiWcF8+OrqrkVCzxRCBHz5Ic/HI9YDJsRoq4m9df9mJ4d+Tc+aI1S/Y58mk2w7MD8jyGZERqLoPQPLLJwaHyF30blWa7tBZy14TU6vdUq5A2Nzo7c2SoBr6whvjDFIBBltKFKDGmoHzaE8err9fopM/LPEAcI/SeNL4gXQXFBHSi9cU3C+pKPo9i3yG37fJmKti2kYe44SFnz+v6wO/RInTBgnzTEa0FaauV8EHapwMSUs5kuguQW6UZ3zd5M4DY+YBRkUWe1e4fQ== Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) by DB9PR01MB9977.eurprd01.prod.exchangelabs.com (2603:10a6:10:300::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.19; Mon, 11 Apr 2022 23:50:28 +0000 Received: from DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000]) by DU2PR01MB7950.eurprd01.prod.exchangelabs.com ([fe80::bd41:5eb6:c582:c000%7]) with mapi id 15.20.5144.030; Mon, 11 Apr 2022 23:50:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Apr 2022 01:50:17 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [3t6O12DMOoI5/PkMKpVkdyx0ank01SaC] X-ClientProxiedBy: ZR0P278CA0060.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::11) To DU2PR01MB7950.eurprd01.prod.exchangelabs.com (2603:10a6:10:239::19) X-Microsoft-Original-Message-ID: <20220411235017.316325-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9bae4b82-72bb-4b81-e920-08da1c160e86 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiThIBhrdRr4cDPWJ93ZpY+lBfiehFlS+IZzO0JV7Os/I08qxkjnC+pk+vK8MmeCdRvx65xYbph+HHTvz33tzmE1wzwbhbWCD80WjSjkohdZ1XUQSEmogAvLNSf3YcBkivyNGCuRRCclI35BoXOx3LEZooKB1Cfh+a6c/9tUApnFWdQ4pFuf5N0mJy1S3wuNiTx8HNUcy5vprSboniAShPbbwGCVBw+A0GuDlTGsdfVnCDTul+z75eUPepUh/iSRGK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9fmtjnQ64GcmYrbcdv7Ct5tHP5qODWM1QDHYHTp5DjmWHXtSwtQrgmVLuJP/S+O6Fl585h14/H3ZgCKKb4AmrXE/ZYgbsXPyGRi00epQb7+/AmU5Sw1pCDx+e7xk7O1BPeaTkD+GfBLyI6M6rK6IrCiqkHMvfSeCsfo4NY33GXgfFh5mOfarzWvXQkW+M57bHTSz3vFoT1JU6mB0v6GyDpMUVGEkz1zdp152CavC+PxifYo6YkfKQpUx9EmWCMVcFQ4/Z33YoKJgjpQIt9H4E7pUFMgv/GgMjbPEqKs/v2KUYMAf8iOLKpkohdlQMdyH/S7vb0tqAlH0aR99Ru+km+IZ7MDYqDV5vFnzkl1YnO2Lw1NSp5Qn7nrEV74tEtVNLnBjlhBRcAjMWxhTVEhzM5GjvqgWVrPY33vuCmn8cONvksuJVs9BVa1/QOuD/tpJOLdcHoNbe9g0KRPmVOkB5pM6xNVryUV3VNP00ox39J4eyx53mZMv40XzkZVTrlGQnZIu62ks1m2dB44xxek19PVA8HuKcjA5rMVtiVT86h X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bae4b82-72bb-4b81-e920-08da1c160e86 X-MS-Exchange-CrossTenant-AuthSource: DU2PR01MB7950.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2022 23:50:28.7739 (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: DB9PR01MB9977 Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/mjpegenc: Don't unnecessarily grow buffer 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: ZwUFZCaapdbo The size of the ICC chunk has already been accounted for when the packet's buffer was initially set in ff_mpv_encode_picture() and the header (including the ICC chunk) has already been written at this point. Signed-off-by: Andreas Rheinhardt --- libavcodec/mjpegenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 1e9b97535a..8cada8366c 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -131,7 +131,6 @@ static void mjpeg_encode_picture_frame(MpegEncContext *s) } bytes_needed = (total_bits + 7) / 8; - ff_mjpeg_add_icc_profile_size(s->avctx, s->picture->f, &bytes_needed); ff_mpv_reallocate_putbitbuffer(s, bytes_needed, bytes_needed); for (int i = 0; i < m->huff_ncode; i++) {