Message ID | AS8P250MB0744F7658585231D26CB9A5A8F1B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM |
---|---|
State | Superseded |
Headers | show
Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1509:b0:1a9:af23:56c1 with SMTP id nq9csp2271761pzb; Mon, 29 Apr 2024 14:18:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU50UMkjlRG19/Y0laiih8zHj/aSBX9cABP9m5HMeP7Do3ccQMD6741OHfj/uHeopcqRl6weFIb44kuWZJof2etJOYcSSOv3YoIIQ== X-Google-Smtp-Source: AGHT+IGkhpNkCl2Vwf+g1+imG35KBeQRSbZ+ikLNU3AziGaSaBvG0PZRiBiAmC5RtAircSV4bY8D X-Received: by 2002:a50:9359:0:b0:572:78f1:ab8e with SMTP id n25-20020a509359000000b0057278f1ab8emr3775621eda.25.1714425480129; Mon, 29 Apr 2024 14:18:00 -0700 (PDT) Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r2-20020a50c002000000b005726c8689a1si3342184edb.211.2024.04.29.14.17.59; Mon, 29 Apr 2024 14:18:00 -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="d3/PJgI+"; 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 3459268D595; Tue, 30 Apr 2024 00:16:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2093.outbound.protection.outlook.com [40.92.66.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA74468D57A for <ffmpeg-devel@ffmpeg.org>; Tue, 30 Apr 2024 00:16:09 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ngnQqC9Yb08nRECPLGCR7ZtArC89jxdi1T+UhOU7mq/PJpNQ81n8f6HFDYD0+cBF6vR7+39zAjv/Pyw5SKZBaQr9tj0USzNW32aiAwIqtzaegc3uMBU6MzQycvrgVL4XOVDsLemYGldaV3u1yEEeLEPqVxbTBAPpjsvwsPTodyJBWGKXdunuAEZkjKM8YHF1yt/BT0JSEjVGTuEEBQVCSVQ7PqbbALPFq9YAU+N8tn+qa9yhBr/TXiub6BNntq0JU9lTtXldLEttaHIM07HLBeFhxiP76tpvoJyeLWXNYkZJGe195PpIOryNCHACqvcW+jI8neE1w5p6BC2PDzw8pA== 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=ac/nuvUXaG4aQnZ6x+uJ3yF/+QFuQwi8HY5NVOstoJw=; b=BZo9sx2ud/BQDNaEqEhxHQYSokySNK11i0JHW5QUUZZ/s5LxrRjtMdoPng2skiqcJVcLXHGzJOGQDnMA/YrS2NgLfHdX2vFBs8QVCnF1pQy6X1+NuN0y7VnW+9auxsEqY7uNbiDbvK+/GbfIg3x69D6ujZIOlNmH0kGnZdvvNBgrwZFi5znORZJKA3J9GBZMmyZuj5LJwQ1jsd3HytqApYqjM39DEYSN7abD92HKJaV9Z+GUnsJw5gQnwPbA1Sj+8PP3mhe33rwa7z+rtlGnR83wIGCp3v5eu2V5WLxdoz1f7LcOniQCDkpPtzDXPUsNP2STX5YZSDIDf6RV/mAH2w== 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=ac/nuvUXaG4aQnZ6x+uJ3yF/+QFuQwi8HY5NVOstoJw=; b=d3/PJgI+QrlwYNRPeeH238W1LxVBA1MhwfD529Y3zHB2Dn7io+sh+LTlt3/mvJEQoOHb4Maa3QIEbhY9dC3jBPEIZLvripB47vNU+AtoVrARTemhwE7elmyayKlIjCwiDyGXfHf5yQ8xa0JZtLtWZiJtD1Nl8C0itop9gV64wTkKiVt8WnRUKEaxVVZRsx617zTLGBwMpx4Tybho/BEd140/4vaXQURxzJKJgTA8XuFj/Z/ynrvEfS6zrzEqexRU7HEeuEfdB4/dPLv+Y2UCgkQ8CSDz3FMyzQXBFGXjXz+afG3Z0Tvl6M/gF3flXnMombCmm1rbrEKLvg8CWQUXQg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by GVXP250MB1057.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:1b5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 21:16:04 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb%3]) with mapi id 15.20.7519.031; Mon, 29 Apr 2024 21:16:04 +0000 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Apr 2024 23:14:14 +0200 Message-ID: <AS8P250MB0744F7658585231D26CB9A5A8F1B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> X-Mailer: git-send-email 2.40.1 In-Reply-To: <GV1SPRMB0021759DDCCEFEB3B9609B808F1B2@GV1SPRMB0021.EURP250.PROD.OUTLOOK.COM> References: <GV1SPRMB0021759DDCCEFEB3B9609B808F1B2@GV1SPRMB0021.EURP250.PROD.OUTLOOK.COM> X-TMN: [6kjaDBFhI6qm1wDeMB6IJLXLk4+foqawVhehZ82e7+A=] X-ClientProxiedBy: ZR0P278CA0199.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::21) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240429211438.3274834-19-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|GVXP250MB1057:EE_ X-MS-Office365-Filtering-Correlation-Id: 4cf512cb-d911-4ac3-47dc-08dc689193fd X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: RlasYR45KGyBaEkfbs/gBMR/OjJVeWdptRE6TPw3GTKtkCEnBTa3+QjFcYf2RGbgDqc9Rp7iH7oAUdhrTt1BUADAlhNC+3fQBr219m8zXRRb8KxXlZgSPpDnh5hbugtF/lHJxwv1GbU4QHGG8Go+p0qNr1W+kObkjmUppGE/yUcMU5B9JIAtPEyF2ivGjnz/3gXqPvAiUAnTE0abVUZLemJukSC7dP8y4FkKknKyJg1Mzf2RGMvxl+my3MriV1jnikIxn/612M/cmyv8JlqPTBzxwQ2ujBsS9QvFb5FfkXOXxooAJJzd2Ab3+U13AHKsdeGpofrDHslPYeTQXiBDE6ZdDG0LXwGjFrCC+1xlulkxDY4sdtb8UOKRZBrOtGmQSjheQLHcXSYA4Z8mRFIfXwU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BOaE3uKctsIeA1eg32oyVkoMnRAOwjMkg37UNjV6ogS8cQQev2w3UGNfR9nWixNUZfc7Dbg+4LulgTF/PP+m21mVfkmiRcOh8nVWS4oQDicvZucOhqSh+NCsnfB39ZJI0b0CjY5rFHsERDlgLhVz9uGVVFVEERasAavN6RIbJIKHA8Ke9gN5EGkPX+Nx/HCSdspvgigCsGfkd71wtFJouVdIkyWXgs4HK1rb0b8KzhXlYUzLMO0ewQ5S1cOb7OSIHzIRgC2B4zlXcXybmQnx9b2Gh1yj75nIKsqFJFgj2Za0oLWJEHn2oMJ7d2BiAOJekIs8SOMhkGcMiFg3YIE/LwmRSjZOrXck+1pjrfgh5NgVFq6wCelAj3lPhkkz2sdt+XLDaL1ZopiuxIzc51g676ZGwpwVAe4Hz4z3MGDXlvXejLXkNMX1vXhGiqF6yrQak3pjf/X/dUvrPpSW+AqXfBcgjHNELFpwIsvUnM/K69s2YOKYpo/58s1S6BP9f701Jrcop1Y7afbh1nP66w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4cf512cb-d911-4ac3-47dc-08dc689193fd X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 21:16:04.3661 (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: GVXP250MB1057 Subject: [FFmpeg-devel] [PATCH 33/57] avcodec/mpegvideo_enc: Factor setting length of B frame chain out X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> X-TUID: nh1m3pd+Se1i |
Series |
[FFmpeg-devel,01/14] avcodec/get_buffer: Remove redundant check
|
expand
|
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 066dca9ac5..c0b7769ccd 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1472,13 +1472,15 @@ fail: return best_b_count; } -static int select_input_picture(MpegEncContext *s) +/** + * Determines whether an input picture is discarded or not + * and if not determines the length of the next chain of B frames + * and puts these pictures (including the P frame) into + * reordered_input_picture. + */ +static int set_bframe_chain_length(MpegEncContext *s) { - int i, ret; - - for (int i = 1; i <= MAX_B_FRAMES; i++) - s->reordered_input_picture[i - 1] = s->reordered_input_picture[i]; - s->reordered_input_picture[MAX_B_FRAMES] = NULL; + int i; /* set next picture type & ordering */ if (!s->reordered_input_picture[0] && s->input_picture[0]) { @@ -1491,7 +1493,7 @@ static int select_input_picture(MpegEncContext *s) ff_vbv_update(s, 0); - goto no_output_pic; + return 0; } } @@ -1598,7 +1600,22 @@ static int select_input_picture(MpegEncContext *s) } } } -no_output_pic: + + return 0; +} + +static int select_input_picture(MpegEncContext *s) +{ + int ret; + + for (int i = 1; i <= MAX_B_FRAMES; i++) + s->reordered_input_picture[i - 1] = s->reordered_input_picture[i]; + s->reordered_input_picture[MAX_B_FRAMES] = NULL; + + ret = set_bframe_chain_length(s); + if (ret < 0) + return ret; + av_frame_unref(s->new_pic); if (s->reordered_input_picture[0]) {
It already avoids a goto and will be useful in the future to be able to specify each functions tasks and obligations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/mpegvideo_enc.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-)