From patchwork Mon Nov 21 01:03:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39367 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1831187pzb; Sun, 20 Nov 2022 17:03:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aVf9vYMdBEUs3U9YyHahbw8w4ta5H7bZpUiOo5E8vbH4omige5dLS2M30jDXclJ+Sf+LK X-Received: by 2002:aa7:c841:0:b0:45d:2a5:2db8 with SMTP id g1-20020aa7c841000000b0045d02a52db8mr1690780edt.105.1668992612059; Sun, 20 Nov 2022 17:03:32 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e12-20020a17090658cc00b007ae6869f9d9si9873359ejs.419.2022.11.20.17.03.31; Sun, 20 Nov 2022 17:03:32 -0800 (PST) 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="MQs43/Y3"; 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 D336F68BCAD; Mon, 21 Nov 2022 03:03:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064073.outbound.protection.outlook.com [40.92.64.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 13F0568BC1A for ; Mon, 21 Nov 2022 03:03:20 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQYcl0fSQeHAlB9Ns4YgUqFOc+L8Gg9ZjVcb2m8xEnHAr0gY7bXbgEk3ZeMUs2VYgo2B/q4mBZT6ESuoVTgvuG1WyFpRdf2k7ZmtgCPKFig5pQe5QvGmnvqVjvCOVPtCwyd8HLgkj3ACkFj+v4hH8/+L4Y+fdmM8zO5TH25Tjd1f+1Jf0iUAZg3fbEpyaOrDiy76lG190cD9LQLuMsDGLCqlwW/fewx23jfaeabuqvGnm3b3m10kgMgRv7Cltt0uJSHP3WjKjenCd892bbQTArH3N7vZhK8VyeLyTxp25WXk3RM7NifJT1k5cZtzkAQaCxU/Gca/p45IWZ7JhNCj9w== 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=hpuX02MX3ReTp60dqZ54oABSpNSVJVDEkOtkoHnOlNY=; b=Uz5/vfyKZuTxNxl0y8LfS36H6SfKUXjcWWbqOm7gYPy5Q0APkx+b9OZ69otLNufzAtDH98LBlIiQQGxjeY8gD2rakWZYuSx1IJAtZOm3l/JegYDyk00mzks4rXYJMiw8WDFNDSu5xhgetepKYOPpB4fhz9P1VV5Ckq7fDsO4Nx213+2XBY1exm83PZoqQbZ0mwu/PNOsBI+2Hn62aiIjeyD7wJD5R726AgQlghFhHAmQ1c3n65/2qGdul3KO3vDw9bI61JUycPfDL8Fb1DdLRrWx6WNYnr6nWmeP3KYjaihP3PHTAlbAdNLWk7LnIm6btR4v24gGcpptLr3OxfkP8g== 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=hpuX02MX3ReTp60dqZ54oABSpNSVJVDEkOtkoHnOlNY=; b=MQs43/Y3kaJ8nwdZ9HE8aLsy7f5uxxRkMCmhJoqQywdJ6UpnC2gLZppxNAc3sNf0+b1c2FZN6WuGgF+VwlALGm1j8e6RQ3S08TwlYGMJCxpFwSo8jRF4BDYZgdIjhbClOWyTvcVZwYQtMSCHrWMPqdeIW9mI/TPX8pz7vwr7ZHDL7mOGyruFn5B1k9qs3W7P//b8ufoCok7ESC9lImaKkRMsk+EedsG6KApm25f08a/NlWh3tBwbKkcucAEO1sILb6vKEAqaHyoQKBgM0IJbL3NqYNPCpweJmFkOsm1P+UUnHlB76BppWasEuizx2kQiCjUktdyfSghnflDV8mbkpA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0465.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 01:03:19 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 01:03:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 02:03:25 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [tFKd4P7dBfIn0rs+bDMwBgq6AZm/m25vNQl54SQuxEQ=] X-ClientProxiedBy: FR3P281CA0151.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121010330.2131526-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0465:EE_ X-MS-Office365-Filtering-Correlation-Id: 01685bc6-a02d-4474-7901-08dacb5c2dab X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmo0aNP8rr9jcp/TekB2Cf+UGEm6saw4ic7gH3h3YydOCPlIMndbldDkxHoYlHzSR2XJm/GGgOQhhIcTbU5C5vvnWXt0vjSSfFfM/gGkdmrS6Zlw1jmvuUneqof+7Lvpl/kZmxeH7LK1YUCkNVKYSGmPoeLjBamPKXu2KaciJ3xvCCz8lyAKi846cxZrZQqVydK2G67CaHuE0bBDoB0WoJHk8VY4FgRcw3mgtTgZ5ern3qGZP4c0SIxjPD8bGGyyH0qpJJs+cEggxW7JM9eYyFeE7v+Vth851GEPTq83n1XCGFWImDG6C/Ge6n484b2J5I/nyw+6KXgerBhqSVtggSe4rPMYNiJZTskVS1dX62UCP8OAHeht1NySJJb0+mIGdxXB5wjCiHwDh+kQffBclLdzcwegK442iejOnwYzI7aTnffxGirMWSUGUjsxWlKamoSxeLBOxw0qdXCoGtebfy6ymod54vEqpRdoXQPAL4bZKKj+zXeajzYbjr3nNiPC0IiFVD48G4xnKzbbdZmj1oHMicQgluMgzBu1BMfqiCp0TkNLyWq6+TMtm1474i0hqhZgTRVIZzdmdbMwXtWtjVgrcT06ybJrPVo1yqx2Z8spq4n7H3ZZTEos8ouB97UobumJa62j14aqdXdKxjryKn9bqRd1sGQueZSR681/XA1Eoaqg3T0Ten8JzYgcp7qLVf+bRbqVvoUkruFq5JH1H/7pbdLcoB27IHXUJH+QbsbHyICXVUWFddRgj8zywGLH/eU= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B1zT7jdQdrTwIhX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uthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 01:03:19.1707 (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: PRAP250MB0465 Subject: [FFmpeg-devel] [PATCH v2 1/6] avcodec/flashsvenc: Fix packet size calculation 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: UXkYvHlUPtON The earlier code did not account for the frame header as well as the block headers; furthermore, in case a large part of a block is unused (due to padding), the output size may exceed 3 * width * height (where the dimensions correspond to the visible pixels) due to the overhead of the zlib header, so use the padded dimensions to calculate the maximum packet size (which is also what the actual call to compress2() uses). Fixes ticket #10053. Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsvenc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 35793400fa..4cedb53fe4 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -54,11 +54,15 @@ #include "put_bits.h" #include "bytestream.h" +/* These values are hardcoded for now. */ +#define BLOCK_WIDTH (4 * 16U) +#define BLOCK_HEIGHT (4 * 16U) typedef struct FlashSVContext { AVCodecContext *avctx; uint8_t *previous_frame; int image_width, image_height; + unsigned packet_size; int block_width, block_height; uint8_t *encbuffer; int block_size; @@ -100,6 +104,7 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx) static av_cold int flashsv_encode_init(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; + int h_blocks, v_blocks, nb_blocks; s->avctx = avctx; @@ -114,6 +119,11 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx) s->image_width = avctx->width; s->image_height = avctx->height; + h_blocks = (s->image_width + BLOCK_WIDTH - 1) / BLOCK_WIDTH; + v_blocks = (s->image_height + BLOCK_WIDTH - 1) / BLOCK_WIDTH; + nb_blocks = h_blocks * v_blocks; + s->packet_size = 4 + nb_blocks * (2 + 3 * BLOCK_WIDTH * BLOCK_HEIGHT); + s->encbuffer = av_mallocz(s->image_width * s->image_height * 3); if (!s->encbuffer) { @@ -229,7 +239,8 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, I_frame = 1; } - if ((res = ff_alloc_packet(avctx, pkt, s->image_width * s->image_height * 3)) < 0) + res = ff_alloc_packet(avctx, pkt, s->packet_size); + if (res < 0) return res; pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16, From patchwork Mon Nov 21 01:07: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: 39368 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1832936pzb; Sun, 20 Nov 2022 17:07:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ILHGp8OMTwzKbiW5racGkgZXCbCR1K10W38thUvcPHjYGSimzq1leCG5/SoK8XO1vNjeJ X-Received: by 2002:a17:906:8a6d:b0:7ad:d18f:c2d6 with SMTP id hy13-20020a1709068a6d00b007add18fc2d6mr13831288ejc.271.1668992835090; Sun, 20 Nov 2022 17:07:15 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id wz12-20020a170906fe4c00b0078dad3ace2esi7737205ejb.676.2022.11.20.17.07.14; Sun, 20 Nov 2022 17:07:15 -0800 (PST) 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=XhviMtgP; 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 48CAF68BCC2; Mon, 21 Nov 2022 03:07:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2059.outbound.protection.outlook.com [40.92.49.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C9DB968BC28 for ; Mon, 21 Nov 2022 03:07:05 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EkeFV8ecQ4KmgCtzJwGF9a3XA67PsHAz9rwPaVg9phT1zXpqgFjyrNqJF50VjVBx/TGuzxE5wFSJwYJnxg11svco7EKI9mAt2GcmITRhzsVuXGNGnjN/tQgxosoAkqZ4Nk6lLuuxfxK6NsGLMYL0/2bd0ER7IeeZw9ETriPNeQn63f56Gyo7LJ97jNJWXazNGqe6MQjw4RADHHkO0ZpvCxqyvM+uz/ZbJuLEpY9099CCY+wRH54vC7/bACg63z4OOL6qW82jXgk0T58CQmUi1YnPkHvIagbX5qlKFsLxcavYm9b9AvS3JFanfd/0pWz5nhrjm//VsyH/W6IK48n6GQ== 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=BUDye1wQlQDFwmcV/2a3gMp20E87cM0oBHpRBCULDP0=; b=V30pyAOAcGz02X5ouuzpHfiMecBlqsZHUUI2VCbANNzO8F7gc42YeDpl9npGFr/Px/gWUg4BeMaOIhZBbTrywYHSgk+aUZQDlNlFqApzyr6uG70ykgX0eXX3QoKCOW0PJd2JpXYBtUJAnX6nEpyyi7ije35XZhWVO78zQmJ8qqmcnbNaKkd2UWTvyw8d08tJBGRt//MuHO/H5YMTR5XIRxVLodxEVnJUR5194o5+2wp/7e7XkQ6aVOXqff7IUAC4JyywU3m9o6xAMyrdV/rpKeSwd8ypaP8pbPTJqY5XIoNV0cgDdhAdHr97kAJGPX5BeMEgtHLyZIF6MuZhsPrLRg== 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=BUDye1wQlQDFwmcV/2a3gMp20E87cM0oBHpRBCULDP0=; b=XhviMtgPtECh8I3H75kKzorKaaQR+gGJ/6bN6T448W9DsHrrfe8Emku25HCJLVdRs24/Eq6rCYiue1GZ5Xcc2KhTBsTeW5Y9Y4Htmcz+cY8nWvGdVpfWAuMng+0BhVpNnYj11RPjYg//PlMRal99N3PAHy9ux+cYxMiYWJLj1LaesGHVLdM5FDSI+DGc6EqLBSa53qr6ebcGTlf7M/WOi/nTu5jEimhv8lJxjo3Ipi54y/DDN5z04F1oxf3xfih9U30CrwqEa7nz3AloM3fp14/b31/s0skca8LSHiTf6kxOTRNz+bmQA+07pmAE18iMuKN9+cmd9WL61dR0Z8T3Ow== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0465.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 01:07:04 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 01:07:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 02:07:12 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [BWma0DhIhiy024B1dTt3/D45l5C9R2iU/YgFtjK8ovs=] X-ClientProxiedBy: FR0P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::10) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121010716.2131624-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0465:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ca3007b-8e9b-47ef-6c9a-08dacb5cb3df X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmo0aNP8rr9jcp/TekB2Cf+UFQhkRb/8/QdAxxZxs24GMSPWeIbgayHIwMyOnKpGFW7CrTnXXNbP/628Jk6pF8RYfGO2baeskobdW+LaVbfuhEl4a0ywUgitBBCLFni1JBoK07K0L2fhWkUF83mpYtfzH4u0AgR0o1FH00QyCxtA5jt1k/IpmvZkuS6TkmhdJpkjlyUHIDzV92Evlb9FwB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MAIwAGdv7M3ja6p1x3ZLvET/7M0eDB4/03Zj0FqfbKkmoyNUThrOLslafNBAzKfmOIzyaKxMPpuYcrOoYN9nuLArQh9U8HdRBUb13+2L38OSDT/qEhkh8Kh2N30HWuR3Fx0TQ2BLYO67fqyr8HuuA4c+SQKqUj8dnduqCjsT3zhK1t+q4ktVgHGYL8DIiv9Le6pHD6bbAY4dF1/F11CkZDVa+EK6ONP/h5twIV47VVfILZsG8PJxziD5ZNRI2SXtniU4HxFUEVwYU43ZR/he5cugCmVKwNDQD/8qu+KJ2D0Dd0B+og8oHkvODVZ00U8rawcKStM+HipPtcMgaXfRDAlRTisSsxr3EjgZVMTJARSb4CymHXOg7a/efh+HYy5T3eAO9uxou8RglrJK4i+WrnTmZMSilmT1J3OI4FLKKh7UcCjGp4o1Hiuv7YyqnIj2IgRQuSPGpM5MwnbwcyLPc6u+R5UYaJCtE+aBsSsjYE7MZVlOCFs+KybZUt8bveq1tL1meut/hmZWXKvQJ2+ckGwtRx5wGue X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ca3007b-8e9b-47ef-6c9a-08dacb5cb3df X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 01:07:04.3727 (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: PRAP250MB0465 Subject: [FFmpeg-devel] [PATCH v2 2/6] avcodec/flashsvenc: Remove unused 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: yQU2Gx5hR9A0 Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsvenc.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 4cedb53fe4..d627b12351 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -64,7 +64,6 @@ typedef struct FlashSVContext { int image_width, image_height; unsigned packet_size; int block_width, block_height; - uint8_t *encbuffer; int block_size; int last_key_frame; uint8_t tmpblock[3 * 256 * 256]; @@ -95,7 +94,6 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; - av_freep(&s->encbuffer); av_freep(&s->previous_frame); return 0; @@ -124,13 +122,6 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx) nb_blocks = h_blocks * v_blocks; s->packet_size = 4 + nb_blocks * (2 + 3 * BLOCK_WIDTH * BLOCK_HEIGHT); - s->encbuffer = av_mallocz(s->image_width * s->image_height * 3); - - if (!s->encbuffer) { - av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); - return AVERROR(ENOMEM); - } - return 0; } From patchwork Mon Nov 21 01:07:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39369 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1832981pzb; Sun, 20 Nov 2022 17:07:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5jzEOk9/ZANg4MayAiXlEWSR8hHeX/vHbAWF6wmNoT2kKjjow8mPqm5A8ijyt1F15p/EZl X-Received: by 2002:aa7:d999:0:b0:461:7f5a:e04e with SMTP id u25-20020aa7d999000000b004617f5ae04emr5746912eds.389.1668992842385; Sun, 20 Nov 2022 17:07:22 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sg34-20020a170907a42200b00791a7e441a3si8560824ejc.459.2022.11.20.17.07.22; Sun, 20 Nov 2022 17:07:22 -0800 (PST) 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=a+yWfFHD; 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 59C2768BCE4; Mon, 21 Nov 2022 03:07:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2059.outbound.protection.outlook.com [40.92.49.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E350368BC9F for ; Mon, 21 Nov 2022 03:07:10 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmL6vxN4xPzsZm9GbUpjj8gknonNVuFXYN05FyF6JUVYICASYF3LKhbqIXHcEdbybnvanu9pJq1INzO1o9FLYb8e7VtyGQ+C/14AT43TMBw82JIE9RA33MSHo5fDrIB5bfYcNzYICBcq89Gfy3W3dPO0SNxzu1YcEoWs7eXSbilTNjZgbWYWZgNcRTQ2AywPDP8AN5MaeIN9QGzswYoChUfb61ASRfv6I5rDfC5PskaHE/ZmQuzIavNp12j05q2cA+6fG771mgPBlKvM9C8FIkTemkaanD3oJAqrz8zfYv5DOvxhEvkCfxZYKnfimuiLcaw/DSN+cxFNSC+YMtc5Sg== 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=0j/bkwNoZfKgVVmyUfzlzpMd3wIXc39Y33fSZ9G5U6w=; b=iQCJjiRfv64OhL36P2w+amPeCTOP4mgjQOe+KpPhGfqi+u7eCpnvGJteIRwPMfw6xSf32yGN0CJi7mIoZ+mL3Pr3E9Yf5cN96k9u5PE+u1DU/4CqoojKN+J1fH8QdwjfkxGVohufcnvK/yhcHbhKHhgr1JLRRXMeXgsqBK+qGZEQDgkqPss0uuBEBeLhAq2n5jpIUobvhxRKjuTSwBTm2pYoiuFcs8fPPQW7WoRV1ywZ/e2mlQihv5YA8dL7kHKXqX4azARbzDhE3SgHnePb9k1wRA+VMP4AOPU7cDd6cjd5f0ZEEBl/4j83cdGC0pK3n2RQIA/t6aL4ZlQiLfZ1vw== 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=0j/bkwNoZfKgVVmyUfzlzpMd3wIXc39Y33fSZ9G5U6w=; b=a+yWfFHD4A+F1wTauhzTsG99K+vEH4QQzfeyUFyT13moGOtFPY8cTiTlfgzT+0hg6wboc6/eTEBKKbssxmUZwNWwEQatM2mSBuVeB7WhK+5lmDKIA/eJ5WBrVZ+1uPxiQXUk6dXo39xQ2zYadVUst4Sn3Cy62EPeony+ZJ1vqINiu4IVC/bvEa5MUPmdH0iI1H1EceqrrEfC2r/E0ZxTn3KxooZ/WeHYabbuuI3biHP0kb3pu4u/3gQDKGDCMj05IJ01EOBElHOZAq7YSIak4zt64Gh+Fo/dBAcoUXmLncHpM/OXsZGFwAJ9NV/cZWUFbN6ARjhHt4nnCY9VGp87Kg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0465.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 01:07:06 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 01:07:06 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 02:07:13 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [OW5mwRmvAws24jvoYIj3kDYUJsV1Vtrauj3yBv7QCdU=] X-ClientProxiedBy: FR0P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::10) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121010716.2131624-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0465:EE_ X-MS-Office365-Filtering-Correlation-Id: a12ead8d-9ee6-4deb-295a-08dacb5cb54c X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmo0aNP8rr9jcp/TekB2Cf+UGEm6saw4ic6CccCQ0iG3JWwn9PT30zXxahRb0ehm5iac/rkkkifk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heevoe5lPkoLQdA62VVMlBCYDhChFvSzz83TkjnfeMxtGueonJZmOBBGIp/e9Srutpar19DibDWmCnVw8xfJ6aIV9TXIkI3n2J8Vyhf9XXwA2f1psAwZmLolYwhhEitUy5jm1tvmeIIPfNlr18Tc1sSftDDsADwtIqkPq2yP/Cs7/WOetaq6NQTkRO1bwmi0Y0wFgl8Rh7sUFWaTTEFpiqP543xNO/9GFKW3pXdLsKhhbRLea9+mkGLOq9U2/XnMK0yMzmLJaP0uDAZfoEMFyaziXTxcTD7jvXDx8JQo2DSksezxYkfjQovQo6QQIvaG3MkufO/86LioeCWU9T9gOeNlGEe8qxv9/payiy/RgWMkTiOqS1lY5g/Y85gYIlBW1/72zP9ckoD279A4uE0mwqfGnnmYTc5naGDHWXMEXAH2J2tJgW+jczxhkHkmr+2W5P1TWJJK/n+aIltb1iLw3Ayr9XMh/0cFYN+1gG9QUorqaVyUUtluC+0d039dN7yEM/GLFTYXJfXnLlLNGfacAezHr0yMUBHEUc60Nc57+zn19oGu6EnU0EgKqp9LpIX16Xp1LlimKwJ2cT5QNVXkAekyQijAFd42pg5JR6d47wN+MC+soE/H9Q X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a12ead8d-9ee6-4deb-295a-08dacb5cb54c X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 01:07:06.7006 (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: PRAP250MB0465 Subject: [FFmpeg-devel] [PATCH v2 3/6] avcodec/flashsvenc: Use const where appropriate 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: JojTHbBFRKM5 Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsvenc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index d627b12351..bd912fb401 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -70,15 +70,14 @@ typedef struct FlashSVContext { } FlashSVContext; static int copy_region_enc(const uint8_t *sptr, uint8_t *dptr, int dx, int dy, - int h, int w, int stride, uint8_t *pfptr) + int h, int w, int stride, const uint8_t *pfptr) { int i, j; - uint8_t *npfptr; int diff = 0; for (i = dx + h; i > dx; i--) { const uint8_t *nsptr = sptr + i * stride + dy * 3; - npfptr = pfptr + i * stride + dy * 3; + const uint8_t *npfptr = pfptr + i * stride + dy * 3; for (j = 0; j < w * 3; j++) { diff |= npfptr[j] ^ nsptr[j]; dptr[j] = nsptr[j]; @@ -128,7 +127,7 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx) static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf, int buf_size, int block_width, int block_height, - uint8_t *previous_frame, int *I_frame) + const uint8_t *previous_frame, int *I_frame) { PutBitContext pb; @@ -204,7 +203,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, { FlashSVContext * const s = avctx->priv_data; const AVFrame * const p = pict; - uint8_t *pfptr; + const uint8_t *pfptr; int res; int I_frame = 0; int opt_w = 4, opt_h = 4; From patchwork Mon Nov 21 01:07:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39370 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1833053pzb; Sun, 20 Nov 2022 17:07:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4naeZfeDdw8LxcXnhHJvpdMyWoDjhu2lUISNu6A8vgDNyGmZ16zl1k4KZtQIC5Ikue9LxS X-Received: by 2002:a05:6402:3895:b0:468:15f1:54b5 with SMTP id fd21-20020a056402389500b0046815f154b5mr13985197edb.8.1668992850958; Sun, 20 Nov 2022 17:07:30 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z8-20020a05640240c800b0045d523bee48si8764084edb.178.2022.11.20.17.07.30; Sun, 20 Nov 2022 17:07:30 -0800 (PST) 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=iMrwwAbz; 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 6B85868BCF8; Mon, 21 Nov 2022 03:07:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2059.outbound.protection.outlook.com [40.92.49.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 08C1E68BCCD for ; Mon, 21 Nov 2022 03:07:16 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BNeUivBtrH2oM8pKcNsWXkhP4hRMo+KxNhqP6Mek5sCXn0/cnzEbuVf6Kf+/bHSuxX4sajYTFq01/HtFfupmPenzA0JJOckvHGal3cE8Y21EU9F4XJdbHEI0c9tvoWyawYdzRw+8WFE3KOXoPOqQ/VLKqJINV/osmiaKDysYf4tzrGI4namoM3z4dcPdfdq5bfdN3zFHCyl7UkrgPmCDQhvREpUO0skUrwjuC5/mnSncYWJpDMxVnoB9WtRp4IOZ72GTzdFCHN55ctzJTN7j4DD8KLNpmdWUq8zar2dHfo2XJdp3aO+rYMUY3zbAs7tfu+nGqMnb7kDwiNVn1ICMaw== 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=mg92jMrenUw2sR4AD3OMhwKLD1JKmdz7RgRTgQRS2g8=; b=ahi+HROjUxiro7ub0jSaU7XmTYNrPaJ26yApPIS42ZifEC+/WkQV3LaIgzSq1kF8doGTAjpitIpRSBgIXyijtGogeuzk2vZhYx3q6e0aBSYI3ZqofMlJ/Z8K59WgE1gCOLY2WnM1dNTKDQAzivZD0fyYaJb+tqSbdIjvN3YvC2ph/CkE9XgdLknJRhAmQGMvPUac4J2vPGFqVoH1dU1pD1b0B3WUhonT9SmoSkd6i+xsZ85dPQP8I2SD+sTU92heYOTzq4LvnpfxPQkUt8YQlMAJXesyCSO76V71vhJErDD7sN9bWSwrI0IjU6WGO+4aKBPS1FEOpfzMijwO9XbJIw== 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=mg92jMrenUw2sR4AD3OMhwKLD1JKmdz7RgRTgQRS2g8=; b=iMrwwAbzML+nzA9JudqCRlU1vZ2Ev7cdKH1X3T7IqVf2mArRafRc+7wALPfAziQocz83qVdFLw8f37DwQKpVvyTW/iZSxl6FR90b14HSWEcpRaWpBbysthxBo0T4iw+I3dBESYgemLa5xGt1onagkv8rSkC2S67uA55YDoj7hv4l0K77tekXrGYikXfu+BfEEgTx4CnR3sQ+BcUoX6M411FVWaP/XyPbsvn14+63OADk13xq+/Hfy5TzY6rtfZo29DICX81o4qqCBdfv/ykUWAQ5b3Vpo1EI9W8cGoeKhcOjSx4AwZ4K9XfzhxxiKZJC6Jovh2c/PwIHZ6AbN89sug== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0465.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 01:07:07 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 01:07:07 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 02:07:14 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [/FoU2hOsRUtHadSfMv6T/yM1O6Z0qNn39jk79iTR6oo=] X-ClientProxiedBy: FR0P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::10) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121010716.2131624-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0465:EE_ X-MS-Office365-Filtering-Correlation-Id: 49c490db-a1ea-4a9b-1547-08dacb5cb5ec X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKw9/h+mHxnUXPC9/FuzQkCX/f5JQeEuPef2E9VHDCLya2WPU/LAftFBiWkEH6O0pxyUdzbNTUjOA2+KBc0omJSMAvGZ1PbJ4OOpJOYowzouHjtl9eNVydSlVouMRVJ1duN5kbut0fwZ5qRVB0XJ2vt1/NJV2lPH5gTFmg8KWLN9aBqK+K0vDunHQdjHVSBjlP6frG955Dn+5XISeBlTBjjCflxoSzLS58cCrwyJYV8AwdNdiNonYOgSB66+MjUGxvnoIxBrzKqYf17i0zZevYGFGj1bEZZaK46DgReLxkdgeDIT5DAOUHd1MFOwKYtv1uRABleCb1d/yqPAxLf1SVXTyyUQgOuh80Zh+5d++rw6MWVRmhq4RfFyS5qj7U/R486BkQoeUvEqnJb7eOQmUn6BwLprIUh2Hv9TsGs1KmJ15wCYoqf0YYCuZEgrUdHpiqHBeKR95WvJO58OP4yY5K4eRuGkU8Hi9y8gkm0f6s6dLPr1wohzDBU94KoLd/mFgtcsnho0CmWoFKh8I2EiI+NYjNip/GCxVngBDArVGvT9ETRKfdkg3RR/Lfm3gfdl6xyeGxqWnP6tWagk6k3IGuvSMJMpWAelfIQizmG2HmwwLbmCCfxwfBGCSVXbkWd8kuHogjI/vdGdHEjaO1lDLiRQellvE7MDG/spI+tw3eFgHXvwl9u4c+LxhUC80Dlp5QfJSJQYM3CvONlB+ksNU8f4O71WNv42e28= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h0Wq8PZDIGb8VOQ871xH3tvzq4FiqsZTjGEUunEESs+gX/oLBzA6XsRdVsYCgR6s76iMBRO0WAVCaEwsRKOcXfPMwwSIwWvoFbg5YALxQxjrIZXQsGVZIobXATa9kRulFUphysrodwGoMC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B7eWxsIMmIqEFur1mbQgBPAKYxq0ZL9I17eQQRB+Cs1t5UEjT3dp0fk8tQiSH92cM1HPDLNa5ngLxIVScEpWlGAzq5LnZvUbpC5rXsS15LhUkhTgwbVcrhUv8RI059SWgL8bjY6m+R9jc5M61ztynGHi+YzZoVxXBAS8T52kwXI9N1mGlhjULVhzeo2Gj9Vtq+Oyx6+whv3PZ4MKNss2X19IROuY4jMdyj590yEk44h5hdf019oF7aYfoZ0YRnsKs7kXuVT9ueCP4HuQ0dDYPl1YuDG4qoJ+vKdZtJm8TdEFH8nEDZ8c3+XMl9ukK3QuRjFV1zek+dLPu1IS2hTuwplWIbkV9+zxd4WC8AS1+e78YpAhfIP6huJ2UOqDaARNF65bD3/LLYswZuQMb8MocL/dhaGuhjXMDKtiavpYKaGLhtqImXXKeP8GIc89DkDRJnBQ+xLEgoP7ia2oMXnb0A/SdIB8tkosWh6uUWkp2OK+irgSNTgVCoLKHLIPH2xF3cShjrPghHPxroGn/rrvsUT6SDJ/K6VJDxgCZfU48zHkE/9t/dHENAC9bnf1KIkmdcC9oJCmdXTex1nd63YTclJtcLWrLZhSHNc603b1R0mNKszRNNyYImeIIVRQHsqQ75RGdZaV1HqU69f0MD2CW8XxC3U38BVBkGxmRuqIzHCpvgRAhyjBOrPINLT5fg21aU++1G1Ysg+cY+dKTbF5cPMBPEyperXIysiRx6flWREN6N6OtYVwvtiQ7rBIuMjXkjDcmRWR3PHLVpwDFXG4hSdi6YR6PXhmTaOUD5SwVsf/x5vkaWFKwj8HX5UC2P1otIkSpo+cFEsjvFh5 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49c490db-a1ea-4a9b-1547-08dacb5cb5ec X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 01:07:07.7955 (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: PRAP250MB0465 Subject: [FFmpeg-devel] [PATCH v2 4/6] avcodec/flashsvenc: Change check for first frame 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: RVb7TEGxbtdi AVCodecContext.frame_number is actually only incremented in case encoding was successfull; if e.g. the ff_alloc_packet() below fails, it won't be incremented and therefore it is possible for the previous_frame buffer to be allocated for multiple first frames, leaking every one except the last. So check for whether there already is a previous frame instead. Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index bd912fb401..ba693ca8f3 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -209,7 +209,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int opt_w = 4, opt_h = 4; /* First frame needs to be a keyframe */ - if (avctx->frame_number == 0) { + if (!s->previous_frame) { s->previous_frame = av_mallocz(FFABS(p->linesize[0]) * s->image_height); if (!s->previous_frame) { av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); From patchwork Mon Nov 21 01:07: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: 39371 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1833108pzb; Sun, 20 Nov 2022 17:07:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4M9CukIXfYE4f5iYQhy9z1PwpANdiK9tAUrkmQ4GJ+cyqDV6X4pYhF6W9wbSjtFEwhxGPl X-Received: by 2002:a17:906:9f02:b0:7b5:f5c9:b450 with SMTP id fy2-20020a1709069f0200b007b5f5c9b450mr2690859ejc.65.1668992858105; Sun, 20 Nov 2022 17:07:38 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f21-20020a0564021e9500b0045c3f6adb7csi9214389edf.215.2022.11.20.17.07.37; Sun, 20 Nov 2022 17:07:38 -0800 (PST) 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=hIE0aKIB; 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 8E83E68BCFC; Mon, 21 Nov 2022 03:07:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2059.outbound.protection.outlook.com [40.92.49.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 21F8768BCF0 for ; Mon, 21 Nov 2022 03:07:21 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=njoNyOTcrnEWnN9aK1MkhGeL8i6zc48WyGEzQP1cEDDy12obQkzY9baUtO0ce9xVWgdmEUBPz/Qmda8vrrIe0K1VcmuMt86JpkaVi40hOKnLxioj+RREvhSkfU/2Zt1hjTMQ4kNwDeVTgZdN/R6bny4AQfA2q3XDtHgYS9S42f3ZmRUf6vsX6nYIpcW/ZyhR7gscnfAnZoUe5R6B0xJAb0sUY3VqydbwvRj+mfzpf1+zpCxsE0yUrpLj5uizp7essdLsudppbPLyyI4wYUoM/7emI/Zd8us12nMTazizJ/MF0UH73eXaem/kG931aI6l/Lb46wWjK9fz5C50yAG1dw== 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=QOwbpkQjeySyR5Uff10erHqKfDfTXcIkUuygMdhwuqo=; b=HSF/jJb1VkXyZG/Jy7osY/kjnCG2tBC2Ok3DzLdIKI4bjfzrvwtNwcqMsXtQH42ktyZd7atlyge4OgOrxJmI5CE5meQeLBfiy3O/fFF78IpYowA5AvQ+FTuGZPBLN4TEd7w3nleh14DAY+UMdAjQiou+/8sUMStxBJjpR5gSNOz6El37uULrjdAm/Rkly1mHTYIPDtH4f9fw6dO69UuD6dZJM9lE1vvKwzwgl1da65uTohS2Hlsst7jpd/5dIBno7U8Ax3Cyod6bO/7WUNncCo6u5+GOGCP65o1VN8rpkP4a2jRrE3+4bio+svz+XXMuA3wntKkLiYHtMhuyyxWwjQ== 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=QOwbpkQjeySyR5Uff10erHqKfDfTXcIkUuygMdhwuqo=; b=hIE0aKIBQgy6FcemMkAEWzz/DdVHSsQJI9yLK/UiBwDa1FyRa45bZuxLsPiKFINvxJdOi27ubxxHs42csPksaRy38/XH3GYbwgktlTleA1RKfvzt2sLSYV4mVKN/eLDFCsqqu953aqQtdwMlUyXrM8XyIzqvB/xXYe68MWT2vAJMID6JEClWQDsF89E6aUZcnHrC7dzKogU8AtkJrAYIqx9c2L0WvygSD9ttWwjJ7nKFAZftj/QoLNv+OLhjlObfaQHNdaIae3x4VgygDQlzMrMlmLnjA+3oSqiPnCwq4xMjaAoORsltbmQy0TEQM3yg7zp2YrLMxC1DakNCUmxcag== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0465.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 01:07:08 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 01:07:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 02:07:15 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [B3pfj1G5UwS9ERk72kKmApS7wdQ9yRBitca+P50USp0=] X-ClientProxiedBy: FR0P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::10) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121010716.2131624-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0465:EE_ X-MS-Office365-Filtering-Correlation-Id: 18cefafd-2656-4dbd-68f3-08dacb5cb689 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKw9/h+mHxnUXPC9/FuzQkCXCWSV0A+Ps+2JN0s+7c94ubJ5WwbTe3ZrJCXSwhATt+Pbk/L1QnJxfKwEfDsPe9agmrpcBwlKrOiMqEfc0xsLOiQA135FOe9q89qs/gbDcQZLFNcLqx7wQCfzB8vRdrKfnb64v/pTQ7vftF188y3pTV/Xb50VvlfR4epPiLti0vMHaXdAXfl0nC52W3IUR61eT1SWF8xvd/ZGLOzHVKiOltnf0vVjFN2UiaaxwA3ZOTgyitv/sjVOVTTjdB4WJwuDfPwamzcMrEAJokNpCxLgBL4nhk+WPLKETkRNAuQVTCAj991Uqs4seUagk8qTG1zG2ehFZrdtCpIv/xUf+rdFdaK8GlJkHpBYZIdDxCwGDcMPqk9Qp3XotrEGgPZEZuNy0h/FEhVB2kIeVU8dD+My9vJGVEeWHc888NTHQzlFaEWCYX+dr4jCnTqywG3uSb+Uer3kK3RHL5+oKjyBnDmXLhVDs884gZwgvDhzxQNHAnFNzhkKYFHV0tJx+mSwwnsjljEFnL7X1qw44U7bmzypdHrUgqrNSxGaDm5NhTH8tCHfxvki8DxAeH1iNgQVGeqMlUJU+pYjJKFgnOtZ9wSAGMSA/DsCcB3YP606YKMFsdj7NEEUz8SB+YDcTl/MK7ZqwDykMtuGfK1c8GyLV2E4XgWvnl/bKDXFwT77Zc0m6SFt4yUW+seW9jAiWu/k4wpdEa7hCO97mLk= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JOOqt9yQCdK6cy6oZsTfHsWej8slsJT2B2PGbwUQ+Pwch4X5zWN76IPHuiIpmYNl+F9R3oxTgXqtNH/qxniME18au9aTgm++2OGSGO5ScJL69cgR3SNNEwFpJFi/us2sPWTA9pOlC8tKUK5q67vH+rgE6ng1di61YIP5xEK236LNhpG8fv6f2goPoHVdCd4sWEl8t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qzOl2Qf3sLFiFHCiBiSPqMTEGrotyQs8Wv7qoKxEk/Fy25KTsX4c7cyQyICUpCVV2gJbJSNcfXE30c5buAL3pNw3K5G/KlP9oy+EkvJM2YKyJHjx/OWG3XO/DlaHfqphWETxWxQrbjSSJKmZ6+3WDXHf2ayre1RliI3Jhn1up8THP0gJsI2+oEQAskg+u2qG0hdNZPDTwEo2ZSUQ4J9wyKmJE2UaoOozKwSUbKRMwuSOt155SRgGpuZsBXMPcS1d/+m/X0cAjN95RudCCqXoQ9limptkC1Su8OPAENk8vlxXbIODjqd3yXWTLMP4Id/7Y+CY+X1DvKe9PbvR2ablL3w4GaUdkJ6EqQEazM0M3xmvTByLIp8Mvq5f0JCb3T31lpVbroi9c1BKIkC1rUy/MAlh8AsYSZWBQhirbSxYPd/B44S5+at2cZzY6BwhjYWQw+Y/DbAXDjDdBbMpmYoKbmwPzliCV7JDkalTqGX1dmvcN705lbxzwzKI9AAjSSkczJ49lXM3zYw8NtD6wKHRDL/xNVAgmY9F0VtXWVRo/UZ1pZwEQEYTSu8ekCRqJJFUKpN9gHw/MNYKCUuC8ZmQONV3lny1IIhVcqIfnRWjKFEj5Nwe74TaJGnrMaMSCZ/16FTH7Nsnd7ph6eW7WifDDCTO5SkAaxY7+EMQITZxawkMEq9SL3yc6YoVU5NqWIrVitbd44IYtplt+gEPg2pXQJJOR17Xbviqc6mjHeRBogAaURGTdtD6J5uUmnwD0fgunpA7fq7ZugycfgSTicHIIN/f3zRcyEJp0OlV/6 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18cefafd-2656-4dbd-68f3-08dacb5cb689 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 01:07:08.7796 (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: PRAP250MB0465 Subject: [FFmpeg-devel] [PATCH v2 5/6] avcodec/flashsvenc: Avoid copying frame 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: K6gWIwYwd99E Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsvenc.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index ba693ca8f3..c4b16dff84 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -44,10 +44,11 @@ * Speed up. Make the difference check faster. */ -#include -#include +#include #include +#include "libavutil/buffer.h" + #include "avcodec.h" #include "codec_internal.h" #include "encode.h" @@ -60,7 +61,8 @@ typedef struct FlashSVContext { AVCodecContext *avctx; - uint8_t *previous_frame; + const uint8_t *previous_frame; + AVBufferRef *prev_frame_buf; int image_width, image_height; unsigned packet_size; int block_width, block_height; @@ -93,7 +95,7 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; - av_freep(&s->previous_frame); + av_buffer_unref(&s->prev_frame_buf); return 0; } @@ -203,26 +205,17 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, { FlashSVContext * const s = avctx->priv_data; const AVFrame * const p = pict; - const uint8_t *pfptr; + const uint8_t *prev_frame = s->previous_frame; int res; int I_frame = 0; int opt_w = 4, opt_h = 4; /* First frame needs to be a keyframe */ if (!s->previous_frame) { - s->previous_frame = av_mallocz(FFABS(p->linesize[0]) * s->image_height); - if (!s->previous_frame) { - av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); - return AVERROR(ENOMEM); - } + prev_frame = pict->data[0]; I_frame = 1; } - if (p->linesize[0] < 0) - pfptr = s->previous_frame - (s->image_height - 1) * p->linesize[0]; - else - pfptr = s->previous_frame; - /* Check the placement of keyframes */ if (avctx->gop_size > 0 && avctx->frame_number >= s->last_key_frame + avctx->gop_size) { @@ -234,15 +227,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return res; pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16, - pfptr, &I_frame); - - //save the current frame - if (p->linesize[0] > 0) - memcpy(s->previous_frame, p->data[0], s->image_height * p->linesize[0]); - else - memcpy(s->previous_frame, - p->data[0] + p->linesize[0] * (s->image_height - 1), - s->image_height * FFABS(p->linesize[0])); + prev_frame, &I_frame); //mark the frame type so the muxer can mux it correctly if (I_frame) { @@ -254,6 +239,12 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; + //save the current frame + res = av_buffer_replace(&s->prev_frame_buf, pict->buf[0]); + if (res < 0) + return res; + s->previous_frame = pict->data[0]; + return 0; } From patchwork Mon Nov 21 01:07: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: 39372 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1833167pzb; Sun, 20 Nov 2022 17:07:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf7xMG0AmBReN2y8uYrrlJEdBasDT8wbu519hDmyMnaVFKN5R+H0f6fAhaG1tkDPuRNX82NW X-Received: by 2002:a05:6402:370e:b0:464:fa1:9dc3 with SMTP id ek14-20020a056402370e00b004640fa19dc3mr9518181edb.343.1668992866208; Sun, 20 Nov 2022 17:07:46 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sh18-20020a1709076e9200b007ae5fa9b603si8915231ejc.374.2022.11.20.17.07.45; Sun, 20 Nov 2022 17:07:46 -0800 (PST) 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=k4vKCTJA; 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 A93E968BCF2; Mon, 21 Nov 2022 03:07:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2059.outbound.protection.outlook.com [40.92.49.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4CEB568BCF0 for ; Mon, 21 Nov 2022 03:07:26 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eA+85BF1IESzhwg/Ewac/FSuDBrzyC3/Tt1kASBCd6zjWy35N3JFxuTN/jgT9AP9ta4ihFMNUkvMjvNsxey+z5sNHHcF+uDjbF1tGsgTBBJO+FMT22orwAeTcZieo1teSYbZRJXQ46zrA9meW4oI5nplFTvKcf8NURgAmZzZA7IGWP/QPZTB79ghvaRz7hLVOEredvHpQ08iofW7LwEfIgQuXn9YaMhtRRjvyxxzE708XoNWS4XcEGv5poeUypy/kwWpzzXJcsPmBjEAL1MhpyABqP0ZlZh6m435Y1z40chiDB9qAlBC6AIsl9xtIHf9f8kOAtKhTDpzLCUlEqcBFQ== 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=rGUSgry9CxV81OV9VSSAdkxG7aFY52AVBWADbF+kk4g=; b=Zw3Ub083CPQhZx/buZijxX+2XXPsvCx9rxWjMwTSdqeQuuujn2bNzANNjOOeNhpYQ/S87mY/LyiZ2Q6lQBppuivP4SM4Km8H0veVBHiIYyzbKkGFsSsaKMLmZVNIisEHHictOiF5XNAC+JCOjyjJBkUPlTkM95fVuZQC30nJf2mpJvSoHa6uL3dnFgr+3sehpTJ98OzTZTl/+nSxxV7BI+SboIaUoXRO5MAxna2qfW7oOOAbAyPs5fy3UtT74VIcfioHHnPj8k4IYmVr9Xv83a0wHEJ854ctUVmTapq4yvcTyLqNuoko4E4bZgmg4FkjJCg7epu0G/J3KJ5szdyq/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=rGUSgry9CxV81OV9VSSAdkxG7aFY52AVBWADbF+kk4g=; b=k4vKCTJA6Rp8p4IerTCGTC3bUww7qOOz4/nhMC79dI7VyFmD6B05H76y0Yz0M9v+Tp8/KsCV7chlfVuE/dbnLg3zyDoQFZAuzv8LHmTEE4i7p3axS0bjD09/xXuQ3ht86DN0FPmiuGemAew9gP3cWnHHqsSUm6/cFoLIOp+vcUYcfTud9Q5jwGlTOihe8CrtuRkVbSJxFvwVHO3w94H2fDiUpi6ZKcGhxxGCxAXdufRjGU+WBaXzqFRLF5IhDuBaOwc5rYNeFSlJUG0HHan3D5zn5rykIN+KA+QMXD9Nrw70QN4da7cnxSJlV7xjDqpTjKN32MwVRb0jHwPbeneMJA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PRAP250MB0465.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 01:07:09 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 01:07:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 02:07:16 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [vGvbMMG8aeiOIdT/5KFfY9K1m9SllLSBSAJnhx9sKg8=] X-ClientProxiedBy: FR0P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::10) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121010716.2131624-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PRAP250MB0465:EE_ X-MS-Office365-Filtering-Correlation-Id: 07bf8f56-52ff-4f14-641c-08dacb5cb71d X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmo0aNP8rr9jcp/TekB2Cf+U/qOfQmyUDuwNqTfTfCuJ7N2sCgiZf9rpgRDKGAx1TlwN0/n7NcO1ByPzyz9ElQQ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212XRUphYhCBbMhhlbeWuRV/4v6b21NktrOAIzxam5b5saSA+7PjMPFiilSvKQ5w4v4whGIBXylC8bS2bXSDkGRzvWdcuZfYpqOqlnvZaEFFy0mGAXlY4YErfzCCC3pMs31Cszv2C5fR7VemWmC2B1HDAyBHPDXw53/7QaF3x2p8/uW50xSy30EknNnMsGM0zQxQ8qIGeo8lSJwpBiOQfX2/3c44dYNSTUJaRWNmnrlwm46AgZUa+aFYbISeTrKK64lQMdDXocp70mfjqBq1o3Ak5VaP3ey26dVPoxJGY7FylynX1PzA56fL2Os/IqbfKwJht0JFx3/aHCqEF63Jkz+ChN5a1DZLKlEgBOyMOty3CH1nKkVnnq9EarF2E7sDAYcnDgoKcmfQ3lxXX0ZHuecudAhC+GAeDdrJt5NZCBKC/4uSUtQ52kD2K2w2KhCIhUDHNTRgoJ/KhkGO1eqHV2FmPzCioq2nUKbRGOTzqo09VZWS3Nmkqg6R801M9Mc1DWLSsS1zf0Bc9kvz2ZLFFNNhrCz8imnrlQDwT5vrgjf2zy3/1o8EaEn/6YFfIfY8XssFnFlhcSyZ+Ic7OteO2eJRFAWsvHdc6Bku57f7f4Bj3YDzB3mh4u5WI X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07bf8f56-52ff-4f14-641c-08dacb5cb71d X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 01:07:09.7507 (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: PRAP250MB0465 Subject: [FFmpeg-devel] [PATCH v2 6/6] avcodec/flashsvenc: Remove unnecessary or unused variable 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: 0vUutIlftdWq Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsvenc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index c4b16dff84..3a35876d9c 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -65,8 +65,6 @@ typedef struct FlashSVContext { AVBufferRef *prev_frame_buf; int image_width, image_height; unsigned packet_size; - int block_width, block_height; - int block_size; int last_key_frame; uint8_t tmpblock[3 * 256 * 256]; } FlashSVContext; @@ -204,7 +202,6 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { FlashSVContext * const s = avctx->priv_data; - const AVFrame * const p = pict; const uint8_t *prev_frame = s->previous_frame; int res; int I_frame = 0; @@ -226,7 +223,8 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (res < 0) return res; - pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16, + pkt->size = encode_bitstream(s, pict, pkt->data, pkt->size, + opt_w * 16, opt_h * 16, prev_frame, &I_frame); //mark the frame type so the muxer can mux it correctly