From patchwork Sat May 11 20:23:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48729 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp291131pzb; Sat, 11 May 2024 13:24:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVZIEs7TJBBBFgRioVMB+pbQ2rbsyl6aIF5m5h0P1WzX3oddWxGYTvp9vZ5l/W+2ikKGVxMHj6ziBKJGoqdn2xRMhOmEYZXvAPCmg== X-Google-Smtp-Source: AGHT+IG0uvU7bxvygRlKCU5oO2sWUVgn1gBVmnweRzCjUX64+L9ynjQP9PteD3hVa2Tvzt00iHd3 X-Received: by 2002:a05:6512:308f:b0:51a:c21b:73fb with SMTP id 2adb3069b0e04-5221007498fmr4409487e87.44.1715459098373; Sat, 11 May 2024 13:24:58 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733c2d4d02si3335879a12.296.2024.05.11.13.24.57; Sat, 11 May 2024 13:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=syt+kc89; 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 A817C68D41C; Sat, 11 May 2024 23:24:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2027.outbound.protection.outlook.com [40.92.49.27]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E44F68D2E5 for ; Sat, 11 May 2024 23:24:48 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UoCM+KgJyQ1ofr/qr5sn3V0n01R8X6ik7hFf+7D9VF9fsB6TSociLQ1lxS0G4S7SM4H36419aLhk3CQfsuTanMidHZ5ojfiD9Z7k2zdPSdpumglt5+LVwv807ZxYumOhRmGmO5Va7X+jqABRZqsE5qwtwPucJrpp3yE6YxfkhxeULHRWgO+U7MjafS7TQeWRK6K8S8fW+NHEKxcximu9Pf+RGYeVU9hrisDJq9/hT3oDFSgkp+Ek4RlGY02xCqvdmVRTmFVd2AP9YOILc3nIJX45OvVXvSfO5H0SeMhbGz74X6T2eglhbeNclQkXH1oEqc4J7I6pvC2fz2UFDnF/gQ== 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=9dnAz91VIPmr+cbPfCdXBrWrZXC/4otBubmk3Nw8uPA=; b=avNqzA/QYKXqocNckR1rEZNbmAWlDCGCf/v3/hUYES1hlWLP9UpufL863LjAhAKJuFjveILtuv0JVSC+iLGSNK/IAEPuDvcX6jcZKj7FMCLxTSL5//1KLBzgeG6Ac6tYEBBz4zu0d2sGFWPcAruMt/+VkConplRf4ZTUarxI6+lSPf6Tk7qHYrvpZcMvnfFvkEtTtBrjbGOF9rXB6s5nIUokeaQQS+6/SYYIODhunYl22xUbCc/ufrDX3l8V8O6irymSxnCSOqwgsYEiaBPpwGfggZmf1SYbQZrYYGTsdZtxsmJ5pZXZKco5xLHFIPJbq2vtAMmzHDvU1BlVD94lKg== 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=9dnAz91VIPmr+cbPfCdXBrWrZXC/4otBubmk3Nw8uPA=; b=syt+kc890c1b3rAyTWZr5D7Jelq6hfbnpj6LwR8NMpkfwTvVH0fGK7FVL2NBVYqIT4AGVucwQIREj7ImyrvqNzMNiUacEuLuV3eWKhHdCPO9AOr7bqd7GXTF0EMAHrO5XRvHZJDzk9ThkGidMXL6PDLIET8CYVsJn0aimtCJUmINCtC0NQHmsOedTlgRvZrdPnj1ar0SBTnRjMqwnhfBoXM95EIyTJeajn4n5gsZuPYzTMEghteKiR5G4oTBEZcJNZ8XXA2SEoNVYU6qQVghArh4zuUuaSchKHswG4yvG8Ag0iG7D530HGw367erlQQAqzrfE09dFgzPUhxk/CVwUQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0286.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:27b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:24:46 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9%4]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:24:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:23:27 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [dsPIaC8idhz4wpTyEbJIcA2CHvnXHSx31q3jfwHF0LE=] X-ClientProxiedBy: ZR0P278CA0183.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::13) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240511202437.2411642-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0286:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b52a7e5-ba9e-4205-8130-08dc71f86686 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: gJbNVEDyJ7zs01ls7E+/Tauv6ffp8owxvtMjJZ6PI/W0pAiEWx9rTktPy3iaok6NGVr+9JJevzmjR2tMN1Eqx0nsY78CS6eTRKM/T6SBxc6uyp1lbPkosOXwYbGXN1oiAXHqIxT5haDEzzGQW97k0viovPl18XF391oudsYpCQYUrJ/Al219m4k2EeTEurW/GgZ3hJOQGfp3RkMX7HQCRBMPFMhWfGMzn0K+hL4jYz1kcsTtknF4GFc3ybmqu3x5HlOLGuZA++1V0fpQnDsxVYNc9dimS/4o/RQrSj1Td1++5i7isAyHxVjfnfaNeaQbQCDrKuyREOiv5TlTZ/MgZH0/tbpUnmkR5DTXf+bMetDNlK0yFKC3fazDBNkzjqF/gwtVj7WCXvusX5cB4nhJ9U/MSHdSQ0DjNYHcwzYfUaXpg0wY04F8MO+ptqOPNhhT/b1YWeEaAIuHWzNwzVpxF5pCWhhKPUxCtHY5HvQH057h/OVRq/4E0qwk2Oh4CuTBCbLPey5YEWfKb6W3BIgc8gvC80cTnvAefHJqwEVjnESgTQBLNpl7sVDgNppkaeRQQ7MdFzGGqUiJzENpGh2G4j+mCaDOp2u0MuTdxNgw1E4J2N7m/AfBV+9NA7POU0TH X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9cOUZBfk7uYBf0dUzrMPbB1Y+gsDHmMwWTeWsHTOdVL2zaCvV/z7JLFLkmdOJXZE1jw59KpvdE0UHuWSZrHXEJgThjFfWnUZwU4Rfgj0aTQV71dSRTr6zgrTwDUeaPMrEjo8Q6EOyc7aCGvdFEPl+zWrqMTWX5da+WgpTE/XQKepoOxolhL/vSD+YvhcyUbp/F4q9wyFy7KVOokBj0CTvvj30t1uiivIBrvJSfktSkAqrVXM2PTbzdAnFsD64ZJkEMI/DLHIywylFHZsuh/wUfVNITt4XI9N85XFyB5USUth6vnVmLXxDTT+P5GODzA7sfzAZHM0MsdABgPyICIO28hPJ6A+djn0zq2DTtcHo/oRVCnNJcvdvpPtfoCKIHxKo1xvuvraqXyTCFTEJKEuFuTRHivx3c34YDo/m3879/CxdwK5fJUFPxy1WC92GFuVLRqsd9CHuMh3Ivxawaj5zWHQJbPm5RbJxUWAKx5Rk0Q26q3rr1SxkPL28OzG2Co7dX2gAv2+7JNZlYQ16oMM1DdLZH2f7K4TQ6OF3xDIFRPI5ec+lDH8CagJzENHCEQWr66IK6Ll2K7GP1lDy5fGh4Yhe8kI+3fOoWgxXAWULEkXEsBFpZf8yg7Kk6SDzAlKOhhpiMWngaQfAuoMy5Rvnjx+vQ1w5AsqY17xIp2q7UzngDiO77tjMe6r2arJFFXQg6LPpQe5oqL8HdtiK4hUnbRaBXL2Sg9OzD5ZfIKKwMvGvFLUbdGZx5MeSWxc8n/SproMDoEEAvmTgyhyRLnLS+VP7AY871RiEhji6wp9QctyBlaMHgMmEhSUfC5Kk2T+UrEShLqdv+l1WhReaBEm1hgc8xkcnChKWA/RNffnWw2qOgDBOo7AckW9Yk26PdREFL9D7JHmYmmlty4vquTCFXbvL8xBEvwV62XmNL/OyAx5I/n8YowbvN/t6vJxb6kCxROm+MyUmebf17SqF52x2E8WCCiV1KlZC2+mvRPEBV6UgrfVaIIOGedtWVk7D9bYMskNOS6CZWfZAr/2Y8iOSiLmB7bG03fKADxvq4aNN5+zznT2n2YrmMAyqTGaTd+i05U4DGX7J3abnb5bVL+S4TMS/w/es/2rHzbEwytcupjVbcFCLvtiAbDgT/ABdQ80TAd93UPt69vwFRzhpdtCnsf1oROAwx/G3WfbFaG49eBPRISsHvcVM4hqqVTU9nQSio22zitkebYcG5Gyb56swS6eytAI1xLyooWHX5SItmg5vRUfk6lefaFKO0gjMw07Pm7m2UN8df+kSBDuF69MGA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b52a7e5-ba9e-4205-8130-08dc71f86686 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:24:46.8775 (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: DU2P250MB0286 Subject: [FFmpeg-devel] [PATCH v2 01/71] avcodec/ratecontrol: Fix double free on error 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: G+/BA3x/GoD+ Happens on init_pass2() failure. Signed-off-by: Andreas Rheinhardt --- libavcodec/ratecontrol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 9ee08ecb88..27017d7976 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -694,6 +694,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s) emms_c(); av_expr_free(rcc->rc_eq_eval); + rcc->rc_eq_eval = NULL; av_freep(&rcc->entry); } From patchwork Sat May 11 20:50:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48731 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp297862pzb; Sat, 11 May 2024 13:51:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXS+PJcFoGsu/8h+mt/xlWaqvWWxafTdiluDKR6D1uEkLcDk89HVHc29GApk41Jmhz77Z0/ParUWYUo18KycErSyI7djTnOiq6+tg== X-Google-Smtp-Source: AGHT+IGKgIil8jCyNlz0/hYMyMC2YY6GYDyLIa50Osnn65q4q43RTigZGRP5iU1jsqtQ9oDZNiqF X-Received: by 2002:a50:c012:0:b0:56e:2e6a:9eef with SMTP id 4fb4d7f45d1cf-5734d59d533mr4169966a12.2.1715460717629; Sat, 11 May 2024 13:51:57 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-574c122d539si16607a12.267.2024.05.11.13.51.56; Sat, 11 May 2024 13:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=gXAB1vxP; 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 4C2B968D43F; Sat, 11 May 2024 23:51:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2056.outbound.protection.outlook.com [40.92.74.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90A2C68C15A for ; Sat, 11 May 2024 23:51:46 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bPkCAFyX2A1pNcGs/3WLOj57Qx2WpPFt2Y6Z2DuXE/tYNT5BfcHPS2CovP1NGD7pHQgswcdVm/ntFB93tBm62Fu/2kpCPqkPUGH98993iWGZj8WXKeobWLlXu64Lt0Ww9wLxyHHavfkKOVnf9oSol5KEx+89NIX3vd9yVW6H9SHuVnGT3RjnUt3V7SrhtCyVRw+zgjY25eVZXvMEZG7hsqjUcdi2eh5oiyqisvEeQ4P2WiaJb5XiMpwUbwuHjJgZCbiiCNVvx+5p8TrAO42Zrw4HA5Bw1Gcnd+tajyR5OQ8f/hweU8BBF/MY9TkUUPOsSeKUMESv55yMZsMwDnGPIA== 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=Atrsf8H1KkYRn2AJSXkvUOcvB3IeB3IGq5tMzb+K2kQ=; b=O0onya5lSz006AvcAaX7HpkVrtevxG0jRnOO245S0D9lptB5dRJnBD1PRkkN5f75fK7TW0+iSUknC3BNKZRiWhIh8bM+vMc/NgmQOcqGMuO4tCPx6ApFx8I2VU0qU51V7XVOH4imy2jcy8thdDPMViXREyw1/LT3tIUrTn8OyW3bFIY2uNNtchhxVgFubNN1ehgrT3ObVnt0UxuddBbHxLWTbUtdyj+f0B9vvGU9P/gpQ/OrQZODmHxjN1pncpFGkJLCwb7itLATyxinrdIqr7PMXxn6bf+QyfXEWTN698S1QMugAaQcrNjG2GC5JkKj6ArDlZ9X5gsYdMyL8Sjbqw== 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=Atrsf8H1KkYRn2AJSXkvUOcvB3IeB3IGq5tMzb+K2kQ=; b=gXAB1vxPBK9L6iqWZs42j9pAFjKPy8mYE1QAVNIeib2UjA3ZCGJz2NTj18GmcZ0GpIG8elOMdGE5V4HrBjCFJzeiS85FaJxR3uc8n7/nmgLERnoczOedGSHe4QJRlXUX+ASaA6OgBkOlb6S+4142izQtGYQvhq0CnMwlRDt6f+Ujl+QbHaoRMV6k+lhh+pHlkAiRTmzTKNHPE7zPfIWiUIkEC2sDSyGJJzVZcIKA6ZZT6rFvum8/dz3rvhxauSeUCNo/8Xi3ABzFZBjcuExHnuFdCkI/Fzf6YUJ5VNx7uQklN1ZS4zbj/5XHU/v+NwgfhW19HitP9JY9J3sIty0+nw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:51:44 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:51:43 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:26 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [JmYcqRJvccxXeH1/+ty87I0h/GC9an6olcGVJd8kLfQ=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 74ef5247-76aa-4e81-b83d-08dc71fc29e3 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: GaoK2xEEeEEJDgCrFYZLmtplABr5Qji+AZuKwuvjUVh8hCVI3pFIJcZ1xokZAsIl7DNdKL6uwiV3tnLstrE40JV4O5fn/R0P861oGUXO+RmhS3BKVxrLmFYD84d38sfeXsMQ9HJobLsA7u6VQQoZSu7SHTBMpAQZnNOuFCtNZ3OgsTPYlbNjY7JLjvJtirSDUaE1h40seGaWPaTqNvoUGVjgVqggb6LuGIJvWceMIlMMCJRNAiAUTuytloSTmmTUFKJToUgU93r/Kni4wKApZPtPTlZZcMCcJUfDpZhtIaIaRsoyQoZxjBhUuMRwgLcRMu+cdyCODilSFtIK4Z7OFydtjOb5j0TadslDpkzDoX02PyI5cozSy89EW8F+zdAm90Lt3EESIIYs4As2zquqm4F9ZejpDpA7UvhBKQGdo5QAFIoS5xhznSuFJeD0HXrJymKjX7dTmCIiF/Mcjq/+Jijue1KuaErPHcHPm4HGErrM8xiKm3XgO7VBXqKi/2LUCOQejYmbhSVWB2gpqYF4sr+++CxRuhVfLop3gWR5kunUeXfUZ7an9pb8uHH1msvUlYTyf+sOAoIA1EpNHLy7TUKw7r4uc/QnG0dKoOEoH4YOhS0FAaBih4D3OKsYZjsg X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /02GjcvLTh3+LGll2tdKVTsCUct9VDVKKvuMUgUziBf0uUi1l8YXRfVdKLecwJdRkHNegOf+M3JgndMsJaLpRQ93IHl86gGzbJr7cXh0XrcP3aQYex0J366OmIL+VMASz//cP0NylCefNW9DKT0t09kQZnSqWzR9jPdFkuivZTlW+efyAe+4uBPz2aaLHItUMUj9mIU1zg+JlX68E/QiCeLR3WMYz2bM8kJ8pFbPoB1zlAl6bkO8MXLJ5wmplKiiAcmE6PTYjqjAai7B/kDlO/4v3sIwq179vULlAuiREOF93DC+fn0HLyyJA5/RBvc9cPtw0aK0pzKk6/3AfIuZQp6dT4M5193j89+LUSX+SVQHIransbjriQtMy2CTvz4MGHjGkabLGvXmZYryW0jAfmDABaCo9ljA7m+Th3z8k5QmzYnAQBvjVUAG2IhwE8F8+XG/GCXRglbEEcJSEvTKKshaPSN9romJxDU4Ca/pXq1E8/CQEe486J1mBvbJo3d/bkFltRaprkaUsk3oqclYjBAa/6H4E9G2Koc/UMf65er8vwi0ttGTx2mZP3KL88t1DGsRIh7SkzG66/zH6/QeBnqC3HOJeXqJP8FOJq448KKApldnmF4EIsZHDUsbGqWEQzSyKS4Ucjq2FeX0mAzV5Fs0ASSWV/ozoPvi4xQ6iDQesWV2NTWSH6TF61fDuxo1y+VUZ+pVnytggQN3pVJzTQQcwWaezKM0YUXk4WdDILsaaah4zjX6b3aLQAN5HtI32TzaO1T5kKSCgglwxEdg5i4pIJ+gDluzLIcV+lTDbJ1I2t7bpsJlcJ1sRLnzG+fHCNcqUDxOT+2qINEs32cW4q/AYnAVIvy9zeJ1WShjX7lu3dhn8bH6Osdw9EvXayan68nJdzvkUtnEUr4U/UmvG1YBXFiW2PgAN1Hb6+oY5516NxncLEvXdyi4OwbcQ0g5hifX9pFXgBb4sexebRnQYZWcsgX3pXDInZ0uKfxWNprGHjNpKg1snC66Nk2MeVpPxgCqLL9oA8ohF5AUL9mCoSADzxHFMzHbT5vME9bHcqdnKxADESITPE7TBa6TQ3pJMT29h0TlZ2EGzwvFCxvzCwEJNuyBuiNVAIKsTQIVlGVdH9LwOFziOpYGzWL34Kq7KCEbgCjForUM42XMZoGGJ/hoPhLFEE68ewQbadCNemjY0UR5pqLfwmcNcis3qWwzCM27RmveGLryI9qIT9wX5wzne5sghSwGEO1+ATqxuVEU7xPCPOei80TdGazLBi1ir2gSoaM0tq38huX6H2CMXg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74ef5247-76aa-4e81-b83d-08dc71fc29e3 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:51:43.2645 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 02/71] avcodec/ratecontrol: Pass RCContext directly in ff_rate_control_uninit() 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: 0G9Wi+koqm2b Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/ratecontrol.c | 5 ++--- libavcodec/ratecontrol.h | 2 +- libavcodec/snowenc.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index b601a1a9e4..e31636d787 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -989,7 +989,7 @@ av_cold int ff_mpv_encode_end(AVCodecContext *avctx) MpegEncContext *s = avctx->priv_data; int i; - ff_rate_control_uninit(s); + ff_rate_control_uninit(&s->rc_context); ff_mpv_common_end(s); diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 27017d7976..78022d80aa 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -623,7 +623,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) } if (init_pass2(s) < 0) { - ff_rate_control_uninit(s); + ff_rate_control_uninit(rcc); return -1; } } @@ -688,9 +688,8 @@ av_cold int ff_rate_control_init(MpegEncContext *s) return 0; } -av_cold void ff_rate_control_uninit(MpegEncContext *s) +av_cold void ff_rate_control_uninit(RateControlContext *rcc) { - RateControlContext *rcc = &s->rc_context; emms_c(); av_expr_free(rcc->rc_eq_eval); diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h index 1f44b44341..a5434f5b90 100644 --- a/libavcodec/ratecontrol.h +++ b/libavcodec/ratecontrol.h @@ -87,8 +87,8 @@ struct MpegEncContext; int ff_rate_control_init(struct MpegEncContext *s); float ff_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); void ff_write_pass1_stats(struct MpegEncContext *s); -void ff_rate_control_uninit(struct MpegEncContext *s); int ff_vbv_update(struct MpegEncContext *s, int frame_size); void ff_get_2pass_fcode(struct MpegEncContext *s); +void ff_rate_control_uninit(RateControlContext *rcc); #endif /* AVCODEC_RATECONTROL_H */ diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 43ca602762..b59dc04edc 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -2077,7 +2077,7 @@ static av_cold int encode_end(AVCodecContext *avctx) SnowContext *const s = &enc->com; ff_snow_common_end(s); - ff_rate_control_uninit(&enc->m); + ff_rate_control_uninit(&enc->m.rc_context); av_frame_free(&s->input_picture); for (int i = 0; i < MAX_REF_FRAMES; i++) { From patchwork Sat May 11 20:50:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48732 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp297953pzb; Sat, 11 May 2024 13:52:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUb0bN937truROikR4Dcq7ZzjJNLPoSB05bk05hTebps7dQHaedXbo1vYoaxDVU0ZjpV5Stpp/77D4jsBsF1zq9D+TYhlEzVbM7JQ== X-Google-Smtp-Source: AGHT+IGRyJ3vvifBGKykjgDqqn6pMBrNNS1cKAe82Zg0cJOjdImAT6tKFXb+v6aY6tfLQjMgY3s4 X-Received: by 2002:a50:d718:0:b0:572:9fea:95b6 with SMTP id 4fb4d7f45d1cf-5734d5cecc0mr4399934a12.24.1715460736984; Sat, 11 May 2024 13:52:16 -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 4fb4d7f45d1cf-5733c37463bsi3247388a12.602.2024.05.11.13.52.16; Sat, 11 May 2024 13:52:16 -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=qbRwJmEo; 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 6A52668D4DA; Sat, 11 May 2024 23:52:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2073.outbound.protection.outlook.com [40.92.74.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4301568D2F6 for ; Sat, 11 May 2024 23:52:07 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ru4ZNJFUIHnerrtYudYkBddqG/nFhYgUJ8ZwsUwhxsj9M631+Kyto5cpbBiXvW8YxeQL+y/MBMZSqVy3clGJrCMPwyLUSQzG35iOxwjYL0VAV4ty/of/GeNTHyr5MGhBhUAfjcHg6Rto8784lLT47dElitUv4K5njQb6NdJLgKlcOvoPmy7XeAal9UkwN2rJAkoUHV6aAz0FiMQMTb61ELBeRK0NIfZpivSuZ/F/D4ZtRTCbBEk9drdqmVyzFxgPI3OlGgKEYSu6sQY6AT7Rx28JK3+9xfVk1Y+zKXo5ivd6BjBGa2lMhLrvlAKASg1N3ZoQw3H5wYASlurg9zHkBQ== 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=OV19Ko0RdD19icqPLGdp10av9v2JX4LjSpzoam5PPes=; b=W4J1/weEVC46bMYcjCzAilOYeVXCbnenHgsQZ8ptevWiqAhyHjqrHGY7nm0zL+vRNZK/fY36ra94N5ZuN/wpdlkquh6ZS7UnO9YmSyQHxIaMHtJmYtARE+TZIbylgrJ2xjvtW4cjARlB9NXWQWberE5t7NQaijXBwIucv30cc/KIDK7WeF4AZB8u1ghcMrt2dOsnJ/W40R3/isMb5rUw7gWO0SLdrv75hP0kYfPuzDyytrpU+U+Wqi0TXD6/x2iA6bUjkxt8SyJ7vC4EHkEWhq3OLmWxJrrd2FJwxa7JDKp4CjjKUDvRtDMskiBnNkgplQhMfs7rbw0g2XnJhNx2QQ== 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=OV19Ko0RdD19icqPLGdp10av9v2JX4LjSpzoam5PPes=; b=qbRwJmEoi9ZZQscOQmnTWuqh0V6q+zrnkoYkTHMN/uhwQUGqsBc/ZKM1/2NL2D4hXp/IsW5cBmtEzs5E0yGF4xNol+vSDJkhbkOubqOM8MHgMSzTE+QTxBvccplQZRxvo3b1x/EOOQCFAKHrR9uanOoMw9jqppQRdME4ikcRWxEu0TTdp5B11PI42IQopNbW6CjXU/rWJiPHIbigRtGHerufXngADCFgnpxrbbsyKdEiuX9zmMKEHc1yEGJ7wdRYKjckvnMvyTSoVHpx+dQE3pTVfNGtFsZvVWv2hZTZmA9jZITid/5Qv3orkKsen8q+fWbFGdKiDBwrOCbINVJZEg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:05 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:27 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [ddohlz8JXXdIR+yEdd8OXjmGKJcyYO/mjYGIYTKYe5s=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d0884f1-2733-4f27-f515-08dc71fc36fb X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: Q5Wi/ZXdeARPwY9gaMbxwRQXOzOzn2OOfjnZyh9K/zHvxvfR0/qmgTSETV2pqIel6WMDnLfbNjpQvCFd+Mh0ZOCwJ4RtHSuaSMAzkwmlrrkBeTHcMG+ZQEbb3KyQusHfQtUHWBhMuJ6Hm4NTzu+0dGlvjrmN5Gc48wdB2Mpi85uae+Ps/0u5r0iFcZfHCF33483mBIYHpMEM6CY10EBaSMEwIXOSC246XXC0INZ+G6sh/S6rR2h2272VCTjmCgkVT7tCsURLeCPh/34izIgCCpxydRIbcFSoxB7d5GEYbC7qM7TJQnOfVa7EVzVNbjLYCI4erfdmect9cuIE1bWNbC44N7swFgj8RNuG7NVkqftd0TMZfBvjkr284CiQWFXoF+gW7fwqfOoZ4SHMtTw9EWCGjdPUMrUTfUub9Hu5+zUQuAvPpmHPsdm+YgM68F85zGtJqj3GU10LDziRASMi1Bmmc49VLoJMdhuRaIslqNk7Ro+bO+P93jjVSnHbAoKAsgTIA5TopPXH34sM8PA8EBuPOFjAk0FhcyMfE2HNFJGai0N6Eg2M/SxCA4LTAq7Ov1yic1tunxj34jTvsP+rSX7sm03Fao1jWjTDGpkxNGgli4rohq94ng8Wf9ioFhdU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eczmqSevcvrbLCDXOqwnb1SEnP8Rl5D5/SMVmSnpzITY9CQhyekpAJtSl1g6UJYL5dylAtTACyYl3ROeFygcgEX2ECFZ19oQI/i7RKhYKj6OD8pEhX297f3M980BzPMO43t8tRln4ouuT1RfgOqcLZIXYTChkK23ulg3JGdwMzpKs5AFgAuuMVNbzyGgSKa6AyQOHiDR0SJ1OtgIB+RakVFZRv+3xOXTfdtlXpgmFvJBYIjlHts0yV0Q93LsOa/Be5Zw+RZZEds34a7H4JpdLVkTblMi5c1zueLbx1uD4fACREveR+sDEAQH20V0rhigNTCA23GxI1OM3mS/kJNon22FGLAyODDp8D/1FL/0JMakw5+xNTiVD8lLTyXr2KEwZ592ClhvqXdWr0zK2PfKplM9TQV/Se5ntnKreE7zBaEAi9VCqctqWGZT68b9b2G4gtUf1ZnvjiA5JwPhSU0zjNqHXNeyhCqij0wwuLH5JprDzUEJXHdjpXhWR28WwECtoJXDXnnPitJXEaGfr1F7yqJWUGq2jByJidSD/IVEqNd9Am82+2m64K/kQRAYRUG9wnI2FgkhiRSeg20Am3FyoqOwNV8zo49ixj5LSgJ+6uqJJzUKb956vbLMXfCZq5Ir3qdmyPrk9VTyWtcjzOg21kqrSqdysTRkKT/ND04dA9Aj5qwR2gOuQNLmdCU4vV1jit1w3rMBWmigfA8Kd1JvIK5qjonxsoevobQsaFwe8qYd9KFVc7CEXUHuJSkM5l2ORMBjckBHsvFuLBwQqi2s7i0oKXutEiTyuUalRswVYNOjSt+ryk+pVC1fYogof0jbRUNOHob4+7/hUUe0mvmGfNfXJnh1/TkEOJOV0ojbmTtzUvgpNEkXlGEen+4xDOrQ3aURQ2HS4XrDSaj5Hr7aKhrh6AyuwpNLD/y3OfeDej8jsDU0pyvlGfI+X9I28d/11Xwi/ysE9S/lpJotxnsDe9I89MIFKAPscknocTIWFzCSV/jr3M0m+sGI7sarhYy54W/6tCbicYmwfF8s3tbfFaRghwDfS/WJRe9Mq2fBqcgMsYT1+oTYKsjT4wCMdBv6GdVnVNiuBtqsBRSM3V4W7Zvy3KeN4/pKnxNza8Zp01c+iNX7Zx06ooA6y0f8yVB2HMqNNrZU9Mott18rPNQniZrEVUrhCYnWDy44vSEEop0VrmXWErdofiZn1hGP/cZ/f/rPT80t93X3vf4w+SZxm4GOo1EmdbKH63j5SRYZEE96QbifZOnOmyDvmfFsl5TGjhnRvtu56CT/dZArYBZxWw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d0884f1-2733-4f27-f515-08dc71fc36fb X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:05.1206 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 03/71] avcodec/ratecontrol: Don't call ff_rate_control_uninit() ourselves 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: Ynz7s7FrKuoV It is currently done inconsistently: Only one error path (namely the one from init_pass2()) made ff_rate_control_init() call ff_rate_control_uninit(); in other error paths cleanup was left to the caller. Given that the only caller of this function already performs the necessary cleanup this commit changes this to always rely on the caller to perform cleanup on error. Also return the error code from init_pass2(). Signed-off-by: Andreas Rheinhardt --- libavcodec/ratecontrol.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 78022d80aa..3219e1f60f 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -622,10 +622,9 @@ av_cold int ff_rate_control_init(MpegEncContext *s) p = next; } - if (init_pass2(s) < 0) { - ff_rate_control_uninit(rcc); - return -1; - } + res = init_pass2(s); + if (res < 0) + return res; } if (!(s->avctx->flags & AV_CODEC_FLAG_PASS2)) { From patchwork Sat May 11 20:50:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48733 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp297990pzb; Sat, 11 May 2024 13:52:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZ2eosWaj+K+ekkgF6noSaO95cjrniRLVSZAWqBi0JOwqBkfOLbOcQUT2LL8YNfD6I5b3dFQTr7D9Z2udn7rjylW0z7H4m0bHQfw== X-Google-Smtp-Source: AGHT+IGt7oaojWH+C/5otf13vvjYhOpSLRz4U27Dt8BgByek20ak7DCA7OESyv9/7slkp2hlFo+p X-Received: by 2002:a50:8747:0:b0:56f:e71b:74e3 with SMTP id 4fb4d7f45d1cf-5734d6f33c0mr4219006a12.39.1715460745847; Sat, 11 May 2024 13:52:25 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733c2d52f8si3233935a12.281.2024.05.11.13.52.25; Sat, 11 May 2024 13:52:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=ot+Xa6tz; 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 9319D68D5A6; Sat, 11 May 2024 23:52:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2073.outbound.protection.outlook.com [40.92.74.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9FB9068D539 for ; Sat, 11 May 2024 23:52:12 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PpTcjBGEWwKAkfH7M3zTuoL7+eJGIm8xUvZSCYWI9ihWM0LDzLKP9frqAn1JojNfxaRkfzefVA74PVBnCPRhjfX0oWHkI/DukgdqDahy85Nd0ibx8phODhC+uKO0kQYEuQ9BIFAqxqT5TDQh0UIAZUbhNsP2CZlOrykEArOhXdQQEdN3yY3TIyBhPQZCnQUp7EE9P/pToEudlxIVcBIiAWgaFOnPY2jUm0MMnAfilkj6pAsAq0FOuU2M0Y4uKW4mbU7YqjPo0Q4KeBJaN2ibleaRXslpdahyTVHNbwA4FONjHFeCPyWISSdWHiptkUjad/umVEAIF3Ol1gJT1/XizQ== 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=SldcewuFhX51BXbgitDItxFsfVSJrd4L1OOzDHVsBAI=; b=lbrXvvoWFswTFikdn4O2Nfm+VwR7IGvKkWb5ZqEShfTZ9C32OLLtbMCOH7MSnF6BC/df3x8LlVKGKEFcJSAaMbGqMyt9p/Rf6FmWMH1cB0q7Su5usZ1rjKEVc3bfqneCvdKXlWyD5LplNQOJ2EEhyBmM7Oxknav3QbUa0wKWh9jtRCFGtZg3tXn8Df0DsZyc10wvnzCcpDFzFgwFaKkfZSsHKkJbNCK5hk6Nw24J0x3Y8lHPYB1/SDEI1phunQBHtnyeDZlyn4/rRigNtzQiVyvale8Gi+zokJRNO1OiIzyT8KefM2KWL8FNCMBdbGyvOcwuxoF8uiMllwU5twsTIg== 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=SldcewuFhX51BXbgitDItxFsfVSJrd4L1OOzDHVsBAI=; b=ot+Xa6tzesAKObpUtxnNT3BybJvXZG+LT2UcQVKPkbL1seZHQp/ewr6/NfMXKP+RqH9PFEHPQSVO0z2w5QeuY66iT2Pd9DdIvyjSgyIB5xfLq1pQ66yb6tRW0jnAbudWTZi+nGyovfTYqukzRGZH+VbIIEpD7DWgE04d7JMiTb8k9CyS+vFDCUlS9zB3gjpqEGzbC6xA9ObRBGSMTW+ecQbJfVPlimtv5wfdlF148dFZtgNAXY6gClb13szomIuyqMil9viRdHvptpbu1tHTNLam7snveRtoDv3BkwArHeZV+/pmgedngEcNLgZhWaNJQI6CSdzjSD4ZjXB0KDDJ4g== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:09 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:28 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [9khZqwomCcoegWPF+jdVP75FL5qVcHlpT2dQfZQcMmQ=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 96429691-b8cd-4d4b-8e6a-08dc71fc3957 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 4g9r1p9resuXJxJs0gbh8I538cSyUSvTOUWbUVnN8ssi7YffK85lg1r7h6ujUWX584Xqfl53BDD6XtYVe2KI0GJcF9ZLZd17wxOTnmVYj4Ch8D4YsxAnl7IiNDmXofsXhYtdLYQzLEJY32o0okhuhWh03WrNovna84smmNHjsIJjIs1CVDtIVnwZYl6F5NgrQlR+d20ZLH/iNnpbw+avOmNXPUcpVrssi+g+UuYVqfp0Nvj/SrO+ylb1VdKz0i+/nEGNtDvzfmRonttDsjI01m6dTS8sGGdJh9ry9Mmfp8gtaICv300nSURS+nr0+tml445wgMw8ak2+lETRQyVEMh3946fM14gfVfYgk/CwMxJaZWenB6HYtm7JRRc1gGc1dzSgpOZSTlsu30vF28Am42UFltTPIF985Rg+d/7rQck229JH9y6DjnO/AdhDkmojdhNXuJehdiCRGgSvNUJNL++BrVB81tnesBK43Hadw7leTdXQxKRROhpck0fDcrrmri4jWxwN5rH80kYoT4bnB1x+ncdhR7rpqcVAsEUktgeQiG1e4YzNqB94GTk/Jklh/PVEsxMvEo+Fe4ElR4ScE5PqUcChUjBrLE45IfCRp/aSWgyQ/WjghBtHowuGtExN X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fpzshjo+AqragV7i/DFkLts85JvoYh3FFCNAr2F4NMf/tmclbQjjqsNEgWAl4NXET5cf1RsIYWv5aosOZegBU5bXr2Rc2gfjHaE5/tRFOJCdXgQx0KlV3fkb8YWJHPBcUIogFwqYjFq9vYTmTuzMV7KBbdFwufd3vR7rEKel8XKnyjZn0mOMiHxXKVJWe3U4L6So6G0J8089UTkQqMeOmlR76vc7mnkxhS/fxw+c5vV06ugenQt11OWBwiLVIKViYo/XBP0HiuBKNQof6MMaiGOiRyyW95QVy9/oR0RHjEXqdSBc/eQ66O7aemOrtWe8O3pbcHbsjFKSHWgWtpnd+TSGs/bS1Q2BPxCM4IYQxfvel1p+cYDqOxQjPK7ggeyQP8To47vbozxzlTy9oAosZfwoh3oK8A1wrvnG5L/SgcfFKZzcAsBY9OUlCzsIsajgMwKt7AZEU758uS8SR0dQ5Ekoxs3n7tfQCGJw/qrBafN2flO2TwCp8pAQhAcVUxJb9gkle2itMZ5pqsiHkmmtVXH5dXYyuT+PdzjTahbzK1n1FFdWSIDrN4plJhRic+Ba3nhf/E+QVZBBg9jytVY5TgtB8whxTTQIVr0q+ioseUEK1RbGkN38xc0qqPuybMhTMb79/chCBvhItw6eK+kgpp6kwLs+myjeRPwGi5LfmW9Sxa5E2ptz8HO+2DvPCzSvC7ImaGNO8ngeuE/4eWoYAWs9l7gqGhP6J02zzOuvEY8J5LGX+cVia9t3xFq52x1WrKWZb4LqiTANr4YlNQ85xTykhGD0vPMxZQpRnJ5BRdy+0XxXamgkQlX3XRtZAQk7/hVVF0Gz1KocCcmh7rgAKW9qqLW+BSX+b3xjz7xXPzPB6qpj0Bk6z78MKjGpNXRvjrW7BXTH4ngZlf5+8lh9pkO/EF/a16s4bKdrpwIFJ5akOdGl5JfLTyZLlEI46Cr8Y2UT3SJxstj1oSKHb1pnXzCcckDls6bw2GED0b6rh21DOj/3MU/GoCGdjPdIaLum/9g51ZoUesxb8f93GhuN+/IG4IC4dllUq8gwhs01qFZSa1aqkRbGVQp50UpyjmqH6vAc9KII53cKiL2eN2gsqS28B138kmr6FMrg1dPFbwB71iNL4t7gSSo0H4HGKPNYxMdLNE/cJKtZLRzBumMLevWd0L4dssjxBMqmA72fBcwbD5pSJpHOXeawKB1pE43IdxTpENBJcBge3YvAIWVqRjIo+avJmiJ+TzblVgVUcSh4QGWicYJffWoJUUGpBk80ees8k7JxBtM/Py1w05fR7g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96429691-b8cd-4d4b-8e6a-08dc71fc3957 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:09.0141 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 04/71] avcodec/mpegvideo, ratecontrol: Remove write-only skip_count 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: gvQjxHbfsU5I Write-only since 6cf0cb8935f515a7b5f79d2e3cf02bd0764943bf. Signed-off-by: Andreas Rheinhardt --- libavcodec/h261enc.c | 1 - libavcodec/ituh263enc.c | 1 - libavcodec/mpeg12enc.c | 1 - libavcodec/mpeg4videoenc.c | 3 --- libavcodec/mpegvideo.h | 1 - libavcodec/mpegvideo_enc.c | 4 ---- libavcodec/msmpeg4enc.c | 1 - libavcodec/ratecontrol.c | 14 +++++++++----- libavcodec/ratecontrol.h | 1 - 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index 438ebb63d9..20dd296711 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -253,7 +253,6 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64], if ((cbp | mvd) == 0) { /* skip macroblock */ - s->skip_count++; s->mb_skip_run++; s->last_mv[0][0][0] = 0; s->last_mv[0][0][1] = 0; diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 97abfb3f45..4741ada853 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -512,7 +512,6 @@ void ff_h263_encode_mb(MpegEncContext * s, s->misc_bits++; s->last_bits++; } - s->skip_count++; return; } diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index f956dde78f..fdb1b1e4a6 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -824,7 +824,6 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, (s->mv[1][0][1] - s->last_mv[1][0][1])) : 0)) == 0))) { s->mb_skip_run++; s->qscale -= s->dquant; - s->skip_count++; s->misc_bits++; s->last_bits++; if (s->pict_type == AV_PICTURE_TYPE_P) { diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 71dda802e2..bddc26650a 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -512,7 +512,6 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], /* nothing to do if this MB was skipped in the next P-frame */ if (s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]) { // FIXME avoid DCT & ... - s->skip_count++; s->mv[0][0][0] = s->mv[0][0][1] = s->mv[1][0][0] = @@ -536,7 +535,6 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], s->misc_bits++; s->last_bits++; } - s->skip_count++; return; } @@ -691,7 +689,6 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], s->misc_bits++; s->last_bits++; } - s->skip_count++; return; } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 215df0fd5b..a8ed1b60b6 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -345,7 +345,6 @@ typedef struct MpegEncContext { int i_tex_bits; int p_tex_bits; int i_count; - int skip_count; int misc_bits; ///< cbp, mb_type int last_bits; ///< temp var used for calculating the above vars diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index e31636d787..f45a5f1b37 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2532,7 +2532,6 @@ static inline void copy_context_before_encode(MpegEncContext *d, d->i_tex_bits= s->i_tex_bits; d->p_tex_bits= s->p_tex_bits; d->i_count= s->i_count; - d->skip_count= s->skip_count; d->misc_bits= s->misc_bits; d->last_bits= 0; @@ -2561,7 +2560,6 @@ static inline void copy_context_after_encode(MpegEncContext *d, d->i_tex_bits= s->i_tex_bits; d->p_tex_bits= s->p_tex_bits; d->i_count= s->i_count; - d->skip_count= s->skip_count; d->misc_bits= s->misc_bits; d->mb_intra= s->mb_intra; @@ -2875,7 +2873,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; - s->skip_count=0; for(i=0; i<3; i++){ /* init last dc values */ @@ -3504,7 +3501,6 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) MERGE(i_tex_bits); MERGE(p_tex_bits); MERGE(i_count); - MERGE(skip_count); MERGE(misc_bits); MERGE(encoding_error[0]); MERGE(encoding_error[1]); diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c index 119ea8f15e..c159256068 100644 --- a/libavcodec/msmpeg4enc.c +++ b/libavcodec/msmpeg4enc.c @@ -405,7 +405,6 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, put_bits(&s->pb, 1, 1); s->last_bits++; s->misc_bits++; - s->skip_count++; return; } diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 3219e1f60f..ecc157a9eb 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -39,7 +39,7 @@ void ff_write_pass1_stats(MpegEncContext *s) { snprintf(s->avctx->stats_out, 256, "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d " - "fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d skipcount:%d hbits:%d;\n", + "fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d hbits:%d;\n", s->current_picture_ptr->display_picture_number, s->current_picture_ptr->coded_picture_number, s->pict_type, @@ -52,7 +52,7 @@ void ff_write_pass1_stats(MpegEncContext *s) s->b_code, s->mc_mb_var_sum, s->mb_var_sum, - s->i_count, s->skip_count, + s->i_count, s->header_bits); } @@ -606,13 +606,17 @@ av_cold int ff_rate_control_init(MpegEncContext *s) av_assert0(picture_number < rcc->num_entries); rce = &rcc->entry[picture_number]; - e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%"SCNd64" var:%"SCNd64" icount:%d skipcount:%d hbits:%d", + e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d " + "mv:%d misc:%d " + "fcode:%d bcode:%d " + "mc-var:%"SCNd64" var:%"SCNd64" " + "icount:%d hbits:%d", &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits, &rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, - &rce->i_count, &rce->skip_count, &rce->header_bits); - if (e != 14) { + &rce->i_count, &rce->header_bits); + if (e != 13) { av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e); diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h index a5434f5b90..1b49889f75 100644 --- a/libavcodec/ratecontrol.h +++ b/libavcodec/ratecontrol.h @@ -50,7 +50,6 @@ typedef struct RateControlEntry{ int64_t mc_mb_var_sum; int64_t mb_var_sum; int i_count; - int skip_count; int f_code; int b_code; }RateControlEntry; From patchwork Sat May 11 20:50:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48734 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298021pzb; Sat, 11 May 2024 13:52:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUJLSCXqo2+qVB2QcMYwJECr3RdvonT1edSILanpr5CW5cHc+Z5HXse3I3359W3Zp4z2m42NJqo8MZ4rvQgkOBUMRgihj5KNvoypw== X-Google-Smtp-Source: AGHT+IEBKQR22uJEerb/wOPH3yPnzv92e2Nb1offAprhlG6u7Yd0ktSl2mQhgm4hYrbZzWpWezsn X-Received: by 2002:ac2:424b:0:b0:51b:1e76:4ea9 with SMTP id 2adb3069b0e04-5220fc6e5d3mr5184700e87.4.1715460756058; Sat, 11 May 2024 13:52: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 a640c23a62f3a-a5a17c2c0e5si367032266b.959.2024.05.11.13.52.35; Sat, 11 May 2024 13:52: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=j258G1ZP; 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 C08AF68D5BE; Sat, 11 May 2024 23:52:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2073.outbound.protection.outlook.com [40.92.74.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E22B168D539 for ; Sat, 11 May 2024 23:52:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mw6x/ncRBzkLTtibp8oH26geDInqNlW9DjTzeZaEevUTyg85Fwisw+PZnyhjbt1mqbaBCgUQYWeMsx/bPRlL8AbmUEWebfS5d6rcJBKRQ6KqKW4XYK//icwF1W7OXPl9GZfTBs522H2+YU2dVQll9eQ0JvNGpQscyOoamx+pb5XaCE53X5Pf2muiQ5zokT9f04f8Lmi5QfYvwEP+fXlAQXtZrjdnfWJ6nnZDAFgr3TgTQt211bZXbDVAn3OpP1NdObPnIuerJ9NzFzPGJrRy0ohuK9gx/mNdVNvPr9RG7KfjfmUOcvfH6DpUSp/kDiR3/JSHCwcD8duCNtw00vRHnA== 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=oAWBP7Lhz3Ne//l3Gq4fYxozoWjTU0yd6fBmAiYiUGY=; b=LEsvLk7d/tILuk7hDb4K5He2QVnHasdLAfvf/xZeMOd2dA0iFMkuKtIFiiEz0yKPyzSisoR6ADN6pAIYHU3g+AvEL3ZT9utLSwfGWQ14Hl5TtcbbM+iJVmJp7jqc71PeN8ExZg3dPjhND+gse+XccC0TGfWYhI7PlYv2dbUs1tgUPyUDNHgr2NxLMuQsPU9i0j2fIv2xbepsuYlN3M+zZlnO9Yslcw2ATyioxAqDgW6jYiLJHDDx0mr594tCk18LtTIdharZv9+q34aG3I9VZQP1QwarmQxwbYYsO7PUved6DxxwFBWaATLS15h/GxTQeAtUFoLhpIZBsWcomsTR4g== 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=oAWBP7Lhz3Ne//l3Gq4fYxozoWjTU0yd6fBmAiYiUGY=; b=j258G1ZPaKk7qm3JUXPoTgYaAnTnnXUnvcXZfIDNGPaY0zQh8M3vHw1F7lw5/ad1OPGPQRZCb/i7gZx8JLF+enSqRXfTm8dJ1Fi1GsbrR6IKbZ5bZiz5PJv6kJ5p8n3bbagXvMANgU5HlCGAIws0vc75/1erlGnyLz34tYru39HxyUD5gAYWnhZRMyYnXeoCbx6f00E4iS5hyIca1o3Y8KgBRPR09/GBYm77Vko6iz9Em0cLWAtl1Spvd3n5dzv5P2XUws4FtOaUaaKLeZZXuQP9jDjihYudUHoNAEnmB1wKrluZSGyj2999wMnjqbb75mAKFAOVSWPV8M7CHzAo0A== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:11 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:29 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [U28PosedRFWO5bhI8oiexGqgERsq+LBsILoC7gAMoLc=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 4416c4ea-bdbe-4b48-c2c5-08dc71fc3a9c X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: /PtEFMWL9ayEgpRWv5/UebqfLgiOH1uHlomne1zrGJeh+exce3xHLRuB9EzX1ZpUMNmdGmJ5/48nWS9DvTWse5fG16+mnCZUyKURzA9nRhGywKIg/g9mDNUfcJo+601Ah1gtiunvRNQsLArlRu2vKQsK/fVf4LmX7hKX2N9QQNGkw1Qtpl7psd9ZG8KG4aqeelW+eQQbcGiPw1tlUvlx9ci9vnsAMsksU9UI0uzd8U5BrF2BGj61m6s10oadSC85M2iTbYeRpXaRpjhyaagrR4+yYXd2c/f5jSh3LEMQiy/noSvO1Z7JEbi0qW3oFRAlNzpUvR8a1dRF7nUphN/s8RzZvGdwv7+8Z4hhtUQWJjQch+lYSUQHFSdkfeUtpssa9IS+9wj2hvCD1TXA/fh2ZtiQLo00NBlhpbWmUcG4nxMUMRFlv8vxaBjf6Q/R+1gLnQLjHr6AAbrkk9rhjF3200t/gn/lLCToAE/nZ+uutXSACFl3P3pIxTjhpXbDOwgMNeJIqpZHaOCjuuep4p7UHm4rcs6sFU05hKkmdSEOXficv2cUPDSQN2JDp/0hKF5i0OLU/jSBKrtLkyUTfe8QxQTh9gZqvA74exKD+jbh7Q0eRr9dNTAbsgHxhCYmdWCb X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7JBDbu5/XZ2R7XSKk1mWfnGJGFeLGgCY+JEgZA1fLbV68W64qIRYEa5N2LQMlT+v1CGSRW7r86XS/Xe8yC/EgzJeSV3sUsay1uQdpwFKzKYDrKmVNMw+b6zVguzAH5LufEglzsamtT1H60Ha2733dzcNAN15kAYRw5brq6HI93rvm+gbzvbqduKJR7k624WxPS3Q/SokOufR++41M3C68KkNt96p6EHURpQVcl/7hlsL3Kp+s6R+J+eMk+wBoMUCoEJhaJq1bJF0liAzTwn1WheCCKctTyxaAmKF3BPquNODuR1IcI7b8GJtDVNoEHiZxu9ake+U2WHbiLBOJfofVeKzCJx+abPJYdbLWmceuqq6qqcwXOGhZxcNf2QDaSOK/Ko4O8dBOOsYexEEv8r+2XWRAC1yRBU3X/ubFoK8MfdetcDkb25+s3dedE2ePLnqA0MB9+qN3t4rx/YXVyVMeC+6Y8Z4BPgkaXrMOiXd1yIlpa9Vtdm1xhCfOJHCthdw0nqhr636xKGyLuMS2G2hqutfiInwmdY2N5IThCrClCC35NxwNE0I6PPbY2Wr1mR2cbd/cCycTjOHbmZSqRjiRajGWVmRBHToTuTaaXgqCixLEZbUj5gcJqDGlXSxrmLL4qrd16RTui4FiEea7yIzn44aBECk7f/yKpsJeVvsXEbReGMF2FUowl0P9syFDIAujd64SR4aHxNPhBys7WV6szKdQZ857g0W7Vu+IFE/zd8JwxeShzQX7xl4XygXaB4/rF+aFT6axtFsEa0hlWnHJM3T5JTt+kO28u791whTAEfDXjG+YeFG5zp3rIXkcsCRQwEb/xA7IW2HwmMZLjDyCliBztE3I7B1VKcwiKqldUUqQYJNXtDDmzDY0gWPMg4oUyTg3EA4PKKgeqFICX4aMcIk6dz79PwnPeWDAIEtQSmp/OZuKRoEYyls9QpKdrN+0m4OISunhh1meRYpSDCGWZo3t7Jw9qsBdx7HF2aMoSk5nEmM7jAEHvy6/WXOjOzPryFqYRpPk/qEj4Xe+0YpA+HyPk57d6IFkVpuOsJ2fNGQM8H2v5IxB+3cVV/2tcnAQYh1xozuD8CQdDFv2Y8LjbNI1rMAnF45Vxxgssmvt9n8YPZA3WOT+O6VKokYiJh/+PfF7j2iMTor5YOgXjTqWOgTqV0B40sh6vbxSBjDSLrmJKXJ9pQ8oxlDgx17u8BmSGNiAfBRG1ll0f1LcPbXQiy3+DByCU35r6OETRNdQqlxL5Kh8YA5P0nX19GT3GK9kkDFt43E+dedLkQhBkxyBA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4416c4ea-bdbe-4b48-c2c5-08dc71fc3a9c X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:11.1762 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 05/71] avcodec/ratecontrol: Avoid padding in RateControlEntry 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: pjJw5q+5zqLd Signed-off-by: Andreas Rheinhardt --- libavcodec/ratecontrol.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h index 1b49889f75..4d71a181b5 100644 --- a/libavcodec/ratecontrol.h +++ b/libavcodec/ratecontrol.h @@ -39,6 +39,9 @@ typedef struct Predictor{ typedef struct RateControlEntry{ int pict_type; float qscale; + int i_count; + int f_code; + int b_code; int mv_bits; int i_tex_bits; int p_tex_bits; @@ -49,9 +52,6 @@ typedef struct RateControlEntry{ float new_qscale; int64_t mc_mb_var_sum; int64_t mb_var_sum; - int i_count; - int f_code; - int b_code; }RateControlEntry; /** From patchwork Sat May 11 20:50:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48735 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298049pzb; Sat, 11 May 2024 13:52:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV12b/uopmc8kiWgLu3oe9leOYiGSlFWF1wMaXm5a2qSDzGCsW+KEh48CIkL+zCuGqnVCDZ55IFBekge8g+Covn0iKgAnTmtR+k8g== X-Google-Smtp-Source: AGHT+IGUyy7PanyCIzc4CT50O1X9FdYdiRFirSUOd/7oh8SdexIHmLXcQ/dH6XlDWlGHww/BCWpk X-Received: by 2002:a05:6512:2201:b0:51f:2908:df48 with SMTP id 2adb3069b0e04-5220fb6afaemr4606225e87.18.1715460765449; Sat, 11 May 2024 13:52:45 -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 4fb4d7f45d1cf-5733c3275e2si3371047a12.400.2024.05.11.13.52.45; Sat, 11 May 2024 13:52:45 -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=mfqKj8qj; 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 0952568D5D2; Sat, 11 May 2024 23:52:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2073.outbound.protection.outlook.com [40.92.74.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 333D968D539 for ; Sat, 11 May 2024 23:52:18 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvNuUmm4EPbs3ZguAkUcH2QbebYr54KNOhYJOyFUIlhu50LfTqYFoB16IQehB82hhYj7KNJEuHvHFN1F3XPfHtLWxWyRLHchbvwc9OATKD1lfq8qsXzyw1OYfwqDUwtwOy7i12oiHIonAM8k5euEeccQa+pOGBitVipeojV1afc5oVWGKNgknmqn+LdSETmjkVKHSsra0slEkUnp9p2Hb8yYiQWqm8CR48vCM8xBWTfj2qvU9ojjAt44jDO3yRfOiJ8xeQHBCeaX+FxuAykxnKyiYN9rLHZNFdC12zh7nu1/f4Xe9MwsgO26ag2opMmGT8my1+WaMZcL/1i6kt442A== 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=4K1+dfFtJCAeHetnjWmw+RNXy3swRhMS7XRYrc1iZ+E=; b=QvAveC+DR5uGcbif6dX3oRTlxuWQZJsmh8uicxwWodNxaD6Lt6bU9t/8nJ6YTgVy5C1PfNRs7SWph5J+7f4ZP30cFRzFQ/vcER3piznyasE965XpaC0ajSeTAMGldRSsvgKn9ECAAJzlPHqnDR6vLL54d5RyY0gx/GUhRszi6s+J67AV5WhJyTsNMSTJFjvsJ8kGMAkDjtQr+Sqjg9DlktjkC3C2wR+mUUWXkjrmOBSqJWxs/3XZ8k4xnq6udVoD+N0CLBHMGj2Tx5YXL0ywSHT4iw4Nsc2gWv7v9XccATdg6Z6XzXYqiqzfH6ksIqO7UBc+0HI1e2d4JrMEOD/zEQ== 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=4K1+dfFtJCAeHetnjWmw+RNXy3swRhMS7XRYrc1iZ+E=; b=mfqKj8qjr62FFOgcpoQldOrXnKJha+1sB0mv4BFxH0iL4Zz0Jt7ZKX2TUr4q56z624Ef7TmaXM+XJBXJ16uG4J4gIQKsKRnrNUnqMUm3mhemqX80FkB1TNWyCFugKEYfMG5ZHIucARj0TvtIQ1uyH2JP+fFk9u9Z0MgPGAOeliE7lmZj+FHsLtwLiScakhhIxpOfS6p0454NYYBy1az55ZAHhv4N7BFkbqkc9yWKFMZ8gN4MKgVnDD6A7R+i24B5Pr3SASVkemP4uzIfYwF8mGggKwQERQeI04RkIQreIIiwrAU29gOnFlIH5cb69KHgof/QxJdD4KsEWZ8lBHP10g== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:14 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:14 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:30 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [oQs2/yKWmzHvJkxcdT96EaxR2fImzh1+kIACpXfELi0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 35115728-c01a-4199-0667-08dc71fc3cbf X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: sdxAZLlFGWPZAGqElLl0XbroXDXGJXSH7+w3cBEGINEjbjoIUS7bd+tTPorWE0+6tdlTxqzCoss3ez2xEZx+YVK1bzm01cDgHOkqktI6L6acyF7rMxaqDM27eEY1ZylPr30+E3srBfElmteTd3Sj77oZvB3LOEfmlgF62T+fbcGVLhxvErln5/3r033FL6AmLK5tI8NZdu4b3bCGD1rGldaozZPQC2p5h1H3MCX9HArjWA+TwKzQnXIxu7lF2OVnD9QvW5hxlP9me09biuvgAKzovrECj+Ld9VLfZ1xTBaEFie2DVHYPUW6l/ugY2twi40/mHO0KTbR6gw0I1gZRegOK6M0/secDbE3pkRKbqX8mcgRhPGjVcPvkFjAZcE92c8vgGDOrSrvjGv1ov35nITQt/24/2G4exzQ/Ihg7mcrWubfu41QywN4WUlcOlnrPfhyY/MlqzOacnP98TUkEk4nVjFvhRjmgK84cVLmuN8WGCSbeo0CvdQ+Bej1UD2zyMW4nFcDxvvhwxHhBj8rGoOMxX6Ii7oieT9JYsiHi1rmHZW2Gyvxfkx+4xDLtA3bijA0XrybVV5K4THA2jU1dxbX0laLTDjEuHiym9n7bXAdUi17WgJWb9mXRN9EAjj9k X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R+RjqQV8KiyltOyzoykTwkt/jBGMDkTDybBm9QNsBHiF3GD1i8vyclyOeGpxoUoyyb0uKtAvAv7vX8wdVAB5wylRsr0BGSZgs2C9s3cHdpiKgvzpU86gdhaR8VE4KyenvbXrA2Ir6xZRrOcL5VK+3Kua0xqEVyyfP+NN9yBMktfbGolSKf+jiFd9uQkhZ3a+B38O0mjpMvpXwq260xusTmgn3cm09iXkD9vNFDkkltn1XaRU7/z9mwZuRjbh/jzkIr3N0yiNDoFUtpYnTx8nYo/kO73gYzzMOYahDbdJFFdbpagMK5y0qLmnfVw53jl+UiPGyav+XbOSIwzMqDoKkr2IzsJDu382ILweEGRXMONhteK9SECed0a07QompVsyG9+jBrDJH+4j+TRuRD89hyR8aHM5NhSqEO2ZRixrBsG0nuvUxaP0oOPrhqgrUBpFKrcmu7JCZ1FkRsu3pmbmPmWrpRE5Y1B915zGty9TbCk76cGVB9clMppmfDgMSoaqcM5R6lxYSAnW95RHHRJ9Eb14BdLbN9PDAlvekPz5S+UURFfEZbYAgfMv9k6/Se5eINGJQHoVJwZxbba0ESCksIalTpjh3Vqrkyy6IqsUJV4H+HJMnHQSn0AY9481/DMSsS/NCpBc/5Zb4/fQgAoqIfrSrPbdjea1Mtp8zr6/WLLlfW2ILxLx7gNPqOZqiFnZeJ5EsBOZcqoH1nP/jBxnXVjjNH3+EI4xssUXpqbuiqy8t6UMsMgJjbdz0s/IgG8pMDNXNENhIhHOKxHYzowBOf7u0xBb3f1ZJHCA0Ui5gNYRnoo3IoEZQ9AfEdiph6yS4Xj8DjKV6dc8Ae+A089tD5x3NbE2N1vdFhYscTEn7qknA3GXMKO5H5Q74IJ+ss5ddW9U4Nt1Im7qyPR/p5qIX7thnQun13B5AU3yy7EpLdB4wGg4KjFc90mV58RHnHtwdNZeuoHLVckUC6J2pXTu19tIHtmiuwslg7RlhAgw668sX/5zLB5Hy8l+O42yL2jGYG+sfpwWfY/R7XB9QPhBvza3kJNzLaDI1+QjUvGCWjiXi7j3oaj/pXTcU92vBydv3C3GafsLqLJyPlvXiWkzDcdxGXcXovy4Axfof4cYHtYKxLKgB9VVN8zEEfh/7TCN2DyFkFka+2MkEac1/J1K8Kg3G6GsEjpBVLimuvBhXGT/UQo8YI1HuH3AXLWTwAumZMkQLF4H9i87jmG8Gc28DPVh0ciuoXYkrhcnGiPUmdh8j1mcRUWrd3DmxM5NSdvxdMZwKqBFyt1O5vNLFPAPJw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35115728-c01a-4199-0667-08dc71fc3cbf X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:14.7094 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 06/71] avcodec/get_buffer: Remove redundant 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: Tt77bWpNxVnK It is unnecessary to check for whether the number of planes of an already existing audio pool coincides with the number of planes to use for the frame: If the common format of both is planar, then the number of planes coincides with the number of channels for which there is already a check*; if not, then both the existing pool as well as the frame use one pool. *: In fact, one could reuse the pool in this case even if the number of channels changes. Signed-off-by: Andreas Rheinhardt --- libavcodec/get_buffer.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libavcodec/get_buffer.c b/libavcodec/get_buffer.c index 9b35fde7c6..ff19f61e86 100644 --- a/libavcodec/get_buffer.c +++ b/libavcodec/get_buffer.c @@ -65,20 +65,15 @@ static void frame_pool_free(FFRefStructOpaque unused, void *obj) static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) { FramePool *pool = avctx->internal->pool; - int i, ret, ch, planes; - - if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { - int planar = av_sample_fmt_is_planar(frame->format); - ch = frame->ch_layout.nb_channels; - planes = planar ? ch : 1; - } + int i, ret; if (pool && pool->format == frame->format) { if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && pool->width == frame->width && pool->height == frame->height) return 0; - if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && pool->planes == planes && - pool->channels == ch && frame->nb_samples == pool->samples) + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && + pool->channels == frame->ch_layout.nb_channels && + frame->nb_samples == pool->samples) return 0; } @@ -141,7 +136,8 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) break; } case AVMEDIA_TYPE_AUDIO: { - ret = av_samples_get_buffer_size(&pool->linesize[0], ch, + ret = av_samples_get_buffer_size(&pool->linesize[0], + frame->ch_layout.nb_channels, frame->nb_samples, frame->format, 0); if (ret < 0) goto fail; @@ -153,9 +149,9 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) } pool->format = frame->format; - pool->planes = planes; - pool->channels = ch; + pool->channels = frame->ch_layout.nb_channels; pool->samples = frame->nb_samples; + pool->planes = av_sample_fmt_is_planar(pool->format) ? pool->channels : 1; break; } default: av_assert0(0); From patchwork Sat May 11 20:50:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48736 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298061pzb; Sat, 11 May 2024 13:52:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDIYfIDoVK7UhR13yx5q0xavKwfRDFW0aZHayMc/nvD5aEmkyQC3CQRFYOe/6YJWNNlpFPf3R8OypLL9nXBQ8LlKIcu5ayJlynJg== X-Google-Smtp-Source: AGHT+IGDaHmfT1KPQjQLOT+4j9WUCqD3GnISUBPzJmiwaTm5di3NTJNkicr12LN0vf6uAvaRHuyc X-Received: by 2002:a05:6512:201:b0:51d:3a99:f22e with SMTP id 2adb3069b0e04-5220ff72e3amr3320422e87.59.1715460775230; Sat, 11 May 2024 13:52:55 -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 a640c23a62f3a-a5a179461fbsi335781266b.102.2024.05.11.13.52.54; Sat, 11 May 2024 13:52:55 -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=GFC6xYDt; 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 4EE1B68D5D9; Sat, 11 May 2024 23:52:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2096.outbound.protection.outlook.com [40.92.89.96]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9451368D5DA for ; Sat, 11 May 2024 23:52:22 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i3wBIsxv+wrsh/AlB9veBiRcXmvo0b3DGpSKQU07Sl9f69BsKMHtgO32GBI8tngLl2HCut6I4EUKUpPQy6rdznxRXvGF4Gy+geIFOI+mxfRkFa3Tda38n9UlBKTic96cuTjpV8EWPWN61/vehdlDj/6J0iZzTD5WJm0gvc8qFTJAifXvgXJ3MZDPT6q79R77EmcgrDVMR/m2WAjKWYe/hdUgLOXfNSM/RQ4skylQUb59q5vZ8G+oQwfj8+gSSClmwEqIZ6u3ui8fCoBeqjey7R/pYOEfweiZHaEqZyFsDXgpi+ZdTxVXASvdSEWdVdCcsDKcAQRqnJsAQFYp8ViJfQ== 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=IPeSM8o4di4y2h1O7ATk3wqLnFOi8xL8L2UZ97N6Sig=; b=lQlxgRVurUVkUeDA/iwuBf1q6GUSZm0cGiyHQTnhlKrkoVm8BArjbOHDOvHABF2IFKbjPX2TcOy2D2EcbMveT/eBTyrtUvZGkklndAK7tx3/D/1K+Ig8rJoM3pEIgCN0UMsbrIhe4qLUKFFMgG/Rx9EIpCPR9fQZyj/Rty1jYcW212mgUIf8jclVLsqxXmhst4FdZjZBsqKo5FkP6Pg0318ujpuz3jFgqKNiiO+xWMm2eUAO4PM2QYi+lENXsw0koouRdjAPtr+KfLqzVpEdKb6/XskcLmA5kt3wMpTaGryYQ+JvzIGKrhfkft3aDMuymwUNTd+suT0cvR/M1GRf3A== 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=IPeSM8o4di4y2h1O7ATk3wqLnFOi8xL8L2UZ97N6Sig=; b=GFC6xYDt5e3+TnkAnNE1TUqV3gh6lo9AdhdNywUmDt/jMGK+3QJIe4+I74NX3OQsfe7dqA1iqsl5aL7PFr+MvWr3iVQuujDu/9f/z7zO5s7VQrSUmjjXGri6Xl3wZvzZxbz/3MjLxkuioDOnSsCnbCpk+68ydBEIQSt4uF/JqZ46IChIF04fNt3bCI9AOa98orttjvdljp7pQYe0PMcMTNcL6gr9XMqQLcbJR9cD3rT7PghRGnqp1M4HpbFIepckCzUqG61QXvw8Ny1XkGgb2+bmDnNEO9D42vMtSz8TiHYahZGkTqQHg74h5gxEScNYQpCVVO1unqRf0x95ZaLuCQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:18 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:31 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [GC6vWV1cRsigytel1dq4RshD48asdCRPikKMPCH2LPQ=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 35a2077b-e896-48ee-323a-08dc71fc3edc X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|56899024|1710799017; X-Microsoft-Antispam-Message-Info: RJjykaYkoBv2A+37p0L2enoRjYYytexLnyftskNxMwZ5ifD8hGYTPnPInBZCs22LoGSAiG+iO6kbCGtgXombhdSQ/Q/LO4fJHV8KHqQ34qz8+veu63v8mlsRN42mfT9makbEzmkDhhPV3i09JhEcPGs89k6K37otCBQF9L3hLvVVKC3UNXHPmHi9ZyKm7PWJL2sETUyswPcBh1jixPTPW+5lxP0gjSkTCerXxCpolAFLzVQsY8i0kBvoBra7Moe+XqbLzZksU+pS7H9t7YNdj1nZp+vLb/JEbob5z+NuAprmBE1SiMqt5cSHnxy+xHV7Bof3kF6rYACEqRUdLf6a2joy1kQWo1mqntVoGbrD0/7+B1Bpb6lnvA6jKiNq5T/81Aj1TcJtQQ0tCxdQjyznsDvKAJqlZ9qV/RUJTwdi/95ODjMqGQvzwl8smoQM2YE25cH9gDka9EKLKRVxngvC9vv+cQpXSy1qCBwNhQBdQ4J2oPE+1JdVdiHasE/ifim9G/jVjuzC0q1mObUNLcd3Ovvcv852VKXsnEm/OxL5AEhuwUPxhWb7tp64zuCUE4fxkODpnETFNsuUo5IS7lvvLX7wyzxBKawxbglMbhZMIShuzw99n2vLGl6flpG1qdws X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CB0l+FHT+AaUBqNGMi71nkcUdJlBID15unb6gTgV/JkwXzmopkfaKcZrEELSxN2gSD4+sKHhQaO57E0oS8HvskL5BYP5uyqzdB1yenoYhv1ry8Ulcf1diYo5xkxf5j75kKdyNkIeOI9y9AMvQEiLsOzU653O5fgRwBw18F9/0e1jsXKgbadUaEAHUSj+O+YYFFqiC3ahfDmuwkqxkX9ze3bD3Rs2C6infAaJgyam6MNdWFwcHSbuVrvqT3sVOA1WjwsH2KEkqUha0TvUpwvWRSL8OknCOlt+S1Qb2sAuvaCn20bL7ETiU+RXr+ZuveaOyIogSj0roGLxbS/0bIme3Smie9OmVahtdtD+yLSNcgL5rO8I7+vNS4WM63uRXBBaDHAdGnb4zNoY39Aie5ydRo2i7k98y7A/o8GIgsNvJXkb226Mki1eQ0O3m7hDvD2efkuwxzYMPI+ra7rmgNE43JcoytElTsotGUj/Q1Ahg9pYIp0OE2KG/Boa8C7Ln922FCrpGPXWNRA8u54mkagRBrKK3xwvPDjZgmGV8IuvQ2yjA+am/J7BDdzFZQO8Tajg7SNZGiNVkudi+pYASi7pDKoJr8+k41rhqAFGLDwJgjR9vL0/bCDXYuJikCWhhe3Sv1OtdHToWjgGTR7i0OBkhIpy06Tli/SNKsZaVd7RLr9VIOACEFez7F9FTUMDPCQcsY/jzh42mzsIPIwfkzkSOWZmg359X1EfdFzB1f5ZnQW0CQ84IoJEpzbo5jG9AADLqRZZrhMCpGiZIjvrrltCKn69AV9Zx1KeG3CkDc1+xwqcpKNsYw7Ah5pVZAKEj+GuAYS08CQ8Fg+fCyiKVKbe/aIu6Sy7hSXwfdsuuQnhN8tOIL4FqkIXYyMMSfsNd59ioM17mJxhIfd4cjviM844tT5dnfTRAR9cbB36hWbgJ0Y0Wn503m1CNouu5GfQpQVPmzl1zCeKBhYHlEQkoJBNHf383BUtfk3jQX/arFhdYYIcO+CFaEgkSrYx7fMtSaCw5WH6ZF5kDUi5+L7mLOIQ56eBg6AfjD3sbPnmIpwf0Qbgbh2nwnTrIcaB5GiQZkTDVBVOOQX+4IF6uzJXX0e/nJPPRinoUU3bW673rBtCtymNcxrkaKYXSc6NY5SvfrUEk1l1CWnugBLXsWFk5I0VSvDZ2t5N66cV4T9lwEgVNsgN3CRd4ou8Q6l0k3VfBvffd6sw1JCqmxC/UBn1pMDNoFHXHuAi/EbxYf5WfvgABLGewsfW7MuIUPjJv1aG3n7AcH+hqTPaBgWx1yDCXxQLAg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35a2077b-e896-48ee-323a-08dc71fc3edc X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:18.2464 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 07/71] avcodec/mpegpicture: Store linesize in ScratchpadContext 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: 8lOPSRDBqeTT The mpegvideo-based codecs currently require the linesize to be constant (except when the frame dimensions change); one reason for this is that certain scratch buffers whose size depend on linesize are only allocated once and are presumed to be correctly sized if the pointers are != NULL. This commit changes this by storing the actual linesize these buffers belong to and reallocating the buffers if it does not suffice. This is not enough to actually support changing linesizes, but it is a start. And it is a prerequisite for the next patch. Also don't emit an error message in case the source ctx's edge_emu_buffer is unset in ff_mpeg_update_thread_context(). It need not be an error at all; e.g. it is a perfectly normal state in case a hardware acceleration is used as the scratch buffers are not allocated in this case (it is easy to run into this issue with MPEG-4) or if the src context was not initialized at all (e.g. because the first packet contained garbage). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 19 ++++++++++++++----- libavcodec/mpegpicture.h | 1 + libavcodec/mpegvideo.c | 19 +++++++------------ libavcodec/mpegvideo_dec.c | 19 +++++++------------ 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 06b6daa01a..aa882cf747 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -89,12 +89,16 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize) { # define EMU_EDGE_HEIGHT (4 * 70) - int alloc_size = FFALIGN(FFABS(linesize) + 64, 32); + int linesizeabs = FFABS(linesize); + int alloc_size = FFALIGN(linesizeabs + 64, 32); + + if (linesizeabs <= sc->linesize) + return 0; if (avctx->hwaccel) return 0; - if (linesize < 24) { + if (linesizeabs < 24) { av_log(avctx, AV_LOG_ERROR, "Image too small, temporary buffers cannot function\n"); return AVERROR_PATCHWELCOME; } @@ -102,6 +106,9 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, if (av_image_check_size2(alloc_size, EMU_EDGE_HEIGHT, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0) return AVERROR(ENOMEM); + av_freep(&sc->edge_emu_buffer); + av_freep(&me->scratchpad); + // edge emu needs blocksize + filter length - 1 // (= 17x17 for halfpel / 21x21 for H.264) // VC-1 computes luma and chroma simultaneously and needs 19X19 + 9x9 @@ -110,9 +117,11 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, // we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines if (!FF_ALLOCZ_TYPED_ARRAY(sc->edge_emu_buffer, alloc_size * EMU_EDGE_HEIGHT) || !FF_ALLOCZ_TYPED_ARRAY(me->scratchpad, alloc_size * 4 * 16 * 2)) { + sc->linesize = 0; av_freep(&sc->edge_emu_buffer); return AVERROR(ENOMEM); } + sc->linesize = linesizeabs; me->temp = me->scratchpad; sc->rd_scratchpad = me->scratchpad; @@ -149,9 +158,9 @@ static int handle_pic_linesizes(AVCodecContext *avctx, Picture *pic, return -1; } - if (!sc->edge_emu_buffer && - (ret = ff_mpeg_framesize_alloc(avctx, me, sc, - pic->f->linesize[0])) < 0) { + ret = ff_mpeg_framesize_alloc(avctx, me, sc, + pic->f->linesize[0]); + if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed to allocate context scratch buffers.\n"); ff_mpeg_unref_picture(pic); diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index a457586be5..215e7388ef 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -38,6 +38,7 @@ typedef struct ScratchpadContext { uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision uint8_t *obmc_scratchpad; uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers + int linesize; ///< linesize that the buffers in this context have been allocated for } ScratchpadContext; /** diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 7af823b8bd..130ccb4c97 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -443,6 +443,7 @@ static void free_duplicate_context(MpegEncContext *s) s->sc.rd_scratchpad = s->sc.b_scratchpad = s->sc.obmc_scratchpad = NULL; + s->sc.linesize = 0; av_freep(&s->dct_error_sum); av_freep(&s->me.map); @@ -464,12 +465,9 @@ static void free_duplicate_contexts(MpegEncContext *s) static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src) { #define COPY(a) bak->a = src->a - COPY(sc.edge_emu_buffer); + COPY(sc); COPY(me.scratchpad); COPY(me.temp); - COPY(sc.rd_scratchpad); - COPY(sc.b_scratchpad); - COPY(sc.obmc_scratchpad); COPY(me.map); COPY(me.score_map); COPY(blocks); @@ -503,9 +501,9 @@ int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src) // exchange uv FFSWAP(void *, dst->pblocks[4], dst->pblocks[5]); } - if (!dst->sc.edge_emu_buffer && - (ret = ff_mpeg_framesize_alloc(dst->avctx, &dst->me, - &dst->sc, dst->linesize)) < 0) { + ret = ff_mpeg_framesize_alloc(dst->avctx, &dst->me, + &dst->sc, dst->linesize); + if (ret < 0) { av_log(dst->avctx, AV_LOG_ERROR, "failed to allocate context " "scratch buffers.\n"); return ret; @@ -646,12 +644,9 @@ static void clear_context(MpegEncContext *s) s->ac_val[0] = s->ac_val[1] = s->ac_val[2] =NULL; - s->sc.edge_emu_buffer = NULL; s->me.scratchpad = NULL; - s->me.temp = - s->sc.rd_scratchpad = - s->sc.b_scratchpad = - s->sc.obmc_scratchpad = NULL; + s->me.temp = NULL; + memset(&s->sc, 0, sizeof(s->sc)); s->bitstream_buffer = NULL; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 4353f1fd68..31403d9acc 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -167,18 +167,13 @@ do {\ } // linesize-dependent scratch buffer allocation - if (!s->sc.edge_emu_buffer) - if (s1->linesize) { - if (ff_mpeg_framesize_alloc(s->avctx, &s->me, - &s->sc, s1->linesize) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate context " - "scratch buffers.\n"); - return AVERROR(ENOMEM); - } - } else { - av_log(s->avctx, AV_LOG_ERROR, "Context scratch buffers could not " - "be allocated due to unknown size.\n"); - } + ret = ff_mpeg_framesize_alloc(s->avctx, &s->me, + &s->sc, s1->linesize); + if (ret < 0) { + av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate context " + "scratch buffers.\n"); + return ret; + } // MPEG-2/interlacing info memcpy(&s->progressive_sequence, &s1->progressive_sequence, From patchwork Sat May 11 20:50:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48737 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298096pzb; Sat, 11 May 2024 13:53:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUszB94Hwi5gB5JETM6qQ0SRm5Wmyv/v5ElHOzzM7scFyl2ouJaUynghvs6K4Y8wZsbYrC0glOVlbY6tshzb06A3LD9khJ5jECXbQ== X-Google-Smtp-Source: AGHT+IGmfc3S4NdUDTptFpk93bfSrQe3i9Y829rfox1gJwM0EbOeQCQnYFcscVm/PwKk1FzUEOsp X-Received: by 2002:a05:651c:1251:b0:2e2:72a7:8440 with SMTP id 38308e7fff4ca-2e52028a885mr43722401fa.41.1715460785785; Sat, 11 May 2024 13:53:05 -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 38308e7fff4ca-2e54592160dsi10993311fa.221.2024.05.11.13.53.05; Sat, 11 May 2024 13:53:05 -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=VrN18QL9; 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 7BE3468C15A; Sat, 11 May 2024 23:52:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2051.outbound.protection.outlook.com [40.92.74.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E0BF68D5E0 for ; Sat, 11 May 2024 23:52:24 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehBZNBdU5z/+uTyya6w3NroQs7h/oLWbJ8wUpNq4Y44Xb/w1O58PtBhs0/xf9cx3cy6A+mnaBHMaRpopnKHH664F23Asm0hYZg9gp1thytIqHfX+75Ia7U1MbCrb9LbJ7Zx/QP7W8eu4eBLmqp0VospY84BVZ/YpZIe7tktuuBuX3279VI82/kVAe5zIQjTOoAqIYNLlPihQxDWWI/aCzcEQXvCHO6ajvmXws39rXJUJQJOYXrgE7TSQZODelAnDK3ZCTbuqfGPETF0W5t3XczbaZYJngbiKKmgOB+YHgcHegwJxRMFwK7afUgS3RqgGm0i8PNX2JNiBWnxokRiI4w== 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=G58UvaailvqdEndIDcGIilSwUKTN0Jw9Gghjg2/Io7w=; b=gwwf11rvEce8inq5Ke0dN/AWnC6Gf9tL3v0z6y6Sqf3/saCLEz5IkVCI0Nri1iBaP5M/l7jijt8btdck/gNmYvNlRvFNXByPKApMeypJUnTG5QyFyqg25a8hJarbgDCsRzqcXRgyOWNcietQ+oEENDck0Bc9AVBH5FrNDAjCGN6ZGRnUiFtNOJKwGJGa+BvsRLorxvKyIamZ5h+GkVx22AxlKfoXbe3IHg37xIaEBmrdMf4AmxppQaRcSS9Za1qersSEmqFJ4VWAQWiV21yTlOyOfpE778IL5f89Vr+4OmLQXjFZxYKT055kQnyim2Gh0fq69W178DKy6Yg2j60Wsg== 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=G58UvaailvqdEndIDcGIilSwUKTN0Jw9Gghjg2/Io7w=; b=VrN18QL9BYj5oR/1A0pkAfbRp6JNIPtJ42E10CiDW9qSWQZSRg7Io7qVk8i6fz5Dl9wufallFTH8AHuUcE+5YVuhs7m2KdAoJ7BbhZqgK+ibKOquBvz+kYz5UcKDqrZjRV9W/w3ZIjSwRgJDgjSrEiQ1O3fv9ujHn/NleUQ1gI/miVKbJgldKs/o7LtPb3XNR/4kPV69xHzRi/L22K8V9CIQO1GsL33gWiqUaUfWCslI5M1bK6yE95hUXe4FhK/glHMzQ2lxo+gcRG6Kep27vJc127Mkx2dEXAym3PrK9i0w/sLCxxnD5jbUJtKNNptZvwBGtPX09+NRvj9Qhfr7dA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:22 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:21 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:32 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [Wszu9W3AK75ASDIJ0K2uUQsR2/skaP6O+6Rit+SMFb0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 93a4b286-bf93-4a0f-6321-08dc71fc410b X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: aJHZDbWYleEh328ooNapWltaDzAMage0ZNyVK5tGRY5H36b7R/7UpwIPQ6qsLcV0ydXsx2OmyLzjABsbXdo7fqRqDepLj+xbBDAMQD1uAK+Xl7K+LFs8+zUr09vS3K0+gKruGMBtUH4rnNmKViGC0c/QxIcmBoogA66PRtDIhpHluDfBlmS92A4/4MeXp/nRgcfq4KiIhnQRsTiD7WPNtEKIbyFZno3bMiUOE+sE6wyieRrAIwvhQE25N7+n3iswL4/rwwfzQeF6YA2H727ISMfP5DuY6TlW+fMnZh+oHwduoeNTTqLN0DL289l46u7Q1XyNafPCMA0FZcYcDsbpah98whlkTOk8HUH6+4OpgBxaWBF4iUtvKE7mlQZcBaxtI42k00OniN0NBwA8Wp96ncOVsbFckuxtxy+XM4gdc26nuc0XdYwzdq0XKu7lh8U9aCWy69IIBYwEitnP5WKOxBX/1xHdSI8keZiDFKIYcpggv4cvCkCEaQ9bQuNiTQT6+tKFspNG/TzD1lm+37BxoMAsFEMqpuBBfG9JjXLlR4V0wHMzhqSqgnCfBUx6K4FY9DMRoWnDkbycwXGM/LCTOmFjjT9og5XGgrMFhhPoXDXXH2cUsyJbdp4As0ChCDLY X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f916jYKjYoyVToep2iAYZEAjRkuYN0c4e6wg+uluDTFBwGW8r1g+qATLa20Ylbkn2g/qkELTTktNegUCJPP/mlGL5vfBTZI9sxRVy1zs3pmBfkxqOOFq6w6i6utdc4TbpOGzUkSg1zbtw4FWNbIGS72Fo+sVs0rkVc6UcMqjFv/tvmfwylIivoWYCcitzezl8NI77dQECNP0p6eCvfRXAIlK9dzje+SGzGuMEKkBOb8/Jod4P4THeNCFr6kY3pz23XSVRlXKlXBCEjF374Rjk7SxK3h0PyDTnpkCKUsWQUe911kNoy67GxbbMAQBt+6Hi7T2Q3tE/2/fRMLCK2myMdi7+uwifKKv01/3jf+jb1WA8BLHBw2bmuNSM2youT6rrjruBUBrsS73SsYr+Qzd2LY/lHVul83aQj35sLEn2aQRq4MOSMmV70hUwflofF00xqZYIQmeKiwk4kXcfjKqfULn9uYgbHWnbtlOerxUUQzyPsFdk7NvWrPfdOo8r71DICd378c4THDLta1fpo1qxsKHen6ghaWG9aOkneLxHo7YxNPdoeyTgNtlQgQCZHNkiOaGPVIm2lW+A8h4PrZXcTbvWOG5C3tlRlggLZMm+uGGjJyIn1IWIZIak4jUX8URHp3J6MFX2prajdseseh4BcQoM5gHcsifULzrPv9WPAajfEBEFo9hHijZGzWk0KEoEbo1cAMKFLzTK1pLhowO5UglydFUe+DbZXJirVubLSo4lqTv4j1lxoo92Dwh3DRrP5TBCzJRnVPpBt1ucKuG62W5FVT+dPAI33vLERS2B0Crt5QtdLeD68QmiPYEaFcjbXjHXbI9IxlP/Omwez/a4XYxAt51K7nVLL6mIDvi5kLuF1r9Si/0uCdBpwJ3P+8PORp8Az4FKvo4IxQK/x42eB/fx9piWbRwe+1OFrae1UksY+OxNJAWmc2GwdEJ4cJli24aO1si/7MGdM/yDvG4aDm7yR6q9ypzZzgQ+tJe6xoW5L6qsL7jPLFIowOV1pKj/ElQMQPLf7WgPrws6bc5i/jJNFeRQ/gldHSftppLTR9nl5eprQTbapnSc2BKGwz9sVOTBsraKVag49822XuznFFHUxRyoGi4AUv5hzDyw4UPd3nQXO4DEFgdxdC5KBNt4pIBFc4H64J8N0MlS4qe25lZNFnXxyIp1c9PeK21JMp+2g1HgN0o3aTzYfBjrpKE+lNPLP7Tw1rpvZ1pwJfVJOlyZ35s5n+lHlxvscBpUlTHInvXe2lw2ybuN82REKf7ZC4GWi2KuDBhbK/BI7GT/A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93a4b286-bf93-4a0f-6321-08dc71fc410b X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:21.8948 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 08/71] avcodec/mpegvideo_dec: Sync linesize and uvlinesize between threads 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: ihd/EtLtyEZ/ linesize and uvlinesize are supposed to be the common linesize of all the Y/UV-planes of all the currently cached pictures. ff_mpeg_update_thread_context() syncs the pictures, yet it did not sync linesize and uvlinesize. This mostly works, because ff_alloc_picture() only accepts new pictures if they coincide with the linesize of the already provided pictures (if any). Yet there is a catch: Linesize changes are accepted when the dimensions change (in which case the cached frames are discarded). So imagine a scenario where all frame threads use the same dimension A until a frame with a different dimension B is encountered in the bitstream, only to be instantly reverted to A in the next picture. If the user changes the linesize of the frames upon the change to dimension B and keeps the linesize thereafter (possible if B > A), ff_alloc_picture() will report an error when frame-threading is in use: The thread decoding B will perform a frame size change and so will the next thread in ff_mpeg_update_thread_context() as well as when decoding its picture. But the next thread will (presuming it is not the same thread that decoded B, i.e. presuming >= 3 threads) not perform a frame size change, because the new frame size coincides with its old frame size, yet the linesize it expects from ff_alloc_picture() is outdated, so that it errors out. It is also possible for the user to use the original linesizes for the frame after the frame that reverted back to A; this will be accepted, yet the assumption that of all pictures are the same will be broken, leading to segfaults. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 31403d9acc..597ffde7f8 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -127,6 +127,9 @@ do {\ UPDATE_PICTURE(last_picture); UPDATE_PICTURE(next_picture); + s->linesize = s1->linesize; + s->uvlinesize = s1->uvlinesize; + #define REBASE_PICTURE(pic, new_ctx, old_ctx) \ ((pic && pic >= old_ctx->picture && \ pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \ From patchwork Sat May 11 20:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48738 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298144pzb; Sat, 11 May 2024 13:53:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUVHPmKaLvAGZnpM15wRrldifxb4kTB3ZTDZKFQwEK2sCUUmyVX5qcnhVKo1gZApw6tFgbg/fRKmxsTkvIJSO1hb2KvvcKoim7NEg== X-Google-Smtp-Source: AGHT+IH+W6AfpUmp6mJFKbl5J6cxcDT2QG3meE7W29fqfBLvK2X0K5fwHaOo8A/nDnbsxomEH2f6 X-Received: by 2002:a50:d793:0:b0:572:3fe4:18b5 with SMTP id 4fb4d7f45d1cf-5734d67aa8fmr3749917a12.32.1715460794419; Sat, 11 May 2024 13:53:14 -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 4fb4d7f45d1cf-5733c2d5e86si3638143a12.232.2024.05.11.13.53.13; Sat, 11 May 2024 13:53:14 -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=Sp0rvMRZ; 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 C164168D5DA; Sat, 11 May 2024 23:52:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2040.outbound.protection.outlook.com [40.92.74.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4077F68D5DE for ; Sat, 11 May 2024 23:52:26 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S70qHfXUr1tQZtrsrRNMNdxXrB0gfgZKKrbmtfKJY/Kw/LpX+lvBpPtChSmLaqUYJo98HhHI60NiyhAjnNeX3OIBRUZRDuvXB7ndCV8uuS1aTTh7IPJyf4InIpNaKHXIlQqcx19fwhIGKZWfC0cQF2QzmnC605ivpI07Dh/CYzRYSJ1Whcf54gonPNuZsocgTqIy1uC4CT40maa/VEKz8xcxaPDyYdq/9UenZ7fLFoipmzQEFp7xPm79BYTSo5EJgPuuVejx/NnMpHPkNYvxuO4zCFbreEM0HG02lnwlR+O+oAv8e8LaR2suDxdtm895M4bJ8dDpCJUSnat21wB0dQ== 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=lI9JdPRx0oo0qr0wNqHPlkFLPIfn3JzI0Vkx4XD/lYc=; b=jRf0u4Qcfi+d81Eo5nuleEYEwtGSXtZFxqD7EXzrBJ0P+5rmcqOAlvgrwcBs6Z5dUH1hW4AqeB9fZGwN3qzsHfjw7VVse0A7tu7XYCNKbzmtybUfCD7mcU2y+OqLTBfplSQuS2hGfjAYajIkqNSUoQbZf2cl1TXH/Y6X2MCGgoPsAkUcwdkPR+1kLnIl/WwmnZWpsvM3M0p9AHm0GnrGNcrRGoi2mFUtRFEbOe/oz6wtDWVvuVsOKfUC/Uz8XANeRkkeRuG74UtwNk9NQh0RvPusqF0mBW1+hyyQ2wRLqACSlCBbcTw7mEgE0UM0Aq1y7jLaSLjGO6rJ9hAwZYrywQ== 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=lI9JdPRx0oo0qr0wNqHPlkFLPIfn3JzI0Vkx4XD/lYc=; b=Sp0rvMRZlERXe8aJAM6JeDKtrjunhMRm5U0ohPDrhuLWbUOtcx5KMfYbx3V9Wk/2M7NZ0OGAgis4vj94V6bzfKVS5VYkXkAcZwPXG+gdb9ugJf3BO/L6/a+PjrD0LnUbjlF7NspTDbWTTgiVnN/3HdYkdNJneDd8jezRJDHYxi5670fc/2BF4+RngxCnk7h6K3DbBJztDgq4HXhoGpre1wwdLwLH2U9crA1BYxjKJnsZOpCKqmFB0SVS7lWffGMkuFnxv2/CXltbcFP2x75O1Md8JNXmZq6yuixSZp9rpBo8iOro+yboDxPgzuYxtqPwMA/DrFuG8DCQW1dEvcYLdg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:24 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:33 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [jm7z1g7ukYdhOUaF4W1rlS5zrAqFylCd2j+yNTDgc0U=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-8-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 90bd0698-acf4-44aa-e0a3-08dc71fc4241 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: J71N+3GSvR57Zukw473zucbB1AvNNhUgFJ1CubsCcdiG6YSY/0Kl4DrwuRJ316jNJk2ITjP9Fns7UJrzve7/dMZqSLigH00HOcRgbcxpVo2jvbUK1Zca3Y7+Qwyq6zVwFvs75opnlGCwxBTDSFsJXDYZQay33zBMT7lWGp7CYntd/QJEn+2ItpdQFKwaImpyDplNs2rHcD8Qc4qFd2Igx7bTxm4dFg88Tc8bpaqNNct/8gDHgqhaJOW1w5NLGk5MK54ZWyLb9Yfw05usPgTDyURGG/0U91cEzfb6h2eDrsVy2+nZnIJjk3CA8H94px1khCEZBM1h7emj4DYdDHT0AB0L9JUExf3UYOayz8gJVSDKX51bLiwz5kSkf+hh8JRsCOSi3uEhLlq8VEfXLPIrt4hPHqoCwblT1D18aaTQD2NpZvnUSlZPz1CWGreaohM8qKVe9myUOhyWc3uxl/N4HBw+jMB8mN2drL2Jn4muqB28fo9DdG4wBcb5yb3kGuZl07ocjT3Di6Zy2B1V/Etn0od1bMi3nmiip3QBGHMxzFDEB7m02I8Tp0mmUtsznaLKOdDnEros31qRaBCcvEid0hOflQg+tnHXgOPVabboOzpx5Hn/jwZQpE3n8LyrTUQF X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iuTFUET2ysFGqLkl4bRH3y8i33VBUT2+MJlAwEeUzhX2igmlaWdJmNkhK2PWSSuiUOotyLvR73YyPkX2pyT0rp6SsMqgry+i3MHAzqJ9dd8Q35HGdXxAw9icXfXzbVSDgaNh4bYZ4Mamdo8/Trkz1w1f29fK/8kS4w3H2g/Rz5vkvWhUGQeHRr5rlQSRJWTmwOiwH3hwCdpevcXNUAeGBS21BhmbHsi8dg91tJGUWhXQSl4XrO5eEl+aHL4raOSB/O/6yu59cOmq+QX5K7vWVZbXvsd3CnD8P7LsotC7azdpbNIL9jCpZm4crxlG2rOqtYkAPfQrZjt8nrpCVJ+Ob4/EluTp4ZeHVb4M2Arv5vBSqp9NLzdotnanDR8yzUlft9M0ugFX8+e0g4CJroyitBmHPyMuHVJ1udJt1sLQb4x1zMgpzhm0hgKjwezRiBoKwx4l4N/lSdhwWIOECF83D3bLPg7wqloLyYyJBZWZVJB5l6ssBcUB89he2rztYprUZzJNUX/P1mWr8kVp+W0de7uiI+yrzHryyKPKm/FIU7g/eEs5jhRUwrI8YNbMvV+C9uCeI4KlcArLwUdhQBzWyFpYTISQcMKjAHR4sC27pCAs37iHrNJ/+ilUmnqV5PWBGZZocdj6wZ4C7ejwIXR2Ad2shyExD2caoFJOrw9SVlVjr428FiHOXG/z+mTHIwFiYLvgolsozacl3fq5JNqFa/V8F1sun84Rh9H3RFO/sA2X4ccxro3w+7n3OK4+Ns1HJYtFeb8tWFHbiYI8VUHyCuxJX7J31yOFHNxnhv6vTpYVdeQUkHBEAovHXIMqJf2G8S//7knzhXrfhRRYComrIjDvAmMsKT5wDn/U/ST8nefv7DgpizQbsmo/GKY8zFsYbXPnJQ9CNwtOCX8ShHHu7sGz4vtV57ts3jNL6IVKox50vHEM8J/A90gx7c1gGtky6iwRJSkUFPr82Uy6gkF8bqKTVHtZiM+XbvgW8whPiVxW4iP1qKT8EiaI3NI0Sxh3hUto8vHbH75YBpvlqqkg/cSiJgHzKsuUmKZPTleeIIv8L3qz4DH/ASenW+zd9xD5MAfyjXfmLoOprT9pnB+zItOkxVTJGpLMbJVI0i6aTMks2f9GV6IrLgPyOUFgaiM2yo+dlblYeGW1TEdTVQnM6Hm3MO6UdCasYfzUwsJTsA4ZEQjMXIdn9DBoaWIAUoVIOf3jOXExmxAFygpiccjJm3hEY9vJGSCZBVZfp2b8kFE020J+Ukc/lc7FqUqdC26TGglE/hMt4dtSuKW5cX5uvA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90bd0698-acf4-44aa-e0a3-08dc71fc4241 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:23.9741 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 09/71] avcodec/mpegvideo_dec: Factor allocating dummy frames out 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: ntQfT7ZWUSwU This will allow to reuse it to allocate dummy frames for the second field (which can be a P-field even if the first field was an intra field). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 85 +++++++++++++++++++++++--------------- libavcodec/mpegvideodec.h | 4 ++ 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 597ffde7f8..efc257d43e 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -281,14 +281,21 @@ fail: return ret; } -static int av_cold alloc_dummy_frame(MpegEncContext *s, Picture **picp) +static int av_cold alloc_dummy_frame(MpegEncContext *s, Picture **picp, Picture *wpic) { Picture *pic; - int ret = alloc_picture(s, picp, 1); + int ret = alloc_picture(s, &pic, 1); if (ret < 0) return ret; - pic = *picp; + ff_mpeg_unref_picture(wpic); + ret = ff_mpeg_ref_picture(wpic, pic); + if (ret < 0) { + ff_mpeg_unref_picture(pic); + return ret; + } + + *picp = pic; ff_thread_report_progress(&pic->tf, INT_MAX, 0); ff_thread_report_progress(&pic->tf, INT_MAX, 1); @@ -314,6 +321,45 @@ static void color_frame(AVFrame *frame, int luma) } } +int ff_mpv_alloc_dummy_frames(MpegEncContext *s) +{ + AVCodecContext *avctx = s->avctx; + int ret; + + if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) && + (s->pict_type != AV_PICTURE_TYPE_I)) { + if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && s->next_picture_ptr->f->buf[0]) + av_log(avctx, AV_LOG_DEBUG, + "allocating dummy last picture for B frame\n"); + else if (s->codec_id != AV_CODEC_ID_H261 /* H.261 has no keyframes */ && + (s->picture_structure == PICT_FRAME || s->first_field)) + av_log(avctx, AV_LOG_ERROR, + "warning: first frame is no keyframe\n"); + + /* Allocate a dummy frame */ + ret = alloc_dummy_frame(s, &s->last_picture_ptr, &s->last_picture); + if (ret < 0) + return ret; + + if (!avctx->hwaccel) { + int luma_val = s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263 ? 16 : 0x80; + color_frame(s->last_picture_ptr->f, luma_val); + } + } + if ((!s->next_picture_ptr || !s->next_picture_ptr->f->buf[0]) && + s->pict_type == AV_PICTURE_TYPE_B) { + /* Allocate a dummy frame */ + ret = alloc_dummy_frame(s, &s->next_picture_ptr, &s->next_picture); + if (ret < 0) + return ret; + } + + av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr && + s->last_picture_ptr->f->buf[0])); + + return 0; +} + /** * generic function called after decoding * the header and before a frame is decoded. @@ -382,34 +428,6 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) s->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL, s->pict_type, s->droppable); - if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) && - (s->pict_type != AV_PICTURE_TYPE_I)) { - if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && s->next_picture_ptr->f->buf[0]) - av_log(avctx, AV_LOG_DEBUG, - "allocating dummy last picture for B frame\n"); - else if (s->codec_id != AV_CODEC_ID_H261) - av_log(avctx, AV_LOG_ERROR, - "warning: first frame is no keyframe\n"); - - /* Allocate a dummy frame */ - ret = alloc_dummy_frame(s, &s->last_picture_ptr); - if (ret < 0) - return ret; - - if (!avctx->hwaccel) { - int luma_val = s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263 ? 16 : 0x80; - color_frame(s->last_picture_ptr->f, luma_val); - } - - } - if ((!s->next_picture_ptr || !s->next_picture_ptr->f->buf[0]) && - s->pict_type == AV_PICTURE_TYPE_B) { - /* Allocate a dummy frame */ - ret = alloc_dummy_frame(s, &s->next_picture_ptr); - if (ret < 0) - return ret; - } - if (s->last_picture_ptr) { if (s->last_picture_ptr->f->buf[0] && (ret = ff_mpeg_ref_picture(&s->last_picture, @@ -423,8 +441,9 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) return ret; } - av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr && - s->last_picture_ptr->f->buf[0])); + ret = ff_mpv_alloc_dummy_frames(s); + if (ret < 0) + return ret; /* set dequantizer, we can't do it during init as * it might change for MPEG-4 and we can't do it in the header diff --git a/libavcodec/mpegvideodec.h b/libavcodec/mpegvideodec.h index 0b841bc1a1..42c2697749 100644 --- a/libavcodec/mpegvideodec.h +++ b/libavcodec/mpegvideodec.h @@ -50,6 +50,10 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx); int ff_mpv_common_frame_size_change(MpegEncContext *s); int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx); +/** + * Ensure that the dummy frames are allocated according to pict_type if necessary. + */ +int ff_mpv_alloc_dummy_frames(MpegEncContext *s); void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64]); void ff_mpv_report_decode_progress(MpegEncContext *s); void ff_mpv_frame_end(MpegEncContext *s); From patchwork Sat May 11 20:50:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48739 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298176pzb; Sat, 11 May 2024 13:53:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUF6v5sfalRl9OXY6j6gY1kTr98LVNl514X25LY30K4+Ya+yhGRtXjpVLTS521ohnVNj4qg6NCjtOzrun0uUSAwpqQoUdRgMujVaA== X-Google-Smtp-Source: AGHT+IGjhe5rEXPUhjBezdfGOrepwYZS4j0bBEDOack924MZ2HMLTtZ9xYMynH2t4bdpV0WyHVD3 X-Received: by 2002:a19:f503:0:b0:51f:3fea:cbcf with SMTP id 2adb3069b0e04-5221016e864mr3185168e87.52.1715460803269; Sat, 11 May 2024 13:53:23 -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 4fb4d7f45d1cf-5733bec1a85si3444339a12.199.2024.05.11.13.53.22; Sat, 11 May 2024 13:53:23 -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=SBwUOgFt; 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 EDCA468D60B; Sat, 11 May 2024 23:52:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2106.outbound.protection.outlook.com [40.92.74.106]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 632A568D574 for ; Sat, 11 May 2024 23:52:29 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GoWW3EDPd2xMd1ar4Z8igcbPFyI1r+M9MU+ub0zLBug8EmW5OAavxnZv6HPiIi49sX8dY3ffExdyuXPRSz8eq9XklQb+8wkegW6iTW+j1PKLvv7kTmncn0k2AqbZVwCKnFQLUJkEZk7AIAEOiaxcfHF++56oW/FuBhpYnTRjqIZur/TI0sUzjeXXxQn8/HrX2i8bpHAdeDczIUAZNoNS7pIDXkgziBSLFRcBb6OjQ1uoSiUd8502wmd0X6xxbmmMMQC+LwlXYf7Korw/hn/G92301yuuQuvDprd+bVatDYR2f+1I2J/2uyGKA2jrdKjcVn+tXx9rBoeHPYohlD2mfA== 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=PSVwu4lUq55ip2m7ct9b/MOeed69vu+V7UUfgxQZbmg=; b=VcgsoKoxI5nyJ4+ZeNW8n0TvVHLS94LfFUyBCBMK8Q/yRn1fjLPT1RcImKa6Yj4CHcKN+MZFCdg80r2SF2fJ0jnsjDdeGiSZLX5Ei+te0WlF83puJkbJc6Qu1FPFHhw8LvWJh2z+buazrT9/wqHSjG3ax57aKM66Bc+0rs119BKA3Mq5x5afcnU4xNOjmKXCK6/FHz9G5HJS+068ayPghmY0XqatIAX6Cw9tO+62JNRduKcHakuhhFO1WbsTP7PNb/ivEnx9ctrBBN+XDMxtZoO1qbR0CXyibmwv18CiZ82W5EZPveTKNiDbiH7RK2vWPEymywIgQwznYJWed/jVIA== 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=PSVwu4lUq55ip2m7ct9b/MOeed69vu+V7UUfgxQZbmg=; b=SBwUOgFtRFSTvNH1AE0R5MTOMHlh0zY/pRlcuFccD0NRmm4TowwnVR+vHGlSHyh5SBsVJx/ZmmMty8Sd0f8OtIX6kKRBqFkgK6LqqimzFXOWSnLN17xCb5ierYMxZmXasZh/44vXopNcxuxcz3VoeDRW0r4uER9Dtm016TdS+qxsIjbAT7WSJ0Pi9XFSUrPUnHCWm6CRT0o2Y76limQATWEf9LtYh+fPJNkthHVuPnDGSjafr4E4xrt2OhcEP94YYncN1AuNMyaXKuHeBoRV3dfBT+vwqbRm6loK69SYZ1aWXIgnccf1kJx5CzKbvXAEMn8QNtYJdUyKnyHZPkGtyQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:26 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:34 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [Y2fCrBq1rkBGDp73jcfRqQj9OzWjt3AsJ6KpSgc493I=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-9-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 900ad6b1-4a3c-47a5-1998-08dc71fc43e1 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: +syebKkfhjEfXt/Of2pm6HBH1haosqOacPLDwqVFsuRGOlsxSKX52cTeUwZ0ZjxaUkPgWLEK4i5m/SE2kjBRLXl8CHOJaj9acL3pKzHRt2AW+lcCv5mxdW6KTpN/cZmF69RcUSXg3lhX/jpB9OEsHvX38VizBzG8dQFlSZvpt3/UeNRfuOYujA/wjKaRA3U7Cbl/nKMt6giJh3dfgKpfxTR33Y9p874PhHS/eUKDwDdpH84xZuikRy7Bp0+IoatAw5toKpUtTON4dn7b3xlNdTt7WfgpaL8z+Jo+w5fgE4KMrGpHNEwWFqVkzopwLnP6suVEMX3GLIz/rcu2AK4OYcUeDEnfBgeqDTb3H2edXrZbRlNe04vRjXIBcyTJ0r1lzAFCB8Ie7HGsBtZUPnfybWvXLNTVnku3Wc89Hsi3adp5I9Ebr4eEksU+pvQSQA8JtG6HRiytByh2VgJll6QPevaWN2QrtAQRQErTrBg3u7lt7Sjk5MttLb69EQk6Qs2P/Xz+zaZKEVPjbrRFhOjbIZDKI40a3IDpbCpP5wQ8txeddo44GSgnfx+KRnCFkVaJlrHNZhn6uvxIt36I6J/kdrEDOMUqV1bdBEPOYIsceR/jhCf+ZhagGNJgUshveOSQ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QzkCnnifF9fz2ZhLf7JkANVNZc1U1hXNTXxjaTe9NGHZe+NIUAEvnwPl7h3gftlRMr5zXa6qx+Ca9iKiKxPtHy21+BokAEF7OdaKOhD5xkRYGk0NDbSZCzAh+2XnFuEHGX2qbVK0DDMxiErUk6oXp9rl9gDVj0aNKImT6zA+lH6AZh4cpgAf3RPUeEhY73AbVCBuOpoODvKzh7IsPRXTMJyyb+2u7sgkDpaQOuH0VSlBxrvwNKEe5VntVLkfCf37BwDZ9yld/AYvlVvyGTbr5XlBY4grY5GVGOPzm0CObZZCZSv2Bv6OUIXoDAY1ZT7XunSLqAbQOjHVj+sLnVxCi88XlH82AJTai3d7inX6KPd4mjDaZUb/MgYduEaQPKa4BnDBaGaPUzwydgzXN0dAv6eCpHCDT0vyuPGpW1bsca95StsfALQeqryxsxZaA3/CwtAWYZy2YMyo1IxZ/cgHOj2AOWar+u6UoyZnisrLIUndn4ks5hn7fw5ltUaH5X7m1hAAO3scA9IhUxlDOjQhskZbuGM0RkpUIEQZZUfkD1onnINQmK76oDv3LzxSBtDHwIAzD7/GrFYJVv698rEolIL7srTWIZEIbaSu3/WJ1gXgjInJ528jNLmVE3+1pzcyNG2Aa7jtdLHiAEIjQs9XBPvSb5r5fweO0q8xWd4nw1Hufsdmi8GqqpS2Wu3zvVQ2l//5H++2D+G4rYqTrD/ZQoSJRKXeyk5DuKDIINdmOhvyA62rtMHU6jZP0ROsEBkA3Lm2E6UbxTqNdpxCJqeDE9rdNJcXo3pUunWPjneWOkopwIjrpPouephNuQc6JszO065vXrB9JI/Qr9x6xBOahGbsQSc7Kh2YlXabthz3dq04zBdwpUheJgb169PAmkeUmJaBOKpupUzczGRueVIM5cFS/7qma+cztjSH/3/sUHYr3ZdakhtPL0gsWJdSkm+EU/JP3MdsRFPA1pAHaolUpMOE1lyV7PQmkzysup9MR7+TXEfufS2A2XIvENpBRclUn9GJc5TdjagAExJnUdF0OJg2AaURq0YiQVfShzAE4opa5ZpCzHdC7A7teOEA8UQ6HLILDhhdijyxeHWQo/AyTv1ZEh8Wf3pYQAlhSqbLE94vX2MK8impDmS5zyxiHrxp6tiHdDK+ftZdDvyLulE69Ho0TPBBKcCuY+bA0ACo3Igy039V0u2SVu4iyBE/51Mof249UqLYOlaAKoDslZLfd+Xhi7AhgiCDGuVctBZdQ5f/EN+iA/wcKA8gFVg0riiq6p2xLsrVY4dNf5CkTt1TzA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 900ad6b1-4a3c-47a5-1998-08dc71fc43e1 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:26.6788 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 10/71] avcodec/mpegpicture: Mark dummy frames as such 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: mKZbTBZ8fmyN This will allow to avoid outputting them. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 2 ++ libavcodec/mpegpicture.h | 1 + libavcodec/mpegvideo_dec.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index aa882cf747..88b4d5dec1 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -270,6 +270,7 @@ void ff_mpeg_unref_picture(Picture *pic) if (pic->needs_realloc) free_picture_tables(pic); + pic->dummy = 0; pic->field_picture = 0; pic->b_frame_score = 0; pic->needs_realloc = 0; @@ -331,6 +332,7 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src) ff_refstruct_replace(&dst->hwaccel_picture_private, src->hwaccel_picture_private); + dst->dummy = src->dummy; dst->field_picture = src->field_picture; dst->b_frame_score = src->b_frame_score; dst->needs_realloc = src->needs_realloc; diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index 215e7388ef..664c116a47 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -70,6 +70,7 @@ typedef struct Picture { /// RefStruct reference for hardware accelerator private data void *hwaccel_picture_private; + int dummy; ///< Picture is a dummy and should not be output int field_picture; ///< whether or not the picture was encoded in separate fields int b_frame_score; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index efc257d43e..bf274e0c48 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -288,6 +288,8 @@ static int av_cold alloc_dummy_frame(MpegEncContext *s, Picture **picp, Picture if (ret < 0) return ret; + pic->dummy = 1; + ff_mpeg_unref_picture(wpic); ret = ff_mpeg_ref_picture(wpic, pic); if (ret < 0) { From patchwork Sat May 11 20:50:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48740 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298235pzb; Sat, 11 May 2024 13:53:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCrJvnBykMVG4MT5kAwdyzf3MiALVEchpOIiaI8IhMuaaLjmzpHGms5pahtgGxN9cpMqRE8WyrvJJMlP9OkgRBkHGxYZEesH9Z4g== X-Google-Smtp-Source: AGHT+IEj/dRe2VGbjkTr7/zMjRfViXTmlTc9W3vPJkKy/+hqx22F2LHJIFaw2qXCFVm8NRvr8gmp X-Received: by 2002:a17:906:69d7:b0:a59:c681:6314 with SMTP id a640c23a62f3a-a5a2d5cd7admr371220966b.42.1715460812451; Sat, 11 May 2024 13:53:32 -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 a640c23a62f3a-a5a17b21d4bsi333758866b.301.2024.05.11.13.53.31; Sat, 11 May 2024 13:53:32 -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="pKukng/g"; 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 2F92968D614; Sat, 11 May 2024 23:52:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2103.outbound.protection.outlook.com [40.92.74.103]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D361068D2F6 for ; Sat, 11 May 2024 23:52:32 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R7hHfWkIwpSmlHpIQ/Ve6E2rx1X1ZFifZWofxTCQq1EwbAYOgb23D6nVsl5ezxHxfxKlUeennosKerjteaxmvEq/DoCexKbAyJfQhvJvV3ze4lhVQ3OX4aINL1gYpLbcIsi92+3OYuhPtP3C/kXv3/cunlljRUDKsMU9FY7YMB4urm0DhYStBuKzG6xOmmw/BB1X7tXs2oI2ZF1gyPes3scsQ0HGX2V0Zvk/46DKdG4uvHfi5CIrIvtLSJ20G4MEEs7oD0qa+FlPkIECQh0mV/hv7MWn+XQIbCmp3FTfPvFcwM8ynFIwXOnN8tauI4Jno7glt6w7lF0H1XuQrr9EIw== 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=cLzQRfHQpVWldzxBlhMm3F3TJwYGQff6nHC2iic9rnc=; b=iWXiBXZPwEkJladUPoeyYQqL3zFUsZrNPTLLTU8efDfVk+UHpWg8XoaaR4ARrh9JfZARRtWMEDTy/IiivL9uw/83xxdI4WJoI24KDvkQTs8NGE1c3Dbu+8VyC6FH9F7FTvpVZU7onJA2JskFg2ct9BapwLbj3qYJ5yxPurD+JrBDBk58JRoyvDDPFd453Ea+qRTTCse5+pcNhGMwiVhVNsPzEjwIJ0DALfpX1f4C8pI79OnEPtXVNMmRtCDGq709svsXtRNlfYlko81btA/Vr1WuITsmP+cErJezKjUuH1C0acMqA5DmWy6QDSYI3HGYnVWGtzyQBRGKOLyysVlr0g== 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=cLzQRfHQpVWldzxBlhMm3F3TJwYGQff6nHC2iic9rnc=; b=pKukng/gBlqP/80ksc8a2zs1dbUFitvHNH+Nd94TjYVSni/NB+NsWfS6kUdMg6Omt+WKZSEsOpfVoB9Hfrz68xZJ5JxjMbVsPTzjinmjXGTyKkdBsxTgz7l2sdQFUsBbYrZmmYK3tCLm3XDXeRtz8+uimY2h30lyKohv1ot9vZxR6UDZ/c08V3qHzkcDwHWJTO9DwwftS6c35rgl9moKaJJ93H2yCE8Jq6Fjh9KfUrdO3mX2SmGqzZqgNHvrnqigDZh2CKW/Qqlje1rKegmnzmP2yf/52bY3XHcdd9YGkuHOYd/H05ORHsF7ULkw0krh3UMxkmgoBV1nqYzZo8GRiw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:30 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:35 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [1oKso98RYE3VozoPnPpPmOdJpkroWgIuFA6hnR8be8c=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-10-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f087906-88df-45e1-bd4d-08dc71fc4618 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: CpkzMQD+GlPeyQCrn3aFKDSDG3nIhKf5h4bJZw/KfjcsUe7APjkKNsZPaDuXq8Cuve0RKfpYXK3oLwRVNHiOfUmudUrB6yeOU1mxHGUBhtmBjFpKuUHaVllOkzMpiwe0BjDskOjw7ISShsvzVjaDCN4Wn9gNf0Dh3j0xvl1tFL2lTlgcbUGMt0NQgLGp4zRCabJpdq0LbdK1Cv9G5mnVEiwxO45TvOdRV9o5EPt8YRbCvWXeCegJvoTNORz6u24Qybs/luBQ7NTuX1uGEpYlyUYJpI+w6URXFtkBR9zGCz70Z2QXIOTr2SFYFY5U+6kWNgIOxDn/FKcS4Sbg8x0Y1xBR2c9uS9KFOZSDaHx5xYoevA+LwNgLhGj2nvpWhsrrzJ4YQuT9PcbihqsTmI5e+SMG4AUzWc6FpqKiPjaR4184s73qE3Wm75Cp572b7FoS5odtH7TKdr0gcgA07T/Qbjdzs5mmT7AY80di26INldo5Kde8Gt25thnSaweS67XsTrxyGByC82iv9JllyO86aBDOI6qW/u44RaOKla3ma5SZyreeEFu0JB5VjWKUcKELB6hhGnbnEDeFsQHHA0r+uZb/7COWsLABgaW4uKzztcvWEfRBqNciriGd1Xp/kPNP X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vD81o5ZJGcytOO7U78WbdDmMHWNFgcV3QaxXtuXD2f7nsyJDrjt2vjgky/BWM+QpjQD/6eunAQD+z2Y7OhUuYFEAzB4UiGjg1Agg4ra1V3t42GNE7I1+OEUVZWVoHiVC/6YTxUQ790oO0H5kiFgeeJ8HQ+FE1hyqHtWqFcbyyJlEFGIC68V6Onl7KdhjVPyelZE7zmy9T/ZUWdh9LIEE8QmeOycbnJogPDHIRZoKfHyn9j6i3OuwPNNZvTytMYELJ+h09xQjW1P7g/jsYoL0/5zc7wXGMoqz8cV4Dv0ZtkPp9jCMXbRWfXvGah+X9wAzwGY8T+bVcZd2pFd8NMiiRemzh1HMaIpSgdL8Yh8IG4ZZPjI484lVsMmrqdQiqda0R7D43y66BAxHVxM3bKSuQLhL5BBf7poWeWUxbioay8K3JUcU2jwIhLy9wCZpCO78LFJ1WjSwUjPod8gubRMW+T2eOm7SFORuHAwyIBGw0ev72JjKbSYR0iIE756dbUolpq/S9g9qHlngUfSN5S02U+O7kru36TJ9i7n1uXfAEa4nsGnfNVCn5OGZEMbhb2wnpG5f0aq7rxro+IYkPVnHAz9lcqIcdERvOtS7PEIxMO4s5hegvdR4qC3jmfT/Or0H1u7Mmou9QDdSwatxcSwuyEIBtZqLbynzyTXVt+xSjW8s/7tYMIzUnsSnCOIchOnw3ZrB6jP6zdgz5ppojyfQxmALC61RrEzOh2Q2PmLJoDFLrHswolBB8SjPdBLlcjGiVZWBhEeF/+unGMmWIiu2y+iZsveyODQsbPX8Aq3BXR00bPj/e3MnMnn2a3c1FsO7Z2TeOShiljFVVebtsQT1NJ5cLbtaswNQV8sVeBfmXxfaNp2xZ/Dkj3NXOg5Qsm33lveynWu1MsVMCY+nRyv+o81Xf8LeEilC2MRdb04kXm1i63hVDRk8bC6eR9+56GYmWBejuVaKaHI0CPzopYtGIsMu5ueVWe18lhF8dooQBtrUplTSzika78NHSuewt8WKs4ZFnGvE/1FHubplBA+Red7jhQ9BQtDRxD4WwoPfKQ50AzmXFSuN3i6XqvFJVQ8UET/y/x6uPiUELl7f6RnB67SaHEBqWbFZS/d/vLCp4u86H2bfzGFGzuMLnw5PFFJEkyCIvG+WaRkNAJ7vxz8a68AWa6dxrwWGLdwHFbV+8K6fCcCrk+waTsfCkef3YOtH7p/n3zpjSX81rgmD0pko7jO6hLp+8cMuxrTRDmBUyw5XhOrrUw6BPjMWWtQrH6uM3f8mAHpg45xNoACaICELig== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f087906-88df-45e1-bd4d-08dc71fc4618 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:30.3825 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 11/71] avcodec/mpeg12dec: Allocate dummy frames for non-I fields 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: fGf15DJtWK8s MPEG-2 allows to pair an intra field (as first field) together with a P-field. In this case a conformant bitstream has to satisfy certain restrictions in order to ensure that only the I field is used for prediction. See section 7.6.3.5 of the MPEG-2 specifications. We do not check these restrictions; normally we simply allocate dummy frames for reference in order to avoid checks lateron. This happens in ff_mpv_frame_start() and therefore does not happen for a second field. This is inconsistent. Fix this by allocating these dummy frames for the second field, too. This already fixes two bugs: 1. Undefined pointer arithmetic in prefetch_motion() in mpegvideo_motion.c where it is simply presumed that the reference frame exists. 2. Several MPEG-2 hardware accelerations rely on last_picture being allocated for P pictures and next picture for B pictures; e.g. VDPAU returns VDP_STATUS_INVALID_HANDLE when decoding an I-P fields pair because the forward_reference was set incorrectly. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 21a214ef5b..9940ff898c 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1372,6 +1372,9 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return ret; } } + ret = ff_mpv_alloc_dummy_frames(s); + if (ret < 0) + return ret; for (int i = 0; i < 3; i++) { s->current_picture.f->data[i] = s->current_picture_ptr->f->data[i]; @@ -1727,7 +1730,7 @@ static int slice_decode_thread(AVCodecContext *c, void *arg) * Handle slice ends. * @return 1 if it seems to be the last slice */ -static int slice_end(AVCodecContext *avctx, AVFrame *pict) +static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; @@ -1758,14 +1761,16 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG2); + *got_output = 1; } else { /* latency of 1 frame for I- and P-frames */ - if (s->last_picture_ptr) { + if (s->last_picture_ptr && !s->last_picture_ptr->dummy) { int ret = av_frame_ref(pict, s->last_picture_ptr->f); if (ret < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG2); + *got_output = 1; } } @@ -2204,14 +2209,9 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, s2->er.error_count += s2->thread_context[i]->er.error_count; } - ret = slice_end(avctx, picture); + ret = slice_end(avctx, picture, got_output); if (ret < 0) return ret; - else if (ret) { - // FIXME: merge with the stuff in mpeg_decode_slice - if (s2->last_picture_ptr || s2->low_delay || s2->pict_type == AV_PICTURE_TYPE_B) - *got_output = 1; - } } s2->pict_type = 0; From patchwork Sat May 11 20:50:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48741 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298275pzb; Sat, 11 May 2024 13:53:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXN4vSCLKNS3pJzh9w+KwvSzLV+gQfBoKF98S9eH4HaOQgyYnB1ZM/ccsJ35/hs30CFmoaSyHBuihmuRGDM1WMU0vBbJJdmldfaoA== X-Google-Smtp-Source: AGHT+IHRwGWx/T5li7+zQXC1N6kaSrmVnDjapMedBME0z2IdcBLJ/pTPtmZjl8jlmyBOea4OOo38 X-Received: by 2002:a50:a6da:0:b0:571:be31:500b with SMTP id 4fb4d7f45d1cf-5734d5cebc2mr3805245a12.25.1715460821555; Sat, 11 May 2024 13:53:41 -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 4fb4d7f45d1cf-5733c36295asi3561483a12.487.2024.05.11.13.53.41; Sat, 11 May 2024 13:53:41 -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=NQsDbviP; 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 5AF5968D50F; Sat, 11 May 2024 23:52:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2037.outbound.protection.outlook.com [40.92.74.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E263868D56E for ; Sat, 11 May 2024 23:52:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XVWZD7RApiIcD9FOyCSMlzZwG4vuyxyqmj0Cgmcf4PS6o4L+Ou+yt2mhBDdVUkPSpAK3ZXDC5i6gKghdbxWQ/jcsMNIQwjFsnJy5+//Ee6i5DXzPXwVdYS4Mxyod+ZsxZhOQt3MmBnSlZgs1fbY+ybUVFEdVGRrQA6GrJATCs0KALTfADh//fDlbSE24seL/fIXlUTEs7RDExxbgMQuU6bi9yIelrrn1crG64IodIYxuBDO97+L+IHVNHx9JgjJNqMcIXsxIm15aeoyzhdZ2mPVaZxpioJRwhpb8jMerJDRALvLdNs6ZcE51RhbYBMvq8ZuJWOCi+Kj5mWuqKAh0IA== 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=pirm70lNkCUtI86A7JIVR5czxY3p6uDIRopK8y6wPCM=; b=lTLFtWrHSIMI6sM2OsdBx4x1yUDVY3y2Ze0cwH5nx9vdeqjDC6SjmUTngdgpgml2H6GHTHMBaBo4d/G7Y+nhizoMrG1SPwmQHTNBCAs9pMkzxsC8vTDuTwCL+TFs4iFl5DcxBb2IHOAdUyh3QzYWFGRaPFCntqlgNLFvSAL43aqbv+RIxf4crg7CWDt58Wg1Jxd+EjLOkKD+uf+pKeud2HXztPv0OYJKNp8OyfVgE24FS+w6O95X1EELeY4pF/79py61ggcUeUGoeVPbVfrb+URexPZ1xWGvVcOOnjZLUMsNjgySTxbnZtDKxcpr5bSGwSqSkOhmkb3+qnZpxIqEkg== 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=pirm70lNkCUtI86A7JIVR5czxY3p6uDIRopK8y6wPCM=; b=NQsDbviPRN0eTEEcmUydfm9ZD1BcN8U+60/48pUXlE/SUFK2Pb+tCiBmIh0AczB2bYUWx3O0B9XVa50tIu88LUpbMa71IMFLK6VWsI6d93mrgEm6zMcgTpo9JtLoCqE4xRrMuPGlFHWt3oNKsjfQpb414fiiuv4XpZl+ogGuvxxZWld+Q7Rk6oTq4pS7+9rhJ4kZ/ka4Qz5UH2U/B9OSqBEuUC7MzHvZPfMmD4kjMxVKS7++CLKAfVZwSIICyHAGlG+5VrvRulPHYUc2fcBGAbQRNXoucPuSPlWhAcFO0PM5rAJ+GmmxgXlnnXSfkFIodcmKnbUStcRVID/T3sK+Bg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:33 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:36 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [4klIDaT+Z0iArSE6KMrEx0th/aNrKXf265uN12QZxJ4=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-11-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 91d2717c-d520-4b7b-1911-08dc71fc4807 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: JoNgfx40slBu85XAVSs/WOq8oUQvDD1/u9ilAl3ltUCclThU1tckhdXloGYMWbsile4TRxLvCQr5Bf8O4i8j48SD6BY5DGNTkaaDgYDNiYWTsu03VyKOWXsqy3EiXWsX8KcpeARprgGA5u1AYFTOU80LLIap6hIvQOCLQePvAM6j9uBaLgB7fZhKEqf61Z2SMvBiOABzrHgqM/68UE+8+4z/JcDK1qE1sTu1wkTlPHfQlCMJKtvOWbUn1CHYsl9k5qSb7E0v186ZkkAlfsM4m20jYXB+niFImsQIHoeW32BrvD7oI0E4AmnFD88BhTXaiKttzCPR9L/XsrUFs2PeyPaNhI4x0p7ymNqJlAxt6yxD3xcnQFRslQP4gaU/MFVpduU7hw0dYUAmNsm41M+u6IlppEXBt0eNu4fTcMNzrCCZWVTLWdzraNFnWdhbXUhgNLW5y38QvjmyjRBLUDzgYDg+rYOXphKPIUZlj0dH2J4A70/7004RLrRnkOosk39NqmjsXpb4JJMLgUyEeDQseKcdOvRDGKOO+Mk6hLoHMv/SG1E9bjZKYjHg+YjJXBpIOWSkgoBX/e1KNXQ0tXpcDDxUEtWN2Rk5ZMoRR7ICyWFGrmK1WB1mqaqeYeFL3EEx X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PiP1sVtpXpOKsBOd4ljmNNOhWLSsvgVUvIozjb3iT4VD5sTDy8qF07zV70PNHzYHkiYtXD8gWI52QcD5gUbgqjc/wPklb2MSQw3u930K4sWatCojqRaWDlZ+889VfrhNTxXN46tb512IXiuccIzTLpT4tcskoEu2GEiewxe7/A2Q3r3IaEspN2OJHRB7rwfJM2Ob90D8HLFKZnai6GPI2RC8ISQMGXwEM5fA4peUGvbtfQCswLlPTi1Xyzec8SVpxguAvJWTLOTZRqCfEjGEKKOg59EN6w5YLOOIaeHPcG5kyYD7UDeEkBc5yqVMRmey/8n+V11t8K5IqHxlQ2isjDZlT4UbH/hkitlkUmoz5ke/kaenBwUWYahCi94/1kzmp9P/T6pw5VbvlSExrVjNpTHycyyGjQm0y4haDRcbjvB9By+Kx1SxytUySUsEJ1f1aB/S0Tj7KwYoVAUQDYAbIBI3GcWab+3f9g++SeqcysKTO4TRcZhOvM/ZSQcSTPCBnKj4xMBEkTQZk/rxgZkKKueBJopwnYOIjHMOaqIcxvNfdDOzURqmhHNI0gx3GOpkcwAa3+g6IBORF2vmyK6xmPZWvX0ZgeRl0WkNZ1DbqL5O4ohkbrpcPCGuQw6XpSpparY4HqSW1htefcErj28qd4a9nvpa4rznsrIg4Aj5CqRDe+QSe/GIxmIHEHTvBnUWovXQXW1kBdu2J9E2kdp8UZi4a60wopk8pGWYL+YgN/betlwnEm68NW1Mt2eOUjsRyWSMC9uDtpKqGUs6XMb1qoZed5ndULDYMbJaBOoRiS0ZDc43elx0yNUN0wWpFtKEZERgnTEploTGwIBTDazGOzhmQBBBQv7YUtrHxM2Ru3tvWOYM4wbknfNlc2Gjz6TxmrOnDlFtDbGUDzsWzr/CyDXfhX88P1W3tbtxj7/LfNQlGRs59VK9yWUvlZHd2hF8r9ILxUuKt7/XhfEATvM2SO4M4lGz9pVQ91W/XEvChagohra180PhNgbBS45kr6lXsJcXIyGS4ueRXYRz8bAmjbBod2H7TvjhWV38rjoIQC4DnwJ0sOVFJJAHSuUp+YMNLIQBWbqOTuj2s6UXdMQO+Co3e7mcIJoZ1b+vNylxRHDEQUUb3tubeOASw0JnxNKIh22s4OfFWB2XB5OQW5BoHOaUFn/nPnnSEIh2j1+VnZWPqv9/oowU4U4eZLlCKza1uculBFU5Yuz1kprUHMCgLbhwddcqXaCM4WscttXbGisbTN4H7Ltt3zTAdrRKy2JozYQHuhABiKuKf8uy+dYZBg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91d2717c-d520-4b7b-1911-08dc71fc4807 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:33.6221 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 12/71] avcodec/mpegvideo_motion: Remove dead checks for existence of reference 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: +h0GjmE0k6bG These references now always exist due to dummy frames. Also remove the corresponding checks in the lowres code in mpegvideo_dec.c. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 12 ++++-------- libavcodec/mpegvideo_motion.c | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index bf274e0c48..c1f49bce14 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -862,8 +862,8 @@ static inline void MPV_motion_lowres(MpegEncContext *s, s->mv[dir][1][0], s->mv[dir][1][1], block_s, mb_y); } else { - if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field - || !ref_picture[0]) { + if (s->picture_structure != s->field_select[dir][0] + 1 && + s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { ref_picture = s->current_picture_ptr->f->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, @@ -877,9 +877,8 @@ static inline void MPV_motion_lowres(MpegEncContext *s, for (int i = 0; i < 2; i++) { uint8_t *const *ref2picture; - if ((s->picture_structure == s->field_select[dir][i] + 1 || - s->pict_type == AV_PICTURE_TYPE_B || s->first_field) && - ref_picture[0]) { + if (s->picture_structure == s->field_select[dir][i] + 1 || + s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { ref2picture = ref_picture; } else { ref2picture = s->current_picture_ptr->f->data; @@ -910,9 +909,6 @@ static inline void MPV_motion_lowres(MpegEncContext *s, pix_op = s->h264chroma.avg_h264_chroma_pixels_tab; } } else { - if (!ref_picture[0]) { - ref_picture = s->current_picture_ptr->f->data; - } for (int i = 0; i < 2; i++) { mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, s->picture_structure != i + 1, diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 8922f5b1a5..01c8d82e98 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -739,8 +739,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); } } else { - if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field - || !ref_picture[0]) { + if (s->picture_structure != s->field_select[dir][0] + 1 && + s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { ref_picture = s->current_picture_ptr->f->data; } @@ -755,9 +755,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, for (i = 0; i < 2; i++) { uint8_t *const *ref2picture; - if ((s->picture_structure == s->field_select[dir][i] + 1 || - s->pict_type == AV_PICTURE_TYPE_B || s->first_field) && - ref_picture[0]) { + if (s->picture_structure == s->field_select[dir][i] + 1 || + s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { ref2picture = ref_picture; } else { ref2picture = s->current_picture_ptr->f->data; @@ -787,9 +786,6 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, pix_op = s->hdsp.avg_pixels_tab; } } else { - if (!ref_picture[0]) { - ref_picture = s->current_picture_ptr->f->data; - } for (i = 0; i < 2; i++) { mpeg_motion(s, dest_y, dest_cb, dest_cr, s->picture_structure != i + 1, From patchwork Sat May 11 20:50:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48792 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp302491pzb; Sat, 11 May 2024 14:07:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmGm+cshwosketyawB0OxCSt02+JyJBJSG2dB+q9pSQIBO3+BteRMjY4LDRveWp5xulLjityJG9XKWR3gcyp0nqXq4c6/xt0pP4Q== X-Google-Smtp-Source: AGHT+IHnzZUQLym2sTHZG3B/eeN5cF2wHudQ9FB1U/jcSYA7M4pbefZ8xZgRxeR7NWfDVW3VRiP/ X-Received: by 2002:a17:906:3c57:b0:a59:2e45:f528 with SMTP id a640c23a62f3a-a5a2d5c96b5mr336765266b.38.1715461660764; Sat, 11 May 2024 14:07:40 -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 a640c23a62f3a-a5a17ba3c4esi349539266b.609.2024.05.11.14.07.40; Sat, 11 May 2024 14:07:40 -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=VjRJiadj; 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 A23E568D857; Sun, 12 May 2024 00:07:37 +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-am6eur05olkn2039.outbound.protection.outlook.com [40.92.91.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE19A68D6A3 for ; Sun, 12 May 2024 00:07:30 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j8+djGsG0fg1rgiNsxAg2eZY2rWb6YKEYJqxP2L5pAGEfDIGKdRNA6JJt9izuiE1JDIVovMvBzWsnJwqJMlcypodYWSytgSIV77RSBDNJsoSqngycfeBdvjK8fdQJhAkq2BmrbnyfNMDJLmb/uDGjAl9Ju2fczZcco89Jl9wMCMs3aQbmE/vKTavWXjv1mTKgJj66Ig8zESNlCLxJiOgoRl0OIl/dGEUeiEdui3jmbXfPgzJrpqtAWA144WqVm7/zJ32HqrqPKybcY9jHraTQ6ZyCeP2M6qRyCklX6W0LJm4DJhZvXJporoKi+ExmxYQ+TUzzSMfBhcHx+XNvCdY8w== 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=DyKBmAL/XkWkSSk6VPgVU2AHpYGax7f5cH2EFriP4Bk=; b=W/UAnJ22s7NyXtXOh68JR8FJxdGCTqDCMIN5/vdKc7Gh9DGjsaCBP7vPbIMaYMbjXjr6eEaO1sR7Hq1NlrWHw0sfaGLEehwWF5AMai5kI0ICUg4OZRgZFOYyRVpdH3WkG8vxiMsZp//jVDrN7Z2CyAriFq6GG3fAhh3CsVlITK3VF5mH44TcLxhD5c6x6TSSSXZu4xn3cjCC9943X9OVCnETy6DBUIdQ/ua/oFoDIMKR9bM+hdsFTw1kwUw7uV1zILwOr63jrR20JRZpiMU13LN9ZYTxwXGSsTN8AGdUXmmzJxBBVt9fgdaLi7ggZHlpJItBgU610ftpsE0rW03Dtg== 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=DyKBmAL/XkWkSSk6VPgVU2AHpYGax7f5cH2EFriP4Bk=; b=VjRJiadj9a0PFWusyS081QZAHnbtTijnKDKw7vmibJmvy6kltcN5KMMk4FUegTFCAnnSVEnjL3zecYlGbMx1L1shA4CA92pDSDgLEGK0UoSDmIsRqc5b+WmwOWhV5FaYFTc0na8ubLjE/e9omMVBKFTzzdZly7tjlegkcSEGY8DQM4r+Hqpi5ifmKKvBcs++3Ais9whjtuiGuymPIMgZA+t+8bIiehIvBNkqvV3eaUyr96CQRbOoWGbABr9zBlF70z/Vx2DLwzNzWop+KGKNKEawVNfxrT3JV8kR0SWPb/d3WrCUjHcRf4kJFG+rg9UkhwEJtD7LNFdSikfvDDlWVg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:37 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:37 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [IbbXaXFgzZ+6/+O81DD6+wmP1jgNvD37RUpbXTFTXbk=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-12-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 75c77074-6f0a-43df-47a4-08dc71fc4a64 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: NBC+VQ2hxNH8iQrH1bBJWQdZjGmyTEYmefd9ucXF1tcj55rfPoP3LsILQfJaSsgsZkzFbSYfKvcdJ4olmscLifDmYkDRzrTSvmRGZZAKul4wzEhU/2oKjHf234EpZwmppiNUynM34BEXnv0wDpXcRkdcQ71uJY+6IL93JaqF/0Sb22v2wvHEjp+uy7HIwL3E99n1/s6xp7kGdp0cPUqi6SpD8vMsPN2nugYD/eGxn9RBQz40S4rdlZFjkiWYMDhNpNoutm8R6EutX+U+HAdZb68CmScOuZ9jj+HnvAOY22XfZSOMo0dFdClNNfLaFzKNNOgs797DY5b2TPgbL/xFApACxQ7j6ppzd0dPo3SmkB7DUF3GMXtIJkoph3IZIhM/9IAqtnRtJxDFmJcqQdmg/XWtv3CQjIv6/7zwKJ9X5pSOLg1A24cO+AlmZknfYNJ5KcyldtC7o3+A5LXp0BLkT+9I2m8enbIz95n4WXkXaVhGJUbXc5zTsf6joUdz3qopiN58+sg9q8qkm+uGOCZDB021SLy4p+swT76D3rE/tXSZAIVHgtz1qkL+GjriDTAXWmIYQmfBwcnBd44RRT+mshP6ASWzlurukS+gdBM3zi9hTLRehEoIXNYFq1ixmepo X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cJhgRasYbf5vETr8SYUVH0+hL9gwM6gJ4c4X78GdyVFrqvbZv75GhGnRviVlIJuQGuwQdd01Nj/BXydAb9Db0sAm8yoqyBuPqy87vUA7rKyLr3GWM28PzgEUQF1sqBTjIZ+gYi5gGyOCmqBcWDZKBki2/hhXp3zBSeXiIxCv854mM87T3looWdZxpXAHkKtIm1w69xpjOJIgtcHSzkXK1Wu6y4hohkqYzZkvdqyd+Qmyx8IZMAcI9WclDYeY+YPwo0f6xqSK9WsMJzJgg5ARfg3pj/WSZH03YKfwOgkp+Uo6Xbx1+Ubq925SUCfNtJyuzlXWtNDKiNAhbZdXC1L6c9YUrm4An2kfnMbehTQKhNo6I5sRfjsyTVHoTpxSc48/MPg5jjmPzdrjw0pXAWRbf4TVZJlWhop6ua3qs0KWeJZiG1oBZNyBzAx0bHoJFEGmqTd+sDvgfjLVhHHhRo0991mXAmPeJntmEsUU4s0KREQKR1dHMFRg3wDSzvJK9sLwS03GjMTD3KS920zZrZ+8SXHLQaQwU2Tf96s3uIQlD5jmWKvB3UF1A9ftc3Xr3nqZo3q0SVrf1zTGSzaUzDs7lYPgPRW0UkTnGgYVH+rNFTlFyCTUoRAaNzKjj58XY66q66lP3D3kUelWS1QKazeuwLuEUpSDdir3RVloxivULwURl9HMwBa9DScRii7WntJdsuzX8/CGzRf90z+XOY/hkrt3QljvJvinmjFvEyU1GcPdcZ3Jnv3AqLxsLuzBdfTUZkTFyg5/PrOSDSbO6pK51L0mGEbAeSfQBwfRGgy510FYdUOTnHf/DpK46+LSZCMpk/xVMtMa9pc5XK2gRb09DuCUbLhIMSEoIFGBSJMvwE+ZB56LIBQBmTpNO70X152S+HykzqvMbHylgLKLq7Uu9kcYpCz+0pF5osdtKQ3P87zpaGwp0DFoVYQek0+EjOjv2gQs/CYdcFJ6TS4e382Pp2SALfwKxssjRthhnarb6ECbFk6A1GnJv1IAK5K30XtXMBOb5HBbItL0E/ZHkY8wVT8SeUDz2kVlNesbPMeKMvQ8jAdLgFkYjYmHJsaUtJg6I6MQhCweuJ/FgjXtd69cqofVLwlwe2qyp2dCf4Lnd/ReDQlrtfTfL9gOElbTkZlH4Pc/B2jtwQmPU2fhMeIP3dRtpxWtIom/1NknQMps6Si97llnV/fsKvy5V95pFhqXTK3ZnHjbgl7AfPJd4o02tuMeOvrEpX30uWNY2mzfZw2hqLmA/YpHqcwILOR5VWmd9YUjEbKQBpUUWrYZxyxRNQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75c77074-6f0a-43df-47a4-08dc71fc4a64 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:37.6203 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 13/71] avcodec/mpegvideo_motion: Optimize check away 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: yirqImZB3cWX Only MPEG-2 can have field motion vectors with coded fields. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_motion.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 01c8d82e98..5b72196395 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -719,7 +719,11 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, dir, ref_picture, qpix_op, pix_op); break; case MV_TYPE_FIELD: - if (s->picture_structure == PICT_FRAME) { + // Only MPEG-1/2 can have a picture_structure != PICT_FRAME here. + if (!CONFIG_SMALL) + av_assert2(is_mpeg12 || s->picture_structure == PICT_FRAME); + if ((!CONFIG_SMALL && !is_mpeg12) || + s->picture_structure == PICT_FRAME) { if (!is_mpeg12 && s->quarter_sample) { for (i = 0; i < 2; i++) qpel_motion(s, dest_y, dest_cb, dest_cr, @@ -739,6 +743,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); } } else { + av_assert2(s->out_format == FMT_MPEG1); if (s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { ref_picture = s->current_picture_ptr->f->data; From patchwork Sat May 11 20:50:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48742 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298303pzb; Sat, 11 May 2024 13:53:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWbdGfaXK+pDSMRqxWoX589w1XpmMFzslTh9GlOgLurFbZnoIb8MoARSAWxX1sT4LHhPYzBHFZyZNs9UYIgHjqIoDoH73a+H6yLTg== X-Google-Smtp-Source: AGHT+IFNfxfVrk4H7dFBKPmI6da42PAA9EIx2MS7WlE2/hsm3VQBs/OVgchFBNKilIo/NfNEkwA9 X-Received: by 2002:a17:907:747:b0:a59:a3ef:21f5 with SMTP id a640c23a62f3a-a5a2d65ed16mr778886266b.57.1715460830739; Sat, 11 May 2024 13:53:50 -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 a640c23a62f3a-a5a17945ef6si358250566b.162.2024.05.11.13.53.50; Sat, 11 May 2024 13:53:50 -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=rM7+aymq; 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 5FB5E68D618; Sat, 11 May 2024 23:52:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2088.outbound.protection.outlook.com [40.92.74.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB07768D56E for ; Sat, 11 May 2024 23:52:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WBM5Jo6rYzPJKnUFxaxabLNWF8K1vjyAsbPxy84197rAgRQ8RMD3rAwCN+aBJ/MDgzN8k4CHWt4sioU2JUWdkXiMj8j/7dvIpNaHzmLM5DmyiH+VGOMHj2Iu0w3qFbfk1fYGFVXAk3+OrGqhMtYOGAUqKZ2jSluXIEOpeKgGzrhPsNhXPT7Ope39aaWTRJdya7rxgHeRoazCew4zQf3UeIJuKaZrpbch7Yg8Ge9q4C6cKKivSLaYqAGWDo9B236TKuUgPBMgVqYcRkACFhRTTyT0/BaABjJcobgb2iC94Eyeg+BsRoX3lb1mD4ePWWvWldUMTlUDOgzFQEk3IZP1cw== 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=nFvqYDiSQmB8x8bsWl8Nhp+kZ1WE7xqNfkm55vbEPeY=; b=N25/mNup2RmNQsZMvcyvrlMG50JuJFXCoAxJP019QCxH/7PN4bKdhTR9WCpIAAFjKkvkv54q6ux35Il7E/wZzMytTqYMODDq0z9EEaV7kTIJTBRh26/JeE7qiIHvRyAHQr1hlrzSrMhyWxzxs0ocPSRiOXyP/xDk6hwcA28LPqakGCPBB4ZwLtnhn/BITJ4+fQ5IVV+UnTgFJOc5w9qLZ1hCoKcdsmdT6Zz7I+3gvlPygAQL8XlBwVC5C2zC1CMtiX7In16RfSunWqpuDljISyBiymGyuR3SzxG6gwmucQwHcxMY0vsSPA9W+z2/Q8dk31WIBS6N3zpEwTOEP3IyYg== 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=nFvqYDiSQmB8x8bsWl8Nhp+kZ1WE7xqNfkm55vbEPeY=; b=rM7+aymqJilHXhtCj2fYnFltv/FmLOesaOjXwSpEX8UFzejK86Y362Uu43miLk9VB+XJ+TaKP4GKxfmtLPkyO8V6cWQtEYucizwCoTc/fsw+n/JGwRIMCGKJufULkSH5+TRavl5bRMedmmNlR2N3OROjz9WhRSWD35MJv579fwiBGfrWn0o2aqowBexxQ2MiiWaau9mfwJbqO/Rsfe6VvuJAbJPTC+9z0UIvFy9dl3fU4Zsqk83zWIcNSsoBuT6/wcqTIC9HvSOI14bTgOOnCIKQjfNxEbEDlaOtF/nJfnpvMUo4OeKOOnE1Fi7nycFbiPhu6fQ3pzvTxmuxYqTi/Q== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:39 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:39 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:38 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [zTjKDMeU5wBTod9/MlVLVpmB5WY1kI1Id2wmhzZclO0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-13-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: d9b739ca-6743-459a-5004-08dc71fc4ba8 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: ej2xoiRDkh807ntx60vsyMpGGBu8WDU8Wmx4SfpfA150IwAZmZRYTcVSTRYiTlavlQR6yMyB+sdn3DkMrGC4LbYFr6uNHhG0l1lf/1gDHW4kqLoP9wLeYULOGWIDlBZW8sdskZFtVr1BbFaUficehsC8PNPuJuSOGl+Kyr6yy0973rpdxG4BK4pWGJcepxaNPmLiY2qv0ti+cL1WUmVy3sEXkuFduACvgOIkgvFS2r4eMu2E/HEI1lMNyP8DaFvdTl3T420qfHTMkKnm1szR35nsyZtkEfSFWMi290moA9czHewXityBptaAqS1vMsvJVgh4U+v506ZnFzN57ZRqk/X4FOw2B9TG2L8cigVJhg2/4evxVhlQ5m9YK4Gz88SYxVwS3IvTRYFYbBX1C5k5gaaPwvhVPs0doo48g1AzHZkgMuVopupB2lPzqzCQzx80yfm6kzHbFywyJ+lqdpWt6+PoxKN5hkEnKzEdHRKnVZQyIEgBynci9JMjJPNOSiYaiIHZBxU5nDCLcKVWIY7yZuTCy4jmkBUxV7b/aMKO5AFWd3rXPS4hs1yfKUcZG2LMrUKgxzKomAwmvUopaOeM5JaGFVzAq8VwT167NIUZHJmDPQzJafdE0Me1Dp4X9iZ2 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UibdGCVu7wjyjXwGWX0yiD3RdA0QK51I8c1XvC/FhO+E2LkjRT8qVL2esJvWjD/Ajgg1UcouY64iXSNr8A7lUBSVOjHfWJbSpLygrvJSMowiUb2XqSHRRRRRo9nhyiCVO8asZZE+brxlNTDxRfzn6GebBkA0j6w5PxMZ0X/Js5MHf7lRQldXCIBLosMfYOk/YW3pwnpnXOUHQ1x/SDG6Q3qwt/SFUX9pbfTblwVZZ0QaFUDk+MnkKzl4L52eqy+kCaZy26kZBJg8RumWndcp410MmpLfamQXtXoD5Nc4jh8FnRsQegMoA0cRM8y1Ew3Lu18QV93g3frSU+49OzSTm+1jEGUPXnsnykPNZFb2+OOB4QF63QHX4nTe3E4bYP1Nh+MHWSlnU6SMuz2n2gVAzv6UArj2hhcoGCT2cJttfOQO8qB0frhDDz8sWex2blbssBsmTsgmzpTkMOftg2QoQ2yh8tuxbVnWRGaMh1Im1cHyyNZmR6UikDiJF0ez3EMc9p3O/9iehsT3/VIGQbjuzpuWLdj9K3e6HzItWrA+zOA+3kT4keEZ4puWyz2F+zNRfeHwZtAP+sjHTGbKG6i6TqHeAyLEqdXAV9PfvpbUQuqlZWVzL+4EzqV/E716Ukg+wNw3khZtPutgHP10+09A3SQoDsLVdbLlw2gGhu/uXMNTvnZhdojQiz+Qij3Ni7ReYKiCAGPgnB3TrcOcpLzUkr8VRCmu+Pvw3tCtWyArp0ti6Wlxu28XblbhVbYSBdL3N9lcnxv0jqoVUSdfdcV9NmQNZTnvlzvVuKG56zVyenjb+Hn4zTvPxCdDt8iLD0eWlL6IbivegTtWpFIrZIVjx+MFBLtdX0NpJ5yhpKuZsSEglN9P4VqDB4paiVSwxPusAQF1Wq+o7YtlrsH7nvfu0MSkBxOArSC0HU11j5aHeEJGQKvDSPbV7wCOeuaZiy69Wvef4IlliKHLR24omlbIdcQcpLnf15qeOnvIAWnk+43lXKyoHu+B6RjeV9LdBRGSolfX6SCD9HjhwrMI2LQPCI/2vsnvAnUCPGF4+thBx1+sSshqjoz1HezuzhbAMn56ZD+XUMvT9LgVJqB5nnYQ18YyyKIsmCWxL/dO2wlteIoGn4wW8PPAimz644kyREm/e+aJ5rjN8W0JymAHP0nQpXeNz4bT/aN6GDsCUM0vhs2fskeuqogE28Bzvxvinp6UCtPF2pIB8DF+2PcHapdY2EDFpA/At33oTZjhWDJs/D0mqc661Wb7Rqlca0jCaOVuUtFpJ6ByynbA7VcrcoHRlg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9b739ca-6743-459a-5004-08dc71fc4ba8 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:39.7285 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 14/71] avcodec/mpegvideo_motion: Optimize check away 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: 4Nbcml0zNATS When !CONFIG_SMALL, we create separate functions for FMT_MPEG1 (i.e. for MPEG-1/2); given that there are only three possibilities for out_format (FMT_MPEG1, FMT_H263 and FMT_H261 -- MJPEG and SpeedHQ are both intra-only and do not have motion vectors at all, ergo they don't call this function), one can optimize MPEG-1/2-only code away in mpeg_motion_internal(). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_motion.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 5b72196395..ccda20c0f1 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -114,13 +114,16 @@ void mpeg_motion_internal(MpegEncContext *s, uvsrc_y = src_y >> 1; } // Even chroma mv's are full pel in H261 - } else if (!is_mpeg12 && s->out_format == FMT_H261) { + } else if (!CONFIG_SMALL && !is_mpeg12 || + CONFIG_SMALL && s->out_format == FMT_H261) { + av_assert2(s->out_format == FMT_H261); mx = motion_x / 4; my = motion_y / 4; uvdxy = 0; uvsrc_x = s->mb_x * 8 + mx; uvsrc_y = mb_y * 8 + my; } else { + av_assert2(s->out_format == FMT_MPEG1); if (s->chroma_y_shift) { mx = motion_x / 2; my = motion_y / 2; @@ -820,6 +823,9 @@ void ff_mpv_motion(MpegEncContext *s, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16]) { + av_assert2(s->out_format == FMT_MPEG1 || + s->out_format == FMT_H263 || + s->out_format == FMT_H261); prefetch_motion(s, ref_picture, dir); #if !CONFIG_SMALL From patchwork Sat May 11 20:50:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48743 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298353pzb; Sat, 11 May 2024 13:53:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXX/L6+ZddbdaGkU+muJ0Fr2HXztDGxokM3BrrXnJ3AZ7BCZh7SOMFAjU83jMEqNcIryVOFwq9xeVNL84izQM0TJd7ztusTv2iPGQ== X-Google-Smtp-Source: AGHT+IHgu7cYdfIDLdKXAQFS74vkDzMSqsH2rHUeC415ZSsA/Z5rOu13oHzScBPwhY9HQattVMTN X-Received: by 2002:a17:907:25c5:b0:a5a:3e00:6317 with SMTP id a640c23a62f3a-a5a3e00636bmr338841566b.31.1715460839331; Sat, 11 May 2024 13:53:59 -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 a640c23a62f3a-a5a17946017si350869866b.97.2024.05.11.13.53.58; Sat, 11 May 2024 13:53:59 -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=K6GN2SpD; 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 D6B2268D353; Sat, 11 May 2024 23:52:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2108.outbound.protection.outlook.com [40.92.74.108]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B87A868D620 for ; Sat, 11 May 2024 23:52:44 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VSB9WbDhN70LlDmv65POaK1kDho7Eh81cy5U5TtsHopUQFeABAZq86pra7OTt/0ocN0ofSoCpMDv9+m5fJRbTLhVjD8wifks7BX3LQmSZAQb4uTzGlXLLYnkSQKK0MBgMI9vmO4HIUa5SNPkl06JlgODqKXIAPmHHLsZ1oXBamXqJy7Zy0hb1dRzjHjYUc0fmo0nhkofUUPa+PU8AHh2o8lDQLXSMuxD1OA8fRWHKYOxDO0NBbmzzi+9k5L0Ch06TNjxHLWungzzSIbPHmMozgFk/OcXpY+ltifJ5IWl7W0c5KCo4VuVbjn1/sWprMsmDjZtBx143UW81P7QkM0Ekg== 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=Lb9UE3JNbn81YMpLNwHjO7AqShG8gtMKPM0yAdya3R4=; b=cY9P5K7Sa1seFr6x0NXUxSKbCUIwWp6/qqQEcSfUvOB7i0qIdjaDgkhhrIbgtR3bta5SmJfVsP/9fzxix1EnFnGQMwDd8PdQXqmkbI/XWR2D0Cy8iVpvvokdHg/AgmVNsJb4+j7TkLnal4pSWfOZC0hq5Avyx5hz3YcwI1KS7t/AYltaiAsj3RfojI3ONStl8jpY067zNa+/LP8Lom6ApnaSjwk86xsxKUGRG5qGS83gA1uVj+4174qjmEUjhldkm3h+ZtvwADo7edsrWlSQmYLxmnrxgnl0sBDChUg5mjH4Y2dlWfcReldb9zvpQbqIYgRtSPEYq5OvxDuFesBWpg== 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=Lb9UE3JNbn81YMpLNwHjO7AqShG8gtMKPM0yAdya3R4=; b=K6GN2SpDbKdkDWLYxeC6AgV7aPwIQVB8jSMBc+zqTlArshSs6PG1K1yppvtv5d0AR3QuLAid8s66IWgMB5ETn7bhi//AwOer4YP/o/1IzzSpyO8I7rmpWq/Vjg9ziXLLFpvX4aOcp00SFoo7KiGn6cMkjoPPk/sGTAAt0x1dgPdBylU7S+u/4m33qA6sN/221PGmMEWqvbRmtmd4Jv1fXnuo1xY/VMgzrV+Gk7/lheIHABgueJszfoE31rELMgvwDaPMjVSx6Jw8xlD+HJXGR3vMs9/9Y5AVyKkmJ+ZbY02DUqnAY7sBjDSkSxl6otU7TgIKccCLaNhPLnTCXtGAaw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0449.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:325::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Sat, 11 May 2024 20:52:42 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:39 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [L3J5FYQ5HRtWJKA3dQjZH5SjXCdR5Q1jWw5WMckgWTY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-14-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0449:EE_ X-MS-Office365-Filtering-Correlation-Id: 389e4b90-d4c1-484b-68f2-08dc71fc4d42 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: pludT8K+Q3NrpHdPiWGKtLy+DOpirNd9EYKGahJKPzXiB6P3vogBr46PanByfXz6vFqqSG8/SmWsxTZKwVxLE2BP/denwplppRkt61IlhsaNVN+KHHxHfViB8V9tEsB03tD/zpC2k94eycXQgXcoDOO+j674zel5cR4nauXEwya5fV6ArV4rAGGno0Y5FrrLKVJFrCn7+4UnY1OrOVl6JCr72b3ZTS+N5WjXbk4YpO4UJmSVBPYXXaF3EpRSAQlh0CL3H6huHZDgfOnQwlLGeu22jblPcsnk7Yc8Qf3Dbw054cqE0/xqEEHEbKPln3v/LJIGaRR/uoqRPrCKv4CVQmslod3nxloFa84BIYObh+Z7UikzhbiZAW8KP2S9Cqn2K3UZR5wxFjOGadvDKDgFrIRfvNaJ4PrQvLaM6R2G9lDy2a1CsIaF145dWDnrrSbhukZO0AU6r/Q/WZ2rZ+7EuGldYgblKX4XC9Bi7/fu7QfgIq1iyx2F+LdgnOW21GLFQoIGhSsAo81MVv9JlpUAd5w7qYMxZMQ8GaXaL0p0GI9m2+sReG0GC5Vj1V1KwLNGgfud0Vx5ZCk/v0ryb3off8b7o9A+//IkRFWTQDgESWhBZPGEfKZ6f3UnC9W9+mjt X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SGUBWIiM8TD/Dg+I/EX6eB4JTdZXpSJ9eKhiE8MsrpwgW0x2nm5Msjjm7koSfnkVAP2fXAxY+KzjKa5u37OBoWBODF2f860mZJINJCaDhBVYqVID+XxMmCIx+cI1qkaxScPZ+m0ZO56XNlq221H26/RUmDdGtu/a+w822DftRFe0CSMcnrpj8xS9KfL2vWLN9PjXls0RE/hlS+a1MYTqJt5YFugJ8PTx7mVQvDCNfDEyr1o2O8jfINyozNoGf+WNRS0Bio5DDwV7Oo5SuYMb/YE5hz+TOrCt3iJa5cgBjY9+NAC05kNHOGMhPDlQCPDM5YlmEbxkBB+B6QMYmjyQ7eYg0oVrNYTIdH/0Id7U8V8ax/CPDM4SZiY6G78ols+VW/T62nJoK9Hm/hv9i1pzIzKIlSmJcfuqryDxUbz7Zg4eZG9gX9geIXJKdcoButfdm1xG6AgYVgKIh9roNbac3fEh6+q5Pl8Uq8WUjAvid9QZeuXst1C4DM0WaLtsu+fft7ti1cG2P6WgOHRvssmK5ONM+9Qa94mSlYX/ncYElRXG0y1sJgj40Rjnx0CFMxEyN+z/Tn941/oIaS2yrNncpHGdIS/+ViIjaFjzzEknknqKwalDvAne+CuQIG61OYNeNwwzhr/rsC3yz8YO7VEuG0B+/Xmf5bhQ3UlwQfahhF6WOuQuRZ8lzYWibvXY88JO9s4KzL6nTiiU4Vdc0kEI1XETuxbeRaHTbPxz6Q6KcKXSc4q7Q1jMitrXllwPoY1Syu0rBzNDYUTpycy6ISryz/equmNwY+MOJCEi6c5j/0AEv3Sjx3eMMlE0Np0wvoLM/5ZGVGE4YxULlhxyoPn5lXtL+ww8ZUITyJH8p/iIf440ipwgAvjoAvO/IXwu9rFoCuE8htdl15MdhgvKlxdGLAGVdzAF3frTPkaVylYhjHHDjmqQixfoIpbPgSrr6b/QtYgkmY6Ly6nts3yut4XaJcQVcYMsxSCfzpQr3DUdTq3ncixzt/kZ8aeHzMXEPikKNVpL4OUtGkkkSwMbip+b920RgWO1OmAD46gNCwx3btnO60Dk9R99HNOVSB83C3ApCxuLBv5BFuoTguCwXnhvI1Ctm2EECWsXGDbYjlmYEcSFrYgsKPMRoygc8OsviIb1lHI3FxV2i20xVGB8PbU6bB+YqaA2vdc7CjmWKItip2HusWBL9CrfF72KMueG+ufoP+WbvOyeAtasrz7zvmh336ZLLRNgpoS68lG+vlbjwq6dAyJYj7JKTX5qwjO+4V10IbdwRxyPs7K7gtYhkZj9DQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 389e4b90-d4c1-484b-68f2-08dc71fc4d42 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:42.4330 (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: DB9P250MB0449 Subject: [FFmpeg-devel] [PATCH v2 15/71] avcodec/mpegvideo_motion: Avoid constant function argument 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: 1NlA4UcMDDcj Always 8. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_motion.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index ccda20c0f1..56bdce59c0 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -239,18 +239,18 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y, int bottom_field, int field_select, uint8_t *const *ref_picture, op_pixels_func (*pix_op)[4], - int motion_x, int motion_y, int h, int mb_y) + int motion_x, int motion_y, int mb_y) { #if !CONFIG_SMALL if (s->out_format == FMT_MPEG1) mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1, bottom_field, field_select, ref_picture, pix_op, - motion_x, motion_y, h, 1, 0, mb_y); + motion_x, motion_y, 8, 1, 0, mb_y); else #endif mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1, bottom_field, field_select, ref_picture, pix_op, - motion_x, motion_y, h, 0, 0, mb_y); + motion_x, motion_y, 8, 0, 0, mb_y); } // FIXME: SIMDify, avg variant, 16x16 version @@ -738,12 +738,12 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 0, s->field_select[dir][0], ref_picture, pix_op, - s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y); + s->mv[dir][0][0], s->mv[dir][0][1], mb_y); /* bottom field */ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 1, s->field_select[dir][1], ref_picture, pix_op, - s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); + s->mv[dir][1][0], s->mv[dir][1][1], mb_y); } } else { av_assert2(s->out_format == FMT_MPEG1); @@ -790,7 +790,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, mpeg_motion_field(s, dest_y, dest_cb, dest_cr, j, j ^ i, ref_picture, pix_op, s->mv[dir][2 * i + j][0], - s->mv[dir][2 * i + j][1], 8, mb_y); + s->mv[dir][2 * i + j][1], mb_y); pix_op = s->hdsp.avg_pixels_tab; } } else { From patchwork Sat May 11 20:50:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48744 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298390pzb; Sat, 11 May 2024 13:54:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIyraEvFVRwKcs03VdJn4vocjZNc1DB4zm3OiraktIiUJ+pndXyZ7PeHShevhzWd97/VJfTOhChcJXCMq4qtjVQUlyi1agS+1pIQ== X-Google-Smtp-Source: AGHT+IF+PkF9ek5gKm6sAXrxYSfBhPOT3qkp2/6hIhEMTvobXn2tK7xf397EYoca52sKWu1mNKMr X-Received: by 2002:a2e:9094:0:b0:2df:4bad:cb7f with SMTP id 38308e7fff4ca-2e51fd4b333mr35783811fa.2.1715460848047; Sat, 11 May 2024 13:54:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733c362b1asi3277859a12.501.2024.05.11.13.54.07; Sat, 11 May 2024 13:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=LBNJzFfR; 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 6B60268D4FB; Sat, 11 May 2024 23:52:55 +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-am6eur05olkn2104.outbound.protection.outlook.com [40.92.91.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCFD168D467 for ; Sat, 11 May 2024 23:52:48 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bdNC2SM46ai+z7ZqTCZGlU7yipiAD5MCb+7o74VtlqEpZF88QhnPbGWHBvchsHFCZfN1q93qVtGBzftQuazDgpbm4r4VoVvgHFYv5xtCwot0ZDOdNoO0ev+yWCDaqn3c9qSQkNJ6DO/60muXHEMHAacD3MnBibALrdF6nmgvBV1UR42vJEdlx5tS/LwiRBwFGY0aWrbAF2Lvqdzf7Sxb3Rwnays7SkK4CQreLcSszVteFV+bsTFKBSapeO/e141b2u/lrIuoqHL4P++t+/+Bfrg3CxL+2geYM9vIBgOibH/UP4j0KVPq1tPJ9RpxHdeBn0gTe3BAztFV9RrcQDtGLg== 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=nYiymu08iRUsRjmCTo/W3g1Pu4ujQQR+Gzgf8zciFUw=; b=MIFp0qHKFof1Bm4IuD2QFiOZjEZFzlxoeh3/Q7VTWnMfaj1lnahm7S1p0E71lCwwfnRORtd3/ua8Rs5ixFu99s7LrU8KKmS4ZuMz0Y6ggzR3YidCR+fHJxpaYeZmumzyrszsJRVcWfUhE4E+HtGRHyFySyVi/Fe/INUIaQJ5mKfnDfrOjkq6jyZUJpADPCvx4dYJIauzBf/i8ku2f5qlCbdGYAKo+JdzDuvH/O/QzBaSP+TRmALt/DiyGvBLCqnOBsqFtcTl5F0F2co6qnTfxFE242VtJNtUYxcq0fn+5qB3ndR0qYLcxnBNMpmvxPGEyJchHUsaSk4PkkbDxY6YMQ== 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=nYiymu08iRUsRjmCTo/W3g1Pu4ujQQR+Gzgf8zciFUw=; b=LBNJzFfRNbI7nx7ptG5m/CBkATs5mCkeQvnLF9xQ9QJnTzeN58i3g1SAA8bke7m+RXCAOHuLGP9nl7GUbjxGTxnRGJyGuhwAZk5WcYkpdGDQlnflIUDWj5MukS9Ixb9rBc4coRmQCytAVUIrNg3Kwy/YmBwf1p1OkeNUgBpiHZ38VHtBrH0XgDll4psf+cXOeMO4yuGY4+zB/SYs8Y4u/7DMMYYwo4YW3tfwr1vpuExAdZiGygCWDpWdIPUKw8FEGSnUHEEAI0ljX2B4AvFyMvqNU0bg3JNQuYMFxXkeuXJGP6MsQKqjWo6oXjroY9A6S5UJan2E7emQI9i2OaQMQA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:52:45 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:40 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [iAMMncvg3UfECNhUemqOuIhVINwTYvjZKz0DTcv23zk=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-15-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 11f27469-97b5-4b3a-7251-08dc71fc4efe X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: t7E9XZZKTDcN+Nj6303edjNNkAdhYd59NTyYXkBECREKF/bXw7297fFmY6EFxPWn1WN9qgMX64PBMGi8MNyAcZQ9hsyW81zZni5OBqLScB/ACOGzSuepXq+Gufoibcd0NY+lgtjEKh7kPjg47qVAjmthwS2XyyD+HyI5VZw+5S2Hpvea1ef9otMAKl5xtbxf46XVqtH7IPmVRweJQHI5taLs1XTF6EvUR9xiaCP+nu/WUbVL0Yy6J39OYMDj+UaWFIE8h6WJJHDvEhAPhbD+9gu4BxEQA2vhDndiblLi6th2PJfXNM2WYPYFvNUfZKG20GS781HYGD7ltOTTAZcNCjcs5jbqMzUOS60QUXF7hOpWWP80azqDKn0Fz2I8fZuEpsm07csDNbAQd+bh7aEqK8POO102yTjFwMe6Brz0LuVC/vGDnmLa/t+GR1PQ2oRJiad7tLj10VZZZV5EtjSHsk41iCA75zv+bRXYRhscS5o7M2ATwbzxdvF2uOEpQJHfem/91HsU3JCqrBcVXd3gm8pPpVby9PxjfrryE+qlNIqAfc44r8LOjK7b0B1vwClFccYkCkPsWexbkaAYNgOwCS1LgFrcSp2vopO3rC1tLutd4nD/5Yken7x25cCEfgGa X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SeUGN9Ok6b+Rr7UGoZWHV/hIE1EU37+EHtjLTHwiebPYMZ2Dv/8uEC6UkHBu5AOficRgwu6h7zgoAhw37YGgqnM6PGVUPdWTYObrNqf2Q4zP/wa08u+TO1282DLNc0iM88xSBAYmn6z7GQTYYJx6ePvndRquKgxRmcCInQqciHmLYw8GHpBsjj1/eTywBYCvNPjKEczfbWeggeP0VmjZIVmIWQnvuX4C4bukm1FHG+E9VX/pt5Bq5wZhaEEEzOZj3NjiWUxoKbCAgFDGextsneEjIo7BpEdQSz3nGdViwNTzoNaYekOtCO9pei7xMZESXVoBQw+JE8Gw7KvxQ+nnVwF05egO78PpnHflfjw2gjinRsSx0vu1m8NTRjCLHcLnz4toKuE8UAhP2r/HXTEgKfQIqOk0e9JMcVFPyqSQzp4zs/AC0ObtAetrec1aycTW2U3Z8ZShKcVuI5FBPgIYsD4gdyvwQJSXbtsGPtGMUWat+cRTm4aVFrkGQUqTYKu9iGa78ew3PKuWSOyuJH5uYSP201hG0mjYXOLSftEDQoY6ayegedmFPTBk7fOqxJOrVgG8/WaNGE1ecgUd0hbk3wZxbf0ypUBQhkjItNCARDo5yk3LB7A95ESborgglef11kb+wwa0GwgGNgasiY2k/+RVMsXmhCPZsI56ptZS0vBgkMCuApqoTMqb/56B06ThR2yLw/IRlbo/66dgW+f6ORoXIi39pPHYkTlCKAT7wleJrbDPv3olkZrFPtw6auBk/YkzvjRQSAoOkUFYndW0zJNssx/wqf12C3hnUYI06KmkpdrwAMM7pyCCnjiheAhsuc5PAwDM3bMMs2Rie2rq0vayxgJ6+tnh+Jqv493dY+mgo8iuj0NV1e80G7ME3ytWUDoJQXvP8VowtdtReqwbsPKbgVZsZ4qjFjdbNOh3oCOiS7xANwMjA6S2ldYYISFno4o69SWlDWR9R25/MJ0dt9SOups8GmAaI5SgPVg+1o/tkzO3lNlhFpLB0G3Q+nj44hGQT5eEzpHYBkxMOkkp85rkcJJqpvXYKoheFwppqlYdf+jRBsy58YKe8U0U/DoAW3V76IaHCQLh3W4uN+xfh7RdCL8Zcm/BTxGmJi0688Lz8qqjLDKnSvRff6Yba5D/y/WmVCK7f2GO+5lD6UDe8mDfUmmQu/ZnD0CjwUZC414XcBYyZo0A+KJkeKv08XnALLtY1FVdCGTXFlsk3QEPKLFqTRNpa0XN7qdl14J23ocKZaLMk/lyFPQVvjdACHAVHJ9kOIBa2VLYFYJyy08NRw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11f27469-97b5-4b3a-7251-08dc71fc4efe X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:45.3415 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 16/71] avcodec/msmpeg4enc: Only calculate coded_cbp when used 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: pBzq0dorqfFm With this patch, msmpeg4v1 and msmpeg4v2 no longer use MpegEncContext.coded_block. Signed-off-by: Andreas Rheinhardt --- libavcodec/msmpeg4enc.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c index c159256068..5e6bc231d4 100644 --- a/libavcodec/msmpeg4enc.c +++ b/libavcodec/msmpeg4enc.c @@ -389,7 +389,6 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, { int cbp, coded_cbp, i; int pred_x, pred_y; - uint8_t *coded_block; ff_msmpeg4_handle_slices(s); @@ -449,20 +448,10 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, } else { /* compute cbp */ cbp = 0; - coded_cbp = 0; - for (i = 0; i < 6; i++) { - int val, pred; - val = (s->block_last_index[i] >= 1); + for (int i = 0; i < 6; i++) { + int val = (s->block_last_index[i] >= 1); cbp |= val << (5 - i); - if (i < 4) { - /* predict value for close blocks only for luma */ - pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); - *coded_block = val; - val = val ^ pred; - } - coded_cbp |= val << (5 - i); } - if(s->msmpeg4_version<=2){ if (s->pict_type == AV_PICTURE_TYPE_I) { put_bits(&s->pb, @@ -480,6 +469,18 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, ff_h263_cbpy_tab[cbp>>2][0]); }else{ if (s->pict_type == AV_PICTURE_TYPE_I) { + /* compute coded_cbp; the 0x3 corresponds to chroma cbp; + * luma coded_cbp are set in the loop below */ + coded_cbp = cbp & 0x3; + for (int i = 0; i < 4; i++) { + uint8_t *coded_block; + int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); + int val = (s->block_last_index[i] >= 1); + *coded_block = val; + val ^= pred; + coded_cbp |= val << (5 - i); + } + put_bits(&s->pb, ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]); } else { From patchwork Sat May 11 20:50:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48745 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298415pzb; Sat, 11 May 2024 13:54:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW31AQwfcWsxJE5ZJvHEcze87gIST5nbVsTryt+YgU4wIC7yGxjdAD/uPZGrtNc/mEwxdghJypiITncKCQHkUlZaFJATmYkCvjsdw== X-Google-Smtp-Source: AGHT+IG5VkFme/3QOvPH0i9poCwjmRUQHXWce55v5fwjfNHYwW2H1+pdh+cdW+Fd89z8A9GvgHge X-Received: by 2002:a50:f60d:0:b0:572:7c13:c7d8 with SMTP id 4fb4d7f45d1cf-5734d6effa0mr5500398a12.34.1715460856800; Sat, 11 May 2024 13:54:16 -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 4fb4d7f45d1cf-5733c378270si3520774a12.631.2024.05.11.13.54.16; Sat, 11 May 2024 13:54:16 -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=uHSF1+0C; 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 71E0F68D620; Sat, 11 May 2024 23:52:56 +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-am6eur05olkn2104.outbound.protection.outlook.com [40.92.91.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A02468D467 for ; Sat, 11 May 2024 23:52:53 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cYL27gyT7gYV7a3eqODH6Y1iYFlJ7R4BxZJvvxq5b3vk6heU6GlVU41jFaPvdf00fu4lKW1AX2X0FT/LRHGjigZuz5Mm1uyKQmWVczQ3bQ5OiUjn/HpHegL2lHIEmru1t7VrkY5VuOTGGKV2+UUt6CLr1/REyCuD0h1Nziql6Q8h6RXno35ZjtWHuFcrN9KIvcImbQcfXNickFjBxBfd1kbpVNs1e5TVmxitzth3Ts3j5HoALNk1C5Vr1kpvlhOs6aL/IH1IFrPTCM6t2lOBwb/Cvb5D6s3yUWCSEeaJ15QjT/UzhBBrfo+44/qF8jBHNdpT5qpPw4bkclBFORiKyg== 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=2vLttLR1fxgjycn4KuEmsk/mDwuAnNuq5i+O4Ioj30g=; b=axYj7StfNDkAmS35YMYGAF1I8AUHP0weuCp/PRMgesyO5g4bFGUg0DHZ7s+Fzqqand5QCUhv6r31NFnIOzFOPh0QP8jSdwkGoLh61l+HLurZiZV2FegS5q7OzogUvZ09gCih5Vt2r6UJHlfC/zVyl0JQUz1Aq6AFZf+w5rKG/7GZ3Evzuax8bgmu6XT7vSRsOEck7Uy5M4VVlV0G7aUr8AU++35Ef2zc2Kegs+IK/BMRGmg/bDAt9yBLlvvYgFzjW9lq1Mft3GJMAfnc8xrubnAEbpPrNLduxrDxxOZaauaHNbg/fn0qkpJAl0BUDxr2b1KI59qrBjvpYeSZB7diTw== 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=2vLttLR1fxgjycn4KuEmsk/mDwuAnNuq5i+O4Ioj30g=; b=uHSF1+0CxZbqH1/JE5j+s3v1pPBKy+mV8dnt/B/+4bSvd0Qm8CKE9vr5WZHCcDhdU4SrnHVWJa/sWV4T99nf5C8mfThVa4MjPwCkHmNGYkCjZSWD7n5VGq/81hL2U3G42KwoBCpJ/Pm4mUHn7a/fLYHLp3bmFGWMw5chvgbWaURxNElacYsWjCDNNVFQCdqZrT6cJHQQjznyBU37cU8nuljrRoSUMqqVnNbTonkzma0FVMqnw/q/SOFJj/ogX7fb187V5Z2saIANUf3dOW88ZDiAcCJ3r5MXaYA+58jaxgo3j9eyTIrQbZKkbexxsv8Aabu2tGyWjlGLnecYA63mgw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:52:49 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:41 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [luchA69sRGRJB6cyYqF+9EQ/suzkOgKT3wgTgGFsQdY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-16-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: b5efa182-2754-47fe-7b91-08dc71fc5158 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: aC0GJNxzKdk76wMfFd32GekHIJp7wcHXqDSw6ZFz+Lu0T8bK3MVN/UkcCMMzC2awhUURIVVTomMMI4KCq6KYHuLBS8ydCrGQElEzpft49FA72ZCpWLneDdox4FeOkITG0PnvXiaBRRC7D/F6UZyFU/8RFKVUb8wpDVqsJH2u+9ROfmIdYJAOAI8StoADC+kDNMR0sL0d6FnuZuEyt+gkjQMuegyrhkcwZowiTc3zl0GKUstP/tpc8KLVlg0i9BWrmZpWAxBPohkk+GLPPNFFCRge32Vd5xrrm23l2LjCUhRQANayaXQNW4jqWc/Cupt7S+rUxRXdztEM5T66Wgd2tWTHxrbS3FEnjJtQNvKX5WsUqNeGzNE2ntXhNYnh430Uywl+K5fAG9gc5hHZl0bfNd2R/eSvWlEJWqrB2eyJZkhqKQkDWXJDKAVQn45Aw2SV+tdLq+fIAQb8oK+giRn2CPndinI88hdv5X3EcZpieGaGCtaSjEBe/CoKyZ4L8Csoxcwzpe3NFCSe7Pt6vmy8vFUHhLOCf6q6kaZVGRmHaOzmkxsu+jfIBhbxHWkOuv2abZPKaQr2iXrJHziZIwp7hRE/KJdP3/89fvd5wOqeb0EqrPNz7Yt9V8bRmnBrfwfz X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 75buE0XuEA5r1t6MNxBhnCcBJdIdcQ8q5uKPkSUBpT/FGetvjwrFVBsySrXYjyZ0qde3fNgz8O8YRgl7H2mhlY2NAI2I6gFBWtW7E7xwM7L3SfhoWzY0U5Z2NudLDfLkGehX/GdAW+Tq9NQ+T/0QWVO+Ximca8sTQAtbDKxT5VxVLRxGxet/ISTAch0vqM5H+qPZ6r3lUyVPtc+46Su10rE3goEJ5t5FQht5M3asp4xhxaNlXv9W3aqarYOPGQ3rBk/C8ONWBe+aeUZ1BYP+lcWu8AnTsWeWyb7E/YqiURLZN41KwoV3NOhQXXmlLsoCRLXJ7olSYnZ+5IGd6fVzJowNhkLo0aGGIkMoLH3H9KZk/jqL3g3rvD94VOQA830rMNrPhJLnDNTU1xtP9ocVpb4X/dQnzSxCmdKiUsHn1fJTM3jspPowy4kvFnWnxVUfa54qyDZGtx2TMShZOY9AOZmsp+y74Vq8rLf1ulZ1VjtKIO78AHQ0b4VaFCftCPJQzO58YGWETqCCW5jHKztG2XXsffy4I0mUBVSNuhzA5aKF4QlBCEdsEFIjUft8UZ7NKdxSzbb5BAmArHFBNS15CRYJ/Tq3h44KynKLp4bcFSufzvpqeQTOGmu7luyTlYqnv87WlKUpt/Wve0HpLLtRRu7/dsD0Fqm6oN4yZX0nGjOlGXzlcsPcN+X8WG9o7kiG1hUbqEvYzHnWlbI11D08GzN///4rREawRynsD8NOal0ZECHpDotBzy704D7Bhf57fNYw04k5PSBMSQxBjvXbqdKt89jKJiHxpu2XwJLq1W8+do+kXyyOndbDkI+Ve6MFaPr3+97lFndvUb7M8+DCTPg5JYtxPvFGYK2AiZ+ejOsSAWcROi6uIJua+29qkX4gCgfT4TX3R4R1TIMDg2kosc3EOlbXfcAAOHTZWgfd6XwK7GsvpA7Re3QwtKmEk2OZ3KZ6sVbjhoDqPdfDg1DtmkyswcwkyOVSpCiJypPMpWZOcscVrHrZ27kYhHwEw8qtv0t7dXdOPrhhC0dlSaCxSK/jEyxO/YfB3ZFkd9EhUXdYMWxjPh3XRcbykqSVJLRSLYC0Ks4H6pAG60GV1vC47x7OC49z78bw6wUHHchsux0jFftY7iNNdmnRWJVo49wKLVEm34PwMZe7DhosU1rkhsjiYq62IWK9KOGZ2ng4TDPj5e5n7K9brp61rCGGnZEfNePB1AsuRW+GMDT2vMgUSE5mxP3xGvtvf66ENO13JEV8i9S4UdfsoF2aOd+SBP6EykHnKW9YJa+Xi7h/CtX1dQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5efa182-2754-47fe-7b91-08dc71fc5158 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:49.3033 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 17/71] avcodec/mpegvideo: Only allocate coded_block when needed 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: 7OfyuP4OQTqs It is only needed for msmpeg4v3, wmv1, wmv2 and VC-1. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 130ccb4c97..74be22346d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -596,11 +596,16 @@ int ff_mpv_init_context_frame(MpegEncContext *s) } if (s->out_format == FMT_H263) { - /* cbp values, cbp, ac_pred, pred_dir */ - if (!(s->coded_block_base = av_mallocz(y_size + (s->mb_height&1)*2*s->b8_stride)) || - !(s->cbp_table = av_mallocz(mb_array_size)) || + /* cbp, ac_pred, pred_dir */ + if (!(s->cbp_table = av_mallocz(mb_array_size)) || !(s->pred_dir_table = av_mallocz(mb_array_size))) return AVERROR(ENOMEM); + } + + if (s->msmpeg4_version >= 3) { + s->coded_block_base = av_mallocz(y_size + (s->mb_height&1)*2*s->b8_stride); + if (!s->coded_block_base) + return AVERROR(ENOMEM); s->coded_block = s->coded_block_base + s->b8_stride + 1; } From patchwork Sat May 11 20:50:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48746 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298461pzb; Sat, 11 May 2024 13:54:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQDSzjS+FCWz1/8BQ/5xMefJE9KEnedWqlXb4Ey7l3tQtkzX/DLFWpzKbcqImj1RxHqlEh7jejaagw6hJxPUg2LkicwMIzy1IvaQ== X-Google-Smtp-Source: AGHT+IGOW1aZNIz5NKAaITi5jk68XW64UNooQ8S8d3/q+kj7wxRRi0HIdyjvG0TnUzBEKk2CS0rq X-Received: by 2002:a17:906:a8f:b0:a58:ea69:3f5c with SMTP id a640c23a62f3a-a5a2d676767mr395224166b.75.1715460866214; Sat, 11 May 2024 13:54:26 -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 a640c23a62f3a-a5a1876dcc8si350041766b.226.2024.05.11.13.54.25; Sat, 11 May 2024 13:54:26 -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=iF3rRpu0; 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 A692568D64A; Sat, 11 May 2024 23:52:57 +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-am6eur05olkn2104.outbound.protection.outlook.com [40.92.91.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2667E68D62F for ; Sat, 11 May 2024 23:52:54 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mm1AqmzMzF3lSBDpem9lnnHya14wSgjCVK+0FWBMvqDwZRGlfnkc67BXCYI8CLb2rpkLhw5j1Ay0CuBSMe8tbEn48RqdTL65X0RvSNKLy/grqZ+zOeLZpD3hgsyqnXcvFodUihID4NSLu4oS+kGS6ph+RomjIpm7+Pv7R67MbdnM6oYlsIOWvji5nXprS7QNMrqMnIv0lwKkO7YuMNyUDRHMN0L5kva0dk/Wx03NNcMe5j/xHLAjAxDV/igBXlpJ7O7BBVntaoiAMKmAgcaYrpVnJogePSD0a/nJD1ZuB3wQ+pjW8/LbCYKRdfkkFN6HhLuWjS+idLuadFDu9/+vjQ== 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=EPHfvsmo1QWX1ay4MwmFi1w0uOqr9QNDQPEOsKul4Sk=; b=YqxrW95xI0MQwMZzgmlttP7gs5Fleya7lfwbw2JQpehHmq22iC2VOFSNPIgvaJ541e1wLbCpmBJFDBGllu6cvFc3vijKS6x7KI7qrEf8lKQHb0U/7EjLcEgJJMUxhciKM5JtPT1kLnPimwcPsz9lCRMsY35vyEUilCmXijUsymVM1BSE96ZXODsd6I9GsOyCmXO7BEtEMPSUYf5erXCXLEXbSRmdzTRUEQLyYzQRKWoZksO1X4Swu3JU1o8WOyqmJYu0bSukf+vFlxGoUwlVA/VNlv/Rh0LREptmbF+VlmRU0iOtgCzCg7gB1N+xjmA6Vzveg2UU/9HeKBYPBPSfbQ== 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=EPHfvsmo1QWX1ay4MwmFi1w0uOqr9QNDQPEOsKul4Sk=; b=iF3rRpu0gZQmR8iokC83vCYTyAJN+7lrkxTZUEVK31mOYHoeQp6yfDv8csJMNy6oWqObZ9CCGlI1nzkalyu4ux4d+KXqZ52PGC8bFCHjMuUJXgQX4dGzPoNkdRkO5BMeTq82EEKpENuVSTfjXoMrokOSH58lK3rslALevOmi+dQySDfdhF8TEe3I+4Y7vmqFWvS2JyUR3kqhWX9ft3HB6Z3nP6lsWSyPNYd0J75AJB+w41+WHAXDbzPN5HqrNeM0LqyHNO7AF77YVIDk8oao6BuEKj1J0zJJr8G/O+3te4FiTliUo49+YFJ+3F43phAGdGOsipnQZ+Y4y6HTXTW7vg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:52:51 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:42 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [15/wdzxQElDuuURw4KrXYHhznpU6JQLBucKEXFgF1RI=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-17-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: a27de17d-50fa-44ca-a03d-08dc71fc52af X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 6IFi8oFagRb0xt54CjH+rtgk799jced5QE/FqhFf6jC5B0ZSQ21sLnORypMtLoKIOzTPTP8XbQVg1H0U+JpbTQIR0snvQSs2b6EQKhD6fnD8ZK8fN4VRE8UA3pWJmHWspNFqTBWWCldIS4X+tByh/5DzVly2AmZbWZUGlmXTFS5rACofHJ2NvLGYEoM+RS8Wrnz7GkcHKrrqehRyCwJvnrttqDzACdV+lSsItHC61PIwEaX2i+PATNzwNxPYegi0jWuJ3HuLVEdAbGb2MyffWtuVaWYxKuFBTvlCP3r2xlT+N1L9WqP+2Yqr90adDD6ppyYFx7bBW4yZINqrILGYJFa5simRt12E7w5sg5nP6ykSHlPAw2YvhaOXRKqtKsInfErrRpvBgqsp7IrjXaTNAmufLji5tsmqF+cWk5o6SvBToEojvVhyDcVIrtF4aCthmMWXftlrZ7j0lhY0WNnk3udYDY51BHbLJfUmp+M49Y8+rEhQ4OkDmk02pWopBOYgazbnc0xMvM5ILbtzHaRsR1d+Mu6r1EDckVwdpnl6T3XRkLNOJcelScC/28kRj4afWAPaSuMnp2JsOlmMciHop+XUyx2uiOVUQUfesWn7y68Q/KEsPZudUfFpp1FX3J2a X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cgw+lW35oS5tFY+/NycP8sdyTfKGr/WfRK/q6gT9DK/apXSgkjXLcoZ9vWEmWkD7PFfYyUsO/CnwpMjrx9AIPLyUV0YnM/TWWkUsMPwstdVzbOuO1Alsuvtmj10aTiwE1OJXjqLDvsquiEvvcOOAntGyg4fokTdaOn+toFNEC9YeyiSwqxxqyWRhle14nn5NymV3khaLm9JSzRIpqmDPrRzWCOdDDCZVhokh7RYrWx4i0JAPKLKASrluENyMyGGniqEg3rAaCFBGbdvRR5dyonSZag8Pgnkf5j48poTyfRh83FWKcjpugy/4Tq28JXzQupdEDZV7GKcHVO2RKOeurXnZS0HSfocdLOPTDR/F71OLzEdRBzCBre1QTSfjwd5nWdcVeDcGCceZpp7+iultfIwN5lQAvLPgfBpa/NpYu2sHmsFuXHsQTbX7RlOCPkgHjs2OmQCU+SzjJxGBXjaATeE14gbnAzN0vH7qkrrVLzJuZgCe5J14EwAUlbl1yNmRBbT91CyeqNQnBV7Dqfsm/zip/TZkcumtFf8caQjigdCcnh37SOjA7i8Z4rQuqk3HyR7+Qk32IIuGt1LwyEmxztZ0kw2fGEolyiJxa6cr/SodLUsLUSTQcqR9rd96AkPu7A/4lnpg5u6YfQOSuyO4UoyyxGCV6tE0mSUZ3ad81InlHCo83SrG9S4WnqaPYzIfKR4TdTx0g6pZkGz39dJ9A4DJCyud5LOftv1deDvxzbtQbDKoEtPNS01xyowxGh+iPye4piDYLdgoDb2PPlxspPboYR2JmrS7gArDo32jaxX7CMS4NaM+1qV07/8Trayajr9PemVwIJFq/pqAaijEJbwLtP2O0Zl0dfdlPKduSCzV+OTDbdkcKUXOCfqHRbWQRGk99ujIaZAS75TxRY7uabdHvKMYrgzBxtr3H39B065UAlEO99ubvVV/3NI9VlJBPZsPiZgKHQl3uPG3U7aIcwUDWHq1M3agcreqp1Wc07//96eLCrnNpc07FFlYpPtrEu7OzXyYYlBkNdZ/nCdNMsowdHLO6sJL0qhSmd/U/dOmo+j+VdQKAQ+TXBTD5qbdTsjStJv8LH8v2Yxcyr3NAoSvxrOJF3mhFEYalnOeBp52NG9ZtexfnZkNDs3/Zk1GjJekAjoAMDdW5JfRbldwVW5R62KJrGM9X3iOcWilhZv29Mc1Rp1/GVP85pQR7jgIayWQPoVfPpGrw/Dzl3kgrSfDEk7SoiphVIOZ2c4Vd9ZqZL8vt2EixnqXM5PIjpoA2dWTcTmvYrqSrm+ya/XTiQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a27de17d-50fa-44ca-a03d-08dc71fc52af X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:51.5471 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 18/71] avcodec/mpegvideo: Don't reset coded_block unnecessarily 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: nQrNbEX7yUOK coded_block is only used for I-frames, so it is unnecessary to reset it in ff_clean_intra_table_entries() (which cleans certain tables for a non-intra MB). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 74be22346d..ca6e637920 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -808,7 +808,7 @@ void ff_mpv_common_end(MpegEncContext *s) /** - * Clean dc, ac, coded_block for the current non-intra MB. + * Clean dc, ac for the current non-intra MB. */ void ff_clean_intra_table_entries(MpegEncContext *s) { @@ -822,12 +822,6 @@ void ff_clean_intra_table_entries(MpegEncContext *s) /* ac pred */ memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t)); memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t)); - if (s->msmpeg4_version>=3) { - s->coded_block[xy ] = - s->coded_block[xy + 1 ] = - s->coded_block[xy + wrap] = - s->coded_block[xy + 1 + wrap] = 0; - } /* chroma */ wrap = s->mb_stride; xy = s->mb_x + s->mb_y * wrap; From patchwork Sat May 11 20:50:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48747 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298494pzb; Sat, 11 May 2024 13:54:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXeWGBgwQ4/BBCQicnqV39iVjgZ0QQY22tlCJUIATUauDCH8KJuYtarOdc/sZDoShL2EWDZwRk5GrUnc7Kr/VQdsPNOq6ltx1LVjQ== X-Google-Smtp-Source: AGHT+IHBR60mHQQIntz2h/gPWXpPxDOHVbp50LgSD+kSlEDRAMZ+ui50csiSIl2AhyTn671vhwtm X-Received: by 2002:ac2:58c5:0:b0:520:7a44:3f30 with SMTP id 2adb3069b0e04-5220fb6ab92mr3927468e87.16.1715460875458; Sat, 11 May 2024 13:54:35 -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 4fb4d7f45d1cf-574b4aaccf4si705626a12.72.2024.05.11.13.54.35; Sat, 11 May 2024 13:54:35 -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=fD7QQkNP; 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 2745068D63F; Sat, 11 May 2024 23:52:59 +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-am6eur05olkn2014.outbound.protection.outlook.com [40.92.91.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E2C868D63F for ; Sat, 11 May 2024 23:52:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUseIvN6UhQ/M/pNYHKgZpkgAkSaSaEHE13yG9xJKsKvOX93Edn26dhXGJCbtKN0O9vTPQVlAw8tPegkHQRIYa8cv1GiAShTN/qju6RIBXVE7GzXvzdt2Wdbk4A9yE92eN46h9js9We6BdBtk6899gtONuMkSCY8qm3WNAJk2EK44LlXrX7KmFzc4H/KkqKtwU8x3iJSa7t3Do8OuXzrK3risi5/9IrNcNdPUH4oJo6RA3WwDvvuop3sHWYGy1Al3jiswimKOtFgBO+8O/wqPTehUbv2V/yC4zWbJaLylvpKrDp8+psFw5KiihLx2JsrmrJc5ikSG71FpFH05cmBkA== 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=6Q7M1C+gxsPSSJSmaJVJp0GUpHgljhRQ/7UmSh0yFoc=; b=Dk8zYIAbar/5yZziw51khpKV8aKB7FjSW/SWqLBbwAXLrZ8jlfCwPIoOjqBeduULC5HxwhU4h6DVbMld8h9wKMhpewV3gWf+ULh5f2Zc351D701z66tlWcB7uAFnNdBat0KSP+D9AhgMM97LUo8iotateH5teJmvVs4yQ12x0hdnj+S0k9t1eERQREdnlMopdfqF3B0rjvyjLenpmwLqaQCqtwy7V+NdL13ALPtOAnVgMzpLKO8O1yBoT81zdY9eR/VkYCrQ/ztDZ5yuXgna4BHtXbxClPwqQVxOt/pAQKBzEuhcm7kpsviDKjAalNok5ehQUnByn/33LZpcXh38oQ== 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=6Q7M1C+gxsPSSJSmaJVJp0GUpHgljhRQ/7UmSh0yFoc=; b=fD7QQkNPUAaQqjkM6bX5PJj7JHmTpl3g5kqMk+s3jd7wB5nye95lGbJ120uWHTBsCt9mE4cFwLDyFihejk6UWoCal364sMnROuZ2XXeEop2do296CkgiGIaWnan6RasAlc0lkxvevjTw3YjFgFdATBzd0efw7XKhJM8N4CQVfwCRMe5rMTQK7V9IIaFvxOq04KgVDb2gPK/YFIfxk8QA+y5GjI5uTPdORsBk9xy8qrkTzqZTezLYdMBlE+maQ4PQNfdYzXzxIpEIfIrbEQslEX1lVBLuSDm1ZExNQDxickSY1Qk+BsovA6BBq4jf5EEsEz80fcXarw0Y6kZFznzihA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:52:55 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:43 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [qR1rdJ+y0N+DhATfLJjwfTc0tLWQz2Q++oYJkQo3EDs=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-18-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: a008aca1-048d-4dcb-eb28-08dc71fc54c5 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: f6uQ/sLvSGdnsd+Zj9X5798YIEa5gNIWzh0Ycu4bTEH7C8txSIbIprFxM9u4FM1PZioNsy+BruQPf315e1YUxRT1QWSJbeTnIsQBbYfJrAVfo9kI/D6qJ1Jp1c5Clnqa+2JZW1uIMa8k1oMWCJHMGiywQz9uh3sGdguT/jL3/7O/BSIBlWgwkRqtHXfigLMx122FmK+zQ0gqfGaekVw7EaObYeKY7mJ4leV87nJ/qTJUl8TFfyXwruJqGBB7jWUCkRQ51GQC0JhBou+JoGiNTh/lTRMQgFuO79jXXrYVTWrz8ZNw51N9fcf+OKTSblWIHGTX+Uj91VwZK+fiksJAZse6e9LQiywtbC20zND+9Yi1Ac6EOCDOpDjK2IDbeL8zCiSGD5aDVTumyI8C/3SwMi0V1ToXWT1NcfHynkGIOxZnskjxnK1m/nGPgGQXLnfxHQbYilq+oOftNNasJkN+MvuxV7o/IXWgUEGjkMdy10uPoxfbZ0Hn9X+qyJJOZNWn9QnokN/BRiIeVRzSP4skYLusACVciWQe30iPjdyoV7lEUS4xepYkYnQobf+M2juCwGNCclCOrek2EnnvXwy/tiDjTONcLAJHz/0IUFukU1dCyw+AMLL1BvbgmhjsQhc2 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kympu+7KL0KK0qqsNVTBPd65oCXtL1jGZdXFIgCVZhbT/l9J8ph0MS4lIwn1cP4XwdAUSQFVK1F9bmpOVuOf0FlIn08B3pqGAzZmk817K7rTnMREozLDwuXI28kwN3oooVZSVDU+iCuDWsXuBP+J5uMHRZmjbSbDYeTPK6jxF8QvZRucZocx8VqYSc0qsTEgK6nmzKcyiurhjgj+huYjydL9B2MVOzpPCOH33cjrV/nav3dIp4Od7veSf9Suno6W9Sz791hBmRBvctqkZzyxOA5g1mVgH77BvrxNrZeUfuIHPUYltku7+6DD+19K8iSc1LoXLXe0pIHHF4xfP+7Pl4LkoDnKHaOsM9Zva2fqNfpQx29Eh/fVCaLH7kOjXe6TChPmrBXXH3nauOy9tMKf7LS9KGDmE+p4LIUDkbfggp1A9zD3WRJuWiZ7YtAurH4qg8PxPEIXV4tepX4695695zWKWgxabgfclqPA6G0MHgb+vI3RyjKuHJdVPMhbV+M2Xopy38ysCi4OBS/qBdCosMgjxwMdL950LUfziCped1vU/Zt3Gz9I/zo3k0sPyhYL0iNWopJtoelvxEINyee2G1nn/XYaZI8YIaKPeY1tF8A6yqpFZf42bj6WWaRoKINyMxt8/jyVq54q4YJMM6Bp1/rElG4SEtVZtjF7Du4h+7cd372T/vM4JROFMCA3YrNR0dwXZdnmPIGFN1XJI03KhCnJkVxfXNOjXaOSAoFh+0nF4x3DdDBcEAZI/cdFPFM18ICay4Qq3ZHx5RwohCVziAiyM4dWj6mCTpkQ+oU5zosp1A+wLu2eiJcyFde3uEpvNNAbDuo4TYIeNvKGQUNOA/NQf5p3pbHp6E/Xum8fMVeQ+wOze6uR6JFNwLTpbr1+RUok+gtufZND3OqwpmQdv6c4lDCQf6RfbHh4FXKCltBl17JtwVgMt0NFiyy51aS0rQC0mT8OnGg/Mk5cTm0QuKdaomFDFmvTK44XMKVVD67xJUXMinOC6QoGlxNR/kXh0ZK7EXg7tBrYAbxDidNbRHNoKOfgBvWHuRYJdyAKoLUjdYpIkHFOkbyQtnNp7DlYTPZbTCfllFqajojwlvGE0LSS7RGhCCiq4bTKnO9qwcxHu0WZi6b4Hn6VSxh89+9zHn6L3D+92zFTe3RsOkQVcCO40iUUy5AazSq0A++aKUDnjmtTA9Gf3sAVtr/bs5ddLtUOPp0lO5ntMiZfjinHKpOyWhzxGoLp+58MjQoPEtKlpdNJXKnqgD3iJt5Twe10JEcHcQz/LMCCuYmLB7wT+w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a008aca1-048d-4dcb-eb28-08dc71fc54c5 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:55.0547 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 19/71] avcodec/mpegvideo: Only allocate cbp_table, pred_dir_table when needed 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: n0DixLuI0lBP Namely for the MPEG-4 decoder. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index ca6e637920..2ef69a5224 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -593,13 +593,12 @@ int ff_mpv_init_context_frame(MpegEncContext *s) tmp += mv_table_size; } } - } - - if (s->out_format == FMT_H263) { - /* cbp, ac_pred, pred_dir */ - if (!(s->cbp_table = av_mallocz(mb_array_size)) || - !(s->pred_dir_table = av_mallocz(mb_array_size))) - return AVERROR(ENOMEM); + if (s->codec_id == AV_CODEC_ID_MPEG4 && !s->encoding) { + /* cbp, pred_dir */ + if (!(s->cbp_table = av_mallocz(mb_array_size)) || + !(s->pred_dir_table = av_mallocz(mb_array_size))) + return AVERROR(ENOMEM); + } } if (s->msmpeg4_version >= 3) { From patchwork Sat May 11 20:50:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48748 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298514pzb; Sat, 11 May 2024 13:54:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXRfO4ud6/l3vOJkrDK+sbj+224FUt9UT0zrwy+cqKaE0jPqYSzTSXzhY5s7go7HG/tRBIjJXgrDW+UWylssJE8rmPY3Ngek2NPsw== X-Google-Smtp-Source: AGHT+IGGyfLKAdWo+064a+yU0k8RuZVSJm642FOv9gKCs2nXKDpQDKt1I3koiy46AECZAvM+eL/e X-Received: by 2002:a17:906:7c57:b0:a59:c3a5:4df6 with SMTP id a640c23a62f3a-a5a2d57acdfmr338546066b.29.1715460883416; Sat, 11 May 2024 13:54:43 -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 a640c23a62f3a-a5a17be6587si326325066b.728.2024.05.11.13.54.43; Sat, 11 May 2024 13:54:43 -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="kH3ua/GA"; 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 6BF6D68D652; Sat, 11 May 2024 23:53:00 +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-am6eur05olkn2082.outbound.protection.outlook.com [40.92.91.82]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D766968D63F for ; Sat, 11 May 2024 23:52:58 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7u5z0m7CykXCPSFfO1k/Nldj7lyiUpUBQV/dTywWe/AGQj8nxoYcGABk+VsJcHiaP6jPEwug6AiJLiFgZW9UwMtiBZ8Cg+MXFr5LH29yQaa8tkk5kW8Hzxm71FF5PxZGiwvuFKtkR6n0iclhZur1RVwJGzZXdWlD3oN4kzUUey8cJZECfCPu5rMWj51KeXoaJPoTlQ4eqzzbCndqRAhw+7T5TcGbJ8dA8ITsX3JQjm0RJMBl0IfBGeb0lSlVR4PSOAGTcqbzMuo0i3zFqItt/E5JWdQlWMOsxRmeMHa4Q6qu9ECghoclIWJzWlsj1/XUJHXu2gWvhMlwW8lPmekGw== 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=D+UIDoJ9BvO2/c+o4pge01AbzxMKD78JlYu61qLtFKk=; b=AYzXbEQPieKoAO+BpvGWbeY7oyRR5tVr5A0iCyS6CFFm7ZV/VVXtzjObZvLKU+mv97HwrkYzImYcofdS+FH2Qt0mcF7q0J3Z29rdNKhyPAp98UyuJYfVJ/U6f4qusRaIdFvUML0bX8RNmUgmnNJux/Sz25NzK9+7LSzU0DWSuILFkSQuwwHszox7OoZoPL+vYokgVYB8QtGOyErN1hsd0wty2XPJXhqRzUvFfux1gAMf1adUAmLzHOUX+GNANS7EbNxojBNjwZ13djS4N6nKBgQ33jfEtqEMos30QbICebB2vqcHB3CvwQlp700LHkCEoeeB67JfSIWCpTW+EntW0g== 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=D+UIDoJ9BvO2/c+o4pge01AbzxMKD78JlYu61qLtFKk=; b=kH3ua/GAsZXNJC99baxgSpCXoje3KGXVYNGHsqyV24HAFJVTrDTAc6JHa1xCDNzqRynd75MqrKVvbBvx4HrIo6wewvoDpe7jvSdAHF+vabuvdMO+Re0JFVJ2uWzoJyGjycm4yBNvzZY4/Zn8wzGuyVnLhmGyKCxc3yzX7ZrG+93DiwbZMLnt/aBmcR3QDybHx3ug934DBbbTlR5ChcMf2PfYBPDKKrpnYtHa7V4l3/pBUHiSjJYRMXH3BCbZrdrHVto8BvCwJQuktrnY/6YfOS+193TFro2LzWadi/BwWLRkS/PYvXDuIw6QchHYhDkxO0/aJIHJ/TJB5nwHSl8Ghw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:52:57 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:57 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:44 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [yHveLUI+4fAQp0TuRWiKvyZHl4N0qw4oD7nENF0znKw=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-19-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 00053a92-29c0-4310-da79-08dc71fc5610 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: GLEOa7G6gEakecsfSlVqyRyHmzgkw72sp9vctwnx/XedQbLhkgHEioqdW5F65ub2rQfQ05IsKGtGj50nSQoO5504WENKgGHsvkVuPxKWKnuLb9WXmqCnTE5VC72VKlcXunOzr6rPdy+5ZrJtBc/w9sKOJEEkAFyUUOBNsQcnx+ru7Naz8vF+6UHnBKjnxqx2FnVzv/VaZVq3XCBvV/0H5Y8/Bj2hTLs91mBDQN1nzR1VbLdCRIRuY0zk7AYVgekE2ru+yBgkVikWLIoNIK1l1RT9j18pXNKe53aGpW9io49RBVLI+wO4Y1JxN2f7FQwgskpBhsGKryzjEF4KoS050EQbLY14JAsr/DS3fafrKrlvRkCol+fkRSdWBGUnxhsDQ4gqN6UCE7PlHR6PoTp4YyM5nK63Y/yHSbUJC9HszaW1XOtNLw7fmoYk13EC/LIx5pkHNuP4MQGs5rRBHRY1JRJbFV9bIom/ahLMHNa+BfYZXfCQz+2alBILdXAG3IRdlW/bCB8sRIymEsO3VCv1uxt8ZNeBvLaFhbzI1OOthQi16HQJ1vwt8Lvf3xahIRDCrKbv96M9UFRjTy0fpPfdigSbIVrZKyYAZz6gR4ZEZe2w4SS6lj1d3hdwpo71Ealo X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CsCl8OIF06uiXhtxP37zZ60KICePnlvPyBaWtzRzRnMGwqVk6/T0wFkv1hPXP5pBKhb6gbfP19pxI8jRIxTzpvFa63dVdCFbU6Q3mHEYMxqslN5QXunQhWbsbhJ3OAyI/VUbMlP1q9F0DIN/2VNseVDLnNbUgOyKo/+R2HQLL1E8rHXX8+NqxB3cDVbqZ8pHgxeRuhITFC6NqyDQApr22Mwy7KKJkigqRlXooNj2TuQW9ke3iatO9vcNbTJpADb1hdpg5uO9nHDaaAlaFK77nHUII2Ogo3naoHe3sOVsuvrc8pHr+EZIDli/Taqq4erC2jDuqHkvZC1NW4jogr8XAuiq10cEYQUlalK8jw61pBtqE1anezfnuxfDqMcok+aRvAc2jvn09peZdUlyZ0C+5zrjWly8ojasleGEiyprw371Hw4LFmN3F5JFL9nR/RBfbmuqk/3N9vCU4HwiEvpiVKIyeELX9CgIMCHURL75v6yJar8Btyw57Dpb82o1Rr+8lCiHvb6Nj41kg3eyaeYzLLvUOUjl6/w8pIVyDxP6J528OcEAelqDnUs4pSNS7+gLuOb3bMjMdiXP7PX+TPjhgIyhgMRsoZ4affeZlOaHiDZ4vxprAA3yRZvoR418WZqkusocRo3ttYEuXpe2tpZy852+Wb7qbOdigX2ODqheBoqtDtde1+CI/o6l+puEBXLJZLVtbCZem9YD85VvwmYj8bK2ubTAbBo6Q4lI7be7BEv/HyJDWVenI0TgR9uVY4zMsNVRR16CB5+tGBhY+X0vCNn3LEBuzSgVd/DDNQAlMJ6bs9eUqDv8J7WjXyzDq0+6qNXPB61GXqs8AaleIcAXVTIHSC+3axdgNt/erPqiWchzEiFXL41y5OmlIIxUUyGMLlM7USTOVb2JQr4JGDJUwHDLeLa9YyOAFAd24BzwylDjQ1mpD2RiWH6aUDrqGPt99X4QXr1bR/vWkliyqhBTgWEZr03xiEx+c5wNxKpnBv9h9KdZNeYV5sezXa0D84wD8S1dEFKRO+RNOjgT+qOC8wMZnS5kNeMtdxCAYr+LQKtJnY5Fd+gDOk+9yTS7f4gXDv/t04EAwinwpkOdYQXtzT6WL5lqDjSPAJ8AUdzS02eetXSmugaP3/tQD/yWosUKZic9jYDMt/3LD07w+WMWSXkmXDx2P6auwHwlU/ZWWs7yjrKZtmkOgW/KmP9PYDyrEbD+CsgXZvhS6qQDd/IXGquohFDyt0I/IdqWhtGRafRL4ofoBceu/vKGsf/2ikYX5KBKbsoYtoVZtZCzXc4xww== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00053a92-29c0-4310-da79-08dc71fc5610 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:57.2001 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 20/71] avcodec/mpegpicture: Always reset motion val 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: J1vrRtrzDo6Z Codecs call ff_find_unused_picture() to get the index of an unused picture; said picture may have buffers left from using it previously (these buffers are intentionally not unreferenced so that it might be possible to reuse them; this is mpegvideo's version of a bufferpool). They should not make any assumptions about which picture they get. Yet somehow this is not true when decoding OBMC: Returning random empty pictures (instead of the first one) leads to nondeterministic results; similarly, explicitly rezeroing the buffer before handing it over to the codec changes the outcome of the h263-obmc tests, but it makes it independent of the returned pictures. Therefore this commit does so. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 88b4d5dec1..06c82880a8 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -245,6 +245,10 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, for (i = 0; i < 2; i++) { pic->motion_val[i] = (int16_t (*)[2])pic->motion_val_buf[i]->data + 4; pic->ref_index[i] = pic->ref_index_buf[i]->data; + /* FIXME: The output of H.263 with OBMC depends upon + * the earlier content of the buffer; therefore we + * reset it here. */ + memset(pic->motion_val_buf[i]->data, 0, pic->motion_val_buf[i]->size); } } From patchwork Sat May 11 20:50:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48791 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp301529pzb; Sat, 11 May 2024 14:04:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsFh5W+W4/OwWAcpNP8i1Lo/0ZsoV3bueXx77FjoG8C6xhUtW1ufCezU1eHCM5mk+pN0T62tjIxT8LC9KVi3j7qaky8Kvj1DSDgw== X-Google-Smtp-Source: AGHT+IHJK0sB+m3XrQBMd8B2baem+BrxAcSDE1oudkCZvGl5FdK4v4naUsrSnC6X2ZKeFbijpBco X-Received: by 2002:a05:6512:398a:b0:519:2a88:add6 with SMTP id 2adb3069b0e04-5220fe7999amr4579590e87.55.1715461472536; Sat, 11 May 2024 14:04:32 -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 4fb4d7f45d1cf-5733bec05fesi3298172a12.147.2024.05.11.14.04.32; Sat, 11 May 2024 14:04:32 -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=rfPXg34X; 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 BDEBE68D669; Sat, 11 May 2024 23:53:05 +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-am6eur05olkn2013.outbound.protection.outlook.com [40.92.91.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D834068D664 for ; Sat, 11 May 2024 23:53:03 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NySJ8bxozEEhzqca2JaNr/R0Sq9LHnXA4HBYQQVQi7Huz1Obu7NdnRFgAy3tyuJaFhk6Do8eV6HEc8pgtvziWNuWKCMFNp33aD0bTjiYeLz9By+0sTASO+vyB3/2Fel7Ep5dIKn6xUMa0LlqrCpYltN0Cf4/pBbZz0oSgjmwh7WowhLzIxV96Lzu5GMVpXGzdlSzZqtldP515MPd5LGYYzoR5pOjV/znipCTAr2bh9UO20Xt6o+XwiydQ55gkjmpcP7U8Nv/iQvn/ere5n2ZQ8P44M+xvQW5VVWcMQvRLEc0pPd3KPkjgxWXY6X1bIHJ2xGmz01XheQfwKDctbKiOw== 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=T5lxUYwyxo3HncNBZeBFZGtB51ROocELdc0fOoRbLgE=; b=AE1tL5jmIoLcOIhdcWcJccgZMo8i7byMB1743tPHL4GOTkNBKICcTYgoCsMcnu1HZeTrP8iihK1MqT18I+hkZm3UnOzvdKOPVeiiZ16TrBc4gqpYGWdhiNof2q+t9L+e+esfp73ngB/z9hDFcAlEgv9YTqhblP8dN/ImxjQe9sQKQa8R/tKMkIeObjW83xmlEV39KvYOX0m3EcDt+q04A8+A9tlF3fDrpBpgedBWtp9jBOCWIYPcTZHRfGQ428+0qOgVipTJY5g/1pS3aM3PM0T1SCbLtVvnLo6+wuVDFYMom52b+/LilJKN1sNdjBPbmOUXqe9JvN0vuvS+Cw6pOA== 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=T5lxUYwyxo3HncNBZeBFZGtB51ROocELdc0fOoRbLgE=; b=rfPXg34X+WW+YgSNwwTR0DDbEHWLMzy050htLrdHpo4/m3HOtLu7ZkKzrKDzqU6vXLT7vs5fvs+sLY+ekEqaYZNLGI0Y958k0Lu6+vfcSz/X/bYCMfRmaajoGcHGZRBrvEgozGunzT2ZFr8v4SkGJTzSr3RPP41bLUTxvelk6/4AIRnP8VV8xbr6hbVsYs1g11EiHlZX/mnl0S9+ldloQz1anFcIUzPAOzIjX9YBu8X/O7nb1zhQ560syquk3XXnHKbWthqctbzFiN0YKbFaSqwCPQMfvM91sGsumkuGkKO+OHoD33xJsMZt0yQjUoM8yTR2oBqwGszxjrHELOD/0A== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:02 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:02 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:45 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [9VK6nfTD+V3kWDib1JTMBHUJyyiOPtJHHp8PgIY9OTM=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-20-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 5aa822b6-9e13-4170-09db-08dc71fc590a X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: VCJHl8uncczS4/4I7uWRdv6UVRoI5sOxoEtzhNSIgK8r4hxdpyYUcg2QWfudvK1pF9eW2kaUNiSh93U7Nzu0dnIg7OblEhVZdbi44D55NiZGT9h27B6CIE3YYhD9/wRq0XXjIaLFyG8j70eYz2uwRuW9OfzFjdKthLZRDEoemhNWqLhE/tcF5I4WQQjf1sw+GPUz4ghRyhTVviHSMRK1PZOTdDFduBRpbf0add8ugT7OqchOLZPPKDRAgMlIOVJ6Oq4j+Jzeur0vnhleHVwEkC/mzIhtNidR3W2awFb12B/vMfh7CYjSlSEkCGnBSrzqCDMTrYfmdUaPvt9N+W3wCMJWCfjKOLTYjmum/gIexpuYzkxhcFbIjRPMs+OdtHdfmEnKXt+xJeI+v2xxsz+WEYDyOd9xaLG0/iCduZ4TJBcmNFPjsmY20AHNZg8mXdJFyTWtUY91TuYFCouvMAtvLwwzBqpJxNBxfiJqHmjO7/zMJYebBzqDjSWfl09jW5Ni2carPV43A/nr62xxpUHq0ty33F789kzciqqVSkOhElNS6MVlrIGMSm2mPs/6b7h9N+eu8PXYm3OX3ouE5INdwsKDwc8ze1yAPsDJ1fSra8XyK7EdhbErdHz5crhm2e2R X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4oI4tuV8ZkA7yhkXJTCis7Z4n1hRRgcUTe+hiieJ7OGjWIY8PtW6f/8An2gL7a/2mn9R8dv6+42mzX+c3IY0lyc3yMCRTQMasYj04xPoOvnuCHHHlaHbQdVtViCK74ShCBgvjTXTjcZrTHmmUKKByupo4zoVyuJqrxaitcE7Zu9vLvIh/wWAYIXfagU4gbUci+/KBQ+DZBmleswCBjKZjo5FyWP58PKrGgVVLVm4aIM5fRxqtPBqAkDmSjY+PdVy/ZFvFQ1m62Vy3coF2NEkefJ/6r8crOIpPgdVW3Kp+I4cRNmQc+NxpzJjAipZ4xOBEc3JgeM1IqERiIs76WH6BPIcDsSv/2kSEcCNCHioLf3KBittnwv3u9THTukeY9JY5T5UDX3wAqCUHu4sAHxo5LH3fCQcUNGxxYjK1bGz48llhSVKe9swfJXCWgotQWunP4IBT0CB0saipMZ1oBsLSPPtCINboSV3lRntyMeYB6nK33IB4Rnq87L5W76WRFiciB9skkasGH4QcLey5PZCnyof0Z/08xgjypka8104TQz2Z1GqQh3Sa7ncQwo084WFyzUUP0sejlBjG5VnXR6iFRQuMdbzb/D2NcDc4y+XB+zNLZ3pkn1I4dPy0K7+oQqPCmsWji5Wg6nbT+ZZRC/djP1zN9jbFXkF98auj3C9UuFoCvWiD7Pw2ozPXXjcz+KCD13/bbXfu662xUCIKDIGMPnP+1tahSWHrMtantBH/9lKgcnJF8ei2oI1RtGYTiaLJ9Q45K2I4KojZumYVbqP1Rnu8Od1fYGDAqKR2+N0D6YO3sAzeTqsJRtN5z6WBWBpgldswKZqEF8EsGeSHMFfs0vL4z+DbG8kwxYWYA/WeABkOpA65RZ3KGnqjjwlGjj0ODkxbQQfFGRphH+CSbR0D03XmowvDwft+V3Y/fhEVi4++/8Q9D+ZRcWDMxXaWkvJWvUmPrCvAAbA3Sf2CO7TEpXu2vKxtr+zEluqQud3ue+eteuduGSRpvXb/4LnifO1eCeI/eCC+Ni5HeDZukNUQOXtQO6gIJiAE2Gu9MwvmgnUrYrXLZ3XcGkqI8vG2SB9gotOgg84S3l4izmdYoludsGQ7qLgd3mIR9LJk1HMolMrqatY8bvlIdLqf0pxXtlQ5vX3iZnRvM/NZlgX1hXDsluzPOe3a7C1KX86ZSBvtcrOHBzMSa4n/1xhI2EDlcntteUV578nDlwsyD7NtmpL5EpAVLBZNVBcLzD1kdDySdA9MFBcDmAyKyb9XLZBWk3M9Z+QKYt6qhJt5mwgQvyXFQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5aa822b6-9e13-4170-09db-08dc71fc590a X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:02.1980 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 21/71] avcodec/mpegpicture: Always reset mbskip_table 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: ywv9oTmb2Ncy Codecs call ff_find_unused_picture() to get the index of an unused picture; said picture may have buffers left from using it previously (these buffers are intentionally not unreferenced so that it might be possible to reuse them; they are only reused when they are writable, otherwise they are replaced by new, zeroed buffers). They should not make any assumptions about which picture they get. Yet this is not true for mbskip_table and damaged bitstreams. When one returns old unused slots randomly, the output becomes nondeterministic. This can't happen now (see below), but it will be possible once mpegpicture uses proper pools for the picture tables. The following discussion uses the sample created via ffmpeg -bitexact -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -ps 50 -bf 2 -bitexact -an -qscale 5 -ss 40 -error_rate 4 -threads 1 out.avi When decoding this with one thread, the slots are as follows: Cur 0 (type I), last -1, Next -1; cur refcount -1, not reusing buffers Cur 1 (type P), last -1, Next 0; cur refcount -1, not reusing buffers Cur 2 (type B), last 0, Next 1; cur refcount -1, not reusing buffers Cur 2 (type B), last 0, Next 1; cur refcount 2, not reusing buffers Cur 0 (type P), last 0, Next 1; cur refcount 2, not reusing buffers Cur 2 (type B), last 1, Next 0; cur refcount 1, reusing buffers Cur 2 (type B), last 1, Next 0; cur refcount 2, not reusing buffers Cur 1 (type P), last 1, Next 0; cur refcount 2, not reusing buffers Cur 2 (type B), last 0, Next 1; cur refcount 1, reusing buffers Cur 2 (type B), last 0, Next 1; cur refcount 2, not reusing buffers Cur 0 (type I), last 0, Next 1; cur refcount 2, not reusing buffers Cur 2 (type B), last 1, Next 0; cur refcount 1, reusing buffers Cur 2 (type B), last 1, Next 0; cur refcount 2, not reusing buffers Cur 1 (type P), last 1, Next 0; cur refcount 2, not reusing buffers After the slots have been filled initially, the buffers are only reused for the first B-frame in a B-frame chain: a) When the new picture is an I or a P frame, the slot of the backward reference is cleared and reused for the new frame (as has been said, "cleared" does not mean that the auxiliary buffers have been unreferenced). Given that not only the slot in the picture array, but also MpegEncContext.last_picture contain references to these auxiliary buffers, they are not writable and are therefore not reused, but replaced by new, zero-allocated buffers. b) When the new picture is the first B-frame in a B-frame chain, the two reference slots are kept as-is and one gets a slot that does not share its auxiliary buffers with any of MpegEncContext. current_picture, last_picture, next_picture. The buffers are therefore writable and are reused. c) When the new picture is a B-frame that is not the first frame in a B-frame chain, ff_mpv_frame_start() reuses the slot occupied by the preceding B-frame. Said slot shares its auxilary buffers with MpegEncContext.current_picture, so that they are not considered writable and are therefore not reused. When using frame-threading, the slots are made to match the one from the last thread, so that the above analysis is mostly the same with one exception: Other threads may also have references to these buffers, so that initial B-frames of a B-frame chain need no longer have writable/reusable buffers. In particular, all I and P-frames always use new, zeroed buffers. Because only the mbskip_tables of I- and P-frames are ever used, it follows that there is currently no problem with using stale values for them at all. Yet as the analysis shows this is very fragile: 1. MpegEncContext.(current|last|next)_picture need not have references of their own, but they have them and this influences the writability decision. 2. It would not work if the slots were returned in a truely random fashion or if there were a proper pool used. Therefore this commit always resets said buffer. This is in preparation for actually adding such a pool (where the checksums for said sample would otherwise be depending on the number of threads used for decoding). Future commits will restrict this to only the codecs for which it is necessary (namely the MPEG-4 decoder). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 06c82880a8..a1404c1d09 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -238,6 +238,7 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, goto fail; pic->mbskip_table = pic->mbskip_table_buf->data; + memset(pic->mbskip_table, 0, pic->mbskip_table_buf->size); pic->qscale_table = pic->qscale_table_buf->data + 2 * mb_stride + 1; pic->mb_type = (uint32_t*)pic->mb_type_buf->data + 2 * mb_stride + 1; From patchwork Sat May 11 20:50:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48749 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298597pzb; Sat, 11 May 2024 13:55:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXcZkYDw0BfGUs7Qj6hBJON0S6xSm+i9ozrONq3cC09V5kfoWpYVT6iA1tJDJeIi1U99weScSnGg29kX7Ex2hdJOm4UFqaUiHXqag== X-Google-Smtp-Source: AGHT+IFeiq0s+Pgt97+jcW6eL4a8idkQuSY8mRWsRP+V5RRuFZ/xph3oW1plUT/ORKKY+G1Uxoaz X-Received: by 2002:a05:6512:3d0c:b0:51f:3cb3:48a4 with SMTP id 2adb3069b0e04-5220fa71dd1mr5370767e87.1.1715460903026; Sat, 11 May 2024 13:55:03 -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 a640c23a62f3a-a5a1797cb34si346014366b.236.2024.05.11.13.55.02; Sat, 11 May 2024 13:55:02 -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=F6dbrrfA; 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 E4E1668D574; Sat, 11 May 2024 23:53:08 +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-am6eur05olkn2018.outbound.protection.outlook.com [40.92.91.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA5AD68D5A6 for ; Sat, 11 May 2024 23:53:07 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=faMIYokv1mcEZKA1nuzkZemvJNVQvhB1RVXawE6Uwb0Cgc2vA+FAAHyf4WzE7wBocwhv3JdDgWhQ5mIG68zltuJ3GlmH6ScSMq+pfydBM9V/KSxI+NQqlFpU2IXpR/UggfBOxNOwQ6sg9YXikxonxzMiFrw8yIsN6+91eRU48DEzceFIGumuees+VFgtaDhkw0GRzph2MsxhVRpBQ0vlYNeUu4jv8okCs2T8ahelQeZItGfEs3sEQi6OsgmnjAKn1vglS9ahbebAVMurTWsFU0h1VPZqtjGDX3FY7go2E+EHZSmXKQnd1nXEYO8iRc4I0X1liDG95Ix2KoOuMxyBAA== 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=7ubgCtFPHi/YnoOYncv5i8X87fV+WAHP1A99BilG7nY=; b=l2QJdrI/PgkU/oC8yWUbmSrLoJheZFwnnN7QhT+cilAflZutWuvfVzIcNwjvlzS9ovUlx7/iqwMtUWqarkM+QRDg2bEmTqTPL52hihHnlnoxXZ0Ivutqks9e+w0f+o9Q87uRQw/J1Iyc0Eoxemj+ay7cIt+YtJkNYH3Ym82cw7l/FTF3E6li+S1uSZ7QW9wRw80sFw3Sa5YtkOMx3iGwEVQ8aLnYWQKc8Nwd7r7auG9+XLyKvJK3M10gOOppkIa8BwgTPn00efwuBPNeWgrkUCPzkzbhkYNnjhVyYM7cjqqEoA0/PSR/600VOvbA2kU+asDZJmY72l6IdFvGhdV+zA== 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=7ubgCtFPHi/YnoOYncv5i8X87fV+WAHP1A99BilG7nY=; b=F6dbrrfAAiYzkwIkk6XkseS+BbqFCiF+d0BAm7egcsQpNQ85CrAgrRx4zuyQYaqXGS7dC8CLSHV9hVJI4+p65wSIfPcpgbgs2A33YfQt2XpWoJPL1aTCkzRyXHYp1tkDP1Xro741hHG6590mWit+9R02KRBHQFDjG8VDS7AaVCr0wtwc64jUubf17B1RcnQWlHUe8IQ0lslwcYyMwasXm6mNc//AnKZ5O8d+jDzXrMrHoKn7RgFBohEksSC1KSPEx4eIr4GF+SSXbWDx+9lwpKCo/GN0lAUsrYniQjSnhWO1SVFKvpQwHSmWYOpfOse2v+8dhrmTJBpz61m60PIseQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:06 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:06 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:46 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [d+lwC7K7/z1UP45z4uU0bR15E3/XKAW110w9AssmBBA=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-21-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: fb57f462-b27a-4842-2b33-08dc71fc5b4c X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: RQYcOJscgeyOJZT0XtHpl8m14i+TE9pWLQhjl6cpNg+caGT8lg3s5POGtaFdAUXmE6ZvcAKlEfjWtCbr1Shb43qW0ZfMUPQLewg41A/UPJc8pbOSR66IvRCy+3d7kzJpL1CDwG9Rfax8D9yeTzNRAn7Cq4jFhQN9krBdo2fcn4wFwEpw10tJ0tbKFVdwgLkk2OpZXHq7NhntA6ZDxLub7ODbZLseuj7VKROb6OSjAYGGx1t0lcC7m5Rd/1xRxjmYsvfGZmH2daxxzZ6bR11mOckONSIbUxb1k05di/pmjq2zEHBtXlYA/RWkdRgYsYt1HyTWdAaSvbrTm6WmQ2kYlws31CVHuF7CbesXm40rAE5pvup3OclYDXmTnqbZArYsKgsIih8nP6AFwibAMYj+R7r72Tl21XoDVpAlQk5atV5JP2YPrWUvHumQs5SAyQG2FW0/Q83x3VJQ5JZjdpar8nGps/GE21OW9hwMBSh6eugw9rA6lNBBQTVXQKjnG96nZd1NO/XDI+JNe0sjm9rbRFROINUVumMrHi4lpLvxpsGM4oN0iuPZW4y/Nkx00b4CSeQVCmrcOBoc94ZthSCAY3LbwStxTTD1gwf7vZ6zTQZyX4i8+7VpA5IoC0YhaTC7 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qGidgieunMhKqWueG3d6B3RGy/yb/kARoSSmU1zISF0myR+FRjy6Yl+pcJ8YcW+lXva7H1vSp7B0tldNG98JmhVloFXzF8mmnj6RoPy7O/FNHEICvbGz+XXxugehQlvZotUM43M8q1KZmtD1Y3S+JTiW+PfGdigPmX5mOaNCLw6L4ZA1Po4sNJbwr3jkH7BO26Ga59mkw6ncUv+74pWVXbxSHaKYirWoZyoGwqIMv2oMXwwRk0HuCY2h54bVZLgYti1bhG31sTpGaMbQkh8PsywArqtKwPG0CGUw4cUyN5WwLElKzHE1w4t7aLd4vbXRva94LAluMDnnr/D5z+9tO5NHmLcdtBQ67tGQbSbBTuw2kq+b3joEx0jlw+daRkdCDTztbl0SCp32kUsmcOoTYf8/5VwBgkHLlcSBHqpmsij7LDg+6F8vAE5dzIkJxUd0MC1nuFrZ4xNDPElq374yGT/dZAQDt7escanNYz+IkrS38PAqYqRT/4ugqITaihkSZ2iaAX8AOD4V+ItkXxo9rTj9y5e2UUX3a4ATNgxBv8lrmWO2w4PQV4PJ9TnY40Na9p/42riosM9TIIu9hcNKXfjaP8Chb4bkGQcQTwYVLqAegKT7Zc4+ydSxcYNN1uDClPcJYUt+yY6y5tvlZRZzma6vI9XYNxxoyPfz97YAGRKlL3AAFGrBNng6pFlPiLOkIzyQK8lrUSgprv6P4ErtM5iItudbCB53UxKBCBGt70qUH0ddh16k6Ejgj3hjbB9dN0qpstLOZYdwkMSO9CPqd2w5lVCuc8SHWbhopmeKukwEJMDc+lGxcitDL8hSWKk9FDGmTfF6SfJe1ll8u1j5SkqTmh/aHKNvpl2R92qSfprtOiY/pm2px9KKlgpypSHCDeZUKoMyaZlZDlu6iJHJ4JmoeQyZmhM2QusVmGYHKdro15Qs3326P1sYeCrmBCyenK/3+3ZkJ7iBXI9a2FOJDI26vvMqbBQy1BjJO7MP8v4FAIEK5Xd7sFoh0d2FCUjG1s11IUx+cpTbjVYtxgRgmkVEjdFX54NojcKT6VN7M+i6g1c+qF+X0vgnhG7TvUJFUUuemPIB6ed5qaQUgeDihUHgiVhJvN5eYkiOLlxr2907gtruDaIdYEqhX1YMS8ykU1EX5FFvovlXuH9pofywt/NYjV1MYD+UIS0LiCLUH4rx6imyTHh3qALIGAk00yGxv9pqpXS4dQ3CVr7HDGH71AEdRUkWC4RUE9KExYrJSO0c10WvmwDFYv+pK9WwDtzg4G9rvpSF4ClmB0wo5xEhUQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb57f462-b27a-4842-2b33-08dc71fc5b4c X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:05.9500 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 22/71] avcodec/mpegvideo: Redo aligning mb_height for VC-1 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: OZnx5XVwRIMj VC-1 can switch from between being progressive and interlaced on a per-frame basis. In the latter case, the number of macroblocks is aligned to two (or equivalently, the height to 32); therefore certain buffers are allocated for the bigger mb_height (see 950fb8acb42f4dab9b1638721992991c0584dbf5 and 017e234c204f8ffb5f85a073231247881be1ac6f). This commit changes how this is done: Aligning these buffers is restricted to VC-1 and it is done directly by aligning mb_height (but not MpegEncContext.mb_height) instead of adding something in an ad-hoc manner. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 2ef69a5224..ce1edca95d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -364,14 +364,8 @@ av_cold void ff_mpv_idct_init(MpegEncContext *s) static int init_duplicate_context(MpegEncContext *s) { - int y_size = s->b8_stride * (2 * s->mb_height + 1); - int c_size = s->mb_stride * (s->mb_height + 1); - int yc_size = y_size + 2 * c_size; int i; - if (s->mb_height & 1) - yc_size += 2*s->b8_stride + 2*s->mb_stride; - if (s->encoding) { s->me.map = av_mallocz(2 * ME_MAP_SIZE * sizeof(*s->me.map)); if (!s->me.map) @@ -397,6 +391,11 @@ static int init_duplicate_context(MpegEncContext *s) } if (s->out_format == FMT_H263) { + int mb_height = s->msmpeg4_version == 6 /* VC-1 like */ ? + FFALIGN(s->mb_height, 2) : s->mb_height; + int y_size = s->b8_stride * (2 * mb_height + 1); + int c_size = s->mb_stride * (mb_height + 1); + int yc_size = y_size + 2 * c_size; /* ac values */ if (!FF_ALLOCZ_TYPED_ARRAY(s->ac_val_base, yc_size)) return AVERROR(ENOMEM); @@ -538,17 +537,24 @@ void ff_mpv_common_defaults(MpegEncContext *s) int ff_mpv_init_context_frame(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; + int mb_height; if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; + /* VC-1 can change from being progressive to interlaced on a per-frame + * basis. We therefore allocate certain buffers so big that they work + * in both instances. */ + mb_height = s->msmpeg4_version == 6 /* VC-1 like*/ ? + FFALIGN(s->mb_height, 2) : s->mb_height; + s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width * 2 + 1; - mb_array_size = s->mb_height * s->mb_stride; - mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; + mb_array_size = mb_height * s->mb_stride; + mv_table_size = (mb_height + 2) * s->mb_stride + 1; /* set default edge pos, will be overridden * in decode_header if needed */ @@ -564,13 +570,10 @@ int ff_mpv_init_context_frame(MpegEncContext *s) s->block_wrap[4] = s->block_wrap[5] = s->mb_stride; - y_size = s->b8_stride * (2 * s->mb_height + 1); - c_size = s->mb_stride * (s->mb_height + 1); + y_size = s->b8_stride * (2 * mb_height + 1); + c_size = s->mb_stride * (mb_height + 1); yc_size = y_size + 2 * c_size; - if (s->mb_height & 1) - yc_size += 2*s->b8_stride + 2*s->mb_stride; - if (!FF_ALLOCZ_TYPED_ARRAY(s->mb_index2xy, s->mb_num + 1)) return AVERROR(ENOMEM); for (y = 0; y < s->mb_height; y++) @@ -602,7 +605,7 @@ int ff_mpv_init_context_frame(MpegEncContext *s) } if (s->msmpeg4_version >= 3) { - s->coded_block_base = av_mallocz(y_size + (s->mb_height&1)*2*s->b8_stride); + s->coded_block_base = av_mallocz(y_size); if (!s->coded_block_base) return AVERROR(ENOMEM); s->coded_block = s->coded_block_base + s->b8_stride + 1; From patchwork Sat May 11 20:50:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48750 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298641pzb; Sat, 11 May 2024 13:55:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUmRiQuqS0K8P/atkASB01s2fA6NG9bW+PXD4kDcivCYDq4gTIi+eqRqoflyfyib9R0oYpkXohEGGVS91t65H7BF6u55qw+BItD2g== X-Google-Smtp-Source: AGHT+IG1tzk9IHWVUCRbqjCAtvFomY2S7+QcSS6PfDgPXwBe97zIKbdp4K9nJR7dlkC2bup2EC6u X-Received: by 2002:aa7:c992:0:b0:572:b0a8:65fd with SMTP id 4fb4d7f45d1cf-573326eddfemr6570366a12.6.1715460912744; Sat, 11 May 2024 13:55:12 -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 4fb4d7f45d1cf-5733c2d61d8si3354078a12.290.2024.05.11.13.55.12; Sat, 11 May 2024 13:55:12 -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=NfE5qOP1; 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 74CEA68D664; Sat, 11 May 2024 23:53:12 +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-am6eur05olkn2037.outbound.protection.outlook.com [40.92.91.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5109368D631 for ; Sat, 11 May 2024 23:53:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdBSiXefRFRhu7xBNvQA3FAFFdoSee2rwv1dS2F2fJ3ssTuBNqUURij6QhRMA5FnxFSuJlKZotRTpGz9NN3yjfniadH9n9dq21bV22UQDUeJ/mGcYoaP9Rlb5oivtP4TtVcat6htEwBRgMS3Gv5xn49zIF1d8649xK8Gq5spjA9yeBUWdBKB0MNzLCAlK+KhyrUsZ/EqndnJx/lPK7MU3WkZh71n54btrfTQrHzQxKOrqtgDT9SSIcQJ1w9w7dsrltw/WpqoXM+9uPCXWxmLzbK1zsNmZP3QG4Sz1l5/ed/uy5AOrtO0nRphshFwuAn+LDqGNUURxio27UshTfYhGQ== 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=5nLxZrMqDKCNpsNj3f8i1HCpab3bbhiOU071PKc6Djk=; b=U8IEyp9PpMolj4khN8E/8nw35No39dNBPpjbvYyyWBdX6HZDjbmArDAHA5XX6GldvPvfh5yy5VIv/E6/jRXqlvf2MVN3I7iNzQ6lpbFXX6QKyKfevbEcFFCK6OCl01ctwqIuSeOP1Sk3yHn6YKGVVJzh5515yCcSnpFgkYm3hmS4GXrXM3pXMzpbARxJprjN7bAvg/vHSzqMoiySxY7DlxbGHOdxBC5ijyo8fg09320X5wPBLWrK8Rvr4BsodyU9huMUNCp+5nXbyfwxnpWuhvjbKK1CfHNf9PaUfpll3qlCgtPXe+4zRZ9OGtytDgnUvzAOMLpiPaUlTDXk/z+1Nw== 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=5nLxZrMqDKCNpsNj3f8i1HCpab3bbhiOU071PKc6Djk=; b=NfE5qOP1DzBhXQkGTmFGWappYwlx7m4L7lWj/8Kf2asFTSK608kQIfFwa5OJQYf7KNOPvjTFI9epkS4hZBFngbTA1TbsqnQyZCccU2+8o28Sb/uHe+fD8P39FWZ+Zv61YCkrixAzIf+oruGUcEnQJ8AZRIuDCmQgKYG2i9zHfcFtm02Hfk5KTfwKmzRV18IssQ/b4BMw0Mmr9st9vfit7rAIIGOsibZC2S+ZIKq2kYt/HW+wm3avoa36QyRA9KOSL0JLkGU6248QS0OXAhKDDyZzkStKa/UJdrnVVFe9GKVlks4lcbk8rmBBVBSDrjO6N5brrKbW0PjdYAtrEQ9KOg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:08 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:47 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [8pqo9WJMWZvpfyskTDIPkhgfRVmOrIyIV6E2t84CRTk=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-22-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 81628667-3171-4f02-f33c-08dc71fc5cb6 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 1MZfiAH3v+4BHx4LlRcpDMFT0X9HcaSEqmHvBbpeP+9+UUONHn28UPL3quY3O1m6xCX3YDZZuSPPc1tWaEDfZ3OeN4cB1N5pNVZvIUqoWygYIa3Bsr4NJzdS+be0iAG6bhGHOeAAV+QXGgPVKGJRZKoib/fDlN358R8d9G6dTaZhzkRnN58tNbGXRwZYcLclqkbSF+bl1HJJfa6cDApc+ztXVdp6vEAl9yezGtHyEkWy5/Hj3W6whr9fY4bZ99MIaik825enMq8GSksmpu3E0MBpRHwoLTWUDCL/Q7OlA3A5je3IvlDHDJFMnx05Kk3yU2lKvWn/HNbYsr+/w2Pc4ZFLhX23VerbO+veT0bBD4pk53QRRzuDOsGud5++pfpnrQPlRIlGfW4vwGdJLBePqljqa+IJvNg2m1OSlKPOlASRsu+DM1ByC9TeokEtH4v63yZnzb85LoIsae7KrsOnpeL7oc/rsE5ayJOhiVCSXG0JHRuqeQPmayuuJd9DtaA47CtNePPBtrPHdDCZVEVHcI9R6S0I1SJzPbhEGqxIt4tSvGrvpNwcZzNF6RfNG2vBwLR/RA/ss65gcu+b6QWOuWjisH8bIBX8QtGmzX29HB9ABGo1hM9rTTWPkdOGYFBE X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6YUhfEGok+OBlj5yx3b7qBRgO3EG6kve3kMvcD7COsgB1hYjs+JhQ5/i8a5QobxRZfkl/PNZUnuMvm7ikn50v7PniWTZJXAljO4UPyCgUQeut2bmW+etCofAOys119PWKsNIg87ztVr+t9i0g5n+1XtWAth4VB42BFk48I/PXz1MUw/6y8cC1u/5YLz1yHbxcMetAI1snslu2Apx7oXNWR+RHzh0lroDVR+AK3QZnoed1WZaqIJ/JlXE2CXkI4BhHUR2AXdtA4HQiY4Re7E5K/UfEA/wtyoxU3mF2JFufpiSm6TtB1nkPT5uXQN2ewZ/9ITKqN6OebF6Janpk4iXwv1GvT9exao5WAUGjgJIkgaIVrjPkrM8xhxqilS40pmf3AFxGVPTOrZq783jqNFCFEGSo31P9FxK1sOuA/vM1nfw9QccbtMWH2GppLS8VfiLYXJ42JPPyVf6jcD1xKCoXNcPibDnISgWQUd10flNSOr7lRoSS+D2FQphdVy7c8nINUP6A3RP8Nm6kQBOPw8Vb2WeQKwZC08VIHKK/cr2cBB9rbvJ9mOlZ/w1HI91+EISpokvDkL/cNVa4KRWxvyVNGrVrvhMwRO4oXIUegFBTz9C3tTILF+4WgIDYr2nHMaeVUMyL6FdE7WN6ByX+6FVz+60vdeX3OLEtv2cmcpRN40q8UTEh14QaEJZADjOVbU0CCup21yRmrUtyBMKWcniGeQCjJmA4ud4dhvM20AtEs76kMsmc2NYzwlZDjOb/8jrCGHzLS6ce7SVAiLmAG9su21VuFhv6GYiSR6uXJ+Y7e+ZvdjzpFJr3b/rYI15duOBPDveoLp6DCAH0WnPegPIRjeVFZMzImPKqbMdyri91glzSa3BXitao7/tYGvpBVXakfeS6jpfJfPmQqiGjDriLTxZN6kxq2Ks8AYsfV7UUJKt7r39SD1CRiwu1JcUOa1tZ6FIMs1a1S4q8dkdNte8rvfJAfyLHBFUEcZyXFsU5lld6gUu/c0ITYxDXSCg8FD2j6XH3Fll3gpB+NjiPXW+S8NOTG3lHzRj35GS0tAeq7+2atD1va4Ho8Ipm3kjOdq6UcEHFcF8xRJgLCKUxJ44GbEXtQpkjEg/K7iH2uCNarEJVr8n/7v7tZ/LLxJ1cY3qSTryyEEhpIvtJfw2lfY6OydymuK4xfwhiD/HH9mDMv4ucx1dc3ux9/QfzIM907E8pn5CUrXTREBuWxEa7hqipxyP7oFIVDC0sEugr0DauumwMWEi/P6+7X5Zdm+QDGyraJIJBYs1ZGIMiFLrv+iYXA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81628667-3171-4f02-f33c-08dc71fc5cb6 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:08.3294 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 23/71] avcodec/mpegvideo, mpegpicture: Add buffer pool 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: a9PJGSgfeA/B This avoids constant allocations+frees and will also allow to simply switch to the RefStruct API, thereby avoiding the overhead of the AVBuffer API. It also simplifies the code, because it removes the "needs_realloc" field: It was added in 435c0b87d28b48dc2e0360adc404a0e2d66d16a0, before the introduction of the AVBuffer API: given that these buffers may be used by different threads, they were not freed immediately and instead were marked as being freed later by setting needs_realloc. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 155 ++++++++----------------------------- libavcodec/mpegpicture.h | 27 ++++--- libavcodec/mpegvideo.c | 37 +++++++++ libavcodec/mpegvideo.h | 2 + libavcodec/mpegvideo_dec.c | 35 ++++----- libavcodec/mpegvideo_enc.c | 13 ++-- 6 files changed, 112 insertions(+), 157 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index a1404c1d09..2d3cc247c4 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -29,15 +29,11 @@ #include "avcodec.h" #include "motion_est.h" #include "mpegpicture.h" -#include "mpegvideo.h" #include "refstruct.h" #include "threadframe.h" static void av_noinline free_picture_tables(Picture *pic) { - pic->alloc_mb_width = - pic->alloc_mb_height = 0; - av_buffer_unref(&pic->mbskip_table_buf); av_buffer_unref(&pic->qscale_table_buf); av_buffer_unref(&pic->mb_type_buf); @@ -46,43 +42,9 @@ static void av_noinline free_picture_tables(Picture *pic) av_buffer_unref(&pic->motion_val_buf[i]); av_buffer_unref(&pic->ref_index_buf[i]); } -} - -static int make_table_writable(AVBufferRef **ref) -{ - AVBufferRef *old = *ref, *new; - - if (av_buffer_is_writable(old)) - return 0; - new = av_buffer_allocz(old->size); - if (!new) - return AVERROR(ENOMEM); - av_buffer_unref(ref); - *ref = new; - return 0; -} - -static int make_tables_writable(Picture *pic) -{ -#define MAKE_WRITABLE(table) \ -do {\ - int ret = make_table_writable(&pic->table); \ - if (ret < 0) \ - return ret; \ -} while (0) - - MAKE_WRITABLE(mbskip_table_buf); - MAKE_WRITABLE(qscale_table_buf); - MAKE_WRITABLE(mb_type_buf); - - if (pic->motion_val_buf[0]) { - for (int i = 0; i < 2; i++) { - MAKE_WRITABLE(motion_val_buf[i]); - MAKE_WRITABLE(ref_index_buf[i]); - } - } - return 0; + pic->mb_width = + pic->mb_height = 0; } int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, @@ -170,38 +132,28 @@ static int handle_pic_linesizes(AVCodecContext *avctx, Picture *pic, return 0; } -static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encoding, int out_format, - int mb_stride, int mb_width, int mb_height, int b8_stride) +static int alloc_picture_tables(BufferPoolContext *pools, Picture *pic, + int mb_height) { - const int big_mb_num = mb_stride * (mb_height + 1) + 1; - const int mb_array_size = mb_stride * mb_height; - const int b8_array_size = b8_stride * mb_height * 2; - int i; - - - pic->mbskip_table_buf = av_buffer_allocz(mb_array_size + 2); - pic->qscale_table_buf = av_buffer_allocz(big_mb_num + mb_stride); - pic->mb_type_buf = av_buffer_allocz((big_mb_num + mb_stride) * - sizeof(uint32_t)); - if (!pic->mbskip_table_buf || !pic->qscale_table_buf || !pic->mb_type_buf) - return AVERROR(ENOMEM); - - if (out_format == FMT_H263 || encoding || - (avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) { - int mv_size = 2 * (b8_array_size + 4) * sizeof(int16_t); - int ref_index_size = 4 * mb_array_size; - - for (i = 0; mv_size && i < 2; i++) { - pic->motion_val_buf[i] = av_buffer_allocz(mv_size); - pic->ref_index_buf[i] = av_buffer_allocz(ref_index_size); - if (!pic->motion_val_buf[i] || !pic->ref_index_buf[i]) - return AVERROR(ENOMEM); +#define GET_BUFFER(name, idx_suffix) do { \ + pic->name ## _buf idx_suffix = av_buffer_pool_get(pools->name ## _pool); \ + if (!pic->name ## _buf idx_suffix) \ + return AVERROR(ENOMEM); \ +} while (0) + GET_BUFFER(mbskip_table,); + GET_BUFFER(qscale_table,); + GET_BUFFER(mb_type,); + if (pools->motion_val_pool) { + for (int i = 0; i < 2; i++) { + GET_BUFFER(motion_val, [i]); + GET_BUFFER(ref_index, [i]); } } +#undef GET_BUFFER - pic->alloc_mb_width = mb_width; - pic->alloc_mb_height = mb_height; - pic->alloc_mb_stride = mb_stride; + pic->mb_width = pools->alloc_mb_width; + pic->mb_height = mb_height; + pic->mb_stride = pools->alloc_mb_stride; return 0; } @@ -211,17 +163,11 @@ static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encodin * The pixels are allocated/set by calling get_buffer() if shared = 0 */ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, - ScratchpadContext *sc, int encoding, int out_format, - int mb_stride, int mb_width, int mb_height, int b8_stride, - ptrdiff_t *linesize, ptrdiff_t *uvlinesize) + ScratchpadContext *sc, BufferPoolContext *pools, + int mb_height, ptrdiff_t *linesize, ptrdiff_t *uvlinesize) { int i, ret; - if (pic->qscale_table_buf) - if ( pic->alloc_mb_width != mb_width - || pic->alloc_mb_height != mb_height) - free_picture_tables(pic); - if (handle_pic_linesizes(avctx, pic, me, sc, *linesize, *uvlinesize) < 0) return -1; @@ -229,18 +175,14 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, *linesize = pic->f->linesize[0]; *uvlinesize = pic->f->linesize[1]; - if (!pic->qscale_table_buf) - ret = alloc_picture_tables(avctx, pic, encoding, out_format, - mb_stride, mb_width, mb_height, b8_stride); - else - ret = make_tables_writable(pic); + ret = alloc_picture_tables(pools, pic, mb_height); if (ret < 0) goto fail; pic->mbskip_table = pic->mbskip_table_buf->data; memset(pic->mbskip_table, 0, pic->mbskip_table_buf->size); - pic->qscale_table = pic->qscale_table_buf->data + 2 * mb_stride + 1; - pic->mb_type = (uint32_t*)pic->mb_type_buf->data + 2 * mb_stride + 1; + pic->qscale_table = pic->qscale_table_buf->data + 2 * pic->mb_stride + 1; + pic->mb_type = (uint32_t*)pic->mb_type_buf->data + 2 * pic->mb_stride + 1; if (pic->motion_val_buf[0]) { for (i = 0; i < 2; i++) { @@ -257,7 +199,6 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, fail: av_log(avctx, AV_LOG_ERROR, "Error allocating a picture.\n"); ff_mpeg_unref_picture(pic); - free_picture_tables(pic); return AVERROR(ENOMEM); } @@ -272,20 +213,18 @@ void ff_mpeg_unref_picture(Picture *pic) ff_refstruct_unref(&pic->hwaccel_picture_private); - if (pic->needs_realloc) - free_picture_tables(pic); + free_picture_tables(pic); pic->dummy = 0; pic->field_picture = 0; pic->b_frame_score = 0; - pic->needs_realloc = 0; pic->reference = 0; pic->shared = 0; pic->display_picture_number = 0; pic->coded_picture_number = 0; } -int ff_update_picture_tables(Picture *dst, const Picture *src) +static int update_picture_tables(Picture *dst, const Picture *src) { int i, ret; @@ -310,9 +249,9 @@ int ff_update_picture_tables(Picture *dst, const Picture *src) dst->ref_index[i] = src->ref_index[i]; } - dst->alloc_mb_width = src->alloc_mb_width; - dst->alloc_mb_height = src->alloc_mb_height; - dst->alloc_mb_stride = src->alloc_mb_stride; + dst->mb_width = src->mb_width; + dst->mb_height = src->mb_height; + dst->mb_stride = src->mb_stride; return 0; } @@ -330,7 +269,7 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src) if (ret < 0) goto fail; - ret = ff_update_picture_tables(dst, src); + ret = update_picture_tables(dst, src); if (ret < 0) goto fail; @@ -340,7 +279,6 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src) dst->dummy = src->dummy; dst->field_picture = src->field_picture; dst->b_frame_score = src->b_frame_score; - dst->needs_realloc = src->needs_realloc; dst->reference = src->reference; dst->shared = src->shared; dst->display_picture_number = src->display_picture_number; @@ -352,30 +290,14 @@ fail: return ret; } -static inline int pic_is_unused(Picture *pic) -{ - if (!pic->f->buf[0]) - return 1; - if (pic->needs_realloc) - return 1; - return 0; -} - -static int find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared) +int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared) { int i; - if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!picture[i].f->buf[0]) return i; } - } else { - for (i = 0; i < MAX_PICTURE_COUNT; i++) { - if (pic_is_unused(&picture[i])) - return i; - } - } av_log(avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); @@ -394,21 +316,8 @@ static int find_unused_picture(AVCodecContext *avctx, Picture *picture, int shar return -1; } -int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared) -{ - int ret = find_unused_picture(avctx, picture, shared); - - if (ret >= 0 && ret < MAX_PICTURE_COUNT) { - if (picture[ret].needs_realloc) { - ff_mpeg_unref_picture(&picture[ret]); - } - } - return ret; -} - void av_cold ff_mpv_picture_free(Picture *pic) { - free_picture_tables(pic); ff_mpeg_unref_picture(pic); av_frame_free(&pic->f); } diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index 664c116a47..a0bfd8250f 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -23,6 +23,7 @@ #include +#include "libavutil/buffer.h" #include "libavutil/frame.h" #include "avcodec.h" @@ -41,6 +42,17 @@ typedef struct ScratchpadContext { int linesize; ///< linesize that the buffers in this context have been allocated for } ScratchpadContext; +typedef struct BufferPoolContext { + AVBufferPool *mbskip_table_pool; + AVBufferPool *qscale_table_pool; + AVBufferPool *mb_type_pool; + AVBufferPool *motion_val_pool; + AVBufferPool *ref_index_pool; + int alloc_mb_width; ///< mb_width used to allocate tables + int alloc_mb_height; ///< mb_height used to allocate tables + int alloc_mb_stride; ///< mb_stride used to allocate tables +} BufferPoolContext; + /** * Picture. */ @@ -63,18 +75,17 @@ typedef struct Picture { AVBufferRef *ref_index_buf[2]; int8_t *ref_index[2]; - int alloc_mb_width; ///< mb_width used to allocate tables - int alloc_mb_height; ///< mb_height used to allocate tables - int alloc_mb_stride; ///< mb_stride used to allocate tables - /// RefStruct reference for hardware accelerator private data void *hwaccel_picture_private; + int mb_width; ///< mb_width of the tables + int mb_height; ///< mb_height of the tables + int mb_stride; ///< mb_stride of the tables + int dummy; ///< Picture is a dummy and should not be output int field_picture; ///< whether or not the picture was encoded in separate fields int b_frame_score; - int needs_realloc; ///< Picture needs to be reallocated (eg due to a frame size change) int reference; int shared; @@ -87,9 +98,8 @@ typedef struct Picture { * Allocate a Picture's accessories, but not the AVFrame's buffer itself. */ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, - ScratchpadContext *sc, int encoding, int out_format, - int mb_stride, int mb_width, int mb_height, int b8_stride, - ptrdiff_t *linesize, ptrdiff_t *uvlinesize); + ScratchpadContext *sc, BufferPoolContext *pools, + int mb_height, ptrdiff_t *linesize, ptrdiff_t *uvlinesize); int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize); @@ -98,7 +108,6 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src); void ff_mpeg_unref_picture(Picture *picture); void ff_mpv_picture_free(Picture *pic); -int ff_update_picture_tables(Picture *dst, const Picture *src); int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index ce1edca95d..5728f4cee3 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -534,8 +534,19 @@ void ff_mpv_common_defaults(MpegEncContext *s) s->slice_context_count = 1; } +static void free_buffer_pools(BufferPoolContext *pools) +{ + av_buffer_pool_uninit(&pools->mbskip_table_pool); + av_buffer_pool_uninit(&pools->qscale_table_pool); + av_buffer_pool_uninit(&pools->mb_type_pool); + av_buffer_pool_uninit(&pools->motion_val_pool); + av_buffer_pool_uninit(&pools->ref_index_pool); + pools->alloc_mb_height = pools->alloc_mb_width = pools->alloc_mb_stride = 0; +} + int ff_mpv_init_context_frame(MpegEncContext *s) { + BufferPoolContext *const pools = &s->buffer_pools; int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; int mb_height; @@ -630,11 +641,36 @@ int ff_mpv_init_context_frame(MpegEncContext *s) return AVERROR(ENOMEM); memset(s->mbintra_table, 1, mb_array_size); +#define ALLOC_POOL(name, size) do { \ + pools->name ##_pool = av_buffer_pool_init((size), av_buffer_allocz); \ + if (!pools->name ##_pool) \ + return AVERROR(ENOMEM); \ +} while (0) + + ALLOC_POOL(mbskip_table, mb_array_size + 2); + ALLOC_POOL(qscale_table, mv_table_size); + ALLOC_POOL(mb_type, mv_table_size * sizeof(uint32_t)); + + if (s->out_format == FMT_H263 || s->encoding || + (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) { + const int b8_array_size = s->b8_stride * mb_height * 2; + int mv_size = 2 * (b8_array_size + 4) * sizeof(int16_t); + int ref_index_size = 4 * mb_array_size; + + ALLOC_POOL(motion_val, mv_size); + ALLOC_POOL(ref_index, ref_index_size); + } +#undef ALLOC_POOL + pools->alloc_mb_width = s->mb_width; + pools->alloc_mb_height = mb_height; + pools->alloc_mb_stride = s->mb_stride; + return !CONFIG_MPEGVIDEODEC || s->encoding ? 0 : ff_mpeg_er_init(s); } static void clear_context(MpegEncContext *s) { + memset(&s->buffer_pools, 0, sizeof(s->buffer_pools)); memset(&s->next_picture, 0, sizeof(s->next_picture)); memset(&s->last_picture, 0, sizeof(s->last_picture)); memset(&s->current_picture, 0, sizeof(s->current_picture)); @@ -762,6 +798,7 @@ void ff_mpv_free_context_frame(MpegEncContext *s) { free_duplicate_contexts(s); + free_buffer_pools(&s->buffer_pools); av_freep(&s->p_field_mv_table_base); for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index a8ed1b60b6..f5ae0d1ca0 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -132,6 +132,8 @@ typedef struct MpegEncContext { Picture **input_picture; ///< next pictures on display order for encoding Picture **reordered_input_picture; ///< pointer to the next pictures in coded order for encoding + BufferPoolContext buffer_pools; + int64_t user_specified_pts; ///< last non-zero pts from AVFrame which was passed into avcodec_send_frame() /** * pts difference between the first and second input frame, used for diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index c1f49bce14..a4c7a0086a 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -115,12 +115,11 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, #define UPDATE_PICTURE(pic)\ do {\ ff_mpeg_unref_picture(&s->pic);\ - if (s1->pic.f && s1->pic.f->buf[0])\ + if (s1->pic.f && s1->pic.f->buf[0]) {\ ret = ff_mpeg_ref_picture(&s->pic, &s1->pic);\ - else\ - ret = ff_update_picture_tables(&s->pic, &s1->pic);\ - if (ret < 0)\ - return ret;\ + if (ret < 0)\ + return ret;\ + }\ } while (0) UPDATE_PICTURE(current_picture); @@ -194,10 +193,6 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s) ff_mpv_free_context_frame(s); - if (s->picture) - for (int i = 0; i < MAX_PICTURE_COUNT; i++) - s->picture[i].needs_realloc = 1; - s->last_picture_ptr = s->next_picture_ptr = s->current_picture_ptr = NULL; @@ -268,9 +263,12 @@ static int alloc_picture(MpegEncContext *s, Picture **picp, int reference) if (ret < 0) goto fail; - ret = ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, 0, s->out_format, - s->mb_stride, s->mb_width, s->mb_height, s->b8_stride, - &s->linesize, &s->uvlinesize); + av_assert1(s->mb_width == s->buffer_pools.alloc_mb_width); + av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height || + FFALIGN(s->mb_height, 2) == s->buffer_pools.alloc_mb_height); + av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); + ret = ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, &s->buffer_pools, + s->mb_height, &s->linesize, &s->uvlinesize); if (ret < 0) goto fail; *picp = pic; @@ -388,8 +386,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) for (int i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference || (&s->picture[i] != s->last_picture_ptr && - &s->picture[i] != s->next_picture_ptr && - !s->picture[i].needs_realloc)) { + &s->picture[i] != s->next_picture_ptr)) { ff_mpeg_unref_picture(&s->picture[i]); } } @@ -487,7 +484,7 @@ int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, const Picture *p { AVVideoEncParams *par; int mult = (qp_type == FF_MPV_QSCALE_TYPE_MPEG1) ? 2 : 1; - unsigned int nb_mb = p->alloc_mb_height * p->alloc_mb_width; + unsigned int nb_mb = p->mb_height * p->mb_width; if (!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS)) return 0; @@ -496,10 +493,10 @@ int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, const Picture *p if (!par) return AVERROR(ENOMEM); - for (unsigned y = 0; y < p->alloc_mb_height; y++) - for (unsigned x = 0; x < p->alloc_mb_width; x++) { - const unsigned int block_idx = y * p->alloc_mb_width + x; - const unsigned int mb_xy = y * p->alloc_mb_stride + x; + for (unsigned y = 0; y < p->mb_height; y++) + for (unsigned x = 0; x < p->mb_width; x++) { + const unsigned int block_idx = y * p->mb_width + x; + const unsigned int mb_xy = y * p->mb_stride + x; AVVideoBlockParams *const b = av_video_enc_params_block(par, block_idx); b->src_x = x * 16; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index f45a5f1b37..4121cc034f 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1112,9 +1112,11 @@ static int alloc_picture(MpegEncContext *s, Picture *pic) pic->f->width = avctx->width; pic->f->height = avctx->height; - return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, 1, s->out_format, - s->mb_stride, s->mb_width, s->mb_height, s->b8_stride, - &s->linesize, &s->uvlinesize); + av_assert1(s->mb_width == s->buffer_pools.alloc_mb_width); + av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height); + av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); + return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, &s->buffer_pools, + s->mb_height, &s->linesize, &s->uvlinesize); } static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) @@ -1480,7 +1482,7 @@ static int select_input_picture(MpegEncContext *s) s->next_picture_ptr && skip_check(s, s->input_picture[0], s->next_picture_ptr)) { // FIXME check that the gop check above is +-1 correct - av_frame_unref(s->input_picture[0]->f); + ff_mpeg_unref_picture(s->input_picture[0]); ff_vbv_update(s, 0); @@ -1627,8 +1629,7 @@ no_output_pic: pic->display_picture_number = s->reordered_input_picture[0]->display_picture_number; /* mark us unused / free shared pic */ - av_frame_unref(s->reordered_input_picture[0]->f); - s->reordered_input_picture[0]->shared = 0; + ff_mpeg_unref_picture(s->reordered_input_picture[0]); s->current_picture_ptr = pic; } else { From patchwork Sat May 11 20:50:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48751 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298675pzb; Sat, 11 May 2024 13:55:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXYO1XgWm+g5NtyroMCore5T9tRyF9wNIq0cJm1o7LxC2RuVUINPwZIKI0XrBCzXX/vaXU4Mpv9iNTjcNXQwcAhi3bYd2dgvNjoVA== X-Google-Smtp-Source: AGHT+IG50UDfWNtlHu6iSEP+d4eT6nnPasQhv31ktAaPOGgtVtm9bGVFxEoODJW/lsgUJRoCaFrV X-Received: by 2002:aa7:c35a:0:b0:574:b106:57db with SMTP id 4fb4d7f45d1cf-574b1065a14mr1848261a12.21.1715460922267; Sat, 11 May 2024 13:55:22 -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 4fb4d7f45d1cf-5733c36e5e7si3292182a12.561.2024.05.11.13.55.21; Sat, 11 May 2024 13:55:22 -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=Y4wgrDjo; 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 BD6C368D670; Sat, 11 May 2024 23:53:13 +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-am6eur05olkn2041.outbound.protection.outlook.com [40.92.91.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 91A6B68D4DA for ; Sat, 11 May 2024 23:53:11 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QOMTp0u38T3Alw7ZKZEOg77yws/hqwehiHWpz8Fmdf+oUs3+SHcZbP/82HQ7jDygWh1bvVRFhDyA+4wotIPfyLo77HgjqbeTqZrZIjSdTJKNV5D+xG0Rvuy4x+FW1vkZf0iGkfXYcpT44LVccR1hq+5pdKW0ev8hTCZYl1CkJJyjUNt7OXxze3lHrCZVn+0BhLfeSr2LB6UL9pfcP+OSOdHeWOg8/DQAqWfS0erkFkCPCLO27yaYakQg/ff/f0io7viEEXYlk4muffJhs7yO0xHZm7yj1W2h+QgQWic6LzoBRFWQAsXpewcpjaekk/IgFmbWTnRs8EJvpclg7mkfXA== 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=LZGP5Z3CzJUsszhh+F6k04ayc8Q7x+GXj/Wh0ILwmpo=; b=M7ZjysBY6nabCGmR2o75GbFJmKgP3hMOL82dW8WVPvQ21aBBXSAMobm209xGNtSm+HB6X0tlET/UOaXmsD5GzfyrvVls8e+LRCXubWY07YhRvF3B39YMLtf5PjOJ99NOivqKFP3aMSP/e0eaFyDLSzQ1wUBpkXUKEPd517HHUme3IRY09PDhzyjnAy1k7pFOIMCKhVERPMIvcAZ4YQwaNkScLX1VbaN0QD0ZGZnrUVkYSNU6BiFl5j2Apiwgujw8dn8LXPeSemgQ+z9lluKA89GrlhqBsh4vZvu119+h5FRY2ryG6GSKUrHPCf/NVn550Otp9h4iakPz3DUrTikWBQ== 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=LZGP5Z3CzJUsszhh+F6k04ayc8Q7x+GXj/Wh0ILwmpo=; b=Y4wgrDjoT3LUAJSHsJJibAh2zHyxTDUo+TDYMZcLyxr0rFg+bLmlzjr1XCz4fVrrxuC6JMxSByuLDVk1Sm7b8M864b3tzN5iuyVFAOnxULYqIQOqDyfcd9Qu0tElxsszLyE+NMwAo2wc/xlOIYRLCWUZZNvxGFL6j7MIyqWb4xlxRhO/5L5B839q+BuPgeuJnNS2BQhlVmGpuVbN3RSVw0e+Wdy9gLG2qe/wZPFImMLo0gVXlJReATYp6ZcolMpkLtzqsG7WjWWKC4OGDvXOg16qlx7ZnF0IdROFR/SHzsOKYF6JAWEl4LgtmL03+QRE1wCuwyUe4kdMkRea2qPZqw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:10 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:48 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [xM5cRKvRGybvkap6NpXLaEc65oiUGJonFCHRtWLOlso=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-23-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 1791714e-b2ef-48aa-47d5-08dc71fc5db6 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 9LAOdgWJQXXjdhLafbuzoPm2BYx+17E6ACiTtLQ/b/6sV5H6V6yQdw5aqhI/wkR99ucgJBCmjjyZky8njkw6b/vtDNgc16L04cEPAfngWj70pFg0xs8NaJXyCB2bNdZ15t9ZuPfnntJoi7V6isYx9d6g7cUC0MhRTkSaKbfV/8dIZD04ZmEf6Xk2VdoXs0tzB9ce2gPEGU9rTly8S/wiktExGBD5fZDUY3Vw8ROTqnkPwkIa3wIBfB7HH5UgCj6/EYXgEP6xg/tF1lP4iT4GN9+8TQVV7Aiqxn2lelZ7TSFAx4mBt+akcheCkEQqXapLznZPfVibN4LRSZQWXrq8FJdNAn5XdW4ZFD5joapl0HZtKrIhGNNsUAlNLsQOXrhUaotekGONYgXPsZ0hOULoxPiS15Faqucv3ssaqjKMeKZyCZVoWOUFD8oIl5/DMRuYfWizZSM3E/O/C1c6ELyCZ7LHijT388bCR78aSokG7Y/OxbKqV6JExjMynrRe80JeX9tFwUUPUSmzFV4IRxZHiD+TebMIK2p+VeMWNMqGiW3vogNLdVm/qETfIiFxm02rHSWuczdJjgdl/MdrCdzIceikuX8nDswlNRrnMVeRO1eFuD+GaSD620tbFWM+stI5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YnirH35xioI0a8RupV7KlWscxJVQGg16qtxvuzYgu+qkDjg0hyN3Gm7IU2COuU8BXmZfV+8UqzZpE2VcZhdzlTafL+/5OckOr4uZS2SoUIKcnYLITVTgj1b7wBsxYDhOqAPkTa4tzR6UTlewhS4fBDpdPUT3a10+4UPJW4PbCDRE/g06dUAF53Xjkoyfbz1jNDtsgoVnHuJY2bmtOiLwFgEi0QxW40+9MvWhLpq97cnTLQDy/ByaWiYLO3vC/JmbGu2JdNILR7hBn5PnGuE4SvoEoEXzyDemSQbAiRIreXAJOADx1lb213nfmagoi4fNdH58CjKy5i7/ofqGs2ExH3EKu1qzniqavQZnHd3H6Xu00n2OSPR0EThpXWDWl0JK/f2gMi4sw5TCy/Z2fZymy03GagbiqgE1qhUjcGSBm1CaMiHOyRUDA6+BZwhBvRqC4USlwOFcKcFzDa3nT7oFC0KquarZLyS4edA0oc7WmfjapkOUG1XpJ2rMPN7V3KxY73PQFBo5XOiNMpQ34WdCMsfbrUlt+1cLQB9ikrEZfag6TOdqGYiR0i5lOYMZlzBETU33LzwZm3H3YQ9C2G+p9YfJ47ipMSMU+IR5D3tG0khFbeu24TyEOsUFV4FPqfn15akw7n/0BCsC44kHibx/gnPAKwJN/NlwGlVPLEl23ho0xSTkjAlWcxEc3/XsmQf0YnH0lMFlD017YFPgcjx0kVZDZGTxNVAYDZ4BFuMbq348B2Oh/F7HucdgJohtMnLb8OYiVnwexDz15TDYSJLRv5+H8yFN0juTtHZRtjNdj9NewDYCUvKv0xFYlMcJ2lYjWXzRN0HvSI5EdM5mQPQq0EcDo4If5GEJLZRSP+dFXA+nbLIWu4wpuO/EabWdhTHw857Hpo8mqIuwhqtwDQwh/Cb0bn+z6C4z2RjvUG2VYsyVW1iqbokvRraEmgGdPgdH36g4uo0E1IJ3XzKZazjdCzwhA97urQSK04wUq/jLejDpeeymk0bkqPNVkgY3HiBkgR9+ILKlezq5u47R2GeeoTNraEYZ+Jylhnq8ib7GELInUtWDM5/CjBCO0A/jTg4+AlHMG5H6y5G5UKGTv/ktXVKLnHc+0UtvSomCH3FwBOC2jLsU5rxpfSDLLXOrK9xPeLJ+Nme3oG1RIUTnQ5M8hP6A2WJ87JOsPQJY0U5aJxWA4JrrSE9WeBRHAd0ecVwNKak0EzT4j7n28xv3RbHMqOUdKHBme0wzWkbMx2ZiTXM2Rsx2lEcr3SAF4BPjeD9lueh8AEXVQocTkx5RDB93Zw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1791714e-b2ef-48aa-47d5-08dc71fc5db6 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:10.0572 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 24/71] avcodec/mpegpicture: Reindent after the previous commit 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: xVoptqAtOuul Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 2d3cc247c4..32ca037526 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -292,12 +292,9 @@ fail: int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared) { - int i; - - for (i = 0; i < MAX_PICTURE_COUNT; i++) { - if (!picture[i].f->buf[0]) - return i; - } + for (int i = 0; i < MAX_PICTURE_COUNT; i++) + if (!picture[i].f->buf[0]) + return i; av_log(avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); From patchwork Sat May 11 20:50:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48752 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298708pzb; Sat, 11 May 2024 13:55:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW8oGKV4u8v9Qj+YTFqRI2SnPAbYD+oGluK+/BdJehKFLwUPtGSkng0rzTquEQemhjVA9cpK59LNqZKtDz+t9yPXt47dG1Ndak/jQ== X-Google-Smtp-Source: AGHT+IFoTkGg36Q5sDMz4v6k6ZNGptgI0d0BI1uaRcrBTxXs/qasHPZTSHLA9gej4WdjBE4RRScr X-Received: by 2002:a05:6512:312a:b0:51f:f8b:dcfb with SMTP id 2adb3069b0e04-5220fc6d7ccmr3359303e87.41.1715460930970; Sat, 11 May 2024 13:55:30 -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 a640c23a62f3a-a5a17b21b09si324345666b.282.2024.05.11.13.55.30; Sat, 11 May 2024 13:55:30 -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=PZNVLJ78; 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 81DED68D67E; Sat, 11 May 2024 23:53:17 +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-am6eur05olkn2080.outbound.protection.outlook.com [40.92.91.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80F2068D67E for ; Sat, 11 May 2024 23:53:15 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jIBk9/vN3m/s3MVg5b42ggu8u4OlS38xKnPimWcKLnP94q+vS6IiaF6embVAm1wfNEMLDwhO1EgD0J/FpSrXI921L4JE5qW/COz7nkqQWY1S2zPCACJq78XJHxhaAe2h+ieKGAh3fdH4B55AFjdXFTkFQ9QSMGqShcssP1yN7RUOql7KA/haWlUH17Ya/yhIEZDDKMhl1P3ld8GH/pOMxe5/LD/NANRSLc6zHRU3c8iP7kNVR2NNL1QulHNLcnEamLdnpIUNGXWW2fPNhsiO8J4d6dUn/AgQyClRzOuy03AfNS+Zd9IskSRGfIYvarGyl9ai2x0fIL7DH+w5PiSmZQ== 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=MnADxi/TM8wWlY8TUCd/lND/MvKq/ThFP/ge8WJfmTU=; b=huGgKg1uq8kWdZ0IHpLFwaiC2nERSck/5R2L1WrtSamMo8mqhyID0gllDGFveh4mqC9Fx7JUtMG8gGq8fA+q4EVBYlO2Npy6Xkrf3lzjYl8LFYZRmNKb6DvW/vcjVh1MAiypEKHz2dtMsJ2rO2xnR2knkfb4Dk0vZ5m+GUgcYzJFBQa2PM3WTmY5b6/+xR2A4EASWbNCrYR4D+h7WkGGQSj0WOE5q6la+A4KJI9buwEYj79imi2LkliG9cUpQ7ZrxaK2dBLT9IvraqncT0wKbX0E7VMEswr7tDHSaM6VQzkA8gzY3+gPORE0k/GWLC8muE8seAuzRl11ZvWvT8q+kg== 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=MnADxi/TM8wWlY8TUCd/lND/MvKq/ThFP/ge8WJfmTU=; b=PZNVLJ78Qyb07rFXEUkyYhlHYc+lRg9bD4EaHmlsJrdu0Q0gtZl12GaLnq2I+7cmEWSL/xRTRwzPFoCwBvdBHZEDNz4lBWtTNNQpbp5BtpqBHFY3dQtbGwBCJyxTfVmVQs9/f28JjrMlI3+Xq6xHOBWF4IIH2Vt1KLveFYE+yRQSxFm6xgo5dvJscPRhjcBoedCH871TSnnIlr/bn4ojDf6HAnd2GZUIHaLFAHzqDbIvrR/p/cyzMApQ2RjRB/lSiYmBgruFNcvrhIe3pmj5PCN8JXOPywJrzC61AVNdH15Zfr0mBDLkZsf5p/cYHSzE3XdrFBjmPaeIErT6OlV41w== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:13 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:13 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:49 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [496WfODqlu3fSKcHArL2cLpvsqh78TLseDTo1kuDkgM=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-24-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: ce962cac-276e-4253-6f0f-08dc71fc5fd9 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: iGxl6NKdpFaxSbGmFWl5KS2wyNsR4DB4SQFgXeuHzdDtLtlhsCuWwx09pfC4e6DyCnL4me2gFSKv6i++qx9ugYiAxk3qQvh6/+ytBNBBypzmtwBcQsfHJMq6f2xAjcKGVReFv9ziGh1kQYid0YBu++/id40R/y/4WqQHLPjAxeyuKmbbELvoLW5emsEeANk162G6SQbMsFItU5kkAhjYyCVl4tLS89Kb5sjgQsveh9UKvgwrkpL38L5kF8fP5iq/OghsRpZQm0wrKmmuNkYAV5kr+SC5RsQLIV4AJADBQdrhpjeY/K5FTlelJEoiGr1065czrv/AqGM5SJ3j/MkIMy3d0UlvTOnOXqoUPqDuBw/5zF1mrZltKM2K5aYquget1xiOyacYMfmHrYorrPpSw/2K1+8aevqjjTHwjqdFKv8bBAhwwNd0wL+035Z/BHPk14BhZtvYBSUtFhj7LhZzmLSVzB+xMgw22IgfQm0bT2nX9/yC1jy0ElGAKjzrXY4C/lOM9bRXFYE4Q9N+5FsoYdUkAJ3zfOlzpO7drR2m7P9j7pgfpllvjNjUg/9O3wQz7+QJFKknzEj2MR9gEzIg4XNvprOyXhgV8iZGkrATuDYwBfVO/7jmFEHCFoqUmTfp X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2/62vB8d1YhySDSTqHoCXFhg0uQm4P6wR33cnOQXgxFvW1ytJDcuCANj0IAmJw3mdFUw1Cz/tSNi6wETb7kOA4u5huThiwQ9XMNpKzyAlLJ32HZ71vKpX6qTV6bMSXgMr/rtyUZnvVkkNgQm8gmQxOX8+HmOu1LbiHUBey4fSbpemp1tosJZ7Y8EmgA4l2QqPw4DcEEUyEb+7XT1JmzFMdAVd94qevkbxj88nobhAB7pjvDFkpOecq+/5xWmY3XkVJuBYgoujXtIrIdZmhITZzfVIPB2wnWrGeBaOF3HwLd2+mVkiGKg7HNfffmJ1/2dH1mejaY/gstyCnILK7J5P6KxFbc/37avvnLWq3c7O+1qi2mGTeZeVCgn9yc91KDs8FLryAWO7fjQt4wZ2zk4tGYK7W48tkabp4MIeKqvG475YxVHqE9ErhtTB6eviwdiKy5eOgHbzG/XrGLiwz5JhHlY91U46ifyqGMQvztqW4pn8M/coIqiE1ymfs4weiVs4vrn/LcPLNzsDerdIAJ4iq0DC50ZrGJrO5y+jIo1u/DdOW8JgT8IIvtYAZGC7IxWM2j8Xgc+5eu57Q9YcngpF6Y1oC15FfpHh+Od43YAcz53Rtgaez3yM2ws3aQhZRyBwgUwbKUec9+azqX22YEfWKCmuU8E1sd9ZTHnVtJi82fGXYtuQ7D0IwU/1ce4T7o80CWalVbOdX1jVd8CVkcGjmRuuuoOSaJbqe9dBYCeSPAHxshr5SRBqjZ29QhEhWRmZGRRn2APEGpC2/DF3ZJ3rA+Dx85/3CGTHyxMgBei5KVPo8cLo1Rnnqpffq+3ZSy2C9qDahbAWbMwSHbVB4DaXfJrX3WdKYn8C7y15s30ZsH+8xx81INH2fkdDWM2UHLSaXIbjzIc2J1N79o33zI+sQQJArUCiUS4JsRpPafqx0Fx+L2XY+O9s8nkUnREzV1qSZR2+dZYPGaTc/GsVgmhl7UPQq/atrVO4Ov3aVaPrSJy6Qd5tA6LtFdH+CUA7Tty2EGUgNXWkEwawVzQ55IgdmTFDk79PygnO1mKurTa0crizG0wvNd1JaNMLfy/awihc2xDlnfNXxC7FUz3vKVkW0UlDD17C+Frnt/7D8dzSj2SAB2wJjvfUmwxp5eHddRkl4TeL3AzmHbuiRQQiM/rndsTQ3LGjFG+BF1x2QqIq0fBn537fqgc6H1mHsSweT1tKSZolsQ7i7sSdt90jcE0M1nIbUw1WWQdlcmK8gQ6A5G7phnxTFFVbrXxxrLQvAf1XaZuE+OuX2ziGvB1diH4xQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce962cac-276e-4253-6f0f-08dc71fc5fd9 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:13.6108 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 25/71] avcodec/mpegpicture: Use RefStruct-pool API 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: oomM2/jQGJwX It involves less allocations and therefore has less potential errors to be checked. One consequence thereof is that updating the picture tables can no longer fail. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 82 ++++++++++++++-------------------------- libavcodec/mpegpicture.h | 21 ++++------ libavcodec/mpegvideo.c | 28 ++++++++------ 3 files changed, 53 insertions(+), 78 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 32ca037526..ad6157f0c1 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "libavutil/avassert.h" #include "libavutil/common.h" #include "libavutil/mem.h" @@ -34,13 +32,13 @@ static void av_noinline free_picture_tables(Picture *pic) { - av_buffer_unref(&pic->mbskip_table_buf); - av_buffer_unref(&pic->qscale_table_buf); - av_buffer_unref(&pic->mb_type_buf); + ff_refstruct_unref(&pic->mbskip_table); + ff_refstruct_unref(&pic->qscale_table_base); + ff_refstruct_unref(&pic->mb_type_base); for (int i = 0; i < 2; i++) { - av_buffer_unref(&pic->motion_val_buf[i]); - av_buffer_unref(&pic->ref_index_buf[i]); + ff_refstruct_unref(&pic->motion_val_base[i]); + ff_refstruct_unref(&pic->ref_index[i]); } pic->mb_width = @@ -135,18 +133,18 @@ static int handle_pic_linesizes(AVCodecContext *avctx, Picture *pic, static int alloc_picture_tables(BufferPoolContext *pools, Picture *pic, int mb_height) { -#define GET_BUFFER(name, idx_suffix) do { \ - pic->name ## _buf idx_suffix = av_buffer_pool_get(pools->name ## _pool); \ - if (!pic->name ## _buf idx_suffix) \ +#define GET_BUFFER(name, buf_suffix, idx_suffix) do { \ + pic->name ## buf_suffix idx_suffix = ff_refstruct_pool_get(pools->name ## _pool); \ + if (!pic->name ## buf_suffix idx_suffix) \ return AVERROR(ENOMEM); \ } while (0) - GET_BUFFER(mbskip_table,); - GET_BUFFER(qscale_table,); - GET_BUFFER(mb_type,); + GET_BUFFER(mbskip_table,,); + GET_BUFFER(qscale_table, _base,); + GET_BUFFER(mb_type, _base,); if (pools->motion_val_pool) { for (int i = 0; i < 2; i++) { - GET_BUFFER(motion_val, [i]); - GET_BUFFER(ref_index, [i]); + GET_BUFFER(ref_index,, [i]); + GET_BUFFER(motion_val, _base, [i]); } } #undef GET_BUFFER @@ -166,7 +164,7 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height, ptrdiff_t *linesize, ptrdiff_t *uvlinesize) { - int i, ret; + int ret; if (handle_pic_linesizes(avctx, pic, me, sc, *linesize, *uvlinesize) < 0) @@ -179,20 +177,12 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, if (ret < 0) goto fail; - pic->mbskip_table = pic->mbskip_table_buf->data; - memset(pic->mbskip_table, 0, pic->mbskip_table_buf->size); - pic->qscale_table = pic->qscale_table_buf->data + 2 * pic->mb_stride + 1; - pic->mb_type = (uint32_t*)pic->mb_type_buf->data + 2 * pic->mb_stride + 1; - - if (pic->motion_val_buf[0]) { - for (i = 0; i < 2; i++) { - pic->motion_val[i] = (int16_t (*)[2])pic->motion_val_buf[i]->data + 4; - pic->ref_index[i] = pic->ref_index_buf[i]->data; - /* FIXME: The output of H.263 with OBMC depends upon - * the earlier content of the buffer; therefore we - * reset it here. */ - memset(pic->motion_val_buf[i]->data, 0, pic->motion_val_buf[i]->size); - } + pic->qscale_table = pic->qscale_table_base + 2 * pic->mb_stride + 1; + pic->mb_type = pic->mb_type_base + 2 * pic->mb_stride + 1; + + if (pic->motion_val_base[0]) { + for (int i = 0; i < 2; i++) + pic->motion_val[i] = pic->motion_val_base[i] + 4; } return 0; @@ -224,36 +214,24 @@ void ff_mpeg_unref_picture(Picture *pic) pic->coded_picture_number = 0; } -static int update_picture_tables(Picture *dst, const Picture *src) +static void update_picture_tables(Picture *dst, const Picture *src) { - int i, ret; - - ret = av_buffer_replace(&dst->mbskip_table_buf, src->mbskip_table_buf); - ret |= av_buffer_replace(&dst->qscale_table_buf, src->qscale_table_buf); - ret |= av_buffer_replace(&dst->mb_type_buf, src->mb_type_buf); - for (i = 0; i < 2; i++) { - ret |= av_buffer_replace(&dst->motion_val_buf[i], src->motion_val_buf[i]); - ret |= av_buffer_replace(&dst->ref_index_buf[i], src->ref_index_buf[i]); - } - - if (ret < 0) { - free_picture_tables(dst); - return ret; + ff_refstruct_replace(&dst->mbskip_table, src->mbskip_table); + ff_refstruct_replace(&dst->qscale_table_base, src->qscale_table_base); + ff_refstruct_replace(&dst->mb_type_base, src->mb_type_base); + for (int i = 0; i < 2; i++) { + ff_refstruct_replace(&dst->motion_val_base[i], src->motion_val_base[i]); + ff_refstruct_replace(&dst->ref_index[i], src->ref_index[i]); } - dst->mbskip_table = src->mbskip_table; dst->qscale_table = src->qscale_table; dst->mb_type = src->mb_type; - for (i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) dst->motion_val[i] = src->motion_val[i]; - dst->ref_index[i] = src->ref_index[i]; - } dst->mb_width = src->mb_width; dst->mb_height = src->mb_height; dst->mb_stride = src->mb_stride; - - return 0; } int ff_mpeg_ref_picture(Picture *dst, Picture *src) @@ -269,9 +247,7 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src) if (ret < 0) goto fail; - ret = update_picture_tables(dst, src); - if (ret < 0) - goto fail; + update_picture_tables(dst, src); ff_refstruct_replace(&dst->hwaccel_picture_private, src->hwaccel_picture_private); diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index a0bfd8250f..363732910a 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -23,9 +23,6 @@ #include -#include "libavutil/buffer.h" -#include "libavutil/frame.h" - #include "avcodec.h" #include "motion_est.h" #include "threadframe.h" @@ -43,11 +40,11 @@ typedef struct ScratchpadContext { } ScratchpadContext; typedef struct BufferPoolContext { - AVBufferPool *mbskip_table_pool; - AVBufferPool *qscale_table_pool; - AVBufferPool *mb_type_pool; - AVBufferPool *motion_val_pool; - AVBufferPool *ref_index_pool; + struct FFRefStructPool *mbskip_table_pool; + struct FFRefStructPool *qscale_table_pool; + struct FFRefStructPool *mb_type_pool; + struct FFRefStructPool *motion_val_pool; + struct FFRefStructPool *ref_index_pool; int alloc_mb_width; ///< mb_width used to allocate tables int alloc_mb_height; ///< mb_height used to allocate tables int alloc_mb_stride; ///< mb_stride used to allocate tables @@ -60,19 +57,17 @@ typedef struct Picture { struct AVFrame *f; ThreadFrame tf; - AVBufferRef *qscale_table_buf; + int8_t *qscale_table_base; int8_t *qscale_table; - AVBufferRef *motion_val_buf[2]; + int16_t (*motion_val_base[2])[2]; int16_t (*motion_val[2])[2]; - AVBufferRef *mb_type_buf; + uint32_t *mb_type_base; uint32_t *mb_type; ///< types and macros are defined in mpegutils.h - AVBufferRef *mbskip_table_buf; uint8_t *mbskip_table; - AVBufferRef *ref_index_buf[2]; int8_t *ref_index[2]; /// RefStruct reference for hardware accelerator private data diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5728f4cee3..eab4451e1e 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -41,6 +41,7 @@ #include "mpegutils.h" #include "mpegvideo.h" #include "mpegvideodata.h" +#include "refstruct.h" static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, int16_t *block, int n, int qscale) @@ -536,11 +537,11 @@ void ff_mpv_common_defaults(MpegEncContext *s) static void free_buffer_pools(BufferPoolContext *pools) { - av_buffer_pool_uninit(&pools->mbskip_table_pool); - av_buffer_pool_uninit(&pools->qscale_table_pool); - av_buffer_pool_uninit(&pools->mb_type_pool); - av_buffer_pool_uninit(&pools->motion_val_pool); - av_buffer_pool_uninit(&pools->ref_index_pool); + ff_refstruct_pool_uninit(&pools->mbskip_table_pool); + ff_refstruct_pool_uninit(&pools->qscale_table_pool); + ff_refstruct_pool_uninit(&pools->mb_type_pool); + ff_refstruct_pool_uninit(&pools->motion_val_pool); + ff_refstruct_pool_uninit(&pools->ref_index_pool); pools->alloc_mb_height = pools->alloc_mb_width = pools->alloc_mb_stride = 0; } @@ -641,15 +642,15 @@ int ff_mpv_init_context_frame(MpegEncContext *s) return AVERROR(ENOMEM); memset(s->mbintra_table, 1, mb_array_size); -#define ALLOC_POOL(name, size) do { \ - pools->name ##_pool = av_buffer_pool_init((size), av_buffer_allocz); \ +#define ALLOC_POOL(name, size, flags) do { \ + pools->name ##_pool = ff_refstruct_pool_alloc((size), (flags)); \ if (!pools->name ##_pool) \ return AVERROR(ENOMEM); \ } while (0) - ALLOC_POOL(mbskip_table, mb_array_size + 2); - ALLOC_POOL(qscale_table, mv_table_size); - ALLOC_POOL(mb_type, mv_table_size * sizeof(uint32_t)); + ALLOC_POOL(mbskip_table, mb_array_size + 2, FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); + ALLOC_POOL(qscale_table, mv_table_size, 0); + ALLOC_POOL(mb_type, mv_table_size * sizeof(uint32_t), 0); if (s->out_format == FMT_H263 || s->encoding || (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) { @@ -657,8 +658,11 @@ int ff_mpv_init_context_frame(MpegEncContext *s) int mv_size = 2 * (b8_array_size + 4) * sizeof(int16_t); int ref_index_size = 4 * mb_array_size; - ALLOC_POOL(motion_val, mv_size); - ALLOC_POOL(ref_index, ref_index_size); + /* FIXME: The output of H.263 with OBMC depends upon + * the earlier content of the buffer; therefore we set + * the flags to always reset returned buffers here. */ + ALLOC_POOL(motion_val, mv_size, FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); + ALLOC_POOL(ref_index, ref_index_size, 0); } #undef ALLOC_POOL pools->alloc_mb_width = s->mb_width; From patchwork Sat May 11 20:50:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48793 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp302958pzb; Sat, 11 May 2024 14:09:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSD18yFdYpB4lN7EYV5knbXV28m0g1qJaFFaRMMMgJwDDvjlaXpRU6AioxCY9nQtHoJLtZTKwNJSsIfADfmnSK8fIxGUwMWsClUg== X-Google-Smtp-Source: AGHT+IFMYaB2KbQe6Tr1LZe3qq5Mqtlf3DRWQahgSHJN/e41AOPQtBAturtXMFweGFgKCsYTN0FG X-Received: by 2002:a17:906:235b:b0:a59:a532:ed58 with SMTP id a640c23a62f3a-a5a2d55ac04mr361156266b.28.1715461759393; Sat, 11 May 2024 14:09:19 -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 a640c23a62f3a-a5a17ba3a7esi374443666b.618.2024.05.11.14.09.19; Sat, 11 May 2024 14:09:19 -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=dcLr74x2; 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 2501368D86B; Sun, 12 May 2024 00:09:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2058.outbound.protection.outlook.com [40.92.74.58]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DE86C68D6D6 for ; Sun, 12 May 2024 00:09:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n2P6NkVFG2s8u+Y7srcdAexKyDb+cJq9h4bQ/Y3h6NKOB8SmyybhWaO4r6Va2B5/ZZibCw3edF3i4/mg3W1SzQuCcg9UUCS5bDVDpHFi92joq4VrVyh+xWnwPUDRX1r/xaJ2OM7jk/n/cZVwL/UWYyRbV/kQBY2jA0I5euCLO/k00vzWEUr6pYDoEeSly43ZtpAGbyxHbbZY2qHiK+7KuBxs3hD8xkl4rh+mmj10ZQjhGtPODs7Co0UQGyBJ34+kAea4ulRhmwcARZmyYDGxtOPbL/7OkCPB8WtYSIbuWRxoNVFDxC4UQx8Izyo88JAY+GAy3Bs44GtchzT0N/3qfA== 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=pNR83he5xtKsRXhNS2X6ynLb+b8W7Bm6k/G55ngqnUk=; b=OO8gZdvNBti2Bo1dKomxxkBXlbjBJ0bpEmqTEUF2B8bRyFv5aBBcAIi+Ka7loJfLETbv2kWNj6cwmPb10W/hBDgmC76xAdR3l3PumGjWV6mIf4Rbw0W8PwPawERRYkuzZPkNCReCWaLX99yPoK1y/9Hats/P1ewhbl2BSdpIqBp1lPf8VGRGbeTSLMW5Li6KZyZUyOeQHpr6V++aQduzKcIsWUTLzavgfxwR4xigd8GCPdvjJQEurwKwG44bBDcxExSQSj9rMFJ7A/TC2ENRbWBhhRutM5KZkU7B+nhOZqaaBVxYGzSNrNXvGS6ffwtVV7nNCzy6WAB6Lbitf11QZQ== 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=pNR83he5xtKsRXhNS2X6ynLb+b8W7Bm6k/G55ngqnUk=; b=dcLr74x2mB8LgWhN2GAr0HBjCenpIUBQEW8IjXegsCfQt5SLQgDHVD3xFe2kA+21SOfOX5cCOeZ1RPVz25IQXj/35lIY6qXEqa5RgWhTk8WJ/1dLky8iJCB82wVU9+vS97U0ozNTUQEPZ312P4oTySh1TxWmX8ChmBaQic0y6qzGp3bhQu0VHNXp0fl5dyRtGHdsudP3/wk7x/6+Ul/5TqMaG6IPGigr5LhKD4Et0yJ0pnnAhHYORWEbYlWKls8uD85P/dkQiOMoPUmmdQHakg283uok0hAixp/vbMdnRYZ8PV7h1NlWwBgJZKSeq99tMHMWou6FZKPGddvMC7IumA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:16 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:50 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [2XRlhQ/vds9JT71qgfinotu5m0wut8Txuu/ZZvRcdNw=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-25-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 75269189-6050-4d27-cda5-08dc71fc61b6 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: mo3RbaRZkkCLSfj6iSmC8jdJkBhmrtynbb1wcKLEkntzv0Xr68+YcSfHr7SqtxvjPwVV11D7K0hNBuxXk7pn4/gHBnLS0MJJO6rHb9oEyZw+/V6VSPmgkOMPhWzs+EqashbJl0NLNPCkNjfk3nsKfTQ/ICVbXI3oxL4wL1MZxZMR4v7iiIgfHJVxuRwlQmi5XxU6LrJtC4eaLy0FBQIhSOpDfhnQwKnygjtGS/YXMmrggd7uhMGguXO/uHdMEHO2GHuuifacBVFfdaIJL2Djk+1aqT+1iLS6DsOJjillS9DKqQaTysV0YxFpU8HQwYCZn5SVdFJWfC5/VR4mbWUGa6ZOyT4FCrTPTQ7DtVvxvCNSLFyCJFZ8u6pQrcaQB95buZ80UhhgwU+8EZCo7yj38/4eneyHHt1/36TbCreNZaG3tlJAvEBZngH+OpfQQVdGpfY5lUl7L6xny/OTYSoBOcYQOLxBgWLJkqbFh4F/U9O1UYOO+YqEl9oGTHXvBVW8Xdz1y5zEyumapOqzblnHkN+t13ebrqgYGM3UsYY27ziOZY0nA4I0HyvHAG9P4ICILA8iUGuzIlJHzgDiUVeH7ZeFepIOrPqlxlsb53G8eb3yCOSdy03oFsh70jsdigDN X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /nbAtFnBmFesFJ3fXNBbl5+ry02wZ89pu0dasWQJtO/ToCaT++RJqgLrWb7zVCfFKSDVif/InUROdD+9D9I/HMbzHXjOMCSN8hde6r4yUlt3SDGlKD4l0kktmaMgrjkaxyJwgVqD8Fc6aXfHCGEKHhNvxoGXnMtF29jDcZ9rPwUVEf6d60McGZEGjvhOU5R7jSrs10oWCF/UfrH0Uml4BV5udDySiPM2s7K0U72UqH5W4zbfq/yUuWN51At45EOYiVBGwMeRrvJlGf2lIppX+hJKu4wpRPbRmISlZn7H8r6oCeey2T+E+gv+clL4d+17FXR8zpvq6bcrNl/SiTaH2VmiecNxoks0yVlmY1M+mD5pBvMkkGxoLNTCfXaJxgsCHwbe3vJdt2ihJ6PDurThqc8ctJuqPsdEI2uQdHCMRhG8lrZ5xfmTsn8Vg5QE+vXn/lxMOA1BZwGXNBl1VUMQhmEGvkJKhYds8xTPiO2lCJs+8HX5TU+Q0pdRwTgZATa/AFWrT9gNyfowo+b0k8MAFzZTATfACIORL68ujVofqq0LNLEJ6rkkL88lwSEuFePUwaFowBQN4g8dMro0hWfKaP0r9V+qjuvOyn6Pj2Lehp0KdG6t9Nju9SyqbU2MmwVoNB4OFZkzT+svh6etyK5guTF967N5m8PIzLxIYUxeanwu0gnGBVToxOFPJ9cVK0p1jqYxtwq9P8wtcGVdK0qI4VyisskTw9aFqNwoEr6xXraq9HMjMyxZnLJzep6Kn46AgCyQ0qLWbvAsonx4/qooDHNK2D3rfWC4uDttkj9HtNhAM0W0Kr3HAIs2bR7d6zQNOLR1PEfhJyakivGgh2Q98ND2YLCYFo+uU88G3AgAS0eM+qQgI24Wx92O84ubbkQF/liCvmuwdFNa+rQ6Ao7MaW8VMyE6tX0KBhO0jAvYpg9SpNixcoBUXVo0o2xYxtewcwnFuxKAH/vaqz56NiM7xLiFVR8RBVvOLlkxPtSUmNhYtjNyqVtj6SpXosvR+9QJyT9G0xZy6qFUMHX/ZJxTHLKBZ40vEg4o4nLXwzOUvfhgq6qz51X8r5EO614ECt1xBZtmPkm+TnV7W7K47KEQnUvMoIny5zILT+s6AXGSfRObHI8aMn5QjMgxzyK4o01uatmkAh1UV4qxqzWuaepqqPgKA7GiplnErpYGddDgmAaduoC0575CYIt6VjM12A9FV2hltU5NFqO3QvRh5KChokdPnccrcukcJXlgWZI3Yskl9A5YJ1+uzm8BolxsDpCuPyeGWFeAHCxCYsQn/IQJYQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75269189-6050-4d27-cda5-08dc71fc61b6 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:16.6547 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 26/71] avcodec/h263: Move encoder-only part out of ff_h263_update_motion_val() 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: 1v8JC88IHyNF Signed-off-by: Andreas Rheinhardt --- libavcodec/h263.c | 9 --------- libavcodec/h263enc.h | 2 +- libavcodec/ituh263enc.c | 14 ++++++++++++++ libavcodec/mpegvideo_enc.c | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b30ffaf878..3edf810bcc 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -91,15 +91,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){ s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x; s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y; } - - if(s->encoding){ //FIXME encoding MUST be cleaned up - if (s->mv_type == MV_TYPE_8X8) - s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; - else if(s->mb_intra) - s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA; - else - s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16; - } } void ff_h263_loop_filter(MpegEncContext * s){ diff --git a/libavcodec/h263enc.h b/libavcodec/h263enc.h index e45475686e..cd5ded1593 100644 --- a/libavcodec/h263enc.h +++ b/libavcodec/h263enc.h @@ -36,7 +36,7 @@ void ff_init_qscale_tab(MpegEncContext *s); void ff_clean_h263_qscales(MpegEncContext *s); void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code); - +void ff_h263_update_mb(MpegEncContext *s); static inline int h263_get_motion_length(int val, int f_code) { diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 4741ada853..87689e5f5b 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -688,6 +688,20 @@ void ff_h263_encode_mb(MpegEncContext * s, } } +void ff_h263_update_mb(MpegEncContext *s) +{ + const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; + + if (s->mv_type == MV_TYPE_8X8) + s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; + else if(s->mb_intra) + s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA; + else + s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16; + + ff_h263_update_motion_val(s); +} + void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code) { int range, bit_size, sign, code, bits; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 4121cc034f..1798a25ed9 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3314,7 +3314,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ if (CONFIG_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B) - ff_h263_update_motion_val(s); + ff_h263_update_mb(s); if(next_block==0){ //FIXME 16 vs linesize16 s->hdsp.put_pixels_tab[0][0](s->dest[0], s->sc.rd_scratchpad , s->linesize ,16); @@ -3440,7 +3440,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ if (CONFIG_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B) - ff_h263_update_motion_val(s); + ff_h263_update_mb(s); mpv_reconstruct_mb(s, s->block); } From patchwork Sat May 11 20:50:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48753 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298742pzb; Sat, 11 May 2024 13:55:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUINNFxlL1DBjEvjPpCyaDv1YtdWQY7pi8snse58q+TkHXUijw7xnRPsyoSNn5yRXD0ZffTmqmgrK4mIbeUcv/ANmOEoHZcju6o/Q== X-Google-Smtp-Source: AGHT+IGHtCFBNXFJSfrrxrLn5alSqYL6YS6TCp3+iJf3edb8xhG7TIg1YvyOsG+lJfn5ey6tuerY X-Received: by 2002:a17:906:f6da:b0:a5a:1ba1:1e7b with SMTP id a640c23a62f3a-a5a2d584119mr374494866b.19.1715460939871; Sat, 11 May 2024 13:55:39 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17ba6afcsi326321566b.686.2024.05.11.13.55.39; Sat, 11 May 2024 13:55:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=V3XinbFq; 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 0471868D698; Sat, 11 May 2024 23:53:22 +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-am6eur05olkn2086.outbound.protection.outlook.com [40.92.91.86]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F0A8C68D5E3 for ; Sat, 11 May 2024 23:53:19 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C8n79ZBuuBY6QlcBvOFJWfIWLOW0wulJkXl5wvMYKu924EcfA512Ih0eSZU+3gHOinw3bV+5iexSZvZkA+I8w+SgBqYiva6NYozRFc5uReHMDr0mCAihTqbT/RRjVtW6EcaGI5G3H/yF61NXNcvK0dwiBoq5iQmFBe6hPIMA87zjiJP3h/htbUpAP+/5QANrixHqb0HzwSoaDfG2nPRKqjL4hv6zz5eX3FvzIdf6EAV8E+s5vnVOjSJRNMTa2vCI3mahCCSI/Uh+k4T62OWBnLPsUyITpm14NPKqAP9X+NDKht2I5N6s/LBpWAT3enKVllloAKnc0qyxmZqjWusnxg== 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=X0XwgT065/dczRgJqxzoroTVOq3YtYkaepJrDmD3Pj8=; b=GDnJDcTkagrh56G5t0EPoCjzsoyPQibf6w3gJGDRqXgxqyF6Eidouugf4muaoqLVQMiZUhk8TJBthQ+lydv+V7bJ7QVLYXfRd/6KGHoCiv2CGfAH9jKKjuABWbiZGDOkuFN/ukIk9h9qKXRsXlSHjBmHKmFJwq8TiNeEYsysjM8IN5ZzwOa3+/tRQw87w3VvO/bczxhIR2FJBptUQbrLFSWaeAuyH45nWLHjA72GxFFSx4xfGaAmjyLdl5IWfdH3ratndWogRLkXaudL87V9f9GIVCd6Wbm2ORl47lHu3wAtPSzRy2imuWS5vvxw5YoD/atIoObCZ5wMez/1ePljEg== 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=X0XwgT065/dczRgJqxzoroTVOq3YtYkaepJrDmD3Pj8=; b=V3XinbFqlIUOE4ZzI1DUKaTx2ZVMcGyX0+97kLygZfAvXrTgIZQszEUK/U3mqFpb8/464zQzGg3E7db0085VirB2yWPlmnMlVbMvFEJgacMEp6ynbXrWG8i/+ekhBgxcrgp6NuWOS9Ind5DTIqzHdxdcDp0T7mczWW8IHNX5B8MQsl+VY6jmzvYAWuRdiRC31VrDvnGG0wQ69jTKUJUkCXp7XYVK/KTFFk4T8mdxY5W9OkNW/EfFn63yJZHuEWae9t8a8smLlRIDYOqS1IhtcXbG67wV2l7Fh0bCy/y5ldbKND0ffJVREX8Zn3RnYMowo9CWzyqf7fR542oIt4jdFQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:18 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:51 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [p1PfpA0bmN+hoxph7Id8Kz08MsoQ9ljTHHFviqej3ks=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-26-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 79af0eaa-348b-4e27-aae4-08dc71fc62c0 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: cshSAr+mH679flugZMDezB7s+Tdf6T/VBZLxc4l7dpNKssCHaq8fxPpmXTfIjWPxmobx4c/bVYXncjafFtWULlPLwU8nVflboQK8kUs9B8IZ/UE6nRInL1AZHKHIm9Wo61ciHZc60CUbuY2gLxp4JhqU8x9IkC3Lwl8Xe+Lrf2HSplJG+ZMyh2ZDeWdSw5RK7RkIzO7gOnRXlcLcDdeZ5i/6+h4gcrWJ9aCR1PepJhUiNFgF4h2zZK8hId9Duua5Tn9bEwqf2KmKJ9F+BKcf4RqzVBcyOIAtWrKyLKs2hmodQ940Nur0As+L7K7OsFe0NsrLHTfUYx9wg/6B69MhORsjsGmC2quzAK8Xpc3N3alQxdWstnFsol1uqyBNKFiGWCwCJIfc22S2XEv+m69ArBVkPJpCRFbqlIH3sx5SwdgVo1Z6bczd881AXxY4mbKFuF572AzCsax3a0xDz/D/Nyn5NNaMrNsPdnkCREDipeqzLbKZdJfEWDwElF4Eg/pvZ7uf4DZ5F1LsCP8elTM4X6utNX+w4RdFHnOd1t/Wswx5xPHm4LbJ602N9k/ryQd5usumICeqRBW3Iq/kqWVp8sEreAJNvCYn76U4V98xRnqdD8BRgfMjc5uj8aJQ8Dog X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7G/UKURqP5YNlSrbmKOh/AJJJE7/zTA75entQCOlQiaEuvxZPLyj/SgjGtZa47WfgorUJZUPu9LJzA3X7pml5unYq5LPXHdcQartji0m57QA86uhUsbQYvV/MGL24swHGVbQ0uPEuEKrFDP06AIhUTvXKbbXCfk12afrTL8Gn8hXKlcLsumuhntKeGzuljWpOQ3MBFE7bTScP1TAmr39o2ygjVUN4BDhaviKjg8MiBepxP/iccggz2eGVPdyPHO1qUb1wOWkujghopcefVSIVHsOVhyTYu1cW2gHLpe+i9z7rRzS7JryhOUuX9s4I0TtYSDzVv4B7GDOIUSlFNXRsed6oiSN+CqrPY4Ql2bKeimeNWG1RFh4UgM4CCOSsjTlaDY+DnEZTKpiKMmx58RU6C0pSMalHKsxKVh0rIz1EwZo9RKyTEXol9LOQGw9QGZU0sB23vM4uJFTfAihX28YqPQVarT98pE0AAOATX1zW7uhGAeyDrCXavwO6yzuR56pJt1Sz4/zYlGBvnk33JSAjATb4pTBQ0HzNyvvrZqV3fB65+OJM+HBnwaj6bBXsz3994Q2d3BQtRWNBzkHAZ8wTDqj5T/bsZWY8bB0eB+kZ/WWAnbwDegX40kOboJLVPYYFxk2dfwVYdwtiZZC+cfCBQpS1T+5F9hJ11ui+K2NpSKnGSFdszEzPubO0BCUsiyh1d5iGYNlpZUrw96GO9dHLoVdufultdFnSAK93SfUTKJ1t1QfyyLh8tBBR2y3X/35Js4Ce6w458UWrMNBpjrBCo7WagX5/DpJae1Ku8+DVVrPed/4vTBLYbSTnq9BstXRueX3iAjRCGIR2rv/C+vEWGvfSHzmx38jo2oZ92DoqbmnLF5oYyb3bzvyyEtmNpG6ZqZsvIGwqKI/GssH762E85G9WPY0/Ce4+WPB93XmtSSH7+TqNVyVIFqOqVDyg/wAsHevl9PdGK8S3ISTMZ524scxxrfAhKL51z3IUtgBmLbxWVWLCjqUwJJ01umhsQDCI6uC8s+uPpjiGH3GLXRaCFqM/oRkJxCA0XxgEF85mZNR6jqmfVArdwg+dGTCXdWh6TEYOJg82682esYCrQurodNaTjfLoyuAc3ovmEyRZzh29cLwIz4mRMnUnPTvD3TEnWb+VRL39XceNS4vz1LdMGMd8zCdCXMLR44464uyxtyTGKV4hU5KhEortS8wkC7sUj0/FVcevWLt3qecFSavYsqLAQPC+BkQP4ZGSm9hl96dcE388vKgHri2RlBrFzmKj3aZE00CQoFY9+8UCGYNDw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79af0eaa-348b-4e27-aae4-08dc71fc62c0 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:18.4709 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 27/71] avcodec/h263, mpeg(picture|video): Only allocate mbskip_table for MPEG-4 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: IeUv7hz6Gcdu It is the only user of said table and doing so is especially important given that this buffer is zeroed every time. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263.c | 3 ++- libavcodec/mpegpicture.c | 3 ++- libavcodec/mpegvideo.c | 19 +++++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 3edf810bcc..b4cf5ee0de 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -56,7 +56,8 @@ void ff_h263_update_motion_val(MpegEncContext * s){ const int wrap = s->b8_stride; const int xy = s->block_index[0]; - s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; + if (s->current_picture.mbskip_table) + s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; if(s->mv_type != MV_TYPE_8X8){ int motion_x, motion_y; diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index ad6157f0c1..ca265da9fc 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -138,10 +138,11 @@ static int alloc_picture_tables(BufferPoolContext *pools, Picture *pic, if (!pic->name ## buf_suffix idx_suffix) \ return AVERROR(ENOMEM); \ } while (0) - GET_BUFFER(mbskip_table,,); GET_BUFFER(qscale_table, _base,); GET_BUFFER(mb_type, _base,); if (pools->motion_val_pool) { + if (pools->mbskip_table_pool) + GET_BUFFER(mbskip_table,,); for (int i = 0; i < 2; i++) { GET_BUFFER(ref_index,, [i]); GET_BUFFER(motion_val, _base, [i]); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index eab4451e1e..5c6ec7db55 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -594,6 +594,12 @@ int ff_mpv_init_context_frame(MpegEncContext *s) s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed? +#define ALLOC_POOL(name, size, flags) do { \ + pools->name ##_pool = ff_refstruct_pool_alloc((size), (flags)); \ + if (!pools->name ##_pool) \ + return AVERROR(ENOMEM); \ +} while (0) + if (s->codec_id == AV_CODEC_ID_MPEG4 || (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)) { /* interlaced direct mode decoding tables */ @@ -608,12 +614,16 @@ int ff_mpv_init_context_frame(MpegEncContext *s) tmp += mv_table_size; } } - if (s->codec_id == AV_CODEC_ID_MPEG4 && !s->encoding) { + if (s->codec_id == AV_CODEC_ID_MPEG4) { + ALLOC_POOL(mbskip_table, mb_array_size + 2, + FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); + if (!s->encoding) { /* cbp, pred_dir */ if (!(s->cbp_table = av_mallocz(mb_array_size)) || !(s->pred_dir_table = av_mallocz(mb_array_size))) return AVERROR(ENOMEM); } + } } if (s->msmpeg4_version >= 3) { @@ -642,13 +652,6 @@ int ff_mpv_init_context_frame(MpegEncContext *s) return AVERROR(ENOMEM); memset(s->mbintra_table, 1, mb_array_size); -#define ALLOC_POOL(name, size, flags) do { \ - pools->name ##_pool = ff_refstruct_pool_alloc((size), (flags)); \ - if (!pools->name ##_pool) \ - return AVERROR(ENOMEM); \ -} while (0) - - ALLOC_POOL(mbskip_table, mb_array_size + 2, FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); ALLOC_POOL(qscale_table, mv_table_size, 0); ALLOC_POOL(mb_type, mv_table_size * sizeof(uint32_t), 0); From patchwork Sat May 11 20:50:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48754 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298784pzb; Sat, 11 May 2024 13:55:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUMiM2EM1DuyQ5qDKqzZHYSt6GoBukMIYfU5rjfkVFAJCn15IGo1qYw2oZGmmAU+0lkpBbsbsPZr786tIGUIoZ1hMCNzEXlEKyUVg== X-Google-Smtp-Source: AGHT+IH5zXckGj4V0j85jjaKkgGIp7eLt1in665Na8SmYXFJPVJ+IbzUEI73bWFhx7KGHanZAXnw X-Received: by 2002:a17:906:a203:b0:a59:a8a4:a59f with SMTP id a640c23a62f3a-a5a2d5d55e8mr207869466b.45.1715460948873; Sat, 11 May 2024 13:55:48 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17c2c8a6si348067366b.1029.2024.05.11.13.55.48; Sat, 11 May 2024 13:55:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=GqZ3sx9W; 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 2B2A868D688; Sat, 11 May 2024 23:53:27 +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-am6eur05olkn2022.outbound.protection.outlook.com [40.92.91.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A7FBD68D5BE for ; Sat, 11 May 2024 23:53:24 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nNBs06ewDdk2PVe7ZzX1VnHwg7yufBlec+mHyKIJxkXWzJib57vkdMRmLtsFLTK+vthLoaXh8hkrjezditUOisCiTDIInEykwNsKdcTRUMl+mHgknZDpUb5Ioza5WyYIQ5uFfYxaRdWAgyczXPgjnKdaSCpWE6heqHoVjdWhvHclHRuDXo8O8K/KXdNFZbq1GAn0ikC8mSWBSX1aap+0r62Sjceq7rJqR6W1M9eIIDA3+u8WXNutfa78FB7yuzj7oxSHy6BW+y51/O0gqDEOLI1Pd+aVirOoCCjKvgm/cvZxRR5+//yzkYMNFfTaFGYRWIx8WTH3NKkC2p9edwe/tw== 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=c7WEPp1mpN1w7jmEt3F3BjBZp9aL64qipUSj7aE89IQ=; b=NCj+BD0qLrpolRH2MTI83LULK9lN8/0FUyXlaELmIYrLWWxxc/tCRHN5qqVIGUuzMWpPUm5x2djnHrynA8TWmGJXBngku0LcoRrEMXU221ZPc0kodgj0CxypAt8K+Mk8tuxs7Wp0dFAtIw5Obh7fVOVo/jab5Vhx/Ch48lYp0tP3kxkvlRLskvHhGUg2946/Ra2kgEJHuNyVKq4uveqC4/z0AlBhLQzLCAhejaIbvmmoB9JRrikQawaeq2mhPpRp3f0Q1+RV3Fut26IF+e8uE+pFJtvgnH0Fba7Q9xsiQvTaOKdZzBGRhNTy1r6vCrsHNmZXZYWcm1jdvic5+yqHFw== 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=c7WEPp1mpN1w7jmEt3F3BjBZp9aL64qipUSj7aE89IQ=; b=GqZ3sx9WSnWml6DosdBd4ZfXwGyHaMQGIjI4oOE8E5bOTfLpbLMGNiyjtGzP3/grzoZI2yh17sPt05ZoEZ6tvQI6swy54KIpLqdriaTuFEp/fnGoq+xU0atWh7WFJkUjuOyXRWjASPvBye0MeL1s98xxAIDR4jPzQHQc9fXafjiOWx5AvgRFcOPj/NZSRPWuUzRmpXalpVdI+y6mAhHslZnM8RLTl4eumBbJAiT4P6GpH1aXE8KsEVWKyqOdcqu1yOl2EaNZAxwbbLXrjPtaqzwFN6ePcih7JC+ZCcbg3HlE5WGlbJ0/5rzAIlIZoVULElc9cbOg9fP4pqcsLdikgw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:23 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:23 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:52 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [DckcyNe33UYGfUyJO0PNZPSiDZs3ew1xbwhJ+lSbmr8=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-27-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 8896905f-2e79-4cca-9df1-08dc71fc657e X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 6mxeN07dUYq6M2Xos9+XNdTxA8fsCkv1+MTwMgSldd/KyZ+YnovYaFZ9VHuHx5B8sHW4470Ae+W2PWVWeYrV6k3WnPJSstwm62UGqcN5WXU/VKK1Op97OH6Up1NgtWJnajsxT+nwAS0OCRdNtm0pKa3md34UN3CoKWNAeXA8mf3GVirszIw78ipieO6h7Wwfspbs76lM1LJXT9j9QGxEVxquhItx9oqsgYEoa4qsCWdktEELq27n+bEzQddF8EMoKUV0asUyFpbeLEOvbHZRCVt06EkXWFfB+MmMHsTFyenrVqLrxRT3XVQGRqRF2mXQJGX8Y58dMW5loirCbAmV/OVbOpXGC7Pn/a8dzq5Falg4RCb/g1UKeFEfOK4/5KEzgz8TMGNNk7NYGyOFz5f7kuUMInOLYgut0wTmBvsQqQjiIpCehWSAEybn/n2IE4G2dJjHmZNq7O2MpKi09iFrYGROncoEMwJmFX1dglTIMHIIM3QrSPmPp2qKwPfRO/z35v3n0uvOJ2P2bN4zVIGn3CIBJw7VpBT31fzLr6o0iPeEETRH8GJ1+E7KAvfO98olmArJabLfWuBl7ekIsB9Zn5O98Wt8iG4sbO0CsmLaYhHzQeeBm/lbtRqSMvcDVyXF X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lfz0FauqjniORzF4PHpvoniM9ppDXg8f6Mam6c6xrPa/wAhkeGfDSEL6lfDqLThw0Tx3+wMrh1B4V51uNeIJBE66sANUOTRDxp34rj+Fjm7sQpofaFcY7EDvDc7+FoFGk3d6UhQlH/dqlE/potyPtV3hWfK0GMH3hS39dvtTZ8ZBO8Q8QonQEWUQYJtmkoDLumP11KubmZ6h3x4qnXX402Wlm7LuhEru+Q9Bfwoi9cdzQkiOpfaPrp3PoNbvtKlKj+aYqU9a+DQmQ6bn6/x3uHGKhR/FVKkfWhdYJRV+b/nsdCjGlcmEIiqJC3wspH5RkEipfIhBvSOdU5QKhARW1iO5E8rvqfu/l6pbE/1dvGgh82AlLhgbZHeM7xGDSOwTRuwAyEPO4t1X1gsE3qCom4EvNhlmA7G+tObVw38C2rkzmOmh1XvGGpyDFztGAarTUifyvsJQgU7U5fe40Y/dkh1SRoF89tjzMqtJRD4ny66bUrKpGYdaK75gv95utQkdiA4E4N/4pdpNoLp26LSaiNHZFQhJX3VOgb1ko8o8vxe4SFgNZxWsgwUlohE2Ps3MvTB/Sxz21DWittJLheXXldOFnS49bp0DHsBM3VwtPKxOVRGBAKu0pFZfwwq0Xnnbarn41u+oKvXxg1Nnt61a9/mLmy87xSWukk573xJSu/ez0UOvTTa3twDGUvKz+4kGBYLos8I/emX7faULpiUPKd/gSoQd/UB6lz0wlRvUOfC1h23sUoF7SnoTM9SlVHNlCeiTnx44Ia/igB7msrCMo7AlbGtgDHXH5+MUQv3gWL9MUWZAMKz9ph6QB6/GsQ8RerWUVoBz/SGLHvR7P2bNbifngfzjMPIaa1JTC3T7EYEYCpe7ylGqid0HfC7wwnZ3k4G3FysIXInQkDCQioxsntAbtPrpSneYGNg/OYjwDdUr/TuDHoT4rTgForVCph4RrPjK1XLEnpEbV4eS8JZj4SJfpBKIAFmKYVb5YWbneN2CeyiYSsNC8YL2YZgb/ZURJUT03SlsgIJjQ+7OLQdRHmrFul2o64ToyQarYHjn5aNscS1DV3EkTtptNMmeGAAk1owu7vTz/wBqXJAusECJ8B4m0Ky5wW3miSIwOdH1wSeSmG9BZ5mzryANmPLGSOSppL6cWYwLyffwHWHnms9KE/23jcKuwD8p2Vll7WofoW6OmBexHPW95lDTafxenizPlkMZYUYuDd+Mt8sJfmAr+mfW3x+sNzEpK6W/ZmiTVco7HYzUzejmFqH6ZvkrbOIwmIoqTTyOud/Z96pnBHDNjg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8896905f-2e79-4cca-9df1-08dc71fc657e X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:23.1319 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 28/71] avcodec/mpegvideo: Reindent after the previous commit 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: liiiy363IxBU Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5c6ec7db55..d82a89566c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -617,12 +617,12 @@ int ff_mpv_init_context_frame(MpegEncContext *s) if (s->codec_id == AV_CODEC_ID_MPEG4) { ALLOC_POOL(mbskip_table, mb_array_size + 2, FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); - if (!s->encoding) { - /* cbp, pred_dir */ - if (!(s->cbp_table = av_mallocz(mb_array_size)) || - !(s->pred_dir_table = av_mallocz(mb_array_size))) - return AVERROR(ENOMEM); - } + if (!s->encoding) { + /* cbp, pred_dir */ + if (!(s->cbp_table = av_mallocz(mb_array_size)) || + !(s->pred_dir_table = av_mallocz(mb_array_size))) + return AVERROR(ENOMEM); + } } } From patchwork Sat May 11 20:50:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48755 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298835pzb; Sat, 11 May 2024 13:55:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV5CTmj1baLSIYCQ7xBRaq7YXEenusCIwOA2PXGIxF2krRwG8gU2u+u4Xos91G3+erF+uiC5fGLRHKN5qZzrMS7t1WGuIlBB98spg== X-Google-Smtp-Source: AGHT+IGwDJHyQutwXGCGFECMVqTCrn1M+Z0EI4R5Pc9qzHRKLqhYPhrye7jwHSmrFDdFpYuHYkNu X-Received: by 2002:a17:907:10d5:b0:a59:ced4:25b0 with SMTP id a640c23a62f3a-a5a2d5cb153mr582469866b.34.1715460957898; Sat, 11 May 2024 13:55:57 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17b21c5csi347762666b.351.2024.05.11.13.55.57; Sat, 11 May 2024 13:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=PgcyR1g6; 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 56B3F68D690; Sat, 11 May 2024 23:53:33 +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-am6eur05olkn2091.outbound.protection.outlook.com [40.92.91.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5442068D6B2 for ; Sat, 11 May 2024 23:53:27 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y6Pf0rcV9mUCeCRFZi5qjYxnM2euKnwErURoIynoGdTohVRz1dbOQv7V51RzCvuSXmgK+120e+73ImvXHH5dPZ6w8V8Hz40WlORjy8eyLikQ8mIg54xvlaF5M+/+LwemvxompegVelo0Bs+eYEXGdYF1Eh6NYpRAs4sFQgyOxG6THBrNR5ilFI3J18pQJqUkM7GIaC6847qqFpq41JFew33QUx9EB++Xxv6IWEi9ceE39Xs9f6MENDNYSlSEiqowdgtHFRJ4sbqHHQ1q3COL80ES4WllGZd6bpkaRyRejnT3F1aUwpmNTqkzrM68HmxNgkz2VOUWfgYOFYtHtHzMIQ== 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=kprnqjeqTQYHR0d0SHGr8U3mOfH2tGNeOSi9Npv/AWw=; b=g0rU/p/gKdyArR4UAq97mndcZX+orJEIVAaIjpXoeSv1j8wk442np065YbcUS6srhijs6PC2IMBl0+UFzs7NY/d8c0HEGaEHwydHpyr35I6lO97ZupgSI+uhYTbNZ0HTZx0+aF1leJcVvOEN5JpIWuJ9A3/Ni/ODnMVnInxAZPDDPypgdxnUbkpAyKEl2Q4qiwe4JLI10sXeP9mHhqa4QyE5Nmqp3jvo+nQpjCqcGqbxKV2wkP+gnu5zLh+uPFq47kSUhMK/DspQHlucN0uTueeO1W6A3sfvjrDDD51zXYT6P02ClK3DALcBx+nUhsBplq8LxpsmUK5sCZ8B+0b9Eg== 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=kprnqjeqTQYHR0d0SHGr8U3mOfH2tGNeOSi9Npv/AWw=; b=PgcyR1g6vBg5vg1OBqDMJU8EJFfde+b9KP/SP2MigPoZ+aRFS3yF2+zVwvidVVOZVR6VX2rV36a8aOpxUugwS4owOVGkkIACeEGnOiXe58OE/og/8jBbCItDK4OXKlx9Oa9RR2C6t0DsnLZTe3KgnSgbaky1y0GYXietMzWWA5iLu1jXEqNC8XOog0Ag+LSmNIWIIZZNNoFnIqrwkinDQPCSX3ZtOtK/pohpVZzJxxApPReK7m2hvXxOp0XLOJ3VVjF22iuiO7WaFSG8ZoIsZeahWQk3R8cCp0NlMa2FnoYkMmUiSu+JNAL/gIywOu03AtA+e9P2N9vT21vUviWqBQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:26 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:53 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [4kg+N5qcC87T0EWkf+A8NhqckEHTdqgSatLGJOUuYgQ=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-28-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 96c83c31-fe69-4aeb-96ff-08dc71fc674c X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: raDFJN1UZQbPMUOAmHbD+zW/XeDCFczPj+WR50ysnidf88Oz7m/e3C2Lmy35jjplwNEtBP3VQHMIFP05De80YdWy5L/CZY1DGsSqH3m+sGSEIghgKJCBKs0PWxRU6JGonll0SKaRBFzmuxuX3hwM68EVvDPE0vXA6gRqCGbHkopgkZsbUHx1ox8f970Ocw7uJG/zpUZY0tRvC++YxUVbNHOrXRWj3mMfK2B69IBM0+EOYz5GhAFUc1PnZvxp4UMycKsWG/KrlsKJjF+UzmVZw/wsapi8h5veizDf7pQutcgOsP1yiJMGichDkQeWKrhzZlPIPOozbMMi5oBmU2KfHH5V0dbrkiHZxNBcSMGtqELKQnbitZoPRcOoWycZWg/x6fNV6/tVHgCMdYBOUBh7q6kVaBgG3J48HiwYKW84y/XbvVH+Jm8fkcWIuoNW7g/+Xt4WN/p4RuLlKvZwkQzmGPr9IY68yUrDxPsjASRqSrBmEDW4XV8bub8DXrIgKcrLD0MKxm6wzfXoqo8YhCuKex983lgQlVyKbrUhKVLiErT+SKfg0Vikm6TO8s793XX55mBw5sJrMBDvF+ET7/EiU7lZIzLLbqI2d/OLLlUz/y7JFj+u1z7Y70j6nK+5+iy5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aDM06dYVuhGpCn3xBJ/Q1e8NfRB5bzWAR+FFBg6LQI1MJEt8LDJSVRS3yvwqgs+MxhT621Vafe8jV3BI3oc5Vgyj6kX2QO8meBfKZd8vGkX9x1LRLzB3PzVqY5XdulBwB0Ot2mtEQPHcmFmCn6o2hj5yFe1c63rH9PxeyKEVJeoHx0htnLoosAyMM0aHGjvpyfYx6tBbIfinxM2VKzFQfEfVNSm4aC2ZI1FJzdi8sA2Bn/5dfPU9j4AWiDKMP322aYEm2qLfEUw1fCjIvUpui6y1028TqSq9OkKoAg9e3jpTjpi3ABF0RjJXYa/IPXk/Q6JHkzlk0mC0xoTTKu4Dm+Oiyi7RElSCXRJuwVEZ2/lexZZblVh1QRAvoE4xNZ3eONepQlt8aeoNvOmqOY7zEczUYZjIjaDpAuTA26Mo3zb0GYdKi03gTVxaPKOzfwZtesSoWtsTP+8owjUVHhlj5deXjW7OBqhDp0OdADCcy0hfH0xL7Cx4f4O1JV2KYk2Zrae4NNWidS9gtH3M4iz5ZkIOHrjpqu4iRw7jcMgz3338lmEFt1M14t/aGu+B85zjY8legD/p/+qZBscW0X3l0lqG9LyUoHBPZxN18AXjL8CMNY921bzr6/JwvbR5PWBbwuEIj2M0T9wEsmVTou1Uf1SofANLFM3RJ+GAvhtrP8E30LTDTNTaAlhN617MJI/3+mvQ+NAfckYNYEsqa1XNMKwfPIxWGk0kXGt3K8dauzPTgr50WYMr69xMvPV6pZ/Al0fvnN4wsn5Ry+9Qg6tZQA3kEm8oWJhJnzO8nACWI50LNilp7fxkzz9hi18PMcTgFXbv6hqn+LPYYeQ/gJCkvRs4eA3O+72+q9BEqKq57MOM1KT8gf2F3XN4X/nzaj6jvwbAb9ocmmbfqLsGfszXNoSCVPER2vKs3klyRH8ZnE7zMe1Mp/pgghq/bPJG991d1w09B6GE7R8iY4s2jYWqT+wHu6Qg/8EUJ8aiBydn3cfqt+hFZfYjE0G0LZpk3TVE2W825mM5d8O+AGCC4wkT0X40hr4DuJ0XAZu0EAT+8+jsUy1+HCVCQkm1E42sgMN7ugjVfqYiLLd1OSKO+JZ22rQgtMftgQZD9ESlABMlvltOdEBRrsid8mzCOi8ZlfO9sy2sC06UcIe+KQUM9q75MN0NNMx5zsATPUw+9fkXxQH5iAJ89BCfoPLrCq0a0iIIL1hNq3+4DyheEQ0ysEafrc/IjDYfSOXo6hWia8KMsGw0oieFI0oM95IE/GCo7iZJVXXcoVOg8wyWrlnEF76ODw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96c83c31-fe69-4aeb-96ff-08dc71fc674c X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:26.1027 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 29/71] avcodec/h263: Move setting mbskip_table to decoder/encoders 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: UeXrrC8NyY56 This removes a branch from H.263 based decoders. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263.c | 3 --- libavcodec/ituh263enc.c | 3 +++ libavcodec/mpeg4videodec.c | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b4cf5ee0de..9849f651cb 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -56,9 +56,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){ const int wrap = s->b8_stride; const int xy = s->block_index[0]; - if (s->current_picture.mbskip_table) - s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; - if(s->mv_type != MV_TYPE_8X8){ int motion_x, motion_y; if (s->mb_intra) { diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 87689e5f5b..e27bd258d7 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -692,6 +692,9 @@ void ff_h263_update_mb(MpegEncContext *s) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; + if (s->current_picture.mbskip_table) + s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; + if (s->mv_type == MV_TYPE_8X8) s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; else if(s->mb_intra) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 6a7a37e817..482bc48f89 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1592,9 +1592,11 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) && ctx->vol_sprite_usage == GMC_SPRITE) { s->mcsel = 1; s->mb_skipped = 0; + s->current_picture.mbskip_table[xy] = 0; } else { s->mcsel = 0; s->mb_skipped = 1; + s->current_picture.mbskip_table[xy] = 1; } } else if (s->mb_intra) { s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]); @@ -1676,6 +1678,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mcsel = 1; s->mv[0][0][0] = get_amv(ctx, 0); s->mv[0][0][1] = get_amv(ctx, 1); + s->current_picture.mbskip_table[xy] = 0; s->mb_skipped = 0; } else { s->current_picture.mb_type[xy] = MB_TYPE_SKIP | @@ -1684,6 +1687,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mcsel = 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; + s->current_picture.mbskip_table[xy] = 1; s->mb_skipped = 1; } goto end; From patchwork Sat May 11 20:50:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48756 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298878pzb; Sat, 11 May 2024 13:56:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUtXnVUitms/GV445TsWyzuhL/1KeFMxOq9IoHeKdWuizBFEtaRniYdkBwrgzlEIoOHiBdQ+PsBO73kOli9ywmGIYXDXvQHYcz4dw== X-Google-Smtp-Source: AGHT+IGejfsS2vPJ1FvwVigX6muDDXf6I/8EqYznfQv1bzqMMEAP8pxBWLEJbhnwxeltxK786tGf X-Received: by 2002:a17:907:3f9f:b0:a59:cd46:fe89 with SMTP id a640c23a62f3a-a5a2d665690mr464788166b.59.1715460967623; Sat, 11 May 2024 13:56:07 -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 a640c23a62f3a-a5a17946049si339975266b.103.2024.05.11.13.56.07; Sat, 11 May 2024 13:56:07 -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=m5l9JgSl; 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 A2D9668D6B4; Sat, 11 May 2024 23:53:34 +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-am6eur05olkn2091.outbound.protection.outlook.com [40.92.91.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9322668D6B2 for ; Sat, 11 May 2024 23:53:32 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCAHDNUeml7/l6fPpoCSDxCdl8eF3QG2YKqpcY3YKkQKwYmFdnviRjZqJAwlcaS41j/V7jpEH78KsDSQmnHzQAOBGsr0Abt7tNgYRN5onSkjB3Q182cfD8p/lQYOuNDqaKimqhd1uxnrghiaXZQbxkYP4wuLfEYfJm4tCGo9nMBE8WivKKXOD/WsyhAhckPx3CZtU0MF3mc+5bvG/epDTwVtT93yav+rQYGYw+Tc5LBvBc8zQnF5e8V6+V/ehyhqPL6QdpkMiKR/27L2GPlk4eESA0DwalTtAL4tPQxe4N8Xq2X3/J8TEgs0xPLOH8gVygT398m698eD+hkFTRGA8w== 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=7P1GfE3RlvBmJgX7UDGTqK+WppV0sAJ918icvO9ZBeE=; b=fnj/T5d3DAg/YEfXyAtY/uyMbW5snYKuPXApacicuGcbC0iGQUcpoNvc6O6oQSr83jkS/bnzbwAPRvW67yb2htIKiBYFNalC0jIpNGRpHNik2fEU03MeLztzzvE9YuUw17qPY7BveNNnvCzIoot8zF0c9avOZyEfizVJrgl5DsNe1o7mZYrybz5W6IMm+co3Q0YBWcR5lPgRRIKQqeqRJ6nRqq4TqZfr3vJ1RxJonBKFdp7oIVAlMoDUzNFV9blnOp9MEYIXVArF5tSNokquxysSbwykQKD+aq3fj4ZVscCxibZZk78pjHtN2xy+AT7/WgW/EerAjGASHsrShLvMFw== 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=7P1GfE3RlvBmJgX7UDGTqK+WppV0sAJ918icvO9ZBeE=; b=m5l9JgSl8CSw8fLXmTPkO+6JvleLRRjwQVWeuMyonCgsoraR7ioEHqfCxoTrwx/n0gd5L4h2FBC5XWShA0TYclA6o7QZaOfUxr/KsfvU7WuBEaGlQ0PF/dabO21DO5LnJpyMTIGeDfd8gOq46UP4wmhAR2GfOs2o6mMlUO1DigNwztUJDtxbtm9s9iRHkWlXYkpltQDI6OCoS5wX3uCCauFJIUKkQ3vuV0QwaiBjl9EPzAW+txkdN8/fy4dndLkzjwKGPXpaI2qwGst2fLrI8ChnJsx3O7hBG0W7v/wKrTPKKjnmoK+NVj2JdccBi5mqc6h3c1Eu0dYJKBEvzeKbWg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:28 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:54 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [6VoAE8OzB/UwcAu6CQ2NTpM8xi3FP4Q72jn6N5jyL9g=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-29-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: e14dc991-ac71-416d-c3a5-08dc71fc68b6 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: clgO497q1+OFteNVc/D9iBlk/2ESYYZyU9edcGIH+SnWr0Hoh7G1u8NM+vRULPfwm7czJ8X9/LGoVgUptKIo7XEDSANPdGXHv5p0yhVxFhPwu5FibYsT/f1CtWeixCxwRJA2kOWQrYKjEc30YUg8pq1LMcxiYG06b7clIqmoMvXBiNZxIADGZmPkWuioSiB9cV/M5pa1yon/AjifHQv1FH23CtBU8i1enUmPAPCXHXigT2OkHIIMsdvjDQ8urgxkqELYqxnYPXVnb1mBhkAcMwrQR1rZgUPbP3Sxm76HhlQhYPPMr+4XSq6RqbfSS4RYCSBtxNeM4CEMgkSjUFerwn9mY9gquVbVwXHCr3rlt3nq8FUrQehZXSquZwCEeP10zT+DUfj1dAxgEHXsMfzzBoQiFfoHep1SymoFvdSCGzytMchP8jwubfXRQUl15nzYRVPKb/UgmKQjR60SZJjt508cE+J7DduumksNDit3RPvuXzZQIJi9FQgkbu6RwwADhNR+K5OYlcsxIyCwBu8WXUQSSonc3+gHbJ2MiRwlWnFkCSTfewt9zIx7xo5ePF79DUWuw9Z9WRYgnB1lcCkf1/taeXPemgUX+V3eErMwZdOG+BDQZrgRc5nVEeFUXGON X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cm1quDZZRymcNuN4db/uXmGtTlQxsL575LwBD+A/BUyuDNvtShDeXSRSHABuRxOHEOq3shHDXBtfK4oSVA4Ydf090OOTYWN9bDToG+hfbfqYt/EckejyIptK56fOJ+cRbAvQ73JFtHwGdNWxl125n/lZHH8k2wc6anoBNasjtHbJBK9DVOQPilkTbRWK1sl2nozk/c1FQvBY+l+kamniGmyjqjzqJ/zlJEW8mESx1eNvOt2jk3VyjaE5tfbQc92nHSo4ko5BYhOeW7hTR10KkVLMElxTcWBBygR/4ohSn7IzYsyhUu7niEZAUT7WNgXx01NpizQKfZbQFgAr5eiSt5sU6d+CnTc1qzGlWpH8GqI/UUhLCNFtsdlKbvcpmfa5z9n+7tictMX+O2rrCIZ5wiLRsGcur49XCRL4rwg9oDgBttyleJuW4FXdqjDfggUnQwWWMbGrDvey5HEouv7P+fqa86EhuxZlf3rd+yh8UBV7xTQuHJtXcS1FZzj2X6FjxQbsnnsFK+m/aNl0mUjGmgYHS6xiRd9UDYvv8phG2hNsGmW16+ovQLetgLgHpmONhZrITJQI/8JVvevrTsOJECHiT6fCk+yu4HBvAZMSCi3Z7gxJu9PzoMSffoazSPFAlwy15sJwr6GC5p/L/IbL8GeHjiShuTa08GOH1oR0kWVuHi6G7LLfh6JW1C+G1L0BbQYBu/LlrWEIDM9C922llQ8s1rqg5YWtkKLw8OtZl4akbPel4t6SVStQ/Fqp9XG+ndwm75tuL+5EtfWSb2yCxrs1uUuet9HCBEp8kZIfsEo9T2U+XQGjHTCJQ6mADZH6lontD8naLjIUEelA1U9cMhajAMh/JJWikwyXV5w9WDBTrr7cCCs/X03k5Q1dl+USqWFmNgDxPwHBKekLNBz+48on4jEWJa7UPDhnILB6isABv5ZOCW0g/tUzf75dATQmRZC45oVRs9qDT5xdveQPPSCEulZRUS/yR4vIWG3aH/fH2oC6REi0NNh0HkG3SAUD/Zrk5wmndeeBOo3f9KjXhdgsVgS68ua1mRBpvURFourXug6W+Ue+CSSsyC7c39PSx7tJiCQoUk9qwXDahYu2+ujStygkwbRNEdha4KPlMQAKoCt40mkmstFG4ANgRqQdyVcINLP5szmB1FAQY5XDwSTul/S4gMXsq/eOe2ao+UUgdFkW9vSWc+mvNWmz7cLXulilHHbWWoZ4B4c5kUl8YbEdqbmzTiCWFNPWh5GoWslhp0GGnmx6PC9TnaWho2eJXDqsbnTRIO+pa4UwjAolPw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e14dc991-ac71-416d-c3a5-08dc71fc68b6 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:28.5140 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 30/71] avcodec/mpegvideo: Restrict resetting mbskip_table to MPEG-4 decoder 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: Dz2SBpMqVcsZ This is done due to invalid input and therefore the encoder is not affected by it. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index d82a89566c..4b1f882105 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -616,7 +616,7 @@ int ff_mpv_init_context_frame(MpegEncContext *s) } if (s->codec_id == AV_CODEC_ID_MPEG4) { ALLOC_POOL(mbskip_table, mb_array_size + 2, - FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); + !s->encoding ? FF_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME : 0); if (!s->encoding) { /* cbp, pred_dir */ if (!(s->cbp_table = av_mallocz(mb_array_size)) || From patchwork Sat May 11 20:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48758 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298938pzb; Sat, 11 May 2024 13:56:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX2UOWluDCg2sssapLEtFFYjhn9c8deefRbTJaKp7da1WKGp/SKc1DXOFmarG2O7qawrJGphjPjSLKJQOB2eNabBShSLICElrPsxw== X-Google-Smtp-Source: AGHT+IFarPxGL1LeNmANJCg6bTWsQEsCRY6h/oxE/l6eL1EL9KXOysg5yyiaK4Fwu8078TTmljPu X-Received: by 2002:a17:906:370c:b0:a59:b730:59d7 with SMTP id a640c23a62f3a-a5a2d55aee2mr422899066b.25.1715460985603; Sat, 11 May 2024 13:56:25 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17ba2accsi331886066b.524.2024.05.11.13.56.25; Sat, 11 May 2024 13:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=DtHZJU0Y; 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 9A0C168D5BE; Sat, 11 May 2024 23:53:38 +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-am6eur05olkn2104.outbound.protection.outlook.com [40.92.91.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B9F0968D6C9 for ; Sat, 11 May 2024 23:53:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQNFZUbcSEQxzonkY4Kq1K3ha5W7HNDARv01cHCLWioy+crVhZMF8ogXQCK5FyN1YjOK6bhqJdSG/wmE/2DZVIlKRV62Igrbhi6+cBl1zzr+ZS0Paff5hv8zXjXPGvG9WldRNR2SqJfmPMavN3kF8nFJx4QHLCIOqF3u9gRi1Vs9SZJj0HD3wb6E9t7kvmeedLUI6soDzGuA71+d5V8qAkxKxAr9d6JYQkv9+j4o2KlnWjTQwgAdowiiN3pW+W7Pd+QoawQWgH6D6PG4uiVKUARIFwBKWimuRS22g2l23Rt7PrC41Am9/Q+YzUId7Qhc+0+/Y2ZxbBIHyXH1gOt3yA== 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=EXNLkBycRqtsaRNnC9nKDHN7qHNQcSHK3S/AIsx19XI=; b=hd9HqEaq6+fS7ZsIkWZmlJlYt0/QjEFusKGIiYvW0EzlX2yVDqt2MbsgrtjKRTMRwAMbJZgO4PR9kWblyBaOVqv6cHuh2qFkIosue/8n0XlPT/INFdM9vJX9z9Do8OLdmSLdHhDHIQ5YoZtWbHU69Hk/oG56bZLWi/0boJ/EKeQVsWPLQjmLIhfu6tYfgxb87C6gOtV7VGWPvsL65UgB0GI1C24m1rswmdyCpwdtbnx1Nbztd9E0Zi8c386BZCixWeM3TXRChwdMPVjzeO5zDYtYImxEowp3ccN3y+a4qkQ+F2IioeebNdgbw8trs8e32LTKn+eKURgcIoygDNVDrg== 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=EXNLkBycRqtsaRNnC9nKDHN7qHNQcSHK3S/AIsx19XI=; b=DtHZJU0YBABahtk3uVI7y/2+g3wqokxDTwYIs0GGR7D3WUBAvxmdiJ89nuvXwtOB3znqRABfzwlD5W6mkaQCXLNUltnb0K47ZqfoqiuuojpA8SLAbWs2aXqOKy4oCGwh8eO8JA1tZ7i6btj/iiEikQjqtqGqgDSKCi50sPGnmm9hYOzhD7gAfJr1Xv/bqRyiPhIUkrn91apGE/VbxRfvjoZ5kdXZuOqjVc3rBrbEQBOWQ/H+YGfLbbVNfsvCIK/SoEKXcJVdNwDryTaDWtCaQpQeRyvEs7apbNBZz+59OUGwz5Q75F9LZmfLQF5h9QfD7XjTn375K3B0UywvQfm9PQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:30 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:55 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [0vLcUqNiOsMCojX2WnjDZ5GYQD11+fya4gKYk50wRL4=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-30-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 08464afc-dca2-49e4-ab39-08dc71fc69be X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: zAlsOyG0PYVyecPG04+WO6ht7FM2xs+DCz7nDzju8Scn1XeuisBLgnSx4BYozDtBjFybGZskRm1KMs9EfPZNhlLRxqTTsVenwjaSYZ7iO1UEdbpPx+fMeaoomZkMvw1M7KRN+zgo89GWDGqCChic+520fKX9FFxxea/KEMJpvdRy5LMu7Rd7DSrTpflQtRXyLEwLwKnRWxVLVeaQIGA+/kD4wPetp3X47uDTrCeEiI44aTmIqBDxLZfj5gX82qSosS9n398c54dPRffvNI0FCM7FZ2OCyuI8RB0bVFRXvofvvMXG59RrkzQ+LQAvbcoM2l5VKdPO1bwGcOcctCDW6LiiVFU431tOuBxUwuKLDQahQCFBRMM8C77t8EdFUE+IkFI0XTXevBYnUGY2V86U+l4M2engemD/XwQvJMA2k38jj8FDWzOscnzjGSUvT5s/GXpuy/unQRqSGOZDipfaJ7G99wLxJyktUfGuszzCjl8p1YZkMWQFBexG4pVAkCbMeOhtQ+qOTAOltGUgJ09JzWzu5iP4RtixKdsfGM6sfeVKmlLrp65aFuvYlTisnK42NJ23D0iIN4XmJLXwgwYEqbjxGj1hgJ+Uu58vVlS2OpyPUssVoRFQxLjgJfT9a0ju X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +w1OWr6Bo9NewA69CUvKRfkLV7HXclb89uxVxoWEYdQq91Rgb0x8/xf66p9quefd84zly0l+1HJmF9XAf7on22cZ3wxQy6sg3O0Fb7WWDD2n165tehWKNWTZyT+zrGf0zxi3P77T7ARIn4PtqOaFw0sCs6ymewTBmS+3j1yj+Nz5tLAyXAXrSiTlLPN7PuHB2GbBb2yHuTMayNRlDIzmE4kxpl1f/kfo+0vXEYA+6klCcX/polHzHXkD0ITeo88krIb3AlxLtrkYm/++LF577DdGfkxmEI5OzhO1mgrqveZBtB1QZEt51+vWnTTVsZjo+HJoUiLBzqWe1UHQT4tD8Dn/sAFC1Mqlv1J17P8fJT484px60ZzPSXdD2FuS6/dR++hDfrupsbbJewEQ9zq7MyjR9fDj8ZL9R6dvfmCA9JVvq83dNRWhZmwqOq8RH9LRtO9JC55z66CpPinRxS5QTa+5X6kp6u2PHZB4YacI7xQFx7DBdzvzO7qAT0zrMthC+bGSHH+nmTuTdpFMlBPbiFGZEaF8Q7tvm44oh9/SC67FlgfIsUfzjniVu1dtRYsBxI5zeUc1hd6/eu3bi3shdwmLb4dNjB31Wy6Z+n5haHi7KxnsBJWftjs3RBrhJowHEy2G0PvtAENMuhEE1SGCHgMSpRDrooSHOHDL+ku1RIBk1LpagsLo6a67PvH7n1UftNtdectbOIyOb4x6DZnptYOSZotzwC7JrwNeBqK4M0TNqIt23pDR8QJi1ollU41vw4nZJEQLAPMjhg7tXx+soIMk5pBbmt2tjbo1q9GcEvH5XMKJnuQjmb/WtsxLEgGtFJQbG2bmgzoSTNa3Is/N071r0ZqoJCUB4pcW6aaVTD2vXM0PRZJKN7dh7GVBODPVXHryb+vD5HF/eDRDfN8mYJrZxy+WeiGXQIyPy2PN86B6dRA5sC9n+TnP23P5GyYZHM6n8faknGr+otxf8sO0K/3qjcO2A8ELDvZlCmEv6QKH4VZD07cluULdFMwQ4ZEjRwR3+nZSBxzh9ALEMKacr728v0r1sO6SSxtXvDYykqG0zjjG+D0RC1ziqu1ZzHOvLHZFB9bY4V3+mybXq12v1g0aFovnzPoPrU7x1FspXZvHot2wVsUEE3XNWUdVFgtkQu/Yy4TJUYybvqZF2imH/CzG1WwctcoNNBEJrnVrk+8ybWppB4e0TWA+nsjVPV6vfCqV5fRS72KNb1D5sUuXskCiv5/Uz1qrOOZsrHHSqofxgtapDpLfQ5Vwh5zLhdNRA4URd3+CMitXBjuja73wMQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08464afc-dca2-49e4-ab39-08dc71fc69be X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:30.3732 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 31/71] avcodec/mpegvideo: Shorten variable names 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: VZY2ayVMd6gM current_picture->cur_pic, last_picture->last_pic, similarly for new_picture and next_picture. Also rename the corresponding *_ptr fields. Signed-off-by: Andreas Rheinhardt --- libavcodec/d3d12va_mpeg2.c | 10 +- libavcodec/d3d12va_vc1.c | 10 +- libavcodec/dxva2_mpeg2.c | 16 +- libavcodec/dxva2_vc1.c | 16 +- libavcodec/h261dec.c | 26 +-- libavcodec/h263.c | 40 ++--- libavcodec/h263dec.c | 34 ++-- libavcodec/ituh263dec.c | 30 ++-- libavcodec/ituh263enc.c | 16 +- libavcodec/motion_est.c | 84 ++++----- libavcodec/mpeg12dec.c | 94 +++++----- libavcodec/mpeg12enc.c | 14 +- libavcodec/mpeg4video.c | 8 +- libavcodec/mpeg4videodec.c | 84 ++++----- libavcodec/mpeg4videoenc.c | 16 +- libavcodec/mpeg_er.c | 12 +- libavcodec/mpegvideo.c | 34 ++-- libavcodec/mpegvideo.h | 14 +- libavcodec/mpegvideo_dec.c | 128 +++++++------- libavcodec/mpegvideo_enc.c | 182 ++++++++++--------- libavcodec/mpegvideo_motion.c | 12 +- libavcodec/mpv_reconstruct_mb_template.c | 20 +-- libavcodec/msmpeg4.c | 4 +- libavcodec/msmpeg4dec.c | 4 +- libavcodec/mss2.c | 2 +- libavcodec/nvdec_mpeg12.c | 6 +- libavcodec/nvdec_mpeg4.c | 6 +- libavcodec/nvdec_vc1.c | 6 +- libavcodec/ratecontrol.c | 10 +- libavcodec/rv10.c | 28 +-- libavcodec/rv30.c | 18 +- libavcodec/rv34.c | 156 ++++++++--------- libavcodec/rv40.c | 10 +- libavcodec/snowenc.c | 18 +- libavcodec/svq1enc.c | 24 +-- libavcodec/vaapi_mpeg2.c | 12 +- libavcodec/vaapi_mpeg4.c | 14 +- libavcodec/vaapi_vc1.c | 12 +- libavcodec/vc1.c | 2 +- libavcodec/vc1_block.c | 194 ++++++++++---------- libavcodec/vc1_loopfilter.c | 30 ++-- libavcodec/vc1_mc.c | 112 ++++++------ libavcodec/vc1_pred.c | 214 +++++++++++------------ libavcodec/vc1dec.c | 58 +++--- libavcodec/vdpau.c | 2 +- libavcodec/vdpau_mpeg12.c | 8 +- libavcodec/vdpau_mpeg4.c | 6 +- libavcodec/vdpau_vc1.c | 12 +- libavcodec/videotoolbox.c | 2 +- libavcodec/wmv2dec.c | 18 +- 50 files changed, 941 insertions(+), 947 deletions(-) diff --git a/libavcodec/d3d12va_mpeg2.c b/libavcodec/d3d12va_mpeg2.c index 936af5f86a..c2cf78104c 100644 --- a/libavcodec/d3d12va_mpeg2.c +++ b/libavcodec/d3d12va_mpeg2.c @@ -44,7 +44,7 @@ static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint { const MpegEncContext *s = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); - D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; if (!ctx) return -1; @@ -69,7 +69,7 @@ static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint static int d3d12va_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const MpegEncContext *s = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; if (ctx_pic->slice_count >= MAX_SLICES) { return AVERROR(ERANGE); @@ -88,7 +88,7 @@ static int d3d12va_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buff static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *input_args, ID3D12Resource *buffer) { const MpegEncContext *s = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; const int is_field = s->picture_structure != PICT_FRAME; const unsigned mb_count = s->mb_width * (s->mb_height >> is_field); @@ -137,12 +137,12 @@ static int d3d12va_mpeg2_end_frame(AVCodecContext *avctx) { int ret; MpegEncContext *s = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_d3d12va_common_end_frame(avctx, s->current_picture_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), + ret = ff_d3d12va_common_end_frame(avctx, s->cur_pic_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), update_input_arguments); if (!ret) ff_mpeg_draw_horiz_band(s, 0, avctx->height); diff --git a/libavcodec/d3d12va_vc1.c b/libavcodec/d3d12va_vc1.c index 110926be82..c4ac67ca04 100644 --- a/libavcodec/d3d12va_vc1.c +++ b/libavcodec/d3d12va_vc1.c @@ -45,7 +45,7 @@ static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_ { const VC1Context *v = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); - D3D12DecodePictureContext *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; if (!ctx) return -1; @@ -67,7 +67,7 @@ static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_ static int d3d12va_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const VC1Context *v = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; if (ctx_pic->slice_count >= MAX_SLICES) { return AVERROR(ERANGE); @@ -93,7 +93,7 @@ static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPU { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - D3D12DecodePictureContext *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args = &input_args->FrameArguments[input_args->NumFrameArguments++]; const unsigned mb_count = s->mb_width * (s->mb_height >> v->field_mode); @@ -151,12 +151,12 @@ static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPU static int d3d12va_vc1_end_frame(AVCodecContext *avctx) { const VC1Context *v = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - return ff_d3d12va_common_end_frame(avctx, v->s.current_picture_ptr->f, + return ff_d3d12va_common_end_frame(avctx, v->s.cur_pic_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, update_input_arguments); diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index d31a8bb872..fde615f530 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -45,17 +45,17 @@ void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx, DXVA_PictureParameters *pp) { const struct MpegEncContext *s = avctx->priv_data; - const Picture *current_picture = s->current_picture_ptr; + const Picture *current_picture = s->cur_pic_ptr; int is_field = s->picture_structure != PICT_FRAME; memset(pp, 0, sizeof(*pp)); pp->wDeblockedPictureIndex = 0; if (s->pict_type != AV_PICTURE_TYPE_I) - pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_picture.f, 0); + pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_pic.f, 0); else pp->wForwardRefPictureIndex = 0xffff; if (s->pict_type == AV_PICTURE_TYPE_B) - pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_picture.f, 0); + pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_pic.f, 0); else pp->wBackwardRefPictureIndex = 0xffff; pp->wDecodedPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, current_picture->f, 1); @@ -157,7 +157,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, const struct MpegEncContext *s = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); struct dxva2_picture_context *ctx_pic = - s->current_picture_ptr->hwaccel_picture_private; + s->cur_pic_ptr->hwaccel_picture_private; const int is_field = s->picture_structure != PICT_FRAME; const unsigned mb_count = s->mb_width * (s->mb_height >> is_field); void *dxva_data_ptr; @@ -260,7 +260,7 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, const struct MpegEncContext *s = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); struct dxva2_picture_context *ctx_pic = - s->current_picture_ptr->hwaccel_picture_private; + s->cur_pic_ptr->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; @@ -280,7 +280,7 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx, { const struct MpegEncContext *s = avctx->priv_data; struct dxva2_picture_context *ctx_pic = - s->current_picture_ptr->hwaccel_picture_private; + s->cur_pic_ptr->hwaccel_picture_private; unsigned position; if (ctx_pic->slice_count >= MAX_SLICES) { @@ -302,12 +302,12 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx) { struct MpegEncContext *s = avctx->priv_data; struct dxva2_picture_context *ctx_pic = - s->current_picture_ptr->hwaccel_picture_private; + s->cur_pic_ptr->hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, s->current_picture_ptr->f, + ret = ff_dxva2_common_end_frame(avctx, s->cur_pic_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), commit_bitstream_and_slice_buffer); diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index f7513b2b15..7122f1cfea 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -46,7 +46,7 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - const Picture *current_picture = s->current_picture_ptr; + const Picture *current_picture = s->cur_pic_ptr; int intcomp = 0; // determine if intensity compensation is needed @@ -59,11 +59,11 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, memset(pp, 0, sizeof(*pp)); if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type) - pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_picture.f, 0); + pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_pic.f, 0); else pp->wForwardRefPictureIndex = 0xffff; if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type) - pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_picture.f, 0); + pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_pic.f, 0); else pp->wBackwardRefPictureIndex = 0xffff; pp->wDecodedPictureIndex = @@ -191,7 +191,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, const VC1Context *v = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); const MpegEncContext *s = &v->s; - struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; static const uint8_t start_code[] = { 0, 0, 1, 0x0d }; const unsigned start_code_size = avctx->codec_id == AV_CODEC_ID_VC1 ? sizeof(start_code) : 0; @@ -317,7 +317,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); - struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; @@ -336,7 +336,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, uint32_t size) { const VC1Context *v = avctx->priv_data; - const Picture *current_picture = v->s.current_picture_ptr; + const Picture *current_picture = v->s.cur_pic_ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; unsigned position; @@ -364,13 +364,13 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, static int dxva2_vc1_end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; - struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, v->s.current_picture_ptr->f, + ret = ff_dxva2_common_end_frame(avctx, v->s.cur_pic_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, commit_bitstream_and_slice_buffer); diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 4fbd5985b3..77aa08687d 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -228,17 +228,17 @@ static int h261_decode_mb_skipped(H261DecContext *h, int mba1, int mba2) s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = 1; h->common.mtype &= ~MB_TYPE_H261_FIL; - if (s->current_picture.motion_val[0]) { + if (s->cur_pic.motion_val[0]) { int b_stride = 2*s->mb_width + 1; int b_xy = 2 * s->mb_x + (2 * s->mb_y) * b_stride; - s->current_picture.motion_val[0][b_xy][0] = s->mv[0][0][0]; - s->current_picture.motion_val[0][b_xy][1] = s->mv[0][0][1]; + s->cur_pic.motion_val[0][b_xy][0] = s->mv[0][0][0]; + s->cur_pic.motion_val[0][b_xy][1] = s->mv[0][0][1]; } ff_mpv_reconstruct_mb(s, s->block); @@ -452,22 +452,22 @@ static int h261_decode_mb(H261DecContext *h) cbp = get_vlc2(&s->gb, h261_cbp_vlc, H261_CBP_VLC_BITS, 1) + 1; if (s->mb_intra) { - s->current_picture.mb_type[xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA; goto intra; } //set motion vectors s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; - s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; s->mv[0][0][0] = h->current_mv_x * 2; // gets divided by 2 in motion compensation s->mv[0][0][1] = h->current_mv_y * 2; - if (s->current_picture.motion_val[0]) { + if (s->cur_pic.motion_val[0]) { int b_stride = 2*s->mb_width + 1; int b_xy = 2 * s->mb_x + (2 * s->mb_y) * b_stride; - s->current_picture.motion_val[0][b_xy][0] = s->mv[0][0][0]; - s->current_picture.motion_val[0][b_xy][1] = s->mv[0][0][1]; + s->cur_pic.motion_val[0][b_xy][0] = s->mv[0][0][0]; + s->cur_pic.motion_val[0][b_xy][1] = s->mv[0][0][1]; } intra: @@ -649,12 +649,12 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict, } ff_mpv_frame_end(s); - av_assert0(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type); - av_assert0(s->current_picture.f->pict_type == s->pict_type); + av_assert0(s->cur_pic.f->pict_type == s->cur_pic_ptr->f->pict_type); + av_assert0(s->cur_pic.f->pict_type == s->pict_type); - if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr, pict); + ff_print_debug_info(s, s->cur_pic_ptr, pict); *got_frame = 1; diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 9849f651cb..19eb3ba52f 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -73,21 +73,21 @@ void ff_h263_update_motion_val(MpegEncContext * s){ s->p_field_mv_table[i][0][mb_xy][0]= s->mv[0][i][0]; s->p_field_mv_table[i][0][mb_xy][1]= s->mv[0][i][1]; } - s->current_picture.ref_index[0][4*mb_xy ] = - s->current_picture.ref_index[0][4*mb_xy + 1] = s->field_select[0][0]; - s->current_picture.ref_index[0][4*mb_xy + 2] = - s->current_picture.ref_index[0][4*mb_xy + 3] = s->field_select[0][1]; + s->cur_pic.ref_index[0][4*mb_xy ] = + s->cur_pic.ref_index[0][4*mb_xy + 1] = s->field_select[0][0]; + s->cur_pic.ref_index[0][4*mb_xy + 2] = + s->cur_pic.ref_index[0][4*mb_xy + 3] = s->field_select[0][1]; } /* no update if 8X8 because it has been done during parsing */ - s->current_picture.motion_val[0][xy][0] = motion_x; - s->current_picture.motion_val[0][xy][1] = motion_y; - s->current_picture.motion_val[0][xy + 1][0] = motion_x; - s->current_picture.motion_val[0][xy + 1][1] = motion_y; - s->current_picture.motion_val[0][xy + wrap][0] = motion_x; - s->current_picture.motion_val[0][xy + wrap][1] = motion_y; - s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x; - s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y; + s->cur_pic.motion_val[0][xy][0] = motion_x; + s->cur_pic.motion_val[0][xy][1] = motion_y; + s->cur_pic.motion_val[0][xy + 1][0] = motion_x; + s->cur_pic.motion_val[0][xy + 1][1] = motion_y; + s->cur_pic.motion_val[0][xy + wrap][0] = motion_x; + s->cur_pic.motion_val[0][xy + wrap][1] = motion_y; + s->cur_pic.motion_val[0][xy + 1 + wrap][0] = motion_x; + s->cur_pic.motion_val[0][xy + 1 + wrap][1] = motion_y; } } @@ -104,7 +104,7 @@ void ff_h263_loop_filter(MpegEncContext * s){ Diag Top Left Center */ - if (!IS_SKIP(s->current_picture.mb_type[xy])) { + if (!IS_SKIP(s->cur_pic.mb_type[xy])) { qp_c= s->qscale; s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize, linesize, qp_c); s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c); @@ -114,10 +114,10 @@ void ff_h263_loop_filter(MpegEncContext * s){ if(s->mb_y){ int qp_dt, qp_tt, qp_tc; - if (IS_SKIP(s->current_picture.mb_type[xy - s->mb_stride])) + if (IS_SKIP(s->cur_pic.mb_type[xy - s->mb_stride])) qp_tt=0; else - qp_tt = s->current_picture.qscale_table[xy - s->mb_stride]; + qp_tt = s->cur_pic.qscale_table[xy - s->mb_stride]; if(qp_c) qp_tc= qp_c; @@ -137,10 +137,10 @@ void ff_h263_loop_filter(MpegEncContext * s){ s->h263dsp.h263_h_loop_filter(dest_y - 8 * linesize + 8, linesize, qp_tt); if(s->mb_x){ - if (qp_tt || IS_SKIP(s->current_picture.mb_type[xy - 1 - s->mb_stride])) + if (qp_tt || IS_SKIP(s->cur_pic.mb_type[xy - 1 - s->mb_stride])) qp_dt= qp_tt; else - qp_dt = s->current_picture.qscale_table[xy - 1 - s->mb_stride]; + qp_dt = s->cur_pic.qscale_table[xy - 1 - s->mb_stride]; if(qp_dt){ const int chroma_qp= s->chroma_qscale_table[qp_dt]; @@ -159,10 +159,10 @@ void ff_h263_loop_filter(MpegEncContext * s){ if(s->mb_x){ int qp_lc; - if (qp_c || IS_SKIP(s->current_picture.mb_type[xy - 1])) + if (qp_c || IS_SKIP(s->cur_pic.mb_type[xy - 1])) qp_lc= qp_c; else - qp_lc = s->current_picture.qscale_table[xy - 1]; + qp_lc = s->cur_pic.qscale_table[xy - 1]; if(qp_lc){ s->h263dsp.h263_h_loop_filter(dest_y, linesize, qp_lc); @@ -184,7 +184,7 @@ int16_t *ff_h263_pred_motion(MpegEncContext * s, int block, int dir, static const int off[4]= {2, 1, 1, -1}; wrap = s->b8_stride; - mot_val = s->current_picture.motion_val[dir] + s->block_index[block]; + mot_val = s->cur_pic.motion_val[dir] + s->block_index[block]; A = mot_val[ - 1]; /* special case for first (slice) line */ diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 48bd467f30..6ae634fceb 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -432,22 +432,22 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ - if (s->low_delay == 0 && s->next_picture_ptr) { - if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) + if (s->low_delay == 0 && s->next_pic_ptr) { + if ((ret = av_frame_ref(pict, s->next_pic_ptr->f)) < 0) return ret; - s->next_picture_ptr = NULL; + s->next_pic_ptr = NULL; *got_frame = 1; - } else if (s->skipped_last_frame && s->current_picture_ptr) { + } else if (s->skipped_last_frame && s->cur_pic_ptr) { /* Output the last picture we decoded again if the stream ended with * an NVOP */ - if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) return ret; /* Copy props from the last input packet. Otherwise, props from the last * returned picture would be reused */ if ((ret = ff_decode_frame_props(avctx, pict)) < 0) return ret; - s->current_picture_ptr = NULL; + s->cur_pic_ptr = NULL; *got_frame = 1; } @@ -561,7 +561,7 @@ retry: s->gob_index = H263_GOB_HEIGHT(s->height); /* skip B-frames if we don't have reference frames */ - if (!s->last_picture_ptr && + if (!s->last_pic_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && @@ -647,21 +647,21 @@ frame_end: if (!s->divx_packed && avctx->hwaccel) ff_thread_finish_setup(avctx); - av_assert1(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type); - av_assert1(s->current_picture.f->pict_type == s->pict_type); + av_assert1(s->cur_pic.f->pict_type == s->cur_pic_ptr->f->pict_type); + av_assert1(s->cur_pic.f->pict_type == s->pict_type); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); - } else if (s->last_picture_ptr) { - if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) + ff_print_debug_info(s, s->cur_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + } else if (s->last_pic_ptr) { + if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->last_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); } - if (s->last_picture_ptr || s->low_delay) { + if (s->last_pic_ptr || s->low_delay) { if ( pict->format == AV_PIX_FMT_YUV420P && (s->codec_tag == AV_RL32("GEOV") || s->codec_tag == AV_RL32("GEOX"))) { for (int p = 0; p < 3; p++) { diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index aeeda1cc42..9358363ed8 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -357,20 +357,20 @@ static void preview_obmc(MpegEncContext *s){ do{ if (get_bits1(&s->gb)) { /* skip mb */ - mot_val = s->current_picture.motion_val[0][s->block_index[0]]; + mot_val = s->cur_pic.motion_val[0][s->block_index[0]]; mot_val[0 ]= mot_val[2 ]= mot_val[0+stride]= mot_val[2+stride]= 0; mot_val[1 ]= mot_val[3 ]= mot_val[1+stride]= mot_val[3+stride]= 0; - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; goto end; } cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); }while(cbpc == 20); if(cbpc & 4){ - s->current_picture.mb_type[xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA; }else{ get_vlc2(&s->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); if (cbpc & 8) { @@ -382,7 +382,7 @@ static void preview_obmc(MpegEncContext *s){ } if ((cbpc & 16) == 0) { - s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; /* 16x16 motion prediction */ mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); if (s->umvplus) @@ -400,7 +400,7 @@ static void preview_obmc(MpegEncContext *s){ mot_val[1 ]= mot_val[3 ]= mot_val[1+stride]= mot_val[3+stride]= my; } else { - s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; for(i=0;i<4;i++) { mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); if (s->umvplus) @@ -750,12 +750,12 @@ static inline void set_one_direct_mv(MpegEncContext *s, Picture *p, int i) static int set_direct_mv(MpegEncContext *s) { const int mb_index = s->mb_x + s->mb_y * s->mb_stride; - Picture *p = &s->next_picture; + Picture *p = &s->next_pic; int colocated_mb_type = p->mb_type[mb_index]; int i; if (s->codec_tag == AV_RL32("U263") && p->f->pict_type == AV_PICTURE_TYPE_I) { - p = &s->last_picture; + p = &s->last_pic; colocated_mb_type = p->mb_type[mb_index]; } @@ -803,7 +803,7 @@ int ff_h263_decode_mb(MpegEncContext *s, s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = !(s->obmc | s->loop_filter); @@ -841,7 +841,7 @@ int ff_h263_decode_mb(MpegEncContext *s, s->mv_dir = MV_DIR_FORWARD; if ((cbpc & 16) == 0) { - s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; /* 16x16 motion prediction */ s->mv_type = MV_TYPE_16X16; ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); @@ -866,7 +866,7 @@ int ff_h263_decode_mb(MpegEncContext *s, if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ } else { - s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; s->mv_type = MV_TYPE_8X8; for(i=0;i<4;i++) { mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); @@ -894,8 +894,8 @@ int ff_h263_decode_mb(MpegEncContext *s, } else if(s->pict_type==AV_PICTURE_TYPE_B) { int mb_type; const int stride= s->b8_stride; - int16_t *mot_val0 = s->current_picture.motion_val[0][2 * (s->mb_x + s->mb_y * stride)]; - int16_t *mot_val1 = s->current_picture.motion_val[1][2 * (s->mb_x + s->mb_y * stride)]; + int16_t *mot_val0 = s->cur_pic.motion_val[0][2 * (s->mb_x + s->mb_y * stride)]; + int16_t *mot_val1 = s->cur_pic.motion_val[1][2 * (s->mb_x + s->mb_y * stride)]; // const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride; //FIXME ugly @@ -1007,7 +1007,7 @@ int ff_h263_decode_mb(MpegEncContext *s, } } - s->current_picture.mb_type[xy] = mb_type; + s->cur_pic.mb_type[xy] = mb_type; } else { /* I-Frame */ do{ cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); @@ -1022,11 +1022,11 @@ int ff_h263_decode_mb(MpegEncContext *s, dquant = cbpc & 4; s->mb_intra = 1; intra: - s->current_picture.mb_type[xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA; if (s->h263_aic) { s->ac_pred = get_bits1(&s->gb); if(s->ac_pred){ - s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; s->h263_aic_dir = get_bits1(&s->gb); } diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index e27bd258d7..bcb230871e 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -271,7 +271,7 @@ void ff_h263_encode_gob_header(MpegEncContext * s, int mb_line) */ void ff_clean_h263_qscales(MpegEncContext *s){ int i; - int8_t * const qscale_table = s->current_picture.qscale_table; + int8_t * const qscale_table = s->cur_pic.qscale_table; ff_init_qscale_tab(s); @@ -565,8 +565,8 @@ void ff_h263_encode_mb(MpegEncContext * s, /* motion vectors: 8x8 mode*/ ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); - motion_x = s->current_picture.motion_val[0][s->block_index[i]][0]; - motion_y = s->current_picture.motion_val[0][s->block_index[i]][1]; + motion_x = s->cur_pic.motion_val[0][s->block_index[i]][0]; + motion_y = s->cur_pic.motion_val[0][s->block_index[i]][1]; if (!s->umvplus) { ff_h263_encode_motion_vector(s, motion_x - pred_x, motion_y - pred_y, 1); @@ -692,15 +692,15 @@ void ff_h263_update_mb(MpegEncContext *s) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; - if (s->current_picture.mbskip_table) - s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; + if (s->cur_pic.mbskip_table) + s->cur_pic.mbskip_table[mb_xy] = s->mb_skipped; if (s->mv_type == MV_TYPE_8X8) - s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; + s->cur_pic.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; else if(s->mb_intra) - s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[mb_xy] = MB_TYPE_INTRA; else - s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16; + s->cur_pic.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16; ff_h263_update_motion_val(s); } diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index fb569ede8a..b2644b5328 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -510,16 +510,16 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) if(mv4){ int mot_xy= s->block_index[0]; - s->current_picture.motion_val[0][mot_xy ][0] = mx; - s->current_picture.motion_val[0][mot_xy ][1] = my; - s->current_picture.motion_val[0][mot_xy + 1][0] = mx; - s->current_picture.motion_val[0][mot_xy + 1][1] = my; + s->cur_pic.motion_val[0][mot_xy ][0] = mx; + s->cur_pic.motion_val[0][mot_xy ][1] = my; + s->cur_pic.motion_val[0][mot_xy + 1][0] = mx; + s->cur_pic.motion_val[0][mot_xy + 1][1] = my; mot_xy += s->b8_stride; - s->current_picture.motion_val[0][mot_xy ][0] = mx; - s->current_picture.motion_val[0][mot_xy ][1] = my; - s->current_picture.motion_val[0][mot_xy + 1][0] = mx; - s->current_picture.motion_val[0][mot_xy + 1][1] = my; + s->cur_pic.motion_val[0][mot_xy ][0] = mx; + s->cur_pic.motion_val[0][mot_xy ][1] = my; + s->cur_pic.motion_val[0][mot_xy + 1][0] = mx; + s->cur_pic.motion_val[0][mot_xy + 1][1] = my; } } @@ -601,8 +601,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) c->ymax = - 16*s->mb_y + s->height - 8*(block>>1); } - P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0]; - P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1]; + P_LEFT[0] = s->cur_pic.motion_val[0][mot_xy - 1][0]; + P_LEFT[1] = s->cur_pic.motion_val[0][mot_xy - 1][1]; if (P_LEFT[0] > c->xmax * (1 << shift)) P_LEFT[0] = c->xmax * (1 << shift); @@ -611,10 +611,10 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) c->pred_x= pred_x4= P_LEFT[0]; c->pred_y= pred_y4= P_LEFT[1]; } else { - P_TOP[0] = s->current_picture.motion_val[0][mot_xy - mot_stride ][0]; - P_TOP[1] = s->current_picture.motion_val[0][mot_xy - mot_stride ][1]; - P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][0]; - P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][1]; + P_TOP[0] = s->cur_pic.motion_val[0][mot_xy - mot_stride ][0]; + P_TOP[1] = s->cur_pic.motion_val[0][mot_xy - mot_stride ][1]; + P_TOPRIGHT[0] = s->cur_pic.motion_val[0][mot_xy - mot_stride + off[block]][0]; + P_TOPRIGHT[1] = s->cur_pic.motion_val[0][mot_xy - mot_stride + off[block]][1]; if (P_TOP[1] > c->ymax * (1 << shift)) P_TOP[1] = c->ymax * (1 << shift); if (P_TOPRIGHT[0] < c->xmin * (1 << shift)) P_TOPRIGHT[0] = c->xmin * (1 << shift); if (P_TOPRIGHT[0] > c->xmax * (1 << shift)) P_TOPRIGHT[0] = c->xmax * (1 << shift); @@ -675,8 +675,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) my4_sum+= my4; } - s->current_picture.motion_val[0][s->block_index[block]][0] = mx4; - s->current_picture.motion_val[0][s->block_index[block]][1] = my4; + s->cur_pic.motion_val[0][s->block_index[block]][0] = mx4; + s->cur_pic.motion_val[0][s->block_index[block]][1] = my4; if(mx4 != mx || my4 != my) same=0; } @@ -686,7 +686,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) { dmin_sum += s->mecc.mb_cmp[0](s, - s->new_picture->data[0] + + s->new_pic->data[0] + s->mb_x * 16 + s->mb_y * 16 * stride, c->scratchpad, stride, 16); } @@ -703,15 +703,15 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize; if(s->no_rounding){ - s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_picture.f->data[1] + offset, s->uvlinesize, 8); - s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f->data[2] + offset, s->uvlinesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.f->data[1] + offset, s->uvlinesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.f->data[2] + offset, s->uvlinesize, 8); }else{ - s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_picture.f->data[1] + offset, s->uvlinesize, 8); - s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_picture.f->data[2] + offset, s->uvlinesize, 8); + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.f->data[1] + offset, s->uvlinesize, 8); + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.f->data[2] + offset, s->uvlinesize, 8); } - dmin_sum += s->mecc.mb_cmp[1](s, s->new_picture->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8); - dmin_sum += s->mecc.mb_cmp[1](s, s->new_picture->data[2] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad + 8, s->uvlinesize, 8); + dmin_sum += s->mecc.mb_cmp[1](s, s->new_pic->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8); + dmin_sum += s->mecc.mb_cmp[1](s, s->new_pic->data[2] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad + 8, s->uvlinesize, 8); } c->pred_x= mx; @@ -899,7 +899,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, const int shift= 1+s->quarter_sample; int mb_type=0; - init_ref(c, s->new_picture->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0); + init_ref(c, s->new_pic->data, s->last_pic.f->data, NULL, 16*mb_x, 16*mb_y, 0); av_assert0(s->quarter_sample==0 || s->quarter_sample==1); av_assert0(s->linesize == c->stride); @@ -927,17 +927,17 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, const int mot_stride = s->b8_stride; const int mot_xy = s->block_index[0]; - P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0]; - P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1]; + P_LEFT[0] = s->cur_pic.motion_val[0][mot_xy - 1][0]; + P_LEFT[1] = s->cur_pic.motion_val[0][mot_xy - 1][1]; if (P_LEFT[0] > (c->xmax << shift)) P_LEFT[0] = c->xmax << shift; if (!s->first_slice_line) { - P_TOP[0] = s->current_picture.motion_val[0][mot_xy - mot_stride ][0]; - P_TOP[1] = s->current_picture.motion_val[0][mot_xy - mot_stride ][1]; - P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][0]; - P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][1]; + P_TOP[0] = s->cur_pic.motion_val[0][mot_xy - mot_stride ][0]; + P_TOP[1] = s->cur_pic.motion_val[0][mot_xy - mot_stride ][1]; + P_TOPRIGHT[0] = s->cur_pic.motion_val[0][mot_xy - mot_stride + 2][0]; + P_TOPRIGHT[1] = s->cur_pic.motion_val[0][mot_xy - mot_stride + 2][1]; if (P_TOP[1] > (c->ymax << shift)) P_TOP[1] = c->ymax << shift; if (P_TOPRIGHT[0] < (c->xmin * (1 << shift))) @@ -1048,9 +1048,9 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, if(intra_score < dmin){ mb_type= CANDIDATE_MB_TYPE_INTRA; - s->current_picture.mb_type[mb_y*s->mb_stride + mb_x] = CANDIDATE_MB_TYPE_INTRA; //FIXME cleanup + s->cur_pic.mb_type[mb_y*s->mb_stride + mb_x] = CANDIDATE_MB_TYPE_INTRA; //FIXME cleanup }else - s->current_picture.mb_type[mb_y*s->mb_stride + mb_x] = 0; + s->cur_pic.mb_type[mb_y*s->mb_stride + mb_x] = 0; { int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); @@ -1070,7 +1070,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int P[10][2]; const int shift= 1+s->quarter_sample; const int xy= mb_x + mb_y*s->mb_stride; - init_ref(c, s->new_picture->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0); + init_ref(c, s->new_pic->data, s->last_pic.f->data, NULL, 16*mb_x, 16*mb_y, 0); av_assert0(s->quarter_sample==0 || s->quarter_sample==1); @@ -1403,7 +1403,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y) ymin= xmin=(-32)>>shift; ymax= xmax= 31>>shift; - if (IS_8X8(s->next_picture.mb_type[mot_xy])) { + if (IS_8X8(s->next_pic.mb_type[mot_xy])) { s->mv_type= MV_TYPE_8X8; }else{ s->mv_type= MV_TYPE_16X16; @@ -1413,8 +1413,8 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y) int index= s->block_index[i]; int min, max; - c->co_located_mv[i][0] = s->next_picture.motion_val[0][index][0]; - c->co_located_mv[i][1] = s->next_picture.motion_val[0][index][1]; + c->co_located_mv[i][0] = s->next_pic.motion_val[0][index][0]; + c->co_located_mv[i][1] = s->next_pic.motion_val[0][index][1]; c->direct_basis_mv[i][0]= c->co_located_mv[i][0]*time_pb/time_pp + ((i& 1)<<(shift+3)); c->direct_basis_mv[i][1]= c->co_located_mv[i][1]*time_pb/time_pp + ((i>>1)<<(shift+3)); // c->direct_basis_mv[1][i][0]= c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(shift+3); @@ -1495,14 +1495,14 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, int fmin, bmin, dmin, fbmin, bimin, fimin; int type=0; const int xy = mb_y*s->mb_stride + mb_x; - init_ref(c, s->new_picture->data, s->last_picture.f->data, - s->next_picture.f->data, 16 * mb_x, 16 * mb_y, 2); + init_ref(c, s->new_pic->data, s->last_pic.f->data, + s->next_pic.f->data, 16 * mb_x, 16 * mb_y, 2); get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; - if (s->codec_id == AV_CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]) { + if (s->codec_id == AV_CODEC_ID_MPEG4 && s->next_pic.mbskip_table[xy]) { int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0 score= ((unsigned)(score*score + 128*256))>>16; @@ -1681,14 +1681,14 @@ void ff_fix_long_p_mvs(MpegEncContext * s, int type) int block; for(block=0; block<4; block++){ int off= (block& 1) + (block>>1)*wrap; - int mx = s->current_picture.motion_val[0][ xy + off ][0]; - int my = s->current_picture.motion_val[0][ xy + off ][1]; + int mx = s->cur_pic.motion_val[0][ xy + off ][0]; + int my = s->cur_pic.motion_val[0][ xy + off ][1]; if( mx >=range || mx <-range || my >=range || my <-range){ s->mb_type[i] &= ~CANDIDATE_MB_TYPE_INTER4V; s->mb_type[i] |= type; - s->current_picture.mb_type[i] = type; + s->cur_pic.mb_type[i] = type; } } } diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 9940ff898c..4aba5651a6 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -437,21 +437,21 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) if (s->mb_skip_run-- != 0) { if (s->pict_type == AV_PICTURE_TYPE_P) { s->mb_skipped = 1; - s->current_picture.mb_type[s->mb_x + s->mb_y * s->mb_stride] = + s->cur_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride] = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; } else { int mb_type; if (s->mb_x) - mb_type = s->current_picture.mb_type[s->mb_x + s->mb_y * s->mb_stride - 1]; + mb_type = s->cur_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride - 1]; else // FIXME not sure if this is allowed in MPEG at all - mb_type = s->current_picture.mb_type[s->mb_width + (s->mb_y - 1) * s->mb_stride - 1]; + mb_type = s->cur_pic.mb_type[s->mb_width + (s->mb_y - 1) * s->mb_stride - 1]; if (IS_INTRA(mb_type)) { av_log(s->avctx, AV_LOG_ERROR, "skip with previntra\n"); return AVERROR_INVALIDDATA; } - s->current_picture.mb_type[s->mb_x + s->mb_y * s->mb_stride] = + s->cur_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride] = mb_type | MB_TYPE_SKIP; if ((s->mv[0][0][0] | s->mv[0][0][1] | s->mv[1][0][0] | s->mv[1][0][1]) == 0) @@ -784,7 +784,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) } } - s->current_picture.mb_type[s->mb_x + s->mb_y * s->mb_stride] = mb_type; + s->cur_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride] = mb_type; return 0; } @@ -1292,36 +1292,36 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return ret; if (s->picture_structure != PICT_FRAME) { - s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * - (s->picture_structure == PICT_TOP_FIELD); + s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * + (s->picture_structure == PICT_TOP_FIELD); for (int i = 0; i < 3; i++) { if (s->picture_structure == PICT_BOTTOM_FIELD) { - s->current_picture.f->data[i] = FF_PTR_ADD(s->current_picture.f->data[i], - s->current_picture.f->linesize[i]); + s->cur_pic.f->data[i] = FF_PTR_ADD(s->cur_pic.f->data[i], + s->cur_pic.f->linesize[i]); } - s->current_picture.f->linesize[i] *= 2; - s->last_picture.f->linesize[i] *= 2; - s->next_picture.f->linesize[i] *= 2; + s->cur_pic.f->linesize[i] *= 2; + s->last_pic.f->linesize[i] *= 2; + s->next_pic.f->linesize[i] *= 2; } } ff_mpeg_er_frame_start(s); /* first check if we must repeat the frame */ - s->current_picture_ptr->f->repeat_pict = 0; + s->cur_pic_ptr->f->repeat_pict = 0; if (s->repeat_first_field) { if (s->progressive_sequence) { if (s->top_field_first) - s->current_picture_ptr->f->repeat_pict = 4; + s->cur_pic_ptr->f->repeat_pict = 4; else - s->current_picture_ptr->f->repeat_pict = 2; + s->cur_pic_ptr->f->repeat_pict = 2; } else if (s->progressive_frame) { - s->current_picture_ptr->f->repeat_pict = 1; + s->cur_pic_ptr->f->repeat_pict = 1; } } - ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f, + ret = ff_frame_new_side_data(s->avctx, s->cur_pic_ptr->f, AV_FRAME_DATA_PANSCAN, sizeof(s1->pan_scan), &pan_scan); if (ret < 0) @@ -1331,14 +1331,14 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (s1->a53_buf_ref) { ret = ff_frame_new_side_data_from_buf( - s->avctx, s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC, + s->avctx, s->cur_pic_ptr->f, AV_FRAME_DATA_A53_CC, &s1->a53_buf_ref, NULL); if (ret < 0) return ret; } if (s1->has_stereo3d) { - AVStereo3D *stereo = av_stereo3d_create_side_data(s->current_picture_ptr->f); + AVStereo3D *stereo = av_stereo3d_create_side_data(s->cur_pic_ptr->f); if (!stereo) return AVERROR(ENOMEM); @@ -1348,7 +1348,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (s1->has_afd) { AVFrameSideData *sd; - ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f, + ret = ff_frame_new_side_data(s->avctx, s->cur_pic_ptr->f, AV_FRAME_DATA_AFD, 1, &sd); if (ret < 0) return ret; @@ -1360,7 +1360,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_finish_setup(avctx); } else { // second field - if (!s->current_picture_ptr) { + if (!s->cur_pic_ptr) { av_log(s->avctx, AV_LOG_ERROR, "first field missing\n"); return AVERROR_INVALIDDATA; } @@ -1377,10 +1377,10 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return ret; for (int i = 0; i < 3; i++) { - s->current_picture.f->data[i] = s->current_picture_ptr->f->data[i]; + s->cur_pic.f->data[i] = s->cur_pic_ptr->f->data[i]; if (s->picture_structure == PICT_BOTTOM_FIELD) - s->current_picture.f->data[i] += - s->current_picture_ptr->f->linesize[i]; + s->cur_pic.f->data[i] += + s->cur_pic_ptr->f->linesize[i]; } } @@ -1507,7 +1507,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, return ret; // Note motion_val is normally NULL unless we want to extract the MVs. - if (s->current_picture.motion_val[0]) { + if (s->cur_pic.motion_val[0]) { const int wrap = s->b8_stride; int xy = s->mb_x * 2 + s->mb_y * 2 * wrap; int b8_xy = 4 * (s->mb_x + s->mb_y * s->mb_stride); @@ -1527,12 +1527,12 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, motion_y = s->mv[dir][i][1]; } - s->current_picture.motion_val[dir][xy][0] = motion_x; - s->current_picture.motion_val[dir][xy][1] = motion_y; - s->current_picture.motion_val[dir][xy + 1][0] = motion_x; - s->current_picture.motion_val[dir][xy + 1][1] = motion_y; - s->current_picture.ref_index [dir][b8_xy] = - s->current_picture.ref_index [dir][b8_xy + 1] = s->field_select[dir][i]; + s->cur_pic.motion_val[dir][xy][0] = motion_x; + s->cur_pic.motion_val[dir][xy][1] = motion_y; + s->cur_pic.motion_val[dir][xy + 1][0] = motion_x; + s->cur_pic.motion_val[dir][xy + 1][1] = motion_y; + s->cur_pic.ref_index [dir][b8_xy] = + s->cur_pic.ref_index [dir][b8_xy + 1] = s->field_select[dir][i]; av_assert2(s->field_select[dir][i] == 0 || s->field_select[dir][i] == 1); } @@ -1735,7 +1735,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output) Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; - if (!s->context_initialized || !s->current_picture_ptr) + if (!s->context_initialized || !s->cur_pic_ptr) return 0; if (s->avctx->hwaccel) { @@ -1756,20 +1756,20 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output) ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - int ret = av_frame_ref(pict, s->current_picture_ptr->f); + int ret = av_frame_ref(pict, s->cur_pic_ptr->f); if (ret < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG2); + ff_print_debug_info(s, s->cur_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG2); *got_output = 1; } else { /* latency of 1 frame for I- and P-frames */ - if (s->last_picture_ptr && !s->last_picture_ptr->dummy) { - int ret = av_frame_ref(pict, s->last_picture_ptr->f); + if (s->last_pic_ptr && !s->last_pic_ptr->dummy) { + int ret = av_frame_ref(pict, s->last_pic_ptr->f); if (ret < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG2); + ff_print_debug_info(s, s->last_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG2); *got_output = 1; } } @@ -2405,7 +2405,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, return AVERROR_INVALIDDATA; } - if (!s2->last_picture_ptr) { + if (!s2->last_pic_ptr) { /* Skip B-frames if we do not have reference frames and * GOP is not closed. */ if (s2->pict_type == AV_PICTURE_TYPE_B) { @@ -2419,7 +2419,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, } if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) s->sync = 1; - if (!s2->next_picture_ptr) { + if (!s2->next_pic_ptr) { /* Skip P-frames if we do not have a reference frame or * we have an invalid header. */ if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) { @@ -2460,7 +2460,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, if ((ret = mpeg_field_start(s2, buf, buf_size)) < 0) return ret; } - if (!s2->current_picture_ptr) { + if (!s2->cur_pic_ptr) { av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n"); return AVERROR_INVALIDDATA; @@ -2524,12 +2524,12 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) { /* special case for last picture */ - if (s2->low_delay == 0 && s2->next_picture_ptr) { - int ret = av_frame_ref(picture, s2->next_picture_ptr->f); + if (s2->low_delay == 0 && s2->next_pic_ptr) { + int ret = av_frame_ref(picture, s2->next_pic_ptr->f); if (ret < 0) return ret; - s2->next_picture_ptr = NULL; + s2->next_pic_ptr = NULL; *got_output = 1; } @@ -2552,14 +2552,14 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, } s->extradata_decoded = 1; if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) { - s2->current_picture_ptr = NULL; + s2->cur_pic_ptr = NULL; return ret; } } ret = decode_chunks(avctx, picture, got_output, buf, buf_size); if (ret<0 || *got_output) { - s2->current_picture_ptr = NULL; + s2->cur_pic_ptr = NULL; if (s->timecode_frame_start != -1 && *got_output) { char tcbuf[AV_TIMECODE_STR_SIZE]; diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index fdb1b1e4a6..bd95451b68 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -290,7 +290,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) AVRational aspect_ratio = s->avctx->sample_aspect_ratio; int aspect_ratio_info; - if (!(s->current_picture.f->flags & AV_FRAME_FLAG_KEY)) + if (!(s->cur_pic.f->flags & AV_FRAME_FLAG_KEY)) return; if (aspect_ratio.num == 0 || aspect_ratio.den == 0) @@ -382,7 +382,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) put_bits(&s->pb, 2, mpeg12->frame_rate_ext.num-1); // frame_rate_ext_n put_bits(&s->pb, 5, mpeg12->frame_rate_ext.den-1); // frame_rate_ext_d - side_data = av_frame_get_side_data(s->current_picture_ptr->f, AV_FRAME_DATA_PANSCAN); + side_data = av_frame_get_side_data(s->cur_pic_ptr->f, AV_FRAME_DATA_PANSCAN); if (side_data) { const AVPanScan *pan_scan = (AVPanScan *)side_data->data; if (pan_scan->width && pan_scan->height) { @@ -419,10 +419,10 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) /* time code: we must convert from the real frame rate to a * fake MPEG frame rate in case of low frame rate */ fps = (framerate.num + framerate.den / 2) / framerate.den; - time_code = s->current_picture_ptr->coded_picture_number + + time_code = s->cur_pic_ptr->coded_picture_number + mpeg12->timecode_frame_start; - mpeg12->gop_picture_number = s->current_picture_ptr->coded_picture_number; + mpeg12->gop_picture_number = s->cur_pic_ptr->coded_picture_number; av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & AV_TIMECODE_FLAG_DROPFRAME)); if (mpeg12->drop_frame_timecode) @@ -530,7 +530,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) if (s->progressive_sequence) put_bits(&s->pb, 1, 0); /* no repeat */ else - put_bits(&s->pb, 1, !!(s->current_picture_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); + put_bits(&s->pb, 1, !!(s->cur_pic_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); /* XXX: optimize the generation of this flag with entropy measures */ s->frame_pred_frame_dct = s->progressive_sequence; @@ -554,7 +554,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) for (i = 0; i < sizeof(svcd_scan_offset_placeholder); i++) put_bits(&s->pb, 8, svcd_scan_offset_placeholder[i]); } - side_data = av_frame_get_side_data(s->current_picture_ptr->f, + side_data = av_frame_get_side_data(s->cur_pic_ptr->f, AV_FRAME_DATA_STEREO3D); if (side_data) { AVStereo3D *stereo = (AVStereo3D *)side_data->data; @@ -594,7 +594,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) } if (CONFIG_MPEG2VIDEO_ENCODER && mpeg12->a53_cc) { - side_data = av_frame_get_side_data(s->current_picture_ptr->f, + side_data = av_frame_get_side_data(s->cur_pic_ptr->f, AV_FRAME_DATA_A53_CC); if (side_data) { if (side_data->size <= A53_MAX_CC_COUNT * 3 && side_data->size % 3 == 0) { diff --git a/libavcodec/mpeg4video.c b/libavcodec/mpeg4video.c index ffeaf822b2..7bbd412aa8 100644 --- a/libavcodec/mpeg4video.c +++ b/libavcodec/mpeg4video.c @@ -98,7 +98,7 @@ static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, uint16_t time_pb = s->pb_time; int p_mx, p_my; - p_mx = s->next_picture.motion_val[0][xy][0]; + p_mx = s->next_pic.motion_val[0][xy][0]; if ((unsigned)(p_mx + tab_bias) < tab_size) { s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx; s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx @@ -108,7 +108,7 @@ static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx : p_mx * (time_pb - time_pp) / time_pp; } - p_my = s->next_picture.motion_val[0][xy][1]; + p_my = s->next_pic.motion_val[0][xy][1]; if ((unsigned)(p_my + tab_bias) < tab_size) { s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my; s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my @@ -129,7 +129,7 @@ static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my) { const int mb_index = s->mb_x + s->mb_y * s->mb_stride; - const int colocated_mb_type = s->next_picture.mb_type[mb_index]; + const int colocated_mb_type = s->next_pic.mb_type[mb_index]; uint16_t time_pp; uint16_t time_pb; int i; @@ -145,7 +145,7 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my) } else if (IS_INTERLACED(colocated_mb_type)) { s->mv_type = MV_TYPE_FIELD; for (i = 0; i < 2; i++) { - int field_select = s->next_picture.ref_index[0][4 * mb_index + 2 * i]; + int field_select = s->next_pic.ref_index[0][4 * mb_index + 2 * i]; s->field_select[0][i] = field_select; s->field_select[1][i] = i; if (s->top_field_first) { diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 482bc48f89..8659ec0376 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -316,7 +316,7 @@ void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir) { int i; int16_t *ac_val, *ac_val1; - int8_t *const qscale_table = s->current_picture.qscale_table; + int8_t *const qscale_table = s->cur_pic.qscale_table; /* find prediction */ ac_val = &s->ac_val[0][0][0] + s->block_index[n] * 16; @@ -968,13 +968,13 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) } while (cbpc == 8); s->cbp_table[xy] = cbpc & 3; - s->current_picture.mb_type[xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA; s->mb_intra = 1; if (cbpc & 4) ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); - s->current_picture.qscale_table[xy] = s->qscale; + s->cur_pic.qscale_table[xy] = s->qscale; s->mbintra_table[xy] = 1; for (i = 0; i < 6; i++) { @@ -992,7 +992,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) s->pred_dir_table[xy] = dir; } else { /* P/S_TYPE */ int mx, my, pred_x, pred_y, bits; - int16_t *const mot_val = s->current_picture.motion_val[0][s->block_index[0]]; + int16_t *const mot_val = s->cur_pic.motion_val[0][s->block_index[0]]; const int stride = s->b8_stride * 2; try_again: @@ -1005,14 +1005,14 @@ try_again: /* skip mb */ if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE) { - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0; mx = get_amv(ctx, 0); my = get_amv(ctx, 1); } else { - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; mx = my = 0; @@ -1045,7 +1045,7 @@ try_again: s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) { - s->current_picture.mb_type[xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA; s->mbintra_table[xy] = 1; mot_val[0] = mot_val[2] = @@ -1078,12 +1078,12 @@ try_again: my = ff_h263_decode_motion(s, pred_y, s->f_code); if (my >= 0xffff) return AVERROR_INVALIDDATA; - s->current_picture.mb_type[xy] = MB_TYPE_16x16 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; } else { mx = get_amv(ctx, 0); my = get_amv(ctx, 1); - s->current_picture.mb_type[xy] = MB_TYPE_16x16 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0; } @@ -1098,7 +1098,7 @@ try_again: mot_val[3 + stride] = my; } else { int i; - s->current_picture.mb_type[xy] = MB_TYPE_8x8 | + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; for (i = 0; i < 4; i++) { int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); @@ -1154,9 +1154,9 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) } s->cbp_table[xy] |= cbpy << 2; - s->current_picture.mb_type[xy] |= ac_pred * MB_TYPE_ACPRED; + s->cur_pic.mb_type[xy] |= ac_pred * MB_TYPE_ACPRED; } else { /* P || S_TYPE */ - if (IS_INTRA(s->current_picture.mb_type[xy])) { + if (IS_INTRA(s->cur_pic.mb_type[xy])) { int i; int dir = 0; int ac_pred = get_bits1(&s->gb); @@ -1170,7 +1170,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) if (s->cbp_table[xy] & 8) ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); - s->current_picture.qscale_table[xy] = s->qscale; + s->cur_pic.qscale_table[xy] = s->qscale; for (i = 0; i < 6; i++) { int dc_pred_dir; @@ -1186,10 +1186,10 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) } s->cbp_table[xy] &= 3; // remove dquant s->cbp_table[xy] |= cbpy << 2; - s->current_picture.mb_type[xy] |= ac_pred * MB_TYPE_ACPRED; + s->cur_pic.mb_type[xy] |= ac_pred * MB_TYPE_ACPRED; s->pred_dir_table[xy] = dir; - } else if (IS_SKIP(s->current_picture.mb_type[xy])) { - s->current_picture.qscale_table[xy] = s->qscale; + } else if (IS_SKIP(s->cur_pic.mb_type[xy])) { + s->cur_pic.qscale_table[xy] = s->qscale; s->cbp_table[xy] = 0; } else { int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); @@ -1202,7 +1202,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) if (s->cbp_table[xy] & 8) ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); - s->current_picture.qscale_table[xy] = s->qscale; + s->cur_pic.qscale_table[xy] = s->qscale; s->cbp_table[xy] &= 3; // remove dquant s->cbp_table[xy] |= (cbpy ^ 0xf) << 2; @@ -1565,20 +1565,20 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) av_assert2(s == (void*)ctx); - mb_type = s->current_picture.mb_type[xy]; + mb_type = s->cur_pic.mb_type[xy]; cbp = s->cbp_table[xy]; use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold; - if (s->current_picture.qscale_table[xy] != s->qscale) - ff_set_qscale(s, s->current_picture.qscale_table[xy]); + if (s->cur_pic.qscale_table[xy] != s->qscale) + ff_set_qscale(s, s->cur_pic.qscale_table[xy]); if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == AV_PICTURE_TYPE_S) { int i; for (i = 0; i < 4; i++) { - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; + s->mv[0][i][0] = s->cur_pic.motion_val[0][s->block_index[i]][0]; + s->mv[0][i][1] = s->cur_pic.motion_val[0][s->block_index[i]][1]; } s->mb_intra = IS_INTRA(mb_type); @@ -1592,14 +1592,14 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) && ctx->vol_sprite_usage == GMC_SPRITE) { s->mcsel = 1; s->mb_skipped = 0; - s->current_picture.mbskip_table[xy] = 0; + s->cur_pic.mbskip_table[xy] = 0; } else { s->mcsel = 0; s->mb_skipped = 1; - s->current_picture.mbskip_table[xy] = 1; + s->cur_pic.mbskip_table[xy] = 1; } } else if (s->mb_intra) { - s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]); + s->ac_pred = IS_ACPRED(s->cur_pic.mb_type[xy]); } else if (!s->mb_intra) { // s->mcsel = 0; // FIXME do we need to init that? @@ -1612,7 +1612,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) } } else { /* I-Frame */ s->mb_intra = 1; - s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]); + s->ac_pred = IS_ACPRED(s->cur_pic.mb_type[xy]); } if (!IS_SKIP(mb_type)) { @@ -1671,23 +1671,23 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv_type = MV_TYPE_16X16; if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE) { - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0; s->mcsel = 1; s->mv[0][0][0] = get_amv(ctx, 0); s->mv[0][0][1] = get_amv(ctx, 1); - s->current_picture.mbskip_table[xy] = 0; + s->cur_pic.mbskip_table[xy] = 0; s->mb_skipped = 0; } else { - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; s->mcsel = 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; - s->current_picture.mbskip_table[xy] = 1; + s->cur_pic.mbskip_table[xy] = 1; s->mb_skipped = 1; } goto end; @@ -1728,7 +1728,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv_dir = MV_DIR_FORWARD; if ((cbpc & 16) == 0) { if (s->mcsel) { - s->current_picture.mb_type[xy] = MB_TYPE_GMC | + s->cur_pic.mb_type[xy] = MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0; /* 16x16 global motion prediction */ @@ -1738,7 +1738,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv[0][0][0] = mx; s->mv[0][0][1] = my; } else if ((!s->progressive_sequence) && get_bits1(&s->gb)) { - s->current_picture.mb_type[xy] = MB_TYPE_16x8 | + s->cur_pic.mb_type[xy] = MB_TYPE_16x8 | MB_TYPE_L0 | MB_TYPE_INTERLACED; /* 16x8 field motion prediction */ @@ -1762,7 +1762,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv[0][i][1] = my; } } else { - s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; /* 16x16 motion prediction */ s->mv_type = MV_TYPE_16X16; ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); @@ -1779,7 +1779,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv[0][0][1] = my; } } else { - s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; + s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; s->mv_type = MV_TYPE_8X8; for (i = 0; i < 4; i++) { mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); @@ -1812,11 +1812,11 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->last_mv[i][1][1] = 0; } - ff_thread_await_progress(&s->next_picture_ptr->tf, s->mb_y, 0); + ff_thread_await_progress(&s->next_pic_ptr->tf, s->mb_y, 0); } /* if we skipped it in the future P-frame than skip it now too */ - s->mb_skipped = s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]; // Note, skiptab=0 if last was GMC + s->mb_skipped = s->next_pic.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]; // Note, skiptab=0 if last was GMC if (s->mb_skipped) { /* skip mb */ @@ -1829,7 +1829,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv[0][0][1] = s->mv[1][0][0] = s->mv[1][0][1] = 0; - s->current_picture.mb_type[xy] = MB_TYPE_SKIP | + s->cur_pic.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; goto end; @@ -1949,7 +1949,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; mb_type |= ff_mpeg4_set_direct_mv(s, mx, my); } - s->current_picture.mb_type[xy] = mb_type; + s->cur_pic.mb_type[xy] = mb_type; } else { /* I-Frame */ int use_intra_dc_vlc; @@ -1968,9 +1968,9 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) intra: s->ac_pred = get_bits1(&s->gb); if (s->ac_pred) - s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; else - s->current_picture.mb_type[xy] = MB_TYPE_INTRA; + s->cur_pic.mb_type[xy] = MB_TYPE_INTRA; cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); if (cbpy < 0) { @@ -2017,11 +2017,11 @@ end: if (s->pict_type == AV_PICTURE_TYPE_B) { const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1; - ff_thread_await_progress(&s->next_picture_ptr->tf, + ff_thread_await_progress(&s->next_pic_ptr->tf, (s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y + 1, s->mb_height - 1) : s->mb_y, 0); - if (s->next_picture.mbskip_table[xy + delta]) + if (s->next_pic.mbskip_table[xy + delta]) return SLICE_OK; } diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index bddc26650a..87b12413ab 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -142,7 +142,7 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], { int score = 0; int i, n; - int8_t *const qscale_table = s->current_picture.qscale_table; + int8_t *const qscale_table = s->cur_pic.qscale_table; memcpy(zigzag_last_index, s->block_last_index, sizeof(int) * 6); @@ -222,7 +222,7 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], void ff_clean_mpeg4_qscales(MpegEncContext *s) { int i; - int8_t *const qscale_table = s->current_picture.qscale_table; + int8_t *const qscale_table = s->cur_pic.qscale_table; ff_clean_h263_qscales(s); @@ -511,7 +511,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], av_assert2(mb_type >= 0); /* nothing to do if this MB was skipped in the next P-frame */ - if (s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]) { // FIXME avoid DCT & ... + if (s->next_pic.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]) { // FIXME avoid DCT & ... s->mv[0][0][0] = s->mv[0][0][1] = s->mv[1][0][0] = @@ -644,7 +644,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], y = s->mb_y * 16; offset = x + y * s->linesize; - p_pic = s->new_picture->data[0] + offset; + p_pic = s->new_pic->data[0] + offset; s->mb_skipped = 1; for (i = 0; i < s->max_b_frames; i++) { @@ -777,8 +777,8 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); ff_h263_encode_motion_vector(s, - s->current_picture.motion_val[0][s->block_index[i]][0] - pred_x, - s->current_picture.motion_val[0][s->block_index[i]][1] - pred_y, + s->cur_pic.motion_val[0][s->block_index[i]][0] - pred_x, + s->cur_pic.motion_val[0][s->block_index[i]][1] - pred_y, s->f_code); } } @@ -886,7 +886,7 @@ static void mpeg4_encode_gop_header(MpegEncContext *s) put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, GOP_STARTCODE); - time = s->current_picture_ptr->f->pts; + time = s->cur_pic_ptr->f->pts; if (s->reordered_input_picture[1]) time = FFMIN(time, s->reordered_input_picture[1]->f->pts); time = time * s->avctx->time_base.num; @@ -1098,7 +1098,7 @@ int ff_mpeg4_encode_picture_header(MpegEncContext *s) } put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */ if (!s->progressive_sequence) { - put_bits(&s->pb, 1, !!(s->current_picture_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); + put_bits(&s->pb, 1, !!(s->cur_pic_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); put_bits(&s->pb, 1, s->alternate_scan); } // FIXME sprite stuff diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index d429b0a839..bc838b05ba 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -49,9 +49,9 @@ void ff_mpeg_er_frame_start(MpegEncContext *s) { ERContext *er = &s->er; - set_erpic(&er->cur_pic, s->current_picture_ptr); - set_erpic(&er->next_pic, s->next_picture_ptr); - set_erpic(&er->last_pic, s->last_picture_ptr); + set_erpic(&er->cur_pic, s->cur_pic_ptr); + set_erpic(&er->next_pic, s->next_pic_ptr); + set_erpic(&er->last_pic, s->last_pic_ptr); er->pp_time = s->pp_time; er->pb_time = s->pb_time; @@ -84,13 +84,13 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, if (!s->chroma_y_shift) s->bdsp.clear_blocks(s->block[6]); - s->dest[0] = s->current_picture.f->data[0] + + s->dest[0] = s->cur_pic.f->data[0] + s->mb_y * 16 * s->linesize + s->mb_x * 16; - s->dest[1] = s->current_picture.f->data[1] + + s->dest[1] = s->cur_pic.f->data[1] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); - s->dest[2] = s->current_picture.f->data[2] + + s->dest[2] = s->cur_pic.f->data[2] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4b1f882105..c8a1d6487a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -678,9 +678,9 @@ int ff_mpv_init_context_frame(MpegEncContext *s) static void clear_context(MpegEncContext *s) { memset(&s->buffer_pools, 0, sizeof(s->buffer_pools)); - memset(&s->next_picture, 0, sizeof(s->next_picture)); - memset(&s->last_picture, 0, sizeof(s->last_picture)); - memset(&s->current_picture, 0, sizeof(s->current_picture)); + memset(&s->next_pic, 0, sizeof(s->next_pic)); + memset(&s->last_pic, 0, sizeof(s->last_pic)); + memset(&s->cur_pic, 0, sizeof(s->cur_pic)); memset(s->thread_context, 0, sizeof(s->thread_context)); @@ -763,9 +763,9 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) goto fail_nomem; } - if (!(s->next_picture.f = av_frame_alloc()) || - !(s->last_picture.f = av_frame_alloc()) || - !(s->current_picture.f = av_frame_alloc())) + if (!(s->next_pic.f = av_frame_alloc()) || + !(s->last_pic.f = av_frame_alloc()) || + !(s->cur_pic.f = av_frame_alloc())) goto fail_nomem; if ((ret = ff_mpv_init_context_frame(s))) @@ -840,15 +840,15 @@ void ff_mpv_common_end(MpegEncContext *s) ff_mpv_picture_free(&s->picture[i]); } av_freep(&s->picture); - ff_mpv_picture_free(&s->last_picture); - ff_mpv_picture_free(&s->current_picture); - ff_mpv_picture_free(&s->next_picture); + ff_mpv_picture_free(&s->last_pic); + ff_mpv_picture_free(&s->cur_pic); + ff_mpv_picture_free(&s->next_pic); s->context_initialized = 0; s->context_reinit = 0; - s->last_picture_ptr = - s->next_picture_ptr = - s->current_picture_ptr = NULL; + s->last_pic_ptr = + s->next_pic_ptr = + s->cur_pic_ptr = NULL; s->linesize = s->uvlinesize = 0; } @@ -881,8 +881,8 @@ void ff_clean_intra_table_entries(MpegEncContext *s) } void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename - const int linesize = s->current_picture.f->linesize[0]; //not s->linesize as this would be wrong for field pics - const int uvlinesize = s->current_picture.f->linesize[1]; + const int linesize = s->cur_pic.f->linesize[0]; //not s->linesize as this would be wrong for field pics + const int uvlinesize = s->cur_pic.f->linesize[1]; const int width_of_mb = (4 + (s->avctx->bits_per_raw_sample > 8)) - s->avctx->lowres; const int height_of_mb = 4 - s->avctx->lowres; @@ -894,9 +894,9 @@ void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; //block_index is not used by mpeg2, so it is not affected by chroma_format - s->dest[0] = s->current_picture.f->data[0] + (int)((s->mb_x - 1U) << width_of_mb); - s->dest[1] = s->current_picture.f->data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); - s->dest[2] = s->current_picture.f->data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); + s->dest[0] = s->cur_pic.f->data[0] + (int)((s->mb_x - 1U) << width_of_mb); + s->dest[1] = s->cur_pic.f->data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); + s->dest[2] = s->cur_pic.f->data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); if (s->picture_structure == PICT_FRAME) { s->dest[0] += s->mb_y * linesize << height_of_mb; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index f5ae0d1ca0..e2953a3198 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -156,29 +156,29 @@ typedef struct MpegEncContext { * copy of the previous picture structure. * note, linesize & data, might not match the previous picture (for field pictures) */ - Picture last_picture; + Picture last_pic; /** * copy of the next picture structure. * note, linesize & data, might not match the next picture (for field pictures) */ - Picture next_picture; + Picture next_pic; /** * Reference to the source picture for encoding. * note, linesize & data, might not match the source picture (for field pictures) */ - AVFrame *new_picture; + AVFrame *new_pic; /** * copy of the current picture structure. * note, linesize & data, might not match the current picture (for field pictures) */ - Picture current_picture; ///< buffer to store the decompressed current picture + Picture cur_pic; ///< buffer to store the decompressed current picture - Picture *last_picture_ptr; ///< pointer to the previous picture. - Picture *next_picture_ptr; ///< pointer to the next picture (for bidir pred) - Picture *current_picture_ptr; ///< pointer to the current picture + Picture *last_pic_ptr; ///< pointer to the previous picture. + Picture *next_pic_ptr; ///< pointer to the next picture (for bidir pred) + Picture *cur_pic_ptr; ///< pointer to the current picture int skipped_last_frame; int last_dc[3]; ///< last DC values for MPEG-1 int16_t *dc_val_base; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index a4c7a0086a..9b04d6a351 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -122,9 +122,9 @@ do {\ }\ } while (0) - UPDATE_PICTURE(current_picture); - UPDATE_PICTURE(last_picture); - UPDATE_PICTURE(next_picture); + UPDATE_PICTURE(cur_pic); + UPDATE_PICTURE(last_pic); + UPDATE_PICTURE(next_pic); s->linesize = s1->linesize; s->uvlinesize = s1->uvlinesize; @@ -134,9 +134,9 @@ do {\ pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \ &new_ctx->picture[pic - old_ctx->picture] : NULL) - s->last_picture_ptr = REBASE_PICTURE(s1->last_picture_ptr, s, s1); - s->current_picture_ptr = REBASE_PICTURE(s1->current_picture_ptr, s, s1); - s->next_picture_ptr = REBASE_PICTURE(s1->next_picture_ptr, s, s1); + s->last_pic_ptr = REBASE_PICTURE(s1->last_pic_ptr, s, s1); + s->cur_pic_ptr = REBASE_PICTURE(s1->cur_pic_ptr, s, s1); + s->next_pic_ptr = REBASE_PICTURE(s1->next_pic_ptr, s, s1); // Error/bug resilience s->workaround_bugs = s1->workaround_bugs; @@ -193,9 +193,9 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s) ff_mpv_free_context_frame(s); - s->last_picture_ptr = - s->next_picture_ptr = - s->current_picture_ptr = NULL; + s->last_pic_ptr = + s->next_pic_ptr = + s->cur_pic_ptr = NULL; if ((s->width || s->height) && (err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0) @@ -326,9 +326,9 @@ int ff_mpv_alloc_dummy_frames(MpegEncContext *s) AVCodecContext *avctx = s->avctx; int ret; - if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) && + if ((!s->last_pic_ptr || !s->last_pic_ptr->f->buf[0]) && (s->pict_type != AV_PICTURE_TYPE_I)) { - if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture_ptr && s->next_picture_ptr->f->buf[0]) + if (s->pict_type == AV_PICTURE_TYPE_B && s->next_pic_ptr && s->next_pic_ptr->f->buf[0]) av_log(avctx, AV_LOG_DEBUG, "allocating dummy last picture for B frame\n"); else if (s->codec_id != AV_CODEC_ID_H261 /* H.261 has no keyframes */ && @@ -337,25 +337,25 @@ int ff_mpv_alloc_dummy_frames(MpegEncContext *s) "warning: first frame is no keyframe\n"); /* Allocate a dummy frame */ - ret = alloc_dummy_frame(s, &s->last_picture_ptr, &s->last_picture); + ret = alloc_dummy_frame(s, &s->last_pic_ptr, &s->last_pic); if (ret < 0) return ret; if (!avctx->hwaccel) { int luma_val = s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263 ? 16 : 0x80; - color_frame(s->last_picture_ptr->f, luma_val); + color_frame(s->last_pic_ptr->f, luma_val); } } - if ((!s->next_picture_ptr || !s->next_picture_ptr->f->buf[0]) && + if ((!s->next_pic_ptr || !s->next_pic_ptr->f->buf[0]) && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ - ret = alloc_dummy_frame(s, &s->next_picture_ptr, &s->next_picture); + ret = alloc_dummy_frame(s, &s->next_pic_ptr, &s->next_pic); if (ret < 0) return ret; } - av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr && - s->last_picture_ptr->f->buf[0])); + av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_pic_ptr && + s->last_pic_ptr->f->buf[0])); return 0; } @@ -376,67 +376,65 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) } /* mark & release old frames */ - if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr && - s->last_picture_ptr != s->next_picture_ptr && - s->last_picture_ptr->f->buf[0]) { - ff_mpeg_unref_picture(s->last_picture_ptr); + if (s->pict_type != AV_PICTURE_TYPE_B && s->last_pic_ptr && + s->last_pic_ptr != s->next_pic_ptr && + s->last_pic_ptr->f->buf[0]) { + ff_mpeg_unref_picture(s->last_pic_ptr); } /* release non reference/forgotten frames */ for (int i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference || - (&s->picture[i] != s->last_picture_ptr && - &s->picture[i] != s->next_picture_ptr)) { + (&s->picture[i] != s->last_pic_ptr && + &s->picture[i] != s->next_pic_ptr)) { ff_mpeg_unref_picture(&s->picture[i]); } } - ff_mpeg_unref_picture(&s->current_picture); - ff_mpeg_unref_picture(&s->last_picture); - ff_mpeg_unref_picture(&s->next_picture); + ff_mpeg_unref_picture(&s->cur_pic); + ff_mpeg_unref_picture(&s->last_pic); + ff_mpeg_unref_picture(&s->next_pic); - ret = alloc_picture(s, &s->current_picture_ptr, + ret = alloc_picture(s, &s->cur_pic_ptr, s->pict_type != AV_PICTURE_TYPE_B && !s->droppable); if (ret < 0) return ret; - s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!s->top_field_first; - s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (!s->progressive_frame && - !s->progressive_sequence); - s->current_picture_ptr->field_picture = s->picture_structure != PICT_FRAME; + s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!s->top_field_first; + s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * + (!s->progressive_frame && !s->progressive_sequence); + s->cur_pic_ptr->field_picture = s->picture_structure != PICT_FRAME; - s->current_picture_ptr->f->pict_type = s->pict_type; + s->cur_pic_ptr->f->pict_type = s->pict_type; if (s->pict_type == AV_PICTURE_TYPE_I) - s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_KEY; + s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_KEY; else - s->current_picture_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; + s->cur_pic_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; - if ((ret = ff_mpeg_ref_picture(&s->current_picture, - s->current_picture_ptr)) < 0) + if ((ret = ff_mpeg_ref_picture(&s->cur_pic, s->cur_pic_ptr)) < 0) return ret; if (s->pict_type != AV_PICTURE_TYPE_B) { - s->last_picture_ptr = s->next_picture_ptr; + s->last_pic_ptr = s->next_pic_ptr; if (!s->droppable) - s->next_picture_ptr = s->current_picture_ptr; + s->next_pic_ptr = s->cur_pic_ptr; } ff_dlog(s->avctx, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", - s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr, - s->last_picture_ptr ? s->last_picture_ptr->f->data[0] : NULL, - s->next_picture_ptr ? s->next_picture_ptr->f->data[0] : NULL, - s->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL, + s->last_pic_ptr, s->next_pic_ptr, s->cur_pic_ptr, + s->last_pic_ptr ? s->last_pic_ptr->f->data[0] : NULL, + s->next_pic_ptr ? s->next_pic_ptr->f->data[0] : NULL, + s->cur_pic_ptr ? s->cur_pic_ptr->f->data[0] : NULL, s->pict_type, s->droppable); - if (s->last_picture_ptr) { - if (s->last_picture_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->last_picture, - s->last_picture_ptr)) < 0) + if (s->last_pic_ptr) { + if (s->last_pic_ptr->f->buf[0] && + (ret = ff_mpeg_ref_picture(&s->last_pic, + s->last_pic_ptr)) < 0) return ret; } - if (s->next_picture_ptr) { - if (s->next_picture_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->next_picture, - s->next_picture_ptr)) < 0) + if (s->next_pic_ptr) { + if (s->next_pic_ptr->f->buf[0] && + (ret = ff_mpeg_ref_picture(&s->next_pic, s->next_pic_ptr)) < 0) return ret; } @@ -459,7 +457,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) } if (s->avctx->debug & FF_DEBUG_NOMC) - color_frame(s->current_picture_ptr->f, 0x80); + color_frame(s->cur_pic_ptr->f, 0x80); return 0; } @@ -469,8 +467,8 @@ void ff_mpv_frame_end(MpegEncContext *s) { emms_c(); - if (s->current_picture.reference) - ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); + if (s->cur_pic.reference) + ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); } void ff_print_debug_info(const MpegEncContext *s, const Picture *p, AVFrame *pict) @@ -512,8 +510,8 @@ int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, const Picture *p void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h) { - ff_draw_horiz_band(s->avctx, s->current_picture_ptr->f, - s->last_picture_ptr ? s->last_picture_ptr->f : NULL, + ff_draw_horiz_band(s->avctx, s->cur_pic_ptr->f, + s->last_pic_ptr ? s->last_pic_ptr->f : NULL, y, h, s->picture_structure, s->first_field, s->low_delay); } @@ -527,11 +525,11 @@ void ff_mpeg_flush(AVCodecContext *avctx) for (int i = 0; i < MAX_PICTURE_COUNT; i++) ff_mpeg_unref_picture(&s->picture[i]); - s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL; + s->cur_pic_ptr = s->last_pic_ptr = s->next_pic_ptr = NULL; - ff_mpeg_unref_picture(&s->current_picture); - ff_mpeg_unref_picture(&s->last_picture); - ff_mpeg_unref_picture(&s->next_picture); + ff_mpeg_unref_picture(&s->cur_pic); + ff_mpeg_unref_picture(&s->last_pic); + ff_mpeg_unref_picture(&s->next_pic); s->mb_x = s->mb_y = 0; @@ -542,7 +540,7 @@ void ff_mpeg_flush(AVCodecContext *avctx) void ff_mpv_report_decode_progress(MpegEncContext *s) { if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->er.error_occurred) - ff_thread_report_progress(&s->current_picture_ptr->tf, s->mb_y, 0); + ff_thread_report_progress(&s->cur_pic_ptr->tf, s->mb_y, 0); } @@ -615,8 +613,8 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, const int h_edge_pos = s->h_edge_pos >> lowres; const int v_edge_pos = s->v_edge_pos >> lowres; int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h; - linesize = s->current_picture.f->linesize[0] << field_based; - uvlinesize = s->current_picture.f->linesize[1] << field_based; + linesize = s->cur_pic.f->linesize[0] << field_based; + uvlinesize = s->cur_pic.f->linesize[1] << field_based; // FIXME obviously not perfect but qpel will not work in lowres anyway if (s->quarter_sample) { @@ -861,7 +859,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, } else { if (s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { - ref_picture = s->current_picture_ptr->f->data; + ref_picture = s->cur_pic_ptr->f->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][0], @@ -878,7 +876,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { ref2picture = ref_picture; } else { - ref2picture = s->current_picture_ptr->f->data; + ref2picture = s->cur_pic_ptr->f->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, @@ -919,7 +917,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, // opposite parity is always in the same // frame if this is second field if (!s->first_field) { - ref_picture = s->current_picture_ptr->f->data; + ref_picture = s->cur_pic_ptr->f->data; } } } diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 1798a25ed9..d7e1085cf8 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -231,11 +231,11 @@ void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix) } /** - * init s->current_picture.qscale_table from s->lambda_table + * init s->cur_pic.qscale_table from s->lambda_table */ void ff_init_qscale_tab(MpegEncContext *s) { - int8_t * const qscale_table = s->current_picture.qscale_table; + int8_t * const qscale_table = s->cur_pic.qscale_table; int i; for (i = 0; i < s->mb_num; i++) { @@ -821,7 +821,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) !FF_ALLOCZ_TYPED_ARRAY(s->q_inter_matrix16, 32) || !FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_B_FRAMES + 1) || !FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_B_FRAMES + 1) || - !(s->new_picture = av_frame_alloc())) + !(s->new_pic = av_frame_alloc())) return AVERROR(ENOMEM); /* Allocate MV tables; the MV and MB tables will be copied @@ -996,7 +996,7 @@ av_cold int ff_mpv_encode_end(AVCodecContext *avctx) for (i = 0; i < FF_ARRAY_ELEMS(s->tmp_frames); i++) av_frame_free(&s->tmp_frames[i]); - av_frame_free(&s->new_picture); + av_frame_free(&s->new_pic); av_freep(&avctx->stats_out); @@ -1340,7 +1340,6 @@ static int estimate_best_b_count(MpegEncContext *s) return AVERROR(ENOMEM); //emms_c(); - //s->next_picture_ptr->quality; p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; @@ -1351,7 +1350,7 @@ static int estimate_best_b_count(MpegEncContext *s) for (i = 0; i < s->max_b_frames + 2; i++) { const Picture *pre_input_ptr = i ? s->input_picture[i - 1] : - s->next_picture_ptr; + s->next_pic_ptr; if (pre_input_ptr) { const uint8_t *data[4]; @@ -1479,8 +1478,8 @@ static int select_input_picture(MpegEncContext *s) if (!s->reordered_input_picture[0] && s->input_picture[0]) { if (s->frame_skip_threshold || s->frame_skip_factor) { if (s->picture_in_gop_number < s->gop_size && - s->next_picture_ptr && - skip_check(s, s->input_picture[0], s->next_picture_ptr)) { + s->next_pic_ptr && + skip_check(s, s->input_picture[0], s->next_pic_ptr)) { // FIXME check that the gop check above is +-1 correct ff_mpeg_unref_picture(s->input_picture[0]); @@ -1491,7 +1490,7 @@ static int select_input_picture(MpegEncContext *s) } if (/*s->picture_in_gop_number >= s->gop_size ||*/ - !s->next_picture_ptr || s->intra_only) { + !s->next_pic_ptr || s->intra_only) { s->reordered_input_picture[0] = s->input_picture[0]; s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; s->reordered_input_picture[0]->coded_picture_number = @@ -1594,14 +1593,14 @@ static int select_input_picture(MpegEncContext *s) } } no_output_pic: - av_frame_unref(s->new_picture); + av_frame_unref(s->new_pic); if (s->reordered_input_picture[0]) { s->reordered_input_picture[0]->reference = s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_B ? 3 : 0; - if ((ret = av_frame_ref(s->new_picture, + if ((ret = av_frame_ref(s->new_pic, s->reordered_input_picture[0]->f))) goto fail; @@ -1631,16 +1630,16 @@ no_output_pic: /* mark us unused / free shared pic */ ff_mpeg_unref_picture(s->reordered_input_picture[0]); - s->current_picture_ptr = pic; + s->cur_pic_ptr = pic; } else { // input is not a shared pix -> reuse buffer for current_pix - s->current_picture_ptr = s->reordered_input_picture[0]; + s->cur_pic_ptr = s->reordered_input_picture[0]; for (i = 0; i < 4; i++) { - if (s->new_picture->data[i]) - s->new_picture->data[i] += INPLACE_OFFSET; + if (s->new_pic->data[i]) + s->new_pic->data[i] += INPLACE_OFFSET; } } - s->picture_number = s->current_picture_ptr->display_picture_number; + s->picture_number = s->cur_pic_ptr->display_picture_number; } return 0; @@ -1652,24 +1651,24 @@ fail: static void frame_end(MpegEncContext *s) { if (s->unrestricted_mv && - s->current_picture.reference && + s->cur_pic.reference && !s->intra_only) { int hshift = s->chroma_x_shift; int vshift = s->chroma_y_shift; - s->mpvencdsp.draw_edges(s->current_picture.f->data[0], - s->current_picture.f->linesize[0], + s->mpvencdsp.draw_edges(s->cur_pic.f->data[0], + s->cur_pic.f->linesize[0], s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); - s->mpvencdsp.draw_edges(s->current_picture.f->data[1], - s->current_picture.f->linesize[1], + s->mpvencdsp.draw_edges(s->cur_pic.f->data[1], + s->cur_pic.f->linesize[1], s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); - s->mpvencdsp.draw_edges(s->current_picture.f->data[2], - s->current_picture.f->linesize[2], + s->mpvencdsp.draw_edges(s->cur_pic.f->data[2], + s->cur_pic.f->linesize[2], s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, @@ -1680,7 +1679,7 @@ static void frame_end(MpegEncContext *s) emms_c(); s->last_pict_type = s->pict_type; - s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality; + s->last_lambda_for [s->pict_type] = s->cur_pic_ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; } @@ -1711,36 +1710,33 @@ static int frame_start(MpegEncContext *s) int ret; /* mark & release old frames */ - if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr && - s->last_picture_ptr != s->next_picture_ptr && - s->last_picture_ptr->f->buf[0]) { - ff_mpeg_unref_picture(s->last_picture_ptr); + if (s->pict_type != AV_PICTURE_TYPE_B && s->last_pic_ptr && + s->last_pic_ptr != s->next_pic_ptr && + s->last_pic_ptr->f->buf[0]) { + ff_mpeg_unref_picture(s->last_pic_ptr); } - s->current_picture_ptr->f->pict_type = s->pict_type; + s->cur_pic_ptr->f->pict_type = s->pict_type; - ff_mpeg_unref_picture(&s->current_picture); - if ((ret = ff_mpeg_ref_picture(&s->current_picture, - s->current_picture_ptr)) < 0) + ff_mpeg_unref_picture(&s->cur_pic); + if ((ret = ff_mpeg_ref_picture(&s->cur_pic, s->cur_pic_ptr)) < 0) return ret; if (s->pict_type != AV_PICTURE_TYPE_B) { - s->last_picture_ptr = s->next_picture_ptr; - s->next_picture_ptr = s->current_picture_ptr; + s->last_pic_ptr = s->next_pic_ptr; + s->next_pic_ptr = s->cur_pic_ptr; } - if (s->last_picture_ptr) { - ff_mpeg_unref_picture(&s->last_picture); - if (s->last_picture_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->last_picture, - s->last_picture_ptr)) < 0) + if (s->last_pic_ptr) { + ff_mpeg_unref_picture(&s->last_pic); + if (s->last_pic_ptr->f->buf[0] && + (ret = ff_mpeg_ref_picture(&s->last_pic, s->last_pic_ptr)) < 0) return ret; } - if (s->next_picture_ptr) { - ff_mpeg_unref_picture(&s->next_picture); - if (s->next_picture_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->next_picture, - s->next_picture_ptr)) < 0) + if (s->next_pic_ptr) { + ff_mpeg_unref_picture(&s->next_pic); + if (s->next_pic_ptr->f->buf[0] && + (ret = ff_mpeg_ref_picture(&s->next_pic, s->next_pic_ptr)) < 0) return ret; } @@ -1771,12 +1767,12 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, } /* output? */ - if (s->new_picture->data[0]) { + if (s->new_pic->data[0]) { 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) { - ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_picture, &pkt_size); + ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_pic, &pkt_size); if (ret < 0) return ret; } @@ -1800,7 +1796,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, init_put_bits(&s->thread_context[i]->pb, start, end - start); } - s->pict_type = s->new_picture->pict_type; + s->pict_type = s->new_pic->pict_type; //emms_c(); ret = frame_start(s); if (ret < 0) @@ -1868,7 +1864,7 @@ vbv_retry: for (i = 0; i < 4; i++) { avctx->error[i] += s->encoding_error[i]; } - ff_side_data_set_encoder_stats(pkt, s->current_picture.f->quality, + ff_side_data_set_encoder_stats(pkt, s->cur_pic.f->quality, s->encoding_error, (avctx->flags&AV_CODEC_FLAG_PSNR) ? MPEGVIDEO_MAX_PLANES : 0, s->pict_type); @@ -1962,10 +1958,10 @@ vbv_retry: } s->total_bits += s->frame_bits; - pkt->pts = s->current_picture.f->pts; - pkt->duration = s->current_picture.f->duration; + pkt->pts = s->cur_pic.f->pts; + pkt->duration = s->cur_pic.f->duration; if (!s->low_delay && s->pict_type != AV_PICTURE_TYPE_B) { - if (!s->current_picture.coded_picture_number) + if (!s->cur_pic.coded_picture_number) pkt->dts = pkt->pts - s->dts_delta; else pkt->dts = s->reordered_pts; @@ -1975,12 +1971,12 @@ vbv_retry: // the no-delay case is handled in generic code if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY) { - ret = ff_encode_reordered_opaque(avctx, pkt, s->current_picture.f); + ret = ff_encode_reordered_opaque(avctx, pkt, s->cur_pic.f); if (ret < 0) return ret; } - if (s->current_picture.f->flags & AV_FRAME_FLAG_KEY) + if (s->cur_pic.f->flags & AV_FRAME_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY; if (s->mb_info) av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size); @@ -2150,7 +2146,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, update_qscale(s); if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) { - s->qscale = s->current_picture_ptr->qscale_table[mb_xy]; + s->qscale = s->cur_pic_ptr->qscale_table[mb_xy]; s->dquant = s->qscale - last_qp; if (s->out_format == FMT_H263) { @@ -2174,11 +2170,11 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, wrap_y = s->linesize; wrap_c = s->uvlinesize; - ptr_y = s->new_picture->data[0] + + ptr_y = s->new_pic->data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; - ptr_cb = s->new_picture->data[1] + + ptr_cb = s->new_pic->data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * mb_block_width; - ptr_cr = s->new_picture->data[2] + + ptr_cr = s->new_pic->data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * mb_block_width; if((mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) && s->codec_id != AV_CODEC_ID_AMV){ @@ -2273,14 +2269,14 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, if (s->mv_dir & MV_DIR_FORWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, - s->last_picture.f->data, + s->last_pic.f->data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->qdsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, - s->next_picture.f->data, + s->next_pic.f->data, op_pix, op_qpix); } @@ -2664,26 +2660,26 @@ static int sse_mb(MpegEncContext *s){ if(w==16 && h==16) if(s->avctx->mb_cmp == FF_CMP_NSSE){ - return s->mecc.nsse[0](s, s->new_picture->data[0] + s->mb_x * 16 + s->mb_y * s->linesize * 16, + return s->mecc.nsse[0](s, s->new_pic->data[0] + s->mb_x * 16 + s->mb_y * s->linesize * 16, s->dest[0], s->linesize, 16) + - s->mecc.nsse[1](s, s->new_picture->data[1] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, + s->mecc.nsse[1](s, s->new_pic->data[1] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, s->dest[1], s->uvlinesize, chroma_mb_h) + - s->mecc.nsse[1](s, s->new_picture->data[2] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, + s->mecc.nsse[1](s, s->new_pic->data[2] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, s->dest[2], s->uvlinesize, chroma_mb_h); }else{ - return s->mecc.sse[0](NULL, s->new_picture->data[0] + s->mb_x * 16 + s->mb_y * s->linesize * 16, + return s->mecc.sse[0](NULL, s->new_pic->data[0] + s->mb_x * 16 + s->mb_y * s->linesize * 16, s->dest[0], s->linesize, 16) + - s->mecc.sse[1](NULL, s->new_picture->data[1] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, + s->mecc.sse[1](NULL, s->new_pic->data[1] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, s->dest[1], s->uvlinesize, chroma_mb_h) + - s->mecc.sse[1](NULL, s->new_picture->data[2] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, + s->mecc.sse[1](NULL, s->new_pic->data[2] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, s->dest[2], s->uvlinesize, chroma_mb_h); } else - return sse(s, s->new_picture->data[0] + s->mb_x * 16 + s->mb_y * s->linesize * 16, + return sse(s, s->new_pic->data[0] + s->mb_x * 16 + s->mb_y * s->linesize * 16, s->dest[0], w, h, s->linesize) + - sse(s, s->new_picture->data[1] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, + sse(s, s->new_pic->data[1] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, s->dest[1], w >> s->chroma_x_shift, h >> s->chroma_y_shift, s->uvlinesize) + - sse(s, s->new_picture->data[2] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, + sse(s, s->new_pic->data[2] + s->mb_x * chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, s->dest[2], w >> s->chroma_x_shift, h >> s->chroma_y_shift, s->uvlinesize); } @@ -2739,7 +2735,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){ for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xx = mb_x * 16; int yy = mb_y * 16; - const uint8_t *pix = s->new_picture->data[0] + (yy * s->linesize) + xx; + const uint8_t *pix = s->new_pic->data[0] + (yy * s->linesize) + xx; int varc; int sum = s->mpvencdsp.pix_sum(pix, s->linesize); @@ -3102,8 +3098,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; + s->mv[0][i][0] = s->cur_pic.motion_val[0][s->block_index[i]][0]; + s->mv[0][i][1] = s->cur_pic.motion_val[0][s->block_index[i]][1]; } encode_mb_hq(s, &backup_s, &best_s, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); @@ -3290,7 +3286,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ } } - s->current_picture.qscale_table[xy] = best_s.qscale; + s->cur_pic.qscale_table[xy] = best_s.qscale; copy_context_after_encode(s, &best_s); @@ -3357,8 +3353,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; + s->mv[0][i][0] = s->cur_pic.motion_val[0][s->block_index[i]][0]; + s->mv[0][i][1] = s->cur_pic.motion_val[0][s->block_index[i]][1]; } break; case CANDIDATE_MB_TYPE_DIRECT: @@ -3459,13 +3455,13 @@ static int encode_thread(AVCodecContext *c, void *arg){ if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; s->encoding_error[0] += sse( - s, s->new_picture->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, + s, s->new_pic->data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize); s->encoding_error[1] += sse( - s, s->new_picture->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, + s, s->new_pic->data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize); s->encoding_error[2] += sse( - s, s->new_picture->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, + s, s->new_pic->data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize); } if(s->loop_filter){ @@ -3522,14 +3518,14 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) static int estimate_qp(MpegEncContext *s, int dry_run){ if (s->next_lambda){ - s->current_picture_ptr->f->quality = - s->current_picture.f->quality = s->next_lambda; + s->cur_pic_ptr->f->quality = + s->cur_pic.f->quality = s->next_lambda; if(!dry_run) s->next_lambda= 0; } else if (!s->fixed_qscale) { int quality = ff_rate_estimate_qscale(s, dry_run); - s->current_picture_ptr->f->quality = - s->current_picture.f->quality = quality; - if (s->current_picture.f->quality < 0) + s->cur_pic_ptr->f->quality = + s->cur_pic.f->quality = quality; + if (s->cur_pic.f->quality < 0) return -1; } @@ -3552,15 +3548,15 @@ static int estimate_qp(MpegEncContext *s, int dry_run){ s->lambda= s->lambda_table[0]; //FIXME broken }else - s->lambda = s->current_picture.f->quality; + s->lambda = s->cur_pic.f->quality; update_qscale(s); return 0; } /* must be called before writing the header */ static void set_frame_distances(MpegEncContext * s){ - av_assert1(s->current_picture_ptr->f->pts != AV_NOPTS_VALUE); - s->time = s->current_picture_ptr->f->pts * s->avctx->time_base.num; + av_assert1(s->cur_pic_ptr->f->pts != AV_NOPTS_VALUE); + s->time = s->cur_pic_ptr->f->pts * s->avctx->time_base.num; if(s->pict_type==AV_PICTURE_TYPE_B){ s->pb_time= s->pp_time - (s->last_non_b_time - s->time); @@ -3591,7 +3587,7 @@ static int encode_picture(MpegEncContext *s) s->me.scene_change_score=0; -// s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME rate distortion +// s->lambda= s->cur_pic_ptr->quality; //FIXME qscale / ... stuff for ME rate distortion if(s->pict_type==AV_PICTURE_TYPE_I){ if(s->msmpeg4_version >= 3) s->no_rounding=1; @@ -3781,16 +3777,16 @@ static int encode_picture(MpegEncContext *s) //FIXME var duplication if (s->pict_type == AV_PICTURE_TYPE_I) { - s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_KEY; //FIXME pic_ptr - s->current_picture.f->flags |= AV_FRAME_FLAG_KEY; + s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_KEY; //FIXME pic_ptr + s->cur_pic.f->flags |= AV_FRAME_FLAG_KEY; } else { - s->current_picture_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; //FIXME pic_ptr - s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY; + s->cur_pic_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; //FIXME pic_ptr + s->cur_pic.f->flags &= ~AV_FRAME_FLAG_KEY; } - s->current_picture_ptr->f->pict_type = - s->current_picture.f->pict_type = s->pict_type; + s->cur_pic_ptr->f->pict_type = + s->cur_pic.f->pict_type = s->pict_type; - if (s->current_picture.f->flags & AV_FRAME_FLAG_KEY) + if (s->cur_pic.f->flags & AV_FRAME_FLAG_KEY) s->picture_in_gop_number=0; s->mb_x = s->mb_y = 0; diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 56bdce59c0..3824832f9d 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -93,8 +93,8 @@ void mpeg_motion_internal(MpegEncContext *s, ptrdiff_t uvlinesize, linesize; v_edge_pos = s->v_edge_pos >> field_based; - linesize = s->current_picture.f->linesize[0] << field_based; - uvlinesize = s->current_picture.f->linesize[1] << field_based; + linesize = s->cur_pic.f->linesize[0] << field_based; + uvlinesize = s->cur_pic.f->linesize[1] << field_based; block_y_half = (field_based | is_16x8); dxy = ((motion_y & 1) << 1) | (motion_x & 1); @@ -514,7 +514,7 @@ static inline void apply_obmc(MpegEncContext *s, op_pixels_func (*pix_op)[4]) { LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); - const Picture *cur_frame = &s->current_picture; + const Picture *cur_frame = &s->cur_pic; int mb_x = s->mb_x; int mb_y = s->mb_y; const int xy = mb_x + mb_y * s->mb_stride; @@ -749,7 +749,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, av_assert2(s->out_format == FMT_MPEG1); if (s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { - ref_picture = s->current_picture_ptr->f->data; + ref_picture = s->cur_pic_ptr->f->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -767,7 +767,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { ref2picture = ref_picture; } else { - ref2picture = s->current_picture_ptr->f->data; + ref2picture = s->cur_pic_ptr->f->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -807,7 +807,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, /* opposite parity is always in the same frame if this is * second field */ if (!s->first_field) - ref_picture = s->current_picture_ptr->f->data; + ref_picture = s->cur_pic_ptr->f->data; } } break; diff --git a/libavcodec/mpv_reconstruct_mb_template.c b/libavcodec/mpv_reconstruct_mb_template.c index 6f7a5fb1b4..febada041a 100644 --- a/libavcodec/mpv_reconstruct_mb_template.c +++ b/libavcodec/mpv_reconstruct_mb_template.c @@ -59,7 +59,7 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], #define IS_MPEG12(s) (is_mpeg12 == MAY_BE_MPEG12 ? ((s)->out_format == FMT_MPEG1) : is_mpeg12) const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; - s->current_picture.qscale_table[mb_xy] = s->qscale; + s->cur_pic.qscale_table[mb_xy] = s->qscale; /* update DC predictors for P macroblocks */ if (!s->mb_intra) { @@ -82,8 +82,8 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], { uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; - const int linesize = s->current_picture.f->linesize[0]; //not s->linesize as this would be wrong for field pics - const int uvlinesize = s->current_picture.f->linesize[1]; + const int linesize = s->cur_pic.f->linesize[0]; //not s->linesize as this would be wrong for field pics + const int uvlinesize = s->cur_pic.f->linesize[1]; const int readable = IS_ENCODER || lowres_flag || s->pict_type != AV_PICTURE_TYPE_B; const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8; @@ -96,7 +96,7 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], s->mb_skipped = 0; av_assert2(s->pict_type!=AV_PICTURE_TYPE_I); *mbskip_ptr = 1; - } else if(!s->current_picture.reference) { + } else if (!s->cur_pic.reference) { *mbskip_ptr = 1; } else{ *mbskip_ptr = 0; /* not skipped */ @@ -124,11 +124,11 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], if (HAVE_THREADS && is_mpeg12 != DEFINITELY_MPEG12 && s->avctx->active_thread_type & FF_THREAD_FRAME) { if (s->mv_dir & MV_DIR_FORWARD) { - ff_thread_await_progress(&s->last_picture_ptr->tf, + ff_thread_await_progress(&s->last_pic_ptr->tf, lowest_referenced_row(s, 0), 0); } if (s->mv_dir & MV_DIR_BACKWARD) { - ff_thread_await_progress(&s->next_picture_ptr->tf, + ff_thread_await_progress(&s->next_pic_ptr->tf, lowest_referenced_row(s, 1), 0); } } @@ -137,11 +137,11 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], const h264_chroma_mc_func *op_pix = s->h264chroma.put_h264_chroma_pixels_tab; if (s->mv_dir & MV_DIR_FORWARD) { - MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f->data, op_pix); + MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.f->data, op_pix); op_pix = s->h264chroma.avg_h264_chroma_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { - MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f->data, op_pix); + MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.f->data, op_pix); } } else { op_pixels_func (*op_pix)[4]; @@ -155,12 +155,12 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], op_qpix = s->qdsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { - ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f->data, op_pix, op_qpix); + ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.f->data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->qdsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { - ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f->data, op_pix, op_qpix); + ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.f->data, op_pix, op_qpix); } } diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index e327bf36a7..323f083f8f 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -282,10 +282,10 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, int bs = 8 >> s->avctx->lowres; if(n<4){ wrap= s->linesize; - dest= s->current_picture.f->data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs; + dest = s->cur_pic.f->data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs; }else{ wrap= s->uvlinesize; - dest= s->current_picture.f->data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs; + dest = s->cur_pic.f->data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs; } if(s->mb_x==0) a= (1024 + (scale>>1))/scale; else a= get_dc(dest-bs, wrap, scale*8>>(2*s->avctx->lowres), bs); diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index bf1e4877bd..c354f46c50 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -105,7 +105,7 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code) static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) { int cbp, code, i; - uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; + uint32_t * const mb_type_ptr = &s->cur_pic.mb_type[s->mb_x + s->mb_y*s->mb_stride]; if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->use_skip_mb_code) { @@ -207,7 +207,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64]) { int cbp, code, i; uint8_t *coded_val; - uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; + uint32_t * const mb_type_ptr = &s->cur_pic.mb_type[s->mb_x + s->mb_y*s->mb_stride]; if (get_bits_left(&s->gb) <= 0) return AVERROR_INVALIDDATA; diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index dd0d403338..6a4b5aeb59 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -431,7 +431,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_mpv_frame_end(s); - f = s->current_picture.f; + f = s->cur_pic.f; if (v->respic == 3) { ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h); diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c index 139f287617..76ef81ea4d 100644 --- a/libavcodec/nvdec_mpeg12.c +++ b/libavcodec/nvdec_mpeg12.c @@ -39,7 +39,7 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer CUVIDMPEG2PICPARAMS *ppc = &pp->CodecSpecific.mpeg2; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->current_picture.f; + AVFrame *cur_frame = s->cur_pic.f; int ret, i; @@ -64,8 +64,8 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer s->pict_type == AV_PICTURE_TYPE_P, .CodecSpecific.mpeg2 = { - .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_picture.f), - .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_picture.f), + .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.f), + .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.f), .picture_coding_type = s->pict_type, .full_pel_forward_vector = s->full_pel[0], diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c index 20a0499437..468002d1c5 100644 --- a/libavcodec/nvdec_mpeg4.c +++ b/libavcodec/nvdec_mpeg4.c @@ -38,7 +38,7 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, CUVIDMPEG4PICPARAMS *ppc = &pp->CodecSpecific.mpeg4; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->current_picture.f; + AVFrame *cur_frame = s->cur_pic.f; int ret, i; @@ -60,8 +60,8 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, s->pict_type == AV_PICTURE_TYPE_S, .CodecSpecific.mpeg4 = { - .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_picture.f), - .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_picture.f), + .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.f), + .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.f), .video_object_layer_width = s->width, .video_object_layer_height = s->height, diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c index 5096d784df..40cd18a8e7 100644 --- a/libavcodec/nvdec_vc1.c +++ b/libavcodec/nvdec_vc1.c @@ -38,7 +38,7 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u CUVIDPICPARAMS *pp = &ctx->pic_params; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->current_picture.f; + AVFrame *cur_frame = s->cur_pic.f; int ret; @@ -63,8 +63,8 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u s->pict_type == AV_PICTURE_TYPE_P, .CodecSpecific.vc1 = { - .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_picture.f), - .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_picture.f), + .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.f), + .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.f), .FrameWidth = cur_frame->width, .FrameHeight = cur_frame->height, diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index ecc157a9eb..e4d18ff669 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -40,10 +40,10 @@ void ff_write_pass1_stats(MpegEncContext *s) snprintf(s->avctx->stats_out, 256, "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d " "fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d hbits:%d;\n", - s->current_picture_ptr->display_picture_number, - s->current_picture_ptr->coded_picture_number, + s->cur_pic_ptr->display_picture_number, + s->cur_pic_ptr->coded_picture_number, s->pict_type, - s->current_picture.f->quality, + s->cur_pic.f->quality, s->i_tex_bits, s->p_tex_bits, s->mv_bits, @@ -936,9 +936,9 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) * here instead of reordering but the reordering is simpler for now * until H.264 B-pyramid must be handled. */ if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) - dts_pic = s->current_picture_ptr; + dts_pic = s->cur_pic_ptr; else - dts_pic = s->last_picture_ptr; + dts_pic = s->last_pic_ptr; if (!dts_pic || dts_pic->f->pts == AV_NOPTS_VALUE) wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index df487b24a9..aea42dd314 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -170,7 +170,7 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); return -1; } - if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->last_pic_ptr && s->pict_type == AV_PICTURE_TYPE_B) { av_log(s->avctx, AV_LOG_ERROR, "early B-frame\n"); return AVERROR_INVALIDDATA; } @@ -458,9 +458,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, if (whole_size < s->mb_width * s->mb_height / 8) return AVERROR_INVALIDDATA; - if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { + if ((s->mb_x == 0 && s->mb_y == 0) || !s->cur_pic_ptr) { // FIXME write parser so we always have complete frames? - if (s->current_picture_ptr) { + if (s->cur_pic_ptr) { ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); s->mb_x = s->mb_y = s->resync_mb_x = s->resync_mb_y = 0; @@ -469,7 +469,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, return ret; ff_mpeg_er_frame_start(s); } else { - if (s->current_picture_ptr->f->pict_type != s->pict_type) { + if (s->cur_pic_ptr->f->pict_type != s->pict_type) { av_log(s->avctx, AV_LOG_ERROR, "Slice type mismatch\n"); return AVERROR_INVALIDDATA; } @@ -632,28 +632,28 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, i++; } - if (s->current_picture_ptr && s->mb_y >= s->mb_height) { + if (s->cur_pic_ptr && s->mb_y >= s->mb_height) { ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); - } else if (s->last_picture_ptr) { - if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) + ff_print_debug_info(s, s->cur_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + } else if (s->last_pic_ptr) { + if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->last_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict,s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); } - if (s->last_picture_ptr || s->low_delay) { + if (s->last_pic_ptr || s->low_delay) { *got_frame = 1; } // so we can detect if frame_end was not called (find some nicer solution...) - s->current_picture_ptr = NULL; + s->cur_pic_ptr = NULL; } return avpkt->size; diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c index 316962fbbb..a4e38edf54 100644 --- a/libavcodec/rv30.c +++ b/libavcodec/rv30.c @@ -160,7 +160,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - int mbtype = s->current_picture_ptr->mb_type[mb_pos]; + int mbtype = s->cur_pic_ptr->mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) @@ -172,11 +172,11 @@ static void rv30_loop_filter(RV34DecContext *r, int row) */ mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]]; + cur_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos]]; if(mb_x) - left_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - 1]]; + left_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos - 1]]; for(j = 0; j < 16; j += 4){ - Y = s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x; + Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x; for(i = !mb_x; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; @@ -196,7 +196,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) if(mb_x) left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF; for(j = 0; j < 8; j += 4){ - C = s->current_picture_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x; + C = s->cur_pic_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x; for(i = !mb_x; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; @@ -214,11 +214,11 @@ static void rv30_loop_filter(RV34DecContext *r, int row) } mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]]; + cur_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos]]; if(row) - top_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - s->mb_stride]]; + top_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos - s->mb_stride]]; for(j = 4*!row; j < 16; j += 4){ - Y = s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize; + Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; @@ -238,7 +238,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) if(row) top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF; for(j = 4*!row; j < 8; j += 4){ - C = s->current_picture_ptr->f->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize; + C = s->cur_pic_ptr->f->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 23a570bb80..467a6ab5a1 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -367,7 +367,7 @@ static int rv34_decode_intra_mb_header(RV34DecContext *r, int8_t *intra_types) r->is16 = get_bits1(gb); if(r->is16){ - s->current_picture_ptr->mb_type[mb_pos] = MB_TYPE_INTRA16x16; + s->cur_pic_ptr->mb_type[mb_pos] = MB_TYPE_INTRA16x16; r->block_type = RV34_MB_TYPE_INTRA16x16; t = get_bits(gb, 2); fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0])); @@ -377,7 +377,7 @@ static int rv34_decode_intra_mb_header(RV34DecContext *r, int8_t *intra_types) if(!get_bits1(gb)) av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n"); } - s->current_picture_ptr->mb_type[mb_pos] = MB_TYPE_INTRA; + s->cur_pic_ptr->mb_type[mb_pos] = MB_TYPE_INTRA; r->block_type = RV34_MB_TYPE_INTRA; if(r->decode_intra_types(r, gb, intra_types) < 0) return -1; @@ -403,7 +403,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) r->block_type = r->decode_mb_info(r); if(r->block_type == -1) return -1; - s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type]; + s->cur_pic_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type]; r->mb_type[mb_pos] = r->block_type; if(r->block_type == RV34_MB_SKIP){ if(s->pict_type == AV_PICTURE_TYPE_P) @@ -411,7 +411,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) if(s->pict_type == AV_PICTURE_TYPE_B) r->mb_type[mb_pos] = RV34_MB_B_DIRECT; } - r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]); + r->is16 = !!IS_INTRA16x16(s->cur_pic_ptr->mb_type[mb_pos]); if (rv34_decode_mv(r, r->block_type) < 0) return -1; if(r->block_type == RV34_MB_SKIP){ @@ -421,7 +421,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) r->chroma_vlc = 1; r->luma_vlc = 0; - if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){ + if(IS_INTRA(s->cur_pic_ptr->mb_type[mb_pos])){ if(r->is16){ t = get_bits(gb, 2); fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0])); @@ -486,27 +486,27 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int c_off = -1; if(avail[-1]){ - A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0]; - A[1] = s->current_picture_ptr->motion_val[0][mv_pos-1][1]; + A[0] = s->cur_pic_ptr->motion_val[0][mv_pos-1][0]; + A[1] = s->cur_pic_ptr->motion_val[0][mv_pos-1][1]; } if(avail[-4]){ - B[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][0]; - B[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][1]; + B[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride][0]; + B[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride][1]; }else{ B[0] = A[0]; B[1] = A[1]; } if(!avail[c_off-4]){ if(avail[-4] && (avail[-1] || r->rv30)){ - C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][0]; - C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][1]; + C[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride-1][0]; + C[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride-1][1]; }else{ C[0] = A[0]; C[1] = A[1]; } }else{ - C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][0]; - C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][1]; + C[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][0]; + C[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][1]; } mx = mid_pred(A[0], B[0], C[0]); my = mid_pred(A[1], B[1], C[1]); @@ -514,8 +514,8 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int my += r->dmv[dmv_no][1]; for(j = 0; j < part_sizes_h[block_type]; j++){ for(i = 0; i < part_sizes_w[block_type]; i++){ - s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx; - s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my; + s->cur_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx; + s->cur_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my; } } } @@ -564,7 +564,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) int has_A = 0, has_B = 0, has_C = 0; int mx, my; int i, j; - Picture *cur_pic = s->current_picture_ptr; + Picture *cur_pic = s->cur_pic_ptr; const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0; int type = cur_pic->mb_type[mb_pos]; @@ -617,27 +617,27 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) int* avail = r->avail_cache + avail_indexes[0]; if(avail[-1]){ - A[0] = s->current_picture_ptr->motion_val[0][mv_pos - 1][0]; - A[1] = s->current_picture_ptr->motion_val[0][mv_pos - 1][1]; + A[0] = s->cur_pic_ptr->motion_val[0][mv_pos - 1][0]; + A[1] = s->cur_pic_ptr->motion_val[0][mv_pos - 1][1]; } if(avail[-4]){ - B[0] = s->current_picture_ptr->motion_val[0][mv_pos - s->b8_stride][0]; - B[1] = s->current_picture_ptr->motion_val[0][mv_pos - s->b8_stride][1]; + B[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride][0]; + B[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride][1]; }else{ B[0] = A[0]; B[1] = A[1]; } if(!avail[-4 + 2]){ if(avail[-4] && (avail[-1])){ - C[0] = s->current_picture_ptr->motion_val[0][mv_pos - s->b8_stride - 1][0]; - C[1] = s->current_picture_ptr->motion_val[0][mv_pos - s->b8_stride - 1][1]; + C[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride - 1][0]; + C[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride - 1][1]; }else{ C[0] = A[0]; C[1] = A[1]; } }else{ - C[0] = s->current_picture_ptr->motion_val[0][mv_pos - s->b8_stride + 2][0]; - C[1] = s->current_picture_ptr->motion_val[0][mv_pos - s->b8_stride + 2][1]; + C[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride + 2][0]; + C[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride + 2][1]; } mx = mid_pred(A[0], B[0], C[0]); my = mid_pred(A[1], B[1], C[1]); @@ -646,8 +646,8 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) for(j = 0; j < 2; j++){ for(i = 0; i < 2; i++){ for(k = 0; k < 2; k++){ - s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx; - s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my; + s->cur_pic_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx; + s->cur_pic_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my; } } } @@ -686,24 +686,24 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, if(thirdpel){ int chroma_mx, chroma_my; - mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); - my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); - lx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; - ly = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; - chroma_mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] / 2; - chroma_my = s->current_picture_ptr->motion_val[dir][mv_pos][1] / 2; + mx = (s->cur_pic_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); + my = (s->cur_pic_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); + lx = (s->cur_pic_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; + ly = (s->cur_pic_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; + chroma_mx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] / 2; + chroma_my = s->cur_pic_ptr->motion_val[dir][mv_pos][1] / 2; umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24); umy = (chroma_my + (3 << 24)) / 3 - (1 << 24); uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3]; uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3]; }else{ int cx, cy; - mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; - my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; - lx = s->current_picture_ptr->motion_val[dir][mv_pos][0] & 3; - ly = s->current_picture_ptr->motion_val[dir][mv_pos][1] & 3; - cx = s->current_picture_ptr->motion_val[dir][mv_pos][0] / 2; - cy = s->current_picture_ptr->motion_val[dir][mv_pos][1] / 2; + mx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] >> 2; + my = s->cur_pic_ptr->motion_val[dir][mv_pos][1] >> 2; + lx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] & 3; + ly = s->cur_pic_ptr->motion_val[dir][mv_pos][1] & 3; + cx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] / 2; + cy = s->cur_pic_ptr->motion_val[dir][mv_pos][1] / 2; umx = cx >> 2; umy = cy >> 2; uvmx = (cx & 3) << 1; @@ -716,14 +716,14 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { /* wait for the referenced mb row to be finished */ int mb_row = s->mb_y + ((yoff + my + 5 + 8 * height) >> 4); - const ThreadFrame *f = dir ? &s->next_picture_ptr->tf : &s->last_picture_ptr->tf; + const ThreadFrame *f = dir ? &s->next_pic_ptr->tf : &s->last_pic_ptr->tf; ff_thread_await_progress(f, mb_row, 0); } dxy = ly*4 + lx; - srcY = dir ? s->next_picture_ptr->f->data[0] : s->last_picture_ptr->f->data[0]; - srcU = dir ? s->next_picture_ptr->f->data[1] : s->last_picture_ptr->f->data[1]; - srcV = dir ? s->next_picture_ptr->f->data[2] : s->last_picture_ptr->f->data[2]; + srcY = dir ? s->next_pic_ptr->f->data[0] : s->last_pic_ptr->f->data[0]; + srcU = dir ? s->next_pic_ptr->f->data[1] : s->last_pic_ptr->f->data[1]; + srcV = dir ? s->next_pic_ptr->f->data[2] : s->last_pic_ptr->f->data[2]; src_x = s->mb_x * 16 + xoff + mx; src_y = s->mb_y * 16 + yoff + my; uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx; @@ -884,11 +884,11 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) switch(block_type){ case RV34_MB_TYPE_INTRA: case RV34_MB_TYPE_INTRA16x16: - ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); return 0; case RV34_MB_SKIP: if(s->pict_type == AV_PICTURE_TYPE_P){ - ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0); break; } @@ -896,23 +896,23 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) //surprisingly, it uses motion scheme from next reference frame /* wait for the current mb row to be finished */ if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_await_progress(&s->next_picture_ptr->tf, FFMAX(0, s->mb_y-1), 0); + ff_thread_await_progress(&s->next_pic_ptr->tf, FFMAX(0, s->mb_y-1), 0); - next_bt = s->next_picture_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride]; + next_bt = s->next_pic_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride]; if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){ - ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); - ZERO8x2(s->current_picture_ptr->motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic_ptr->motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); }else for(j = 0; j < 2; j++) for(i = 0; i < 2; i++) for(k = 0; k < 2; k++) for(l = 0; l < 2; l++) - s->current_picture_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]); + s->cur_pic_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]); if(!(IS_16X8(next_bt) || IS_8X16(next_bt) || IS_8X8(next_bt))) //we can use whole macroblock MC rv34_mc_2mv(r, block_type); else rv34_mc_2mv_skip(r); - ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); break; case RV34_MB_P_16x16: case RV34_MB_P_MIX16x16: @@ -1180,7 +1180,7 @@ static int rv34_set_deblock_coef(RV34DecContext *r) MpegEncContext *s = &r->s; int hmvmask = 0, vmvmask = 0, i, j; int midx = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride; - int16_t (*motion_val)[2] = &s->current_picture_ptr->motion_val[0][midx]; + int16_t (*motion_val)[2] = &s->cur_pic_ptr->motion_val[0][midx]; for(j = 0; j < 16; j += 8){ for(i = 0; i < 2; i++){ if(is_mv_diff_gt_3(motion_val + i, 1)) @@ -1223,26 +1223,26 @@ static int rv34_decode_inter_macroblock(RV34DecContext *r, int8_t *intra_types) dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width; if(s->mb_x && dist) r->avail_cache[5] = - r->avail_cache[9] = s->current_picture_ptr->mb_type[mb_pos - 1]; + r->avail_cache[9] = s->cur_pic_ptr->mb_type[mb_pos - 1]; if(dist >= s->mb_width) r->avail_cache[2] = - r->avail_cache[3] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride]; + r->avail_cache[3] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride]; if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1) - r->avail_cache[4] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride + 1]; + r->avail_cache[4] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride + 1]; if(s->mb_x && dist > s->mb_width) - r->avail_cache[1] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride - 1]; + r->avail_cache[1] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride - 1]; s->qscale = r->si.quant; cbp = cbp2 = rv34_decode_inter_mb_header(r, intra_types); r->cbp_luma [mb_pos] = cbp; r->cbp_chroma[mb_pos] = cbp >> 16; r->deblock_coefs[mb_pos] = rv34_set_deblock_coef(r) | r->cbp_luma[mb_pos]; - s->current_picture_ptr->qscale_table[mb_pos] = s->qscale; + s->cur_pic_ptr->qscale_table[mb_pos] = s->qscale; if(cbp == -1) return -1; - if (IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){ + if (IS_INTRA(s->cur_pic_ptr->mb_type[mb_pos])){ if(r->is16) rv34_output_i16x16(r, intra_types, cbp); else rv34_output_intra(r, intra_types, cbp); return 0; @@ -1325,21 +1325,21 @@ static int rv34_decode_intra_macroblock(RV34DecContext *r, int8_t *intra_types) dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width; if(s->mb_x && dist) r->avail_cache[5] = - r->avail_cache[9] = s->current_picture_ptr->mb_type[mb_pos - 1]; + r->avail_cache[9] = s->cur_pic_ptr->mb_type[mb_pos - 1]; if(dist >= s->mb_width) r->avail_cache[2] = - r->avail_cache[3] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride]; + r->avail_cache[3] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride]; if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1) - r->avail_cache[4] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride + 1]; + r->avail_cache[4] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride + 1]; if(s->mb_x && dist > s->mb_width) - r->avail_cache[1] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride - 1]; + r->avail_cache[1] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride - 1]; s->qscale = r->si.quant; cbp = rv34_decode_intra_mb_header(r, intra_types); r->cbp_luma [mb_pos] = cbp; r->cbp_chroma[mb_pos] = cbp >> 16; r->deblock_coefs[mb_pos] = 0xFFFF; - s->current_picture_ptr->qscale_table[mb_pos] = s->qscale; + s->cur_pic_ptr->qscale_table[mb_pos] = s->qscale; if(cbp == -1) return -1; @@ -1480,7 +1480,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int r->loop_filter(r, s->mb_y - 2); if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_report_progress(&s->current_picture_ptr->tf, + ff_thread_report_progress(&s->cur_pic_ptr->tf, s->mb_y - 2, 0); } @@ -1578,19 +1578,19 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) s->mb_num_left = 0; if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); + ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); if (s->pict_type == AV_PICTURE_TYPE_B) { - if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->cur_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); got_picture = 1; - } else if (s->last_picture_ptr) { - if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) + } else if (s->last_pic_ptr) { + if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->last_pic_ptr, pict); + ff_mpv_export_qp_table(s, pict, s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); got_picture = 1; } @@ -1625,10 +1625,10 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ - if (s->next_picture_ptr) { - if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) + if (s->next_pic_ptr) { + if ((ret = av_frame_ref(pict, s->next_pic_ptr->f)) < 0) return ret; - s->next_picture_ptr = NULL; + s->next_pic_ptr = NULL; *got_picture_ptr = 1; } @@ -1651,7 +1651,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); return AVERROR_INVALIDDATA; } - if ((!s->last_picture_ptr || !s->last_picture_ptr->f->data[0]) && + if ((!s->last_pic_ptr || !s->last_pic_ptr->f->data[0]) && si.type == AV_PICTURE_TYPE_B) { av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference data.\n"); @@ -1664,7 +1664,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* first slice */ if (si.start == 0) { - if (s->mb_num_left > 0 && s->current_picture_ptr) { + if (s->mb_num_left > 0 && s->cur_pic_ptr) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); if (!s->context_reinit) @@ -1789,7 +1789,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, break; } - if (s->current_picture_ptr) { + if (s->cur_pic_ptr) { if (last) { if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); @@ -1806,7 +1806,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); s->mb_num_left = 0; - ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); + ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); return AVERROR_INVALIDDATA; } } diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index 19d4e742df..a98e64f5bf 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -371,7 +371,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - int mbtype = s->current_picture_ptr->mb_type[mb_pos]; + int mbtype = s->cur_pic_ptr->mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) @@ -386,7 +386,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) unsigned y_to_deblock; int c_to_deblock[2]; - q = s->current_picture_ptr->qscale_table[mb_pos]; + q = s->cur_pic_ptr->qscale_table[mb_pos]; alpha = rv40_alpha_tab[q]; beta = rv40_beta_tab [q]; betaY = betaC = beta * 3; @@ -401,7 +401,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) if(avail[i]){ int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride; mvmasks[i] = r->deblock_coefs[pos]; - mbtype [i] = s->current_picture_ptr->mb_type[pos]; + mbtype [i] = s->cur_pic_ptr->mb_type[pos]; cbp [i] = r->cbp_luma[pos]; uvcbp[i][0] = r->cbp_chroma[pos] & 0xF; uvcbp[i][1] = r->cbp_chroma[pos] >> 4; @@ -460,7 +460,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) } for(j = 0; j < 16; j += 4){ - Y = s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize; + Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0; @@ -505,7 +505,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) } for(k = 0; k < 2; k++){ for(j = 0; j < 2; j++){ - C = s->current_picture_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize; + C = s->cur_pic_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + j*2; int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0; diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index b59dc04edc..1ed7581fea 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -1834,9 +1834,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (ret < 0) return ret; - mpv->current_picture_ptr = &mpv->current_picture; - mpv->current_picture.f = s->current_picture; - mpv->current_picture.f->pts = pict->pts; + mpv->cur_pic_ptr = &mpv->cur_pic; + mpv->cur_pic.f = s->current_picture; + mpv->cur_pic.f->pts = pict->pts; if(pic->pict_type == AV_PICTURE_TYPE_P){ int block_width = (width +15)>>4; int block_height= (height+15)>>4; @@ -1846,9 +1846,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, av_assert0(s->last_picture[0]->data[0]); mpv->avctx = s->avctx; - mpv->last_picture.f = s->last_picture[0]; - mpv-> new_picture = s->input_picture; - mpv->last_picture_ptr = &mpv->last_picture; + mpv->last_pic.f = s->last_picture[0]; + mpv-> new_pic = s->input_picture; + mpv->last_pic_ptr = &mpv->last_pic; mpv->linesize = stride; mpv->uvlinesize = s->current_picture->linesize[1]; mpv->width = width; @@ -2043,9 +2043,9 @@ redo_frame: mpv->frame_bits = 8 * (s->c.bytestream - s->c.bytestream_start); mpv->p_tex_bits = mpv->frame_bits - mpv->misc_bits - mpv->mv_bits; mpv->total_bits += 8*(s->c.bytestream - s->c.bytestream_start); - mpv->current_picture.display_picture_number = - mpv->current_picture.coded_picture_number = avctx->frame_num; - mpv->current_picture.f->quality = pic->quality; + mpv->cur_pic.display_picture_number = + mpv->cur_pic.coded_picture_number = avctx->frame_num; + mpv->cur_pic.f->quality = pic->quality; if (enc->pass1_rc) if (ff_rate_estimate_qscale(mpv, 0) < 0) return -1; diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index d71ad07b86..52140494bb 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -326,13 +326,13 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, if (s->pict_type == AV_PICTURE_TYPE_P) { s->m.avctx = s->avctx; - s->m.current_picture_ptr = &s->m.current_picture; - s->m.last_picture_ptr = &s->m.last_picture; - s->m.last_picture.f->data[0] = ref_plane; + s->m.cur_pic_ptr = &s->m.cur_pic; + s->m.last_pic_ptr = &s->m.last_pic; + s->m.last_pic.f->data[0] = ref_plane; s->m.linesize = - s->m.last_picture.f->linesize[0] = - s->m.new_picture->linesize[0] = - s->m.current_picture.f->linesize[0] = stride; + s->m.last_pic.f->linesize[0] = + s->m.new_pic->linesize[0] = + s->m.cur_pic.f->linesize[0] = stride; s->m.width = width; s->m.height = height; s->m.mb_width = block_width; @@ -370,9 +370,9 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, s->m.mb_mean = (uint8_t *)s->dummy; s->m.mb_var = (uint16_t *)s->dummy; s->m.mc_mb_var = (uint16_t *)s->dummy; - s->m.current_picture.mb_type = s->dummy; + s->m.cur_pic.mb_type = s->dummy; - s->m.current_picture.motion_val[0] = s->motion_val8[plane] + 2; + s->m.cur_pic.motion_val[0] = s->motion_val8[plane] + 2; s->m.p_mv_table = s->motion_val16[plane] + s->m.mb_stride + 1; s->m.mecc = s->mecc; // move @@ -381,7 +381,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, s->m.me.dia_size = s->avctx->dia_size; s->m.first_slice_line = 1; for (y = 0; y < block_height; y++) { - s->m.new_picture->data[0] = src - y * 16 * stride; // ugly + s->m.new_pic->data[0] = src - y * 16 * stride; // ugly s->m.mb_y = y; for (i = 0; i < 16 && i + 16 * y < height; i++) { @@ -561,7 +561,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) av_frame_free(&s->current_picture); av_frame_free(&s->last_picture); - av_frame_free(&s->m.new_picture); + av_frame_free(&s->m.new_pic); return 0; } @@ -624,10 +624,10 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) s->dummy = av_mallocz((s->y_block_width + 1) * s->y_block_height * sizeof(int32_t)); s->m.me.map = av_mallocz(2 * ME_MAP_SIZE * sizeof(*s->m.me.map)); - s->m.new_picture = av_frame_alloc(); + s->m.new_pic = av_frame_alloc(); if (!s->m.me.scratchpad || !s->m.me.map || - !s->mb_type || !s->dummy || !s->m.new_picture) + !s->mb_type || !s->dummy || !s->m.new_pic) return AVERROR(ENOMEM); s->m.me.score_map = s->m.me.map + ME_MAP_SIZE; diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c index eeb4e87321..389540fd0c 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -42,12 +42,12 @@ static inline int mpeg2_get_is_frame_start(const MpegEncContext *s) static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; VAPictureParameterBufferMPEG2 pic_param; VAIQMatrixBufferMPEG2 iq_matrix; int i, err; - pic->output_surface = ff_vaapi_get_surface_id(s->current_picture_ptr->f); + pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic_ptr->f); pic_param = (VAPictureParameterBufferMPEG2) { .horizontal_size = s->width, @@ -73,10 +73,10 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_ switch (s->pict_type) { case AV_PICTURE_TYPE_B: - pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_picture.f); + pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.f); // fall-through case AV_PICTURE_TYPE_P: - pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_picture.f); + pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.f); break; } @@ -115,7 +115,7 @@ fail: static int vaapi_mpeg2_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; int ret; ret = ff_vaapi_decode_issue(avctx, pic); @@ -131,7 +131,7 @@ fail: static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; VASliceParameterBufferMPEG2 slice_param; GetBitContext gb; uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset; diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 363b686e42..e227bee113 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -49,11 +49,11 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext *s = &ctx->m; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; VAPictureParameterBufferMPEG4 pic_param; int i, err; - pic->output_surface = ff_vaapi_get_surface_id(s->current_picture_ptr->f); + pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic_ptr->f); pic_param = (VAPictureParameterBufferMPEG4) { .vop_width = s->width, @@ -78,7 +78,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ .vop_fields.bits = { .vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I, .backward_reference_vop_coding_type = - s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f->pict_type - AV_PICTURE_TYPE_I : 0, + s->pict_type == AV_PICTURE_TYPE_B ? s->next_pic.f->pict_type - AV_PICTURE_TYPE_I : 0, .vop_rounding_type = s->no_rounding, .intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx), .top_field_first = s->top_field_first, @@ -100,9 +100,9 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ } if (s->pict_type == AV_PICTURE_TYPE_B) - pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_picture.f); + pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.f); if (s->pict_type != AV_PICTURE_TYPE_I) - pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_picture.f); + pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.f); err = ff_vaapi_decode_make_param_buffer(avctx, pic, VAPictureParameterBufferType, @@ -139,7 +139,7 @@ fail: static int vaapi_mpeg4_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; int ret; ret = ff_vaapi_decode_issue(avctx, pic); @@ -155,7 +155,7 @@ fail: static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; VASliceParameterBufferMPEG4 slice_param; int err; diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index 5594118a69..ef914cf4b2 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -253,11 +253,11 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; VAPictureParameterBufferVC1 pic_param; int err; - pic->output_surface = ff_vaapi_get_surface_id(s->current_picture_ptr->f); + pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic_ptr->f); pic_param = (VAPictureParameterBufferVC1) { .forward_reference_picture = VA_INVALID_ID, @@ -374,10 +374,10 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t switch (s->pict_type) { case AV_PICTURE_TYPE_B: - pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_picture.f); + pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.f); // fall-through case AV_PICTURE_TYPE_P: - pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_picture.f); + pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.f); break; } @@ -450,7 +450,7 @@ static int vaapi_vc1_end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; int ret; ret = ff_vaapi_decode_issue(avctx, pic); @@ -465,7 +465,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; VASliceParameterBufferVC1 slice_param; int mb_height; int err; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index e234192fdd..643232653c 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -856,7 +856,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; else v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; - v->s.current_picture_ptr->f->pict_type = v->s.pict_type; + v->s.cur_pic_ptr->f->pict_type = v->s.pict_type; if (!v->pic_header_flag) goto parse_common_info; } diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index a6ee4922f9..6b5b1d0566 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -59,9 +59,9 @@ static inline void init_block_index(VC1Context *v) MpegEncContext *s = &v->s; ff_init_block_index(s); if (v->field_mode && !(v->second_field ^ v->tff)) { - s->dest[0] += s->current_picture_ptr->f->linesize[0]; - s->dest[1] += s->current_picture_ptr->f->linesize[1]; - s->dest[2] += s->current_picture_ptr->f->linesize[2]; + s->dest[0] += s->cur_pic_ptr->f->linesize[0]; + s->dest[1] += s->cur_pic_ptr->f->linesize[1]; + s->dest[2] += s->cur_pic_ptr->f->linesize[2]; } } @@ -417,7 +417,7 @@ static inline int ff_vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, int dqscale_index; /* scale predictors if needed */ - q1 = FFABS(s->current_picture.qscale_table[mb_pos]); + q1 = FFABS(s->cur_pic.qscale_table[mb_pos]); dqscale_index = s->y_dc_scale_table[q1] - 1; if (dqscale_index < 0) return 0; @@ -433,12 +433,12 @@ static inline int ff_vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, a = dc_val[ - wrap]; if (c_avail && (n != 1 && n != 3)) { - q2 = FFABS(s->current_picture.qscale_table[mb_pos - 1]); + q2 = FFABS(s->cur_pic.qscale_table[mb_pos - 1]); if (q2 && q2 != q1) c = (int)((unsigned)c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18; } if (a_avail && (n != 2 && n != 3)) { - q2 = FFABS(s->current_picture.qscale_table[mb_pos - s->mb_stride]); + q2 = FFABS(s->cur_pic.qscale_table[mb_pos - s->mb_stride]); if (q2 && q2 != q1) a = (int)((unsigned)a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18; } @@ -448,7 +448,7 @@ static inline int ff_vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, off--; if (n != 2) off -= s->mb_stride; - q2 = FFABS(s->current_picture.qscale_table[off]); + q2 = FFABS(s->cur_pic.qscale_table[off]); if (q2 && q2 != q1) b = (int)((unsigned)b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18; } @@ -771,19 +771,19 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, else // top ac_val -= 16 * s->block_wrap[n]; - q1 = s->current_picture.qscale_table[mb_pos]; + q1 = s->cur_pic.qscale_table[mb_pos]; if (n == 3) q2 = q1; else if (dc_pred_dir) { if (n == 1) q2 = q1; else if (c_avail && mb_pos) - q2 = s->current_picture.qscale_table[mb_pos - 1]; + q2 = s->cur_pic.qscale_table[mb_pos - 1]; } else { if (n == 2) q2 = q1; else if (a_avail && mb_pos >= s->mb_stride) - q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; + q2 = s->cur_pic.qscale_table[mb_pos - s->mb_stride]; } //AC Decoding @@ -973,11 +973,11 @@ static int vc1_decode_intra_block(VC1Context *v, int16_t block[64], int n, else //top ac_val -= 16 * s->block_wrap[n]; - q1 = s->current_picture.qscale_table[mb_pos]; + q1 = s->cur_pic.qscale_table[mb_pos]; if (dc_pred_dir && c_avail && mb_pos) - q2 = s->current_picture.qscale_table[mb_pos - 1]; + q2 = s->cur_pic.qscale_table[mb_pos - 1]; if (!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) - q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; + q2 = s->cur_pic.qscale_table[mb_pos - s->mb_stride]; if (dc_pred_dir && n == 1) q2 = q1; if (!dc_pred_dir && n == 2) @@ -1314,10 +1314,10 @@ static int vc1_decode_p_mb(VC1Context *v) GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { - s->current_picture.motion_val[1][s->block_index[0]][0] = 0; - s->current_picture.motion_val[1][s->block_index[0]][1] = 0; + s->cur_pic.motion_val[1][s->block_index[0]][0] = 0; + s->cur_pic.motion_val[1][s->block_index[0]][1] = 0; } - s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; + s->cur_pic.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; ff_vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); /* FIXME Set DC val for inter block ? */ @@ -1334,7 +1334,7 @@ static int vc1_decode_p_mb(VC1Context *v) mquant = v->pq; cbp = 0; } - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], @@ -1383,8 +1383,8 @@ static int vc1_decode_p_mb(VC1Context *v) v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } - s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; - s->current_picture.qscale_table[mb_pos] = 0; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_SKIP; + s->cur_pic.qscale_table[mb_pos] = 0; ff_vc1_pred_mv(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); ff_vc1_mc_1mv(v, 0); } @@ -1427,7 +1427,7 @@ static int vc1_decode_p_mb(VC1Context *v) if (!intra_count && !coded_inter) goto end; GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; /* test if block is intra and has pred */ { int intrapred = 0; @@ -1484,7 +1484,7 @@ static int vc1_decode_p_mb(VC1Context *v) } } else { // skipped MB s->mb_intra = 0; - s->current_picture.qscale_table[mb_pos] = 0; + s->cur_pic.qscale_table[mb_pos] = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; @@ -1494,7 +1494,7 @@ static int vc1_decode_p_mb(VC1Context *v) ff_vc1_mc_4mv_luma(v, i, 0, 0); } ff_vc1_mc_4mv_chroma(v, 0); - s->current_picture.qscale_table[mb_pos] = 0; + s->cur_pic.qscale_table[mb_pos] = 0; } } end: @@ -1574,19 +1574,19 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) } if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB for (i = 0; i < 4; i++) { - s->current_picture.motion_val[1][s->block_index[i]][0] = 0; - s->current_picture.motion_val[1][s->block_index[i]][1] = 0; + s->cur_pic.motion_val[1][s->block_index[i]][0] = 0; + s->cur_pic.motion_val[1][s->block_index[i]][1] = 0; } v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. s->mb_intra = 1; - s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA; fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = get_bits1(gb); if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2); v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)]; s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)]; @@ -1670,7 +1670,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) } if (cbp) GET_MQUANT(); // p. 227 - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { @@ -1701,8 +1701,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } - s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; - s->current_picture.qscale_table[mb_pos] = 0; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_SKIP; + s->cur_pic.qscale_table[mb_pos] = 0; v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; @@ -1746,11 +1746,11 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) if (idx_mbmode <= 1) { // intra MB v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. s->mb_intra = 1; - s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; - s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; + s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; + s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)]; s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)]; @@ -1780,7 +1780,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; - s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; + s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (idx_mbmode <= 5) { // 1-MV @@ -1808,7 +1808,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) if (cbp) { GET_MQUANT(); } - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2); } @@ -1880,7 +1880,7 @@ static int vc1_decode_b_mb(VC1Context *v) v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } - s->current_picture.qscale_table[mb_pos] = 0; + s->cur_pic.qscale_table[mb_pos] = 0; if (!direct) { if (!skipped) { @@ -1917,7 +1917,7 @@ static int vc1_decode_b_mb(VC1Context *v) cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); s->mb_intra = 0; - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2); dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; @@ -1932,7 +1932,7 @@ static int vc1_decode_b_mb(VC1Context *v) } if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; s->ac_pred = get_bits1(gb); cbp = 0; ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); @@ -1954,7 +1954,7 @@ static int vc1_decode_b_mb(VC1Context *v) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2); } @@ -2029,11 +2029,11 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) if (idx_mbmode <= 1) { // intra MB v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. s->mb_intra = 1; - s->current_picture.motion_val[1][s->block_index[0]][0] = 0; - s->current_picture.motion_val[1][s->block_index[0]][1] = 0; - s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; + s->cur_pic.motion_val[1][s->block_index[0]][0] = 0; + s->cur_pic.motion_val[1][s->block_index[0]][1] = 0; + s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)]; s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)]; @@ -2069,7 +2069,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; - s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; + s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (v->fmb_is_raw) @@ -2106,7 +2106,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) if (bmvtype == BMV_TYPE_DIRECT) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[0] = 0; - if (!s->next_picture_ptr->field_picture) { + if (!s->next_pic_ptr->field_picture) { av_log(s->avctx, AV_LOG_ERROR, "Mixed field/frame direct mode not supported\n"); return AVERROR_INVALIDDATA; } @@ -2138,7 +2138,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) if (cbp) { GET_MQUANT(); } - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2); } @@ -2217,21 +2217,21 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB for (i = 0; i < 4; i++) { - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = 0; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = 0; - s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = 0; - s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = 0; + s->mv[0][i][0] = s->cur_pic.motion_val[0][s->block_index[i]][0] = 0; + s->mv[0][i][1] = s->cur_pic.motion_val[0][s->block_index[i]][1] = 0; + s->mv[1][i][0] = s->cur_pic.motion_val[1][s->block_index[i]][0] = 0; + s->mv[1][i][1] = s->cur_pic.motion_val[1][s->block_index[i]][1] = 0; } v->is_intra[s->mb_x] = 0x3f; // Set the bitfield to all 1. s->mb_intra = 1; - s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA; fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = get_bits1(gb); if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc, VC1_CBPCY_P_VLC_BITS, 2); v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)]; s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)]; @@ -2272,31 +2272,31 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) direct = v->direct_mb_plane[mb_pos]; if (direct) { - if (s->next_picture_ptr->field_picture) + if (s->next_pic_ptr->field_picture) av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); - s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample); + s->mv[0][0][0] = s->cur_pic.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][0][1] = s->cur_pic.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][0][0] = s->cur_pic.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][0][1] = s->cur_pic.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample); if (twomv) { - s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample); + s->mv[0][2][0] = s->cur_pic.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][2][1] = s->cur_pic.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][2][0] = s->cur_pic.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][2][1] = s->cur_pic.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample); for (i = 1; i < 4; i += 2) { - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1]; - s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0]; - s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1]; + s->mv[0][i][0] = s->cur_pic.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0]; + s->mv[0][i][1] = s->cur_pic.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1]; + s->mv[1][i][0] = s->cur_pic.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0]; + s->mv[1][i][1] = s->cur_pic.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1]; } } else { for (i = 1; i < 4; i++) { - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1]; - s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0]; - s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1]; + s->mv[0][i][0] = s->cur_pic.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0]; + s->mv[0][i][1] = s->cur_pic.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1]; + s->mv[1][i][0] = s->cur_pic.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0]; + s->mv[1][i][1] = s->cur_pic.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1]; } } } @@ -2398,10 +2398,10 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) if (mvsw) { for (i = 0; i < 2; i++) { - s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0]; - s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1]; - s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0]; - s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1]; + s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->cur_pic.motion_val[dir][s->block_index[i+2]][0] = s->cur_pic.motion_val[dir][s->block_index[i]][0]; + s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->cur_pic.motion_val[dir][s->block_index[i+2]][1] = s->cur_pic.motion_val[dir][s->block_index[i]][1]; + s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->cur_pic.motion_val[dir2][s->block_index[i]][0] = s->cur_pic.motion_val[dir2][s->block_index[i+2]][0]; + s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->cur_pic.motion_val[dir2][s->block_index[i]][1] = s->cur_pic.motion_val[dir2][s->block_index[i+2]][1]; } } else { ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, !dir); @@ -2428,15 +2428,15 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) v->blk_mv_type[s->block_index[3]] = 1; ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, !dir); for (i = 0; i < 2; i++) { - s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0]; - s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1]; + s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->cur_pic.motion_val[!dir][s->block_index[i+2]][0] = s->cur_pic.motion_val[!dir][s->block_index[i]][0]; + s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->cur_pic.motion_val[!dir][s->block_index[i+2]][1] = s->cur_pic.motion_val[!dir][s->block_index[i]][1]; } ff_vc1_mc_1mv(v, dir); } if (cbp) GET_MQUANT(); // p. 227 - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index], VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { @@ -2467,8 +2467,8 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } - s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; - s->current_picture.qscale_table[mb_pos] = 0; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_SKIP; + s->cur_pic.qscale_table[mb_pos] = 0; v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; @@ -2486,10 +2486,10 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) if (mvsw) dir2 = !dir; for (i = 0; i < 2; i++) { - s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->current_picture.motion_val[dir][s->block_index[i+2]][0] = s->current_picture.motion_val[dir][s->block_index[i]][0]; - s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->current_picture.motion_val[dir][s->block_index[i+2]][1] = s->current_picture.motion_val[dir][s->block_index[i]][1]; - s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->current_picture.motion_val[dir2][s->block_index[i]][0] = s->current_picture.motion_val[dir2][s->block_index[i+2]][0]; - s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->current_picture.motion_val[dir2][s->block_index[i]][1] = s->current_picture.motion_val[dir2][s->block_index[i+2]][1]; + s->mv[dir][i+2][0] = s->mv[dir][i][0] = s->cur_pic.motion_val[dir][s->block_index[i+2]][0] = s->cur_pic.motion_val[dir][s->block_index[i]][0]; + s->mv[dir][i+2][1] = s->mv[dir][i][1] = s->cur_pic.motion_val[dir][s->block_index[i+2]][1] = s->cur_pic.motion_val[dir][s->block_index[i]][1]; + s->mv[dir2][i+2][0] = s->mv[dir2][i][0] = s->cur_pic.motion_val[dir2][s->block_index[i]][0] = s->cur_pic.motion_val[dir2][s->block_index[i+2]][0]; + s->mv[dir2][i+2][1] = s->mv[dir2][i][1] = s->cur_pic.motion_val[dir2][s->block_index[i]][1] = s->cur_pic.motion_val[dir2][s->block_index[i+2]][1]; } } else { v->blk_mv_type[s->block_index[0]] = 1; @@ -2498,8 +2498,8 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) v->blk_mv_type[s->block_index[3]] = 1; ff_vc1_pred_mv_intfr(v, 0, 0, 0, 2, v->range_x, v->range_y, !dir); for (i = 0; i < 2; i++) { - s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->current_picture.motion_val[!dir][s->block_index[i+2]][0] = s->current_picture.motion_val[!dir][s->block_index[i]][0]; - s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->current_picture.motion_val[!dir][s->block_index[i+2]][1] = s->current_picture.motion_val[!dir][s->block_index[i]][1]; + s->mv[!dir][i+2][0] = s->mv[!dir][i][0] = s->cur_pic.motion_val[!dir][s->block_index[i+2]][0] = s->cur_pic.motion_val[!dir][s->block_index[i]][0]; + s->mv[!dir][i+2][1] = s->mv[!dir][i][1] = s->cur_pic.motion_val[!dir][s->block_index[i+2]][1] = s->cur_pic.motion_val[!dir][s->block_index[i]][1]; } } } @@ -2568,11 +2568,11 @@ static void vc1_decode_i_blocks(VC1Context *v) update_block_index(s); s->bdsp.clear_blocks(v->block[v->cur_blk_idx][0]); mb_pos = s->mb_x + s->mb_y * s->mb_width; - s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; - s->current_picture.qscale_table[mb_pos] = v->pq; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA; + s->cur_pic.qscale_table[mb_pos] = v->pq; for (int i = 0; i < 4; i++) { - s->current_picture.motion_val[1][s->block_index[i]][0] = 0; - s->current_picture.motion_val[1][s->block_index[i]][1] = 0; + s->cur_pic.motion_val[1][s->block_index[i]][0] = 0; + s->cur_pic.motion_val[1][s->block_index[i]][1] = 0; } // do actual MB decoding and displaying @@ -2698,10 +2698,10 @@ static int vc1_decode_i_blocks_adv(VC1Context *v) update_block_index(s); s->bdsp.clear_blocks(v->block[v->cur_blk_idx][0]); mb_pos = s->mb_x + s->mb_y * s->mb_stride; - s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; + s->cur_pic.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; for (int i = 0; i < 4; i++) { - s->current_picture.motion_val[1][s->block_index[i] + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][s->block_index[i] + v->blocks_off][1] = 0; + s->cur_pic.motion_val[1][s->block_index[i] + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][s->block_index[i] + v->blocks_off][1] = 0; } // do actual MB decoding and displaying @@ -2724,7 +2724,7 @@ static int vc1_decode_i_blocks_adv(VC1Context *v) GET_MQUANT(); - s->current_picture.qscale_table[mb_pos] = mquant; + s->cur_pic.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same */ s->y_dc_scale = s->y_dc_scale_table[FFABS(mquant)]; s->c_dc_scale = s->c_dc_scale_table[FFABS(mquant)]; @@ -2948,7 +2948,7 @@ static void vc1_decode_skip_blocks(VC1Context *v) { MpegEncContext *s = &v->s; - if (!v->s.last_picture.f->data[0]) + if (!v->s.last_pic.f->data[0]) return; ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, ER_MB_END); @@ -2957,9 +2957,9 @@ static void vc1_decode_skip_blocks(VC1Context *v) s->mb_x = 0; init_block_index(v); update_block_index(s); - memcpy(s->dest[0], s->last_picture.f->data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); - memcpy(s->dest[1], s->last_picture.f->data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); - memcpy(s->dest[2], s->last_picture.f->data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); + memcpy(s->dest[0], s->last_pic.f->data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); + memcpy(s->dest[1], s->last_pic.f->data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); + memcpy(s->dest[2], s->last_pic.f->data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); s->first_slice_line = 0; } } @@ -2969,7 +2969,7 @@ void ff_vc1_decode_blocks(VC1Context *v) v->s.esc3_level_length = 0; if (v->x8_type) { - ff_intrax8_decode_picture(&v->x8, &v->s.current_picture, + ff_intrax8_decode_picture(&v->x8, &v->s.cur_pic, &v->s.gb, &v->s.mb_x, &v->s.mb_y, 2 * v->pq + v->halfpq, v->pq * !v->pquantizer, v->s.loop_filter, v->s.low_delay); diff --git a/libavcodec/vc1_loopfilter.c b/libavcodec/vc1_loopfilter.c index 0f990cccef..8afb4db190 100644 --- a/libavcodec/vc1_loopfilter.c +++ b/libavcodec/vc1_loopfilter.c @@ -500,7 +500,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 1 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off], ttblk, @@ -520,7 +520,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride + v->mb_off] : &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off], ttblk, @@ -543,7 +543,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 1 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off], ttblk, @@ -562,7 +562,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 1 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 + v->blocks_off], ttblk, @@ -583,7 +583,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off], ttblk, @@ -602,7 +602,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] + v->mb_off] : &v->mv_f[0][s->block_index[i] + v->blocks_off], ttblk, @@ -625,7 +625,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 2 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off], ttblk, @@ -646,7 +646,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 1 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off], ttblk, @@ -665,7 +665,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride + v->mb_off] : &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off], ttblk, @@ -688,7 +688,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 2 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off], ttblk, @@ -709,7 +709,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 1 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off], ttblk, @@ -728,7 +728,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off], ttblk, @@ -749,7 +749,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 4 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 4 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 2 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 4 + v->blocks_off], ttblk, @@ -770,7 +770,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] - 2 + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] - 2 + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] - 1 + v->mb_off] : &v->mv_f[0][s->block_index[i] - 2 + v->blocks_off], ttblk, @@ -789,7 +789,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) cbp, is_intra, i > 3 ? uvmv : - &s->current_picture.motion_val[0][s->block_index[i] + v->blocks_off], + &s->cur_pic.motion_val[0][s->block_index[i] + v->blocks_off], i > 3 ? &v->mv_f[0][s->block_index[i] + v->mb_off] : &v->mv_f[0][s->block_index[i] + v->blocks_off], ttblk, diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index 8f0b3f6fab..e24328569d 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -184,11 +184,11 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) if ((!v->field_mode || (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && - !v->s.last_picture.f->data[0]) + !v->s.last_pic.f->data[0]) return; - linesize = s->current_picture_ptr->f->linesize[0]; - uvlinesize = s->current_picture_ptr->f->linesize[1]; + linesize = s->cur_pic_ptr->f->linesize[0]; + uvlinesize = s->cur_pic_ptr->f->linesize[1]; mx = s->mv[dir][0][0]; my = s->mv[dir][0][1]; @@ -196,8 +196,8 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) // store motion vectors for further use in B-frames if (s->pict_type == AV_PICTURE_TYPE_P) { for (i = 0; i < 4; i++) { - s->current_picture.motion_val[1][s->block_index[i] + v->blocks_off][0] = mx; - s->current_picture.motion_val[1][s->block_index[i] + v->blocks_off][1] = my; + s->cur_pic.motion_val[1][s->block_index[i] + v->blocks_off][0] = mx; + s->cur_pic.motion_val[1][s->block_index[i] + v->blocks_off][1] = my; } } @@ -219,30 +219,30 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) } if (!dir) { if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { - srcY = s->current_picture.f->data[0]; - srcU = s->current_picture.f->data[1]; - srcV = s->current_picture.f->data[2]; + srcY = s->cur_pic.f->data[0]; + srcU = s->cur_pic.f->data[1]; + srcV = s->cur_pic.f->data[2]; luty = v->curr_luty; lutuv = v->curr_lutuv; use_ic = *v->curr_use_ic; interlace = 1; } else { - srcY = s->last_picture.f->data[0]; - srcU = s->last_picture.f->data[1]; - srcV = s->last_picture.f->data[2]; + srcY = s->last_pic.f->data[0]; + srcU = s->last_pic.f->data[1]; + srcV = s->last_pic.f->data[2]; luty = v->last_luty; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } } else { - srcY = s->next_picture.f->data[0]; - srcU = s->next_picture.f->data[1]; - srcV = s->next_picture.f->data[2]; + srcY = s->next_pic.f->data[0]; + srcU = s->next_pic.f->data[1]; + srcV = s->next_pic.f->data[2]; luty = v->next_luty; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } if (!srcY || !srcU) { @@ -464,31 +464,31 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) if ((!v->field_mode || (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && - !v->s.last_picture.f->data[0]) + !v->s.last_pic.f->data[0]) return; - linesize = s->current_picture_ptr->f->linesize[0]; + linesize = s->cur_pic_ptr->f->linesize[0]; mx = s->mv[dir][n][0]; my = s->mv[dir][n][1]; if (!dir) { if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { - srcY = s->current_picture.f->data[0]; + srcY = s->cur_pic.f->data[0]; luty = v->curr_luty; use_ic = *v->curr_use_ic; interlace = 1; } else { - srcY = s->last_picture.f->data[0]; + srcY = s->last_pic.f->data[0]; luty = v->last_luty; use_ic = v->last_use_ic; - interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } } else { - srcY = s->next_picture.f->data[0]; + srcY = s->next_pic.f->data[0]; luty = v->next_luty; use_ic = v->next_use_ic; - interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } if (!srcY) { @@ -503,8 +503,8 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) if (s->pict_type == AV_PICTURE_TYPE_P && n == 3 && v->field_mode) { int opp_count = get_luma_mv(v, 0, - &s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0], - &s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1]); + &s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0], + &s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1]); int k, f = opp_count > 2; for (k = 0; k < 4; k++) v->mv_f[1][s->block_index[k] + v->blocks_off] = f; @@ -515,8 +515,8 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) int width = s->avctx->coded_width; int height = s->avctx->coded_height >> 1; if (s->pict_type == AV_PICTURE_TYPE_P) { - s->current_picture.motion_val[1][s->block_index[n] + v->blocks_off][0] = mx; - s->current_picture.motion_val[1][s->block_index[n] + v->blocks_off][1] = my; + s->cur_pic.motion_val[1][s->block_index[n] + v->blocks_off][0] = mx; + s->cur_pic.motion_val[1][s->block_index[n] + v->blocks_off][1] = my; } qx = (s->mb_x * 16) + (mx >> 2); qy = (s->mb_y * 8) + (my >> 3); @@ -645,7 +645,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) int interlace; int uvlinesize; - if (!v->field_mode && !v->s.last_picture.f->data[0]) + if (!v->field_mode && !v->s.last_pic.f->data[0]) return; if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; @@ -654,8 +654,8 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) if (!v->field_mode || !v->numref) { int valid_count = get_chroma_mv(v, dir, &tx, &ty); if (!valid_count) { - s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; + s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; return; //no need to do MC for intra blocks } @@ -664,12 +664,12 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) int opp_count = get_luma_mv(v, dir, &tx, &ty); chroma_ref_type = v->cur_field_type ^ (opp_count > 2); } - if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_picture.f->data[0]) + if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_pic.f->data[0]) return; - s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; - s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; + s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; + s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; - uvlinesize = s->current_picture_ptr->f->linesize[1]; + uvlinesize = s->cur_pic_ptr->f->linesize[1]; uvmx = (tx + ((tx & 3) == 3)) >> 1; uvmy = (ty + ((ty & 3) == 3)) >> 1; @@ -698,24 +698,24 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) if (!dir) { if (v->field_mode && (v->cur_field_type != chroma_ref_type) && v->second_field) { - srcU = s->current_picture.f->data[1]; - srcV = s->current_picture.f->data[2]; + srcU = s->cur_pic.f->data[1]; + srcV = s->cur_pic.f->data[2]; lutuv = v->curr_lutuv; use_ic = *v->curr_use_ic; interlace = 1; } else { - srcU = s->last_picture.f->data[1]; - srcV = s->last_picture.f->data[2]; + srcU = s->last_pic.f->data[1]; + srcV = s->last_pic.f->data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } } else { - srcU = s->next_picture.f->data[1]; - srcV = s->next_picture.f->data[2]; + srcU = s->next_pic.f->data[1]; + srcV = s->next_pic.f->data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } if (!srcU) { @@ -856,7 +856,7 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; - uvlinesize = s->current_picture_ptr->f->linesize[1]; + uvlinesize = s->cur_pic_ptr->f->linesize[1]; for (i = 0; i < 4; i++) { int d = i < 2 ? dir: dir2; @@ -880,17 +880,17 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) else uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); if (i < 2 ? dir : dir2) { - srcU = s->next_picture.f->data[1]; - srcV = s->next_picture.f->data[2]; + srcU = s->next_pic.f->data[1]; + srcV = s->next_pic.f->data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } else { - srcU = s->last_picture.f->data[1]; - srcV = s->last_picture.f->data[2]; + srcU = s->last_pic.f->data[1]; + srcV = s->last_pic.f->data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } if (!srcU) return; @@ -1012,11 +1012,11 @@ void ff_vc1_interp_mc(VC1Context *v) int interlace; int linesize, uvlinesize; - if (!v->field_mode && !v->s.next_picture.f->data[0]) + if (!v->field_mode && !v->s.next_pic.f->data[0]) return; - linesize = s->current_picture_ptr->f->linesize[0]; - uvlinesize = s->current_picture_ptr->f->linesize[1]; + linesize = s->cur_pic_ptr->f->linesize[0]; + uvlinesize = s->cur_pic_ptr->f->linesize[1]; mx = s->mv[1][0][0]; my = s->mv[1][0][1]; @@ -1030,11 +1030,11 @@ void ff_vc1_interp_mc(VC1Context *v) uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1)); } - srcY = s->next_picture.f->data[0]; - srcU = s->next_picture.f->data[1]; - srcV = s->next_picture.f->data[2]; + srcY = s->next_pic.f->data[0]; + srcU = s->next_pic.f->data[1]; + srcV = s->next_pic.f->data[2]; - interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); src_x = s->mb_x * 16 + (mx >> 2); src_y = s->mb_y * 16 + (my >> 2); diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index ad2caf6db2..51ad668f23 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -241,24 +241,24 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, xy = s->block_index[n]; if (s->mb_intra) { - s->mv[0][n][0] = s->current_picture.motion_val[0][xy + v->blocks_off][0] = 0; - s->mv[0][n][1] = s->current_picture.motion_val[0][xy + v->blocks_off][1] = 0; - s->current_picture.motion_val[1][xy + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][xy + v->blocks_off][1] = 0; + s->mv[0][n][0] = s->cur_pic.motion_val[0][xy + v->blocks_off][0] = 0; + s->mv[0][n][1] = s->cur_pic.motion_val[0][xy + v->blocks_off][1] = 0; + s->cur_pic.motion_val[1][xy + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][xy + v->blocks_off][1] = 0; if (mv1) { /* duplicate motion data for 1-MV block */ - s->current_picture.motion_val[0][xy + 1 + v->blocks_off][0] = 0; - s->current_picture.motion_val[0][xy + 1 + v->blocks_off][1] = 0; - s->current_picture.motion_val[0][xy + wrap + v->blocks_off][0] = 0; - s->current_picture.motion_val[0][xy + wrap + v->blocks_off][1] = 0; - s->current_picture.motion_val[0][xy + wrap + 1 + v->blocks_off][0] = 0; - s->current_picture.motion_val[0][xy + wrap + 1 + v->blocks_off][1] = 0; + s->cur_pic.motion_val[0][xy + 1 + v->blocks_off][0] = 0; + s->cur_pic.motion_val[0][xy + 1 + v->blocks_off][1] = 0; + s->cur_pic.motion_val[0][xy + wrap + v->blocks_off][0] = 0; + s->cur_pic.motion_val[0][xy + wrap + v->blocks_off][1] = 0; + s->cur_pic.motion_val[0][xy + wrap + 1 + v->blocks_off][0] = 0; + s->cur_pic.motion_val[0][xy + wrap + 1 + v->blocks_off][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; - s->current_picture.motion_val[1][xy + 1 + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][xy + 1 + v->blocks_off][1] = 0; - s->current_picture.motion_val[1][xy + wrap + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][xy + wrap + v->blocks_off][1] = 0; - s->current_picture.motion_val[1][xy + wrap + 1 + v->blocks_off][0] = 0; - s->current_picture.motion_val[1][xy + wrap + 1 + v->blocks_off][1] = 0; + s->cur_pic.motion_val[1][xy + 1 + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][xy + 1 + v->blocks_off][1] = 0; + s->cur_pic.motion_val[1][xy + wrap + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][xy + wrap + v->blocks_off][1] = 0; + s->cur_pic.motion_val[1][xy + wrap + 1 + v->blocks_off][0] = 0; + s->cur_pic.motion_val[1][xy + wrap + 1 + v->blocks_off][1] = 0; } return; } @@ -301,7 +301,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, } if (a_valid) { - A = s->current_picture.motion_val[dir][xy - wrap + v->blocks_off]; + A = s->cur_pic.motion_val[dir][xy - wrap + v->blocks_off]; a_f = v->mv_f[dir][xy - wrap + v->blocks_off]; num_oppfield += a_f; num_samefield += 1 - a_f; @@ -312,7 +312,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, a_f = 0; } if (b_valid) { - B = s->current_picture.motion_val[dir][xy - wrap + off + v->blocks_off]; + B = s->cur_pic.motion_val[dir][xy - wrap + off + v->blocks_off]; b_f = v->mv_f[dir][xy - wrap + off + v->blocks_off]; num_oppfield += b_f; num_samefield += 1 - b_f; @@ -323,7 +323,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, b_f = 0; } if (c_valid) { - C = s->current_picture.motion_val[dir][xy - 1 + v->blocks_off]; + C = s->cur_pic.motion_val[dir][xy - 1 + v->blocks_off]; c_f = v->mv_f[dir][xy - 1 + v->blocks_off]; num_oppfield += c_f; num_samefield += 1 - c_f; @@ -451,15 +451,15 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, if (v->field_mode && v->cur_field_type && v->ref_field_type[dir] == 0) y_bias = 1; /* store MV using signed modulus of MV range defined in 4.11 */ - s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy + v->blocks_off][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; - s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy + v->blocks_off][1] = ((py + dmv_y + r_y - y_bias) & ((r_y << 1) - 1)) - r_y + y_bias; + s->mv[dir][n][0] = s->cur_pic.motion_val[dir][xy + v->blocks_off][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; + s->mv[dir][n][1] = s->cur_pic.motion_val[dir][xy + v->blocks_off][1] = ((py + dmv_y + r_y - y_bias) & ((r_y << 1) - 1)) - r_y + y_bias; if (mv1) { /* duplicate motion data for 1-MV block */ - s->current_picture.motion_val[dir][xy + 1 + v->blocks_off][0] = s->current_picture.motion_val[dir][xy + v->blocks_off][0]; - s->current_picture.motion_val[dir][xy + 1 + v->blocks_off][1] = s->current_picture.motion_val[dir][xy + v->blocks_off][1]; - s->current_picture.motion_val[dir][xy + wrap + v->blocks_off][0] = s->current_picture.motion_val[dir][xy + v->blocks_off][0]; - s->current_picture.motion_val[dir][xy + wrap + v->blocks_off][1] = s->current_picture.motion_val[dir][xy + v->blocks_off][1]; - s->current_picture.motion_val[dir][xy + wrap + 1 + v->blocks_off][0] = s->current_picture.motion_val[dir][xy + v->blocks_off][0]; - s->current_picture.motion_val[dir][xy + wrap + 1 + v->blocks_off][1] = s->current_picture.motion_val[dir][xy + v->blocks_off][1]; + s->cur_pic.motion_val[dir][xy + 1 + v->blocks_off][0] = s->cur_pic.motion_val[dir][xy + v->blocks_off][0]; + s->cur_pic.motion_val[dir][xy + 1 + v->blocks_off][1] = s->cur_pic.motion_val[dir][xy + v->blocks_off][1]; + s->cur_pic.motion_val[dir][xy + wrap + v->blocks_off][0] = s->cur_pic.motion_val[dir][xy + v->blocks_off][0]; + s->cur_pic.motion_val[dir][xy + wrap + v->blocks_off][1] = s->cur_pic.motion_val[dir][xy + v->blocks_off][1]; + s->cur_pic.motion_val[dir][xy + wrap + 1 + v->blocks_off][0] = s->cur_pic.motion_val[dir][xy + v->blocks_off][0]; + s->cur_pic.motion_val[dir][xy + wrap + 1 + v->blocks_off][1] = s->cur_pic.motion_val[dir][xy + v->blocks_off][1]; v->mv_f[dir][xy + 1 + v->blocks_off] = v->mv_f[dir][xy + v->blocks_off]; v->mv_f[dir][xy + wrap + v->blocks_off] = v->mv_f[dir][xy + wrap + 1 + v->blocks_off] = v->mv_f[dir][xy + v->blocks_off]; } @@ -483,24 +483,24 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, xy = s->block_index[n]; if (s->mb_intra) { - s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; - s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; - s->current_picture.motion_val[1][xy][0] = 0; - s->current_picture.motion_val[1][xy][1] = 0; + s->mv[0][n][0] = s->cur_pic.motion_val[0][xy][0] = 0; + s->mv[0][n][1] = s->cur_pic.motion_val[0][xy][1] = 0; + s->cur_pic.motion_val[1][xy][0] = 0; + s->cur_pic.motion_val[1][xy][1] = 0; if (mvn == 1) { /* duplicate motion data for 1-MV block */ - s->current_picture.motion_val[0][xy + 1][0] = 0; - s->current_picture.motion_val[0][xy + 1][1] = 0; - s->current_picture.motion_val[0][xy + wrap][0] = 0; - s->current_picture.motion_val[0][xy + wrap][1] = 0; - s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; - s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; + s->cur_pic.motion_val[0][xy + 1][0] = 0; + s->cur_pic.motion_val[0][xy + 1][1] = 0; + s->cur_pic.motion_val[0][xy + wrap][0] = 0; + s->cur_pic.motion_val[0][xy + wrap][1] = 0; + s->cur_pic.motion_val[0][xy + wrap + 1][0] = 0; + s->cur_pic.motion_val[0][xy + wrap + 1][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; - s->current_picture.motion_val[1][xy + 1][0] = 0; - s->current_picture.motion_val[1][xy + 1][1] = 0; - s->current_picture.motion_val[1][xy + wrap][0] = 0; - s->current_picture.motion_val[1][xy + wrap][1] = 0; - s->current_picture.motion_val[1][xy + wrap + 1][0] = 0; - s->current_picture.motion_val[1][xy + wrap + 1][1] = 0; + s->cur_pic.motion_val[1][xy + 1][0] = 0; + s->cur_pic.motion_val[1][xy + 1][1] = 0; + s->cur_pic.motion_val[1][xy + wrap][0] = 0; + s->cur_pic.motion_val[1][xy + wrap][1] = 0; + s->cur_pic.motion_val[1][xy + wrap + 1][0] = 0; + s->cur_pic.motion_val[1][xy + wrap + 1][1] = 0; } return; } @@ -510,14 +510,14 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, if (s->mb_x || (n == 1) || (n == 3)) { if ((v->blk_mv_type[xy]) // current block (MB) has a field MV || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV - A[0] = s->current_picture.motion_val[dir][xy - 1][0]; - A[1] = s->current_picture.motion_val[dir][xy - 1][1]; + A[0] = s->cur_pic.motion_val[dir][xy - 1][0]; + A[1] = s->cur_pic.motion_val[dir][xy - 1][1]; a_valid = 1; } else { // current block has frame mv and cand. has field MV (so average) - A[0] = (s->current_picture.motion_val[dir][xy - 1][0] - + s->current_picture.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; - A[1] = (s->current_picture.motion_val[dir][xy - 1][1] - + s->current_picture.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; + A[0] = (s->cur_pic.motion_val[dir][xy - 1][0] + + s->cur_pic.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; + A[1] = (s->cur_pic.motion_val[dir][xy - 1][1] + + s->cur_pic.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; a_valid = 1; } if (!(n & 1) && v->is_intra[s->mb_x - 1]) { @@ -537,11 +537,11 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { n_adj = (n & 2) | (n & 1); } - B[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; - B[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; + B[0] = s->cur_pic.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; + B[1] = s->cur_pic.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { - B[0] = (B[0] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; - B[1] = (B[1] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; + B[0] = (B[0] + s->cur_pic.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; + B[1] = (B[1] + s->cur_pic.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; } } if (s->mb_width > 1) { @@ -552,11 +552,11 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n & 2; } - C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; - C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; + C[0] = s->cur_pic.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; + C[1] = s->cur_pic.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { - C[0] = (1 + C[0] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; - C[1] = (1 + C[1] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; + C[0] = (1 + C[0] + (s->cur_pic.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; + C[1] = (1 + C[1] + (s->cur_pic.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; } if (s->mb_x == s->mb_width - 1) { if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { @@ -566,11 +566,11 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n | 1; } - C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; - C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; + C[0] = s->cur_pic.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; + C[1] = s->cur_pic.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { - C[0] = (1 + C[0] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; - C[1] = (1 + C[1] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; + C[0] = (1 + C[0] + s->cur_pic.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; + C[1] = (1 + C[1] + s->cur_pic.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; } } else c_valid = 0; @@ -581,12 +581,12 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, } else { pos_b = s->block_index[1]; b_valid = 1; - B[0] = s->current_picture.motion_val[dir][pos_b][0]; - B[1] = s->current_picture.motion_val[dir][pos_b][1]; + B[0] = s->cur_pic.motion_val[dir][pos_b][0]; + B[1] = s->cur_pic.motion_val[dir][pos_b][1]; pos_c = s->block_index[0]; c_valid = 1; - C[0] = s->current_picture.motion_val[dir][pos_c][0]; - C[1] = s->current_picture.motion_val[dir][pos_c][1]; + C[0] = s->cur_pic.motion_val[dir][pos_c][0]; + C[1] = s->cur_pic.motion_val[dir][pos_c][1]; } total_valid = a_valid + b_valid + c_valid; @@ -671,18 +671,18 @@ void ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, } /* store MV using signed modulus of MV range defined in 4.11 */ - s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; - s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; + s->mv[dir][n][0] = s->cur_pic.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; + s->mv[dir][n][1] = s->cur_pic.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; if (mvn == 1) { /* duplicate motion data for 1-MV block */ - s->current_picture.motion_val[dir][xy + 1 ][0] = s->current_picture.motion_val[dir][xy][0]; - s->current_picture.motion_val[dir][xy + 1 ][1] = s->current_picture.motion_val[dir][xy][1]; - s->current_picture.motion_val[dir][xy + wrap ][0] = s->current_picture.motion_val[dir][xy][0]; - s->current_picture.motion_val[dir][xy + wrap ][1] = s->current_picture.motion_val[dir][xy][1]; - s->current_picture.motion_val[dir][xy + wrap + 1][0] = s->current_picture.motion_val[dir][xy][0]; - s->current_picture.motion_val[dir][xy + wrap + 1][1] = s->current_picture.motion_val[dir][xy][1]; + s->cur_pic.motion_val[dir][xy + 1 ][0] = s->cur_pic.motion_val[dir][xy][0]; + s->cur_pic.motion_val[dir][xy + 1 ][1] = s->cur_pic.motion_val[dir][xy][1]; + s->cur_pic.motion_val[dir][xy + wrap ][0] = s->cur_pic.motion_val[dir][xy][0]; + s->cur_pic.motion_val[dir][xy + wrap ][1] = s->cur_pic.motion_val[dir][xy][1]; + s->cur_pic.motion_val[dir][xy + wrap + 1][0] = s->cur_pic.motion_val[dir][xy][0]; + s->cur_pic.motion_val[dir][xy + wrap + 1][1] = s->cur_pic.motion_val[dir][xy][1]; } else if (mvn == 2) { /* duplicate motion data for 2-Field MV block */ - s->current_picture.motion_val[dir][xy + 1][0] = s->current_picture.motion_val[dir][xy][0]; - s->current_picture.motion_val[dir][xy + 1][1] = s->current_picture.motion_val[dir][xy][1]; + s->cur_pic.motion_val[dir][xy + 1][0] = s->cur_pic.motion_val[dir][xy][0]; + s->cur_pic.motion_val[dir][xy + 1][1] = s->cur_pic.motion_val[dir][xy][1]; s->mv[dir][n + 1][0] = s->mv[dir][n][0]; s->mv[dir][n + 1][1] = s->mv[dir][n][1]; } @@ -715,19 +715,19 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], xy = s->block_index[0]; if (s->mb_intra) { - s->current_picture.motion_val[0][xy][0] = - s->current_picture.motion_val[0][xy][1] = - s->current_picture.motion_val[1][xy][0] = - s->current_picture.motion_val[1][xy][1] = 0; + s->cur_pic.motion_val[0][xy][0] = + s->cur_pic.motion_val[0][xy][1] = + s->cur_pic.motion_val[1][xy][0] = + s->cur_pic.motion_val[1][xy][1] = 0; return; } - if (direct && s->next_picture_ptr->field_picture) + if (direct && s->next_pic_ptr->field_picture) av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); - s->mv[0][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample); + s->mv[0][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][0][1] = scale_mv(s->next_pic.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][0][1] = scale_mv(s->next_pic.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample); /* Pullback predicted motion vectors as specified in 8.4.5.4 */ s->mv[0][0][0] = av_clip(s->mv[0][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); @@ -735,18 +735,18 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); if (direct) { - s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0]; - s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1]; - s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0]; - s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1]; + s->cur_pic.motion_val[0][xy][0] = s->mv[0][0][0]; + s->cur_pic.motion_val[0][xy][1] = s->mv[0][0][1]; + s->cur_pic.motion_val[1][xy][0] = s->mv[1][0][0]; + s->cur_pic.motion_val[1][xy][1] = s->mv[1][0][1]; return; } if ((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { - C = s->current_picture.motion_val[0][xy - 2]; - A = s->current_picture.motion_val[0][xy - wrap * 2]; + C = s->cur_pic.motion_val[0][xy - 2]; + A = s->cur_pic.motion_val[0][xy - wrap * 2]; off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; - B = s->current_picture.motion_val[0][xy - wrap * 2 + off]; + B = s->cur_pic.motion_val[0][xy - wrap * 2 + off]; if (!s->mb_x) C[0] = C[1] = 0; if (!s->first_slice_line) { // predictor A is not out of bounds @@ -812,10 +812,10 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y; } if ((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { - C = s->current_picture.motion_val[1][xy - 2]; - A = s->current_picture.motion_val[1][xy - wrap * 2]; + C = s->cur_pic.motion_val[1][xy - 2]; + A = s->cur_pic.motion_val[1][xy - wrap * 2]; off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; - B = s->current_picture.motion_val[1][xy - wrap * 2 + off]; + B = s->cur_pic.motion_val[1][xy - wrap * 2 + off]; if (!s->mb_x) C[0] = C[1] = 0; @@ -882,10 +882,10 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], s->mv[1][0][0] = ((px + dmv_x[1] + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[1][0][1] = ((py + dmv_y[1] + r_y) & ((r_y << 1) - 1)) - r_y; } - s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0]; - s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1]; - s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0]; - s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1]; + s->cur_pic.motion_val[0][xy][0] = s->mv[0][0][0]; + s->cur_pic.motion_val[0][xy][1] = s->mv[0][0][1]; + s->cur_pic.motion_val[1][xy][0] = s->mv[1][0][0]; + s->cur_pic.motion_val[1][xy][1] = s->mv[1][0][1]; } void ff_vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dmv_y, @@ -897,14 +897,14 @@ void ff_vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dmv_y, if (v->bmvtype == BMV_TYPE_DIRECT) { int total_opp, k, f; - if (s->next_picture.mb_type[mb_pos + v->mb_off] != MB_TYPE_INTRA) { - s->mv[0][0][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0] + v->blocks_off][0], + if (s->next_pic.mb_type[mb_pos + v->mb_off] != MB_TYPE_INTRA) { + s->mv[0][0][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[0] + v->blocks_off][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][0][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0] + v->blocks_off][1], + s->mv[0][0][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[0] + v->blocks_off][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][0][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0] + v->blocks_off][0], + s->mv[1][0][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[0] + v->blocks_off][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][0][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0] + v->blocks_off][1], + s->mv[1][0][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[0] + v->blocks_off][1], v->bfraction, 1, s->quarter_sample); total_opp = v->mv_f_next[0][s->block_index[0] + v->blocks_off] @@ -919,10 +919,10 @@ void ff_vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dmv_y, } v->ref_field_type[0] = v->ref_field_type[1] = v->cur_field_type ^ f; for (k = 0; k < 4; k++) { - s->current_picture.motion_val[0][s->block_index[k] + v->blocks_off][0] = s->mv[0][0][0]; - s->current_picture.motion_val[0][s->block_index[k] + v->blocks_off][1] = s->mv[0][0][1]; - s->current_picture.motion_val[1][s->block_index[k] + v->blocks_off][0] = s->mv[1][0][0]; - s->current_picture.motion_val[1][s->block_index[k] + v->blocks_off][1] = s->mv[1][0][1]; + s->cur_pic.motion_val[0][s->block_index[k] + v->blocks_off][0] = s->mv[0][0][0]; + s->cur_pic.motion_val[0][s->block_index[k] + v->blocks_off][1] = s->mv[0][0][1]; + s->cur_pic.motion_val[1][s->block_index[k] + v->blocks_off][0] = s->mv[1][0][0]; + s->cur_pic.motion_val[1][s->block_index[k] + v->blocks_off][1] = s->mv[1][0][1]; v->mv_f[0][s->block_index[k] + v->blocks_off] = f; v->mv_f[1][s->block_index[k] + v->blocks_off] = f; } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 3b5b016cf9..93398e3fb2 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -235,15 +235,15 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) v->sprite_output_frame->linesize[plane] * row; for (sprite = 0; sprite <= v->two_sprites; sprite++) { - uint8_t *iplane = s->current_picture.f->data[plane]; - int iline = s->current_picture.f->linesize[plane]; + uint8_t *iplane = s->cur_pic.f->data[plane]; + int iline = s->cur_pic.f->linesize[plane]; int ycoord = yoff[sprite] + yadv[sprite] * row; int yline = ycoord >> 16; int next_line; ysub[sprite] = ycoord & 0xFFFF; if (sprite) { - iplane = s->last_picture.f->data[plane]; - iline = s->last_picture.f->linesize[plane]; + iplane = s->last_pic.f->data[plane]; + iline = s->last_pic.f->linesize[plane]; } next_line = FFMIN(yline + 1, (v->sprite_height >> !!plane) - 1) * iline; if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) { @@ -317,12 +317,12 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) if (ret < 0) return ret; - if (!s->current_picture.f || !s->current_picture.f->data[0]) { + if (!s->cur_pic.f || !s->cur_pic.f->data[0]) { av_log(avctx, AV_LOG_ERROR, "Got no sprites\n"); return AVERROR_UNKNOWN; } - if (v->two_sprites && (!s->last_picture_ptr || !s->last_picture.f->data[0])) { + if (v->two_sprites && (!s->last_pic_ptr || !s->last_pic.f->data[0])) { av_log(avctx, AV_LOG_WARNING, "Need two sprites, only got one\n"); v->two_sprites = 0; } @@ -340,7 +340,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - AVFrame *f = s->current_picture.f; + AVFrame *f = s->cur_pic.f; int plane, i; /* Windows Media Image codecs have a convergence interval of two keyframes. @@ -837,10 +837,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { /* special case for last picture */ - if (s->low_delay == 0 && s->next_picture_ptr) { - if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) + if (s->low_delay == 0 && s->next_pic_ptr) { + if ((ret = av_frame_ref(pict, s->next_pic_ptr->f)) < 0) return ret; - s->next_picture_ptr = NULL; + s->next_pic_ptr = NULL; *got_frame = 1; } @@ -1047,7 +1047,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } /* skip B-frames if we don't have reference frames */ - if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->last_pic_ptr && s->pict_type == AV_PICTURE_TYPE_B) { av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n"); goto end; } @@ -1061,19 +1061,19 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, goto err; } - v->s.current_picture_ptr->field_picture = v->field_mode; - v->s.current_picture_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE); - v->s.current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff; + v->s.cur_pic_ptr->field_picture = v->field_mode; + v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE); + v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff; // process pulldown flags - s->current_picture_ptr->f->repeat_pict = 0; + s->cur_pic_ptr->f->repeat_pict = 0; // Pulldown flags are only valid when 'broadcast' has been set. if (v->rff) { // repeat field - s->current_picture_ptr->f->repeat_pict = 1; + s->cur_pic_ptr->f->repeat_pict = 1; } else if (v->rptfrm) { // repeat frames - s->current_picture_ptr->f->repeat_pict = v->rptfrm * 2; + s->cur_pic_ptr->f->repeat_pict = v->rptfrm * 2; } if (avctx->hwaccel) { @@ -1135,7 +1135,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, ret = AVERROR_INVALIDDATA; goto err; } - v->s.current_picture_ptr->f->pict_type = v->s.pict_type; + v->s.cur_pic_ptr->f->pict_type = v->s.pict_type; ret = hwaccel->start_frame(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field); @@ -1230,9 +1230,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, v->end_mb_x = s->mb_width; if (v->field_mode) { - s->current_picture.f->linesize[0] <<= 1; - s->current_picture.f->linesize[1] <<= 1; - s->current_picture.f->linesize[2] <<= 1; + s->cur_pic.f->linesize[0] <<= 1; + s->cur_pic.f->linesize[1] <<= 1; + s->cur_pic.f->linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } @@ -1307,9 +1307,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } if (v->field_mode) { v->second_field = 0; - s->current_picture.f->linesize[0] >>= 1; - s->current_picture.f->linesize[1] >>= 1; - s->current_picture.f->linesize[2] >>= 1; + s->cur_pic.f->linesize[0] >>= 1; + s->cur_pic.f->linesize[1] >>= 1; + s->cur_pic.f->linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { @@ -1353,16 +1353,16 @@ image: *got_frame = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) goto err; if (!v->field_mode) - ff_print_debug_info(s, s->current_picture_ptr, pict); + ff_print_debug_info(s, s->cur_pic_ptr, pict); *got_frame = 1; - } else if (s->last_picture_ptr) { - if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) + } else if (s->last_pic_ptr) { + if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) goto err; if (!v->field_mode) - ff_print_debug_info(s, s->last_picture_ptr, pict); + ff_print_debug_info(s, s->last_pic_ptr, pict); *got_frame = 1; } } diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 6df3e88dac..cd7194138d 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -370,7 +370,7 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - Picture *pic = s->current_picture_ptr; + Picture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index bbf76eb469..1f0ea7e803 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -35,7 +35,7 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - Picture *pic = s->current_picture_ptr; + Picture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG1Or2 *info = &pic_ctx->info.mpeg; VdpVideoSurface ref; @@ -47,12 +47,12 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, switch (s->pict_type) { case AV_PICTURE_TYPE_B: - ref = ff_vdpau_get_surface_id(s->next_picture.f); + ref = ff_vdpau_get_surface_id(s->next_pic.f); assert(ref != VDP_INVALID_HANDLE); info->backward_reference = ref; /* fall through to forward prediction */ case AV_PICTURE_TYPE_P: - ref = ff_vdpau_get_surface_id(s->last_picture.f); + ref = ff_vdpau_get_surface_id(s->last_pic.f); info->forward_reference = ref; } @@ -87,7 +87,7 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - Picture *pic = s->current_picture_ptr; + Picture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c index 055426b95b..ecbc80b86d 100644 --- a/libavcodec/vdpau_mpeg4.c +++ b/libavcodec/vdpau_mpeg4.c @@ -34,7 +34,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext * const s = &ctx->m; - Picture *pic = s->current_picture_ptr; + Picture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4; VdpVideoSurface ref; @@ -47,13 +47,13 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, switch (s->pict_type) { case AV_PICTURE_TYPE_B: - ref = ff_vdpau_get_surface_id(s->next_picture.f); + ref = ff_vdpau_get_surface_id(s->next_pic.f); assert(ref != VDP_INVALID_HANDLE); info->backward_reference = ref; info->vop_coding_type = 2; /* fall-through */ case AV_PICTURE_TYPE_P: - ref = ff_vdpau_get_surface_id(s->last_picture.f); + ref = ff_vdpau_get_surface_id(s->last_pic.f); assert(ref != VDP_INVALID_HANDLE); info->forward_reference = ref; } diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index 0eacc4477d..119e514c0e 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -36,7 +36,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, { VC1Context * const v = avctx->priv_data; MpegEncContext * const s = &v->s; - Picture *pic = s->current_picture_ptr; + Picture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoVC1 *info = &pic_ctx->info.vc1; VdpVideoSurface ref; @@ -47,15 +47,15 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, switch (s->pict_type) { case AV_PICTURE_TYPE_B: - if (s->next_picture_ptr) { - ref = ff_vdpau_get_surface_id(s->next_picture.f); + if (s->next_pic_ptr) { + ref = ff_vdpau_get_surface_id(s->next_pic.f); assert(ref != VDP_INVALID_HANDLE); info->backward_reference = ref; } /* fall-through */ case AV_PICTURE_TYPE_P: - if (s->last_picture_ptr) { - ref = ff_vdpau_get_surface_id(s->last_picture.f); + if (s->last_pic_ptr) { + ref = ff_vdpau_get_surface_id(s->last_pic.f); assert(ref != VDP_INVALID_HANDLE); info->forward_reference = ref; } @@ -104,7 +104,7 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, { VC1Context * const v = avctx->priv_data; MpegEncContext * const s = &v->s; - Picture *pic = s->current_picture_ptr; + Picture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index d6990a39c0..7807047aa6 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -1108,7 +1108,7 @@ static int videotoolbox_mpeg_decode_slice(AVCodecContext *avctx, static int videotoolbox_mpeg_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - AVFrame *frame = s->current_picture_ptr->f; + AVFrame *frame = s->cur_pic_ptr->f; return ff_videotoolbox_common_end_frame(avctx, frame); } diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index ff27d1b4d0..61e1759449 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -103,7 +103,7 @@ static int parse_mb_skip(WMV2DecContext *w) int mb_x, mb_y; int coded_mb_count = 0; MpegEncContext *const s = &w->s; - uint32_t *const mb_type = s->current_picture_ptr->mb_type; + uint32_t *const mb_type = s->cur_pic_ptr->mb_type; w->skip_type = get_bits(&s->gb, 2); switch (w->skip_type) { @@ -238,8 +238,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) if (s->pict_type == AV_PICTURE_TYPE_I) { /* Is filling with zeroes really the right thing to do? */ - memset(s->current_picture_ptr->mb_type, 0, - sizeof(*s->current_picture_ptr->mb_type) * + memset(s->cur_pic_ptr->mb_type, 0, + sizeof(*s->cur_pic_ptr->mb_type) * s->mb_height * s->mb_stride); if (w->j_type_bit) w->j_type = get_bits1(&s->gb); @@ -331,7 +331,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) s->esc3_run_length = 0; if (w->j_type) { - ff_intrax8_decode_picture(&w->x8, &s->current_picture, + ff_intrax8_decode_picture(&w->x8, &s->cur_pic, &s->gb, &s->mb_x, &s->mb_y, 2 * s->qscale, (s->qscale - 1) | 1, s->loop_filter, s->low_delay); @@ -366,11 +366,11 @@ static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py) wrap = s->b8_stride; xy = s->block_index[0]; - mot_val = s->current_picture.motion_val[0][xy]; + mot_val = s->cur_pic.motion_val[0][xy]; - A = s->current_picture.motion_val[0][xy - 1]; - B = s->current_picture.motion_val[0][xy - wrap]; - C = s->current_picture.motion_val[0][xy + 2 - wrap]; + A = s->cur_pic.motion_val[0][xy - 1]; + B = s->cur_pic.motion_val[0][xy - wrap]; + C = s->cur_pic.motion_val[0][xy + 2 - wrap]; if (s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag) diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1])); @@ -452,7 +452,7 @@ static int wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]) return 0; if (s->pict_type == AV_PICTURE_TYPE_P) { - if (IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])) { + if (IS_SKIP(s->cur_pic.mb_type[s->mb_y * s->mb_stride + s->mb_x])) { /* skip mb */ s->mb_intra = 0; for (i = 0; i < 6; i++) From patchwork Sat May 11 20:50:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48757 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298904pzb; Sat, 11 May 2024 13:56:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUAB6L2mU/SpO8iiUhshRIcH7efGyhT5OaYpOLiYg7rIsjdypMpJ1hbnXOG4cdBQsl1luGca/emkfWBvA34NaG0Bw30w9gtl+PsuA== X-Google-Smtp-Source: AGHT+IELnfqdhGHDPZJ4WBa/Tnds279XCfUPdXC+Pt4ohdcpDmHSrDT4GPBqYd17rqgvV54CGzsD X-Received: by 2002:a05:6512:3d8d:b0:51d:9ae:87e with SMTP id 2adb3069b0e04-5221016b565mr6201285e87.46.1715460975991; Sat, 11 May 2024 13:56:15 -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 a640c23a62f3a-a5a17945fe5si373656966b.196.2024.05.11.13.56.15; Sat, 11 May 2024 13:56:15 -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=B4zZ1Koy; 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 05E1168D6CB; Sat, 11 May 2024 23:53:36 +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-am6eur05olkn2029.outbound.protection.outlook.com [40.92.91.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 688D868D6BF for ; Sat, 11 May 2024 23:53:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=loaT/c/gSHq1DavArDQIOb5+SYSm9UaPcbHcVM3fcO/w+F8wIFVRf/4rIJ8zwvWmd/pDqZiuuEQD33D5kwma7VW5ApjnAQ3xoEDchZCeAKdjj31frnyRX1acxD5qDcYMGu5yW1oVlMISvKASivkSPTX5iU3ZIVRQ1pnZCBf2JNZyEzHupoorOgErSRu8tPpMKrS1ksjO+m2QOexs7h0NLpke61QfUz+Miw+vu2sKK9gGebYC14fjzXfYGh3k4i8YJGjpcteg3XtUgG9mir8QOmlJFMbk7YHOTS3vX133NBFWg2/Q77PebkssRnoZDx3CJ5GnA3v/7DERLo0xY6rKKw== 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=2mAHbcSW1QsjQfEe2aR+Lkf2Rc72uDRc15LZnIe58SU=; b=JWxJl9f0A9N5A5Ai6AOUTpvU833vFQ5uAoskO+Vlzml97WhxJT3DapRXGc6guqQgQ26+hea5/z1yiy5de+OAzN3/VRu0+J8kUtiNKoMi+2U7TZz0/DSeKEWfeRVATx4PCV7ML/VxNzPQeiIgiv/IxOsYapFeLkIGcXsVpKJF8DaazU9+ghahZGKRms/AC2fEhgDpUbFT6qY+L6pSLj93YZuDy8z0rWCdA9Kt2BwsZGosZWMANx2cCqgsTZAxVJ5L94LYdbNkS8upqK7SZqeSUBkv//QombUac4S6ZeBxPW+r5/w1d6MpaC6CwE4ogVyzUuq0u2yAPsZfZWXexvABpw== 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=2mAHbcSW1QsjQfEe2aR+Lkf2Rc72uDRc15LZnIe58SU=; b=B4zZ1Koy6rNVdD/akCwJvi5wi5fxG6jo9EjrLR2Z/D9uW21UFmS/Yeku0y2drGNAUmmBgu12Kx10ftUGQEb8UPeQ0j6tjCmDq+/mo3MOBvv7V8WwwAmtmM/1OJPV15D0VJGEquOVp41hN5RYyUR4iLz55GzJMKJzWNRhIXZrPGamlfjxQTgOZRK7546d74YxCYFvEp1c5jpAWcUwpf6XMAPqBAO/R0XFYjM12+W7RjLb69kaDnfmgYy19dBjy9PWAbIklvGFDQ6QWZjedodpDq1DgL6wY1lVIPdHFVIpFZPeDHN9IRyWXxBrqGrHlouS1avna3xicqsnF0T9grBCcA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:33 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:56 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [C0SXeOEh+ridn+kESVj7QMjebc/yVPmUrqa5LSkdUko=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-31-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: cec5271a-a8a7-4a00-df7b-08dc71fc6b71 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: pbjEZnoDUQEo4OMTBofxnR+SuW0sPJdQP6r1mY4F3UYtc026xuSSb439/EneyZ8aOKeqqO+CQaneeeIB1Noqp0v5PkfFIC9gnnoblWiYWPbd0TfQdgJyCzRzjFdGClODA0sm4YOr26YeIQoNp2jckmpiTkO6pgDyZaEpj8zgtjODJ0twW3ZaeMkTy/jQV7ZDMfC0iXHcf2HsciRg8gCTj13vB2Fd3ZrZbOl6gQjvAZZzsrhSHPrtwuAchpPmM6aNqrBt26/svZvNKJuFPzs2b49qMqonAVixp5r7a3TvnafvWcXdg273a74L+XtrkY1zYW++6F7MoFF4WenXIIXsnYgZ/l6Ak5SLgLYhYdLSMQxv3fXhAqUjS0/aXR+xAR8m2Vm0DbYDBVq+s8Ht2fZh6LT7/lMfCNEYtFIyzYy1hxFaL7io5HV327AI5Pw46V4yxmSD3Ej2Ec7okVnVlnOuGAVWLWLwuwCMTd+OfgEqs6LV6xgJ+ig1DrEgJGq1rGJ2ASTzv4eloPgEE2JfZSOfl7o3owezVTDdEXY+YnV939HhOm+mzUuOG7vPB0qu/ZjOBrX5UYPLEIZiKeecmHG1dZW9mqF5X5upBrPdL1DC/2quy1pIhYG1GM0KyAwCcOFm X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a8Ck3AONNyuKVofIsY8hPdZW7W7dsgNjYyh6nOMzMA7elGYRg8GrgnvVjKAKUnEGJWjD2U15lGg8pCEjp4yc3ICl3Az9hz6Cs3tpdI2yw8P/QJZ49uNU1ViIMe5Y7uQfNKVWYgbYCk/uuX1uJQQmWN/amBsY99sTB8l5lxeNcoW7CjOGctO4gVfecr80EBz4xJaIPN4660hBKtqWdLX69px75dUq72ch0+mi84Re8vEUwqt/6Mzm/WEhMpy3BaODWAxN2mjYrT3ul8ke2ou33yngMqY0WaGc4HGHPfA54p59mcUdCpXX1sQ+1fjG/3x0s6TqBJRuwR4K6pgn78HOguxdu/AaIGA4sIIyG+u+xgcNxpFwPhidyLR5EYiZI18zlaNReiXeA1QKFrGdkuSgfE7/fsZDaaKtfuwroHSfnncblRj/Sq+ZKElui0R6IbJ5tfTszla6ZVwqPFCWbRp7FIy9+5ODYIseaIqQzbP2WlHMqL7wKG/qeWscBbO18QXeXADEYf5pEjT9tbmrHfJu8e+ZkT9SYsOAJZkNYVOlPnAGgmfeZG2sOobXKtPhlotPwePSMrux2w9PvceX0o0mnqoapPfk9mCZCs3ghuIhngVAcEM+ZpqaByGXsREu/h1H+pv81OBnsbH+nozE0WHKcwCrXLa2gHQHWLoSUOhGlqaRviCV8/NYP5GOxf/AgqB2Y5vStuX0iryQibO9mtkfPtib0AMn2Lu2RvSan0Q55Tmt6GNizkEHA8g7prnUa3IAPVzKPkABDiRYpLuG+ghR4Jsv0oiOts2/PYZVz0Y3dbr6dgCY6uopBtuMSal39EhXN1uK8tBIWxBJzBw1X9HV4HH6csKeO0ytKs+SfZMa4Rhz/3DxNxiLfc0v+EItxsZvub3SM1SsgGjwE+N5j1GPnny1MB6Smn9AyKj8LAp0ZLKoGGSFEvy3MuHAWcUaJxMgMpNj85yFUf4YgAkeis0HBvPB9yVOEvPbxodNfBqqWSwfwbvWOg+C9amqjJsOgybcbFx5fCcKJWVB9l+gDtoQLkpyGWYI10+0YiYF/xVOEshmB0fIx+uEyK88NKQs4q+hB3VARIpiwEECfCNvexRohDFCfsKoEMb/kq26DYlKyISNMjbihGZdU2Fz8jmbjsjEZSVjluPyqDadAWd4MipfD3C8dQTZBpc7vgWrt6rCTPa+dswpu/+x3s1kPoURb7fM2nF5NN4dme9/ZKmR/7op4KUL24VFXFway0GNSSNNDGwe7gFgcvz1syhAcMytEIRmqblJtv7+XHoS1Lj76iB7MA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cec5271a-a8a7-4a00-df7b-08dc71fc6b71 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:33.0339 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 32/71] avcodec/mpegpicture: Reduce value of MAX_PLANES define 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: mZquOvsF+jcf No mpegvideo based codec supports alpha. While just at it, also make the define shorter. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.h | 2 +- libavcodec/mpegvideo.h | 2 +- libavcodec/mpegvideo_enc.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index 363732910a..8e3c119acc 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -27,7 +27,7 @@ #include "motion_est.h" #include "threadframe.h" -#define MPEGVIDEO_MAX_PLANES 4 +#define MPV_MAX_PLANES 3 #define MAX_PICTURE_COUNT 36 #define EDGE_WIDTH 16 diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index e2953a3198..62550027a7 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -256,7 +256,7 @@ typedef struct MpegEncContext { uint8_t *mb_mean; ///< Table for MB luminance int64_t mb_var_sum; ///< sum of MB variance for current frame int64_t mc_mb_var_sum; ///< motion compensated MB variance for current frame - uint64_t encoding_error[MPEGVIDEO_MAX_PLANES]; + uint64_t encoding_error[MPV_MAX_PLANES]; int motion_est; ///< ME algorithm int me_penalty_compensation; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index d7e1085cf8..e7459cc5bf 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1634,7 +1634,7 @@ no_output_pic: } else { // input is not a shared pix -> reuse buffer for current_pix s->cur_pic_ptr = s->reordered_input_picture[0]; - for (i = 0; i < 4; i++) { + for (int i = 0; i < MPV_MAX_PLANES; i++) { if (s->new_pic->data[i]) s->new_pic->data[i] += INPLACE_OFFSET; } @@ -1861,12 +1861,11 @@ vbv_retry: if (avctx->flags & AV_CODEC_FLAG_PASS1) ff_write_pass1_stats(s); - for (i = 0; i < 4; i++) { + for (int i = 0; i < MPV_MAX_PLANES; i++) avctx->error[i] += s->encoding_error[i]; - } ff_side_data_set_encoder_stats(pkt, s->cur_pic.f->quality, s->encoding_error, - (avctx->flags&AV_CODEC_FLAG_PSNR) ? MPEGVIDEO_MAX_PLANES : 0, + (avctx->flags&AV_CODEC_FLAG_PSNR) ? MPV_MAX_PLANES : 0, s->pict_type); if (avctx->flags & AV_CODEC_FLAG_PASS1) From patchwork Sat May 11 20:50:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48759 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298965pzb; Sat, 11 May 2024 13:56:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXD7bi1vsJEJnGOe+o6BCoRICTYo3n4CgExGr8RLUpYdJH1PiDt9Irzls062l+IAIP8D5omWZ5IPvdf9YwOFQOwngSV+VNRxSVW/w== X-Google-Smtp-Source: AGHT+IF+iIRZZSisxTMpkRhKhksxmVUwGZCzMkksLCp6nx5JkWX9siDIfzdI+FP0daMBUduzpDrk X-Received: by 2002:a05:6512:398a:b0:519:2a88:add6 with SMTP id 2adb3069b0e04-5220fe7999amr4571399e87.55.1715460996394; Sat, 11 May 2024 13:56: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 2adb3069b0e04-521f38db035si2186962e87.442.2024.05.11.13.56.35; Sat, 11 May 2024 13:56: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=ablPYTZy; 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 6C77A68D6D9; Sat, 11 May 2024 23:53:42 +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-am6eur05olkn2089.outbound.protection.outlook.com [40.92.91.89]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 027AC68D6C4 for ; Sat, 11 May 2024 23:53:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XEkdT3Lw7BMSgYm0EuOnvX3ChBIugziRts9IkoyJDEYFXvhSHIvKxAePIN5cYV9VcFLcEYW3NMI/oZ3KUhG5quh9ALZwY4HoHc8hQfAOx3KbUzJhIFJ6JhKHvmK32UTukNZ19nJjViwuJJwgBkHTLIRX0DZbgGhOe/ZHAsu0CauoAQmoMl9vmr49RWXfBorhYaKVMSqb+wc5+X2/Baf4qdX8TPbVFyg9NAFDKt4Ck/U/KlXqtXx8qXY1pEt6QGsF5XKkaI73ZRn5KpGij+mQP+OJhi5tMrjJnIUYXu7u8Wlvlj0kgW5HxMRIsBMj6UOQwEqtP640hBJ0yU4uo6of0Q== 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=gTDEJ5usnwsqhWxjSK4y1arF4xPUcQARcuWggzVtiuw=; b=Kwg3IMzKu/OO8Yk6x34ETnY696987Kl+oTUB/i+9U47LkqdPzOrwPANfRTdYlZtPcJaMbP10w4Y6+rEPsXLz2Kdm6+AkqWan7Qd94LII1T8Jom+BximLb9kbLfWheyfeJf674lSPrnjVYKRORUOM7J5wHNLNCQSmxHWu3LG/K1un93Twzv3cb/jC2P7qeeiik1lzJH3FsSL+NMgFNr0IMxIecZQh0ss7k8/6xO8vCbrCGR+q8ZicE7eGDLgEPIxchlNd09FYjNU2MT1cSD5Kq8S596S5gCjUq7cgrQ5E+PLDa0HkQE9LgpH3dD/iJsf/JjNO0NbLIcqsPEVYhYNJrg== 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=gTDEJ5usnwsqhWxjSK4y1arF4xPUcQARcuWggzVtiuw=; b=ablPYTZyeqriJ8so9I26eZZ36e3lgQfpqxG/lo5W9cXf9icGqDC9mZqJKVkBFpzc3mNgw9Gmbcj0JYeMGXPfk12RIdaGhvFTyyfeKNG4t5gchnkxZTPWmA2fhyRuK355vI3uNKuS23IeZsojEMr4pQX89u+/tdu34lf5EunHwGXlY+2g2+LdXL0VdPq4VFbINPvALWaupiQ26bsppxbpSSn0+9wJdN+n31yHIPeLb3aVU8pGK7NTtwxoSnVIhUjMDSzoOjWpbf2cnspxDtAaE87s06ODTQoVO4YXHndEFllGePGs0yLGprY9Lcp8mkKdl+l9dZCM58F3A+m/XtPZew== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:53:38 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:53:38 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:57 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [10VjxLcmlFy2iY+9qlLJiO19h5wYmzSD+SrgLiAuzZA=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-32-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d024c7e-2409-491a-5f1e-08dc71fc6e74 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: MP9NckW2PFxF2t8JB8q2qjxsAi+HAHMJ9nH/leEmWiDLep4zWwDreY6vS2W4iojZoWlMSQA6+7DUHLkusPFejiSZMHaVl6cJ6vvBT/+naotLBl8OWSnndJbPzvRQqZnXaH2OwMAVfKvxB1NgXc1tdRsV6+xvI5F95sEqpqAbp0tlp48F+Uyq+Rd+N+RwWvRJD1cTT1VP/0+BEeJ8ceuxNrF10Sh/NPoKJkED350Grk0d6A5C0WLscCmiOWShYbo+241eXOr3Smt+5dXhGlsu7+UgoNV5TobyLWgekNJCwhQZB/enKxr6UTTMntFeyuaz0QN8h/FrZWtXOP0l5lNHGVAlmN4X1hEDCQWj3/3HKhpEVFIW8P9fpSM6CXK+alHH7Gu73CyYRmhTzdbW/weQ7+0ZPR7OgPuvIEu/SIWMiSM0AWq3bxAIyuLJKHPBWztL/niVDBwbVqayf9d63bGnHLGDNK3nTTPzmWCCI2s8LcD7Ws2GqbkeUT+rTJ1i+sRIOQko8CNoVnc9oLtxMBxuQIag9ylZ7TPsC6+z6gAB2XFJYBtaoOD5YFvLBjmE+MvKd+OJNwwJ0je9+7OUB3j2A2HquK0qpDAq4QVoh298XLecJ+3CozkyvbMCBRlCnIUS X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ktvi2MXJ2HLNFxln9ToRHZh36dCCgbuTygBS3KLQ4MVjBVf2a7Y1np5T/HHWOYt9aP3Uv4mQIffe997aw3/kZgAzta1IQ20T4arYsjd9n9tE4xn+RQKOA8C6V74o2YXujYaryzSgGl5PROrxgqXzR1Jy7CGQ+yy/jf6nZrC/jGTMCxqAducY7pTT15YaDCuHcNKGhTlOcY7CKfsHXIHUi8amtYR5YLz9/hgVhTLIsEzPN/aqovNfj0+57qfYfiN4n3TSVdelOh17u2Z/QC3qG7VjFsRsgum1aUSS9Rgfa15Z0+retW46VoNWZ73LxWM0SR3F+MpAVwlrcGNCVJJIp/v6q76ll+RPEtsT+uiPjrz3KYd5AS75HvVYS1dAlI46Js2p0faDwgxt9DeIOFvjc3FnRVpczaU/C4uuqFqBliDzeqCAAigFdwN7cmi1+R4oByJw7Nk3SznKX3pdi9tTp4fBL6OGKRVY574PiH0IUzU+W/MpBPx2FGhaFP32jzD+ZG00Bkept2AknP9ig3sBWd+BYHJzknh1lkL/xya+LHhfp9PpQKjt8UMMHYHxMyIsX2VEjGJaKi+h3ZZBBPhKkOOA/CtwHMPcEY6H5BoVArwQgpjLLYDMi1zGgSAG/waOto/3RJefimjTK6YP/JeU6mHsJI+u2lJf6ra5q4fZO/m7tqUYJeVdt4GdiEmPu7pSojKnRyKPMybw7eO0z6JMqm9YWBTfcgGBEKe1MoVcdbtJHTpqQSN1skcVpPQgHbUMxJ4YnIZe0K8Wx16jBO6j0wospcQpDXogjrfa5PgUaXmf9PSZ+YKbQfKNjs1vUSwd5tpFuXJZfP4YJpcRJ1k167X7RM+AP460/F/wuHS81BVpqn2ok/mm3B7izl1saWg1EiHvIwhICurmjKC3JQfFxi40zrUR7AHJqBCs8pNmerRws94qSxes9N0iY0/sCg0rb1Do84rDXkqvklKVMjBWOuPf/wDAwrAaPv+D4hdbI2jdJZ/9fpT9d/yjNw34LRB4nC6ZjllcQXoAy1DUvYjERJGIgYvxvBUel4NFSorhxGI8vEeRr4+/8Yqfl3gtOh7ip+lhPsQwKX6LZuYZ7gbKTyIu69QpAhaJbQqFfveWI8NH7/7d8QLAXWTfXoaq71RxNaMXGd6lo3+9xi3bEEArCTSBJFQ5oyeRC04KxLtocYz1Igui22otmFIR2DEhCdBZElGKBypMbGctd8P3J06pF66XZYlu+39ip0HrXDh10sabXZEy9JEYWdm1jTH41BgNTwBlgA7vsCLFW8sZVM1kNQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d024c7e-2409-491a-5f1e-08dc71fc6e74 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:53:38.1200 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 33/71] avcodec/mpegpicture: Cache AVFrame.data and linesize values 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: KpcTpAyavHlz This avoids an indirection and is in preparation for removing the AVFrame from MpegEncContext.(cur|last|next)_pic altogether. Signed-off-by: Andreas Rheinhardt --- libavcodec/motion_est.c | 16 +++---- libavcodec/mpeg12dec.c | 14 +++--- libavcodec/mpeg_er.c | 6 +-- libavcodec/mpegpicture.c | 14 ++++++ libavcodec/mpegpicture.h | 4 ++ libavcodec/mpegvideo.c | 10 ++-- libavcodec/mpegvideo_dec.c | 4 +- libavcodec/mpegvideo_enc.c | 16 +++---- libavcodec/mpegvideo_motion.c | 4 +- libavcodec/mpv_reconstruct_mb_template.c | 12 ++--- libavcodec/msmpeg4.c | 4 +- libavcodec/mss2.c | 4 +- libavcodec/svq1enc.c | 6 +-- libavcodec/vc1_block.c | 8 ++-- libavcodec/vc1_mc.c | 60 ++++++++++++------------ libavcodec/vc1dec.c | 28 +++++------ 16 files changed, 114 insertions(+), 96 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index b2644b5328..fcef47a623 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -703,11 +703,11 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize; if(s->no_rounding){ - s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.f->data[1] + offset, s->uvlinesize, 8); - s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.f->data[2] + offset, s->uvlinesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); }else{ - s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.f->data[1] + offset, s->uvlinesize, 8); - s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.f->data[2] + offset, s->uvlinesize, 8); + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); } dmin_sum += s->mecc.mb_cmp[1](s, s->new_pic->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8); @@ -899,7 +899,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, const int shift= 1+s->quarter_sample; int mb_type=0; - init_ref(c, s->new_pic->data, s->last_pic.f->data, NULL, 16*mb_x, 16*mb_y, 0); + init_ref(c, s->new_pic->data, s->last_pic.data, NULL, 16*mb_x, 16*mb_y, 0); av_assert0(s->quarter_sample==0 || s->quarter_sample==1); av_assert0(s->linesize == c->stride); @@ -1070,7 +1070,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int P[10][2]; const int shift= 1+s->quarter_sample; const int xy= mb_x + mb_y*s->mb_stride; - init_ref(c, s->new_pic->data, s->last_pic.f->data, NULL, 16*mb_x, 16*mb_y, 0); + init_ref(c, s->new_pic->data, s->last_pic.data, NULL, 16*mb_x, 16*mb_y, 0); av_assert0(s->quarter_sample==0 || s->quarter_sample==1); @@ -1495,8 +1495,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, int fmin, bmin, dmin, fbmin, bimin, fimin; int type=0; const int xy = mb_y*s->mb_stride + mb_x; - init_ref(c, s->new_pic->data, s->last_pic.f->data, - s->next_pic.f->data, 16 * mb_x, 16 * mb_y, 2); + init_ref(c, s->new_pic->data, s->last_pic.data, + s->next_pic.data, 16 * mb_x, 16 * mb_y, 2); get_limits(s, 16*mb_x, 16*mb_y); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 4aba5651a6..c04d351e0c 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1297,12 +1297,12 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) for (int i = 0; i < 3; i++) { if (s->picture_structure == PICT_BOTTOM_FIELD) { - s->cur_pic.f->data[i] = FF_PTR_ADD(s->cur_pic.f->data[i], - s->cur_pic.f->linesize[i]); + s->cur_pic.data[i] = FF_PTR_ADD(s->cur_pic.data[i], + s->cur_pic.linesize[i]); } - s->cur_pic.f->linesize[i] *= 2; - s->last_pic.f->linesize[i] *= 2; - s->next_pic.f->linesize[i] *= 2; + s->cur_pic.linesize[i] *= 2; + s->last_pic.linesize[i] *= 2; + s->next_pic.linesize[i] *= 2; } } @@ -1377,9 +1377,9 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return ret; for (int i = 0; i < 3; i++) { - s->cur_pic.f->data[i] = s->cur_pic_ptr->f->data[i]; + s->cur_pic.data[i] = s->cur_pic_ptr->f->data[i]; if (s->picture_structure == PICT_BOTTOM_FIELD) - s->cur_pic.f->data[i] += + s->cur_pic.data[i] += s->cur_pic_ptr->f->linesize[i]; } } diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index bc838b05ba..8d8b2aea92 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -84,13 +84,13 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, if (!s->chroma_y_shift) s->bdsp.clear_blocks(s->block[6]); - s->dest[0] = s->cur_pic.f->data[0] + + s->dest[0] = s->cur_pic.data[0] + s->mb_y * 16 * s->linesize + s->mb_x * 16; - s->dest[1] = s->cur_pic.f->data[1] + + s->dest[1] = s->cur_pic.data[1] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); - s->dest[2] = s->cur_pic.f->data[2] + + s->dest[2] = s->cur_pic.data[2] + s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + s->mb_x * (16 >> s->chroma_x_shift); diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index ca265da9fc..6da9545b50 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -174,6 +174,11 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, *linesize = pic->f->linesize[0]; *uvlinesize = pic->f->linesize[1]; + for (int i = 0; i < MPV_MAX_PLANES; i++) { + pic->data[i] = pic->f->data[i]; + pic->linesize[i] = pic->f->linesize[i]; + } + ret = alloc_picture_tables(pools, pic, mb_height); if (ret < 0) goto fail; @@ -206,7 +211,11 @@ void ff_mpeg_unref_picture(Picture *pic) free_picture_tables(pic); + memset(pic->data, 0, sizeof(pic->data)); + memset(pic->linesize, 0, sizeof(pic->linesize)); + pic->dummy = 0; + pic->field_picture = 0; pic->b_frame_score = 0; pic->reference = 0; @@ -248,6 +257,11 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src) if (ret < 0) goto fail; + for (int i = 0; i < MPV_MAX_PLANES; i++) { + dst->data[i] = src->data[i]; + dst->linesize[i] = src->linesize[i]; + } + update_picture_tables(dst, src); ff_refstruct_replace(&dst->hwaccel_picture_private, diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index 8e3c119acc..814f71213e 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -21,6 +21,7 @@ #ifndef AVCODEC_MPEGPICTURE_H #define AVCODEC_MPEGPICTURE_H +#include #include #include "avcodec.h" @@ -57,6 +58,9 @@ typedef struct Picture { struct AVFrame *f; ThreadFrame tf; + uint8_t *data[MPV_MAX_PLANES]; + ptrdiff_t linesize[MPV_MAX_PLANES]; + int8_t *qscale_table_base; int8_t *qscale_table; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c8a1d6487a..c24b7207b1 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -881,8 +881,8 @@ void ff_clean_intra_table_entries(MpegEncContext *s) } void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename - const int linesize = s->cur_pic.f->linesize[0]; //not s->linesize as this would be wrong for field pics - const int uvlinesize = s->cur_pic.f->linesize[1]; + const int linesize = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics + const int uvlinesize = s->cur_pic.linesize[1]; const int width_of_mb = (4 + (s->avctx->bits_per_raw_sample > 8)) - s->avctx->lowres; const int height_of_mb = 4 - s->avctx->lowres; @@ -894,9 +894,9 @@ void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; //block_index is not used by mpeg2, so it is not affected by chroma_format - s->dest[0] = s->cur_pic.f->data[0] + (int)((s->mb_x - 1U) << width_of_mb); - s->dest[1] = s->cur_pic.f->data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); - s->dest[2] = s->cur_pic.f->data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); + s->dest[0] = s->cur_pic.data[0] + (int)((s->mb_x - 1U) << width_of_mb); + s->dest[1] = s->cur_pic.data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); + s->dest[2] = s->cur_pic.data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); if (s->picture_structure == PICT_FRAME) { s->dest[0] += s->mb_y * linesize << height_of_mb; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 9b04d6a351..570a422b6f 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -613,8 +613,8 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, const int h_edge_pos = s->h_edge_pos >> lowres; const int v_edge_pos = s->v_edge_pos >> lowres; int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h; - linesize = s->cur_pic.f->linesize[0] << field_based; - uvlinesize = s->cur_pic.f->linesize[1] << field_based; + linesize = s->cur_pic.linesize[0] << field_based; + uvlinesize = s->cur_pic.linesize[1] << field_based; // FIXME obviously not perfect but qpel will not work in lowres anyway if (s->quarter_sample) { diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index e7459cc5bf..2f6aaad1c7 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1655,20 +1655,20 @@ static void frame_end(MpegEncContext *s) !s->intra_only) { int hshift = s->chroma_x_shift; int vshift = s->chroma_y_shift; - s->mpvencdsp.draw_edges(s->cur_pic.f->data[0], - s->cur_pic.f->linesize[0], + s->mpvencdsp.draw_edges(s->cur_pic.data[0], + s->cur_pic.linesize[0], s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); - s->mpvencdsp.draw_edges(s->cur_pic.f->data[1], - s->cur_pic.f->linesize[1], + s->mpvencdsp.draw_edges(s->cur_pic.data[1], + s->cur_pic.linesize[1], s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); - s->mpvencdsp.draw_edges(s->cur_pic.f->data[2], - s->cur_pic.f->linesize[2], + s->mpvencdsp.draw_edges(s->cur_pic.data[2], + s->cur_pic.linesize[2], s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, @@ -2268,14 +2268,14 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, if (s->mv_dir & MV_DIR_FORWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, - s->last_pic.f->data, + s->last_pic.data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->qdsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, - s->next_pic.f->data, + s->next_pic.data, op_pix, op_qpix); } diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 3824832f9d..9c1872aa1b 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -93,8 +93,8 @@ void mpeg_motion_internal(MpegEncContext *s, ptrdiff_t uvlinesize, linesize; v_edge_pos = s->v_edge_pos >> field_based; - linesize = s->cur_pic.f->linesize[0] << field_based; - uvlinesize = s->cur_pic.f->linesize[1] << field_based; + linesize = s->cur_pic.linesize[0] << field_based; + uvlinesize = s->cur_pic.linesize[1] << field_based; block_y_half = (field_based | is_16x8); dxy = ((motion_y & 1) << 1) | (motion_x & 1); diff --git a/libavcodec/mpv_reconstruct_mb_template.c b/libavcodec/mpv_reconstruct_mb_template.c index febada041a..70dab76f73 100644 --- a/libavcodec/mpv_reconstruct_mb_template.c +++ b/libavcodec/mpv_reconstruct_mb_template.c @@ -82,8 +82,8 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], { uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; - const int linesize = s->cur_pic.f->linesize[0]; //not s->linesize as this would be wrong for field pics - const int uvlinesize = s->cur_pic.f->linesize[1]; + const int linesize = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics + const int uvlinesize = s->cur_pic.linesize[1]; const int readable = IS_ENCODER || lowres_flag || s->pict_type != AV_PICTURE_TYPE_B; const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8; @@ -137,11 +137,11 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], const h264_chroma_mc_func *op_pix = s->h264chroma.put_h264_chroma_pixels_tab; if (s->mv_dir & MV_DIR_FORWARD) { - MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.f->data, op_pix); + MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix); op_pix = s->h264chroma.avg_h264_chroma_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { - MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.f->data, op_pix); + MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix); } } else { op_pixels_func (*op_pix)[4]; @@ -155,12 +155,12 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], op_qpix = s->qdsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { - ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.f->data, op_pix, op_qpix); + ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->qdsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { - ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.f->data, op_pix, op_qpix); + ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix, op_qpix); } } diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 323f083f8f..f7ebb8ba89 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -282,10 +282,10 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, int bs = 8 >> s->avctx->lowres; if(n<4){ wrap= s->linesize; - dest = s->cur_pic.f->data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs; + dest = s->cur_pic.data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs; }else{ wrap= s->uvlinesize; - dest = s->cur_pic.f->data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs; + dest = s->cur_pic.data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs; } if(s->mb_x==0) a= (1024 + (scale>>1))/scale; else a= get_dc(dest-bs, wrap, scale*8>>(2*s->avctx->lowres), bs); diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 6a4b5aeb59..5d52744529 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -382,7 +382,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, MSS12Context *c = &ctx->c; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - AVFrame *f; + Picture *f; int ret; ff_mpeg_flush(avctx); @@ -431,7 +431,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_mpv_frame_end(s); - f = s->cur_pic.f; + f = &s->cur_pic; if (v->respic == 3) { ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h); diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 52140494bb..c75ab1800a 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -328,11 +328,11 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, s->m.avctx = s->avctx; s->m.cur_pic_ptr = &s->m.cur_pic; s->m.last_pic_ptr = &s->m.last_pic; - s->m.last_pic.f->data[0] = ref_plane; + s->m.last_pic.data[0] = ref_plane; s->m.linesize = - s->m.last_pic.f->linesize[0] = + s->m.last_pic.linesize[0] = s->m.new_pic->linesize[0] = - s->m.cur_pic.f->linesize[0] = stride; + s->m.cur_pic.linesize[0] = stride; s->m.width = width; s->m.height = height; s->m.mb_width = block_width; diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 6b5b1d0566..9cb9fd27bf 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -2948,7 +2948,7 @@ static void vc1_decode_skip_blocks(VC1Context *v) { MpegEncContext *s = &v->s; - if (!v->s.last_pic.f->data[0]) + if (!v->s.last_pic.data[0]) return; ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, ER_MB_END); @@ -2957,9 +2957,9 @@ static void vc1_decode_skip_blocks(VC1Context *v) s->mb_x = 0; init_block_index(v); update_block_index(s); - memcpy(s->dest[0], s->last_pic.f->data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); - memcpy(s->dest[1], s->last_pic.f->data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); - memcpy(s->dest[2], s->last_pic.f->data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); + memcpy(s->dest[0], s->last_pic.data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); + memcpy(s->dest[1], s->last_pic.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); + memcpy(s->dest[2], s->last_pic.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); s->first_slice_line = 0; } } diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index e24328569d..b60a48b38f 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -184,7 +184,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) if ((!v->field_mode || (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && - !v->s.last_pic.f->data[0]) + !v->s.last_pic.data[0]) return; linesize = s->cur_pic_ptr->f->linesize[0]; @@ -219,26 +219,26 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) } if (!dir) { if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { - srcY = s->cur_pic.f->data[0]; - srcU = s->cur_pic.f->data[1]; - srcV = s->cur_pic.f->data[2]; + srcY = s->cur_pic.data[0]; + srcU = s->cur_pic.data[1]; + srcV = s->cur_pic.data[2]; luty = v->curr_luty; lutuv = v->curr_lutuv; use_ic = *v->curr_use_ic; interlace = 1; } else { - srcY = s->last_pic.f->data[0]; - srcU = s->last_pic.f->data[1]; - srcV = s->last_pic.f->data[2]; + srcY = s->last_pic.data[0]; + srcU = s->last_pic.data[1]; + srcV = s->last_pic.data[2]; luty = v->last_luty; lutuv = v->last_lutuv; use_ic = v->last_use_ic; interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } } else { - srcY = s->next_pic.f->data[0]; - srcU = s->next_pic.f->data[1]; - srcV = s->next_pic.f->data[2]; + srcY = s->next_pic.data[0]; + srcU = s->next_pic.data[1]; + srcV = s->next_pic.data[2]; luty = v->next_luty; lutuv = v->next_lutuv; use_ic = v->next_use_ic; @@ -464,7 +464,7 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) if ((!v->field_mode || (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && - !v->s.last_pic.f->data[0]) + !v->s.last_pic.data[0]) return; linesize = s->cur_pic_ptr->f->linesize[0]; @@ -474,18 +474,18 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) if (!dir) { if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { - srcY = s->cur_pic.f->data[0]; + srcY = s->cur_pic.data[0]; luty = v->curr_luty; use_ic = *v->curr_use_ic; interlace = 1; } else { - srcY = s->last_pic.f->data[0]; + srcY = s->last_pic.data[0]; luty = v->last_luty; use_ic = v->last_use_ic; interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } } else { - srcY = s->next_pic.f->data[0]; + srcY = s->next_pic.data[0]; luty = v->next_luty; use_ic = v->next_use_ic; interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); @@ -645,7 +645,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) int interlace; int uvlinesize; - if (!v->field_mode && !v->s.last_pic.f->data[0]) + if (!v->field_mode && !v->s.last_pic.data[0]) return; if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; @@ -664,7 +664,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) int opp_count = get_luma_mv(v, dir, &tx, &ty); chroma_ref_type = v->cur_field_type ^ (opp_count > 2); } - if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_pic.f->data[0]) + if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_pic.data[0]) return; s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; @@ -698,21 +698,21 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) if (!dir) { if (v->field_mode && (v->cur_field_type != chroma_ref_type) && v->second_field) { - srcU = s->cur_pic.f->data[1]; - srcV = s->cur_pic.f->data[2]; + srcU = s->cur_pic.data[1]; + srcV = s->cur_pic.data[2]; lutuv = v->curr_lutuv; use_ic = *v->curr_use_ic; interlace = 1; } else { - srcU = s->last_pic.f->data[1]; - srcV = s->last_pic.f->data[2]; + srcU = s->last_pic.data[1]; + srcV = s->last_pic.data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } } else { - srcU = s->next_pic.f->data[1]; - srcV = s->next_pic.f->data[2]; + srcU = s->next_pic.data[1]; + srcV = s->next_pic.data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); @@ -880,14 +880,14 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) else uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); if (i < 2 ? dir : dir2) { - srcU = s->next_pic.f->data[1]; - srcV = s->next_pic.f->data[2]; + srcU = s->next_pic.data[1]; + srcV = s->next_pic.data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); } else { - srcU = s->last_pic.f->data[1]; - srcV = s->last_pic.f->data[2]; + srcU = s->last_pic.data[1]; + srcV = s->last_pic.data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); @@ -1012,7 +1012,7 @@ void ff_vc1_interp_mc(VC1Context *v) int interlace; int linesize, uvlinesize; - if (!v->field_mode && !v->s.next_pic.f->data[0]) + if (!v->field_mode && !v->s.next_pic.data[0]) return; linesize = s->cur_pic_ptr->f->linesize[0]; @@ -1030,9 +1030,9 @@ void ff_vc1_interp_mc(VC1Context *v) uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1)); } - srcY = s->next_pic.f->data[0]; - srcU = s->next_pic.f->data[1]; - srcV = s->next_pic.f->data[2]; + srcY = s->next_pic.data[0]; + srcU = s->next_pic.data[1]; + srcV = s->next_pic.data[2]; interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 93398e3fb2..d8d58bb7eb 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -235,15 +235,15 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) v->sprite_output_frame->linesize[plane] * row; for (sprite = 0; sprite <= v->two_sprites; sprite++) { - uint8_t *iplane = s->cur_pic.f->data[plane]; - int iline = s->cur_pic.f->linesize[plane]; + uint8_t *iplane = s->cur_pic.data[plane]; + int iline = s->cur_pic.linesize[plane]; int ycoord = yoff[sprite] + yadv[sprite] * row; int yline = ycoord >> 16; int next_line; ysub[sprite] = ycoord & 0xFFFF; if (sprite) { - iplane = s->last_pic.f->data[plane]; - iline = s->last_pic.f->linesize[plane]; + iplane = s->last_pic.data[plane]; + iline = s->last_pic.linesize[plane]; } next_line = FFMIN(yline + 1, (v->sprite_height >> !!plane) - 1) * iline; if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) { @@ -317,12 +317,12 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) if (ret < 0) return ret; - if (!s->cur_pic.f || !s->cur_pic.f->data[0]) { + if (!s->cur_pic.data[0]) { av_log(avctx, AV_LOG_ERROR, "Got no sprites\n"); return AVERROR_UNKNOWN; } - if (v->two_sprites && (!s->last_pic_ptr || !s->last_pic.f->data[0])) { + if (v->two_sprites && (!s->last_pic_ptr || !s->last_pic.data[0])) { av_log(avctx, AV_LOG_WARNING, "Need two sprites, only got one\n"); v->two_sprites = 0; } @@ -340,14 +340,14 @@ static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - AVFrame *f = s->cur_pic.f; + Picture *f = &s->cur_pic; int plane, i; /* Windows Media Image codecs have a convergence interval of two keyframes. Since we can't enforce it, clear to black the missing sprite. This is wrong but it looks better than doing nothing. */ - if (f && f->data[0]) + if (f->data[0]) for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY ? 1 : 3); plane++) for (i = 0; i < v->sprite_height>>!!plane; i++) memset(f->data[plane] + i * f->linesize[plane], @@ -1230,9 +1230,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, v->end_mb_x = s->mb_width; if (v->field_mode) { - s->cur_pic.f->linesize[0] <<= 1; - s->cur_pic.f->linesize[1] <<= 1; - s->cur_pic.f->linesize[2] <<= 1; + s->cur_pic.linesize[0] <<= 1; + s->cur_pic.linesize[1] <<= 1; + s->cur_pic.linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } @@ -1307,9 +1307,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } if (v->field_mode) { v->second_field = 0; - s->cur_pic.f->linesize[0] >>= 1; - s->cur_pic.f->linesize[1] >>= 1; - s->cur_pic.f->linesize[2] >>= 1; + s->cur_pic.linesize[0] >>= 1; + s->cur_pic.linesize[1] >>= 1; + s->cur_pic.linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { From patchwork Sat May 11 20:50:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48760 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298989pzb; Sat, 11 May 2024 13:56:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUKPpsYHVCyeRYZK8xRWyWV9vHrMJfUJuP/mSms8FH/BGf3tZqc+B/hsN6jRp/7Jd+1H6Hr5KawAtvawqKLW+vrm8IdKZgkrW0fXg== X-Google-Smtp-Source: AGHT+IEf3X4X3vMSpW3etqcB6bh43UliBRP95SVGHYeO2ectJ2blzcxkzKxnkSYaDPzDX4MN2fx8 X-Received: by 2002:a17:906:3b0d:b0:a52:6fe5:938b with SMTP id a640c23a62f3a-a5a11845848mr723795566b.26.1715461005334; Sat, 11 May 2024 13:56:45 -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 a640c23a62f3a-a5a17c2c0e5si367338166b.959.2024.05.11.13.56.44; Sat, 11 May 2024 13:56:45 -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=uDIEDK77; 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 F3A7568D706; Sat, 11 May 2024 23:54:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2024.outbound.protection.outlook.com [40.92.74.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 47AC668D6C8 for ; Sat, 11 May 2024 23:54:11 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WvyP3a7EyqIKqrT5/MT5MvECyht2fwGpxHETlGJC5cM1jNEblO8WXkgWoigBY4Ig2s4aDMr+buRgBEqICHRfOyxmcRSaBWfBd+eIzYBrZ8ZBS9GP+aUg29Dit7j9n49MBRO/d3YhbScuh2DyZ09LD/xviUAABOeiMfMLf3MTsi6gsZQD+OjNjIdYjs13WnhJ2wLB3jrUiadhuxGFzzNZoRkv8d4xXHDqMfon/HJZca0V+l1RoXjIUNgeP4m8oeNi711sp7uT6E+aVjAD+skuGajJexblbDj6iHcC0vudzoJyhGaqE15pIhSecMn2+OePnn5nffeZ2bL77tEW665BTA== 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=jfvQt8qvUyPQN6xquJ17v+G9+OouHUH786ogxIqXwyU=; b=exaAlv/KgDS7U2w+OlEAjhvTcMZSRwSHTG1ct7IMwPz2VaVhysw1aBMbJyd4Gq1BZkynBsQcaBEKYqcuEcOZx+Tr4ZodOyYzV6S/mYiyB/+wTHPeaqIR8wcalreWvKjsL28lGM2LVk1VnPXxESMr0sNAFcn2NRjQeAN2VQX0nbrEZ5X9FvNl+Mu377gwkfTXgh2GM/1O/SizBh1pVgFiOnJbDVLvQiGwtqo0dG8Kt04hS3zcJu4VnBh0eqAZCjvLRsazB7tSxCgGDLwvWYoiwiO352hCf/fud7d7Ty80u31c+QhNA0Gc2/HhNbwyd+OxnFbR1peCKbdVOc26e3dPGA== 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=jfvQt8qvUyPQN6xquJ17v+G9+OouHUH786ogxIqXwyU=; b=uDIEDK777vQHXYLTTuFRuJcXzRBiIUC7kuEkPD15sFUgi2u1mi2luKoQZ7E/zat9eVPknbPNTt9h4xmVhhVVl8wSpnJL4MQrNLCiGVIvLzNBPMNIRNRSzriyUI+1VHciz60/WNK5Fcd8QKORfhypt+fBw94NcvEtL0FmUvBFyij15Ft8Ae7ZkZm2psKkA7YbqiVoQHFob2mSUxgImJcJCIwcumasVR/FGcNs/9t78Xy1QpkeTbWHLQkheAbvgpY21Ld5dwez7062eeYnTQnPMU5JgJfgFLInpLKDd9Up/81CMMdysiLBN9niIXbDCCPv9DHcUJs1VtWXxWlNunvatA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:08 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:58 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [mBizMYQcfB6ytA7h7bPvYhO6GQ8lSBk850WqMJo42d0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-33-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 563f6d85-457c-4f6a-b5b4-08dc71fc80bb X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: KP5fnvog8zpocqJsm7q2hDFJS3vrYhznQ2NauQYyP9dXGhHX8ID8g0ltoaUIhDpCGnMlLBCb0aFEUqeL1wQrkwZYGVs1ea+zR2BsX+0W+scEQ6d+HObbuR7nIZJU37pNpKm1/RLFfs5b0yU8bvLgBIo0fIdgGj4XlN5XV+8ayZVq66gAfA5n4MLKHRkGpW/3PaFmaJbAaweXUkwD6MMpUeXbXptWykttjna7LDy+VU196E1qwr43+dDoebHQvfim0tox7XuQL6lQo4d3ocsXQ8DoYY8Bi3N/gLRkAHwy2kV/rF6/abozB05jUSiglYJ5WJ47oCivCgSMiuYQa55iIHbOCSFwq/Ji5BRyzxcQPOsZ5/LxXHe6QOFjfVbB2Nl4h9Reyi1ta7dVeUPowCnp3fP5f5a7BAmya5gUdw9AGxAaqgFTeAhKmItFXt5cZggJu5uia8wE+cfvyf0a8XARfT2xmgTmXZH8Pzbl361/pRnS+yXzJ3tMIhC9VCpnqYG1iS0iJel+KorEcLIR1A5Hfjz11vwCLe3HXJ4pxKN4oked134te3gLzskI+LFHt9rLIhIptP/Bu4DrQw0gO3zy8H4qzZvnJgIHQS/A4VdSB1BkOq6Tbzyu51BT3mRdj0Lk X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 460F050TEHZDby9uZt2vhTG/EDUC9R5QtlQLqZ+OQbNUygm8r0P+jZ2l8rUJaXmgRWURJv0dVq6curyYkb+B/bTJpIVp4MjBrC84Y8aAcSkey4uV9LqhQDfd6zVUgo4LqdRaisvpZFtOPqNhZ7l5UkUULhnZ+M9140kL14nPmpE+CqZh37bDd7VwM6je5M1dk7X2YoCZeanlpSveeT4TxklulYkhmhqqIGZaoyVtnn7rHO5DmXS5rMbACPpg3giTbY5FF3msYrxYxGj2EUptloCW8yEGXbC6wQTejhKwqubfPMaPurHQHFvVr7sJjL6h/sGQvrczu2sXs1U8z+T0NP5wjrHyDDnd/4vOYgXIZElE//76aZw7GO9W8kFjP8c1aUU7M1Mb0as8PGq28guqopUmgk+FNfFNehU2TCyaaLh1LfzC/nWsAEKHtXVizkeUDBcsmLXlLjyu1cPqz6DYZ60XNlSQlCa3mzcC8spTwdPk+KtP1OX/6ZbDlHvgNw3cxlw5uBdWDCOmxWLkqeKCO1DMnLmf8cQOMaIGkS1/L/1I1FIThoFFZnVUBuT4s8My6ZdO5TvrtCC8XzR+DW8ph1C51AwTrn0oj/I+C/0/EfcB5bOFfD0oqEp2jwa/a/UVsotFgYZShRNLctxODFPfzJolpMzN12/Agqn6VYLN9EtMFsxUY73tsH+t+bOGChM1B7PHT0oG34R7puh3zKDPHXddPPVclpZR75S/mUL2m96Fvz0YIFe+tM9uGAzDDYeAVSvQpsAQnoGrIe3hvbkdWNbfffw5SI2RVKTQf0ETzdPNLzgiUlYndpWzkJgGd+bSbBpxMSfP6ZmJliHoRMgxnbZtHkkzfuaPij3XpJsgf5lWsEYuH2a2BfgeNZ57hlZvSiw3jIkSt2+kacohU1/+GJ8QDm+Po2ZR3abDySMlRTgxT4DoP/U/Hs5S34h2/Mnsw6GR4e/RA1q8L1J/ctWzap/M7FlIP5gYhQ/Mnu7qE2h0SS8gMSsG0Nx4c6fNxCZNhZS5PbFywnRs00odYzdWooYGONfqdHoCR3HOeJ7pvFGVWKmRoIxRNvTBRwxoC5JMg7bEzX3T7YMZVaqY2/C9OO9fXjIxQnPKt4BjetFdkNf/r/xuureM13k6zJeAXK7+NnkgbrctuoYLmejBlAagO5rveL+bzkjH7pZ1sms9MZDq55gLK0kvv1AhR2xC5GONOLyA7EP7s0XFaEmmQ86I6kkyPVg56ObjwpDqv1oY6qarGKT8QXkSEA7VrXyQ2vNKajnEGYfLf6pAQnhArioj+g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 563f6d85-457c-4f6a-b5b4-08dc71fc80bb X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:08.7982 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 34/71] avcodec/rv30, rv34, rv40: Avoid indirection 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: o7yfYI+pE+Z7 Use the cached values from MpegEncContext.(cur|last|next)_pic instead of the corresponding *_pic_ptr. Also do the same in wmv2dec.c and mpegvideo_enc.c. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/rv30.c | 18 +++--- libavcodec/rv34.c | 122 +++++++++++++++++++------------------ libavcodec/rv40.c | 10 +-- libavcodec/wmv2dec.c | 7 +-- 5 files changed, 80 insertions(+), 79 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 2f6aaad1c7..f84a05d674 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2145,7 +2145,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, update_qscale(s); if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) { - s->qscale = s->cur_pic_ptr->qscale_table[mb_xy]; + s->qscale = s->cur_pic.qscale_table[mb_xy]; s->dquant = s->qscale - last_qp; if (s->out_format == FMT_H263) { diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c index a4e38edf54..9c8bb966e9 100644 --- a/libavcodec/rv30.c +++ b/libavcodec/rv30.c @@ -160,7 +160,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - int mbtype = s->cur_pic_ptr->mb_type[mb_pos]; + int mbtype = s->cur_pic.mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) @@ -172,11 +172,11 @@ static void rv30_loop_filter(RV34DecContext *r, int row) */ mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - cur_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos]]; + cur_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos]]; if(mb_x) - left_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos - 1]]; + left_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos - 1]]; for(j = 0; j < 16; j += 4){ - Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x; + Y = s->cur_pic.data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x; for(i = !mb_x; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; @@ -196,7 +196,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) if(mb_x) left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF; for(j = 0; j < 8; j += 4){ - C = s->cur_pic_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x; + C = s->cur_pic.data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x; for(i = !mb_x; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; @@ -214,11 +214,11 @@ static void rv30_loop_filter(RV34DecContext *r, int row) } mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - cur_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos]]; + cur_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos]]; if(row) - top_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos - s->mb_stride]]; + top_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos - s->mb_stride]]; for(j = 4*!row; j < 16; j += 4){ - Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize; + Y = s->cur_pic.data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; loc_lim = 0; @@ -238,7 +238,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) if(row) top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF; for(j = 4*!row; j < 8; j += 4){ - C = s->cur_pic_ptr->f->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize; + C = s->cur_pic.data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + (j >> 1); loc_lim = 0; diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 467a6ab5a1..941d983501 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -367,7 +367,7 @@ static int rv34_decode_intra_mb_header(RV34DecContext *r, int8_t *intra_types) r->is16 = get_bits1(gb); if(r->is16){ - s->cur_pic_ptr->mb_type[mb_pos] = MB_TYPE_INTRA16x16; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA16x16; r->block_type = RV34_MB_TYPE_INTRA16x16; t = get_bits(gb, 2); fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0])); @@ -377,7 +377,7 @@ static int rv34_decode_intra_mb_header(RV34DecContext *r, int8_t *intra_types) if(!get_bits1(gb)) av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n"); } - s->cur_pic_ptr->mb_type[mb_pos] = MB_TYPE_INTRA; + s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA; r->block_type = RV34_MB_TYPE_INTRA; if(r->decode_intra_types(r, gb, intra_types) < 0) return -1; @@ -403,7 +403,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) r->block_type = r->decode_mb_info(r); if(r->block_type == -1) return -1; - s->cur_pic_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type]; + s->cur_pic.mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type]; r->mb_type[mb_pos] = r->block_type; if(r->block_type == RV34_MB_SKIP){ if(s->pict_type == AV_PICTURE_TYPE_P) @@ -411,7 +411,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) if(s->pict_type == AV_PICTURE_TYPE_B) r->mb_type[mb_pos] = RV34_MB_B_DIRECT; } - r->is16 = !!IS_INTRA16x16(s->cur_pic_ptr->mb_type[mb_pos]); + r->is16 = !!IS_INTRA16x16(s->cur_pic.mb_type[mb_pos]); if (rv34_decode_mv(r, r->block_type) < 0) return -1; if(r->block_type == RV34_MB_SKIP){ @@ -421,7 +421,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) r->chroma_vlc = 1; r->luma_vlc = 0; - if(IS_INTRA(s->cur_pic_ptr->mb_type[mb_pos])){ + if (IS_INTRA(s->cur_pic.mb_type[mb_pos])) { if(r->is16){ t = get_bits(gb, 2); fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0])); @@ -480,33 +480,34 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int int mx, my; int* avail = r->avail_cache + avail_indexes[subblock_no]; int c_off = part_sizes_w[block_type]; + int16_t (*motion_val)[2] = s->cur_pic.motion_val[0]; mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->b8_stride; if(subblock_no == 3) c_off = -1; if(avail[-1]){ - A[0] = s->cur_pic_ptr->motion_val[0][mv_pos-1][0]; - A[1] = s->cur_pic_ptr->motion_val[0][mv_pos-1][1]; + A[0] = motion_val[mv_pos-1][0]; + A[1] = motion_val[mv_pos-1][1]; } if(avail[-4]){ - B[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride][0]; - B[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride][1]; + B[0] = motion_val[mv_pos-s->b8_stride][0]; + B[1] = motion_val[mv_pos-s->b8_stride][1]; }else{ B[0] = A[0]; B[1] = A[1]; } if(!avail[c_off-4]){ if(avail[-4] && (avail[-1] || r->rv30)){ - C[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride-1][0]; - C[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride-1][1]; + C[0] = motion_val[mv_pos-s->b8_stride-1][0]; + C[1] = motion_val[mv_pos-s->b8_stride-1][1]; }else{ C[0] = A[0]; C[1] = A[1]; } }else{ - C[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][0]; - C[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][1]; + C[0] = motion_val[mv_pos-s->b8_stride+c_off][0]; + C[1] = motion_val[mv_pos-s->b8_stride+c_off][1]; } mx = mid_pred(A[0], B[0], C[0]); my = mid_pred(A[1], B[1], C[1]); @@ -514,8 +515,8 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int my += r->dmv[dmv_no][1]; for(j = 0; j < part_sizes_h[block_type]; j++){ for(i = 0; i < part_sizes_w[block_type]; i++){ - s->cur_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx; - s->cur_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my; + motion_val[mv_pos + i + j*s->b8_stride][0] = mx; + motion_val[mv_pos + i + j*s->b8_stride][1] = my; } } } @@ -564,7 +565,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) int has_A = 0, has_B = 0, has_C = 0; int mx, my; int i, j; - Picture *cur_pic = s->cur_pic_ptr; + Picture *cur_pic = &s->cur_pic; const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0; int type = cur_pic->mb_type[mb_pos]; @@ -617,27 +618,27 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) int* avail = r->avail_cache + avail_indexes[0]; if(avail[-1]){ - A[0] = s->cur_pic_ptr->motion_val[0][mv_pos - 1][0]; - A[1] = s->cur_pic_ptr->motion_val[0][mv_pos - 1][1]; + A[0] = s->cur_pic.motion_val[0][mv_pos - 1][0]; + A[1] = s->cur_pic.motion_val[0][mv_pos - 1][1]; } if(avail[-4]){ - B[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride][0]; - B[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride][1]; + B[0] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride][0]; + B[1] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride][1]; }else{ B[0] = A[0]; B[1] = A[1]; } if(!avail[-4 + 2]){ if(avail[-4] && (avail[-1])){ - C[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride - 1][0]; - C[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride - 1][1]; + C[0] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride - 1][0]; + C[1] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride - 1][1]; }else{ C[0] = A[0]; C[1] = A[1]; } }else{ - C[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride + 2][0]; - C[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride + 2][1]; + C[0] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride + 2][0]; + C[1] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride + 2][1]; } mx = mid_pred(A[0], B[0], C[0]); my = mid_pred(A[1], B[1], C[1]); @@ -646,8 +647,8 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) for(j = 0; j < 2; j++){ for(i = 0; i < 2; i++){ for(k = 0; k < 2; k++){ - s->cur_pic_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx; - s->cur_pic_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my; + s->cur_pic.motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx; + s->cur_pic.motion_val[k][mv_pos + i + j*s->b8_stride][1] = my; } } } @@ -683,27 +684,28 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; int is16x16 = 1; int emu = 0; + int16_t *motion_val = s->cur_pic.motion_val[dir][mv_pos]; if(thirdpel){ int chroma_mx, chroma_my; - mx = (s->cur_pic_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); - my = (s->cur_pic_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); - lx = (s->cur_pic_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; - ly = (s->cur_pic_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; - chroma_mx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] / 2; - chroma_my = s->cur_pic_ptr->motion_val[dir][mv_pos][1] / 2; + mx = (motion_val[0] + (3 << 24)) / 3 - (1 << 24); + my = (motion_val[1] + (3 << 24)) / 3 - (1 << 24); + lx = (motion_val[0] + (3 << 24)) % 3; + ly = (motion_val[1] + (3 << 24)) % 3; + chroma_mx = motion_val[0] / 2; + chroma_my = motion_val[1] / 2; umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24); umy = (chroma_my + (3 << 24)) / 3 - (1 << 24); uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3]; uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3]; }else{ int cx, cy; - mx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] >> 2; - my = s->cur_pic_ptr->motion_val[dir][mv_pos][1] >> 2; - lx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] & 3; - ly = s->cur_pic_ptr->motion_val[dir][mv_pos][1] & 3; - cx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] / 2; - cy = s->cur_pic_ptr->motion_val[dir][mv_pos][1] / 2; + mx = motion_val[0] >> 2; + my = motion_val[1] >> 2; + lx = motion_val[0] & 3; + ly = motion_val[1] & 3; + cx = motion_val[0] / 2; + cy = motion_val[1] / 2; umx = cx >> 2; umy = cy >> 2; uvmx = (cx & 3) << 1; @@ -721,9 +723,9 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, } dxy = ly*4 + lx; - srcY = dir ? s->next_pic_ptr->f->data[0] : s->last_pic_ptr->f->data[0]; - srcU = dir ? s->next_pic_ptr->f->data[1] : s->last_pic_ptr->f->data[1]; - srcV = dir ? s->next_pic_ptr->f->data[2] : s->last_pic_ptr->f->data[2]; + srcY = dir ? s->next_pic.data[0] : s->last_pic.data[0]; + srcU = dir ? s->next_pic.data[1] : s->last_pic.data[1]; + srcV = dir ? s->next_pic.data[2] : s->last_pic.data[2]; src_x = s->mb_x * 16 + xoff + mx; src_y = s->mb_y * 16 + yoff + my; uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx; @@ -884,11 +886,11 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) switch(block_type){ case RV34_MB_TYPE_INTRA: case RV34_MB_TYPE_INTRA16x16: - ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); return 0; case RV34_MB_SKIP: if(s->pict_type == AV_PICTURE_TYPE_P){ - ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0); break; } @@ -898,21 +900,21 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_await_progress(&s->next_pic_ptr->tf, FFMAX(0, s->mb_y-1), 0); - next_bt = s->next_pic_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride]; + next_bt = s->next_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride]; if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){ - ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); - ZERO8x2(s->cur_pic_ptr->motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic.motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); }else for(j = 0; j < 2; j++) for(i = 0; i < 2; i++) for(k = 0; k < 2; k++) for(l = 0; l < 2; l++) - s->cur_pic_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]); + s->cur_pic.motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_pic.motion_val[0][mv_pos + i + j*s->b8_stride][k]); if(!(IS_16X8(next_bt) || IS_8X16(next_bt) || IS_8X8(next_bt))) //we can use whole macroblock MC rv34_mc_2mv(r, block_type); else rv34_mc_2mv_skip(r); - ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); + ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride); break; case RV34_MB_P_16x16: case RV34_MB_P_MIX16x16: @@ -1180,7 +1182,7 @@ static int rv34_set_deblock_coef(RV34DecContext *r) MpegEncContext *s = &r->s; int hmvmask = 0, vmvmask = 0, i, j; int midx = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride; - int16_t (*motion_val)[2] = &s->cur_pic_ptr->motion_val[0][midx]; + int16_t (*motion_val)[2] = &s->cur_pic.motion_val[0][midx]; for(j = 0; j < 16; j += 8){ for(i = 0; i < 2; i++){ if(is_mv_diff_gt_3(motion_val + i, 1)) @@ -1223,26 +1225,26 @@ static int rv34_decode_inter_macroblock(RV34DecContext *r, int8_t *intra_types) dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width; if(s->mb_x && dist) r->avail_cache[5] = - r->avail_cache[9] = s->cur_pic_ptr->mb_type[mb_pos - 1]; + r->avail_cache[9] = s->cur_pic.mb_type[mb_pos - 1]; if(dist >= s->mb_width) r->avail_cache[2] = - r->avail_cache[3] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride]; + r->avail_cache[3] = s->cur_pic.mb_type[mb_pos - s->mb_stride]; if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1) - r->avail_cache[4] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride + 1]; + r->avail_cache[4] = s->cur_pic.mb_type[mb_pos - s->mb_stride + 1]; if(s->mb_x && dist > s->mb_width) - r->avail_cache[1] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride - 1]; + r->avail_cache[1] = s->cur_pic.mb_type[mb_pos - s->mb_stride - 1]; s->qscale = r->si.quant; cbp = cbp2 = rv34_decode_inter_mb_header(r, intra_types); r->cbp_luma [mb_pos] = cbp; r->cbp_chroma[mb_pos] = cbp >> 16; r->deblock_coefs[mb_pos] = rv34_set_deblock_coef(r) | r->cbp_luma[mb_pos]; - s->cur_pic_ptr->qscale_table[mb_pos] = s->qscale; + s->cur_pic.qscale_table[mb_pos] = s->qscale; if(cbp == -1) return -1; - if (IS_INTRA(s->cur_pic_ptr->mb_type[mb_pos])){ + if (IS_INTRA(s->cur_pic.mb_type[mb_pos])) { if(r->is16) rv34_output_i16x16(r, intra_types, cbp); else rv34_output_intra(r, intra_types, cbp); return 0; @@ -1325,21 +1327,21 @@ static int rv34_decode_intra_macroblock(RV34DecContext *r, int8_t *intra_types) dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width; if(s->mb_x && dist) r->avail_cache[5] = - r->avail_cache[9] = s->cur_pic_ptr->mb_type[mb_pos - 1]; + r->avail_cache[9] = s->cur_pic.mb_type[mb_pos - 1]; if(dist >= s->mb_width) r->avail_cache[2] = - r->avail_cache[3] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride]; + r->avail_cache[3] = s->cur_pic.mb_type[mb_pos - s->mb_stride]; if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1) - r->avail_cache[4] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride + 1]; + r->avail_cache[4] = s->cur_pic.mb_type[mb_pos - s->mb_stride + 1]; if(s->mb_x && dist > s->mb_width) - r->avail_cache[1] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride - 1]; + r->avail_cache[1] = s->cur_pic.mb_type[mb_pos - s->mb_stride - 1]; s->qscale = r->si.quant; cbp = rv34_decode_intra_mb_header(r, intra_types); r->cbp_luma [mb_pos] = cbp; r->cbp_chroma[mb_pos] = cbp >> 16; r->deblock_coefs[mb_pos] = 0xFFFF; - s->cur_pic_ptr->qscale_table[mb_pos] = s->qscale; + s->cur_pic.qscale_table[mb_pos] = s->qscale; if(cbp == -1) return -1; diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index a98e64f5bf..536bbc9623 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -371,7 +371,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ - int mbtype = s->cur_pic_ptr->mb_type[mb_pos]; + int mbtype = s->cur_pic.mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) @@ -386,7 +386,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) unsigned y_to_deblock; int c_to_deblock[2]; - q = s->cur_pic_ptr->qscale_table[mb_pos]; + q = s->cur_pic.qscale_table[mb_pos]; alpha = rv40_alpha_tab[q]; beta = rv40_beta_tab [q]; betaY = betaC = beta * 3; @@ -401,7 +401,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) if(avail[i]){ int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride; mvmasks[i] = r->deblock_coefs[pos]; - mbtype [i] = s->cur_pic_ptr->mb_type[pos]; + mbtype [i] = s->cur_pic.mb_type[pos]; cbp [i] = r->cbp_luma[pos]; uvcbp[i][0] = r->cbp_chroma[pos] & 0xF; uvcbp[i][1] = r->cbp_chroma[pos] >> 4; @@ -460,7 +460,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) } for(j = 0; j < 16; j += 4){ - Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize; + Y = s->cur_pic.data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0; @@ -505,7 +505,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) } for(k = 0; k < 2; k++){ for(j = 0; j < 2; j++){ - C = s->cur_pic_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize; + C = s->cur_pic.data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + j*2; int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0; diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 61e1759449..432d6f7223 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -103,7 +103,7 @@ static int parse_mb_skip(WMV2DecContext *w) int mb_x, mb_y; int coded_mb_count = 0; MpegEncContext *const s = &w->s; - uint32_t *const mb_type = s->cur_pic_ptr->mb_type; + uint32_t *const mb_type = s->cur_pic.mb_type; w->skip_type = get_bits(&s->gb, 2); switch (w->skip_type) { @@ -238,9 +238,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) if (s->pict_type == AV_PICTURE_TYPE_I) { /* Is filling with zeroes really the right thing to do? */ - memset(s->cur_pic_ptr->mb_type, 0, - sizeof(*s->cur_pic_ptr->mb_type) * - s->mb_height * s->mb_stride); + memset(s->cur_pic.mb_type, 0, + sizeof(*s->cur_pic.mb_type) * s->mb_height * s->mb_stride); if (w->j_type_bit) w->j_type = get_bits1(&s->gb); else From patchwork Sat May 11 20:50:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48761 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299019pzb; Sat, 11 May 2024 13:56:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWbA4Dng4llJjUn9FKorKwnrfR+cM/Pjn8GZg0au6XEAvoX64G3vm8sLoPqcjcgRfn9oV5FxW7w232MjTScmv16+p2pVE8cJQAE1g== X-Google-Smtp-Source: AGHT+IF4E2AKN79a20VNZ65zAelRNpOyP9rRX5iBEpgqEPAMs+kqtrK72BdFiN1eW+8RCWo4ir8p X-Received: by 2002:a2e:86d0:0:b0:2e5:2aa1:a76a with SMTP id 38308e7fff4ca-2e52aa1aa26mr32968641fa.5.1715461015500; Sat, 11 May 2024 13:56:55 -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 38308e7fff4ca-2e4d1519321si18858811fa.322.2024.05.11.13.56.54; Sat, 11 May 2024 13:56:55 -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=u90+sJvn; 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 2E5C268D68D; Sat, 11 May 2024 23:54:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2024.outbound.protection.outlook.com [40.92.74.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A213668D6C8 for ; Sat, 11 May 2024 23:54:16 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PRdxWw+HWxledK2/g1EvpJeHcORLLaoxHF4Uy064TmQhFM8v5C3yc5vY3W7asVJASYLmPptChcz8OKq2W2tRLjvaBkCIWgJWI2vdiPScYWKlDro7470QBX9SRKPVyZx1QeV5v1+i96MlboNWqIV6uYTotpDaODrXh/CfUPbskNGIXt6o+RKeNMJBPfar5oqRTtN9OAeLg1KAE57F7ohN/E2CthjmZ9UTEi9VpoO/k6CXKJfFk9qk+/DM3ICH6Uztdbti1O2wg4eXRVHQUsW2qFfzp3VlZ284xXP031Ei3cZdY7hKlaVu4LUi4SlufntLElbEb3IFhaI4i3V8Cir+mA== 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=O3S9iQOUMLmoRWkuOZ3uV0TTHD2xW7VOIeiVPuunh38=; b=QJYSeXb0GjmSqo3X2rPu9/jCnHpWUGX8YVOyaMiqdSayTAI3FqhzprgImp23zlQ3rWyDTf4yzXtkwMEoTOOHYhfI/ssX5Fu96bX8198dzIHX8Xrxa6jGeVMZUlelF9rMbGiPfKIdYR8so57DmGuB3iybRPzO3sO8TfzEae/cGB2CB6Tb2TZWNrsfQ7Z1VHjSBdQkMdqUJ6+YiHKIPx8Pv+fFldazV7c/BDoyFZ5rYICxmLv713MuWhSluhUrf1g7t8pnayRs1qPdOgz1JUYEaU8byiKQTfX5+i4+4xEbhsXQQn+iptTIxD9HmmtkJMUH5u0T1yMHMRIS97jTHZhTpQ== 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=O3S9iQOUMLmoRWkuOZ3uV0TTHD2xW7VOIeiVPuunh38=; b=u90+sJvnBCPKmhGkFNybKJffQqhR1sLG771bSMkAzoRP/wC7yyZvpLzxJ/z/i8DUWrbf+k1MYg6v5idxU/gnEAeTvZEs2Wx8VIcX+OojHWC9Yo9amWt5sx1eidCK/YTjSFnD5Bk8klR6QrlQGSVdJx/+jnmrySBzXeTVgiOQgqJYNiZQqFeKB/9EHIiAcGxUmkWjn5VfbML6xyOzJm91e4V6+8hfelTaxj5eFKWS/LyW5ef31rl0tE7HkIoLcgi2p6Ns4M3I/W7QdZH3Rm/UBCmuFbzlNw/6UnB8yxjavod9e07vUvW5Wkx5AQlUtXYUbHUqOtSAFuX8GVLYvSXLsg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:11 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:59 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [0mImb+jI54btDLZhAZGHiVqgVbphy5o8M7VeK1e+UBA=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-34-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: f08db4d2-8d20-4f31-3bc2-08dc71fc8266 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: tnKGl7GVNylwqMcbG1wOjhBHg2TSvmpvle/7BU0O+NbFMNJPGh+u60zNYQCeNHOa46ca5HNpy1BeoD6NZL8keDIGSo6eSnr6JL8QwcdjT+gTlDVGjNZ1i7scXuNub2QvGmWkZYYsOOZ5ubCuc13AC1qQMc+ZyhL3/9WRT+KjBEc46wq+8t4rGfS6mhnBulaGJCetYOTPeCyq95aZJzr1QXDi8wlVNRrzbgwVF+CFu6WMKLPkGAdMWHyb7IuJS3IJRR/CEklcu7inomjeQSE9V0pQXdiKvVkPBMGbWS+yu5LKaZY6C/C5Xifg/YPyMpdCwCiDVnA7IEN+zqytqWji0Ah3RqU2l423aDUmWtuJV58TR+2sPfdxiD3UH4VwPp3qPrl+bJFwo50LRjA7ZDMIuyemWx7KRuUJT+d4Vc+QdcjxiQI0c78EtXo6tZGXVajo8b035//+c4ZAEkahX6cj+DPil6uydCis+KF5scoZJwr830FXDNIzyZ/3CM1Rsv8nPzpDmnUOxWSiE5T2GLtlellBS1lKb2cfqbPT9Oyujg2s3jpq3Rar2AsdA4edyxeIsOrxcE5wf4y6Uxzk3DCubpUG23ecFkqjhnvO6WiFwOuMCvXK2YRn3caaR8O/TsMs X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: whxNcVBsy30QJeMwSGffgeVPd6HTNO9Z1Iv3tVt7+3C84VeO5Ms4ZCQLkkj4zmgSd5Vc1mI9WC9h1oDY2Hrd2SI5LSXlwiEMY9nCuK7RZgkaiErTSej7MOH4BaNzdb3gRZek7bm1z7fdlwuFalG6LPzYbmpkK+ADXMmin/4o/PAlbtpR+Tet4HtMCy0qWmjthtUMyfV0pWCirunMCApiaBfbF+xMA1ewHvpOOWkaYAxViSXl8itSsjuGS1nvBkKPs7mtWPabfQf5LLfXx/G8J+60xTAqsSUBScpB3isMeWz17WlWlBX4nMenLy3WTDjUlf7d8C/43ggYYdSTDKlbna/JIKFx5FMOxyKCxL+omzZc7L/bsVvZ/AJFiWOwIyES2ievCJt1y07dcaBcd+cR2M02c8ehFfzca3qGNqumbbTuXRsWXBEExOzbgcOX/HEFzKcTOmbg41jszXgrKRF3yQjVfihgEwfWvn+8YZnbQZSY5LGEif8hKXUwpUG2q2HIkmHH9M9gO0ykjDnlXwGZA7lBXlxrvUUMUo1oHDJmFt/PzStC1BKnEUP2dLN4aWbvourqIq26nXwM9f/kHN1kksvAqiJdNaet/eBya8PSEHyPOOH1E9+H9TRQnNNUWus0Xz+EWhBwY9i03tyBuKATKpV1bZ6rFMjWsEgl7mx3L16G+iicQjaAId18qO1WH1zjtgqzHu9hTFStDHG7BuWxomzZN/LVP8XyVbD1yqHg1ooPQc3UcBmK14wr9iLx+HcZIxIOT6+u4n4xQEhCRUSnE8uWH0vCnMn0QFMj+u6f82jfxfUJ/6eJ9iq9yZfzz2mF/RmvR641uv6hLboE2bM2uV2tYHt2kHis0hYWDqsUvmMWlvypbbp6B/dWuHfxD2PGv06i55UXqFGyhrLpKwyXdlkdKLFrP+hzLfD9ZK1MlVuLC++v4JdvEHTP0Xjc8kTq+RVU+XS5/AA69vYrO1vO5hHtnhnTjEr2tUYSzp9gdo8p+BukwU38G2O7b65oMcgMBMdr2V1x4F9VoIEv8ZJpwGMpj6aP0R4Y9aazmINAFW12o7Xrk00a4kJBqwB77FKBBjO1qmQlc2jhiT1HrrJWsVJD3QNU1RhwRint93HLA3/3IlC0jWK7ifhDY9xV8m7XG7uNtI6RQkdqP3cNnV9RJe6emmPvOX6BHXIKgmYPb+kr53vDPCxgyFRVaJw5zxcevv6BjZyRF6nyJKyEjmwnRJnEikqhN4sKN6DRVds7sd2+vYoHWj0VsBCEydJeD3sTLZdHPrhnkU66T71SSOCeHQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f08db4d2-8d20-4f31-3bc2-08dc71fc8266 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:11.6148 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 35/71] avcodec/mpegvideo: Add 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: 9Dx2cmnxXq25 Specifically, add const to the pointed-to-type of pointers that point to something static or that belong to last_pic or next_pic (because modifying these might lead to data races). Signed-off-by: Andreas Rheinhardt --- libavcodec/h261dec.c | 2 +- libavcodec/h261enc.c | 2 +- libavcodec/ituh263dec.c | 6 ++-- libavcodec/ituh263enc.c | 2 +- libavcodec/mpeg12dec.c | 6 ++-- libavcodec/mpeg12enc.c | 8 ++--- libavcodec/mpeg4videodec.c | 9 +++--- libavcodec/mpeg4videoenc.c | 32 ++++++++++---------- libavcodec/mpeg_er.c | 2 +- libavcodec/mpegvideo.h | 4 +-- libavcodec/mpegvideo_enc.c | 6 ++-- libavcodec/mpegvideo_motion.c | 32 ++++++++++---------- libavcodec/mpegvideoenc.h | 2 +- libavcodec/mpv_reconstruct_mb_template.c | 4 +-- libavcodec/msmpeg4dec.c | 6 ++-- libavcodec/ratecontrol.c | 22 +++++++------- libavcodec/rv34.c | 3 +- libavcodec/vc1_loopfilter.c | 26 +++++++++------- libavcodec/vc1_mc.c | 16 +++++----- libavcodec/vc1_pred.c | 38 +++++++++++------------- libavcodec/vc1dec.c | 6 ++-- libavcodec/wmv2.c | 3 +- libavcodec/wmv2.h | 3 +- 23 files changed, 123 insertions(+), 117 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 77aa08687d..00edd7a7c2 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -281,7 +281,7 @@ static int h261_decode_block(H261DecContext *h, int16_t *block, int n, int coded { MpegEncContext *const s = &h->s; int level, i, j, run; - RLTable *rl = &ff_h261_rl_tcoeff; + const RLTable *rl = &ff_h261_rl_tcoeff; const uint8_t *scan_table; /* For the variable length encoding there are two code tables, one being diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index 20dd296711..01bce533a0 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -167,7 +167,7 @@ static void h261_encode_block(H261EncContext *h, int16_t *block, int n) { MpegEncContext *const s = &h->s; int level, run, i, j, last_index, last_non_zero, sign, slevel, code; - RLTable *rl; + const RLTable *rl; rl = &ff_h261_rl_tcoeff; if (s->mb_intra) { diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 9358363ed8..492cb5e0d4 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -534,7 +534,7 @@ static int h263_decode_block(MpegEncContext * s, int16_t * block, int n, int coded) { int level, i, j, run; - RLTable *rl = &ff_h263_rl_inter; + const RLTable *rl = &ff_h263_rl_inter; const uint8_t *scan_table; GetBitContext gb= s->gb; @@ -719,7 +719,7 @@ static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb) #define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0])) #define tab_bias (tab_size / 2) -static inline void set_one_direct_mv(MpegEncContext *s, Picture *p, int i) +static inline void set_one_direct_mv(MpegEncContext *s, const Picture *p, int i) { int xy = s->block_index[i]; uint16_t time_pp = s->pp_time; @@ -750,7 +750,7 @@ static inline void set_one_direct_mv(MpegEncContext *s, Picture *p, int i) static int set_direct_mv(MpegEncContext *s) { const int mb_index = s->mb_x + s->mb_y * s->mb_stride; - Picture *p = &s->next_pic; + const Picture *p = &s->next_pic; int colocated_mb_type = p->mb_type[mb_index]; int i; diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index bcb230871e..b7c9f124a9 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -305,7 +305,7 @@ static const int dquant_code[5]= {1,0,9,2,3}; static void h263_encode_block(MpegEncContext * s, int16_t * block, int n) { int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code; - RLTable *rl; + const RLTable *rl; rl = &ff_h263_rl_inter; if (s->mb_intra && !s->h263_aic) { diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index c04d351e0c..6877b9ef4a 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -160,7 +160,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, int16_t *block, int n) { int level, i, j, run; - uint8_t *const scantable = s->intra_scantable.permutated; + const uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix = s->inter_matrix; const int qscale = s->qscale; @@ -244,7 +244,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, int16_t *block, int n) { int level, i, j, run; - uint8_t *const scantable = s->intra_scantable.permutated; + const uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; int mismatch; @@ -331,7 +331,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, int level, dc, diff, i, j, run; int component; const RL_VLC_ELEM *rl_vlc; - uint8_t *const scantable = s->intra_scantable.permutated; + const uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; int mismatch; diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index bd95451b68..42ff92cb16 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -470,7 +470,7 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s) void ff_mpeg1_encode_picture_header(MpegEncContext *s) { MPEG12EncContext *const mpeg12 = (MPEG12EncContext*)s; - AVFrameSideData *side_data; + const AVFrameSideData *side_data; mpeg1_encode_sequence_header(s); /* MPEG-1 picture header */ @@ -557,7 +557,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) side_data = av_frame_get_side_data(s->cur_pic_ptr->f, AV_FRAME_DATA_STEREO3D); if (side_data) { - AVStereo3D *stereo = (AVStereo3D *)side_data->data; + const AVStereo3D *stereo = (AVStereo3D *)side_data->data; uint8_t fpa_type; switch (stereo->type) { @@ -711,7 +711,7 @@ static inline void encode_dc(MpegEncContext *s, int diff, int component) } } -static void mpeg1_encode_block(MpegEncContext *s, int16_t *block, int n) +static void mpeg1_encode_block(MpegEncContext *s, const int16_t *block, int n) { int alevel, level, last_non_zero, dc, diff, i, j, run, last_index, sign; int code, component; @@ -793,7 +793,7 @@ next_coef: } static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, - int16_t block[8][64], + const int16_t block[8][64], int motion_x, int motion_y, int mb_block_count, int chroma_y_shift) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 8659ec0376..8f2e03414b 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1292,8 +1292,8 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, MpegEncContext *s = &ctx->m; int level, i, last, run, qmul, qadd; int av_uninit(dc_pred_dir); - RLTable *rl; - RL_VLC_ELEM *rl_vlc; + const RLTable *rl; + const RL_VLC_ELEM *rl_vlc; const uint8_t *scan_table; // Note intra & rvlc should be optimized away if this is inlined @@ -1651,7 +1651,6 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) { Mpeg4DecContext *ctx = s->avctx->priv_data; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; - int16_t *mot_val; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; const int xy = s->mb_x + s->mb_y * s->mb_stride; int next; @@ -1782,7 +1781,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->cur_pic.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; s->mv_type = MV_TYPE_8X8; for (i = 0; i < 4; i++) { - mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); + int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); mx = ff_h263_decode_motion(s, pred_x, s->f_code); if (mx >= 0xffff) return AVERROR_INVALIDDATA; @@ -2075,7 +2074,7 @@ static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0, additional_code_len, sign, mismatch; const VLCElem *cur_vlc = studio_intra_tab[0]; - uint8_t *const scantable = s->intra_scantable.permutated; + const uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; uint32_t flc; const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6)); diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 87b12413ab..c5b5b3ea50 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -71,7 +71,7 @@ static uint8_t uni_mpeg4_inter_rl_len[64 * 64 * 2 * 2]; * @param[in] block_last_index last index in scantable order that refers to a non zero element in block. */ static inline int get_block_rate(MpegEncContext *s, int16_t block[64], - int block_last_index, uint8_t scantable[64]) + int block_last_index, const uint8_t scantable[64]) { int last = 0; int j; @@ -106,7 +106,7 @@ static inline int get_block_rate(MpegEncContext *s, int16_t block[64], * @param[in] zigzag_last_index index referring to the last non zero coefficient in zigzag order */ static inline void restore_ac_coeffs(MpegEncContext *s, int16_t block[6][64], - const int dir[6], uint8_t *st[6], + const int dir[6], const uint8_t *st[6], const int zigzag_last_index[6]) { int i, n; @@ -137,12 +137,12 @@ static inline void restore_ac_coeffs(MpegEncContext *s, int16_t block[6][64], * @param[out] zigzag_last_index index referring to the last non zero coefficient in zigzag order */ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], - const int dir[6], uint8_t *st[6], + const int dir[6], const uint8_t *st[6], int zigzag_last_index[6]) { int score = 0; int i, n; - int8_t *const qscale_table = s->cur_pic.qscale_table; + const int8_t *const qscale_table = s->cur_pic.qscale_table; memcpy(zigzag_last_index, s->block_last_index, sizeof(int) * 6); @@ -288,14 +288,14 @@ static inline int mpeg4_get_dc_length(int level, int n) * Encode an 8x8 block. * @param n block index (0-3 are luma, 4-5 are chroma) */ -static inline void mpeg4_encode_block(MpegEncContext *s, - int16_t *block, int n, int intra_dc, - uint8_t *scan_table, PutBitContext *dc_pb, +static inline void mpeg4_encode_block(const MpegEncContext *s, + const int16_t *block, int n, int intra_dc, + const uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb) { int i, last_non_zero; - uint32_t *bits_tab; - uint8_t *len_tab; + const uint32_t *bits_tab; + const uint8_t *len_tab; const int last_index = s->block_last_index[n]; if (s->mb_intra) { // Note gcc (3.2.1 at least) will optimize this away @@ -350,11 +350,11 @@ static inline void mpeg4_encode_block(MpegEncContext *s, } static int mpeg4_get_block_length(MpegEncContext *s, - int16_t *block, int n, - int intra_dc, uint8_t *scan_table) + const int16_t *block, int n, + int intra_dc, const uint8_t *scan_table) { int i, last_non_zero; - uint8_t *len_tab; + const uint8_t *len_tab; const int last_index = s->block_last_index[n]; int len = 0; @@ -403,8 +403,10 @@ static int mpeg4_get_block_length(MpegEncContext *s, return len; } -static inline void mpeg4_encode_blocks(MpegEncContext *s, int16_t block[6][64], - int intra_dc[6], uint8_t **scan_table, +static inline void mpeg4_encode_blocks(MpegEncContext *s, + const int16_t block[6][64], + const int intra_dc[6], + const uint8_t * const *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb) { @@ -796,7 +798,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], int dc_diff[6]; // dc values with the dc prediction subtracted int dir[6]; // prediction direction int zigzag_last_index[6]; - uint8_t *scan_table[6]; + const uint8_t *scan_table[6]; int i; for (i = 0; i < 6; i++) diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index 8d8b2aea92..360f3ce3e0 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -22,7 +22,7 @@ #include "mpegvideodec.h" #include "mpeg_er.h" -static void set_erpic(ERPicture *dst, Picture *src) +static void set_erpic(ERPicture *dst, const Picture *src) { int i; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 62550027a7..3150f337c0 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -595,8 +595,8 @@ void ff_mpv_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], - qpel_mc_func (*qpix_op)[16]); + const op_pixels_func (*pix_op)[4], + const qpel_mc_func (*qpix_op)[16]); static inline void ff_update_block_index(MpegEncContext *s, int bits_per_raw_sample, int lowres, int chroma_x_shift) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index f84a05d674..21626b58a0 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -4219,8 +4219,8 @@ static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? int prev_run=0; int prev_level=0; int qmul, qadd, start_i, last_non_zero, i, dc; - uint8_t * length; - uint8_t * last_length; + const uint8_t *length; + const uint8_t *last_length; int lambda; int rle_index, run, q = 1, sum; //q is only used when s->mb_intra is true @@ -4533,7 +4533,7 @@ static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? * permutation up, the block is not (inverse) permutated * to scantable order! */ -void ff_block_permute(int16_t *block, uint8_t *permutation, +void ff_block_permute(int16_t *block, const uint8_t *permutation, const uint8_t *scantable, int last) { int i; diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 9c1872aa1b..964caa5afb 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -38,7 +38,7 @@ static inline int hpel_motion(MpegEncContext *s, uint8_t *dest, uint8_t *src, int src_x, int src_y, - op_pixels_func *pix_op, + const op_pixels_func *pix_op, int motion_x, int motion_y) { int dxy = 0; @@ -79,7 +79,7 @@ void mpeg_motion_internal(MpegEncContext *s, int bottom_field, int field_select, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], + const op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int h, @@ -219,7 +219,7 @@ void mpeg_motion_internal(MpegEncContext *s, static void mpeg_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_select, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], + const op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int h, int is_16x8, int mb_y) { #if !CONFIG_SMALL @@ -238,7 +238,7 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int bottom_field, int field_select, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], + const op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int mb_y) { #if !CONFIG_SMALL @@ -254,7 +254,7 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y, } // FIXME: SIMDify, avg variant, 16x16 version -static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride) +static inline void put_obmc(uint8_t *dst, uint8_t *const src[5], int stride) { int x; uint8_t *const top = src[1]; @@ -310,7 +310,7 @@ static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride) static inline void obmc_motion(MpegEncContext *s, uint8_t *dest, uint8_t *src, int src_x, int src_y, - op_pixels_func *pix_op, + const op_pixels_func *pix_op, int16_t mv[5][2] /* mid top left right bottom */) #define MID 0 { @@ -339,8 +339,8 @@ static inline void qpel_motion(MpegEncContext *s, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], - qpel_mc_func (*qpix_op)[16], + const op_pixels_func (*pix_op)[4], + const qpel_mc_func (*qpix_op)[16], int motion_x, int motion_y, int h) { const uint8_t *ptr_y, *ptr_cb, *ptr_cr; @@ -443,7 +443,7 @@ static inline void qpel_motion(MpegEncContext *s, static void chroma_4mv_motion(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture, - op_pixels_func *pix_op, + const op_pixels_func *pix_op, int mx, int my) { const uint8_t *ptr; @@ -511,7 +511,7 @@ static inline void apply_obmc(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4]) + const op_pixels_func (*pix_op)[4]) { LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); const Picture *cur_frame = &s->cur_pic; @@ -599,8 +599,8 @@ static inline void apply_8x8(MpegEncContext *s, uint8_t *dest_cr, int dir, uint8_t *const *ref_picture, - qpel_mc_func (*qpix_op)[16], - op_pixels_func (*pix_op)[4]) + const qpel_mc_func (*qpix_op)[16], + const op_pixels_func (*pix_op)[4]) { int dxy, mx, my, src_x, src_y; int i; @@ -684,8 +684,8 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, uint8_t *dest_cr, int dir, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], - qpel_mc_func (*qpix_op)[16], + const op_pixels_func (*pix_op)[4], + const qpel_mc_func (*qpix_op)[16], int is_mpeg12) { int i; @@ -820,8 +820,8 @@ void ff_mpv_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t *const *ref_picture, - op_pixels_func (*pix_op)[4], - qpel_mc_func (*qpix_op)[16]) + const op_pixels_func (*pix_op)[4], + const qpel_mc_func (*qpix_op)[16]) { av_assert2(s->out_format == FMT_MPEG1 || s->out_format == FMT_H263 || diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h index c20ea500eb..f7e681eaa6 100644 --- a/libavcodec/mpegvideoenc.h +++ b/libavcodec/mpegvideoenc.h @@ -152,7 +152,7 @@ int ff_dct_quantize_c(MpegEncContext *s, int16_t *block, int n, int qscale, int void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra); -void ff_block_permute(int16_t *block, uint8_t *permutation, +void ff_block_permute(int16_t *block, const uint8_t *permutation, const uint8_t *scantable, int last); static inline int get_bits_diff(MpegEncContext *s) diff --git a/libavcodec/mpv_reconstruct_mb_template.c b/libavcodec/mpv_reconstruct_mb_template.c index 70dab76f73..2da2218042 100644 --- a/libavcodec/mpv_reconstruct_mb_template.c +++ b/libavcodec/mpv_reconstruct_mb_template.c @@ -144,8 +144,8 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix); } } else { - op_pixels_func (*op_pix)[4]; - qpel_mc_func (*op_qpix)[16]; + const op_pixels_func (*op_pix)[4]; + const qpel_mc_func (*op_qpix)[16]; if ((is_mpeg12 == DEFINITELY_MPEG12 || !s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { op_pix = s->hdsp.put_pixels_tab; diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index c354f46c50..a7b3fc4603 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -627,8 +627,8 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, { int level, i, last, run, run_diff; int av_uninit(dc_pred_dir); - RLTable *rl; - RL_VLC_ELEM *rl_vlc; + const RLTable *rl; + const RL_VLC_ELEM *rl_vlc; int qmul, qadd; if (s->mb_intra) { @@ -811,7 +811,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, void ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr) { - MVTable *mv; + const MVTable *mv; int code, mx, my; mv = &ff_mv_tables[s->mv_table_index]; diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index e4d18ff669..1c9af6b53c 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -70,7 +70,7 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS } -static inline double qp2bits(RateControlEntry *rce, double qp) +static inline double qp2bits(const RateControlEntry *rce, double qp) { if (qp <= 0.0) { av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n"); @@ -83,7 +83,7 @@ static double qp2bits_cb(void *rce, double qp) return qp2bits(rce, qp); } -static inline double bits2qp(RateControlEntry *rce, double bits) +static inline double bits2qp(const RateControlEntry *rce, double bits) { if (bits < 0.9) { av_log(NULL, AV_LOG_ERROR, "bits<0.9\n"); @@ -96,7 +96,7 @@ static double bits2qp_cb(void *rce, double qp) return bits2qp(rce, qp); } -static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, double q) +static double get_diff_limited_q(MpegEncContext *s, const RateControlEntry *rce, double q) { RateControlContext *rcc = &s->rc_context; AVCodecContext *a = s->avctx; @@ -163,7 +163,7 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic *qmax_ret = qmax; } -static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, +static double modify_qscale(MpegEncContext *s, const RateControlEntry *rce, double q, int frame_num) { RateControlContext *rcc = &s->rc_context; @@ -385,7 +385,7 @@ static int init_pass2(MpegEncContext *s) /* find qscale */ for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; + const RateControlEntry *rce = &rcc->entry[i]; qscale[i] = get_qscale(s, &rcc->entry[i], rate_factor, i); rcc->last_qscale_for[rce->pict_type] = qscale[i]; @@ -394,20 +394,20 @@ static int init_pass2(MpegEncContext *s) /* fixed I/B QP relative to P mode */ for (i = FFMAX(0, rcc->num_entries - 300); i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; + const RateControlEntry *rce = &rcc->entry[i]; qscale[i] = get_diff_limited_q(s, rce, qscale[i]); } for (i = rcc->num_entries - 1; i >= 0; i--) { - RateControlEntry *rce = &rcc->entry[i]; + const RateControlEntry *rce = &rcc->entry[i]; qscale[i] = get_diff_limited_q(s, rce, qscale[i]); } /* smooth curve */ for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; + const RateControlEntry *rce = &rcc->entry[i]; const int pict_type = rce->new_pict_type; int j; double q = 0.0, sum = 0.0; @@ -877,8 +877,8 @@ static void adaptive_quantization(MpegEncContext *s, double q) void ff_get_2pass_fcode(MpegEncContext *s) { - RateControlContext *rcc = &s->rc_context; - RateControlEntry *rce = &rcc->entry[s->picture_number]; + const RateControlContext *rcc = &s->rc_context; + const RateControlEntry *rce = &rcc->entry[s->picture_number]; s->f_code = rce->f_code; s->b_code = rce->b_code; @@ -929,7 +929,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) rce = &rcc->entry[picture_number]; wanted_bits = rce->expected_bits; } else { - Picture *dts_pic; + const Picture *dts_pic; rce = &local_rce; /* FIXME add a dts field to AVFrame and ensure it is set and use it diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 941d983501..df1d570e73 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -679,7 +679,8 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, h264_chroma_mc_func (*chroma_mc)) { MpegEncContext *s = &r->s; - uint8_t *Y, *U, *V, *srcY, *srcU, *srcV; + uint8_t *Y, *U, *V; + const uint8_t *srcY, *srcU, *srcV; int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; int is16x16 = 1; diff --git a/libavcodec/vc1_loopfilter.c b/libavcodec/vc1_loopfilter.c index 8afb4db190..67abb4b01c 100644 --- a/libavcodec/vc1_loopfilter.c +++ b/libavcodec/vc1_loopfilter.c @@ -413,9 +413,10 @@ static av_always_inline void vc1_p_h_loop_filter(VC1Context *v, uint8_t *dest, u } } -static av_always_inline void vc1_p_v_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp, - uint8_t *is_intra, int16_t (*mv)[2], uint8_t *mv_f, - int *ttblk, uint32_t flags, int block_num) +static av_always_inline +void vc1_p_v_loop_filter(VC1Context *v, uint8_t *dest, const uint32_t *cbp, + const uint8_t *is_intra, int16_t (*mv)[2], const uint8_t *mv_f, + const int *ttblk, uint32_t flags, int block_num) { MpegEncContext *s = &v->s; int pq = v->pq; @@ -799,7 +800,7 @@ void ff_vc1_p_loop_filter(VC1Context *v) } } -static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *dest, int *ttblk, +static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *dest, const int *ttblk, uint32_t flags, uint8_t fieldtx, int block_num) { MpegEncContext *s = &v->s; @@ -849,8 +850,9 @@ static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *d } } -static av_always_inline void vc1_p_v_intfr_loop_filter(VC1Context *v, uint8_t *dest, int *ttblk, - uint32_t flags, uint8_t fieldtx, int block_num) +static av_always_inline +void vc1_p_v_intfr_loop_filter(VC1Context *v, uint8_t *dest, const int *ttblk, + uint32_t flags, uint8_t fieldtx, int block_num) { MpegEncContext *s = &v->s; int pq = v->pq; @@ -1109,8 +1111,9 @@ void ff_vc1_p_intfr_loop_filter(VC1Context *v) } } -static av_always_inline void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp, - int *ttblk, uint32_t flags, int block_num) +static av_always_inline +void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *dest, const uint32_t *cbp, + const int *ttblk, uint32_t flags, int block_num) { MpegEncContext *s = &v->s; int pq = v->pq; @@ -1141,8 +1144,9 @@ static av_always_inline void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *d } } -static av_always_inline void vc1_b_v_intfi_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp, - int *ttblk, uint32_t flags, int block_num) +static av_always_inline +void vc1_b_v_intfi_loop_filter(VC1Context *v, uint8_t *dest, const uint32_t *cbp, + const int *ttblk, uint32_t flags, int block_num) { MpegEncContext *s = &v->s; int pq = v->pq; @@ -1174,7 +1178,7 @@ void ff_vc1_b_intfi_loop_filter(VC1Context *v) MpegEncContext *s = &v->s; int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6; uint8_t *dest; - uint32_t *cbp; + const uint32_t *cbp; int *ttblk; uint32_t flags = 0; int i; diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index b60a48b38f..90ff1eee58 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -58,7 +58,7 @@ static av_always_inline void vc1_scale_chroma(uint8_t *srcU, uint8_t *srcV, } static av_always_inline void vc1_lut_scale_luma(uint8_t *srcY, - uint8_t *lut1, uint8_t *lut2, + const uint8_t *lut1, const uint8_t *lut2, int k, int linesize) { int i, j; @@ -78,7 +78,7 @@ static av_always_inline void vc1_lut_scale_luma(uint8_t *srcY, } static av_always_inline void vc1_lut_scale_chroma(uint8_t *srcU, uint8_t *srcV, - uint8_t *lut1, uint8_t *lut2, + const uint8_t *lut1, const uint8_t *lut2, int k, int uvlinesize) { int i, j; @@ -177,7 +177,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int v_edge_pos = s->v_edge_pos >> v->field_mode; int i; - uint8_t (*luty)[256], (*lutuv)[256]; + const uint8_t (*luty)[256], (*lutuv)[256]; int use_ic; int interlace; int linesize, uvlinesize; @@ -457,7 +457,7 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) int off; int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; - uint8_t (*luty)[256]; + const uint8_t (*luty)[256]; int use_ic; int interlace; int linesize; @@ -640,7 +640,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) int16_t tx, ty; int chroma_ref_type; int v_edge_pos = s->v_edge_pos >> v->field_mode; - uint8_t (*lutuv)[256]; + const uint8_t (*lutuv)[256]; int use_ic; int interlace; int uvlinesize; @@ -851,7 +851,7 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) int use_ic; int interlace; int uvlinesize; - uint8_t (*lutuv)[256]; + const uint8_t (*lutuv)[256]; if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; @@ -1191,8 +1191,8 @@ void ff_vc1_interp_mc(VC1Context *v) } if (use_ic) { - uint8_t (*luty )[256] = v->next_luty; - uint8_t (*lutuv)[256] = v->next_lutuv; + const uint8_t (*luty )[256] = v->next_luty; + const uint8_t (*lutuv)[256] = v->next_lutuv; vc1_lut_scale_luma(srcY, luty[v->field_mode ? v->ref_field_type[1] : ((0+src_y - s->mspel) & 1)], luty[v->field_mode ? v->ref_field_type[1] : ((1+src_y - s->mspel) & 1)], diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index 51ad668f23..f5e80fe0ef 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -33,7 +33,7 @@ #include "vc1_pred.h" #include "vc1data.h" -static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int dir) +static av_always_inline int scaleforsame_x(const VC1Context *v, int n /* MV */, int dir) { int scaledvalue, refdist; int scalesame1, scalesame2; @@ -66,7 +66,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di return av_clip(scaledvalue, -v->range_x, v->range_x - 1); } -static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, int dir) +static av_always_inline int scaleforsame_y(const VC1Context *v, int i, int n /* MV */, int dir) { int scaledvalue, refdist; int scalesame1, scalesame2; @@ -103,7 +103,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, return av_clip(scaledvalue, -v->range_y / 2, v->range_y / 2 - 1); } -static av_always_inline int scaleforopp_x(VC1Context *v, int n /* MV */) +static av_always_inline int scaleforopp_x(const VC1Context *v, int n /* MV */) { int scalezone1_x, zone1offset_x; int scaleopp1, scaleopp2, brfd; @@ -130,7 +130,7 @@ static av_always_inline int scaleforopp_x(VC1Context *v, int n /* MV */) return av_clip(scaledvalue, -v->range_x, v->range_x - 1); } -static av_always_inline int scaleforopp_y(VC1Context *v, int n /* MV */, int dir) +static av_always_inline int scaleforopp_y(const VC1Context *v, int n /* MV */, int dir) { int scalezone1_y, zone1offset_y; int scaleopp1, scaleopp2, brfd; @@ -161,7 +161,7 @@ static av_always_inline int scaleforopp_y(VC1Context *v, int n /* MV */, int dir } } -static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */, +static av_always_inline int scaleforsame(const VC1Context *v, int i, int n /* MV */, int dim, int dir) { int brfd, scalesame; @@ -182,7 +182,7 @@ static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */, return n; } -static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, +static av_always_inline int scaleforopp(const VC1Context *v, int n /* MV */, int dim, int dir) { int refdist, scaleopp; @@ -215,7 +215,6 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, { MpegEncContext *s = &v->s; int xy, wrap, off = 0; - int16_t *A, *B, *C; int px, py; int sum; int mixedmv_pic, num_samefield = 0, num_oppfield = 0; @@ -301,7 +300,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, } if (a_valid) { - A = s->cur_pic.motion_val[dir][xy - wrap + v->blocks_off]; + const int16_t *A = s->cur_pic.motion_val[dir][xy - wrap + v->blocks_off]; a_f = v->mv_f[dir][xy - wrap + v->blocks_off]; num_oppfield += a_f; num_samefield += 1 - a_f; @@ -312,7 +311,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, a_f = 0; } if (b_valid) { - B = s->cur_pic.motion_val[dir][xy - wrap + off + v->blocks_off]; + const int16_t *B = s->cur_pic.motion_val[dir][xy - wrap + off + v->blocks_off]; b_f = v->mv_f[dir][xy - wrap + off + v->blocks_off]; num_oppfield += b_f; num_samefield += 1 - b_f; @@ -323,7 +322,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, b_f = 0; } if (c_valid) { - C = s->cur_pic.motion_val[dir][xy - 1 + v->blocks_off]; + const int16_t *C = s->cur_pic.motion_val[dir][xy - 1 + v->blocks_off]; c_f = v->mv_f[dir][xy - 1 + v->blocks_off]; num_oppfield += c_f; num_samefield += 1 - c_f; @@ -692,8 +691,7 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype) { MpegEncContext *s = &v->s; - int xy, wrap, off = 0; - int16_t *A, *B, *C; + int xy, wrap; int px, py; int sum; int r_x, r_y; @@ -743,10 +741,10 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], } if ((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { - C = s->cur_pic.motion_val[0][xy - 2]; - A = s->cur_pic.motion_val[0][xy - wrap * 2]; - off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; - B = s->cur_pic.motion_val[0][xy - wrap * 2 + off]; + int16_t *C = s->cur_pic.motion_val[0][xy - 2]; + const int16_t *A = s->cur_pic.motion_val[0][xy - wrap * 2]; + int off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; + const int16_t *B = s->cur_pic.motion_val[0][xy - wrap * 2 + off]; if (!s->mb_x) C[0] = C[1] = 0; if (!s->first_slice_line) { // predictor A is not out of bounds @@ -812,10 +810,10 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y; } if ((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { - C = s->cur_pic.motion_val[1][xy - 2]; - A = s->cur_pic.motion_val[1][xy - wrap * 2]; - off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; - B = s->cur_pic.motion_val[1][xy - wrap * 2 + off]; + int16_t *C = s->cur_pic.motion_val[1][xy - 2]; + const int16_t *A = s->cur_pic.motion_val[1][xy - wrap * 2]; + int off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; + const int16_t *B = s->cur_pic.motion_val[1][xy - wrap * 2 + off]; if (!s->mb_x) C[0] = C[1] = 0; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index d8d58bb7eb..b89f695b56 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -211,7 +211,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) { int i, plane, row, sprite; int sr_cache[2][2] = { { -1, -1 }, { -1, -1 } }; - uint8_t* src_h[2][2]; + const uint8_t *src_h[2][2]; int xoff[2], xadv[2], yoff[2], yadv[2], alpha; int ysub[2]; MpegEncContext *s = &v->s; @@ -235,7 +235,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) v->sprite_output_frame->linesize[plane] * row; for (sprite = 0; sprite <= v->two_sprites; sprite++) { - uint8_t *iplane = s->cur_pic.data[plane]; + const uint8_t *iplane = s->cur_pic.data[plane]; int iline = s->cur_pic.linesize[plane]; int ycoord = yoff[sprite] + yadv[sprite] * row; int yline = ycoord >> 16; @@ -667,7 +667,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) } } else { // VC1/WVC1/WVP2 const uint8_t *start = avctx->extradata; - uint8_t *end = avctx->extradata + avctx->extradata_size; + const uint8_t *end = avctx->extradata + avctx->extradata_size; const uint8_t *next; int size, buf2_size; uint8_t *buf2 = NULL; diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index e3d3288d33..c2bcb988c4 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -49,7 +49,8 @@ av_cold void ff_wmv2_common_init(MpegEncContext *s) void ff_mspel_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, - uint8_t *const *ref_picture, op_pixels_func (*pix_op)[4], + uint8_t *const *ref_picture, + const op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int h) { WMV2Context *const w = s->private_ctx; diff --git a/libavcodec/wmv2.h b/libavcodec/wmv2.h index e49b81cdfb..6fc9704c3d 100644 --- a/libavcodec/wmv2.h +++ b/libavcodec/wmv2.h @@ -39,7 +39,8 @@ void ff_wmv2_common_init(MpegEncContext *s); void ff_mspel_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, - uint8_t *const *ref_picture, op_pixels_func (*pix_op)[4], + uint8_t *const *ref_picture, + const op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int h); From patchwork Sat May 11 20:51:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48762 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299049pzb; Sat, 11 May 2024 13:57:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUF2B8uqk+4ymXBrTzvgstYMremXT0BFLa8CR/PqfKkC2Bako51Z827w+i+VVOzOWPdwu1/JSe9M2eODOsOFv+0M4rpzS8WtsOl8A== X-Google-Smtp-Source: AGHT+IHzojZDuY2mQdgll8ZYDMNvfflDC/yaYYkMJO0fZ5gqtj46kdrzdtO9SI23y1BQehsKZHgt X-Received: by 2002:a50:99d1:0:b0:572:a17d:a302 with SMTP id 4fb4d7f45d1cf-5734d705b6amr3549858a12.42.1715461024498; Sat, 11 May 2024 13:57:04 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733c2d547csi3586738a12.230.2024.05.11.13.57.03; Sat, 11 May 2024 13:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=R40Wef+9; 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 630BA68D725; Sat, 11 May 2024 23:54:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2024.outbound.protection.outlook.com [40.92.74.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD5AB68D6EE for ; Sat, 11 May 2024 23:54:16 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eg9aYr1xYvApJFV/LOUiAgptP4TnzyxuAD7bXHDO7wIc9OTvRyygTn/fmb5EeZjvirSKLw+nFJj4l6+qhMy6t7c7ONgWmPeTMW5qkdMyEeObwH5gERE7Hc+5/1vOlPdZdPX1mnsIqU6fbxBmt4MuHNjdlaifz9tS4Dy9yFmr/CbZbGi9NWOTWSm7h3ffEDD0uwxBvmH3SAKDwbjKwb6S50P1kwhH8iD7F4j/KnSAA6tbDPkt36ucDnL63h4Te0KNPzfHgd1aloKKW+xJvdI+gyO/OLqtDh5BixuJVRNr5gtkdZxzclK9C0+CQ2vllCMzD68iiqMxReSuMz/PwBEdFg== 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=btqpa3c3umfgs2CGrc9XI0qf5OMsZ4dRuT/yO525Vvg=; b=G9wnEToBaWiEGtI2DwesR0z65ykCIX2Jz/nG9SwueVkypYAEcvDqefSrHMQmEnzM0fGg0+BzuG6jCoAcaQppISbVkg3Z6c/tFpDJXv7TEZeBS1b4uR14U39XRlqpkh5VDsiYBdNBUMTodooIaeRD0m/x8kyYMLAiYv+ZSNiZnXqHOu157eZSwIxqhHkC6T0rjFwcgBFsfVWPKRpMAwqkogFEW1DXQHkm/b54r20ibgmbjGmI9fwbsNOmaQaWctUcOU8R6LIpr2Fk/m0HAgbR21r4ZwhMt+zgCejWxEpcW+jC8DymxNOth4A7vylRJ8QthVKvdefVrOLV3SQAx8Fk5A== 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=btqpa3c3umfgs2CGrc9XI0qf5OMsZ4dRuT/yO525Vvg=; b=R40Wef+9xxuIRTw5hS/JvQ8gkWbLORoiIm30ETyQyeGle8LCu8t1cw2LQw1p14KQW1JNt3VabhAca/FRmMzN4PEa5CtZ+TDBsmAag4QM9SK3bdJLD852s7nVyGmxMzh216Bi5dGSMD4HzMNNqgFWbxFQW5u6H26xhN8q6gEbKLqVqhC1rdsdQJwTl7ul38o8oFFniTniR36oMNgqBF2jrdc8Orz934davQX8TSiqgxt3RPFjI3aV3RuD0nIDxaxorfGF3HikjIeagy0aoUpUsjg1F78KhnAu8vrvYj+pSsrzIE3xQURqDHFmK91YwrzhFYXejYdFDxJpckftFjZXnw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:14 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:14 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:00 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [9il5U/4pY001m+3AWioNM2Y3RT/smHtadJGL9g3B/Y4=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-35-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 26216668-6ae8-46d5-22b1-08dc71fc8407 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: eE2QpJO9BA3IRu3dhjTN5+r2CSx0I+xfVNfyw4bqWWrGL5gbxSulVT0XlQlgmRaMIVxkExPP8+WKg4CljOiDa0SbmIKkvsH2tZZ3JZVSU9cxKwSZ+Rw3WOxIqA9R+jrKsINwI4tThsTOxLoUAqyvfsXxlul9gWRyTxCPXylHH0PCFrqDD1FtDdGiQJskddAdJVLxj/ho5SI34pGc4rf3qX6OASXAqytNG0UGuHx/FsTDFhKOHXl1CbXXTo5QQ7o6CSNvfFbLmadGrNlIyUSO8fSbJSJ4k3bSBzycN1209x2J9RVK0gCOCWFPAA+tg5KqG65HbZ8ophKiI3nEVCuvbXe7NzKs+wp2XdSLkKeFqTyBf2FavAdzdFFkrQcamp67FXvFIjHl1SC4GnBhw4RR9d9fk7mpOsTjUc/dEvQ0VOoyB912RoZ+vFALTpaPcIcWU+x8qXvrDd3HiujyWBgrv6tRi+IHcmvBgaYlZhEKMzGzMttHXRnbKVVonbjQBtDDfjYEjxcaEu6ucy9ix4SmKBXdFsXoFvdhMjuDwoY7+cXl63Zv5vtfhte02+I7uBnkUFB7EgxAEm3aWhpupBCJt3/WsEHjjVUxjT2ZYoIStPo= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V1QSrfnCup54vgn8mWyphuuWG2Ao1jH/LYjB1hYAM5NLBZ+kVKChyzLfPdcrYOBOZ+Q9evTICfmfasepWXzemZsM532daM+OtrSPhZN7aiZdb+F11DvxHU7vFiY9SrpKBc/oIvIbc1+rP5YwYJcoSv0xG8PXw7wkFIiNuBB4LFkHgF9EPueZbnvmTCPJUCnZs1+D++9teQpek1Z2q9rBMDqOMATS38YEPx4lYBimNmMjMNSnmChRLES7PGz6dbvS1EQJCqprtM1sSmz03CC9jUAdGI26X0AYRmxVlbU6EgKxNZ/BJpYpywIh77nMwTDbfAhM9vZy+96ET8H22QQWG54N9hvG+D9rAOhz2swkPpzhevBxI7XCNxTWmDkWmd0yrElc1mIutNBatim34aOMDh4CbZHz/tb6oDFli63YYvltI+Fd1zTmUCkWT9clY744xBNngTvfVXd1CBu0XCR69SJB63O6AoXf6h+Osf75o6uZI3U5d4K6JoUECVPbFjq2rXXoEyd88CupBVj+chfeiNhRJE4BOScDQ1IYUapytV4P+jgaCf+xnoAMq7MHYu6GW93EHaQH6okFFQmZHC6H1UlSSMnA/7aTjP4GBlO/LaAD/p5nsyYZR6q8M5QAIV5T/f3O7hXsvl1RV+VjelaiXWVh+7865aEV8WaGG5U3wH1YyfSATmmfpKlDozJ1ls+ksRokBRPlg+6AMUMu6NWYA3f5e8IgQ3FwDal5R7SkNL0Vvuk1DL4Eiw/Lm5GVl/26M2DeEfo/k1UF5me/TZPFOneYl4D8wM6okLeRTrz/zNod2BtS2gzgR81GHeqRose5SzPDbkdK2jIJW4kNleAGer6kFVryPIDsW6k25zCHSnNlxQeNCo8iLNFs6pCRLbSWOSni8To89TpUCwNtVf3UmJmQPUOerIjGM8yyZx5C54G311Fku8pVJPJLkG4ldYQe/79a9xF0EpA1sdD+ztmP9/vyPrQuJpCxzWgM/yDuBASe4Cz7cfawvzJp0dasGu0mzY362ASj0tEPouVVtWhn6fv8QAizm6lGhpII0kFOVyKLtaNZ0iuC5aEkcAXCms6cQTy8kFCwpG64N/FGZ0FAyxiNHaCG64VFn/Y1E1fxN64UaDWUtrnj399JZKEelT47j0bKMbQ/5zkf7pMe4ULprjIBM2dhSgXCANTze0oH/I1OBrooYMPFBtIhzyuldBl6n01LvuFL/NJYx12F31i7jeMTk3FUVQmaDPXs5RRiwUkwXCA29PZlB248GIwoMnUuHvW750BLZUneNTY0eMRYWg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26216668-6ae8-46d5-22b1-08dc71fc8407 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:14.3116 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 36/71] avcodec/vc1_pred: Remove unused function parameter 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: qIroBjBXUekd Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1_pred.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index f5e80fe0ef..9141290d26 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -66,7 +66,7 @@ static av_always_inline int scaleforsame_x(const VC1Context *v, int n /* MV */, return av_clip(scaledvalue, -v->range_x, v->range_x - 1); } -static av_always_inline int scaleforsame_y(const VC1Context *v, int i, int n /* MV */, int dir) +static av_always_inline int scaleforsame_y(const VC1Context *v, int n /* MV */, int dir) { int scaledvalue, refdist; int scalesame1, scalesame2; @@ -161,7 +161,7 @@ static av_always_inline int scaleforopp_y(const VC1Context *v, int n /* MV */, i } } -static av_always_inline int scaleforsame(const VC1Context *v, int i, int n /* MV */, +static av_always_inline int scaleforsame(const VC1Context *v, int n /* MV */, int dim, int dir) { int brfd, scalesame; @@ -170,7 +170,7 @@ static av_always_inline int scaleforsame(const VC1Context *v, int i, int n /* MV n >>= hpel; if (v->s.pict_type != AV_PICTURE_TYPE_B || v->second_field || !dir) { if (dim) - n = scaleforsame_y(v, i, n, dir) * (1 << hpel); + n = scaleforsame_y(v, n, dir) * (1 << hpel); else n = scaleforsame_x(v, n, dir) * (1 << hpel); return n; @@ -365,16 +365,16 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, v->mv_f[dir][xy + v->blocks_off] = 0; v->ref_field_type[dir] = v->cur_field_type; if (a_valid && a_f) { - field_predA[0] = scaleforsame(v, n, field_predA[0], 0, dir); - field_predA[1] = scaleforsame(v, n, field_predA[1], 1, dir); + field_predA[0] = scaleforsame(v, field_predA[0], 0, dir); + field_predA[1] = scaleforsame(v, field_predA[1], 1, dir); } if (b_valid && b_f) { - field_predB[0] = scaleforsame(v, n, field_predB[0], 0, dir); - field_predB[1] = scaleforsame(v, n, field_predB[1], 1, dir); + field_predB[0] = scaleforsame(v, field_predB[0], 0, dir); + field_predB[1] = scaleforsame(v, field_predB[1], 1, dir); } if (c_valid && c_f) { - field_predC[0] = scaleforsame(v, n, field_predC[0], 0, dir); - field_predC[1] = scaleforsame(v, n, field_predC[1], 1, dir); + field_predC[0] = scaleforsame(v, field_predC[0], 0, dir); + field_predC[1] = scaleforsame(v, field_predC[1], 1, dir); } } From patchwork Sat May 11 20:51:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48763 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299066pzb; Sat, 11 May 2024 13:57:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4GVQnfnJRxaIS69uXj8u+/7qqXdKgHfXnNRruIoHnN1lQJEbCk03dlJK132BsW5fsIU+ue4xz4rmr1FCxT62iZsEc4mgIrb7UFg== X-Google-Smtp-Source: AGHT+IEShmQt0ueSzAe9zKJO2JXpRhEIud+7Bq43UCu2z2kyTw77bkhNwyXf7Eu9iaDtD3ERY9PM X-Received: by 2002:a17:907:50e:b0:a59:a0b7:1850 with SMTP id a640c23a62f3a-a5a2d6871dfmr426211566b.5.1715461032659; Sat, 11 May 2024 13:57:12 -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 a640c23a62f3a-a5a17b36905si320848566b.447.2024.05.11.13.57.12; Sat, 11 May 2024 13:57:12 -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=OE2P5Aej; 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 EC69F68D6C4; Sat, 11 May 2024 23:54:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2047.outbound.protection.outlook.com [40.92.74.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11A1C68D6C4 for ; Sat, 11 May 2024 23:54:21 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2fMYRePQ3LB3aJFR9FGC6bunKj8v6xJSPehaxKMrh72KZiLAfi6sO8q1pEm8Siyb542f6xu7R6uzpgvTVYKXpole1sXYIIuX0bZKPuI4lASQj/eL283bwCTqqAcZ3jhtMZ03IVwVpI7fEeNicjWWYnVN3H59IxrT22t5eOumzSykYGvlwmZF5ZnaxmKbcmuIiA0UuWyJ/uwWTv/b9oB9FqSe+o6M86nHUI+jhjeywdjiuZArZlPf0sltuSOx5nHwJbFrXCbXUVLlocf/BdYj7BPG4Ce+JSa9CKsdrExzPp5r8z2snSj0+ubs7uS2qd2cA9FCmpe5KmO5v7TxJUdXQ== 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=dNe7gmbibJqHRrfN+04xnj4UOuQMdGo2zOpc8E5Whb0=; b=L0uRQwEQmvJTtZ57iaF5/d+L7MLTOslz+R3OSp2A5QWg9xFGiLfA2bWz8kA3Z+zvq0MTZMlAFFHtNv2hm/l/dXFB1gsETYG8jEVFhirCNC7ZqjbyhFBZvhFrV5e3mHmc5GoPcGEKIHMGOu/2WiZSrRVCM97FwI/NsOqLRz+7QP3ctcAGwWoK0pJcnqbA4+xmKJiP+blUlR5RK3mdqYBsX8Xru9rh+bVmNnMLJ12t+sKJvvGu53cK6VzmXSOj12Td3VoNAwAebOwW5lQBjN7y9axEF5XSBurbexGu+br41T9/AE/aRcf+NQW5dGfAwOFub32D1FwdeO5HBkognSOwiw== 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=dNe7gmbibJqHRrfN+04xnj4UOuQMdGo2zOpc8E5Whb0=; b=OE2P5AejAwOc09fc8kHpB17N4Psgb0q9q6AS4DZ8u0OILL1mMI54HCVQJ18MSNb87/TS+n8maATvhos/ssZSH5Fmw38Ybu31GVAshqZPuMrxoxMIqYLoiaVJuRoIPJOoMwH/sGeg8g9F70Qi3u1ak2plw/J4KAFRpOfO+NxPRLYk+grKN5IqABdd4eC0iUzGW0J+mSrwk+ODVGQ2ppUOjpnEw+Bve+KJ4z1qZzBdC+OiyVb6Oqk9ffSjciNuC7cbp57zanNALvVt/js0LikOzPUksUWrPcttu7tui4mDJL+VmOnmgicUGIfWE8Zk9/mxFebRQffY64b1bdDQfD1LVA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:19 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:01 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [MjeHDthZrVJHJWBs9VTJ7YkBF4N2SSZwEDpnU76cGpY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-36-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 8818c181-a5af-4702-9119-08dc71fc872c X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|56899024|1710799017; X-Microsoft-Antispam-Message-Info: fIu5wFy+KUtrEskj8z8tqxBl39qALeJucu8n/OiihnrIsz1sv7fB9L6nzfsVjvZN/WHP1qphnNCdbUBPugsCOWYjqERIAFBO4oJCslIj+MfE2nxT48zQOSQW4Bd/gUkD6FRw7/k3PfaWnrgQdkkrghR4Awism+isTOEnawHeSmiVcuDHFqo7eWYJobFzcnNceU9kwFVtkvd/myHMDUHRJwdmUgTccys3V53pjXo6eyxWNg9kLZEK5KNdPg2dEQdRcwaFGjxESVba6AQvtTDWJCBqEXD0pArj3uVkJqxOIPqiroaTrvmVh3ZCtgOOHrKQ/ve0bFWHzWLAkC09ACRUSfke7gfLfHYISTzwln3BQnW8s4KVyCOswsTLNS+4ZGN/S9pUBu2Wff2Q7HnqdCtI+wXl0/THd7s6UGv4tQ1LWvMD2PHe/6FGlYKQmbX1Y7RbXhCfsRYTUKnj/1nxSOXeBK2lG+zSAj5ACLfRLTZOWgkHqUz7EZNKMCmUlgB+1LI9wu4ys6Xuc33IjxRbkMtXRJAlyi2wLCzLUUKZ83tzxbL0qXf8Wl9Eo7J9+E3m02lXIUmHe3Q5iCBtsdJjeh2UZ0ZPDyOA1Cx+265Fh1BlLPkeEIcewAJ33JAk6M6zq2td X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vY9avJRMHxMVSqyXcZ1fi0VfLBWsu8v4XNmsFVxEQ3aDX3/5I6Yk6eaKHamFwn3yr+yx+EBhj6VUlc6Lp1LyntY+grBaWRrSfgrFtTQXXAjcx4BWUpiCaPWOf9Ph+lsUaDrrKVTHViU5P3MUHCVi2oWwMs7TQLXu9O94sVO8t/LQw10czUZgIF3TKrXWXtrvLNvirmWAUnl3JZfWmGEHE/fFlSaMo53v4soJeZcSOZbLuRkYP31H85404d/9w3WKyLjdpOurLWSVwcGDHGp4NVWzzgBowEUglAV2b+8vfjFTIJ5xhxUykoCuS3DXweI1mE75rwMCyE1KMBh04w/UJKkkRpy6jUvOT1qUWm1r7VBFO7EH96Ldxjp2gIXD6EQ/mWF1nSRQcfzUqxdNm9mqsOZI60DR6Z7E2T7ahBh8FjGCDaSt5iotJpXt6FYHGthY3r6/qp5gUDvFWkH7ucHlkWq79RAnQfgcPLi9uH/Ck00yYHJmyxiyDUXyjzDQfjIuCjBdXozQG0kIaW+Nkj96icAgI8880mNT4X7EJUV2jRYpIX20f9/PjN5lmE3swDmrKcQH6bHQgDZIcQ4zItFTicFDpmg410IdKcQpf2EW2LRAryNw0D+/CNY8vBi31/58osVhg4/MDlYo5MhvODFSkHi8HOpJkVDfUsvZJJTG6YFtVyxutbyljHhMQxUvflFayDE6rC+pq4EVpwRwW5Cvm5KiLDyeaY87qD/twz1bcrHF8JqJaARGf3gXcm5jbidT+AIJvdeZzwqrgls2e5yy4Zc/xR7zF6vfqAr4WXKe7RnZXjCvjx6Y9nO4cglz7ZZfmqJMM1KqaJElR+LVnTvrAkLgP/VnOeRQ+zc/V4v4JRcAPgAhHya3L0U86Jd36vPHido3iZIvhp92HTx6hR/+kZOZdAf+PK7zLxeHlSXNNYknexcRMnKvawql6+DbpcEFsJWuZZSs5hn1jzlZQMbQvNzpcOHXihpJVhE23PWmn59i7SaSCXvYeiu+cat9DhC7luFrC1AfThuBqH1kp+Lpjl4sl6n64GHecppAt7uz9wngHJHpKT+SQF6ehJY2YYHwOeolkGUGkXmSRsm9ZnyXHj6kWu1CA7w/fg8E790hv2lS36wqP5JFG4RY85CaX+owfEFnIloMvAQdE0Zs6D+gyF6TrSXs6cL+zumCJ+Mwmbg8fxRitYJ3zYsdHVFNLixiQLYiL+UzZEDMql+Lh9u/jvPmRuGRGwuEW7CVSc8J9txCE9vq655Vp37Ru3z3gjtDb3CNwslew3tv60fblUdNCQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8818c181-a5af-4702-9119-08dc71fc872c X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:19.5696 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 37/71] avcodec/mpegpicture: Improve error messages and code 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: Ft1qxKRQVGBp Make it clear that this is not a failure of get_buffer/the user, but a deficit of mpegvideo. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 6da9545b50..f605338845 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -102,20 +102,19 @@ static int handle_pic_linesizes(AVCodecContext *avctx, Picture *pic, if ((linesize && linesize != pic->f->linesize[0]) || (uvlinesize && uvlinesize != pic->f->linesize[1])) { - av_log(avctx, AV_LOG_ERROR, - "get_buffer() failed (stride changed: linesize=%d/%d uvlinesize=%d/%d)\n", + av_log(avctx, AV_LOG_ERROR, "Stride change unsupported: " + "linesize=%d/%d uvlinesize=%d/%d)\n", linesize, pic->f->linesize[0], uvlinesize, pic->f->linesize[1]); ff_mpeg_unref_picture(pic); - return -1; + return AVERROR_PATCHWELCOME; } if (av_pix_fmt_count_planes(pic->f->format) > 2 && pic->f->linesize[1] != pic->f->linesize[2]) { - av_log(avctx, AV_LOG_ERROR, - "get_buffer() failed (uv stride mismatch)\n"); + av_log(avctx, AV_LOG_ERROR, "uv stride mismatch unsupported\n"); ff_mpeg_unref_picture(pic); - return -1; + return AVERROR_PATCHWELCOME; } ret = ff_mpeg_framesize_alloc(avctx, me, sc, From patchwork Sat May 11 20:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48764 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299103pzb; Sat, 11 May 2024 13:57:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQLXU1xqar7H0sONg5OfL8lo7Dis5Uhd49XsyGf8KsN3e00/PTYfhOJni2akdT+FTSNDpy0fKZ2U/Hm0UJ3Zym1kQlKqJnWqe7/A== X-Google-Smtp-Source: AGHT+IFcXMUmQFKrivZ4j6CcG1uDrJSrVNA1VsU3NXakaQ+LPmRdjjlaqSGoDZicUsSCG6dM/Pz/ X-Received: by 2002:a17:906:17c5:b0:a59:c9ad:bd26 with SMTP id a640c23a62f3a-a5a2d54c601mr370267966b.12.1715461041515; Sat, 11 May 2024 13:57:21 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17b21ceesi325105366b.402.2024.05.11.13.57.21; Sat, 11 May 2024 13:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=j+wPcN+T; 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 66F0868D740; Sat, 11 May 2024 23:54:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2033.outbound.protection.outlook.com [40.92.74.33]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1FE9468D739 for ; Sat, 11 May 2024 23:54:24 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQvhBdnm8qYKo3XxyVjKniPKBJ0Yr8IxJzJIijW0/U9pZMNbE2J19F0MoUt6Db/STmROfX1YiFGqHZcBBmuLDPhNHDXvf09lRNvx0UZn9+DNfLOK1HWPXsU6T65BZ+YF+LDvNG7f4ov1sgjmdIBnBDvlCpMSd4W8py03LEzvTC8ZIHan1dc4iIWH3JIMrvpaGgrCdtE/BIO9NZKSkHoaE13rSGQybwO/7ZT//8Hv5PUXL/9gmHYGs/zoH3xUC+4l7ymimTyfZvZlBjAOcpz4ZW18DoLRrlqHrJ/nT9P1d0fqIWesK5MF0Xf8u03f/fZzEZdjdDYlkpwgAHfjo3X9DA== 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=VF1B9B5tZbfY/HW9Hc9xulW7hAAOu5/xIhP+rKWSeLA=; b=Ndh9nwQMXWKKwdOklc3G2Seb3xwvolj2/UunSs1c6iEhmPNXZ5FGd0XB2V6iSPuLZ50WrMSS+MydTNoKl1yvQUVgg7VQIohdOL6RUChDGpYjDz1U6Q1fqGLe5/dynTz559JE8+FCp7ee/e7gl6PmwJN1rrHjTrbDkjtKtHhBBFW1xu0BMJl/5yf7GJ4me3wP970ifERjBXV4x0PgxKS+bnIAfNuYTatLwBSMknp6hcUZ+5wg9CNybYOHK1R4XuM/0EVHrEeKqvVNC/SN/V7ekq5Vni8VuFnITcHUAfwiwWUHnaWsARPMLDKACinryUWy6nlTOo0PMtF/rAePSp71sw== 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=VF1B9B5tZbfY/HW9Hc9xulW7hAAOu5/xIhP+rKWSeLA=; b=j+wPcN+TJmv7lk9sAmuAkeDwiyMIvlpvaiHH4lzfszGv6ZBE7NPUYUMb8fhPEI/iQXaJjU2fbMtHUS5wvTdViHtEn+bjaQBfxY2CPRPsqH6prUsudQ7EjtnngRg1XLBss+P6hwOmaN5UH6ykNcTFw9T0MCz3MoV1jsGB3qCOiwD/bVp72FoECcBBm/gSOYzXu1+uSxKW6xiJvaS8kGBd5Ez0HuWvbobkR0mFEwOJn2zNXEKFI6PpvyHq88RDmjS7ZJ3MvtPDjBhJoIBrjOrSMBYrPByIJc0aNgC50VwCLvk60JbAu1GnLEFWtReMDi8p6VxUbr9vrcGTcMZS8KkKEg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:22 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:02 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [fVYB/A1cxMXayvOUORXJV51GBCCiAtYkghax7OKGtg0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-37-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 98315a5a-5bc4-4958-38db-08dc71fc88fe X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|56899024|1710799017; X-Microsoft-Antispam-Message-Info: lbsuLEjhAmnyw/CCqE00XkYL2TW9ttvbamzZo01QTrt6QnlnYT3cz+AS+9o/DfM/jzePQxZFTuA5yjBFIK5sMmLoXbjnduZaDp7rE/dS3WS5YY8G7YHV9VEdsSHqmsQHV11mESKqOQbBSAfzVOn5FvfiKksaUkaoGwuNQ2V5HKAkXxjqrpbLz7e/wCuJyfyBInWhXwTbRui+8mdNdNV76z/I3Y7joo7UeIjaG/1TiYbyEdqH3mrwSHnQbdJPPRan71RhSAOxl286XeCp4o4imKLP3AcCAz5G8EpHnRP5rn3QdJ/5DDrxH2Pem1jyTFJHC+11tOnV5//HVkSoHbkGMeQfE7mlcyA8DXPTOmNbpSRbGUaWzhXLqmaeELYK2t2KZr7gM25EJuXSj1KtHrPwUhuuCZF1tBGNN5XgIAr4OYSUyIF4PaS0OOATJwkBF6p7VfdSZ2/ZaMF4/C8GL2/gdYhUjiG6stbbKhQTghbgw7FD6Gl0+21kV4qTxs9b19tG8jZE9JVWRkJyfFGr7uJLu/z3dxldmG07g4PyTWbptuIvZcvsNNOhR+q9Q5M3lzYWCRb1tSaFnCi5tdIAbRjE+0FAYIOJ0zeQIKeNrR8iNmlT0RN9RfoxU25PZzLmGFs4 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +lr0pANX7cn6JxACh5+MLptswXXXOnWU1K1JL7lqPBz39q/D/0gKL+8x2TirhWPgDlcTOjkTV8bRMWjL4IsBnR6vXAgv5LScHO1V3q1gL7tcdINzb2coyOaPoAqGeeeOcb/jmZIO0SJ5WoEas4tsCGGnMzGkbj+ak5Opx7SDilW3u94/NOS7eWRGtnn8P4s1UvtGxJjI0hgusIkqMJQVBREvYYNhemw3nxznVldZfa9e46k8KsY0FQQ315nqrYRNoFKCVJFASkUB8eMMW4klbA6dR1wwQcWOH+AF8sGpe8vGnVUnKcl4fsmiApBo4+xi240LkTKLmRj9XUzmLIa2pQgqbTdXDqgrqi3Vc6KoQlV25WPuoXqcHUR448zUu+JA4WfdjUokVHdMRJeUf5WGTEeXGpAc1ps1j9rmwfcHEV8z3Ly7BJdBV8sQK3jQblSyNSxhbL7yj5UCjYAunCtVq03YjvsoK2zs+EtCKfV/A2cmQhb0wvjdFI8MSoAbR6Y3Vk/hxd/yWqLa/6ADBAwV+l6yQaGLHQFrnQSTxpTigzOOuWymep/Caz9esDitqjc8zZRg+/GdTNY04BcSKEtqAd2j1Sa/3wGKv7tQz6gU/dhVodGsT//dt3i2b9yGAU8yyz+mdot05jnMAfUsOqx3qg6+ktVfjm+aaYbF6TDy3GFYKou9x9LIqtysuoIOdP8H7hqxseDfvNbx6ZpI3TwX5FoS6zm4/jiKzkZFwFiPJNBHxn5su8Y2OnHXwTgQTGf160wmIZaXwjBDSgcjLSKIAoDoVJzK9Vcd1b4VhPOnReRooNdZLhWOuI7YaL0Sr1wEo5PFUkuutAaFIUIdEHLId2pd1o+Tr8wLt4HPM685szdnnv8Q5id3edEo5ye7vqoN+QQ9e4SII6NRFabtGugYjHhtSIPDJZt6n4DCRKaMSd3p3Y11V/cEJ6RPmA/WEDCVo+udZKeeHvE2UNcU2zSXx4UZ1CLQ5kn9Z0KXQQqdL32kXBmZ9dbwIR+dLzBw2RF3HictzioxczhzHqZ+wV4uuN3bo2k2+FBZfPHUaI3BLZ3Fa61DZvkYDD7KCmS9aoYMa46TtFOuOisUyJ8aP+GVwnpyJ4lzjV38IR85nysbxPBlqq+vCnm9j4VwMcyNmpkipD2aUb7aeaBNYbZkAlHW0CJK/eVcSwsVAlEQkGb5E9tjb60AUyQNbZSvHIk8OwqxaWTvOuZWdEn3fVVAR8d0eSR4oOK9HV+PgMonxjJg4t878lv5D99v+/jOmz1rozibnhhDxzu0scIflQ5Mh74Biw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98315a5a-5bc4-4958-38db-08dc71fc88fe X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:22.6403 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 38/71] avcodec/mpegpicture: Split ff_alloc_picture() into check and alloc part 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: SdX4aoWKJmfF ff_alloc_picture() currently does two things: It checks the consistency of the linesize (which should not be necessary, but is) and it allocates certain buffers. (It does not actually allocate the picture buffers, so its name is misleading.) This commit splits it into two separate functions. The rationale for this is that for the encoders, every picture needs its linesizes checked, but not every picture needs these extra buffers. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 70 ++++++++++++++------------------------ libavcodec/mpegpicture.h | 15 ++++++-- libavcodec/mpegvideo_dec.c | 8 +++-- libavcodec/mpegvideo_enc.c | 57 ++++++++++++++----------------- 4 files changed, 69 insertions(+), 81 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index f605338845..840aa23c38 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -91,40 +91,27 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, return 0; } -/** - * Check the pic's linesize and allocate linesize dependent scratch buffers - */ -static int handle_pic_linesizes(AVCodecContext *avctx, Picture *pic, - MotionEstContext *me, ScratchpadContext *sc, - int linesize, int uvlinesize) +int ff_mpv_pic_check_linesize(void *logctx, const AVFrame *f, + ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep) { - int ret; - - if ((linesize && linesize != pic->f->linesize[0]) || - (uvlinesize && uvlinesize != pic->f->linesize[1])) { - av_log(avctx, AV_LOG_ERROR, "Stride change unsupported: " - "linesize=%d/%d uvlinesize=%d/%d)\n", - linesize, pic->f->linesize[0], - uvlinesize, pic->f->linesize[1]); - ff_mpeg_unref_picture(pic); + ptrdiff_t linesize = *linesizep, uvlinesize = *uvlinesizep; + + if ((linesize && linesize != f->linesize[0]) || + (uvlinesize && uvlinesize != f->linesize[1])) { + av_log(logctx, AV_LOG_ERROR, "Stride change unsupported: " + "linesize=%"PTRDIFF_SPECIFIER"/%d uvlinesize=%"PTRDIFF_SPECIFIER"/%d)\n", + linesize, f->linesize[0], + uvlinesize, f->linesize[1]); return AVERROR_PATCHWELCOME; } - if (av_pix_fmt_count_planes(pic->f->format) > 2 && - pic->f->linesize[1] != pic->f->linesize[2]) { - av_log(avctx, AV_LOG_ERROR, "uv stride mismatch unsupported\n"); - ff_mpeg_unref_picture(pic); + if (av_pix_fmt_count_planes(f->format) > 2 && + f->linesize[1] != f->linesize[2]) { + av_log(logctx, AV_LOG_ERROR, "uv stride mismatch unsupported\n"); return AVERROR_PATCHWELCOME; } - - ret = ff_mpeg_framesize_alloc(avctx, me, sc, - pic->f->linesize[0]); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, - "get_buffer() failed to allocate context scratch buffers.\n"); - ff_mpeg_unref_picture(pic); - return ret; - } + *linesizep = f->linesize[0]; + *uvlinesizep = f->linesize[1]; return 0; } @@ -156,28 +143,22 @@ static int alloc_picture_tables(BufferPoolContext *pools, Picture *pic, return 0; } -/** - * Allocate a Picture. - * The pixels are allocated/set by calling get_buffer() if shared = 0 - */ -int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, - ScratchpadContext *sc, BufferPoolContext *pools, - int mb_height, ptrdiff_t *linesize, ptrdiff_t *uvlinesize) +int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, Picture *pic, + MotionEstContext *me, ScratchpadContext *sc, + BufferPoolContext *pools, int mb_height) { int ret; - if (handle_pic_linesizes(avctx, pic, me, sc, - *linesize, *uvlinesize) < 0) - return -1; - - *linesize = pic->f->linesize[0]; - *uvlinesize = pic->f->linesize[1]; - for (int i = 0; i < MPV_MAX_PLANES; i++) { pic->data[i] = pic->f->data[i]; pic->linesize[i] = pic->f->linesize[i]; } + ret = ff_mpeg_framesize_alloc(avctx, me, sc, + pic->f->linesize[0]); + if (ret < 0) + goto fail; + ret = alloc_picture_tables(pools, pic, mb_height); if (ret < 0) goto fail; @@ -192,9 +173,8 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, return 0; fail: - av_log(avctx, AV_LOG_ERROR, "Error allocating a picture.\n"); - ff_mpeg_unref_picture(pic); - return AVERROR(ENOMEM); + av_log(avctx, AV_LOG_ERROR, "Error allocating picture accessories.\n"); + return ret; } /** diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index 814f71213e..6589b38262 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -96,9 +96,18 @@ typedef struct Picture { /** * Allocate a Picture's accessories, but not the AVFrame's buffer itself. */ -int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, - ScratchpadContext *sc, BufferPoolContext *pools, - int mb_height, ptrdiff_t *linesize, ptrdiff_t *uvlinesize); +int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, Picture *pic, + MotionEstContext *me, ScratchpadContext *sc, + BufferPoolContext *pools, int mb_height); + +/** + * Check that the linesizes of an AVFrame are consistent with the requirements + * of mpegvideo. + * FIXME: There should be no need for this function. mpegvideo should be made + * to work with changing linesizes. + */ +int ff_mpv_pic_check_linesize(void *logctx, const struct AVFrame *f, + ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep); int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize); diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 570a422b6f..663d97e60f 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -259,6 +259,10 @@ static int alloc_picture(MpegEncContext *s, Picture **picp, int reference) if (ret < 0) goto fail; + ret = ff_mpv_pic_check_linesize(avctx, pic->f, &s->linesize, &s->uvlinesize); + if (ret < 0) + goto fail; + ret = ff_hwaccel_frame_priv_alloc(avctx, &pic->hwaccel_picture_private); if (ret < 0) goto fail; @@ -267,8 +271,8 @@ static int alloc_picture(MpegEncContext *s, Picture **picp, int reference) av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height || FFALIGN(s->mb_height, 2) == s->buffer_pools.alloc_mb_height); av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); - ret = ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, &s->buffer_pools, - s->mb_height, &s->linesize, &s->uvlinesize); + ret = ff_mpv_alloc_pic_accessories(s->avctx, pic, &s->me, &s->sc, + &s->buffer_pools, s->mb_height); if (ret < 0) goto fail; *picp = pic; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 21626b58a0..d4b280da05 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1103,6 +1103,10 @@ static int alloc_picture(MpegEncContext *s, Picture *pic) if (ret < 0) return ret; + ret = ff_mpv_pic_check_linesize(avctx, pic->f, &s->linesize, &s->uvlinesize); + if (ret < 0) + return ret; + for (int i = 0; pic->f->data[i]; i++) { int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) * pic->f->linesize[i] + @@ -1112,11 +1116,7 @@ static int alloc_picture(MpegEncContext *s, Picture *pic) pic->f->width = avctx->width; pic->f->height = avctx->height; - av_assert1(s->mb_width == s->buffer_pools.alloc_mb_width); - av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height); - av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); - return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, &s->buffer_pools, - s->mb_height, &s->linesize, &s->uvlinesize); + return 0; } static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) @@ -1188,7 +1188,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) } else { ret = alloc_picture(s, pic); if (ret < 0) - return ret; + goto fail; ret = av_frame_copy_props(pic->f, pic_arg); if (ret < 0) { ff_mpeg_unref_picture(pic); @@ -1258,6 +1258,9 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) s->input_picture[encoding_delay] = pic; return 0; +fail: + ff_mpeg_unref_picture(pic); + return ret; } static int skip_check(MpegEncContext *s, const Picture *p, const Picture *ref) @@ -1600,45 +1603,37 @@ no_output_pic: s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_B ? 3 : 0; - if ((ret = av_frame_ref(s->new_pic, - s->reordered_input_picture[0]->f))) - goto fail; - if (s->reordered_input_picture[0]->shared || s->avctx->rc_buffer_size) { // input is a shared pix, so we can't modify it -> allocate a new // one & ensure that the shared one is reuseable - - Picture *pic; - int i = ff_find_unused_picture(s->avctx, s->picture, 0); - if (i < 0) - return i; - pic = &s->picture[i]; - - pic->reference = s->reordered_input_picture[0]->reference; - ret = alloc_picture(s, pic); + av_frame_move_ref(s->new_pic, s->reordered_input_picture[0]->f); + ret = alloc_picture(s, s->reordered_input_picture[0]); if (ret < 0) goto fail; - ret = av_frame_copy_props(pic->f, s->reordered_input_picture[0]->f); - if (ret < 0) { - ff_mpeg_unref_picture(pic); + ret = av_frame_copy_props(s->reordered_input_picture[0]->f, s->new_pic); + if (ret < 0) goto fail; - } - pic->coded_picture_number = s->reordered_input_picture[0]->coded_picture_number; - pic->display_picture_number = s->reordered_input_picture[0]->display_picture_number; - - /* mark us unused / free shared pic */ - ff_mpeg_unref_picture(s->reordered_input_picture[0]); - - s->cur_pic_ptr = pic; } else { // input is not a shared pix -> reuse buffer for current_pix - s->cur_pic_ptr = s->reordered_input_picture[0]; + ret = av_frame_ref(s->new_pic, s->reordered_input_picture[0]->f); + if (ret < 0) + goto fail; for (int i = 0; i < MPV_MAX_PLANES; i++) { if (s->new_pic->data[i]) s->new_pic->data[i] += INPLACE_OFFSET; } } + s->cur_pic_ptr = s->reordered_input_picture[0]; + av_assert1(s->mb_width == s->buffer_pools.alloc_mb_width); + av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height); + av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); + ret = ff_mpv_alloc_pic_accessories(s->avctx, s->cur_pic_ptr, &s->me, + &s->sc, &s->buffer_pools, s->mb_height); + if (ret < 0) { + ff_mpeg_unref_picture(s->cur_pic_ptr); + return ret; + } s->picture_number = s->cur_pic_ptr->display_picture_number; } From patchwork Sat May 11 20:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48765 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299138pzb; Sat, 11 May 2024 13:57:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVhemfodvkM43L7TPQa0F1jfefa4R5sv0TUyu/civjRB93/5h9vMal7VnOX4w8QXHY8YFjZv96FZXKV8laJo+etRF3U4sHPbuxGsA== X-Google-Smtp-Source: AGHT+IEbe8XvQOO8Zw5iJ9q8QlongzJyLKdhfBX+3mEFLVfJq3kor/Vc7DmlNDBs3hAjMs8TQGKi X-Received: by 2002:a17:906:38f:b0:a59:cdf4:f93d with SMTP id a640c23a62f3a-a5a2d5cb1dfmr381071166b.34.1715461050356; Sat, 11 May 2024 13:57:30 -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 a640c23a62f3a-a5a17b21be2si352085766b.473.2024.05.11.13.57.30; Sat, 11 May 2024 13:57:30 -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=jAZxs4bT; 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 96F8D68D2F6; Sat, 11 May 2024 23:54:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2055.outbound.protection.outlook.com [40.92.74.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51C1068D2F6 for ; Sat, 11 May 2024 23:54:27 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ol/a9PEB/yp9LmjSUNNVITxvSCu5g1Y2j4YSJFxDblNngISGjc5Cr524Lzc6ZX5WEe3AftInE0XdZBP0WRJRmBIx8fvhOB6G+5wHp3wfabnMwiM2vGNemVtYSa+4XQWvWaZHsc28TD82p+utc9IupCRIw2l63C1bx/M4I9n3rfHyjrHJF4aLjhTUhWpViunTL0sGN9XFK9SRCou+weH5D0dsdUWOdiL16gUQzE/4leY1ClXC/VmyOI6z++qM7tVSmDkK43drCpJnVbHYqUoRcBEvBqDz7rFRINB/OiXodknlCooIzJVW08jkSTWfCKvu7DemHXwyFmQP2EQswLfsrw== 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=BPy/y3FVhWiMW2AykmoMSPc5zPDpl4STsaxx1t5pRck=; b=PcC2M5NHB+261DBuoeOGDrjUucW9Qy6AB7+EVuaaNe+OLb52bHQyJ2jdM4Jwa3/rjCc4pfKID7Y6S8mqZtiEKmuXDUC/6FORrVFYRO85he0CZcnLMWyd5M1WbrpcHc9QYkNnyPYbLhzQiZg/kva2bn9t5fKbOTK46YC29EVB8T1e4RAtL7Es7iKXDS4wziKV0j5EWiQpFCXHC/0lC/0crpqnMGPyMW6XKC6G2z7m+l6xedcQQJFlBHoId6JPbTOt5O1dgbsB+92IRzSPpb+S9aE6rMucLekVtkn46dI2ieQjLT+O5NnJ+McAHXsfmlfU0JFK5IP/IG+/L+3xjuFwCA== 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=BPy/y3FVhWiMW2AykmoMSPc5zPDpl4STsaxx1t5pRck=; b=jAZxs4bTm2GBFXFVtc7UG7hbwZFCj30m/wqowzqis7RgPITIQTgaUpqL9ejc3jJJUfMXEsq5etwbj5fISeAzxgKZ9G/P0SDjwxX0orKodK0XcE9iwxv1oKWytJJ57jc6LPP14xtdf/IQ+0GTOk74ShUumgoMtulO4Ylyuv8sscpz//JXckRP10CPaC7Fg1TDgDNyALu2oVLOH0qWGAT0olZaiUJniEOTTwdfbRMy1ZmBPheIMU/SgfYaWnc2WgO7UpxIS1fTn7s42r9sUN45McAZtaYL/+ObD/OBMDPyPb6YOUbUQIODU75gtm8WGr/35rK8qmfA2DdkXy4F+2IAPw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:25 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:25 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:03 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [s2m3N09nlmW0Eg6imlPAYzLXwfrHr0s2af/h1BIucsg=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-38-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 82be3313-37a7-4752-bab0-08dc71fc8a7a X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|56899024|1710799017; X-Microsoft-Antispam-Message-Info: K+PcnqyhcuqVcYkys7nqes7XPsWu4AZXyqErNSCXllYkCF8Jg05li0at6+2JrHgTZf+xNn4GxNuQgxsCko9AyPeuc/i8MyMTaPb/eSktw+04YxWIQwqZYf8GKBcGhkWcKlBj309XOFiNJP5u409+EvVPx/KYSTnJDO2kcKrVm8IFXo6xDYtYlYG5YSU2Ua6ZtXvcNnXeRPRmXffwDKjwtpjcgWAOst+uLBEHJq5KVrfRkFRdHPhqoAVY9zrjhZwwhrvk7zKZzz9xqAelu1gRUV3F1GervY8+FS6WbxYDiHrQcmzMDrkfWPwg5tFgfubOWxc+dDY4NodXBXrF40tb8qE6JAZGSCDKyfsnKMHamDtmfwbrkWgmQGRyMNdP0Kg5P+QsmKKNhMCyyQWBYtUUxW6PReIgC7aC6+vnFv5D/RI0taO6H6Vq9rz48D0hfAx/q07IySPyF9QOibyXW7fKoVBFg7qzLO6ZI/09ecUPmbIrI+Q62RP7SfLb4hGIDlCuDMpvfOwkmXem6m0kIur/Uf2r0coHOpBOUlPJdcBKMbUS4yaQHLQ9qcWg1znKUnEaF27cf+BR/1qiGFi7GHIAKgq3fbi9FiJYZM/eFdE9BuDHKyY0mNFznxPZHJdp/pdj X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LQQfXfDUP0HlHKVtit9ErEA7P7u1mU1SuX4jOt50QQf7h5iUbtSuE5JLiF7HaQmqe42xVtaGK+dqNbhLPgwxVhPg72hyOckk7BtOoMff1NNFtcZzUi19V9JurxrH6BHZxNSDVg6OxWVmKPI2Cr5HJ/hdUl16qsbkwKjAjzGKqKueCuW6zxvZIATJB3ClVbW4M7pbySfvE29he8PAWPSSVXNxtSbXn1fNP89eTO2WPb4zm0GVLiuLuPRlimskYymylUOtcXOgwBXmEUnR4gEVD3Hk7qgcFirnqcRu3vgpILbzOdTrXeuxSrhhQwX5ii7ymMMugCKjasOmjKPsr2nBRZI1lM1mbyamu5AB0PvI2pR9fKOMz79ZTQ/c4Iow9RjIwRjmSB1vfSs/z3lRWLeBj6NcN9lXhCwTKudfMC7oHAbQk9aYEBkGXeMdas26Rmq3BoT7aBd1d5KeiL6UBer76qOE38cY+qX/k2uRpfTPB0/4OD76dLebjq2r31We7bktjGDwYuI6YQtDgA7i1xrwm5s5WYgqbbglct8SBSFEKTLHrY/lA3SoC2a/oO6Ty5URHUjKKBpGR+FwQCRlWL19kjd738RCVUhmbDv4FYhHodNBOipfgtJE2RmDcP+wz4aBLbcvjxvaolXBlEkwgMTWiq3NZsMiB/0HsrQy6stJjxMnnt9GqpbAVw/nIvZDXZXRgw3rJLXcyt6yUc1ctWgETWAVhDiYFiUwNDqiStlHOF9BVd2nuV/1aUsQeEYKn3iDpd2Zn7btX5pgpbE4C51Z9n/KVvXEJA9WyTouYK7Dh6q8X2GzmxY50MzrHX8d3q5RffHJwVg3V1nCAV8DoHHtqGfmm9lXX4lMRfsuTH663DD9v8JBvIxqCcFRsUm+KujB2ieD2gT5haXlsILobaSazaVZ+D8Ie594DJVqheNcnSMAiHRXDy7FSCVLiFgmwEGLiw4RTl2DK+U1w0JbM1MqhLY3tuf+ju5qnjzV5nacCg2EgmVyWC47J/iEkKcvSo0lcbEDes56v2OCA7/H595P+TvCjvJvcYoEzfA0dNyblSg4d/ak3bLFA/0baMwixThC3R7odjxvUoxCxYDjGu4LjymwJ7lm2ZYJhHbw5egxTnLT5JDDlvHdlaFVHJMneO0hdV+jIqe0vTMVJm64NDn3z6OEcPJ3corbYKdSuSYzFfj1RAWEkJaD73WbTNbd2BwCdz/zp/zE2iOonRmmsMcFsYOfEimeoyethVL2wtKOUh9MswV10ITSkRaH7d1oqsV3aMp2FGICqWhZp6dCej/SWg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82be3313-37a7-4752-bab0-08dc71fc8a7a X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:25.1333 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 39/71] avcodec/mpegvideo_enc: Pass AVFrame*, not Picture* to alloc_picture() 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: fDqkuUuNMgpK It now only deals with the AVFrame and no longer with the accessories. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index d4b280da05..c6f4cd9b0e 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1091,30 +1091,30 @@ static int get_intra_count(MpegEncContext *s, const uint8_t *src, return acc; } -static int alloc_picture(MpegEncContext *s, Picture *pic) +static int alloc_picture(MpegEncContext *s, AVFrame *f) { AVCodecContext *avctx = s->avctx; int ret; - pic->f->width = avctx->width + 2 * EDGE_WIDTH; - pic->f->height = avctx->height + 2 * EDGE_WIDTH; + f->width = avctx->width + 2 * EDGE_WIDTH; + f->height = avctx->height + 2 * EDGE_WIDTH; - ret = ff_encode_alloc_frame(avctx, pic->f); + ret = ff_encode_alloc_frame(avctx, f); if (ret < 0) return ret; - ret = ff_mpv_pic_check_linesize(avctx, pic->f, &s->linesize, &s->uvlinesize); + ret = ff_mpv_pic_check_linesize(avctx, f, &s->linesize, &s->uvlinesize); if (ret < 0) return ret; - for (int i = 0; pic->f->data[i]; i++) { + for (int i = 0; f->data[i]; i++) { int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) * - pic->f->linesize[i] + + f->linesize[i] + (EDGE_WIDTH >> (i ? s->chroma_x_shift : 0)); - pic->f->data[i] += offset; + f->data[i] += offset; } - pic->f->width = avctx->width; - pic->f->height = avctx->height; + f->width = avctx->width; + f->height = avctx->height; return 0; } @@ -1186,7 +1186,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) return ret; pic->shared = 1; } else { - ret = alloc_picture(s, pic); + ret = alloc_picture(s, pic->f); if (ret < 0) goto fail; ret = av_frame_copy_props(pic->f, pic_arg); @@ -1607,7 +1607,7 @@ no_output_pic: // input is a shared pix, so we can't modify it -> allocate a new // one & ensure that the shared one is reuseable av_frame_move_ref(s->new_pic, s->reordered_input_picture[0]->f); - ret = alloc_picture(s, s->reordered_input_picture[0]); + ret = alloc_picture(s, s->reordered_input_picture[0]->f); if (ret < 0) goto fail; From patchwork Sat May 11 20:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48766 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299170pzb; Sat, 11 May 2024 13:57:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXgpIdoFaJhKv1z0h4IltVROKACyuZMf4LFhkB9PiUKymoOP/lKxSA01odMjgOxnkshBW38hmHIP6aYwpUfAmDBeyqmmsRkkClRKg== X-Google-Smtp-Source: AGHT+IGasBbM+lQupBIRURIgQ25ws35Um+6LygHC981hCUbvXeApEnBeGSehOu5+JUlS2kvdkfgI X-Received: by 2002:a17:906:a845:b0:a59:9f7b:68d4 with SMTP id a640c23a62f3a-a5a2d5734eemr373463766b.28.1715461058575; Sat, 11 May 2024 13:57:38 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a1797cab8si332050766b.258.2024.05.11.13.57.38; Sat, 11 May 2024 13:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=u+EzIab9; 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 EFA0E68D5EC; Sat, 11 May 2024 23:54:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2067.outbound.protection.outlook.com [40.92.74.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 42AED6801F2 for ; Sat, 11 May 2024 23:54:30 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lEvBAzL7Z9fF4QAjMrlDEKzniFcgurh5rbA1XP5rIzn6svuwgNqg9TcFxIbLutp9teHOG59pMl9PbNSCt3khGuygRXgOCsGzfqzh59fGjMAjL/Z5BcATPQ5iZNKHVdlGuc6ozTphAvJr6TRQswB+3nNtO9BuN/oRqQsX0IxYI9DQzCPQWytKfCAl6GnQ+BGe+EnwtPN9eZVsawDAq1sY6CCkgSlRp4bx8xzdHO+XBWVixasyzdZSFj+G4LdUvKoF1ibqr5HYXm7rNcUDavHnTfXsIxFqcjgNmnuShtqwZfQZMg6Yq5VfBwIkFEPHPIzvMsJEGsEcyouIKXAwWutk9A== 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=lztE0fSL3kHM5l2hvkDQSvAVX3Qnq/FcO7ELfSnGxcc=; b=JCJU15RPFaXopW077LykyXPBDSJ9WU3sypz8w8i7QBXNk1lOyYTz3at/segJSNqqsV1PNb6GqC0RTh52RSIHFCYggdIf3sgR1ySwvYaM+Qakj/TYXBVrk2Wz/o+lQdtQe6ViWUjK2216bmrxrH0aXQpDfliEjDJsZWh8kbKMCaBxZmsQOBrB57xRu7zh6fL78yymZxApz0nAXbsgbsMHHzR8CZUOQqK2N30CejYSFnPYdcK9rt++SvSn1FOHDg1aHKO4K8ildg+s99QsAKe+uoMxwLMYgPZnt/hV63PFQN4dKw041MXWUv9xMylkdVcYPwXETSzWSeE0W8Y9GfQpNg== 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=lztE0fSL3kHM5l2hvkDQSvAVX3Qnq/FcO7ELfSnGxcc=; b=u+EzIab9+6C5MkbAe71f0hAczgzF7RXsFidF5oIxxaUzkRigCuv1MdyYm48MpdS8BxdLpfSDC/haSbgimxX3OqTMNTzTfUNlw48es8d8XMwgwWOt8K2Io3CxluARQ/uGs1TqZFEktP064LIMqO4ciEWyL1Ua2A0JO8SplcEnTOkWAaHYZf3xqjqWqJST8UWE5okKSVezC24zzt/ZDimOI0IWdMqgY55fabMVnEq05DQHit5iV9oTtoreTSD2hCYd8+52ebxPlORPoTg50n03Gd7r4020GfR9cb783zDl8+Ue7tkULE6CrqnzA8jqvnEG6GGyK+nhd3gdwd9430wSKw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:28 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:28 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:04 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [JFkrSF96I84miB/WJU7jukgysIYw11Hj+scbl6LsW1U=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-39-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: af5d24fd-e85a-41bd-52a0-08dc71fc8c39 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: nLH6/JyXrXvDw2CHUxtHYKNj5QsSdXzqQkKC2DuEwVPFrdGvm+jxvH0bvgAb77Qhr2kpPe0GoMrNrz1Jg1dSN/vGP+rhavwtnIapsqIkpsHdVgkkty61O8Mxvx8rYS+Bz/FXLJdf3zkVVYBb8R5POum8GB6JsxrBSdvMDEyo0oehNgA2xu0SS+TmZJHY4Xw4QpzK5ntWcaRcTUlJyTB9D3aj4+Lr16HDvdnGtkoJgcsunTjwxMYKUndTyTGenTmQEDO0MgEcUbm8+LHyZkHlz0q2smLhjv1fiD05mQQT5JMzQAivI6q7VRLXI5dXEH7amVRgwEkKGqvFvCy5pGNbA0zAvcmejZI5vMa/m91c59ZxgmajJDLA2kGJx+3VoCxSZ/929mri1BuFxdzrZ7d0ZjMXCwVHETLSaOX05k8kMHmyhV6ddbD2bbPtKRxz5pyEhFg0pRd/sST8JT6v+hXJKkm5Fqc9GJi52ZEJd4MdeSliZnegl80iE1LIN46YsUEwYcx80zxoiD8mRJ0k1L+HkCuG8kV2x6J5P7Q5clo4DvQnP9RUK/W2FxovHFs1XomLV9iC+XN40GdXjFL44fCl3fqjRgSfI23wzRLO6XxSLbR+fmrgkcwRohGtbVGEkDe5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j5DbTFf1K2cOso0v/HRyjJ1il5IuW+viGfz+Pv/P56X+PSlPHzOyH4pIoNvixTJy6ffEtzC6FsTxYgx4Mq7InB5KnsGW1CCzDxqMh7CRKyWzjZs7pBLyJ0jsNApdU0HMY8FbxYaSAPmX2qk3Yuk0zyPf0yy68xFn1qViWsMdwcV0dWPk6fOrVvIss5XPJW8S3+b/SFf05f4bhqdk4Wkfct/c4i4s9bNWbBpJZhN9pK5mZptzgQH2c9lf0GRw1Mm0rNaeDdB9ZbCaRDUZFA/YfwDUD0s49wce4iLI+NM4Ga7dV7MEWOdG1DFkshjcYPOYru/rEz8hYUzKF8HiJCYEmCjDQZYLJwMlcZIj13In/AjYtrzORQlgzDFb2FiUrjhBNWZtEL2B5jX1RGCC1FS2aRAFexNTsZHlf6BnrwcjyryMSiNRlfawQH/FkwQyb4oWNr/Ky9y9XKvdvTKMV4FK11vvlpCU1g++tE9HPP+8idaiF/Xq0F8JVRWB05Nb7bguqUZPPyXiASvQSbX/8z2A+8GO5iMD8qSDzZX8I2K64P1hcGec3S5cMDralDDvOcr1KJwzVcxjFWFpRCQxnd9IU+wmM5B0tHKMUVTc6h0CLqRIw+ov6l5qmnJ0xW1pjIJx0XZ3ayrUf2u3Rcr8N7zeK43tSiPOGOWMMuCKbiTl/RcUd6V7jdvDYvjgS3ADSTDccM7grns3o+PonDWVwNq72th/mdk3w/MdPDmc1E4jqcHdp/nSRHf/dm9ZIshPJnEnRNw2H/IalTJqWlIc59dUeMk+jvy8NC83SXJ0nQyYpFHinScoxf0q5Lf7d+FzVdyRa061QigaKYAWLDWi/uFEtmtYLscG3NvodTuegNx1nCROGHi0CHqMsInXnRl4eZ7uo3mIRX1qGghMa5K9FA9W5bXMRwbuaPFVQVFMcibeUOzUiCPyP+ExuvHAuGAGzPsGWUt4N6A/Cg5RShB6Zn4DGGjdreymws6U4RjtgECsyNybRsQg8WRsSL8JLpGUeOQkq1egcQHBYHZDFGcmfeZd6TtEJSnk9xPDiXodXdyUMuaQKlocjnQjFRHnfhoxbB7k0DBTms6G9xQ7LbGgh/w0R6yQdEtIHUvJu34IdlloSsjvu531qQb7GNvz9knbDMqOQPglf50pZ971OcBBn4Leae48YWPWoDwQdGRpRKPNUJAQMnn3XO8Htn1sJB2b9ZlRFR0vdO8N5RFXqX0OtMMi9g+DAvtnybkRH4fFzz+KgX9MI8fClBsmJFvF+6qyZ9EOFpuwxrGqIoT+ooomtuLxmA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: af5d24fd-e85a-41bd-52a0-08dc71fc8c39 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:28.0314 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 40/71] avcodec/mpegvideo_enc: Move copying properties to alloc_picture() 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: jqZ8H1WLfwj8 This way said function sets everything (except for the actual contents of the frame's data). Also rename it to prepare_picture() given its new role. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index c6f4cd9b0e..393b21823f 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1091,7 +1091,11 @@ static int get_intra_count(MpegEncContext *s, const uint8_t *src, return acc; } -static int alloc_picture(MpegEncContext *s, AVFrame *f) +/** + * Allocates new buffers for an AVFrame and copies the properties + * from another AVFrame. + */ +static int prepare_picture(MpegEncContext *s, AVFrame *f, const AVFrame *props_frame) { AVCodecContext *avctx = s->avctx; int ret; @@ -1107,6 +1111,10 @@ static int alloc_picture(MpegEncContext *s, AVFrame *f) if (ret < 0) return ret; + ret = av_frame_copy_props(f, props_frame); + if (ret < 0) + return ret; + for (int i = 0; f->data[i]; i++) { int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) * f->linesize[i] + @@ -1186,14 +1194,9 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) return ret; pic->shared = 1; } else { - ret = alloc_picture(s, pic->f); + ret = prepare_picture(s, pic->f, pic_arg); if (ret < 0) goto fail; - ret = av_frame_copy_props(pic->f, pic_arg); - if (ret < 0) { - ff_mpeg_unref_picture(pic); - return ret; - } for (int i = 0; i < 3; i++) { ptrdiff_t src_stride = pic_arg->linesize[i]; @@ -1607,11 +1610,8 @@ no_output_pic: // input is a shared pix, so we can't modify it -> allocate a new // one & ensure that the shared one is reuseable av_frame_move_ref(s->new_pic, s->reordered_input_picture[0]->f); - ret = alloc_picture(s, s->reordered_input_picture[0]->f); - if (ret < 0) - goto fail; - ret = av_frame_copy_props(s->reordered_input_picture[0]->f, s->new_pic); + ret = prepare_picture(s, s->reordered_input_picture[0]->f, s->new_pic); if (ret < 0) goto fail; } else { From patchwork Sat May 11 20:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48767 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299184pzb; Sat, 11 May 2024 13:57:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/Bfx5kMzFb9ehNcBzU93dxIXRJDsaSQU2aXJU2/+ss4A7/wHDqRWcPIwg7jl7I0ak8F6ZF/59Y1dwtOXBpUCissrpPie88XoA+w== X-Google-Smtp-Source: AGHT+IH1Ns3prRmgRwz+Zfq07rGCYMH2zm8SCQxGHz4TJSNdoqaaOT2S1SsJ08BaVKBupA4gm8v8 X-Received: by 2002:a50:8d16:0:b0:572:459a:7aed with SMTP id 4fb4d7f45d1cf-5734d6f55f9mr4019360a12.37.1715461067381; Sat, 11 May 2024 13:57:47 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733beac77fsi3349040a12.55.2024.05.11.13.57.47; Sat, 11 May 2024 13:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=CHEbuq3f; 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 353E568D742; Sat, 11 May 2024 23:54:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2038.outbound.protection.outlook.com [40.92.74.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B60168D67A for ; Sat, 11 May 2024 23:54:36 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MaglsSeOdLw9vD0pHalq7uPBzui4ZnplsJsYBkWYdt7Ez81I4lgraZ3QfniDmSw8ik/lBY+KaPxsK1ZTDU8C5HgvIYDLshOkRpp+KPkUaI3lfGALqW+rJPezTKrLkAFVKlplpewexmlkZLIG4PosZuM2A1d/Oky5ebqWHwIf8D16c0PBVqP+ZH49BQiWtJpnhOymSMkrD8BMfNUWtlyUC+z/GZ2gXaj+3el8paewAGUFbn/ctcZw1LFhJZpMLTx8HWfCS5qogRlb9ydas8eohzegkUhwCVhB46CTMNB7TKsR/rLE0DbLbycCEYfRp1mD1WNH5JDwwU+msfJ+IMcdXg== 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=7ZrvhlggSPxpWUd/8cnNNblepNCZfzAK9YjkZ5qM3y4=; b=j2ZX43Ib8n4mBQKfzt7onuUg7wMrHojkhb2juKiH2lAYdJRCav9IvhSP7ztqa1+Y1GH1r/CtS/Spifu/TpsBk4QKBmmMqN1UndQk6ixvwE6XDSwqr4ViOOca/TT1UcWRoNvsat/uhHbI7bqt5vSC1nXtu5+zB1rgkq0VrgqQM46oPPZ0yhbMihK7sWHf5qKWbDmUoICk1X8sY4hJccdV3eQmZwM3VxJWgfY8XOIEuKaFudAAW6HYTeU7K6Wudmv48w2ymZfBGQdEOWCLGefLe1bvSaIdXs77mQujF+w4JFDp9Tl82GTJMTl++5kjJQR2FbNJ8Dj78ChZsJdwJL/kdw== 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=7ZrvhlggSPxpWUd/8cnNNblepNCZfzAK9YjkZ5qM3y4=; b=CHEbuq3f/sSRujptL7JOrPB678o273gMEPyT6va3x1vLUSb0KQtfBNIIPDpuKBBlninrF/3dB88tVSOMvD0rcq+Bkx7fefLqdSnOsatHLYnKpQsDO4oDzBbEluXhh2KU8XpSMRPmZNnUf+RrToFwfM+byrs1FE+eq3GZh7ET4JhDJbmNQSoIDvw2UcqU2O4DxZa1c+AS3bB6kO+asnH7ZW04YHSsyIp/urpkvwj3XamBec/y8sOpNJHQttlez5CDdLSZH6xqeRsJiVI4MVRD4NIcSpRHViIU0aTb3EXD4gZhm4WeRHDCG438OAMI+drd5tjUljgzUYJRRil/SNMpCw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:34 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:05 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [bOmRZvRYmBcXpNHYQNL5jE4MxJlR1Y/JZ0Dg1/eTPGY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-40-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 449b386d-5c51-48ac-8329-08dc71fc8ffa X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|56899024|1710799017; X-Microsoft-Antispam-Message-Info: Ktdamtz2vNLGSHHDJf4YD0M4yAJoKKG5tUCcseVIRa1F4Dw0l0jlWnvNuBVEry8t+kNtm0AyhL0tRm9BUQ4rKAr4vUQ4XVd7q4r26drYo1rK5u4qUZiJc5JQWgWCkpdJ9gEGKT9IHZPTHX1bRPA84TUQyLZ7bHaXTH3onifcgnuYB4Hp01FhRWNlSphYICfrQir/r4VXYqDZHBt3iSxtprT3Wb9akNyLYdzLQHw7QXrAVJAE505OH60iU4hY0zxaP7jwOweyZ5bcjZzqMwYWidhcnFVTYkpbEbO0dscc+DNGxBs8bOBs11O0TJZqkCjQjRu4ctWDtrb6OV9JDOHyVBkuStH1GuujzIRn8YT3giI+UdFGmkawdi6Dz/DGglbZF+Cg8FWNXvnlRvZ5HSG2cOY0HNNzV/GMdItIQymtmw/TwIlY3nh5fyaicZywnJihM3IJ8vjniRIk1sQUwKE7hReqNdEzj96SyBac5BDH2BVrLOmg9paby+UYtMHYaaZwGsprCd/RFVRG86K6T784eBZGImvre4da17jfR5TKDsiTWWvTQg5G2NMkiMPjOB8AbNmpA/MCV85x/0Sy5irYlnFGer1bF1bsdq7pW7wNQvUbBgMg/ifeZeoAGD55QYGG X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SC8xtfatofdHo4cRJN+aHyBrK67nRHFdNasjm9ssoLLKOoXyUl/YSkaGiK1cFjkf7UixGDSc2rfAPLzL1oFohL9js0GJBv5Z0+v2keH8Wr05y8UHlWA6g4PdR8sHiilRhaeqAR/7W434rt9/5RdCOxsqH80Qp9LoGLUbwzN+vztIeRiIVAV/iNVTsdAmfFhS6w4wr93RXjt9WClDDyxQNsBpzABj2LCKYtu7hHVxm1RYQbT+Q7xNzp2U6P8jSrR5YNZc7A03eOGi79jrFzy+hKtFyhV5tZmo0SEHZgss7qC/P6ZcKQyZzoTfM/cjLNJhKavr+PQnAgBmwy4HXCw1pC9qNvAsNq7A+rdh88MLmWCp5gjBEKJUMnC/h9PCFuEbySJWz7Hb71BU5ToA49jV/dZZH7zJLTFPb94AoB+tL/9EWtvb943aIBA2c+n0XcGSWJzMB1H789x2Dc+IILtWmEl8n5BE1NXX0tSeqQMo54O8bw6CSfsNqEexKuVvd1ja6V3hdFsyeNpbrsg64KYYYLcZKRnEz1/IESi48MrFjUR/Fm2GU1QX2M6z3zpW+7WHnlKLaZi+EzaWphXOCmQjkF1S6gat5FrsAOJzOk42yQdT+dl4W1qQimCuwUO1IUET7guolm1hApVpUs/U0y72ebQD4zFzQtMZoCl03HT7FNPU1u0R2bEbF3mESHkjvrCjHIK58+aEMNyptdRvKqu/qMrPX/5sDaQakxAqVC2nf/h0OAA7q96HCGa8IlSMixcEtdd4Kdz8xE9J9vZPEExGg+h9Fj/rht2dhMNFWO3+95+yily0prrExEjqhdQGFum0FvaIH9ZS3watW6w/oWCI8/xW/Yr64jpW1XiBA4WjWcrgJPKtJJT5Y8JfMbE/BQ2BfhdFAlo93GGFrsooAyDkF0UjEq+ZEhe9E2PIfV3PwajLH9FtdbdJTtHLtR1/+uWDXUghKwAqX7RG+YxZVIzU7/x5lWqbRUTfyxw3SaWBiKd0JpsI0FMMGIngg4MVF5pcGThxmY29A3BUHbbhBoJ0uG3u90CTPONgMs8QEq/2lMd1HFG+qM3cl3AKGuym9269RYPzoxVKU848+uDQ1Cvd5Todule0qwft0JeAv1NnbAw+w6AgQlnoi9752AW04ySrROzlEFf81kBXNI7yKpoLG1FTs4krECVd9fFgFTloper7ILeZZwg/KKZUxJgc+Z5dSqxIajeRB5788lTIbzNOOv7zoAH4ZqNB6vPh2BFIiF5Jbf0jICP5a+MC7u/lEqVBXXSPpAKYNlbuT9YGLEQsjg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 449b386d-5c51-48ac-8329-08dc71fc8ffa X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:34.3874 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 41/71] avcodec/mpegpicture: Rename Picture->MPVPicture 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: W5t4qzmZZiKm Picture is just too generic. Signed-off-by: Andreas Rheinhardt --- libavcodec/dxva2_mpeg2.c | 2 +- libavcodec/dxva2_vc1.c | 4 ++-- libavcodec/intrax8.c | 2 +- libavcodec/intrax8.h | 2 +- libavcodec/ituh263dec.c | 4 ++-- libavcodec/mpeg4videoenc.c | 2 +- libavcodec/mpeg_er.c | 2 +- libavcodec/mpegpicture.c | 16 ++++++++-------- libavcodec/mpegpicture.h | 18 +++++++++--------- libavcodec/mpegvideo.h | 18 +++++++++--------- libavcodec/mpegvideo_dec.c | 13 +++++++------ libavcodec/mpegvideo_enc.c | 6 +++--- libavcodec/mpegvideo_motion.c | 2 +- libavcodec/mpegvideodec.h | 5 +++-- libavcodec/mss2.c | 2 +- libavcodec/ratecontrol.c | 2 +- libavcodec/rv34.c | 2 +- libavcodec/vc1dec.c | 2 +- libavcodec/vdpau.c | 2 +- libavcodec/vdpau_mpeg12.c | 4 ++-- libavcodec/vdpau_mpeg4.c | 2 +- libavcodec/vdpau_vc1.c | 4 ++-- 22 files changed, 59 insertions(+), 57 deletions(-) diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index fde615f530..d29a5bb538 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -45,7 +45,7 @@ void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx, DXVA_PictureParameters *pp) { const struct MpegEncContext *s = avctx->priv_data; - const Picture *current_picture = s->cur_pic_ptr; + const MPVPicture *current_picture = s->cur_pic_ptr; int is_field = s->picture_structure != PICT_FRAME; memset(pp, 0, sizeof(*pp)); diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index 7122f1cfea..f536da1008 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -46,7 +46,7 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - const Picture *current_picture = s->cur_pic_ptr; + const MPVPicture *current_picture = s->cur_pic_ptr; int intcomp = 0; // determine if intensity compensation is needed @@ -336,7 +336,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, uint32_t size) { const VC1Context *v = avctx->priv_data; - const Picture *current_picture = v->s.cur_pic_ptr; + const MPVPicture *current_picture = v->s.cur_pic_ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; unsigned position; diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index 40085c69ce..f1dce86a50 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -730,7 +730,7 @@ av_cold void ff_intrax8_common_end(IntraX8Context *w) av_freep(&w->prediction_table); } -int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, +int ff_intrax8_decode_picture(IntraX8Context *w, MPVPicture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int dquant, int quant_offset, int loopfilter, int lowdelay) diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h index 8e22361f1f..b9f8c4250b 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -106,7 +106,7 @@ void ff_intrax8_common_end(IntraX8Context *w); * @param quant_offset offset away from zero * @param loopfilter enable filter after decoding a block */ -int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, +int ff_intrax8_decode_picture(IntraX8Context *w, MPVPicture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int quant, int halfpq, int loopfilter, int lowdelay); diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 492cb5e0d4..2e4d74adc8 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -719,7 +719,7 @@ static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb) #define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0])) #define tab_bias (tab_size / 2) -static inline void set_one_direct_mv(MpegEncContext *s, const Picture *p, int i) +static inline void set_one_direct_mv(MpegEncContext *s, const MPVPicture *p, int i) { int xy = s->block_index[i]; uint16_t time_pp = s->pp_time; @@ -750,7 +750,7 @@ static inline void set_one_direct_mv(MpegEncContext *s, const Picture *p, int i) static int set_direct_mv(MpegEncContext *s) { const int mb_index = s->mb_x + s->mb_y * s->mb_stride; - const Picture *p = &s->next_pic; + const MPVPicture *p = &s->next_pic; int colocated_mb_type = p->mb_type[mb_index]; int i; diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index c5b5b3ea50..036171fe70 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -652,7 +652,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], for (i = 0; i < s->max_b_frames; i++) { const uint8_t *b_pic; int diff; - Picture *pic = s->reordered_input_picture[i + 1]; + const MPVPicture *pic = s->reordered_input_picture[i + 1]; if (!pic || pic->f->pict_type != AV_PICTURE_TYPE_B) break; diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index 360f3ce3e0..21fe7d6f71 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -22,7 +22,7 @@ #include "mpegvideodec.h" #include "mpeg_er.h" -static void set_erpic(ERPicture *dst, const Picture *src) +static void set_erpic(ERPicture *dst, const MPVPicture *src) { int i; diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 840aa23c38..429c110397 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -30,7 +30,7 @@ #include "refstruct.h" #include "threadframe.h" -static void av_noinline free_picture_tables(Picture *pic) +static void av_noinline free_picture_tables(MPVPicture *pic) { ff_refstruct_unref(&pic->mbskip_table); ff_refstruct_unref(&pic->qscale_table_base); @@ -116,7 +116,7 @@ int ff_mpv_pic_check_linesize(void *logctx, const AVFrame *f, return 0; } -static int alloc_picture_tables(BufferPoolContext *pools, Picture *pic, +static int alloc_picture_tables(BufferPoolContext *pools, MPVPicture *pic, int mb_height) { #define GET_BUFFER(name, buf_suffix, idx_suffix) do { \ @@ -143,7 +143,7 @@ static int alloc_picture_tables(BufferPoolContext *pools, Picture *pic, return 0; } -int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, Picture *pic, +int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVPicture *pic, MotionEstContext *me, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height) { @@ -181,7 +181,7 @@ fail: * Deallocate a picture; frees the picture tables in case they * need to be reallocated anyway. */ -void ff_mpeg_unref_picture(Picture *pic) +void ff_mpeg_unref_picture(MPVPicture *pic) { pic->tf.f = pic->f; ff_thread_release_ext_buffer(&pic->tf); @@ -203,7 +203,7 @@ void ff_mpeg_unref_picture(Picture *pic) pic->coded_picture_number = 0; } -static void update_picture_tables(Picture *dst, const Picture *src) +static void update_picture_tables(MPVPicture *dst, const MPVPicture *src) { ff_refstruct_replace(&dst->mbskip_table, src->mbskip_table); ff_refstruct_replace(&dst->qscale_table_base, src->qscale_table_base); @@ -223,7 +223,7 @@ static void update_picture_tables(Picture *dst, const Picture *src) dst->mb_stride = src->mb_stride; } -int ff_mpeg_ref_picture(Picture *dst, Picture *src) +int ff_mpeg_ref_picture(MPVPicture *dst, MPVPicture *src) { int ret; @@ -260,7 +260,7 @@ fail: return ret; } -int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared) +int ff_find_unused_picture(AVCodecContext *avctx, MPVPicture *picture, int shared) { for (int i = 0; i < MAX_PICTURE_COUNT; i++) if (!picture[i].f->buf[0]) @@ -283,7 +283,7 @@ int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared) return -1; } -void av_cold ff_mpv_picture_free(Picture *pic) +void av_cold ff_mpv_picture_free(MPVPicture *pic) { ff_mpeg_unref_picture(pic); av_frame_free(&pic->f); diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index 6589b38262..f0837b158a 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -52,9 +52,9 @@ typedef struct BufferPoolContext { } BufferPoolContext; /** - * Picture. + * MPVPicture. */ -typedef struct Picture { +typedef struct MPVPicture { struct AVFrame *f; ThreadFrame tf; @@ -91,12 +91,12 @@ typedef struct Picture { int display_picture_number; int coded_picture_number; -} Picture; +} MPVPicture; /** - * Allocate a Picture's accessories, but not the AVFrame's buffer itself. + * Allocate an MPVPicture's accessories, but not the AVFrame's buffer itself. */ -int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, Picture *pic, +int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVPicture *pic, MotionEstContext *me, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height); @@ -112,11 +112,11 @@ int ff_mpv_pic_check_linesize(void *logctx, const struct AVFrame *f, int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize); -int ff_mpeg_ref_picture(Picture *dst, Picture *src); -void ff_mpeg_unref_picture(Picture *picture); +int ff_mpeg_ref_picture(MPVPicture *dst, MPVPicture *src); +void ff_mpeg_unref_picture(MPVPicture *picture); -void ff_mpv_picture_free(Picture *pic); +void ff_mpv_picture_free(MPVPicture *pic); -int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared); +int ff_find_unused_picture(AVCodecContext *avctx, MPVPicture *picture, int shared); #endif /* AVCODEC_MPEGPICTURE_H */ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 3150f337c0..6d96376a6e 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -128,9 +128,9 @@ typedef struct MpegEncContext { int mb_num; ///< number of MBs of a picture ptrdiff_t linesize; ///< line size, in bytes, may be different from width ptrdiff_t uvlinesize; ///< line size, for chroma in bytes, may be different from width - Picture *picture; ///< main picture buffer - Picture **input_picture; ///< next pictures on display order for encoding - Picture **reordered_input_picture; ///< pointer to the next pictures in coded order for encoding + MPVPicture *picture; ///< main picture buffer + MPVPicture **input_picture;///< next pictures on display order for encoding + MPVPicture **reordered_input_picture; ///< pointer to the next pictures in coded order for encoding BufferPoolContext buffer_pools; @@ -156,13 +156,13 @@ typedef struct MpegEncContext { * copy of the previous picture structure. * note, linesize & data, might not match the previous picture (for field pictures) */ - Picture last_pic; + MPVPicture last_pic; /** * copy of the next picture structure. * note, linesize & data, might not match the next picture (for field pictures) */ - Picture next_pic; + MPVPicture next_pic; /** * Reference to the source picture for encoding. @@ -174,11 +174,11 @@ typedef struct MpegEncContext { * copy of the current picture structure. * note, linesize & data, might not match the current picture (for field pictures) */ - Picture cur_pic; ///< buffer to store the decompressed current picture + MPVPicture cur_pic; - Picture *last_pic_ptr; ///< pointer to the previous picture. - Picture *next_pic_ptr; ///< pointer to the next picture (for bidir pred) - Picture *cur_pic_ptr; ///< pointer to the current picture + MPVPicture *last_pic_ptr; ///< pointer to the previous picture. + MPVPicture *next_pic_ptr; ///< pointer to the next picture (for bidir pred) + MPVPicture *cur_pic_ptr; ///< pointer to the current picture int skipped_last_frame; int last_dc[3]; ///< last DC values for MPEG-1 int16_t *dc_val_base; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 663d97e60f..97efd4fe81 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -228,11 +228,11 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s) return err; } -static int alloc_picture(MpegEncContext *s, Picture **picp, int reference) +static int alloc_picture(MpegEncContext *s, MPVPicture **picp, int reference) { AVCodecContext *avctx = s->avctx; int idx = ff_find_unused_picture(s->avctx, s->picture, 0); - Picture *pic; + MPVPicture *pic; int ret; if (idx < 0) @@ -283,9 +283,9 @@ fail: return ret; } -static int av_cold alloc_dummy_frame(MpegEncContext *s, Picture **picp, Picture *wpic) +static int av_cold alloc_dummy_frame(MpegEncContext *s, MPVPicture **picp, MPVPicture *wpic) { - Picture *pic; + MPVPicture *pic; int ret = alloc_picture(s, &pic, 1); if (ret < 0) return ret; @@ -475,14 +475,15 @@ void ff_mpv_frame_end(MpegEncContext *s) ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); } -void ff_print_debug_info(const MpegEncContext *s, const Picture *p, AVFrame *pict) +void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict) { ff_print_debug_info2(s->avctx, pict, s->mbskip_table, p->mb_type, p->qscale_table, p->motion_val, s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample); } -int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, const Picture *p, int qp_type) +int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, + const MPVPicture *p, int qp_type) { AVVideoEncParams *par; int mult = (qp_type == FF_MPV_QSCALE_TYPE_MPEG1) ? 2 : 1; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 393b21823f..251b954210 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1129,7 +1129,7 @@ static int prepare_picture(MpegEncContext *s, AVFrame *f, const AVFrame *props_f static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) { - Picture *pic = NULL; + MPVPicture *pic = NULL; int64_t pts; int i, display_picture_number = 0, ret; int encoding_delay = s->max_b_frames ? s->max_b_frames @@ -1266,7 +1266,7 @@ fail: return ret; } -static int skip_check(MpegEncContext *s, const Picture *p, const Picture *ref) +static int skip_check(MpegEncContext *s, const MPVPicture *p, const MPVPicture *ref) { int x, y, plane; int score = 0; @@ -1355,7 +1355,7 @@ static int estimate_best_b_count(MpegEncContext *s) FF_LAMBDA_SHIFT; for (i = 0; i < s->max_b_frames + 2; i++) { - const Picture *pre_input_ptr = i ? s->input_picture[i - 1] : + const MPVPicture *pre_input_ptr = i ? s->input_picture[i - 1] : s->next_pic_ptr; if (pre_input_ptr) { diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 964caa5afb..56d794974b 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -514,7 +514,7 @@ static inline void apply_obmc(MpegEncContext *s, const op_pixels_func (*pix_op)[4]) { LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); - const Picture *cur_frame = &s->cur_pic; + const MPVPicture *cur_frame = &s->cur_pic; int mb_x = s->mb_x; int mb_y = s->mb_y; const int xy = mb_x + mb_y * s->mb_stride; diff --git a/libavcodec/mpegvideodec.h b/libavcodec/mpegvideodec.h index 42c2697749..4259d5a02d 100644 --- a/libavcodec/mpegvideodec.h +++ b/libavcodec/mpegvideodec.h @@ -58,12 +58,13 @@ void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64]); void ff_mpv_report_decode_progress(MpegEncContext *s); void ff_mpv_frame_end(MpegEncContext *s); -int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, const Picture *p, int qp_type); +int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, + const MPVPicture *p, int qp_type); int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); void ff_mpeg_flush(AVCodecContext *avctx); -void ff_print_debug_info(const MpegEncContext *s, const Picture *p, AVFrame *pict); +void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict); static inline int mpeg_get_qscale(MpegEncContext *s) { diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 5d52744529..05319436b6 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -382,7 +382,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, MSS12Context *c = &ctx->c; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - Picture *f; + MPVPicture *f; int ret; ff_mpeg_flush(avctx); diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 1c9af6b53c..1429b3a93a 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -929,7 +929,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) rce = &rcc->entry[picture_number]; wanted_bits = rce->expected_bits; } else { - const Picture *dts_pic; + const MPVPicture *dts_pic; rce = &local_rce; /* FIXME add a dts field to AVFrame and ensure it is set and use it diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index df1d570e73..284de14e8c 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -565,7 +565,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) int has_A = 0, has_B = 0, has_C = 0; int mx, my; int i, j; - Picture *cur_pic = &s->cur_pic; + MPVPicture *cur_pic = &s->cur_pic; const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0; int type = cur_pic->mb_type[mb_pos]; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index b89f695b56..71fda305da 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -340,7 +340,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - Picture *f = &s->cur_pic; + MPVPicture *f = &s->cur_pic; int plane, i; /* Windows Media Image codecs have a convergence interval of two keyframes. diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index cd7194138d..f46bfa2bdf 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -370,7 +370,7 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - Picture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index 1f0ea7e803..abd8cb19af 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -35,7 +35,7 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - Picture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG1Or2 *info = &pic_ctx->info.mpeg; VdpVideoSurface ref; @@ -87,7 +87,7 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - Picture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c index ecbc80b86d..e2766835f6 100644 --- a/libavcodec/vdpau_mpeg4.c +++ b/libavcodec/vdpau_mpeg4.c @@ -34,7 +34,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext * const s = &ctx->m; - Picture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4; VdpVideoSurface ref; diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index 119e514c0e..9ed1665cad 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -36,7 +36,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, { VC1Context * const v = avctx->priv_data; MpegEncContext * const s = &v->s; - Picture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoVC1 *info = &pic_ctx->info.vc1; VdpVideoSurface ref; @@ -104,7 +104,7 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, { VC1Context * const v = avctx->priv_data; MpegEncContext * const s = &v->s; - Picture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; From patchwork Sat May 11 20:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48768 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299226pzb; Sat, 11 May 2024 13:57:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2HrGenvh0yQ3xa+nJk3aGnf8bcF4Z6CGFd+15eJrieYu81uGJk/aYOKzqqHb6Zsx2RBgNnSTG4kB2nre6veIBYf8j5Ja2IwADUw== X-Google-Smtp-Source: AGHT+IHoDHpWzEmFKVQ91FLlW4l42weQtf8YNy3lw88smQ6D3hw+vyD9dYGIN6zE7WEnbWqQ2yy1 X-Received: by 2002:a50:d74e:0:b0:56e:2b31:b111 with SMTP id 4fb4d7f45d1cf-5734d5be7camr3529369a12.7.1715461077229; Sat, 11 May 2024 13:57:57 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733beac952si3286733a12.94.2024.05.11.13.57.56; Sat, 11 May 2024 13:57:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=aU+WJ6kV; 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 0C34268D782; Sat, 11 May 2024 23:54:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2038.outbound.protection.outlook.com [40.92.74.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA9CF68D67A for ; Sat, 11 May 2024 23:54:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cpecaYRQ8GbCWqsQQddVrmM+oBJVAMsWj0APKGQhJCoFV39aR4YiRFXr8o8i3Rw0A+BgumYK5zUmTE8Hb0G0Rw37vzcnoZ8eGEaXuE6zlWk01yHyfshEx+ikwWFm9y/mJN5A0l94u1b9qHiGb9ZuWPXhPz6VdUsdb9bSF3eTJfFAgKstHhbJFvmRWu1G8HsM9EU2WBW0jaLTKRYdMVJlVKLcKqTD4gnO+dImVR3e8NzpUquhsGzHZdCVE80aFeGn3OVQTFIaVCIk0TEemSk7siAjR6b0Ay9va4i5ktA6uD7oGjMKRjM/4+IQq72ZO6W5TO71tMxmmi+1v0MvT3iXRA== 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=TQIxRHDl9dvJVsKdErP0JcBFI/KMz/n5BYpAWHqH498=; b=Xf3wm7a/3DRRyPmxDfSHPHZ0d1jhcRarAX1GWiPLUFqO0nvkKF2oZd6i/7pFRrgDB6DEnjImYUaIcELVhoFGs7k5jOgeW00GDNAo4AHe08TOi4KT9eN1Hbw1FZV5jVABMs+cpxBf7SMonHIXlxkuUbp9g/7/JGFd8zjyz+7szZUfThlRBVzeM08nFdyZcA/78GvKfpYv0QD3CJmTE+O70uBctzjR8wXy8AOEl/Iy34Hwh61JiNd0hfeBJioarVwM77dhRRHHkNbcyswtGjDXRn2TnRVP1RnrFkyGOiu2+MgFlEepO3fdkugzvX9ZcE7Ac6Oc3ZF33qDXmsRyhLvBiw== 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=TQIxRHDl9dvJVsKdErP0JcBFI/KMz/n5BYpAWHqH498=; b=aU+WJ6kVXnqOvrJOuqnk1ZuT9b9RzHkIzpnHH55uN7f793AHso3XGQ5N604CKtbTzCtXOtCKwrp4TQCCrihJnPjeeSX0P7Gpzn0JAQWngvsnwYM8jNHTIpuzskPONUNdvGS41ZGYtNaoPKyKe63vx5P59unYCupSHsGVnD2W8c0hmChIZsYlkyh0lgcvgn2lcWVgslhlyWqBv6YXJ5F0kW0v6FFdTL5cQwrRjPjBAkDxP3A0/rvXNqTBvsa6hSkb3HW496iEHRlSFLC8JTjteytB5CIsqJTusfofD4BYBXwO3VB9VxFyLjRzBeP1EaDZGidYvPSALCBjy1QN0TQYDg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:37 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:06 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [8fW7YQvTorirAKUbVqra2pcI5Jz3hWR19soRlaNiJAY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-41-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 440791cd-b1e0-46f7-5f79-08dc71fc91cc X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: y/x7rJ7u7Mf5UC/d5A/zV48qbxeK4Va2R8MuwfBEMgfcC+1Y58InoEJGqLeIiuHb7JnoRgQNTGgoH29RtaAFCK05sGuD79AiFEtTpLzegVNWi9hDw6Lqob2XMBcj30NirhD+ddS9Vn4RSjJ1E7MwO8vWGb7XQdi6nXCGAlzqdnMmENj9ZdXDPPDv/cmvLcuStKKzsGXwNCoHazpHEWNS3xya4II9jgdmfuOUzv5gaSlwdliX08hG0U1A3SKW7R8nhFu+fo18VJARcKVFMcz2HZM2cRNO2gXX1h/5Z5KhUAd7OLBosPpueJ598+wrHH6xy3y6wEZfhxRFV/Xz/+ev4WDw5IgiTyQIL4TLIuDww5WK+EktvcuVWtG3OVlnshLvqySF6+Xf2RTc16cfqyh+Ed6olyIbEtLDjXsQ4+xg4fxAtUbQ3E9xo8rgudGLhsqTvVFBukopWugdy9a7102v7JLkrchXKqtUvaAbxtJHsWeCrsFkc+WsIaowYWTfO4v7rjqf+1HG0wGQiIiosp6BfvBXzKTqCnlnlkIKmedkGx0BPJaCLiFR8V3YcV53O0aUaRLQFnDSBE8x0rL5eW0fL2+HLxzLlPBUC1VH6WjhcQPzlu4pncPl78AeokA/1JT9 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6TVfviiSTqWt8v60dA7kUZ2fX2daFIwqjtHiqcc5BrEoVSsKOsBnU5kXLRPbf4gCAr9Z9qcqiSCDlPsIN6we8GNXlTSq0b676pXG8iJwr8wT9Ck9+rAShtmGgCo5Dze5j0vHtIc6iP1PNwSQuAEyyCwKL/W+RmNwpzHWmuhnuQ5M2+BvcR2ndvxgkomynMTEK3IHOwRrnbnespsRu/+9zjaduzdM3vZETBezSEYidNMXkOKoyHaKiYbiQs6UvjfbunR/4uJyzqxhtJoIHC0GyL04G9S561U8hoTj1xIgeFzIYJBwWBNUAJqR/Outvbn9t5hacHhBbV0w9zC2M76lTMXvcZTkJTyEcuI9mfpZjmoQV9ADziEX7BAp4RkWjmb2ufLhALTbC7SJARyPvg+LMZdBdpbOou455U6Zuwy43CNQ/oy6eVGhdv9X+czeO5zq85FofQ3UGVM9iI8aAOaCRmYUtZq0DbY6gj/1CnHVA+CSS1q6JIc+Oq0X5+j+WTPmo4OKXzKGdzgV8NQ9FIV/5Jbor6xxr0+1PvHJIze6JGaX0Tu64FR01tI5FmttWBFJ5iojzEAG2kV5wRSKbbWxG+D3Lkd0w4bN30KlUjQ9g0gISMmWiDz35dBBSEPPnnayf3GzRvfL/1Y5qNiZtr2pBSsgBBe5yGwD0A3fEH4ptZ7TdF8R0mjeIxOinCtgsuTot+6rfwxdrROt8VY4z256J2snO/j0bQ9A3iahLOIqPQSeooFO003mqRWehrX3WOR58IZlJmTiGbMYMxJYurrnOUJ8SQ2ubqkxcagPDu9BhznWqGjztnznHR89XuJwtECuesmvdNt3f0imhZ8GFA2EKL6/6fwzVBwflJ6jW0PZnJMXybYA9UO5q34Bzhbvm6AT6gEW2G15/pscoV4XlCjuMEo1YWQqzYezDuPezNR6khIob/XVH6G+ewj2Td1VIUmzXkG+fdQKXRWXLh3h4C4a6g+V5kH+2iLktdkbTsL1oHHVXDJRaJ6vmJzxmOxbqGDWa8knFxaGdrl4bVu4UGY+qArchjFK/v89q6J3zVFnphBpEbTpATXMqKF94OokPvRDzTibxXQJEYOE86uJKWNm/jv66TS28L304ADDPgQdK3Ep6E0mCaX/UvpI7QhMtrM19f0LoghxRNpIAFJ6SrI+7vFhu8QLRYqDnoG+OmkDUiXxU4hqLhC11shZlnWr1Oo7v7bywUlZ6M0lCwP+OeOFVrVXmI6WGTcIUHkhsNA6n15ufDYgns3FUef33DRaqKVklDpGpGSLLjmtF/2ohIwHxg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 440791cd-b1e0-46f7-5f79-08dc71fc91cc X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:37.4365 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 42/71] avcodec/vc1_mc: Don't check AVFrame INTERLACE flags 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: 6KpAr05S4V/6 Instead cache these values in VC1Context to avoid the indirection and AND. Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1.h | 1 + libavcodec/vc1_mc.c | 20 +++++++++----------- libavcodec/vc1dec.c | 2 ++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 0e01458c89..185236662f 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -293,6 +293,7 @@ typedef struct VC1Context{ uint8_t next_luty[2][256], next_lutuv[2][256]; ///< lookup tables used for intensity compensation uint8_t (*curr_luty)[256] ,(*curr_lutuv)[256]; int last_use_ic, *curr_use_ic, next_use_ic, aux_use_ic; + int last_interlaced, next_interlaced; ///< whether last_pic, next_pic is interlaced int rnd; ///< rounding control int cbptab; diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index 90ff1eee58..fad9a4c370 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -233,7 +233,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) luty = v->last_luty; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } } else { srcY = s->next_pic.data[0]; @@ -242,7 +242,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) luty = v->next_luty; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } if (!srcY || !srcU) { @@ -482,13 +482,13 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) srcY = s->last_pic.data[0]; luty = v->last_luty; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } } else { srcY = s->next_pic.data[0]; luty = v->next_luty; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } if (!srcY) { @@ -708,14 +708,14 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) srcV = s->last_pic.data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } } else { srcU = s->next_pic.data[1]; srcV = s->next_pic.data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } if (!srcU) { @@ -884,13 +884,13 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) srcV = s->next_pic.data[2]; lutuv = v->next_lutuv; use_ic = v->next_use_ic; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->next_interlaced; } else { srcU = s->last_pic.data[1]; srcV = s->last_pic.data[2]; lutuv = v->last_lutuv; use_ic = v->last_use_ic; - interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); + interlace = v->last_interlaced; } if (!srcU) return; @@ -1009,7 +1009,7 @@ void ff_vc1_interp_mc(VC1Context *v) int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int v_edge_pos = s->v_edge_pos >> v->field_mode; int use_ic = v->next_use_ic; - int interlace; + int interlace = v->next_interlaced; int linesize, uvlinesize; if (!v->field_mode && !v->s.next_pic.data[0]) @@ -1034,8 +1034,6 @@ void ff_vc1_interp_mc(VC1Context *v) srcU = s->next_pic.data[1]; srcV = s->next_pic.data[2]; - interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); - src_x = s->mb_x * 16 + (mx >> 2); src_y = s->mb_y * 16 + (my >> 2); uvsrc_x = s->mb_x * 8 + (uvmx >> 2); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 71fda305da..36a47502f5 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1064,6 +1064,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, v->s.cur_pic_ptr->field_picture = v->field_mode; v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE); v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff; + v->last_interlaced = v->s.last_pic_ptr ? v->s.last_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; + v->next_interlaced = v->s.next_pic_ptr ? v->s.next_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; // process pulldown flags s->cur_pic_ptr->f->repeat_pict = 0; From patchwork Sat May 11 20:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48769 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299273pzb; Sat, 11 May 2024 13:58:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQag5l4g+srPkFlkFMvD4w0JJauzkQ9/WHUmDBzH9Di0iGmRzmn2icYOCzJUXOdT94OG82hDWLGQF0TkCSqOxfOP+bJrfrKNejzA== X-Google-Smtp-Source: AGHT+IHjMgI+hECDf8DpV2r9XDxW4njrhTa6SqtVcJgPIUomJe313VUklySrlb2m+S2VBDRiUw5d X-Received: by 2002:a50:cd17:0:b0:56e:22bd:7e90 with SMTP id 4fb4d7f45d1cf-5734d6dec0cmr3720969a12.40.1715461086819; Sat, 11 May 2024 13:58:06 -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 4fb4d7f45d1cf-5733bec1a7asi3355181a12.172.2024.05.11.13.58.06; Sat, 11 May 2024 13:58:06 -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=FE5iqC0Z; 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 77F7F68D78B; Sat, 11 May 2024 23:54:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2084.outbound.protection.outlook.com [40.92.74.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EEF6A68D1C4 for ; Sat, 11 May 2024 23:54:42 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jb9QrrdedqNXXYdyTu5aR1iRBLyxBb16oBaI4iECQwGnFYEqCUrqBUS1yFcH+Tf2SuuqAiPO0y67mRTxXAUYE13SWwBPxp+dQW6gywJPHu1Tjg7ZDmhef1dIPTstPqs8LM4SMhdmqmpFJkWThAYlrLKxc+s5sLuRHlihYCwthzde6lT4uPesArUTsxxAyUSJuewHo9ZJlQvRfN6/iqF5TRqoee/f70pEJSIx+oRZ5Uf6Ab+j0G0InHtqX9aa2kbFRhPVhMU7HS0u8NJVJBWxXNPx9LxxQGTceW9PBxK/dvMlNMo6FX+26GnVp03l2DzXzxca6Pa9AfYOi6RxGUbvsg== 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=9BRP2CxX/o+Qq2TMyHQVVnvtnH8vUQczIxCstEjmP/4=; b=L1gI1xHD69vscPZaM26gGLy+uSo8Y1QTFXBEnh1cZBdipppn9vQgzSyqL4pbdrh4Cg8fOPi6qsOw5VzPbwRra41rfKySIH9kF9u8rbFjLTt4XBjiifH7b3bTnuGjz0J9zzaT260wGCOaDvWP9St2Hr3LOzMoT3YMZp2X7rWUYNfmm5/a+UX4cAVo5zq2ZEMVhbPsRMgDLyOS8FdwLVsvbDT5H1IfTP7rHaVFmffT3l8NpJlZmBplCysZQ/wd63sZyINwRsVj5f6UxAwrJ7lqmjTsPqCdJ9mgXLl2ibpLAj9LPiMx5AtId4BbLfME8Q5SWV3JUSVbz0Ck3FiSkmh4mw== 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=9BRP2CxX/o+Qq2TMyHQVVnvtnH8vUQczIxCstEjmP/4=; b=FE5iqC0ZXzNxjj1qCOS/6xiASRtIAoR2yzA62azrGV4zBCkJqa9NLvl+x2PqF7tN4gLBh1fg4Umg47wRK54N/LFDJCjnLM4hJdC1pI549mHGpNQWdrvs0k+ixilmuqGqdksOOgvOPCW++4vd7tD5jryHXJbM+YPb5v+LivCpHu/ydaUMl1AYpphvY+EdmMF1QVFlYoEhkZfl//skMZvxtIg8K4b4JjB1kukS2qkDZXLiM0eNXsh1GR2jU35e9o0iq8Ge50EdqmBPU27Ajn+m6ycj1Dc7sqJFXhyCzXUDK/FBTak1DXtNIWiAJqLJ9qLlvr4+6WC3Om4Ixmx8LiV8hg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:39 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:39 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:07 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [luszfeR7hRnoo0Dsju0vh10QR46ZXZPqVImrAorN5Pc=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-42-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a655639-3297-431b-a1ff-08dc71fc92ce X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: ftHOUeJDv8Ukkei4aNM1cRVJ+UQohVFF/wLEouyyWwGSBrawAQXHQ0FuETjaBlYeLmtnowVtrpz0+ppMzGWQmsAeQs1w68sRrWIzgCBOyshwAOMaB4Yywv1giZAtvXraYGfGuqxqDQmeWgfy+X8yFDRQuMqmDb2FtQsQc9PayJGoZWtYXuGZm7WzaKnCp0kMeZGTpXflDWP/ljek9mtJsjlrlLDGcVFUBG2ONsGnMhchbrjutjlmjAWA9u6zABEBxVIKgdjuDYySUXMymEv4ShBO1gqSikYOQQ5mRiepUSzD1xUMuuQQg0UFmycN8xHMIcd/pRFrKIfESxjdrYrFSvD+13wVsngfp9YIhv0tzIbQXPhmcItQFcEDRQc2+niBQTpXsaO2LrkypT8P5F+LKAJk2KoANGAf76n9KfSJ1nxZUoB2zpYpC24u5em4yUE79sxGo7xAkJ/s/MchSpvE0541WFUZ77zzNu0p5S3nQ7j1qjuaZeqkWHCfAPm5UIe+mxvYII4kctqOyVkAZNoFQyzurIZCYm4yTuT0eFJIqPAUdCgjiVsTekjTNy/Y3laTyF/2nvywOFO5fj+9CFsiht/I2DaPanXEjHKZl0CC+HHdtOFYXkOQ9aaleDO+TVru X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WN7/kbSiRPyuUlV91nXd0CUU/By0i5Gq/SwZFw9k3ssMZHwiUgQqrILmTzsiRopNdw4MEdyoAqTtYpbLr+3oZVKK/IbFtDWvBJkj37XyTmMGEJ8ysUFXK55yukqWrFCAdP9//ZtdaTR7a6jUNs3ZnJhC+2p4hTmPxgwJ/d6feP9lzXXTo3NXCC70rl3VwFq4pDGUd0X791HV3XKWgwRXND0GzgySwuZqsDtk7odiT4tpQyb6K4njmzEqom8SzUyNWMICoSQAlY0qFPjHmZxUDsRcQeR9vWNuJ12HsoAweLqTqcz3paum9XRsLlKY4p6faFmRC1IJTDsVH1jS8N1a5BlIeHkK70fH8YuSF1e1For+DJlpPxda8R0pmxYtbZsA0qJgpTErJhAfa/KlpsB17EYa1cBl8SQArg2gwdYUoEtDBINRF5MfIuavTqSxpnZY4NDpRJamf4FHcRDOZyFMUEKBYefsjJcw2AE52iqUMlIGxxdI6qjvZJfna0tvc2GYP+SAi3jt/hpj9NW1KRa5u1PLHMVVutV2EHImYMKc8+7kcbCudaHMuXc6fFidH1zg6lwqEL9hESmxiZRLPYPwD32rwP9cUeaBdLulYGpWeUv8LTrTMpB2MF/SOpVj+t9miUXsR3mFh8pjaYrkT7Jbpx3vaa0NV4dqpGdmWXlkQMX0ChMo0Gydv4bo6F3Aq0Aaj6MaKBnnc9c0yTOIeTeSQh1c6g5R8WUukS36zVY6BLGRk/DcKKwvvgu8U1oZn1xTaLb8fDWA/YNnMb+9i1OkssgxKOB/rVRKysJhLbOd40yIuBavov/Hrky411Vh5d0u/QlzPV2EsACbxoXymdshUBMMG2PgqDweX7K+tj2DtU1oh2igJhgZnwgx21/l3iJb7qEwraZixDhDajocn+HM/bVGMOJ6XSYJiGYFUccG+DH4v0ccfibuHYnXPCuTWVBFIS+WBpYPMb8wP4n333AM0UkJWOlwjLNc3mhWt8n7fFag4UBp3GDD+JC9Aro/Tdmun1Wpr0eAWfZwpb9GXeP2U5/silegKktaJySDS8K4HrAdO2MSai6XCV+2bMPicqyV0yjh6Q6Tpx6oESWR7vj4qyIRwlVXOJvkuE5d2HAp8SqvPrKJTlK3iFCev3i469TRM4XRalu3L7DTYeEEy0n5uenZE5XuM5cPQcQpU+ptJvYZDaLEANB7kShQ9vy56DjBgHfhT91ewxgOazwXECfITorh1VmfLrpYB2LDFL/hlJyKQbjNp2GCT+cNTt2RrVgVL05pp28eVwcreP6CTi93Fw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a655639-3297-431b-a1ff-08dc71fc92ce X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:39.1906 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 43/71] avcodec/mpegpicture: Split MPVPicture into WorkPicture and ordinary Pic 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: KauDYfFWM5e2 There are two types of MPVPictures: Three (cur_pic, last_pic, next_pic) that are directly part of MpegEncContext and an array of MPVPictures that are separately allocated and are mostly accessed via pointers (cur|last|next)_pic_ptr; they are also used to store AVFrames in the encoder (necessary due to B-frames). As the name implies, each of the former is directly associated with one of the _ptr pointers: They actually share the same underlying buffers, but the ones that are part of the context can have their data pointers offset and their linesize doubled for field pictures. Up until now, each of these had their own references; in particular, there was an underlying av_frame_ref() to sync cur_pic and cur_pic_ptr etc. This is wasteful. This commit changes this relationship: cur_pic, last_pic and next_pic now become MPVWorkPictures; this structure does not have an AVFrame at all any more, but only the cached values of data and linesize. It also contains a pointer to the corresponding MPVPicture, establishing a more natural relationsship between the two. This already means that creating the context-pictures from the pointers can no longer fail. What has not been changed is the fact that the MPVPicture* pointers are not ownership pointers and that the MPVPictures are part of an array of MPVPictures that is owned by a single AVCodecContext. Doing so will be done in a latter commit. Signed-off-by: Andreas Rheinhardt --- libavcodec/d3d12va_mpeg2.c | 10 +- libavcodec/d3d12va_vc1.c | 10 +- libavcodec/dxva2_mpeg2.c | 16 +-- libavcodec/dxva2_vc1.c | 20 ++-- libavcodec/h261dec.c | 7 +- libavcodec/h263dec.c | 33 +++--- libavcodec/ituh263dec.c | 4 +- libavcodec/mpeg12dec.c | 56 ++++----- libavcodec/mpeg12enc.c | 14 +-- libavcodec/mpeg4videodec.c | 4 +- libavcodec/mpeg4videoenc.c | 4 +- libavcodec/mpeg_er.c | 6 +- libavcodec/mpegpicture.c | 56 ++++++--- libavcodec/mpegpicture.h | 30 ++++- libavcodec/mpegvideo.c | 11 -- libavcodec/mpegvideo.h | 9 +- libavcodec/mpegvideo_dec.c | 143 +++++++++-------------- libavcodec/mpegvideo_enc.c | 99 ++++++---------- libavcodec/mpegvideo_motion.c | 8 +- libavcodec/mpv_reconstruct_mb_template.c | 4 +- libavcodec/mss2.c | 2 +- libavcodec/nvdec_mpeg12.c | 6 +- libavcodec/nvdec_mpeg4.c | 6 +- libavcodec/nvdec_vc1.c | 6 +- libavcodec/ratecontrol.c | 10 +- libavcodec/rv10.c | 28 ++--- libavcodec/rv34.c | 38 +++--- libavcodec/snowenc.c | 17 +-- libavcodec/svq1enc.c | 5 +- libavcodec/vaapi_mpeg2.c | 12 +- libavcodec/vaapi_mpeg4.c | 14 +-- libavcodec/vaapi_vc1.c | 14 ++- libavcodec/vc1.c | 2 +- libavcodec/vc1_block.c | 12 +- libavcodec/vc1_mc.c | 14 +-- libavcodec/vc1_pred.c | 2 +- libavcodec/vc1dec.c | 40 +++---- libavcodec/vdpau.c | 2 +- libavcodec/vdpau_mpeg12.c | 8 +- libavcodec/vdpau_mpeg4.c | 6 +- libavcodec/vdpau_vc1.c | 12 +- libavcodec/videotoolbox.c | 2 +- libavcodec/wmv2dec.c | 2 +- 43 files changed, 386 insertions(+), 418 deletions(-) diff --git a/libavcodec/d3d12va_mpeg2.c b/libavcodec/d3d12va_mpeg2.c index c2cf78104c..86a7d97b34 100644 --- a/libavcodec/d3d12va_mpeg2.c +++ b/libavcodec/d3d12va_mpeg2.c @@ -44,7 +44,7 @@ static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint { const MpegEncContext *s = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); - D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic.ptr->hwaccel_picture_private; if (!ctx) return -1; @@ -69,7 +69,7 @@ static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint static int d3d12va_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const MpegEncContext *s = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic.ptr->hwaccel_picture_private; if (ctx_pic->slice_count >= MAX_SLICES) { return AVERROR(ERANGE); @@ -88,7 +88,7 @@ static int d3d12va_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buff static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *input_args, ID3D12Resource *buffer) { const MpegEncContext *s = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic.ptr->hwaccel_picture_private; const int is_field = s->picture_structure != PICT_FRAME; const unsigned mb_count = s->mb_width * (s->mb_height >> is_field); @@ -137,12 +137,12 @@ static int d3d12va_mpeg2_end_frame(AVCodecContext *avctx) { int ret; MpegEncContext *s = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic.ptr->hwaccel_picture_private; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_d3d12va_common_end_frame(avctx, s->cur_pic_ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), + ret = ff_d3d12va_common_end_frame(avctx, s->cur_pic.ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), update_input_arguments); if (!ret) ff_mpeg_draw_horiz_band(s, 0, avctx->height); diff --git a/libavcodec/d3d12va_vc1.c b/libavcodec/d3d12va_vc1.c index c4ac67ca04..dccc0fbffa 100644 --- a/libavcodec/d3d12va_vc1.c +++ b/libavcodec/d3d12va_vc1.c @@ -45,7 +45,7 @@ static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_ { const VC1Context *v = avctx->priv_data; D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx); - D3D12DecodePictureContext *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = v->s.cur_pic.ptr->hwaccel_picture_private; if (!ctx) return -1; @@ -67,7 +67,7 @@ static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_ static int d3d12va_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const VC1Context *v = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = v->s.cur_pic.ptr->hwaccel_picture_private; if (ctx_pic->slice_count >= MAX_SLICES) { return AVERROR(ERANGE); @@ -93,7 +93,7 @@ static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPU { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - D3D12DecodePictureContext *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = s->cur_pic.ptr->hwaccel_picture_private; D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args = &input_args->FrameArguments[input_args->NumFrameArguments++]; const unsigned mb_count = s->mb_width * (s->mb_height >> v->field_mode); @@ -151,12 +151,12 @@ static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPU static int d3d12va_vc1_end_frame(AVCodecContext *avctx) { const VC1Context *v = avctx->priv_data; - D3D12DecodePictureContext *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; + D3D12DecodePictureContext *ctx_pic = v->s.cur_pic.ptr->hwaccel_picture_private; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - return ff_d3d12va_common_end_frame(avctx, v->s.cur_pic_ptr->f, + return ff_d3d12va_common_end_frame(avctx, v->s.cur_pic.ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, update_input_arguments); diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index d29a5bb538..4b58466878 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -45,17 +45,17 @@ void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx, DXVA_PictureParameters *pp) { const struct MpegEncContext *s = avctx->priv_data; - const MPVPicture *current_picture = s->cur_pic_ptr; + const MPVPicture *current_picture = s->cur_pic.ptr; int is_field = s->picture_structure != PICT_FRAME; memset(pp, 0, sizeof(*pp)); pp->wDeblockedPictureIndex = 0; if (s->pict_type != AV_PICTURE_TYPE_I) - pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_pic.f, 0); + pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_pic.ptr->f, 0); else pp->wForwardRefPictureIndex = 0xffff; if (s->pict_type == AV_PICTURE_TYPE_B) - pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_pic.f, 0); + pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_pic.ptr->f, 0); else pp->wBackwardRefPictureIndex = 0xffff; pp->wDecodedPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, current_picture->f, 1); @@ -157,7 +157,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, const struct MpegEncContext *s = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); struct dxva2_picture_context *ctx_pic = - s->cur_pic_ptr->hwaccel_picture_private; + s->cur_pic.ptr->hwaccel_picture_private; const int is_field = s->picture_structure != PICT_FRAME; const unsigned mb_count = s->mb_width * (s->mb_height >> is_field); void *dxva_data_ptr; @@ -260,7 +260,7 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, const struct MpegEncContext *s = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); struct dxva2_picture_context *ctx_pic = - s->cur_pic_ptr->hwaccel_picture_private; + s->cur_pic.ptr->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; @@ -280,7 +280,7 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx, { const struct MpegEncContext *s = avctx->priv_data; struct dxva2_picture_context *ctx_pic = - s->cur_pic_ptr->hwaccel_picture_private; + s->cur_pic.ptr->hwaccel_picture_private; unsigned position; if (ctx_pic->slice_count >= MAX_SLICES) { @@ -302,12 +302,12 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx) { struct MpegEncContext *s = avctx->priv_data; struct dxva2_picture_context *ctx_pic = - s->cur_pic_ptr->hwaccel_picture_private; + s->cur_pic.ptr->hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, s->cur_pic_ptr->f, + ret = ff_dxva2_common_end_frame(avctx, s->cur_pic.ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), commit_bitstream_and_slice_buffer); diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index f536da1008..6dc9cd8b5a 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -46,7 +46,7 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - const MPVPicture *current_picture = s->cur_pic_ptr; + const MPVPicture *current_picture = s->cur_pic.ptr; int intcomp = 0; // determine if intensity compensation is needed @@ -58,12 +58,12 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, } memset(pp, 0, sizeof(*pp)); - if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type) - pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_pic.f, 0); + if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type && s->last_pic.ptr) + pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_pic.ptr->f, 0); else pp->wForwardRefPictureIndex = 0xffff; - if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type) - pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_pic.f, 0); + if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type && s->next_pic.ptr) + pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_pic.ptr->f, 0); else pp->wBackwardRefPictureIndex = 0xffff; pp->wDecodedPictureIndex = @@ -191,7 +191,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, const VC1Context *v = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); const MpegEncContext *s = &v->s; - struct dxva2_picture_context *ctx_pic = s->cur_pic_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = s->cur_pic.ptr->hwaccel_picture_private; static const uint8_t start_code[] = { 0, 0, 1, 0x0d }; const unsigned start_code_size = avctx->codec_id == AV_CODEC_ID_VC1 ? sizeof(start_code) : 0; @@ -317,7 +317,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx, { const VC1Context *v = avctx->priv_data; AVDXVAContext *ctx = DXVA_CONTEXT(avctx); - struct dxva2_picture_context *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = v->s.cur_pic.ptr->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; @@ -336,7 +336,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, uint32_t size) { const VC1Context *v = avctx->priv_data; - const MPVPicture *current_picture = v->s.cur_pic_ptr; + const MPVPicture *current_picture = v->s.cur_pic.ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; unsigned position; @@ -364,13 +364,13 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx, static int dxva2_vc1_end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; - struct dxva2_picture_context *ctx_pic = v->s.cur_pic_ptr->hwaccel_picture_private; + struct dxva2_picture_context *ctx_pic = v->s.cur_pic.ptr->hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, v->s.cur_pic_ptr->f, + ret = ff_dxva2_common_end_frame(avctx, v->s.cur_pic.ptr->f, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, commit_bitstream_and_slice_buffer); diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 00edd7a7c2..9acfd984ee 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -649,12 +649,11 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict, } ff_mpv_frame_end(s); - av_assert0(s->cur_pic.f->pict_type == s->cur_pic_ptr->f->pict_type); - av_assert0(s->cur_pic.f->pict_type == s->pict_type); + av_assert0(s->pict_type == s->cur_pic.ptr->f->pict_type); - if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->cur_pic_ptr, pict); + ff_print_debug_info(s, s->cur_pic.ptr, pict); *got_frame = 1; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 6ae634fceb..4fe4a30000 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -432,22 +432,22 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ - if (s->low_delay == 0 && s->next_pic_ptr) { - if ((ret = av_frame_ref(pict, s->next_pic_ptr->f)) < 0) + if (s->low_delay == 0 && s->next_pic.ptr) { + if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0) return ret; - s->next_pic_ptr = NULL; + s->next_pic.ptr = NULL; *got_frame = 1; - } else if (s->skipped_last_frame && s->cur_pic_ptr) { + } else if (s->skipped_last_frame && s->cur_pic.ptr) { /* Output the last picture we decoded again if the stream ended with * an NVOP */ - if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) return ret; /* Copy props from the last input packet. Otherwise, props from the last * returned picture would be reused */ if ((ret = ff_decode_frame_props(avctx, pict)) < 0) return ret; - s->cur_pic_ptr = NULL; + s->cur_pic.ptr = NULL; *got_frame = 1; } @@ -561,7 +561,7 @@ retry: s->gob_index = H263_GOB_HEIGHT(s->height); /* skip B-frames if we don't have reference frames */ - if (!s->last_pic_ptr && + if (!s->last_pic.ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && @@ -647,21 +647,20 @@ frame_end: if (!s->divx_packed && avctx->hwaccel) ff_thread_finish_setup(avctx); - av_assert1(s->cur_pic.f->pict_type == s->cur_pic_ptr->f->pict_type); - av_assert1(s->cur_pic.f->pict_type == s->pict_type); + av_assert1(s->pict_type == s->cur_pic.ptr->f->pict_type); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->cur_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); - } else if (s->last_pic_ptr) { - if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) + ff_print_debug_info(s, s->cur_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG1); + } else if (s->last_pic.ptr) { + if ((ret = av_frame_ref(pict, s->last_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->last_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->last_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG1); } - if (s->last_pic_ptr || s->low_delay) { + if (s->last_pic.ptr || s->low_delay) { if ( pict->format == AV_PIX_FMT_YUV420P && (s->codec_tag == AV_RL32("GEOV") || s->codec_tag == AV_RL32("GEOX"))) { for (int p = 0; p < 3; p++) { diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 2e4d74adc8..0809048362 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -750,12 +750,12 @@ static inline void set_one_direct_mv(MpegEncContext *s, const MPVPicture *p, int static int set_direct_mv(MpegEncContext *s) { const int mb_index = s->mb_x + s->mb_y * s->mb_stride; - const MPVPicture *p = &s->next_pic; + const MPVPicture *p = s->next_pic.ptr; int colocated_mb_type = p->mb_type[mb_index]; int i; if (s->codec_tag == AV_RL32("U263") && p->f->pict_type == AV_PICTURE_TYPE_I) { - p = &s->last_pic; + p = s->last_pic.ptr; colocated_mb_type = p->mb_type[mb_index]; } diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 6877b9ef4a..e3f2dd8af7 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1292,7 +1292,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return ret; if (s->picture_structure != PICT_FRAME) { - s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * + s->cur_pic.ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * (s->picture_structure == PICT_TOP_FIELD); for (int i = 0; i < 3; i++) { @@ -1309,19 +1309,19 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) ff_mpeg_er_frame_start(s); /* first check if we must repeat the frame */ - s->cur_pic_ptr->f->repeat_pict = 0; + s->cur_pic.ptr->f->repeat_pict = 0; if (s->repeat_first_field) { if (s->progressive_sequence) { if (s->top_field_first) - s->cur_pic_ptr->f->repeat_pict = 4; + s->cur_pic.ptr->f->repeat_pict = 4; else - s->cur_pic_ptr->f->repeat_pict = 2; + s->cur_pic.ptr->f->repeat_pict = 2; } else if (s->progressive_frame) { - s->cur_pic_ptr->f->repeat_pict = 1; + s->cur_pic.ptr->f->repeat_pict = 1; } } - ret = ff_frame_new_side_data(s->avctx, s->cur_pic_ptr->f, + ret = ff_frame_new_side_data(s->avctx, s->cur_pic.ptr->f, AV_FRAME_DATA_PANSCAN, sizeof(s1->pan_scan), &pan_scan); if (ret < 0) @@ -1331,14 +1331,14 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (s1->a53_buf_ref) { ret = ff_frame_new_side_data_from_buf( - s->avctx, s->cur_pic_ptr->f, AV_FRAME_DATA_A53_CC, + s->avctx, s->cur_pic.ptr->f, AV_FRAME_DATA_A53_CC, &s1->a53_buf_ref, NULL); if (ret < 0) return ret; } if (s1->has_stereo3d) { - AVStereo3D *stereo = av_stereo3d_create_side_data(s->cur_pic_ptr->f); + AVStereo3D *stereo = av_stereo3d_create_side_data(s->cur_pic.ptr->f); if (!stereo) return AVERROR(ENOMEM); @@ -1348,7 +1348,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (s1->has_afd) { AVFrameSideData *sd; - ret = ff_frame_new_side_data(s->avctx, s->cur_pic_ptr->f, + ret = ff_frame_new_side_data(s->avctx, s->cur_pic.ptr->f, AV_FRAME_DATA_AFD, 1, &sd); if (ret < 0) return ret; @@ -1360,7 +1360,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_finish_setup(avctx); } else { // second field - if (!s->cur_pic_ptr) { + if (!s->cur_pic.ptr) { av_log(s->avctx, AV_LOG_ERROR, "first field missing\n"); return AVERROR_INVALIDDATA; } @@ -1377,10 +1377,10 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) return ret; for (int i = 0; i < 3; i++) { - s->cur_pic.data[i] = s->cur_pic_ptr->f->data[i]; + s->cur_pic.data[i] = s->cur_pic.ptr->f->data[i]; if (s->picture_structure == PICT_BOTTOM_FIELD) s->cur_pic.data[i] += - s->cur_pic_ptr->f->linesize[i]; + s->cur_pic.ptr->f->linesize[i]; } } @@ -1735,7 +1735,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output) Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; - if (!s->context_initialized || !s->cur_pic_ptr) + if (!s->context_initialized || !s->cur_pic.ptr) return 0; if (s->avctx->hwaccel) { @@ -1756,20 +1756,20 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output) ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - int ret = av_frame_ref(pict, s->cur_pic_ptr->f); + int ret = av_frame_ref(pict, s->cur_pic.ptr->f); if (ret < 0) return ret; - ff_print_debug_info(s, s->cur_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG2); + ff_print_debug_info(s, s->cur_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG2); *got_output = 1; } else { /* latency of 1 frame for I- and P-frames */ - if (s->last_pic_ptr && !s->last_pic_ptr->dummy) { - int ret = av_frame_ref(pict, s->last_pic_ptr->f); + if (s->last_pic.ptr && !s->last_pic.ptr->dummy) { + int ret = av_frame_ref(pict, s->last_pic.ptr->f); if (ret < 0) return ret; - ff_print_debug_info(s, s->last_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG2); + ff_print_debug_info(s, s->last_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->last_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG2); *got_output = 1; } } @@ -2405,7 +2405,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, return AVERROR_INVALIDDATA; } - if (!s2->last_pic_ptr) { + if (!s2->last_pic.ptr) { /* Skip B-frames if we do not have reference frames and * GOP is not closed. */ if (s2->pict_type == AV_PICTURE_TYPE_B) { @@ -2419,7 +2419,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, } if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) s->sync = 1; - if (!s2->next_pic_ptr) { + if (!s2->next_pic.ptr) { /* Skip P-frames if we do not have a reference frame or * we have an invalid header. */ if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) { @@ -2460,7 +2460,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, if ((ret = mpeg_field_start(s2, buf, buf_size)) < 0) return ret; } - if (!s2->cur_pic_ptr) { + if (!s2->cur_pic.ptr) { av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n"); return AVERROR_INVALIDDATA; @@ -2524,12 +2524,12 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) { /* special case for last picture */ - if (s2->low_delay == 0 && s2->next_pic_ptr) { - int ret = av_frame_ref(picture, s2->next_pic_ptr->f); + if (s2->low_delay == 0 && s2->next_pic.ptr) { + int ret = av_frame_ref(picture, s2->next_pic.ptr->f); if (ret < 0) return ret; - s2->next_pic_ptr = NULL; + s2->next_pic.ptr = NULL; *got_output = 1; } @@ -2552,14 +2552,14 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, } s->extradata_decoded = 1; if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) { - s2->cur_pic_ptr = NULL; + s2->cur_pic.ptr = NULL; return ret; } } ret = decode_chunks(avctx, picture, got_output, buf, buf_size); if (ret<0 || *got_output) { - s2->cur_pic_ptr = NULL; + s2->cur_pic.ptr = NULL; if (s->timecode_frame_start != -1 && *got_output) { char tcbuf[AV_TIMECODE_STR_SIZE]; diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 42ff92cb16..304cfb9046 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -290,7 +290,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) AVRational aspect_ratio = s->avctx->sample_aspect_ratio; int aspect_ratio_info; - if (!(s->cur_pic.f->flags & AV_FRAME_FLAG_KEY)) + if (!(s->cur_pic.ptr->f->flags & AV_FRAME_FLAG_KEY)) return; if (aspect_ratio.num == 0 || aspect_ratio.den == 0) @@ -382,7 +382,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) put_bits(&s->pb, 2, mpeg12->frame_rate_ext.num-1); // frame_rate_ext_n put_bits(&s->pb, 5, mpeg12->frame_rate_ext.den-1); // frame_rate_ext_d - side_data = av_frame_get_side_data(s->cur_pic_ptr->f, AV_FRAME_DATA_PANSCAN); + side_data = av_frame_get_side_data(s->cur_pic.ptr->f, AV_FRAME_DATA_PANSCAN); if (side_data) { const AVPanScan *pan_scan = (AVPanScan *)side_data->data; if (pan_scan->width && pan_scan->height) { @@ -419,10 +419,10 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) /* time code: we must convert from the real frame rate to a * fake MPEG frame rate in case of low frame rate */ fps = (framerate.num + framerate.den / 2) / framerate.den; - time_code = s->cur_pic_ptr->coded_picture_number + + time_code = s->cur_pic.ptr->coded_picture_number + mpeg12->timecode_frame_start; - mpeg12->gop_picture_number = s->cur_pic_ptr->coded_picture_number; + mpeg12->gop_picture_number = s->cur_pic.ptr->coded_picture_number; av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & AV_TIMECODE_FLAG_DROPFRAME)); if (mpeg12->drop_frame_timecode) @@ -530,7 +530,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) if (s->progressive_sequence) put_bits(&s->pb, 1, 0); /* no repeat */ else - put_bits(&s->pb, 1, !!(s->cur_pic_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); + put_bits(&s->pb, 1, !!(s->cur_pic.ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); /* XXX: optimize the generation of this flag with entropy measures */ s->frame_pred_frame_dct = s->progressive_sequence; @@ -554,7 +554,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) for (i = 0; i < sizeof(svcd_scan_offset_placeholder); i++) put_bits(&s->pb, 8, svcd_scan_offset_placeholder[i]); } - side_data = av_frame_get_side_data(s->cur_pic_ptr->f, + side_data = av_frame_get_side_data(s->cur_pic.ptr->f, AV_FRAME_DATA_STEREO3D); if (side_data) { const AVStereo3D *stereo = (AVStereo3D *)side_data->data; @@ -594,7 +594,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s) } if (CONFIG_MPEG2VIDEO_ENCODER && mpeg12->a53_cc) { - side_data = av_frame_get_side_data(s->cur_pic_ptr->f, + side_data = av_frame_get_side_data(s->cur_pic.ptr->f, AV_FRAME_DATA_A53_CC); if (side_data) { if (side_data->size <= A53_MAX_CC_COUNT * 3 && side_data->size % 3 == 0) { diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 8f2e03414b..6cdab62b46 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1811,7 +1811,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->last_mv[i][1][1] = 0; } - ff_thread_await_progress(&s->next_pic_ptr->tf, s->mb_y, 0); + ff_thread_await_progress(&s->next_pic.ptr->tf, s->mb_y, 0); } /* if we skipped it in the future P-frame than skip it now too */ @@ -2016,7 +2016,7 @@ end: if (s->pict_type == AV_PICTURE_TYPE_B) { const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1; - ff_thread_await_progress(&s->next_pic_ptr->tf, + ff_thread_await_progress(&s->next_pic.ptr->tf, (s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y + 1, s->mb_height - 1) : s->mb_y, 0); diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 036171fe70..2f4b1a1d52 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -888,7 +888,7 @@ static void mpeg4_encode_gop_header(MpegEncContext *s) put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, GOP_STARTCODE); - time = s->cur_pic_ptr->f->pts; + time = s->cur_pic.ptr->f->pts; if (s->reordered_input_picture[1]) time = FFMIN(time, s->reordered_input_picture[1]->f->pts); time = time * s->avctx->time_base.num; @@ -1100,7 +1100,7 @@ int ff_mpeg4_encode_picture_header(MpegEncContext *s) } put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */ if (!s->progressive_sequence) { - put_bits(&s->pb, 1, !!(s->cur_pic_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); + put_bits(&s->pb, 1, !!(s->cur_pic.ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)); put_bits(&s->pb, 1, s->alternate_scan); } // FIXME sprite stuff diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index 21fe7d6f71..f9421ec91f 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -49,9 +49,9 @@ void ff_mpeg_er_frame_start(MpegEncContext *s) { ERContext *er = &s->er; - set_erpic(&er->cur_pic, s->cur_pic_ptr); - set_erpic(&er->next_pic, s->next_pic_ptr); - set_erpic(&er->last_pic, s->last_pic_ptr); + set_erpic(&er->cur_pic, s->cur_pic.ptr); + set_erpic(&er->next_pic, s->next_pic.ptr); + set_erpic(&er->last_pic, s->last_pic.ptr); er->pp_time = s->pp_time; er->pb_time = s->pb_time; diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 429c110397..9d5a24523f 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -45,6 +45,45 @@ static void av_noinline free_picture_tables(MPVPicture *pic) pic->mb_height = 0; } +void ff_mpv_unref_picture(MPVWorkPicture *pic) +{ + if (pic->ptr) + ff_mpeg_unref_picture(pic->ptr); + memset(pic, 0, sizeof(*pic)); +} + +static void set_workpic_from_pic(MPVWorkPicture *wpic, const MPVPicture *pic) +{ + for (int i = 0; i < MPV_MAX_PLANES; i++) { + wpic->data[i] = pic->f->data[i]; + wpic->linesize[i] = pic->f->linesize[i]; + } + wpic->qscale_table = pic->qscale_table; + wpic->mb_type = pic->mb_type; + wpic->mbskip_table = pic->mbskip_table; + + for (int i = 0; i < 2; i++) { + wpic->motion_val[i] = pic->motion_val[i]; + wpic->ref_index[i] = pic->ref_index[i]; + } + wpic->reference = pic->reference; +} + +void ff_mpv_replace_picture(MPVWorkPicture *dst, const MPVWorkPicture *src) +{ + memcpy(dst, src, sizeof(*dst)); +} + +void ff_mpv_workpic_from_pic(MPVWorkPicture *wpic, MPVPicture *pic) +{ + if (!pic) { + memset(wpic, 0, sizeof(*wpic)); + return; + } + wpic->ptr = pic; + set_workpic_from_pic(wpic, pic); +} + int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize) { @@ -143,17 +182,13 @@ static int alloc_picture_tables(BufferPoolContext *pools, MPVPicture *pic, return 0; } -int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVPicture *pic, +int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *wpic, MotionEstContext *me, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height) { + MPVPicture *pic = wpic->ptr; int ret; - for (int i = 0; i < MPV_MAX_PLANES; i++) { - pic->data[i] = pic->f->data[i]; - pic->linesize[i] = pic->f->linesize[i]; - } - ret = ff_mpeg_framesize_alloc(avctx, me, sc, pic->f->linesize[0]); if (ret < 0) @@ -170,6 +205,7 @@ int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVPicture *pic, for (int i = 0; i < 2; i++) pic->motion_val[i] = pic->motion_val_base[i] + 4; } + set_workpic_from_pic(wpic, pic); return 0; fail: @@ -190,9 +226,6 @@ void ff_mpeg_unref_picture(MPVPicture *pic) free_picture_tables(pic); - memset(pic->data, 0, sizeof(pic->data)); - memset(pic->linesize, 0, sizeof(pic->linesize)); - pic->dummy = 0; pic->field_picture = 0; @@ -236,11 +269,6 @@ int ff_mpeg_ref_picture(MPVPicture *dst, MPVPicture *src) if (ret < 0) goto fail; - for (int i = 0; i < MPV_MAX_PLANES; i++) { - dst->data[i] = src->data[i]; - dst->linesize[i] = src->linesize[i]; - } - update_picture_tables(dst, src); ff_refstruct_replace(&dst->hwaccel_picture_private, diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index f0837b158a..7bf204dd5b 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -58,9 +58,6 @@ typedef struct MPVPicture { struct AVFrame *f; ThreadFrame tf; - uint8_t *data[MPV_MAX_PLANES]; - ptrdiff_t linesize[MPV_MAX_PLANES]; - int8_t *qscale_table_base; int8_t *qscale_table; @@ -93,10 +90,30 @@ typedef struct MPVPicture { int coded_picture_number; } MPVPicture; +typedef struct MPVWorkPicture { + uint8_t *data[MPV_MAX_PLANES]; + ptrdiff_t linesize[MPV_MAX_PLANES]; + + MPVPicture *ptr; + + int8_t *qscale_table; + + int16_t (*motion_val[2])[2]; + + uint32_t *mb_type; ///< types and macros are defined in mpegutils.h + + uint8_t *mbskip_table; + + int8_t *ref_index[2]; + + int reference; +} MPVWorkPicture; + /** - * Allocate an MPVPicture's accessories, but not the AVFrame's buffer itself. + * Allocate an MPVPicture's accessories (but not the AVFrame's buffer itself) + * and set the MPVWorkPicture's fields. */ -int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVPicture *pic, +int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *pic, MotionEstContext *me, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height); @@ -113,6 +130,9 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize); int ff_mpeg_ref_picture(MPVPicture *dst, MPVPicture *src); +void ff_mpv_unref_picture(MPVWorkPicture *pic); +void ff_mpv_workpic_from_pic(MPVWorkPicture *wpic, MPVPicture *pic); +void ff_mpv_replace_picture(MPVWorkPicture *dst, const MPVWorkPicture *src); void ff_mpeg_unref_picture(MPVPicture *picture); void ff_mpv_picture_free(MPVPicture *pic); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c24b7207b1..e062749291 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -763,11 +763,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) goto fail_nomem; } - if (!(s->next_pic.f = av_frame_alloc()) || - !(s->last_pic.f = av_frame_alloc()) || - !(s->cur_pic.f = av_frame_alloc())) - goto fail_nomem; - if ((ret = ff_mpv_init_context_frame(s))) goto fail; @@ -840,15 +835,9 @@ void ff_mpv_common_end(MpegEncContext *s) ff_mpv_picture_free(&s->picture[i]); } av_freep(&s->picture); - ff_mpv_picture_free(&s->last_pic); - ff_mpv_picture_free(&s->cur_pic); - ff_mpv_picture_free(&s->next_pic); s->context_initialized = 0; s->context_reinit = 0; - s->last_pic_ptr = - s->next_pic_ptr = - s->cur_pic_ptr = NULL; s->linesize = s->uvlinesize = 0; } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 6d96376a6e..3e2c98b039 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -156,13 +156,13 @@ typedef struct MpegEncContext { * copy of the previous picture structure. * note, linesize & data, might not match the previous picture (for field pictures) */ - MPVPicture last_pic; + MPVWorkPicture last_pic; /** * copy of the next picture structure. * note, linesize & data, might not match the next picture (for field pictures) */ - MPVPicture next_pic; + MPVWorkPicture next_pic; /** * Reference to the source picture for encoding. @@ -174,11 +174,8 @@ typedef struct MpegEncContext { * copy of the current picture structure. * note, linesize & data, might not match the current picture (for field pictures) */ - MPVPicture cur_pic; + MPVWorkPicture cur_pic; - MPVPicture *last_pic_ptr; ///< pointer to the previous picture. - MPVPicture *next_pic_ptr; ///< pointer to the next picture (for bidir pred) - MPVPicture *cur_pic_ptr; ///< pointer to the current picture int skipped_last_frame; int last_dc[3]; ///< last DC values for MPEG-1 int16_t *dc_val_base; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 97efd4fe81..71a6c0ad67 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -114,12 +114,10 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, #define UPDATE_PICTURE(pic)\ do {\ - ff_mpeg_unref_picture(&s->pic);\ - if (s1->pic.f && s1->pic.f->buf[0]) {\ - ret = ff_mpeg_ref_picture(&s->pic, &s1->pic);\ - if (ret < 0)\ - return ret;\ - }\ + if (s->picture && s1->picture && s1->pic.ptr && s1->pic.ptr->f->buf[0]) {\ + ff_mpv_workpic_from_pic(&s->pic, &s->picture[s1->pic.ptr - s1->picture]);\ + } else\ + ff_mpv_unref_picture(&s->pic);\ } while (0) UPDATE_PICTURE(cur_pic); @@ -129,15 +127,6 @@ do {\ s->linesize = s1->linesize; s->uvlinesize = s1->uvlinesize; -#define REBASE_PICTURE(pic, new_ctx, old_ctx) \ - ((pic && pic >= old_ctx->picture && \ - pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \ - &new_ctx->picture[pic - old_ctx->picture] : NULL) - - s->last_pic_ptr = REBASE_PICTURE(s1->last_pic_ptr, s, s1); - s->cur_pic_ptr = REBASE_PICTURE(s1->cur_pic_ptr, s, s1); - s->next_pic_ptr = REBASE_PICTURE(s1->next_pic_ptr, s, s1); - // Error/bug resilience s->workaround_bugs = s1->workaround_bugs; s->padding_bug_score = s1->padding_bug_score; @@ -193,9 +182,9 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s) ff_mpv_free_context_frame(s); - s->last_pic_ptr = - s->next_pic_ptr = - s->cur_pic_ptr = NULL; + s->last_pic.ptr = + s->next_pic.ptr = + s->cur_pic.ptr = NULL; if ((s->width || s->height) && (err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0) @@ -228,7 +217,7 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s) return err; } -static int alloc_picture(MpegEncContext *s, MPVPicture **picp, int reference) +static int alloc_picture(MpegEncContext *s, MPVWorkPicture *dst, int reference) { AVCodecContext *avctx = s->avctx; int idx = ff_find_unused_picture(s->avctx, s->picture, 0); @@ -239,6 +228,7 @@ static int alloc_picture(MpegEncContext *s, MPVPicture **picp, int reference) return idx; pic = &s->picture[idx]; + dst->ptr = pic; pic->tf.f = pic->f; pic->reference = reference; @@ -271,36 +261,27 @@ static int alloc_picture(MpegEncContext *s, MPVPicture **picp, int reference) av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height || FFALIGN(s->mb_height, 2) == s->buffer_pools.alloc_mb_height); av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); - ret = ff_mpv_alloc_pic_accessories(s->avctx, pic, &s->me, &s->sc, + ret = ff_mpv_alloc_pic_accessories(s->avctx, dst, &s->me, &s->sc, &s->buffer_pools, s->mb_height); if (ret < 0) goto fail; - *picp = pic; return 0; fail: - ff_mpeg_unref_picture(pic); + ff_mpv_unref_picture(dst); return ret; } -static int av_cold alloc_dummy_frame(MpegEncContext *s, MPVPicture **picp, MPVPicture *wpic) +static int av_cold alloc_dummy_frame(MpegEncContext *s, MPVWorkPicture *dst) { MPVPicture *pic; - int ret = alloc_picture(s, &pic, 1); + int ret = alloc_picture(s, dst, 1); if (ret < 0) return ret; + pic = dst->ptr; pic->dummy = 1; - ff_mpeg_unref_picture(wpic); - ret = ff_mpeg_ref_picture(wpic, pic); - if (ret < 0) { - ff_mpeg_unref_picture(pic); - return ret; - } - - *picp = pic; - ff_thread_report_progress(&pic->tf, INT_MAX, 0); ff_thread_report_progress(&pic->tf, INT_MAX, 1); @@ -330,9 +311,9 @@ int ff_mpv_alloc_dummy_frames(MpegEncContext *s) AVCodecContext *avctx = s->avctx; int ret; - if ((!s->last_pic_ptr || !s->last_pic_ptr->f->buf[0]) && + if ((!s->last_pic.ptr || !s->last_pic.ptr->f->buf[0]) && (s->pict_type != AV_PICTURE_TYPE_I)) { - if (s->pict_type == AV_PICTURE_TYPE_B && s->next_pic_ptr && s->next_pic_ptr->f->buf[0]) + if (s->pict_type == AV_PICTURE_TYPE_B && s->next_pic.ptr && s->next_pic.ptr->f->buf[0]) av_log(avctx, AV_LOG_DEBUG, "allocating dummy last picture for B frame\n"); else if (s->codec_id != AV_CODEC_ID_H261 /* H.261 has no keyframes */ && @@ -341,25 +322,25 @@ int ff_mpv_alloc_dummy_frames(MpegEncContext *s) "warning: first frame is no keyframe\n"); /* Allocate a dummy frame */ - ret = alloc_dummy_frame(s, &s->last_pic_ptr, &s->last_pic); + ret = alloc_dummy_frame(s, &s->last_pic); if (ret < 0) return ret; if (!avctx->hwaccel) { int luma_val = s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263 ? 16 : 0x80; - color_frame(s->last_pic_ptr->f, luma_val); + color_frame(s->last_pic.ptr->f, luma_val); } } - if ((!s->next_pic_ptr || !s->next_pic_ptr->f->buf[0]) && + if ((!s->next_pic.ptr || !s->next_pic.ptr->f->buf[0]) && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ - ret = alloc_dummy_frame(s, &s->next_pic_ptr, &s->next_pic); + ret = alloc_dummy_frame(s, &s->next_pic); if (ret < 0) return ret; } - av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_pic_ptr && - s->last_pic_ptr->f->buf[0])); + av_assert0(s->pict_type == AV_PICTURE_TYPE_I || (s->last_pic.ptr && + s->last_pic.ptr->f->buf[0])); return 0; } @@ -380,68 +361,49 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) } /* mark & release old frames */ - if (s->pict_type != AV_PICTURE_TYPE_B && s->last_pic_ptr && - s->last_pic_ptr != s->next_pic_ptr && - s->last_pic_ptr->f->buf[0]) { - ff_mpeg_unref_picture(s->last_pic_ptr); + if (s->pict_type != AV_PICTURE_TYPE_B && s->last_pic.ptr && + s->last_pic.ptr != s->next_pic.ptr && + s->last_pic.ptr->f->buf[0]) { + ff_mpeg_unref_picture(s->last_pic.ptr); } /* release non reference/forgotten frames */ for (int i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference || - (&s->picture[i] != s->last_pic_ptr && - &s->picture[i] != s->next_pic_ptr)) { + (&s->picture[i] != s->last_pic.ptr && + &s->picture[i] != s->next_pic.ptr)) { ff_mpeg_unref_picture(&s->picture[i]); } } - ff_mpeg_unref_picture(&s->cur_pic); - ff_mpeg_unref_picture(&s->last_pic); - ff_mpeg_unref_picture(&s->next_pic); - - ret = alloc_picture(s, &s->cur_pic_ptr, + ret = alloc_picture(s, &s->cur_pic, s->pict_type != AV_PICTURE_TYPE_B && !s->droppable); if (ret < 0) return ret; - s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!s->top_field_first; - s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * + s->cur_pic.ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!s->top_field_first; + s->cur_pic.ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (!s->progressive_frame && !s->progressive_sequence); - s->cur_pic_ptr->field_picture = s->picture_structure != PICT_FRAME; + s->cur_pic.ptr->field_picture = s->picture_structure != PICT_FRAME; - s->cur_pic_ptr->f->pict_type = s->pict_type; + s->cur_pic.ptr->f->pict_type = s->pict_type; if (s->pict_type == AV_PICTURE_TYPE_I) - s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_KEY; + s->cur_pic.ptr->f->flags |= AV_FRAME_FLAG_KEY; else - s->cur_pic_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; - - if ((ret = ff_mpeg_ref_picture(&s->cur_pic, s->cur_pic_ptr)) < 0) - return ret; + s->cur_pic.ptr->f->flags &= ~AV_FRAME_FLAG_KEY; if (s->pict_type != AV_PICTURE_TYPE_B) { - s->last_pic_ptr = s->next_pic_ptr; + ff_mpv_workpic_from_pic(&s->last_pic, s->next_pic.ptr); if (!s->droppable) - s->next_pic_ptr = s->cur_pic_ptr; + ff_mpv_workpic_from_pic(&s->next_pic, s->cur_pic.ptr); } ff_dlog(s->avctx, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", - s->last_pic_ptr, s->next_pic_ptr, s->cur_pic_ptr, - s->last_pic_ptr ? s->last_pic_ptr->f->data[0] : NULL, - s->next_pic_ptr ? s->next_pic_ptr->f->data[0] : NULL, - s->cur_pic_ptr ? s->cur_pic_ptr->f->data[0] : NULL, + (void*)s->last_pic.ptr, (void*)s->next_pic.ptr, (void*)s->cur_pic.ptr, + s->last_pic.ptr ? s->last_pic.ptr->f->data[0] : NULL, + s->next_pic.ptr ? s->next_pic.ptr->f->data[0] : NULL, + s->cur_pic.ptr ? s->cur_pic.ptr->f->data[0] : NULL, s->pict_type, s->droppable); - if (s->last_pic_ptr) { - if (s->last_pic_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->last_pic, - s->last_pic_ptr)) < 0) - return ret; - } - if (s->next_pic_ptr) { - if (s->next_pic_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->next_pic, s->next_pic_ptr)) < 0) - return ret; - } - ret = ff_mpv_alloc_dummy_frames(s); if (ret < 0) return ret; @@ -461,7 +423,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) } if (s->avctx->debug & FF_DEBUG_NOMC) - color_frame(s->cur_pic_ptr->f, 0x80); + color_frame(s->cur_pic.ptr->f, 0x80); return 0; } @@ -472,7 +434,7 @@ void ff_mpv_frame_end(MpegEncContext *s) emms_c(); if (s->cur_pic.reference) - ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); + ff_thread_report_progress(&s->cur_pic.ptr->tf, INT_MAX, 0); } void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict) @@ -515,8 +477,8 @@ int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h) { - ff_draw_horiz_band(s->avctx, s->cur_pic_ptr->f, - s->last_pic_ptr ? s->last_pic_ptr->f : NULL, + ff_draw_horiz_band(s->avctx, s->cur_pic.ptr->f, + s->last_pic.ptr ? s->last_pic.ptr->f : NULL, y, h, s->picture_structure, s->first_field, s->low_delay); } @@ -530,11 +492,10 @@ void ff_mpeg_flush(AVCodecContext *avctx) for (int i = 0; i < MAX_PICTURE_COUNT; i++) ff_mpeg_unref_picture(&s->picture[i]); - s->cur_pic_ptr = s->last_pic_ptr = s->next_pic_ptr = NULL; - ff_mpeg_unref_picture(&s->cur_pic); - ff_mpeg_unref_picture(&s->last_pic); - ff_mpeg_unref_picture(&s->next_pic); + ff_mpv_unref_picture(&s->cur_pic); + ff_mpv_unref_picture(&s->last_pic); + ff_mpv_unref_picture(&s->next_pic); s->mb_x = s->mb_y = 0; @@ -545,7 +506,7 @@ void ff_mpeg_flush(AVCodecContext *avctx) void ff_mpv_report_decode_progress(MpegEncContext *s) { if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->er.error_occurred) - ff_thread_report_progress(&s->cur_pic_ptr->tf, s->mb_y, 0); + ff_thread_report_progress(&s->cur_pic.ptr->tf, s->mb_y, 0); } @@ -864,7 +825,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, } else { if (s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { - ref_picture = s->cur_pic_ptr->f->data; + ref_picture = s->cur_pic.ptr->f->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][0], @@ -881,7 +842,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { ref2picture = ref_picture; } else { - ref2picture = s->cur_pic_ptr->f->data; + ref2picture = s->cur_pic.ptr->f->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, @@ -922,7 +883,7 @@ static inline void MPV_motion_lowres(MpegEncContext *s, // opposite parity is always in the same // frame if this is second field if (!s->first_field) { - ref_picture = s->cur_pic_ptr->f->data; + ref_picture = s->cur_pic.ptr->f->data; } } } diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 251b954210..cd25cd3221 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1356,7 +1356,7 @@ static int estimate_best_b_count(MpegEncContext *s) for (i = 0; i < s->max_b_frames + 2; i++) { const MPVPicture *pre_input_ptr = i ? s->input_picture[i - 1] : - s->next_pic_ptr; + s->next_pic.ptr; if (pre_input_ptr) { const uint8_t *data[4]; @@ -1484,8 +1484,8 @@ static int select_input_picture(MpegEncContext *s) if (!s->reordered_input_picture[0] && s->input_picture[0]) { if (s->frame_skip_threshold || s->frame_skip_factor) { if (s->picture_in_gop_number < s->gop_size && - s->next_pic_ptr && - skip_check(s, s->input_picture[0], s->next_pic_ptr)) { + s->next_pic.ptr && + skip_check(s, s->input_picture[0], s->next_pic.ptr)) { // FIXME check that the gop check above is +-1 correct ff_mpeg_unref_picture(s->input_picture[0]); @@ -1496,7 +1496,7 @@ static int select_input_picture(MpegEncContext *s) } if (/*s->picture_in_gop_number >= s->gop_size ||*/ - !s->next_pic_ptr || s->intra_only) { + !s->next_pic.ptr || s->intra_only) { s->reordered_input_picture[0] = s->input_picture[0]; s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; s->reordered_input_picture[0]->coded_picture_number = @@ -1624,17 +1624,17 @@ no_output_pic: s->new_pic->data[i] += INPLACE_OFFSET; } } - s->cur_pic_ptr = s->reordered_input_picture[0]; + s->cur_pic.ptr = s->reordered_input_picture[0]; av_assert1(s->mb_width == s->buffer_pools.alloc_mb_width); av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height); av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); - ret = ff_mpv_alloc_pic_accessories(s->avctx, s->cur_pic_ptr, &s->me, + ret = ff_mpv_alloc_pic_accessories(s->avctx, &s->cur_pic, &s->me, &s->sc, &s->buffer_pools, s->mb_height); if (ret < 0) { - ff_mpeg_unref_picture(s->cur_pic_ptr); + ff_mpv_unref_picture(&s->cur_pic); return ret; } - s->picture_number = s->cur_pic_ptr->display_picture_number; + s->picture_number = s->cur_pic.ptr->display_picture_number; } return 0; @@ -1674,7 +1674,7 @@ static void frame_end(MpegEncContext *s) emms_c(); s->last_pict_type = s->pict_type; - s->last_lambda_for [s->pict_type] = s->cur_pic_ptr->f->quality; + s->last_lambda_for [s->pict_type] = s->cur_pic.ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; } @@ -1700,47 +1700,26 @@ static void update_noise_reduction(MpegEncContext *s) } } -static int frame_start(MpegEncContext *s) +static void frame_start(MpegEncContext *s) { - int ret; - /* mark & release old frames */ - if (s->pict_type != AV_PICTURE_TYPE_B && s->last_pic_ptr && - s->last_pic_ptr != s->next_pic_ptr && - s->last_pic_ptr->f->buf[0]) { - ff_mpeg_unref_picture(s->last_pic_ptr); + if (s->pict_type != AV_PICTURE_TYPE_B && s->last_pic.ptr && + s->last_pic.ptr != s->next_pic.ptr && + s->last_pic.ptr->f->buf[0]) { + ff_mpv_unref_picture(&s->last_pic); } - s->cur_pic_ptr->f->pict_type = s->pict_type; - - ff_mpeg_unref_picture(&s->cur_pic); - if ((ret = ff_mpeg_ref_picture(&s->cur_pic, s->cur_pic_ptr)) < 0) - return ret; + s->cur_pic.ptr->f->pict_type = s->pict_type; if (s->pict_type != AV_PICTURE_TYPE_B) { - s->last_pic_ptr = s->next_pic_ptr; - s->next_pic_ptr = s->cur_pic_ptr; - } - - if (s->last_pic_ptr) { - ff_mpeg_unref_picture(&s->last_pic); - if (s->last_pic_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->last_pic, s->last_pic_ptr)) < 0) - return ret; - } - if (s->next_pic_ptr) { - ff_mpeg_unref_picture(&s->next_pic); - if (s->next_pic_ptr->f->buf[0] && - (ret = ff_mpeg_ref_picture(&s->next_pic, s->next_pic_ptr)) < 0) - return ret; + ff_mpv_replace_picture(&s->last_pic, &s->next_pic); + ff_mpv_replace_picture(&s->next_pic, &s->cur_pic); } if (s->dct_error_sum) { av_assert2(s->noise_reduction && s->encoding); update_noise_reduction(s); } - - return 0; } int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, @@ -1793,9 +1772,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, s->pict_type = s->new_pic->pict_type; //emms_c(); - ret = frame_start(s); - if (ret < 0) - return ret; + frame_start(s); vbv_retry: ret = encode_picture(s); if (growing_buffer) { @@ -1858,7 +1835,7 @@ vbv_retry: for (int i = 0; i < MPV_MAX_PLANES; i++) avctx->error[i] += s->encoding_error[i]; - ff_side_data_set_encoder_stats(pkt, s->cur_pic.f->quality, + ff_side_data_set_encoder_stats(pkt, s->cur_pic.ptr->f->quality, s->encoding_error, (avctx->flags&AV_CODEC_FLAG_PSNR) ? MPV_MAX_PLANES : 0, s->pict_type); @@ -1952,10 +1929,10 @@ vbv_retry: } s->total_bits += s->frame_bits; - pkt->pts = s->cur_pic.f->pts; - pkt->duration = s->cur_pic.f->duration; + pkt->pts = s->cur_pic.ptr->f->pts; + pkt->duration = s->cur_pic.ptr->f->duration; if (!s->low_delay && s->pict_type != AV_PICTURE_TYPE_B) { - if (!s->cur_pic.coded_picture_number) + if (!s->cur_pic.ptr->coded_picture_number) pkt->dts = pkt->pts - s->dts_delta; else pkt->dts = s->reordered_pts; @@ -1965,12 +1942,12 @@ vbv_retry: // the no-delay case is handled in generic code if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY) { - ret = ff_encode_reordered_opaque(avctx, pkt, s->cur_pic.f); + ret = ff_encode_reordered_opaque(avctx, pkt, s->cur_pic.ptr->f); if (ret < 0) return ret; } - if (s->cur_pic.f->flags & AV_FRAME_FLAG_KEY) + if (s->cur_pic.ptr->f->flags & AV_FRAME_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY; if (s->mb_info) av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size); @@ -3512,14 +3489,12 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) static int estimate_qp(MpegEncContext *s, int dry_run){ if (s->next_lambda){ - s->cur_pic_ptr->f->quality = - s->cur_pic.f->quality = s->next_lambda; + s->cur_pic.ptr->f->quality = s->next_lambda; if(!dry_run) s->next_lambda= 0; } else if (!s->fixed_qscale) { int quality = ff_rate_estimate_qscale(s, dry_run); - s->cur_pic_ptr->f->quality = - s->cur_pic.f->quality = quality; - if (s->cur_pic.f->quality < 0) + s->cur_pic.ptr->f->quality = quality; + if (s->cur_pic.ptr->f->quality < 0) return -1; } @@ -3542,15 +3517,15 @@ static int estimate_qp(MpegEncContext *s, int dry_run){ s->lambda= s->lambda_table[0]; //FIXME broken }else - s->lambda = s->cur_pic.f->quality; + s->lambda = s->cur_pic.ptr->f->quality; update_qscale(s); return 0; } /* must be called before writing the header */ static void set_frame_distances(MpegEncContext * s){ - av_assert1(s->cur_pic_ptr->f->pts != AV_NOPTS_VALUE); - s->time = s->cur_pic_ptr->f->pts * s->avctx->time_base.num; + av_assert1(s->cur_pic.ptr->f->pts != AV_NOPTS_VALUE); + s->time = s->cur_pic.ptr->f->pts * s->avctx->time_base.num; if(s->pict_type==AV_PICTURE_TYPE_B){ s->pb_time= s->pp_time - (s->last_non_b_time - s->time); @@ -3581,7 +3556,7 @@ static int encode_picture(MpegEncContext *s) s->me.scene_change_score=0; -// s->lambda= s->cur_pic_ptr->quality; //FIXME qscale / ... stuff for ME rate distortion +// s->lambda= s->cur_pic.ptr->quality; //FIXME qscale / ... stuff for ME rate distortion if(s->pict_type==AV_PICTURE_TYPE_I){ if(s->msmpeg4_version >= 3) s->no_rounding=1; @@ -3769,18 +3744,14 @@ static int encode_picture(MpegEncContext *s) } } - //FIXME var duplication if (s->pict_type == AV_PICTURE_TYPE_I) { - s->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_KEY; //FIXME pic_ptr - s->cur_pic.f->flags |= AV_FRAME_FLAG_KEY; + s->cur_pic.ptr->f->flags |= AV_FRAME_FLAG_KEY; } else { - s->cur_pic_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; //FIXME pic_ptr - s->cur_pic.f->flags &= ~AV_FRAME_FLAG_KEY; + s->cur_pic.ptr->f->flags &= ~AV_FRAME_FLAG_KEY; } - s->cur_pic_ptr->f->pict_type = - s->cur_pic.f->pict_type = s->pict_type; + s->cur_pic.ptr->f->pict_type = s->pict_type; - if (s->cur_pic.f->flags & AV_FRAME_FLAG_KEY) + if (s->cur_pic.ptr->f->flags & AV_FRAME_FLAG_KEY) s->picture_in_gop_number=0; s->mb_x = s->mb_y = 0; diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index 56d794974b..6e9368dd9c 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -514,7 +514,7 @@ static inline void apply_obmc(MpegEncContext *s, const op_pixels_func (*pix_op)[4]) { LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); - const MPVPicture *cur_frame = &s->cur_pic; + const MPVWorkPicture *cur_frame = &s->cur_pic; int mb_x = s->mb_x; int mb_y = s->mb_y; const int xy = mb_x + mb_y * s->mb_stride; @@ -749,7 +749,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, av_assert2(s->out_format == FMT_MPEG1); if (s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { - ref_picture = s->cur_pic_ptr->f->data; + ref_picture = s->cur_pic.ptr->f->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -767,7 +767,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { ref2picture = ref_picture; } else { - ref2picture = s->cur_pic_ptr->f->data; + ref2picture = s->cur_pic.ptr->f->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -807,7 +807,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s, /* opposite parity is always in the same frame if this is * second field */ if (!s->first_field) - ref_picture = s->cur_pic_ptr->f->data; + ref_picture = s->cur_pic.ptr->f->data; } } break; diff --git a/libavcodec/mpv_reconstruct_mb_template.c b/libavcodec/mpv_reconstruct_mb_template.c index 2da2218042..549c55ffad 100644 --- a/libavcodec/mpv_reconstruct_mb_template.c +++ b/libavcodec/mpv_reconstruct_mb_template.c @@ -124,11 +124,11 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], if (HAVE_THREADS && is_mpeg12 != DEFINITELY_MPEG12 && s->avctx->active_thread_type & FF_THREAD_FRAME) { if (s->mv_dir & MV_DIR_FORWARD) { - ff_thread_await_progress(&s->last_pic_ptr->tf, + ff_thread_await_progress(&s->last_pic.ptr->tf, lowest_referenced_row(s, 0), 0); } if (s->mv_dir & MV_DIR_BACKWARD) { - ff_thread_await_progress(&s->next_pic_ptr->tf, + ff_thread_await_progress(&s->next_pic.ptr->tf, lowest_referenced_row(s, 1), 0); } } diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 05319436b6..1888053eb2 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -382,7 +382,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, MSS12Context *c = &ctx->c; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - MPVPicture *f; + MPVWorkPicture *f; int ret; ff_mpeg_flush(avctx); diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c index 76ef81ea4d..99b2b14f1f 100644 --- a/libavcodec/nvdec_mpeg12.c +++ b/libavcodec/nvdec_mpeg12.c @@ -39,7 +39,7 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer CUVIDMPEG2PICPARAMS *ppc = &pp->CodecSpecific.mpeg2; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->cur_pic.f; + AVFrame *cur_frame = s->cur_pic.ptr->f; int ret, i; @@ -64,8 +64,8 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer s->pict_type == AV_PICTURE_TYPE_P, .CodecSpecific.mpeg2 = { - .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.f), - .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.f), + .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.ptr ? s->last_pic.ptr->f : NULL), + .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.ptr ? s->next_pic.ptr->f : NULL), .picture_coding_type = s->pict_type, .full_pel_forward_vector = s->full_pel[0], diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c index 468002d1c5..80da11b5b1 100644 --- a/libavcodec/nvdec_mpeg4.c +++ b/libavcodec/nvdec_mpeg4.c @@ -38,7 +38,7 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, CUVIDMPEG4PICPARAMS *ppc = &pp->CodecSpecific.mpeg4; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->cur_pic.f; + AVFrame *cur_frame = s->cur_pic.ptr->f; int ret, i; @@ -60,8 +60,8 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, s->pict_type == AV_PICTURE_TYPE_S, .CodecSpecific.mpeg4 = { - .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.f), - .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.f), + .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.ptr ? s->last_pic.ptr->f : NULL), + .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.ptr ? s->next_pic.ptr->f : NULL), .video_object_layer_width = s->width, .video_object_layer_height = s->height, diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c index 40cd18a8e7..0668863cb4 100644 --- a/libavcodec/nvdec_vc1.c +++ b/libavcodec/nvdec_vc1.c @@ -38,7 +38,7 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u CUVIDPICPARAMS *pp = &ctx->pic_params; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->cur_pic.f; + AVFrame *cur_frame = s->cur_pic.ptr->f; int ret; @@ -63,8 +63,8 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u s->pict_type == AV_PICTURE_TYPE_P, .CodecSpecific.vc1 = { - .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.f), - .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.f), + .ForwardRefIdx = ff_nvdec_get_ref_idx(s->last_pic.ptr ? s->last_pic.ptr->f : NULL), + .BackwardRefIdx = ff_nvdec_get_ref_idx(s->next_pic.ptr ? s->next_pic.ptr->f : NULL), .FrameWidth = cur_frame->width, .FrameHeight = cur_frame->height, diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 1429b3a93a..609d47faeb 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -40,10 +40,10 @@ void ff_write_pass1_stats(MpegEncContext *s) snprintf(s->avctx->stats_out, 256, "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d " "fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d hbits:%d;\n", - s->cur_pic_ptr->display_picture_number, - s->cur_pic_ptr->coded_picture_number, + s->cur_pic.ptr->display_picture_number, + s->cur_pic.ptr->coded_picture_number, s->pict_type, - s->cur_pic.f->quality, + s->cur_pic.ptr->f->quality, s->i_tex_bits, s->p_tex_bits, s->mv_bits, @@ -936,9 +936,9 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) * here instead of reordering but the reordering is simpler for now * until H.264 B-pyramid must be handled. */ if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) - dts_pic = s->cur_pic_ptr; + dts_pic = s->cur_pic.ptr; else - dts_pic = s->last_pic_ptr; + dts_pic = s->last_pic.ptr; if (!dts_pic || dts_pic->f->pts == AV_NOPTS_VALUE) wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index aea42dd314..201e7ed6d0 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -170,7 +170,7 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) av_log(s->avctx, AV_LOG_ERROR, "low delay B\n"); return -1; } - if (!s->last_pic_ptr && s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->last_pic.ptr && s->pict_type == AV_PICTURE_TYPE_B) { av_log(s->avctx, AV_LOG_ERROR, "early B-frame\n"); return AVERROR_INVALIDDATA; } @@ -458,9 +458,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, if (whole_size < s->mb_width * s->mb_height / 8) return AVERROR_INVALIDDATA; - if ((s->mb_x == 0 && s->mb_y == 0) || !s->cur_pic_ptr) { + if ((s->mb_x == 0 && s->mb_y == 0) || !s->cur_pic.ptr) { // FIXME write parser so we always have complete frames? - if (s->cur_pic_ptr) { + if (s->cur_pic.ptr) { ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); s->mb_x = s->mb_y = s->resync_mb_x = s->resync_mb_y = 0; @@ -469,7 +469,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, return ret; ff_mpeg_er_frame_start(s); } else { - if (s->cur_pic_ptr->f->pict_type != s->pict_type) { + if (s->cur_pic.ptr->f->pict_type != s->pict_type) { av_log(s->avctx, AV_LOG_ERROR, "Slice type mismatch\n"); return AVERROR_INVALIDDATA; } @@ -632,28 +632,28 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, i++; } - if (s->cur_pic_ptr && s->mb_y >= s->mb_height) { + if (s->cur_pic.ptr && s->mb_y >= s->mb_height) { ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->cur_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); - } else if (s->last_pic_ptr) { - if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) + ff_print_debug_info(s, s->cur_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG1); + } else if (s->last_pic.ptr) { + if ((ret = av_frame_ref(pict, s->last_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict,s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->last_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict,s->last_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG1); } - if (s->last_pic_ptr || s->low_delay) { + if (s->last_pic.ptr || s->low_delay) { *got_frame = 1; } // so we can detect if frame_end was not called (find some nicer solution...) - s->cur_pic_ptr = NULL; + s->cur_pic.ptr = NULL; } return avpkt->size; diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 284de14e8c..d935c261b5 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -565,7 +565,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) int has_A = 0, has_B = 0, has_C = 0; int mx, my; int i, j; - MPVPicture *cur_pic = &s->cur_pic; + MPVWorkPicture *cur_pic = &s->cur_pic; const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0; int type = cur_pic->mb_type[mb_pos]; @@ -719,7 +719,7 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { /* wait for the referenced mb row to be finished */ int mb_row = s->mb_y + ((yoff + my + 5 + 8 * height) >> 4); - const ThreadFrame *f = dir ? &s->next_pic_ptr->tf : &s->last_pic_ptr->tf; + const ThreadFrame *f = dir ? &s->next_pic.ptr->tf : &s->last_pic.ptr->tf; ff_thread_await_progress(f, mb_row, 0); } @@ -899,7 +899,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) //surprisingly, it uses motion scheme from next reference frame /* wait for the current mb row to be finished */ if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_await_progress(&s->next_pic_ptr->tf, FFMAX(0, s->mb_y-1), 0); + ff_thread_await_progress(&s->next_pic.ptr->tf, FFMAX(0, s->mb_y-1), 0); next_bt = s->next_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride]; if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){ @@ -1483,7 +1483,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int r->loop_filter(r, s->mb_y - 2); if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_report_progress(&s->cur_pic_ptr->tf, + ff_thread_report_progress(&s->cur_pic.ptr->tf, s->mb_y - 2, 0); } @@ -1581,19 +1581,19 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) s->mb_num_left = 0; if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); + ff_thread_report_progress(&s->cur_pic.ptr->tf, INT_MAX, 0); if (s->pict_type == AV_PICTURE_TYPE_B) { - if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->cur_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->cur_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->cur_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->cur_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG1); got_picture = 1; - } else if (s->last_pic_ptr) { - if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) + } else if (s->last_pic.ptr) { + if ((ret = av_frame_ref(pict, s->last_pic.ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_pic_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_pic_ptr, FF_MPV_QSCALE_TYPE_MPEG1); + ff_print_debug_info(s, s->last_pic.ptr, pict); + ff_mpv_export_qp_table(s, pict, s->last_pic.ptr, FF_MPV_QSCALE_TYPE_MPEG1); got_picture = 1; } @@ -1628,10 +1628,10 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ - if (s->next_pic_ptr) { - if ((ret = av_frame_ref(pict, s->next_pic_ptr->f)) < 0) + if (s->next_pic.ptr) { + if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0) return ret; - s->next_pic_ptr = NULL; + s->next_pic.ptr = NULL; *got_picture_ptr = 1; } @@ -1654,7 +1654,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); return AVERROR_INVALIDDATA; } - if ((!s->last_pic_ptr || !s->last_pic_ptr->f->data[0]) && + if ((!s->last_pic.ptr || !s->last_pic.ptr->f->data[0]) && si.type == AV_PICTURE_TYPE_B) { av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference data.\n"); @@ -1667,7 +1667,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* first slice */ if (si.start == 0) { - if (s->mb_num_left > 0 && s->cur_pic_ptr) { + if (s->mb_num_left > 0 && s->cur_pic.ptr) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); if (!s->context_reinit) @@ -1792,7 +1792,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, break; } - if (s->cur_pic_ptr) { + if (s->cur_pic.ptr) { if (last) { if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); @@ -1809,7 +1809,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); s->mb_num_left = 0; - ff_thread_report_progress(&s->cur_pic_ptr->tf, INT_MAX, 0); + ff_thread_report_progress(&s->cur_pic.ptr->tf, INT_MAX, 0); return AVERROR_INVALIDDATA; } } diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 1ed7581fea..8d6dabae65 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -62,6 +62,7 @@ typedef struct SnowEncContext { MECmpContext mecc; MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX) + MPVPicture cur_pic, last_pic; #define ME_CACHE_SIZE 1024 unsigned me_cache[ME_CACHE_SIZE]; unsigned me_cache_generation; @@ -1834,9 +1835,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (ret < 0) return ret; - mpv->cur_pic_ptr = &mpv->cur_pic; - mpv->cur_pic.f = s->current_picture; - mpv->cur_pic.f->pts = pict->pts; + mpv->cur_pic.ptr = &enc->cur_pic; + mpv->cur_pic.ptr->f = s->current_picture; + mpv->cur_pic.ptr->f->pts = pict->pts; if(pic->pict_type == AV_PICTURE_TYPE_P){ int block_width = (width +15)>>4; int block_height= (height+15)>>4; @@ -1846,9 +1847,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, av_assert0(s->last_picture[0]->data[0]); mpv->avctx = s->avctx; - mpv->last_pic.f = s->last_picture[0]; + mpv->last_pic.ptr = &enc->last_pic; + mpv->last_pic.ptr->f = s->last_picture[0]; mpv-> new_pic = s->input_picture; - mpv->last_pic_ptr = &mpv->last_pic; mpv->linesize = stride; mpv->uvlinesize = s->current_picture->linesize[1]; mpv->width = width; @@ -2043,9 +2044,9 @@ redo_frame: mpv->frame_bits = 8 * (s->c.bytestream - s->c.bytestream_start); mpv->p_tex_bits = mpv->frame_bits - mpv->misc_bits - mpv->mv_bits; mpv->total_bits += 8*(s->c.bytestream - s->c.bytestream_start); - mpv->cur_pic.display_picture_number = - mpv->cur_pic.coded_picture_number = avctx->frame_num; - mpv->cur_pic.f->quality = pic->quality; + enc->cur_pic.display_picture_number = + enc->cur_pic.coded_picture_number = avctx->frame_num; + enc->cur_pic.f->quality = pic->quality; if (enc->pass1_rc) if (ff_rate_estimate_qscale(mpv, 0) < 0) return -1; diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index c75ab1800a..9631fa243d 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -60,6 +60,7 @@ typedef struct SVQ1EncContext { * else, the idea is to make the motion estimation eventually independent * of MpegEncContext, so this will be removed then. */ MpegEncContext m; + MPVPicture cur_pic, last_pic; AVCodecContext *avctx; MECmpContext mecc; HpelDSPContext hdsp; @@ -326,8 +327,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, if (s->pict_type == AV_PICTURE_TYPE_P) { s->m.avctx = s->avctx; - s->m.cur_pic_ptr = &s->m.cur_pic; - s->m.last_pic_ptr = &s->m.last_pic; + s->m.cur_pic.ptr = &s->cur_pic; + s->m.last_pic.ptr = &s->last_pic; s->m.last_pic.data[0] = ref_plane; s->m.linesize = s->m.last_pic.linesize[0] = diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c index 389540fd0c..328a2f7db3 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -42,12 +42,12 @@ static inline int mpeg2_get_is_frame_start(const MpegEncContext *s) static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; VAPictureParameterBufferMPEG2 pic_param; VAIQMatrixBufferMPEG2 iq_matrix; int i, err; - pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic_ptr->f); + pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic.ptr->f); pic_param = (VAPictureParameterBufferMPEG2) { .horizontal_size = s->width, @@ -73,10 +73,10 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_ switch (s->pict_type) { case AV_PICTURE_TYPE_B: - pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.f); + pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.ptr->f); // fall-through case AV_PICTURE_TYPE_P: - pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.f); + pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.ptr->f); break; } @@ -115,7 +115,7 @@ fail: static int vaapi_mpeg2_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; int ret; ret = ff_vaapi_decode_issue(avctx, pic); @@ -131,7 +131,7 @@ fail: static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; VASliceParameterBufferMPEG2 slice_param; GetBitContext gb; uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset; diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index e227bee113..76602c544a 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -49,11 +49,11 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext *s = &ctx->m; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; VAPictureParameterBufferMPEG4 pic_param; int i, err; - pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic_ptr->f); + pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic.ptr->f); pic_param = (VAPictureParameterBufferMPEG4) { .vop_width = s->width, @@ -78,7 +78,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ .vop_fields.bits = { .vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I, .backward_reference_vop_coding_type = - s->pict_type == AV_PICTURE_TYPE_B ? s->next_pic.f->pict_type - AV_PICTURE_TYPE_I : 0, + s->pict_type == AV_PICTURE_TYPE_B ? s->next_pic.ptr->f->pict_type - AV_PICTURE_TYPE_I : 0, .vop_rounding_type = s->no_rounding, .intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx), .top_field_first = s->top_field_first, @@ -100,9 +100,9 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ } if (s->pict_type == AV_PICTURE_TYPE_B) - pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.f); + pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.ptr->f); if (s->pict_type != AV_PICTURE_TYPE_I) - pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.f); + pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.ptr->f); err = ff_vaapi_decode_make_param_buffer(avctx, pic, VAPictureParameterBufferType, @@ -139,7 +139,7 @@ fail: static int vaapi_mpeg4_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; int ret; ret = ff_vaapi_decode_issue(avctx, pic); @@ -155,7 +155,7 @@ fail: static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; VASliceParameterBufferMPEG4 slice_param; int err; diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index ef914cf4b2..8aedad7828 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -253,11 +253,11 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; VAPictureParameterBufferVC1 pic_param; int err; - pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic_ptr->f); + pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic.ptr->f); pic_param = (VAPictureParameterBufferVC1) { .forward_reference_picture = VA_INVALID_ID, @@ -374,10 +374,12 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t switch (s->pict_type) { case AV_PICTURE_TYPE_B: - pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.f); + if (s->next_pic.ptr) + pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.ptr->f); // fall-through case AV_PICTURE_TYPE_P: - pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.f); + if (s->last_pic.ptr) + pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.ptr->f); break; } @@ -450,7 +452,7 @@ static int vaapi_vc1_end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; int ret; ret = ff_vaapi_decode_issue(avctx, pic); @@ -465,7 +467,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; - VAAPIDecodePicture *pic = s->cur_pic_ptr->hwaccel_picture_private; + VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; VASliceParameterBufferVC1 slice_param; int mb_height; int err; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 643232653c..987e77fcc7 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -856,7 +856,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; else v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; - v->s.cur_pic_ptr->f->pict_type = v->s.pict_type; + v->s.cur_pic.ptr->f->pict_type = v->s.pict_type; if (!v->pic_header_flag) goto parse_common_info; } diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 9cb9fd27bf..b880f978d1 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -59,9 +59,9 @@ static inline void init_block_index(VC1Context *v) MpegEncContext *s = &v->s; ff_init_block_index(s); if (v->field_mode && !(v->second_field ^ v->tff)) { - s->dest[0] += s->cur_pic_ptr->f->linesize[0]; - s->dest[1] += s->cur_pic_ptr->f->linesize[1]; - s->dest[2] += s->cur_pic_ptr->f->linesize[2]; + s->dest[0] += s->cur_pic.ptr->f->linesize[0]; + s->dest[1] += s->cur_pic.ptr->f->linesize[1]; + s->dest[2] += s->cur_pic.ptr->f->linesize[2]; } } @@ -2106,7 +2106,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v) if (bmvtype == BMV_TYPE_DIRECT) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[0] = 0; - if (!s->next_pic_ptr->field_picture) { + if (!s->next_pic.ptr->field_picture) { av_log(s->avctx, AV_LOG_ERROR, "Mixed field/frame direct mode not supported\n"); return AVERROR_INVALIDDATA; } @@ -2272,7 +2272,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) direct = v->direct_mb_plane[mb_pos]; if (direct) { - if (s->next_pic_ptr->field_picture) + if (s->next_pic.ptr->field_picture) av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); s->mv[0][0][0] = s->cur_pic.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_pic.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); s->mv[0][0][1] = s->cur_pic.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_pic.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); @@ -2969,7 +2969,7 @@ void ff_vc1_decode_blocks(VC1Context *v) v->s.esc3_level_length = 0; if (v->x8_type) { - ff_intrax8_decode_picture(&v->x8, &v->s.cur_pic, + ff_intrax8_decode_picture(&v->x8, v->s.cur_pic.ptr, &v->s.gb, &v->s.mb_x, &v->s.mb_y, 2 * v->pq + v->halfpq, v->pq * !v->pquantizer, v->s.loop_filter, v->s.low_delay); diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c index fad9a4c370..9adb71c7ad 100644 --- a/libavcodec/vc1_mc.c +++ b/libavcodec/vc1_mc.c @@ -187,8 +187,8 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) !v->s.last_pic.data[0]) return; - linesize = s->cur_pic_ptr->f->linesize[0]; - uvlinesize = s->cur_pic_ptr->f->linesize[1]; + linesize = s->cur_pic.ptr->f->linesize[0]; + uvlinesize = s->cur_pic.ptr->f->linesize[1]; mx = s->mv[dir][0][0]; my = s->mv[dir][0][1]; @@ -467,7 +467,7 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) !v->s.last_pic.data[0]) return; - linesize = s->cur_pic_ptr->f->linesize[0]; + linesize = s->cur_pic.ptr->f->linesize[0]; mx = s->mv[dir][n][0]; my = s->mv[dir][n][1]; @@ -669,7 +669,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; - uvlinesize = s->cur_pic_ptr->f->linesize[1]; + uvlinesize = s->cur_pic.ptr->f->linesize[1]; uvmx = (tx + ((tx & 3) == 3)) >> 1; uvmy = (ty + ((ty & 3) == 3)) >> 1; @@ -856,7 +856,7 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) return; - uvlinesize = s->cur_pic_ptr->f->linesize[1]; + uvlinesize = s->cur_pic.ptr->f->linesize[1]; for (i = 0; i < 4; i++) { int d = i < 2 ? dir: dir2; @@ -1015,8 +1015,8 @@ void ff_vc1_interp_mc(VC1Context *v) if (!v->field_mode && !v->s.next_pic.data[0]) return; - linesize = s->cur_pic_ptr->f->linesize[0]; - uvlinesize = s->cur_pic_ptr->f->linesize[1]; + linesize = s->cur_pic.ptr->f->linesize[0]; + uvlinesize = s->cur_pic.ptr->f->linesize[1]; mx = s->mv[1][0][0]; my = s->mv[1][0][1]; diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index 9141290d26..6e260fa053 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -719,7 +719,7 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], s->cur_pic.motion_val[1][xy][1] = 0; return; } - if (direct && s->next_pic_ptr->field_picture) + if (direct && s->next_pic.ptr->field_picture) av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); s->mv[0][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 36a47502f5..9b912bec1f 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -322,7 +322,7 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) return AVERROR_UNKNOWN; } - if (v->two_sprites && (!s->last_pic_ptr || !s->last_pic.data[0])) { + if (v->two_sprites && (!s->last_pic.ptr || !s->last_pic.data[0])) { av_log(avctx, AV_LOG_WARNING, "Need two sprites, only got one\n"); v->two_sprites = 0; } @@ -340,7 +340,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; - MPVPicture *f = &s->cur_pic; + MPVWorkPicture *f = &s->cur_pic; int plane, i; /* Windows Media Image codecs have a convergence interval of two keyframes. @@ -837,10 +837,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { /* special case for last picture */ - if (s->low_delay == 0 && s->next_pic_ptr) { - if ((ret = av_frame_ref(pict, s->next_pic_ptr->f)) < 0) + if (s->low_delay == 0 && s->next_pic.ptr) { + if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0) return ret; - s->next_pic_ptr = NULL; + s->next_pic.ptr = NULL; *got_frame = 1; } @@ -1047,7 +1047,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } /* skip B-frames if we don't have reference frames */ - if (!s->last_pic_ptr && s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->last_pic.ptr && s->pict_type == AV_PICTURE_TYPE_B) { av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n"); goto end; } @@ -1061,21 +1061,21 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, goto err; } - v->s.cur_pic_ptr->field_picture = v->field_mode; - v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE); - v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff; - v->last_interlaced = v->s.last_pic_ptr ? v->s.last_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; - v->next_interlaced = v->s.next_pic_ptr ? v->s.next_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; + v->s.cur_pic.ptr->field_picture = v->field_mode; + v->s.cur_pic.ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE); + v->s.cur_pic.ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff; + v->last_interlaced = v->s.last_pic.ptr ? v->s.last_pic.ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; + v->next_interlaced = v->s.next_pic.ptr ? v->s.next_pic.ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0; // process pulldown flags - s->cur_pic_ptr->f->repeat_pict = 0; + s->cur_pic.ptr->f->repeat_pict = 0; // Pulldown flags are only valid when 'broadcast' has been set. if (v->rff) { // repeat field - s->cur_pic_ptr->f->repeat_pict = 1; + s->cur_pic.ptr->f->repeat_pict = 1; } else if (v->rptfrm) { // repeat frames - s->cur_pic_ptr->f->repeat_pict = v->rptfrm * 2; + s->cur_pic.ptr->f->repeat_pict = v->rptfrm * 2; } if (avctx->hwaccel) { @@ -1137,7 +1137,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, ret = AVERROR_INVALIDDATA; goto err; } - v->s.cur_pic_ptr->f->pict_type = v->s.pict_type; + v->s.cur_pic.ptr->f->pict_type = v->s.pict_type; ret = hwaccel->start_frame(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field); @@ -1355,16 +1355,16 @@ image: *got_frame = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - if ((ret = av_frame_ref(pict, s->cur_pic_ptr->f)) < 0) + if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) goto err; if (!v->field_mode) - ff_print_debug_info(s, s->cur_pic_ptr, pict); + ff_print_debug_info(s, s->cur_pic.ptr, pict); *got_frame = 1; - } else if (s->last_pic_ptr) { - if ((ret = av_frame_ref(pict, s->last_pic_ptr->f)) < 0) + } else if (s->last_pic.ptr) { + if ((ret = av_frame_ref(pict, s->last_pic.ptr->f)) < 0) goto err; if (!v->field_mode) - ff_print_debug_info(s, s->last_pic_ptr, pict); + ff_print_debug_info(s, s->last_pic.ptr, pict); *got_frame = 1; } } diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index f46bfa2bdf..0dd5641603 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -370,7 +370,7 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - MPVPicture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic.ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index abd8cb19af..1ce0bfaa07 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -35,7 +35,7 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - MPVPicture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic.ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG1Or2 *info = &pic_ctx->info.mpeg; VdpVideoSurface ref; @@ -47,12 +47,12 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, switch (s->pict_type) { case AV_PICTURE_TYPE_B: - ref = ff_vdpau_get_surface_id(s->next_pic.f); + ref = ff_vdpau_get_surface_id(s->next_pic.ptr->f); assert(ref != VDP_INVALID_HANDLE); info->backward_reference = ref; /* fall through to forward prediction */ case AV_PICTURE_TYPE_P: - ref = ff_vdpau_get_surface_id(s->last_pic.f); + ref = ff_vdpau_get_surface_id(s->last_pic.ptr->f); info->forward_reference = ref; } @@ -87,7 +87,7 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - MPVPicture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic.ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c index e2766835f6..40af8655cc 100644 --- a/libavcodec/vdpau_mpeg4.c +++ b/libavcodec/vdpau_mpeg4.c @@ -34,7 +34,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext * const s = &ctx->m; - MPVPicture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic.ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4; VdpVideoSurface ref; @@ -47,13 +47,13 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, switch (s->pict_type) { case AV_PICTURE_TYPE_B: - ref = ff_vdpau_get_surface_id(s->next_pic.f); + ref = ff_vdpau_get_surface_id(s->next_pic.ptr->f); assert(ref != VDP_INVALID_HANDLE); info->backward_reference = ref; info->vop_coding_type = 2; /* fall-through */ case AV_PICTURE_TYPE_P: - ref = ff_vdpau_get_surface_id(s->last_pic.f); + ref = ff_vdpau_get_surface_id(s->last_pic.ptr->f); assert(ref != VDP_INVALID_HANDLE); info->forward_reference = ref; } diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index 9ed1665cad..d02a454bb8 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -36,7 +36,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, { VC1Context * const v = avctx->priv_data; MpegEncContext * const s = &v->s; - MPVPicture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic.ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpPictureInfoVC1 *info = &pic_ctx->info.vc1; VdpVideoSurface ref; @@ -47,15 +47,15 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, switch (s->pict_type) { case AV_PICTURE_TYPE_B: - if (s->next_pic_ptr) { - ref = ff_vdpau_get_surface_id(s->next_pic.f); + if (s->next_pic.ptr) { + ref = ff_vdpau_get_surface_id(s->next_pic.ptr->f); assert(ref != VDP_INVALID_HANDLE); info->backward_reference = ref; } /* fall-through */ case AV_PICTURE_TYPE_P: - if (s->last_pic_ptr) { - ref = ff_vdpau_get_surface_id(s->last_pic.f); + if (s->last_pic.ptr) { + ref = ff_vdpau_get_surface_id(s->last_pic.ptr->f); assert(ref != VDP_INVALID_HANDLE); info->forward_reference = ref; } @@ -104,7 +104,7 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, { VC1Context * const v = avctx->priv_data; MpegEncContext * const s = &v->s; - MPVPicture *pic = s->cur_pic_ptr; + MPVPicture *pic = s->cur_pic.ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 7807047aa6..a8ea8ff7ff 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -1108,7 +1108,7 @@ static int videotoolbox_mpeg_decode_slice(AVCodecContext *avctx, static int videotoolbox_mpeg_end_frame(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - AVFrame *frame = s->cur_pic_ptr->f; + AVFrame *frame = s->cur_pic.ptr->f; return ff_videotoolbox_common_end_frame(avctx, frame); } diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 432d6f7223..bb3829dcd6 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -330,7 +330,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) s->esc3_run_length = 0; if (w->j_type) { - ff_intrax8_decode_picture(&w->x8, &s->cur_pic, + ff_intrax8_decode_picture(&w->x8, s->cur_pic.ptr, &s->gb, &s->mb_x, &s->mb_y, 2 * s->qscale, (s->qscale - 1) | 1, s->loop_filter, s->low_delay); From patchwork Sat May 11 20:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48770 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299310pzb; Sat, 11 May 2024 13:58:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXLyfuNMx0n+Oba3zsAZvoSvlf+MjkeeZO9H2TufuiomhHCkKUEerA9Jo092DQedVr5qJ1alruD5QeITLLUsAGtVlyn4/WqIb+XYw== X-Google-Smtp-Source: AGHT+IFZncL3z/cKy7mQB0aUdo6koZXsv8mKn0JnnOV3dcn5T7q7rFr/c7CulWogA785ldp0coOH X-Received: by 2002:a17:906:553:b0:a59:f380:1821 with SMTP id a640c23a62f3a-a5a2d679867mr383948066b.69.1715461097109; Sat, 11 May 2024 13:58:17 -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 a640c23a62f3a-a5a17b21e3esi354431166b.316.2024.05.11.13.58.16; Sat, 11 May 2024 13:58:17 -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=Bn4Mb7Q0; 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 CEA4068D78E; Sat, 11 May 2024 23:54:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2030.outbound.protection.outlook.com [40.92.74.30]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3A48768D778 for ; Sat, 11 May 2024 23:54:43 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dkfc3jLWc7yfQerML0vPMkQhn8qK7DZYNvE4/19FvICDNpVQRoMI5aDN9ljCPxT1kcKenTsHXzdWd4UxkMipmtJW+DOW3b+vdjwO6Sw3gVF/rhm3QtaUiXsjulIlc7eymKZlm1Q3XOYEo9XpI5U1EP0od01yvLt9k10PRRjY33E3I+0dY+ykGkEL7RxZYn4CnvOSPpIbRbed+5Ns4542hQosUj765auc1MkLWYw9ERiDC1hLwlC8cm5YiZvR9EZ+PW8E8YmsSh1hB5+scgiNz3gmTpzZeu9jKagWg926fGHoG5tWHZD3Ec3Nb3zzsh0rjm3B+lemYCJP9U4TYq3zdA== 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=hv8tsVcr2eesAn43yxfSJFytzjOM60rJ9DHrLgvJO0c=; b=lLMXdpYFVpe4nqvgzr5XvGxQcOm1yIMlCFHRmf5V4LMLTmudbTF5fhnWZq+kfRtVw0zDabISICehscrLcKwHoTN6RvBJHw1T+VdbndobQ77RZ7U2WhlRHPD5zsQAohpN2aSxg/8oxHI6ol5DioYz6IrX0OyKfc/EqlUES6l0ApG/CakfFMTwIA0w7s8vpS6/cxO9ah3KyJBLywTC7tTMJnVCt0Zze4eEmi/oKefSkAljGzHhVdrdTZsgt2R39BKI/Q+l6wf75T9Ni6dvR0jRP6e0xN+JDTTJ9X4yi1CqyTM6y4TgbkgwTZ+tvsPLHJigXvvUmkpbU/hnJFYRvuqICQ== 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=hv8tsVcr2eesAn43yxfSJFytzjOM60rJ9DHrLgvJO0c=; b=Bn4Mb7Q0E0MNHStYCXYscyQWEpoZLR9FxmH3ci70M5Y+JVabQQBXvqiqT+hpMWp/p+E/ZqgeDzvA7al60QEEVSGcCGAZIp55ERq3eELjqlVpGYdv7Ygst0bzKHm885N+iTVBqBl5XH5YGoDJ4dYRy/iwRwTBjoJPFd10SCspGPeh0DbAbfo9sX24D9Vr8T7EB6uhA4AmrdQNU+A0bQhmfH3u8Th+mnl2l8XNpYovIEc2PUlUyBBnhH2d4vNUrnqAJcvrOpUxWCTZgQO1d5TcGCIWaOqwLVEoNdjM8m2Lzb2g2PaBoysQSqhIMByp9+MHoSERRhGj/q1nnRBFVlX/Vw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:42 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:08 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [m7LaIJ+bCvh6xBiT9cCjNWHnm4py/tO4glUcbOmMdo8=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-43-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 366fd0ef-5e8b-4c53-d6b6-08dc71fc9498 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: wztHg2NCSJPWsBFAGbVrHpVkFEnAwmixaTkCEtPdFsgVATNSREhImTBM7RV/U2cFWOdoWMi38E15iPY5DOn8HbKP1+QASMhi7xX2SOv5ocS1RZoENJeehaG+gLqDQF/ygLb470R7zUuANiyNkBl+0F+DxYM9kLa8tT3N4RzUUsfvbg1QsnhcDnUQVqN1r7KEYsqxcXxYxR576cU+mBnCYpOganpgpv+B3R0RlStrhQ5pz69ejWKS5mzrCwHm7zov+g5cv+3lgNCug0m+eyB+DSE0pdbo9n7MHaC9qtCOiPMn2NjVm0/RxqWgucwDDViULhsTW6ko0qM3+Uklwagfz3lQ/rQEuGXdSqK3QfqYtmDxlM93rK0ysBDMD+Ev4+/Y3f9FTecvuJlWdHK5Oh1BNVGnensPLiKPbv2WWTPVQqAFjWIfF8lH5rYu/hxGFNJKg2l08OJnPKN3SYPNbfepsltzZYJIK0DhWqLsJqqoPONVPYMEjwudbTCJUJR1wWMY+qLQSMrSmMr4lb4ErO62VvndLqOWDsf68tZXb6Xdi1/4IV2bFqTfyd+q9PGw63W02VMgm4krznNvwdNd2eiGXkYFjh4aMDRIMBURrDCoVJSmcYJkVndeLPiE/5zhRmbZ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xh0Sq9NnD/uHUj96XsbCyUMaTQfcEJZSpiq+irosijDaYRSpqhZyl+QTLjOWl4lk4f0D7t61/lE9JW7Tr8iOQSySAq8SvtR5rCA7GC61575TSdCtZoK+WUg7+nCU1rhFqcNOiapS86KI2nTO0r8h4J+hTzhBdxtwUsBuCv0xJNJQNvQd+GWmghWhUGVuS1KDarBcDhb0kiPGaS20D30YVAerHTWMvdoyJfpLj94ie15e3cqUQJxUgVaEzX2Au12WmwyfFX5GMNVlKH1uTBtqYeWB54z78mUGLiRx3ws8DEsk8vQdh0oOIpD0lCbvb3kRdNFXeQZO5VkhVWQH7hJysMcVzEhOn6BaX6/QgoMe1F2YAaMh2GLzlBy3EkSZ/UunVqGDGKt/3wdn2j0UM2zVuPO/76FJIyMOu3764baU0q3ZF4pb0KMZ48kmmQ9uFzL6WYZWVLlFgfWYr8LhHdgOe2EOTRJtp5vFa/boIr8AqxcQQATFkAT/WXzIRsvYvPjr4wYy7RmTgaKP7tr0B/8SphQ1/RyOwp3JPD+yOrMrgq2sw90Sgg7i/zutgXzYjx8/7+oxuCkNmWzT5l9yddWy+l7uSV6s+hPvhDN5IfDpAAUMj3+of55h/fBbAEpD3ldXmtO7RaWs5jj2O8Je9VcFOiisQXim7WoUJXtMSTqXfwHtyU88XR/H3w0BThwaOuCyChqDribrPRf0AJ/OFSXmWc0u7Qo6z9Xvz4dFYXm+31BnGPiAUqjLY45ZNUmIFYvuMnjpLXcssv+qJk8+ua1DxjHhacQpusYsnC3ncUFCj6q8m8ZXXa8N2gewluzK1LCuoUHqUrMQteYzjl5TaTug3dtwfbo8+rI35HWx8/lgGVfaVTkLA9nLDjX8/K8UZ+Foo7Np6uVCns7DxShomKBjrIP2U8jhoIxBU+NxMUHIY4qU6Tu8oQcyTIingGcsjsbL3Diozz41pUKsWrJYGlIre4MY4Ex17jBBXPiUPWIhTvF45zmFVWzieibXiPJlxM0yvrh4gNkTjWos8QDaEGf6qjZuhIUD2xwuBKcGGMZMPnM9E7SxvViAoFBdNB7pHEaszq7ohjFSJzz759YNhWJTg5HG5PwT72sOpVXJ7iGSciWolhj7fIM/snM2dz/RMl902XnXKQKpFN/9X/znHaICT1vCfnzNiiLhRn8uGx3rmA4L578dz1sjyIdPispE/DJc6SUXMFz2rLrZBlHi1wpz4XczkR+YDIBpRh1Vb/5bxkDstFDw0O36cs7c2E/lAfttzQ18LLc8AqxpBpmOpABjlQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 366fd0ef-5e8b-4c53-d6b6-08dc71fc9498 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:42.0954 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 44/71] avcodec/error_resilience: Deduplicate cleanup code 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: Fj7ApG6LWGel Signed-off-by: Andreas Rheinhardt --- libavcodec/error_resilience.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index efbacb8760..66d03987b6 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -948,19 +948,10 @@ void ff_er_frame_end(ERContext *s, int *decode_error_flags) s->ref_index[i] = av_calloc(s->mb_stride * s->mb_height, 4 * sizeof(uint8_t)); s->motion_val_base[i] = av_calloc(size + 4, 2 * sizeof(uint16_t)); if (!s->ref_index[i] || !s->motion_val_base[i]) - break; + goto cleanup; s->cur_pic.ref_index[i] = s->ref_index[i]; s->cur_pic.motion_val[i] = s->motion_val_base[i] + 4; } - if (i < 2) { - for (i = 0; i < 2; i++) { - av_freep(&s->ref_index[i]); - av_freep(&s->motion_val_base[i]); - s->cur_pic.ref_index[i] = NULL; - s->cur_pic.motion_val[i] = NULL; - } - return; - } } if (s->avctx->debug & FF_DEBUG_ER) { @@ -1344,14 +1335,15 @@ void ff_er_frame_end(ERContext *s, int *decode_error_flags) s->mbintra_table[mb_xy] = 1; } + memset(&s->cur_pic, 0, sizeof(ERPicture)); + memset(&s->last_pic, 0, sizeof(ERPicture)); + memset(&s->next_pic, 0, sizeof(ERPicture)); + +cleanup: for (i = 0; i < 2; i++) { av_freep(&s->ref_index[i]); av_freep(&s->motion_val_base[i]); s->cur_pic.ref_index[i] = NULL; s->cur_pic.motion_val[i] = NULL; } - - memset(&s->cur_pic, 0, sizeof(ERPicture)); - memset(&s->last_pic, 0, sizeof(ERPicture)); - memset(&s->next_pic, 0, sizeof(ERPicture)); } From patchwork Sat May 11 20:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48771 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299349pzb; Sat, 11 May 2024 13:58:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsolUjNBn57Tt45qrVUdyLKOjbHrpixSTa9qodzzGwYG6JwWvx9csRrh1Q99mJ++AOyZQseRsAbQlp40BIoCtPW4Jk/Z48kvwjPg== X-Google-Smtp-Source: AGHT+IFwzMJGHuys5tCmIj9jpgzHgQgO38nHwa6Vfod9Y6BiajaAgaEXwbrlfI0deTCsHzgoh+P6 X-Received: by 2002:a17:906:7110:b0:a59:a18e:3fd9 with SMTP id a640c23a62f3a-a5a2d54c365mr353667266b.5.1715461105334; Sat, 11 May 2024 13:58:25 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a1794691esi339990066b.57.2024.05.11.13.58.24; Sat, 11 May 2024 13:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=W85g4J4P; 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 8872168D79E; Sat, 11 May 2024 23:54:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2046.outbound.protection.outlook.com [40.92.74.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7921168D786 for ; Sat, 11 May 2024 23:54:45 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k3ZFumCmIY/DHV/A+o/MhPaci/SXtYHHubAkQRyyK9J9UdUHDW1mgKu9Ud+xMy2JbJipyKD63eDK3cvMGtx+0ZmqOz8Tvz9c7bTSedKT7zANoeEd/bxxlS5Huc0y431Mvu9X/UMEvn/xQpKSZw53+CRTKUTuB4BRU6zNoS2xtUbJQqYz8UEEwYyYMeM/ZC/medTF0y0nB63KI6Wr4xIMNHhCv0i3DxkN8EVw4fW8WvVG5gBmet/wNFrXuzQyGvYm141m2mrDkatMkpXp1ZV8ptm8r1vIJr7alCgCNg/dmirE5/WOhhEbEw7xl/2Z+48rEXlXSc9GLvdkk0NO1uAreQ== 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=SjG+JYYVgfQnztSTcY04J3EOCZWo+k72hwqiUNyHbOA=; b=lzFS7cfLUuMXjnre0hr8RYtS1V1Nwu0WpU+qanbYktNoyunuoWSj+xQHejThlx835C/3KjiIjp6GwSYYToTSS9FiKgiMrkZ5zKuW+TLL2vkqtyV0ywrh+18ZsUm3iAgtfhCR8OgKVSEeHsv7l89QMuL7hiHEpz0TGuz+HyCpkOaaPlE4tj7STIXzDR26kwQ5lw/f2rUZaG4sE8qBHK5li+AlMBYPXc0Z2TAN+nPWwK/x0L6/j2kf4kXpiOGHKmRkQWsbopYRiLqB0PJIioEU369WXwFjfKCBuvXDeBxLNfZSHr8dtQy5Zfd2BBg6nW0fbTJ41IQt3evgE+Tldu8a5Q== 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=SjG+JYYVgfQnztSTcY04J3EOCZWo+k72hwqiUNyHbOA=; b=W85g4J4Pa/cNmdD5Nm7MK57aRQc+Z/o4b9HD0S+VUEJELJx7smxpxYc/OBLsyyGqBTjogTFw3UQ3d6Jn1OROKmfTNKX+JVCuE+d5M1FC60jYMs5Yy7L8snYHqUzGQCBT24kpwhsNoh7x4ybt2y7aS/mofSMOCX2RlreWMA2PTh7TkZJDEITMQaqvej+krYHrwmWSJZe0FAaJjpBK6x31mClvLCi4cvcB6Upm2jZiBbwY6AhoiuCnTZnBM+y2qjj5+HODq+Er+RFBBoh6TeiIYzOox1eYomEQDyNjJj70EK+Rnodk1xRl9EgiL3jfT7l05txxwNCOBM9TyOUk92bmrQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:43 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:43 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:09 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [bikEGAOt64QjngHphtygj0knCyWFJFYK7RQ0YWlRGNM=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-44-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b88c708-a367-41c4-9f86-08dc71fc9563 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: 1HSEe+5KAnlEYglUXxlOEitD0rAaohoDbECdYPKxxT9Kuw+W3U8kujWq/qhdGtEIDBbza2xhai9ISr7wdXZ8NkWrk5hOajDOUcl8v3J5jmIHX70g+i5YZwQWXzojZ7+MZgQ2VFkbGDVu4mcTEhwDnZbQzNg/SQzyTpwfmTya2Fy1q6BvePLHmeJjEooaohk2CRf3MfBd5xPUGiVrzddUEbJNEJWiMPa7kt3n0kMJanaP2U8j+RqADVxDrBYHk22dgBOMi2xw/WZ8nGYhfogotyFfv1cuArnImLzJKR2oXhMhssY+xRUehGoaquH1mJtUHc3WKgX8SpqljynjcaHNFoG/Qws6ukfZlhNnZj2t74mrrzjaDDPHrb79MhgJuil4gLunFCldr8HtCN3t3QtBVyvOhO/xiH/FMdhbn5ySh0DzpY9KiZ9sL4T6ZOGTFagDbSy1eYbPH27/2Zd0rlx7dI6PPq30xgDgPJXBGWq98/rqKbZkO1ihJ9uyZ5MfC5bgcMCBSif4PIQO2xztGl4a7lsIzIDDgbkCMU8Gd3KVr53oceB7yCfwY4zQheTI8Ohw8B4oXUDkYzhW8bS7OHM4m62O2pLSAPg4nimxhr4ZKpWBmGKcnCDwGsECjKJh0lYp X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fN6o8zZQRMsraF+QTbwlhbf25srIpwlRG8ad63qXzn/gUJZSJdHIpQzTyZMZTGVcKLlbUSSWRxu9Jnibcv6+Y+OMWrjeD93UsmcpBhINX0JJH1wARDtgonlglyNYDgYOdeMhM0dQb08QByGyT8YuyZOIvqVjXLLX025ec/MdKP9enkDLJ62nHTZcy9JpyqqTY3LzSIRACKIaCmPhINM92ivMOzexrKqwI6Ar28e3XkMRHck+AN9BAnrtGuh9khv8XfIspTrIUhKHw8AE3xc/YXwg1EJLqiJBs+P0EE7V8GhjjX/SG0LTQFs4E8yJKRLnn96TMfP7sNEzrLP3SeUVbIxf0cv6Ky9vhYezi/llbo6bpSsIr2o8Sr469NiQxSMZDCzxBE4eF9zqP2/L3Wedxopg8dYfTYqbUusBnX5I1By2BYa1OMAN9iNsDFE7hIHH6yCMk7cEPgYJbp/teH1ys/TGb8u734Y2nRnhfcxmgjy1sjfvKjoEwsBlUFPK+1w/1QaFfq/Y4vPHLl8jd1QcVRFujPSi5SNx0tLHSXrp/0lgtJ1FF5+uJb6qLuI10GN3xR7jKar9DhL4Vkdh7T0CH0u994D+86W4Hb4PuJA0g4VywOn1roqx3N1KQL5E+Vm97Mf38lePJ/1fPthNGp+ndlTznCRN+vZRa6RO3YGxTku6QgOEPJz3rFlmrBD3Hb3pM75azC11Za64OO22R0HLTqh3k0UifWmtT8FlYj8EXCq2rN0VRCk+sPYbh6UQIGJlHUjBKvghgZfMSvc7M6JIx2Vc1ercJQvVC57jSq7Bicr9hTaOfNwD/aHtrGZkmsnkhFwvRQZW/p30f51DMOwpWTHcUBINPzy5esfJS8fMizWvm8ZtyHVv+Tq/6xapFnT9EM6/a22V2EijjemBs96jd6QZR4Kg6gE5VXCw8pUlnc/4++wzrTKmyAcrdDn0jNix53mfD8Yq3DeSan/efu1BvwSdrmlTjF0lCidLoAjucHfQK7kcfbD0HiUDIvq4KrFzWBDZqtHvhxZleDHdd5yuLUNGZjlcgork2GT7HXHDMaoTsVnGs7je0Yl7l+07B9nqLXwlQML8csNTLVjMtaF5Sey/JcFDKARFizLuuDpxU0wZkKwpCeeB95SaAwQC9cOYjN8kSNkZfqgisVnnxacYxLA9G84EN951GO+CvHRAKaxKVzBj1iGJhDFZLypvZ6px/fWYJOc9TeIRTj3rgHeJbMQuykq+e3OfzHFJS5IjQdhBlSrZ0G4G+cZ4/UV6XLaLzL7KY4IaDapmDoltbhYO2Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b88c708-a367-41c4-9f86-08dc71fc9563 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:43.3864 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 45/71] 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 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: aO+v6a7zi5qc 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 --- libavcodec/mpegvideo_enc.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index cd25cd3221..025204f395 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]) { From patchwork Sat May 11 20:51:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48772 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299368pzb; Sat, 11 May 2024 13:58:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVSsZykce1uO5ryZbYXYQulYdBU5y8tx1IO/yIgqigmBfBDRg1QDyDwOZyKuPs/6SR6mIiGBUuV33QBDCy3aNiwq5I/u1CnAGSNqQ== X-Google-Smtp-Source: AGHT+IFnl/o3WMwlFedjNx/41I1g2whoSSoGWYXnrcVRw5gRQab2KQe8locO1HFHIhYSW3TxdiVD X-Received: by 2002:a50:c349:0:b0:572:7ea0:66ca with SMTP id 4fb4d7f45d1cf-5734d6dc34amr4082019a12.36.1715461113272; Sat, 11 May 2024 13:58:33 -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 4fb4d7f45d1cf-5733c2d55d8si3410341a12.328.2024.05.11.13.58.32; Sat, 11 May 2024 13:58:33 -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=ZRsMSfD9; 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 B1CEC68D79F; Sat, 11 May 2024 23:54:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2083.outbound.protection.outlook.com [40.92.74.83]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B44C368D77C for ; Sat, 11 May 2024 23:54:47 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M307M73g/cLXQ/hJPjiUN2C2TFESVVYmixEEXZ6gqO6G8Reu0PL8NmTvasaAoIfr9tmwTkCHWWomsrid+XQ0jUALEMETar7/ScIme2o6ccgq6LWyP0/Wrh99B9ODZ+Ki/mIGCH8H7Hc+dd6r6Oy7X6wrtsisGw0i+X4QFlm3k69P5BqyonOoPCkdN4XaM2xi7BBeZG3c6lJKxl4GZeDiugqACiQIGOMsZzbxb2TBJQCSV4AXMLk7fIzM52+5nALRR+vLfbzUqru5yQHrNP/Nzh15hGIznDKrSVoQ+cm0A/Zb1jD/70obLTarEYGF/d0BsO8rpf3ns0cEDjubGB4BjQ== 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=Ufvj9uvrKXAkjJUbUqakaq5FNTAKaM77Omus5Gab5WA=; b=bazrD1lDTWh7Q4P6UQbW/7k7X66W0baw8K2V8wUMT5HaedEHouQ8GFWW2v5ZN6htmLuaZntZimE6Km5fUkFuVob/3HWPecMSRU52KSEs2ePbo+/De54BpaOOwgRgT9wPWPj3bvjxAPUI1RC4KgrxpUmVywZfk/wnGZH0G7xe/Vic2CcRTGONzDveN4rmxLznmXxcReCylYagTmrwF/HHCPJ0fiZ3n/rGy3kNdIzQGalKiO6QJ30kuuAWdSDnS+1s57Us4/GblGt7HlOZzmzUdnS9v/QeqRX8y1vT/iHIOk4QdOD6x9/QiY5BqDFmHpnxZBWnAGfq2IPhSKk04T2PrA== 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=Ufvj9uvrKXAkjJUbUqakaq5FNTAKaM77Omus5Gab5WA=; b=ZRsMSfD9u73KN28DfLA6M4b7cY1DJlzYsGmRewZVszRSy55Lq2IrPCaM8YF3EF5lbSz5WxyF7wwNJvB0qkbI7AvStSe3fe/4qLjJqY2MrZq5jW1Y/r5uMuUFG5mO5iwo457fcnKBFFyPhqG7Z6clii5iF7kO6/gS3rFxnDDPQXGGQ7X8zvmuQNwl4ixYrSWmu8EOUFaF099PzbD5mrk2P8weeT9u7noT1ZePlm65sANe21iWe9CD9uRzbjiWS9QOOXyOkIh0Y84No/kkxj84zR3AUX2p7g8iO2MU7KaP42PyNdZc5hebGBFwwQUV39zlnlQS9B0dYP6TuAJXv8rhlQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:45 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:10 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [iOBQiu6pmCXj8QjSaP7ldN0KIUKURqUjSb9YHkwOlu0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-45-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: 03388be4-b658-449c-74fc-08dc71fc9693 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: 8t88mURe32nyOJFzATDMPHzo5B785ptJIStMBYFkpyKTTSnVocrvIVv/CKl+MsaidOkKSXSwWPRxy0hc0RIb3WpY8IHZwXHuK/ihnd4J10KanPjRo36qDSaFCmo7OJE5BryUO1+ymFx+UgosNRAi48de/hI0XIVO1s8Tbbj6eV+gDAugQqCV7HawAvhmmbsdyKiffKx1o00aWOuGrO3suDdIi9GOkpEH+/DCrK+uEOZy69h9KKzQhrmRguf2p7Nr4s5zN9nE5j188tTDU3mo92qI4na5+vpdMOUxw+DBKfWAGqHOq7tN9qQcACu1wehrFg5bFiX2Z6iNbU8iAJZIpa+mAzdNgF8cmj1ZYICM38MvJh9mIwQ0aZ1/huCAI+CqaDqPDwhuExaAv5E/yZshpbRclStxuSr1e5mBT90rpLOtKB52JHcgtTqmeYNmBPFqtu3Qm5aUy6+AxXX3QocJ01399DtYAmxCwUufnJg2C0lvddCbOVp1kU75rNcoVNtuGN4G3pKAmjUvQpThZrIbBusIxKMfvXpAUlgTdCsZTeHHlvHyLvxcfPxjT3T1f0RmXkborOnhBlKbVEYOOsov7AHXuUbh1FmZOxjxWcNcbUP5jzGC1xYQWQzhMmVm43V9 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r99lO5Wih3JhKQ/gOOILf1ilWNfVXLHBI5X+U9ORIug8wycwnqYsiJgTZIZW9h1lyFOMaPlEgA58eRBV3ia4HeD1ZuvZrYwJbpp2rkhD2nibdXGdqm27BcddymkGo2hnGHcRfG0yfrQNGYxwcLFebhWGkTZUQmcxupU/hj4rWomQGfC0JJ5NKqBuykwARPPVoCkJkPLg08X5GLecPzP7k0eNjp+nZURYmHp8eOX6s91nhNhc4rDVQnLQOz9oZskup2vV+9Wery+Yb+gq8lN/1JG0EnOYGL8m5wa1KSKdB6s6Yd+MLhUCj5as8TZIgoSulIG5StneEcqbh89yuzt+AxATb/JoOEJ2gas7Q7f3MshcQpK62xJr8RmKeV0WKiv01ZGaK9R72Fpngchsk/uHkyLhJbtU2gjVgtbXlGxiGLG0C7PFH/Qd9JB55auSHn+g0tFy9EuT99sjKMrhkB2hF7WuDewpsxhYAT5+86c/MltUYzAQmFqBr7I+IjRFQQ+qwnWnzSYNU6Oc37dcgRcEG2I4eTtevdrB/2UJdIcIh0A9374ulnxObsgLrV+NLTPW5dI9oz3vr4NJPHo6CFtffzW6AMlXKbsUnejd9YgjYUTMS6d+/x8umPkB9j1j4zigWnhZR5n8kFO4M6Ep98ywBp84pnKAIHHmVvX4sz7vn1WiDeD3ief7fyGfrOsAsf43OfEvyNc+yH0tPYN+apZVUb7H0s3RLqxKHwXYrN1oqm9YQSSmKw0WVrdCnTn1O4islpDf1AUyKWNgmNIHiwflTRI37rZ+71+TAvg/L0kBxbOIAYpN/+kGnd6K9FKlDYfSfXrS/p2Wvna9xomcZBALHOB98ZALaMNcC+r+L+pUar85bg1pZQHza/nIWvdi7DPMiwukdd7m1GKb3bkuvjqTZv/PrlIiLDdfHNyPug2mVIM++A2Lk71y+GPgS6hxQfb6yRz8CWCvYVQATkOPvI1a+mZw5Imiuo7/4bMAz3381VD6DiagdW3g+f7wIFEqvBfOPfzfOapqtpLMinsD1by9m/HEJ8c+vdVkjYUa9WsivR1+ADJY435aafUZA0pY1uSJl8t9eZHBzpuOw2q6jxoeqzAnedJgLTCOe8KEmmluuC14l2HOQVUYg8I+6wUF/sFX/YOTlkQxETSNyLQEz+z1tEtiby/bpLhKXYYUM06W6HM91/Pynhd2j2Vj8XpG7+MPL606LKMDbc1qLQO9+ZjfJ5dez3lynqBLKoQ3+SasG749j6pBXx0QBq3B6IyAqxTVafYAnJAP2V5zWfaxnSqo/A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03388be4-b658-449c-74fc-08dc71fc9693 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:45.6631 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 46/71] avcodec/mpegvideo_enc: Return early when getting length of B frame chain 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: I6L3ecDV4voY Possible now that this is a function of its own. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 025204f395..610067eaef 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1482,8 +1482,11 @@ static int set_bframe_chain_length(MpegEncContext *s) { int i; + /* Either nothing to do or can't do anything */ + if (s->reordered_input_picture[0] || !s->input_picture[0]) + return 0; + /* set next picture type & ordering */ - if (!s->reordered_input_picture[0] && s->input_picture[0]) { if (s->frame_skip_threshold || s->frame_skip_factor) { if (s->picture_in_gop_number < s->gop_size && s->next_pic.ptr && @@ -1599,7 +1602,6 @@ static int set_bframe_chain_length(MpegEncContext *s) s->coded_picture_number++; } } - } return 0; } From patchwork Sat May 11 20:51:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48773 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299408pzb; Sat, 11 May 2024 13:58:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+L5UOU1KOFqpcdYsfTXbg2HO6NtxHFbO1XaJsSwYSyX6g2v5G0ZFLdUmoAT24QoXmJzqkkOctwuc1P061VfOOw4QoKdNkepXVRg== X-Google-Smtp-Source: AGHT+IGkSjHWPO2HoN76k9WsEo0DshjGn9e5lXjgwgVeCtRBZ1cw7rKya8E+2R+M5BFKX9EZ7YUM X-Received: by 2002:a50:f699:0:b0:572:7c99:a280 with SMTP id 4fb4d7f45d1cf-5734d5c0c28mr4364169a12.15.1715461121803; Sat, 11 May 2024 13:58:41 -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 4fb4d7f45d1cf-5733beac808si3396266a12.22.2024.05.11.13.58.41; Sat, 11 May 2024 13:58:41 -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=RMHYXdHq; 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 E5DB668D60B; Sat, 11 May 2024 23:54:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2043.outbound.protection.outlook.com [40.92.74.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F6CB68D792 for ; Sat, 11 May 2024 23:54:49 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XVTHCy/b9Q6ywfNAEwu7Osxet5q+DEk05lbHOzVuPEftMmJs7+OQsN0C5IYeds7RvgIJMrQ2DGzPvXyEUybT3F7pY61YInS4aBFBweMWcB8ltRBD2sOOrPJuzJOhNG64KC0j3l7c3VYPGCU28kTXoU1cUQGrs0Cp3Cik0KCz8LnjVCImuftLt0tWuivJLz1A6TebbcdMMgMqbysjR/p5eDJRCEL0qIeudH89WEW7POkICBDkohBxO6Rba36wIEtlx+TbWxnCB6kmO3rLpfvFhy63pcUHSj7fKNcJDWth4UJ8pPFvqbF/oDFyHoTQE8urb+AUnFw+tmnjz/GI9LifDg== 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=s4eM1B4rfBiKq6VMDw9lGyWyzUSggPviosq04wLtOCY=; b=junPITb5EC1IP5Cj0+qhEEvQfX63QiP3BaI1ViShAgxes9f6KMymU7svMAnXGDgP4aEYbT2J8b5XckeIAB9gKVVmg5Uwk+bhcu9aStDs2CF3s9MEexb9piBRqrmVU0/+BbjgnNGC0LEwjE8OSeUYVw/++4dBDlt+mfH5gub4r7IXNc9JfZXmjfNcOGekezF5elwemnRIu5ez6CsVYYHVwy9tZ0/pEl8WkK0VTX6TMVb5IHBlnlvfaiy1RSfUKYwnEU57NxW2Vp7mg4V4roHd7zwh8FSKntSVwZ0yJZdxInOSNU6xjBVTU+vEnaFY6BWskiSde6BcR4rcgbjnEv02Vw== 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=s4eM1B4rfBiKq6VMDw9lGyWyzUSggPviosq04wLtOCY=; b=RMHYXdHq/ePip/LJGwSSxAHo1Ab4OU5IIqy+fPAMemdEQTVwDb2QtFaVSksVJR/18NXr/d5t7PxfEww19Gun5MOR1CJ0eZR38+If4kMI0xRQBzEXAopgyNFqbPaQRMcONAlCu4w+dBIDnquefcwHll8wV/7ocJaYuRWQ6nijhbzTMT5xAFcvFOleinNagPDI8T43c6Eg88P4C96SlC/MQNb4IdY9oU/XemXxQAJL//S5GNRyNAGTPZaUbEcdS906wfLH4H4+zdc6sr8AJ3ZG/0BHSvB/BnkZYoUiyHUGk+JIFBAUZBD/b4v6+sQUaWesEdzopF/13g89n0JO0jC/vA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB9P250MB0403.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:327::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54; Sat, 11 May 2024 20:54:47 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:11 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [atAmSQPAaU6k6brwEu85l9OS3x+8HsYOfmzFyIAmgP4=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-46-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB9P250MB0403:EE_ X-MS-Office365-Filtering-Correlation-Id: ef9b106e-887f-4f1e-77d6-08dc71fc9775 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: fWd3f1eqkFE3kzIfdmrPGy1GIgX95tRR3yD27gMVborwO9blRq4iw5WNv7eQJ9h56wEh0cgcKa0QOm9vdJOwp2UODaeHMgaMD8oX4WZ5T8MAAifNeaN0/aRa9Wfr6qs+F70hCPWzhiVu7mKHiEfo3NbOnqBKgaqJo9s84PlcYcMTppGhL1P5mIZfrOHUvNNBU/Q8NJYBaX6DCPuUFogTZVnaJqMi6p9vvNuTkxCRS06f1hm77ECyPg2mdWV7dfdhxQAhtI/Eh5KsbY3Nwo9sLreIlr0F8Dw7DdTw64HMGTfbF8w0bFNc/is9Do/TjZRx53rvY+U7FTYNpTx0Ft4irt1BdcS8HhXULcHdxeXWkcRH7pQAZ2Qgt0+wxD2HDU2tBUj8owqPmO7Xa1IsyEgkgxK9o1851T187vj56vRkfAxmKY7Twd4tXiNHnVdk5lGyobyz50I/IaMFxp3g7Oc7/Ljrnfe2d06CMN+1KCK6gRuGq+PIwIcyOqxOsqZr/aM1cdZ+PDdawo6MNE6CPPSO90qoCikALGktkZLxHqajU5GuQ788mYH9CidmNE2jTpkxEFo7Al8SeI8vLHkB0aI6cyegR23NRipPk5XnI5sA6Uy36qIwGCPhSQX5i3VNHoqD X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1YmSjmMmN1f1/Oi3DAFVeArbsXJLwGDtu0zDPMswxmFiHssggJ+WjWuRFCvUwdLKmNYiDbubBCXDDB9/9lEyOOFmfvDE0TS+ZB6LlA/j/HRbeTpHydQPF2hosVgrpI4o4Qc282lVgo0QlDK9JRiBrugGHwByJtWjsGRQOmoWy5p+tL5F/8OOz9VVJCTatQW7o2PcU1rjkxSRuk2FHhZHqnsFaACib2Qb6ymYiHZeAYIN8Cp/Jw3OKn/DApRdg7HdTyUEbWOCthllQdYdqozrtI1pohuc/ClgX9DOLx+MSO8YxgyiSQPMCDJOlrpu72aBPcsIIIzR927Y0FStBXjuQpiosSEeFp6tkp1HUDwp9lO8QWjUli+BUKUQPpVAqfmeQv1MCjM5KitzCNu0e7OkaHim+M4rT12I/xwU3op9qkNjJr6/Z8+20w6xgZky0A9ZOSS9f4O98a6MBQ+XFkeLRzg55LCiaHFZ+RccAyRFl/mNEJskFerguFgbo2JhixnOXcdQs4nZ/7L/xt2mJ2jeM5MM9Nxun43KLq7pNmGnWtltrnN0OSMSv3kS/kjIzzEw9oKpkLOVQIsGsz0RwAowS2SgTPW7hLgGmogOOz1abUUnsaZYnYLDYRnmWFGr3iO+SRbi4T/64WkXvhzsAhcT87m41JHCcJCFsZVgx3+m29vJItaWTVA7HUMnPy5pbrhPpxaAgQJhDchczpTMha4l6VgDVr2blJUHFIUqG8MlGcXW0wWoLDm5MgLLPYK6b1K2l/oPs7ACboczHLbkczfRQb89pB9OmeXkhVi9T5A6ltJr4RXH63RSFaK1iNTc7XuM92Fi9o1BXHasfQRLUs/6atYAIRnLMeMAx9T/ru4nUJInIFGoxPIQOL2TQCZhIblvDJrQ1usu2CcZNrXA9y/E9UHhiDbiRXgeNguWpqu6kPXyO1sVsomS1M8zyyYsjmzB1uhMmqJQ9L2WqUf1IBSLH73UJnIROUPcYbMxcAH/TzdZ39NzLh0kYsAUORQwpXPBCjw1K/mg0raXe3nStTJTlFYzwDjAtW3PEW6wyBTUShJ3vcAq5GGBIlq12B1e2W+ncrjvtYi1/U4b+c64aNZE0/Rc/QLFs6j9fT/6tG8jdvoaYEL7XrkA89TIELY0Kx+PwB+jOrmuJK+/GqTd+wweHut+35lWt7MpvZYCpVSc3CdAR2WqRMGt/tdbuQxHa/mlLo6RukFFjzj+gI0l4MIxkvyp3dukZp4rUmHAwqvE4NhACD8rcKNZLajTH0o+jBe/LVOBGLF00+9+zEn/s6DTkw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef9b106e-887f-4f1e-77d6-08dc71fc9775 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:46.8979 (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: DB9P250MB0403 Subject: [FFmpeg-devel] [PATCH v2 47/71] avcodec/mpegvideo_enc: Reindentation 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: NBpevlaAJy/M Also try to use loop-scope for iterators. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 193 ++++++++++++++++++------------------- 1 file changed, 96 insertions(+), 97 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 610067eaef..c9dc9959df 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1480,129 +1480,128 @@ fail: */ static int set_bframe_chain_length(MpegEncContext *s) { - int i; - /* Either nothing to do or can't do anything */ if (s->reordered_input_picture[0] || !s->input_picture[0]) return 0; /* set next picture type & ordering */ - if (s->frame_skip_threshold || s->frame_skip_factor) { - if (s->picture_in_gop_number < s->gop_size && - s->next_pic.ptr && - skip_check(s, s->input_picture[0], s->next_pic.ptr)) { - // FIXME check that the gop check above is +-1 correct - ff_mpeg_unref_picture(s->input_picture[0]); + if (s->frame_skip_threshold || s->frame_skip_factor) { + if (s->picture_in_gop_number < s->gop_size && + s->next_pic.ptr && + skip_check(s, s->input_picture[0], s->next_pic.ptr)) { + // FIXME check that the gop check above is +-1 correct + ff_mpeg_unref_picture(s->input_picture[0]); - ff_vbv_update(s, 0); + ff_vbv_update(s, 0); - return 0; - } + return 0; } + } - if (/*s->picture_in_gop_number >= s->gop_size ||*/ - !s->next_pic.ptr || s->intra_only) { - s->reordered_input_picture[0] = s->input_picture[0]; - s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; - s->reordered_input_picture[0]->coded_picture_number = - s->coded_picture_number++; - } else { - int b_frames = 0; - - if (s->avctx->flags & AV_CODEC_FLAG_PASS2) { - for (i = 0; i < s->max_b_frames + 1; i++) { - int pict_num = s->input_picture[0]->display_picture_number + i; - - if (pict_num >= s->rc_context.num_entries) - break; - if (!s->input_picture[i]) { - s->rc_context.entry[pict_num - 1].new_pict_type = AV_PICTURE_TYPE_P; - break; - } + if (/*s->picture_in_gop_number >= s->gop_size ||*/ + !s->next_pic.ptr || s->intra_only) { + s->reordered_input_picture[0] = s->input_picture[0]; + s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; + s->reordered_input_picture[0]->coded_picture_number = + s->coded_picture_number++; + } else { + int b_frames = 0; - s->input_picture[i]->f->pict_type = - s->rc_context.entry[pict_num].new_pict_type; - } - } + if (s->avctx->flags & AV_CODEC_FLAG_PASS2) { + for (int i = 0; i < s->max_b_frames + 1; i++) { + int pict_num = s->input_picture[0]->display_picture_number + i; - if (s->b_frame_strategy == 0) { - b_frames = s->max_b_frames; - while (b_frames && !s->input_picture[b_frames]) - b_frames--; - } else if (s->b_frame_strategy == 1) { - for (i = 1; i < s->max_b_frames + 1; i++) { - if (s->input_picture[i] && - s->input_picture[i]->b_frame_score == 0) { - s->input_picture[i]->b_frame_score = - get_intra_count(s, - s->input_picture[i ]->f->data[0], - s->input_picture[i - 1]->f->data[0], - s->linesize) + 1; - } - } - for (i = 0; i < s->max_b_frames + 1; i++) { - if (!s->input_picture[i] || - s->input_picture[i]->b_frame_score - 1 > - s->mb_num / s->b_sensitivity) - break; + if (pict_num >= s->rc_context.num_entries) + break; + if (!s->input_picture[i]) { + s->rc_context.entry[pict_num - 1].new_pict_type = AV_PICTURE_TYPE_P; + break; } - b_frames = FFMAX(0, i - 1); + s->input_picture[i]->f->pict_type = + s->rc_context.entry[pict_num].new_pict_type; + } + } - /* reset scores */ - for (i = 0; i < b_frames + 1; i++) { - s->input_picture[i]->b_frame_score = 0; - } - } else if (s->b_frame_strategy == 2) { - b_frames = estimate_best_b_count(s); - if (b_frames < 0) { - ff_mpeg_unref_picture(s->input_picture[0]); - return b_frames; + if (s->b_frame_strategy == 0) { + b_frames = s->max_b_frames; + while (b_frames && !s->input_picture[b_frames]) + b_frames--; + } else if (s->b_frame_strategy == 1) { + int i; + for (i = 1; i < s->max_b_frames + 1; i++) { + if (s->input_picture[i] && + s->input_picture[i]->b_frame_score == 0) { + s->input_picture[i]->b_frame_score = + get_intra_count(s, + s->input_picture[i ]->f->data[0], + s->input_picture[i - 1]->f->data[0], + s->linesize) + 1; } } + for (i = 0; i < s->max_b_frames + 1; i++) { + if (!s->input_picture[i] || + s->input_picture[i]->b_frame_score - 1 > + s->mb_num / s->b_sensitivity) + break; + } - emms_c(); + b_frames = FFMAX(0, i - 1); - for (i = b_frames - 1; i >= 0; i--) { - int type = s->input_picture[i]->f->pict_type; - if (type && type != AV_PICTURE_TYPE_B) - b_frames = i; + /* reset scores */ + for (i = 0; i < b_frames + 1; i++) { + s->input_picture[i]->b_frame_score = 0; } - if (s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_B && - b_frames == s->max_b_frames) { - av_log(s->avctx, AV_LOG_ERROR, - "warning, too many B-frames in a row\n"); + } else if (s->b_frame_strategy == 2) { + b_frames = estimate_best_b_count(s); + if (b_frames < 0) { + ff_mpeg_unref_picture(s->input_picture[0]); + return b_frames; } + } - if (s->picture_in_gop_number + b_frames >= s->gop_size) { - if ((s->mpv_flags & FF_MPV_FLAG_STRICT_GOP) && - s->gop_size > s->picture_in_gop_number) { - b_frames = s->gop_size - s->picture_in_gop_number - 1; - } else { - if (s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) - b_frames = 0; - s->input_picture[b_frames]->f->pict_type = AV_PICTURE_TYPE_I; - } - } + emms_c(); - if ((s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) && b_frames && - s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_I) - b_frames--; + for (int i = b_frames - 1; i >= 0; i--) { + int type = s->input_picture[i]->f->pict_type; + if (type && type != AV_PICTURE_TYPE_B) + b_frames = i; + } + if (s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_B && + b_frames == s->max_b_frames) { + av_log(s->avctx, AV_LOG_ERROR, + "warning, too many B-frames in a row\n"); + } - s->reordered_input_picture[0] = s->input_picture[b_frames]; - if (s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_I) - s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_P; - s->reordered_input_picture[0]->coded_picture_number = - s->coded_picture_number++; - for (i = 0; i < b_frames; i++) { - s->reordered_input_picture[i + 1] = s->input_picture[i]; - s->reordered_input_picture[i + 1]->f->pict_type = - AV_PICTURE_TYPE_B; - s->reordered_input_picture[i + 1]->coded_picture_number = - s->coded_picture_number++; + if (s->picture_in_gop_number + b_frames >= s->gop_size) { + if ((s->mpv_flags & FF_MPV_FLAG_STRICT_GOP) && + s->gop_size > s->picture_in_gop_number) { + b_frames = s->gop_size - s->picture_in_gop_number - 1; + } else { + if (s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) + b_frames = 0; + s->input_picture[b_frames]->f->pict_type = AV_PICTURE_TYPE_I; } } + if ((s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) && b_frames && + s->input_picture[b_frames]->f->pict_type == AV_PICTURE_TYPE_I) + b_frames--; + + s->reordered_input_picture[0] = s->input_picture[b_frames]; + if (s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_I) + s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_P; + s->reordered_input_picture[0]->coded_picture_number = + s->coded_picture_number++; + for (int i = 0; i < b_frames; i++) { + s->reordered_input_picture[i + 1] = s->input_picture[i]; + s->reordered_input_picture[i + 1]->f->pict_type = + AV_PICTURE_TYPE_B; + s->reordered_input_picture[i + 1]->coded_picture_number = + s->coded_picture_number++; + } + } + return 0; } From patchwork Sat May 11 20:51:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48774 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299454pzb; Sat, 11 May 2024 13:58:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWD+6NIQVusrVnYsZZZyT8+3aHS+BA38pDRUQ6M4YdAGtzdMuJiJ0+6inPvBlM+/GU6MkvcvrQ0pxLGOtuZtL+F5eIRxc4wMSvnLA== X-Google-Smtp-Source: AGHT+IE7GBuzM3eEUbaiAf5fVS3wQslxpdNx9DpgY3He4PJ2cwQ+FQQTJVyR8k/ickHNuNc4+mnu X-Received: by 2002:a50:d543:0:b0:572:9bd2:9a90 with SMTP id 4fb4d7f45d1cf-5734d6ecbb5mr4169285a12.31.1715461130615; Sat, 11 May 2024 13:58:50 -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 4fb4d7f45d1cf-57359c22d20si1923625a12.134.2024.05.11.13.58.50; Sat, 11 May 2024 13:58:50 -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=jiZ6o8yo; 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 6A8E968D7A4; Sat, 11 May 2024 23:54:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2064.outbound.protection.outlook.com [40.92.90.64]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 958FF68D7A0 for ; Sat, 11 May 2024 23:54:50 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QN2PwhtfdwyXbocj4PbMNOc2CaElPFQxrNPmnXM3z8yWnZbGCiVNpTXb8I8/k+2lWnF4Ml8++zRn9Hpu2pC/RFuZvBOwOSbaOY2Ro8bOob6l2IUoOtfdq7UdMj3+ZAKHZ2zvQii/ITENqh5dHc5jlfDyGLPAc8M6pZki696Usj+54pEuL/1QhPU7nn+CPq6ZFTSZ+NlAROdOitHSX9/VdgLKFwWuz9/AO0dcjGl+4OYvLxl5nXNNfV5a19adSoWYUA8KfgeN3925fFaIXluLdBkNiEybRHpYjk9iJ5pd6EB4k0f8ERLYUx4DmQBZ57FcleyraeN+iJLCCEw2ZBNXNg== 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=LT6kmRUsOyo5twdNqt1n18dwG/MenfKUTs4y+6RwTnE=; b=YPkS/Pi6ZPy7NRzT+Pzq7gtK89NBUyVtrnWUvob3NezQ0Tz/UL+PRxIN0mUUR7apG+JnFThcc1frq3ZD5p95YzJwsNyzd71/0JLNB3wquVVpg3yg/4i83m7wPBNAzuEIyWb0/dtbl1/wYvfS+oHHMuUTwoKI5NMs0/+NteaejtnK4wif5/4HmkXy57D8VQBTF0aSKb83lRcWaXVQGd/lGSeNze3Zb65CwfuWztKjuvceO3Bna8MSzYf72UkiYvpndE2dwaSg297nn2RFrkmackgKWuaFCnGtRqyNdklqoH1+aO+aCE/6q/5MXtrdeZjiO697kBJTqtDNObXYetQzEw== 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=LT6kmRUsOyo5twdNqt1n18dwG/MenfKUTs4y+6RwTnE=; b=jiZ6o8yoV/ZCNYeMzWwAnRsEeL1kmAQM6OmlWDZwMIEOm26NWtoTHt1w+4RNXqxmefrth1Fx8zG36++GOI5szwDHXYH6+49npByBJQDBkoX6oRm/CddsFnkYAbwkPLYt2vWmIwGw4KMvx4K6NFEuDqm0dJoGvIoqbFy6VbBfzRl6S/u4RI6DyfNTIrxN5d58eC+KNYDekWt7pOUdQp7MMNxTbzjuEQwMtS+xrfwXVi210oPijUxxmsLZYhBw9R8xN6ORk3olRZwS8pSEKghV8G9tQaxmU2QKaQCw5Xyg4Q86L4u/8zVcnUFxxcXe/66Oho86BjtplzNHGORXaHAC0Q== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:54:48 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:48 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:12 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [aiGUZ2GJuYtAyc+LXSAxkvGygLQntS55scTuhv5ZzCY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-47-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 466b3530-bdf5-4b1b-290e-08dc71fc986d X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: FolVKt4viRiswAxle/iElZb1kePltFn7xaCdf6VFH6/TxlkW8zgpzn0fpC2P+9g1MdVsR5o9kz7tNrIz25OJE/FcMOaFOxZdfmphOuOawJLulgqUdRNMzmjJM2/IqYOXcT7A+bpfbi1Bc/2Io6uR0dlLroF9hmcJQCUI6NDgKs4DG8O2s9nYoEmV62Pfx4B0ZFZPPR0FKBIk56g7wI16DzU5rgUhyDsrv7lvM+6hyIsNEGch4n8CQurX2B8LHBdVF6qqqT03Jd+wTwQFgbLjep/qKSK6IJ2kOKkgHHCDsoW5s9YUK1QI0CCGEYMUIUTgnslvA+fodtxW5tTQrm+oxvfMxzmkEkhBpFerNwrqdKXeN1W9UTONyau2WqiSFehdqtYuFwwvvasYCpJqVOIgC/5IdpMu+by7nyd0VhZuhhacTJjr9suYlDpE254GOkzdBkVvFJAP8iylwnHU5G6IgEQmEozBxV0uuULm3WZrHqXpy+5Rx6w6792PFYooJuYkmcLTaa7sxjN+8YHc7F1N1n3YTCdPMaLvQv/BgUzRZQEiINTILJWvL+SIVu8t9K609luRuUw/wJdoNR3upRrZv39wo6gIXGe6ycgg09P5U6YdHyjhNlPs8AndCJk4+5d+ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e/8dHjpBMlpXwZ94wfgdTm7dw7MSd6RCfRJNicfleO8xM5ppBC+CexBccn3GTkayZdsAoI7cCA3+6UdQAa80EaY15xsa6blhIur75/F/meJGxni2ADyg9fJeM0DcL+2p8aCX5pWuET5fLgos69it8PKoc/b8OLzI07I9jVgya/rI9Gj3rNmNzUfWuJ1OV/wl3y2TdAtupzy/hhx1h0cFmrQ+Z3dB2JCAEvpYVhHYoID1Xz2chmjXOcwwZFrtxj04GiQ1FUiZKishDMFq2idxAsyHJ4GBJyoMlLPNw6i3y9r2zl4+7bB+eAt+5dzAq1Ad3wqLGrmoc0h15+v7o1ykS/RySpk8CG4cWR13Ny+9VlzK7G0RLf9hVgjuZ8T7ncC2pqVZ7yi8KI2SWeQPwF5R/lq9rNsHeryu7BbvwojbS01aE6Z8GIW8o6b+iNdIDqoWYOI/odfLzx5iamx0s8gYtonE278dH9EKp6SIBJ0elolXxxGC/cD3LdxPHibZGAJxY0d5QhpZVe+l+p36BvkQTAEGY8+Z3VKFoWH8C1PuxOaRPIjYEXdhT9VDdILlTRkuBk7T94PHZq9mXG59lfL3muyBAmQFZw5JGKp8obm9osDFfxq6AGxNxWESD3wO5YgG0VzVLXsFkiQbrramP4tjlYZL1m7ocbOOID4zhHbRm6W4rNs0t8UHUGPJ8kFZZtrZ24pKLNCJf189hzKau0+uHkoTEkifYgbW7BvAiz/cwGJBlPTiG9ZAsIQtpDpzNaaQ6gcFimgZhr8xf21QnkiAAUAFhcsx1UbXFns1p49IIbY2o89hB6odgaHzpy0CHGqOfgsfACY8ktQwO3YOGra1b5NzXzatgP+W9l/k147X4vOc+II4ECryIkmbknJ/dNwP58nxhtLdrYrWWfKWAHG7L/HruUMoP7z5HcBi8Nic15PCN8wU8vFrWU41JC9ndp722nMIjuxdqeXhgM9JDuTEKgE9OB/+AMDjaEY2DqGT0UWdZfKKrsglx1vp/96y0jZ9n1vOLHbxKWjnw7ei3lwgOdfEBHeXfNsMc+I7QF9o6w2I3QAZ/0UsXxx3SdKcXs8gJsyYdPPDPlaFFDeePFSNepY3qBNNzlqy7vyW41Z/YlNH1sTuIvXdPrclz5+PlxSwDiu2A/iLuPzk2SWre3+/E/1quVhBWOwtFuBI4EL0oYZ4cnCB1q45PDvt4nV6S6hS/44lva3jw6oexGLSIaBEhuIZlEanG3f69ddlUiJa4zMclwpgJbt7FBP2K1sUrTSgca2SPdf0o3hYHPKAwgPBXw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 466b3530-bdf5-4b1b-290e-08dc71fc986d X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:48.5201 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 48/71] avcodec/mpeg12dec: Don't initialize inter tables for IPU 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: lzHTFDtQlcdt IPU is intra-only. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index e3f2dd8af7..097e4ba19a 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2751,13 +2751,8 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame, m->intra_vlc_format = !!(s->flags & 0x20); m->alternate_scan = !!(s->flags & 0x10); - if (s->flags & 0x10) { - ff_init_scantable(m->idsp.idct_permutation, &m->inter_scantable, ff_alternate_vertical_scan); - ff_init_scantable(m->idsp.idct_permutation, &m->intra_scantable, ff_alternate_vertical_scan); - } else { - ff_init_scantable(m->idsp.idct_permutation, &m->inter_scantable, ff_zigzag_direct); - ff_init_scantable(m->idsp.idct_permutation, &m->intra_scantable, ff_zigzag_direct); - } + ff_init_scantable(m->idsp.idct_permutation, &m->intra_scantable, + s->flags & 0x10 ? ff_alternate_vertical_scan : ff_zigzag_direct); m->last_dc[0] = m->last_dc[1] = m->last_dc[2] = 1 << (7 + (s->flags & 3)); m->qscale = 1; @@ -2846,13 +2841,6 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx) m->chroma_intra_matrix[j] = v; } - for (int i = 0; i < 64; i++) { - int j = m->idsp.idct_permutation[i]; - int v = ff_mpeg1_default_non_intra_matrix[i]; - m->inter_matrix[j] = v; - m->chroma_inter_matrix[j] = v; - } - return 0; } From patchwork Sat May 11 20:51:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48794 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp303371pzb; Sat, 11 May 2024 14:10:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/6N2zDLdSI2EfMvSbh1ZOzCxqPuRvJ+H3H+bxY5FMTwfO0VnoI/9omau2qbdN+CtMsPaIwDBSTD9VgIrNrBT/66Djp4zS73W7yQ== X-Google-Smtp-Source: AGHT+IGUJiNgCUopmEVTX2u21lwIxiBXDI23Nh521WQSzC2a18QFdFBW+a6qXTtgxvI6O3LuQHcm X-Received: by 2002:a05:6402:5154:b0:572:58d3:a6bf with SMTP id 4fb4d7f45d1cf-5734d6b2ed1mr4625786a12.2.1715461837108; Sat, 11 May 2024 14:10:37 -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 4fb4d7f45d1cf-5735a4a5dc2si1758868a12.63.2024.05.11.14.10.36; Sat, 11 May 2024 14:10:37 -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=Mg4Wds69; 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 C63DC68D8A9; Sun, 12 May 2024 00:10:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2020.outbound.protection.outlook.com [40.92.49.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7902F68D7A0 for ; Sun, 12 May 2024 00:10:27 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KgelxWGc7Ivx3jFCESsSCLfNSPHlqUbFv6Ncke4B/nkGIcZMAvIQdNqtFoTGvnqVAYOF1BkX7L+tTZoOxyuBn5yriZuWBJJyPivPtRbvSKqGANlV6EJxOK9Wj/ORLvmjLRUQ6XrqWTRef7KLSWvk6KyYQbQ1fUBhAfkB+br8jl90y9I13UaSPCuaTEZOibelkXyKbEFp0rSJ+c0b9CojpVYs+z2nl6cvtX7zcpTyBsvM5qQzsJfVQY9SKm8OxZLlIYvkL+rNJROrD2N1Oshu7IztJSqktMlcP/iwypD16Z/tgGueJTV0WYaxGmlEp+WK+HTnNzOW//zNbklXqxXgLQ== 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=eBK/z989gcNltQSWpeCi0fPGWxbktnARAGoUcfAlpPE=; b=Qpw/YxNzIA3RzjDQQYynGxHu7wEFCp+8TF9W9hPtJCh7HwyuSk641jjTlLTyAJflLibgFOkQZjgUF1bDQqeDjwU/5SioJgd0p4TFhHqpexD0UuY8KuiV4VE3NACL7D0DA/yVHDP6j/qJRI8XILGlxQhOi9n4cooQJLNubY6EcKOl4jiwZaDkhUBi9NQdAbBALDpdPp/lYuVxql2tTvoBGc0MhaavAP+M3M7lLGPYLjJIWIEWvLj4cC1S+4Bnz6RSQ0ixHQ/cMnxYBJ1S2Np/NKrbQmeuJo7qhGv5b73QvqpM5gmzqycVfthPBRm5erPys0AiV0+coJmJn5HGmePSww== 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=eBK/z989gcNltQSWpeCi0fPGWxbktnARAGoUcfAlpPE=; b=Mg4Wds69i/GpO4yWoj+P2MuBtLAQgQMQ2C9mdWza3N4XY1uJ6yn15/MFskqbbyIBBsdw441NYixPBEnqpjeBk3IjZKDNWrlYY5ksF7Jp1op6RfB/glc+oz6fySjI9ENn8jr9032xE4mu/kahwEvDY9dG6JeHQ8LSVylgSFvaGuctSZX+fD6xX4arLRydOMVncjqf/VUTX/PIffFl2EXDMeqnrVcTc7DzBpiUrCUuQPNrGyAgWdaFfQWAVkbY3cFs0oK4q5pBC1tnVqebfhcgoG9fZWVj6Q80Ap/f2za4cHJmHqScw8fMbY1AgBodBEAJees1VS24ka3/BIVLOzncPQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:54:50 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:13 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [0B67+eY60V5N+OGFrMpzQGpieHfgCaoN4O+kYEavQNw=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-48-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: be144d32-d160-4f89-9276-08dc71fc996f X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: IRhfV0Su2O+BHo6klOizqSZwarZdTjXk0c42QFB1NVL1kgUHeL2Hy9Pwv5dehKfq2qfDKfeXto4KfFq3razlWEdBKGetRTqnQIap0EDP2TVVJRvSFyF15ejV2pDGSv6VaWUtD5Pd/+9/e9+iutjOLZCOTFI0fFWKRNAPBsdAujw5YU3QLGu6EcoW4SNbIAbdBnBGUUd9SqAJrDIrJHKzBgBZdj0mvKLVNIUebux7YLtwzvpIQ/Cbq9UBe9dlqv+dwaTo9epKNoN/XpCA14gZOoc2aQsC1JC1XCSwnRHqMpMap6oBzuMqUeKZ7E5rnGglYMEREPHLbSLU2aV6829Ft8qSFFaSJ+jzS/JeAtE2BvFvK8FUxtZqFWQBInRXOMq4JmB8ND66vkFTWhdjYMlSV45O6yOhDOYHhYYNgTgUV+Y5g1Y8LU7FGJO7QU9Uh/NlldErkQ7S5tOAraOR10E7g2cTUk+2DvVe0VOR2zFAHOyoUDmkcOLjDOQJjg7qGXYIZhL+azBR8LoIwiA6hBk9Dzulm04Pu7q0MvcsAogwWH19GwlI6U5gSnp93HQqDX3o8OHpN84xLNLK3U444tn4+53ufDXZ6JJiqDOSzu2RM+hjo5eGS1SEuSp+A9n5bTii X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3yDTXWXqhSKlpbpFcqjs4V00fNvcfH3YpvUm0KuGiuUncRwR91aEcwydbwTD5Oaseyd2ZAkKtIrW44jJ0720oTrXJZvZBiQUisFPicB+7Gi1Z7o2qj+luX/xs2Bs6UPZ4UJfQqCMoUyVEr99PtTGET4k0wewU2SBFET0iYCqD5luAshUE53jK1G+769KkGM+Qw4K2r5NU761GBzh7mkuAhvxCI7EF9kDn/KtbhKhEPWT1GtWQcwuSalHwRAUyVw15yV9fN6KCOKaoTCU729mGxjO4e1Nvx1jtJFlyS3gpalgJ+Ej/OzqbyJc0sYc0eH/YlBawupeeVW6vrLGceXgdG2xQDxFOrkIZlzCYtAzvfI1LY5Aq1cbg4FGRTHGMSUuU56knRVOXX3W+fPCxAQBC3ca8ELfSW9Y+Bso2H3EcCCZV6ZixgubPbsogowQWwd6CIcY7lToC8Bz3lktJrdVpvJ3PlOabZKalZhTxUD+7KKIfwkC/j6LTzdl+8iMJJ+UtQyRMIlnOS3ue/cgBH4mcGQVEbLoCsw12EWeazTpNTURI89Q2eNfSiWoHzrJ8KRZ9hS6nn/WxLWkDcOe4JS2SqC/XRicsuwpcPzaUk5RlfB9RK7X3PWovfAP3ImUzeKTxHn8VrvpmmpY9KDjOtbeAhxkRuDyfeYfjoQ6ypwj8tGqBTLP3lVLOsESZ91vhU53ZLOOOqdAyyVWmau8pK2mtsaI8rkKeQtIpZxdYwvHsp7f89Y58GE4/2w2OWLTHQzAb41BVSieL8RFlePyy00oB42lotj4e2ubVat4Wr0aNZNqXnvhcWBZR2QEyOJZsL8pPIhbcZjf+Yjnx/WFh4vFxkigy/RznCstcJxTE81RjSXQ5XaWoRGNlWWZo1dFsccN8q9xApVZ2N7x8zmp6tVmhHFgKbcUiT/IHKs7WRCFd3DOPXNyNB2kbcUQ2Y9Adypxb1GoKuSkcoWjU2EyacbdBQrwukaVDriIQGyARrdUd2ADzB6Pbr9FFpzTSmzHr/pHe0+jjzxbkVA+5WqT9o7JwyT1WCiNmDJPnjAjT/xXPI2HF4GsllCd7iv3IjkPNMw+Knot+UXz2HfsOQtk52ew58nBdBK1WzX1WOUEXe9Rcn2Q812a5MJmbe9Lq7Q6GpHqT17x8G20ZCfIcUjisH0sQ/FJPRcP1eleUwNBXccAH+15kLjPh2gMk8hygEmnssP3nvOxSutFy/kkfSPlWxTqvurJFDyWiIH2rvCKyRw41Fb8T8yxPn2pU8Qfkn3lOQ8OTMHmCZ5uy2kiofBdTRT7Nw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: be144d32-d160-4f89-9276-08dc71fc996f X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:50.2947 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 49/71] avcodec/mpeg12dec: Only initialize IDCT for IPU 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: WTnRK6z6wbXX This is all that is used. This is in preparation for further commits that will extend ff_mpv_decode_init() in a way that will make it possible to fail and require cleanup. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 097e4ba19a..3cd706de36 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2830,8 +2830,9 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx) MpegEncContext *m = &s->m; avctx->pix_fmt = AV_PIX_FMT_YUV420P; + m->avctx = avctx; - ff_mpv_decode_init(m, avctx); + ff_idctdsp_init(&m->idsp, avctx); ff_mpeg12_init_vlcs(); for (int i = 0; i < 64; i++) { From patchwork Sat May 11 20:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48775 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299481pzb; Sat, 11 May 2024 13:58:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcW1nR1s1hMDBWywc2ZOwTG2aKTgNYoyKtZ8a7nvwPuHpd3hsFWSmWatythUTrhvGW70oJNzilmd70X5ysZMNk/jvgIHlbHZXwwg== X-Google-Smtp-Source: AGHT+IFc2mDP4Olr/1Rnzz0x29FuWJfxDGLyuk7e3pVGRwGnRmefaMQ0uU7bojE7IusTw/pap1On X-Received: by 2002:a17:906:7110:b0:a59:a18e:3fd9 with SMTP id a640c23a62f3a-a5a2d54c365mr353699166b.5.1715461139165; Sat, 11 May 2024 13:58:59 -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 a640c23a62f3a-a5a17be1fdcsi338552466b.703.2024.05.11.13.58.58; Sat, 11 May 2024 13:58:59 -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=jsQx5Odm; 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 8EF8068D77D; Sat, 11 May 2024 23:54:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2046.outbound.protection.outlook.com [40.92.90.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED91568D7B7 for ; Sat, 11 May 2024 23:54:53 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZYY/iQ8jjcsGPNG5uFzyiHqC6LVRHTDHnvze7JfY2XwtviQt5jU7/DuJordHNviyxG/Rxh+85TJUr0KnsVDz6za5kM/wKfOO1hgv5WpJdvOPFGk+5UEczMPx9qf42EZBZ1CO0lOX7DO+44GrGM7R7RLHQTaRkqTOTZOJuesWRf11d+dBp55o6cbqGXx4ElARDas/ybU+gz6GtzWRaRwbW3wonS+WPv+z5b48EVIB2RjayX8IRnAjemZGwpXfaDcBnITF/Xb9S+ezE6cAy0F8SI5qJ+jIiNGLO0crBW/cp+ZzPV5NF15JClcCWilAkCstp+S1X+41i+fgFcsN2DRxjw== 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=LiIb1d8ORPDo/xWxgth4DFNsXsiQgCtP3hUUWbBUP2s=; b=aVlefq8PT3H7Gm9deE5E80xoOg9TRz8IslvXbbi+u3oQXkDs184ToU/afLqgH4TPtnSEPZaNsBcJiToPYi+dxOSLq2IuViARvzwYzFveEv4+7DcymzAxhIIgv3zRvIFT3SfFKicmbE1H7dUQt1QeGez+ZK+L/xrJjlGIqrMfTo9pFtT1eBpE4rTM0AJ7anlA9hnaiivJdeuluqOyIR0K/Pn/Uk9rwSuSRLxlRanADI9Y7PuUeBzUoAquWShdTrQ/ZEi164gGoxPIqh1asyqOCkQy4nmSr5GwMlnhNAsoumyfW8jyzH3yPkzxFRLt3Ku+p4v6p7/aQd02ghUs5Rd/Tg== 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=LiIb1d8ORPDo/xWxgth4DFNsXsiQgCtP3hUUWbBUP2s=; b=jsQx5OdmxcpuKmRMDnhgztwqAUFH7vPmstLAoV2R4KGFVn1NMZjZBKW97wXMukF2RyLky2Yk7O4ro+C1nyFVSzoUCT9D+gSjfxP9yNL22K8yZ/9edHZ6D02D69VtZ36Fo2JZDzbc6GG/xGysto3eixSsVjfsDCn4VGllPCrz7YgqwEhZXiadvkzfo0/d6DBFB4vAPQ/hUH9BwRLw1v+wHIe8fslUmLBosc1q9k9PJptQAbqje/0nmVQkQOPfqW9e0WK+qaFCDvgXMYn6ci4zUnVdIvpikrqp65myzzUucyg20LszSOf8wI+Bdmwi0XhjP0FpG3nWrvw5T6njM+bb3A== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:54:52 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:54:52 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:14 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [x6a2zf75bA1eM+XqwgWOP68BL8+CiAueKBqnGlBfZeI=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-49-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: d185c005-c257-4696-6ef6-08dc71fc9ad4 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: zKU/N6dJPJIZeXE7FVTP/dNHBnUbuermq7bhMwr9uhAud30mR09FPsdp7fX+kvNLrqNogc5cxGSw0RT80HeoxmqR/oZ9vfJIKetDpI+ydPUqF+8IZR3CdF/lGf8t6ht+h399fFdGdcwekRhYoAEtIf8+GjP1V/iLnxUI+vDL7G3VUUFRxB/FhLA+uWNe8mJ1p+CaGP+nBAMuUBxSWCgupXdnXixre8aPNTIi5L6QlkXzBglobbD9uEs4PnUEtkEYvHbZyurXgPpEaXg+91IiMgN0dBoOFPRBHiKUz2yucWM+OU/eoxTQoODD+lYKPGoljSzhCv5TBi5vmDm4gPpYfCl1Cw7KoeYAvNRx9OQ6evH3dwmDjbL4sXfhyVqe5sdFGH35nU2VXferwh3r+LdBoaOmZ/kPDqunVSW1vyfH1XmXpW6lpwcHSuwwJI3cuFjiGdVbD+nZFudveqodlr9BO2P7plBj+TqjbYDZQsRxwiPg2gZiPScq3k1/IS7iDrsS3+jwlocUMDo/wHrha1A5Xlml5C+PEtwDNMRYoaLs5HKZwlS3OWR2Dlx6u0sMS8NJ5b94gz8qah1egYltaXALoTUMAi9+YULfbDCgTPffjmk5utiGgst59E7AAUZF5gR9 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XTKCKw0d+NNZBoGnj5OhjUh8CoNh9ksGllr/2K3AokKDExL7LrroMXGcUfZtdgByc3nT0jZ7zyDkcwRUQRA7SfPtWNfLL2M1gMp89CVgOO7hnFjn064+09Jek7qFolREvF65rnLtpkNltTj4x/dhsm72PCDIJO6bW1D1FaWkw5UYSwFLA/tHT9AOcSXJ2WCnbEvShRjleDnWGWu4+jPf98mVBswEWfuHW22czFnq5sJuhvbFvapyYpBcbkCYatrxm3ghxNnvKeXvjj/NogRiR7P9guraZlx+c9AY+T7EQouyCkPGa/a4k3XYraK0eG8XOBQetCnrIujcyM1GbEBAcghk0nwPf4FRnfOqMJTDwPKG4pYN1k6Qzs0gugYcqwi8df64WlNIMFPhZyK6YlV4Op/BH+oIvgeCzJzIETcJLomgHMnV5FBOFaerBHapmBTR3nvjZkNcl3oy7kiTBp0sfWTdxnx5mTeVVYNUfiyM02Ph/usGMov2Z7GUQebUtmB3qi1cXe6fyceJw0Si3R9w8ooEhEiVvLrF/6Ek7O85vGEr4jvzmlIyeUu/tT1hb+A5m68s2RpjIDY5VMXwINMpUw0Vv2Hv8xAVfV16qhf9x62latfvWRZPMsqAmrUvVmxE1MclqK1OXYgm01JuVEc+tTWRKRkhmRuDYIse+9zhCJd9OE/4qJ5Sn9q8VBD+TpNRJXXSXR893TUMwZ626PNWL8ItDI9dsna3RofjkgxucsOgAZMo2uMni2UpkQ6tpH2L0Wfvu+2kE0GGjeukLsnEj+M51dXFnAbaujErV7PKETpWr1aq8rnx3R3fvieOsBj5A5AC6SuLr0PzlmTvAmInzbOnfgjhKJp9fjZWKpGT+hjZRP6eIoeImr4PXKcK9r3Ny0aVlKS/B93kqi36hp9p4LVlJvajbIb1AlU/BebbctjNj4+hGwG6eOKb4fdwUqQyQAejkffhnVhRbEyzD85hhrJCYtH27jA8AJZpJkscs/64RU2CNOLjP3IePKUjO5hZvec3X3D5abGHxbvB90ggnxePT/C/lyYGS+RaTj098bsWrUaPIRrRZ8x/j/crGEhMc5UBieJzhNzhX9Nukek7Lx22dEKHXasqnV09K3j8F9JGelC4RGvUwrGcfMhEc5QPD+mp0GorXJOaAnAyCL9pjPmyYqkFBLgqcecRlCPW0AyRaZ5hv1zHPAFdaIuljOMEVSGH+aup6yFneeIjB1Gz1wutVm8/6Luvat36BXjtc+sYnZABbhc7OWJBzWlx+6pcU+M/mOla+iahDSF1zI3z1w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d185c005-c257-4696-6ef6-08dc71fc9ad4 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:54:52.5801 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 50/71] avcodec/mpeg12dec: Remove write-only assignment 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: dbLzmd79hD64 Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 3cd706de36..e573d3cdff 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2788,8 +2788,6 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame, m->intra_scantable.permutated, m->last_dc, s->block[n], n, m->qscale); - if (ret >= 0) - m->block_last_index[n] = ret; } else { ret = mpeg2_decode_block_intra(m, s->block[n], n); } From patchwork Sat May 11 20:51:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48778 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299755pzb; Sat, 11 May 2024 14:00:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4OaRjr4tokfcb1bq8CaP8BVP7Yj404BuToc1Pl03qrOhnkXd6fM9BBl2vtOj4H8HdHVtK+aVj9hFGQPzCx8eFWU30MlncpWIbxQ== X-Google-Smtp-Source: AGHT+IEEQoShXwse32ALVi/efjfIOLgkrr2k5vgtHJ6311GVZvaoW0vImxt2j9RWVPlSwBzjTNV4 X-Received: by 2002:a17:906:1315:b0:a5a:5c0b:ff77 with SMTP id a640c23a62f3a-a5a5c0c0048mr19499266b.19.1715461204029; Sat, 11 May 2024 14:00:04 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17b21e33si340431966b.304.2024.05.11.14.00.03; Sat, 11 May 2024 14:00:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=L+svyXcT; 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 7159768D7F6; Sat, 11 May 2024 23:55:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2071.outbound.protection.outlook.com [40.92.90.71]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A4EC68D42D for ; Sat, 11 May 2024 23:55:22 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mXkOY0O/BlKW9ozy+/Aaj6xoe9qXpIlSu3HEd2ImYYuKJybVrJIOtwUzUQP27LzwVkl9Qons4e5WglybN68nmRxM8cBpLT9CaQ5FvZbs2yeAQo+pWiWP2V+TvnyCOhQncdlbXdcfS12fU1JFgqNqmgBphJldY2moUJb/oT4nEOa+TqKAgVd30odQS37xEKSb3PIKPZzm17nh3y+7bbDJfUQ3FrVTKNt0s9AkTm5Stry/RVNDrwKx03+eajlqliUZ+9MrVRKUsmQWc1l4qVZDW6lXp+wJIdZDwE9YxJ2TM+qcJje3T2ZI9/PmKgsiP/Udq7woy3SnqGjt41L67I6urQ== 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=RzE12RuAffRiSra5akuuryU03KcDeH4iAqp74loEuUk=; b=Jr9SvdKiUHML5HJrs/Z3t82AHYk8K96z8p2UbR7WfbJstYCgdHplyF5esFbNpduhL8g+3vX5C1MWqLDwTmzFIiXrYDeWLTtpwxNCJ9Vc8miiaDL0bKFwg1RK/DhGUK1Otis7+RzWrlnZdL+1/0o4tyGjFaVnn2cJsIhlzpzgUzbRE02KpsSQCKK9zu59eTNdbnOH3PD2NIHk80kzlowH23ZNKqKlVhgyDZ6oMTP4P1t9SrSnSS/LP/mbMytTITPjXI4g8mKWskn+yf5exAC9hdzIDEPs4hYllz6iwa6iJT0Wajb4cNpbWNqdJnmHcBu+tGF8tbXgBH029R6pIoa3tg== 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=RzE12RuAffRiSra5akuuryU03KcDeH4iAqp74loEuUk=; b=L+svyXcTdiPUwFmcJlNJOs5ub6Wd6F11r419d00jRVopbFt6gra/OVg6c39mqCf2SkCGWW2KLbCQZoAXBgX7g8Fxx9k0Jqzsv4Ei60qXRO1UkAIf2cYoX6cC2verNwUlgSjQPUbpL/XAwDh+ly2UQ+CL98J6SNNYU++8DXu+EV9GPy+RmAhXNkhvqwQlsV6RKOFbmzjUwSSwpX71ndCOeuj47Q3ovval79HamHeEBiSpDS9NEWXeCUfCl2Vxdj82JFFKmnCgusAyMJ+v1Xj3rDNAM+BYEj2pRdckYB+/LZflDbABmiHAU616En4XFH0GbM56kXhd8qboDPRd3iUhUQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:21 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:21 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:21 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [KMmttcBujZqMnikJXrwhqlyqnyDqbhHhizvLLDQatOQ=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-56-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 52f2b1e7-30e7-47e6-0a74-08dc71fcabe0 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 65dQQ/tN9Kcb6qKKTXaUZInt/fH7f5Wy5d265oAtZFp7tqgYt2lCDK0TSBNrran2PLJ0Ige5T8MFHS/DgB3m3XPhMSnwRP1QImRznSSy0ZXvmRBtwicXpotDczujTLDuD1kOER7pVOdEq75iKQ6M1ZQmWB3r/KjjXezAGvcEzIacwebxi/dxJG7p9mQINX8WF94futaPwIoY1yd1+V+mldUv7ufrs+85PznVE7AMlcQOsDecWMpNBjLbjli//LoE4gcCRHcaC8FH0AisxaOYLh5HxLtP4Tv/B6FDYmp4v8NxkOdSCZFOgQQ8E4HcrLpEa0dh+27qePaMmfYq8pRai+OJfxnDjbBb6Eho1nUdDTRpowao65dAgBv3xpdJh3JY2JYzOohNbN2CPbdosDLuiTyGMp8xaHRhrahFQfIqkXd1/xyUuY9gZPbAIc2D44bt5ADgJryM4vjBw2qyK9FUy4GV/W0Pdfg92R5ZB/SRz9/2RH49a/YK5WtUX4PXs6S2giPQ39FZywt3d9VeyczEkmun5eZvgyLJEOexKFCbyMJ0DQ8BVUA5FaLR7ITSWTCQ9qhZq5OXm+TXF4kvqny0zSsS/WBxa5Yqx8jG3m3BOmU3VDIW6Eu+mtHYoQW7AHMe X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lOTscv0I1oCbkLjGzRbqFMFYf2BCCfCOuzoCgqgj39KrDS13/MVrPCMXAhxolSpLy/EhKFa0f3ZJjNT8Fj9TrPLd7KJGsLSXbGA7BwJQw7gSOlDp6wBylxUqhP/KS4bXAXXUxp4Yr2sBQSYWvbqUzfk7wyeCJDTr5qI/qeEpD/e3iuMvkEUtFVCLSkO64FwCQxMvU3dKpZkiiIbotg5RM3NVrrrCsRkGEPLzbcYyre8sXL0JbTLzGM0N7UyC89NN0paI2V5jZidd6mz5hg/ffBxb/xbksKilQIIdqdbemqmOLHzCsGywO55blSqz/g+oTaqxQFS9aovizkRI7hLunNcWNI+LKWnXs+bIr6tmOuOWdmawOdSSGQYxaICB8ShMjhyjF9Ef1V1J/EGxNDWffbeCfqDkvXHuocajrGBC2gdz4oUvC6cC7ykSx8LmaYf2TL75nVUBeCHGMcW9MKKczxpVI+tLSwV9/cRgsbor2Y35I3XIhuqhXXRKoYlDneagBXg2HFkuQsjYmyxx7xd911QwQopOA7jH4bXvmIGz7LFymFQvgPUz/y0Il5ohCwxm1bF5OvJbXm9kDwppBJF34Mw/iV1dRtPxcoJa59ZgwbXmn1LcCJqqRoly7d1SoKzB6g1cqT1axC9qbUydrOOc38WmZGk1AiitAqZwqkI8C7RQCiUCgQdbx7GP8qBQOdXBVa8M6YsF0GDkO8Bin0YSFF8jjbtqf+Gl+Vq7Je2zl+gXs2U1GNDsUfBXcTj2YXOE/+LLsqaQRq9bglRzAowjRHFnP7/OLqfVBihGq4thxIZfALsibCHIrUm3qnAFMmCt6LCcoP7pM66vU9qfIZJx1l4WYhxs5uv78eol64F123rZupLwKHSAT8O/HKUVs1RXr4WbR6AM/k3l/9mcUhsA6qDTwzdPlm0rs9eCVybCgXHLkJkLTzCoO7iP+OCV4gH1FFNMOm3p1DZMgXT8nJTAkNbeR+gYa3rk35AKsKZrJluVRUiycatCJEeuUpHH12DPHx0/JlijZRUqB0PJG96wipcAYBKvA2tWgiRQ6tzF1kVB7OUB+uQa/9mrHZaLcl+0GLYbqW6iNPLAoDkX7tu/D0MrdZmI08eufGlMtoaacWU/f5sojSjjlwiUj0Alb/oMpXAjrEMNnyS2IxGdCE4vOWpCcM/Jv4TN15IiQZkrNGr5dGbnkaPTpyFFCqiHcmXj/kUgsMS7dbQNk2zGHlk3F3BIgVF256sojuBI5GqLkVvJvLHZENMwHDkqIZyi1MBn81McOMXIc7aK8HwCLetldQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52f2b1e7-30e7-47e6-0a74-08dc71fcabe0 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:21.1886 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 57/71] avcodec/mpegpicture: Use ThreadProgress instead of ThreadFrame API 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: o81+WSf2Gc+/ Given that MPVPictures are already directly shared between threads in case of frame-threaded decoding, one can simply use it to pass decoding progress information between threads. This allows to avoid one level of indirection; it also means avoids allocations (of the ThreadFrameProgress structure) in case of frame-threading and indeed makes ff_thread_release_ext_buffer() decoder-only (actually, H.264-decoder-only). Signed-off-by: Andreas Rheinhardt --- libavcodec/error_resilience.c | 13 ++++++++---- libavcodec/error_resilience.h | 1 + libavcodec/mpeg4videodec.c | 8 ++++---- libavcodec/mpeg_er.c | 2 +- libavcodec/mpegpicture.c | 19 ++++++++++++------ libavcodec/mpegpicture.h | 7 ++++--- libavcodec/mpegvideo_dec.c | 25 +++++++++++++----------- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/mpv_reconstruct_mb_template.c | 8 ++++---- libavcodec/pthread_frame.c | 5 ----- libavcodec/rv34.c | 16 +++++++-------- 11 files changed, 59 insertions(+), 47 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 66d03987b6..56844d5084 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -34,6 +34,7 @@ #include "mpegutils.h" #include "mpegvideo.h" #include "threadframe.h" +#include "threadprogress.h" /** * @param stride the number of MVs to get to the next row @@ -409,8 +410,12 @@ static void guess_mv(ERContext *s) set_mv_strides(s, &mot_step, &mot_stride); num_avail = 0; - if (s->last_pic.motion_val[0]) - ff_thread_await_progress(s->last_pic.tf, mb_height-1, 0); + if (s->last_pic.motion_val[0]) { + if (s->last_pic.tf) + ff_thread_await_progress(s->last_pic.tf, mb_height-1, 0); + else + ff_thread_progress_await(s->last_pic.progress, mb_height - 1); + } for (i = 0; i < mb_width * mb_height; i++) { const int mb_xy = s->mb_index2xy[i]; int f = 0; @@ -763,7 +768,7 @@ static int is_intra_more_likely(ERContext *s) if (s->avctx->codec_id == AV_CODEC_ID_H264) { // FIXME } else { - ff_thread_await_progress(s->last_pic.tf, mb_y, 0); + ff_thread_progress_await(s->last_pic.progress, mb_y); } is_intra_likely += s->sad(NULL, last_mb_ptr, mb_ptr, linesize[0], 16); @@ -1198,7 +1203,7 @@ void ff_er_frame_end(ERContext *s, int *decode_error_flags) int time_pb = s->pb_time; av_assert0(s->avctx->codec_id != AV_CODEC_ID_H264); - ff_thread_await_progress(s->next_pic.tf, mb_y, 0); + ff_thread_progress_await(s->next_pic.progress, mb_y); s->mv[0][0][0] = s->next_pic.motion_val[0][xy][0] * time_pb / time_pp; s->mv[0][0][1] = s->next_pic.motion_val[0][xy][1] * time_pb / time_pp; diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h index 1346639c3c..a1b9b9ec1a 100644 --- a/libavcodec/error_resilience.h +++ b/libavcodec/error_resilience.h @@ -40,6 +40,7 @@ typedef struct ERPicture { AVFrame *f; const struct ThreadFrame *tf; + const struct ThreadProgress *progress; // it is the caller's responsibility to allocate these buffers int16_t (*motion_val[2])[2]; diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index f4d83dc2aa..450278eee7 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -45,7 +45,7 @@ #include "internal.h" #include "profiles.h" #include "qpeldsp.h" -#include "threadframe.h" +#include "threadprogress.h" #include "xvididct.h" #include "unary.h" @@ -1811,7 +1811,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->last_mv[i][1][1] = 0; } - ff_thread_await_progress(&s->next_pic.ptr->tf, s->mb_y, 0); + ff_thread_progress_await(&s->next_pic.ptr->progress, s->mb_y); } /* if we skipped it in the future P-frame than skip it now too */ @@ -2016,10 +2016,10 @@ end: if (s->pict_type == AV_PICTURE_TYPE_B) { const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1; - ff_thread_await_progress(&s->next_pic.ptr->tf, + ff_thread_progress_await(&s->next_pic.ptr->progress, (s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y + 1, s->mb_height - 1) - : s->mb_y, 0); + : s->mb_y); if (s->next_pic.mbskip_table[xy + delta]) return SLICE_OK; } diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c index f9421ec91f..e7b3197bb1 100644 --- a/libavcodec/mpeg_er.c +++ b/libavcodec/mpeg_er.c @@ -34,7 +34,7 @@ static void set_erpic(ERPicture *dst, const MPVPicture *src) } dst->f = src->f; - dst->tf = &src->tf; + dst->progress = &src->progress; for (i = 0; i < 2; i++) { dst->motion_val[i] = src->motion_val[i]; diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 95255b893e..ea5d54c670 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -28,13 +28,13 @@ #include "motion_est.h" #include "mpegpicture.h" #include "refstruct.h" -#include "threadframe.h" static void mpv_pic_reset(FFRefStructOpaque unused, void *obj) { MPVPicture *pic = obj; - ff_thread_release_ext_buffer(&pic->tf); + av_frame_unref(pic->f); + ff_thread_progress_reset(&pic->progress); ff_refstruct_unref(&pic->hwaccel_picture_private); @@ -65,14 +65,18 @@ static void mpv_pic_reset(FFRefStructOpaque unused, void *obj) pic->coded_picture_number = 0; } -static int av_cold mpv_pic_init(FFRefStructOpaque unused, void *obj) +static int av_cold mpv_pic_init(FFRefStructOpaque opaque, void *obj) { MPVPicture *pic = obj; + int ret, init_progress = (uintptr_t)opaque.nc; + + ret = ff_thread_progress_init(&pic->progress, init_progress); + if (ret < 0) + return ret; pic->f = av_frame_alloc(); if (!pic->f) return AVERROR(ENOMEM); - pic->tf.f = pic->f; return 0; } @@ -80,12 +84,15 @@ static void av_cold mpv_pic_free(FFRefStructOpaque unused, void *obj) { MPVPicture *pic = obj; + ff_thread_progress_destroy(&pic->progress); av_frame_free(&pic->f); } -av_cold FFRefStructPool *ff_mpv_alloc_pic_pool(void) +av_cold FFRefStructPool *ff_mpv_alloc_pic_pool(int init_progress) { - return ff_refstruct_pool_alloc_ext(sizeof(MPVPicture), 0, NULL, + return ff_refstruct_pool_alloc_ext(sizeof(MPVPicture), + FF_REFSTRUCT_POOL_FLAG_FREE_ON_INIT_ERROR, + (void*)(uintptr_t)init_progress, mpv_pic_init, mpv_pic_reset, mpv_pic_free, NULL); } diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index f6db4238b5..f9633e11db 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -26,7 +26,7 @@ #include "avcodec.h" #include "motion_est.h" -#include "threadframe.h" +#include "threadprogress.h" #define MPV_MAX_PLANES 3 #define EDGE_WIDTH 16 @@ -55,7 +55,6 @@ typedef struct BufferPoolContext { */ typedef struct MPVPicture { struct AVFrame *f; - ThreadFrame tf; int8_t *qscale_table_base; int8_t *qscale_table; @@ -87,6 +86,8 @@ typedef struct MPVPicture { int display_picture_number; int coded_picture_number; + + ThreadProgress progress; } MPVPicture; typedef struct MPVWorkPicture { @@ -111,7 +112,7 @@ typedef struct MPVWorkPicture { /** * Allocate a pool of MPVPictures. */ -struct FFRefStructPool *ff_mpv_alloc_pic_pool(void); +struct FFRefStructPool *ff_mpv_alloc_pic_pool(int init_progress); /** * Allocate an MPVPicture's accessories (but not the AVFrame's buffer itself) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index d596f94df3..b7f72ad460 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -40,11 +40,13 @@ #include "mpeg4videodec.h" #include "refstruct.h" #include "thread.h" -#include "threadframe.h" +#include "threadprogress.h" #include "wmv2dec.h" int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) { + enum ThreadingStatus thread_status; + ff_mpv_common_defaults(s); s->avctx = avctx; @@ -59,9 +61,12 @@ int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) ff_mpv_idct_init(s); ff_h264chroma_init(&s->h264chroma, 8); //for lowres - if (!s->picture_pool && // VC-1 can call this multiple times - ff_thread_sync_ref(avctx, offsetof(MpegEncContext, picture_pool))) { - s->picture_pool = ff_mpv_alloc_pic_pool(); + if (s->picture_pool) // VC-1 can call this multiple times + return 0; + + thread_status = ff_thread_sync_ref(avctx, offsetof(MpegEncContext, picture_pool)); + if (thread_status != FF_THREAD_IS_COPY) { + s->picture_pool = ff_mpv_alloc_pic_pool(thread_status != FF_THREAD_NO_FRAME_THREADING); if (!s->picture_pool) return AVERROR(ENOMEM); } @@ -229,7 +234,6 @@ static int alloc_picture(MpegEncContext *s, MPVWorkPicture *dst, int reference) dst->ptr = pic; - pic->tf.f = pic->f; pic->reference = reference; /* WM Image / Screen codecs allocate internal buffers with different @@ -237,8 +241,8 @@ static int alloc_picture(MpegEncContext *s, MPVWorkPicture *dst, int reference) if (avctx->codec_id != AV_CODEC_ID_WMV3IMAGE && avctx->codec_id != AV_CODEC_ID_VC1IMAGE && avctx->codec_id != AV_CODEC_ID_MSS2) { - ret = ff_thread_get_ext_buffer(avctx, &pic->tf, - reference ? AV_GET_BUFFER_FLAG_REF : 0); + ret = ff_thread_get_buffer(avctx, pic->f, + reference ? AV_GET_BUFFER_FLAG_REF : 0); } else { pic->f->width = avctx->width; pic->f->height = avctx->height; @@ -281,8 +285,7 @@ static int av_cold alloc_dummy_frame(MpegEncContext *s, MPVWorkPicture *dst) pic = dst->ptr; pic->dummy = 1; - ff_thread_report_progress(&pic->tf, INT_MAX, 0); - ff_thread_report_progress(&pic->tf, INT_MAX, 1); + ff_thread_progress_report(&pic->progress, INT_MAX); return 0; } @@ -418,7 +421,7 @@ void ff_mpv_frame_end(MpegEncContext *s) emms_c(); if (s->cur_pic.reference) - ff_thread_report_progress(&s->cur_pic.ptr->tf, INT_MAX, 0); + ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX); } void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict) @@ -484,7 +487,7 @@ void ff_mpeg_flush(AVCodecContext *avctx) void ff_mpv_report_decode_progress(MpegEncContext *s) { if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->er.error_occurred) - ff_thread_report_progress(&s->cur_pic.ptr->tf, s->mb_y, 0); + ff_thread_progress_report(&s->cur_pic.ptr->progress, s->mb_y); } diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index df2ff67ed2..85ed52d9ad 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -823,7 +823,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) !FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_B_FRAMES + 1) || !FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_B_FRAMES + 1) || !(s->new_pic = av_frame_alloc()) || - !(s->picture_pool = ff_mpv_alloc_pic_pool())) + !(s->picture_pool = ff_mpv_alloc_pic_pool(0))) return AVERROR(ENOMEM); /* Allocate MV tables; the MV and MB tables will be copied diff --git a/libavcodec/mpv_reconstruct_mb_template.c b/libavcodec/mpv_reconstruct_mb_template.c index 549c55ffad..9aacf380a1 100644 --- a/libavcodec/mpv_reconstruct_mb_template.c +++ b/libavcodec/mpv_reconstruct_mb_template.c @@ -124,12 +124,12 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], if (HAVE_THREADS && is_mpeg12 != DEFINITELY_MPEG12 && s->avctx->active_thread_type & FF_THREAD_FRAME) { if (s->mv_dir & MV_DIR_FORWARD) { - ff_thread_await_progress(&s->last_pic.ptr->tf, - lowest_referenced_row(s, 0), 0); + ff_thread_progress_await(&s->last_pic.ptr->progress, + lowest_referenced_row(s, 0)); } if (s->mv_dir & MV_DIR_BACKWARD) { - ff_thread_await_progress(&s->next_pic.ptr->tf, - lowest_referenced_row(s, 1), 0); + ff_thread_progress_await(&s->next_pic.ptr->progress, + lowest_referenced_row(s, 1)); } } diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 67f09c1f48..fd7819f52d 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -985,11 +985,6 @@ int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) int ret; f->owner[0] = f->owner[1] = avctx; - /* Hint: It is possible for this function to be called with codecs - * that don't support frame threading at all, namely in case - * a frame-threaded decoder shares code with codecs that are not. - * This currently affects non-MPEG-4 mpegvideo codecs. - * The following check will always be true for them. */ if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 94d5ee30df..d3816df059 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -43,7 +43,7 @@ #include "qpeldsp.h" #include "rectangle.h" #include "thread.h" -#include "threadframe.h" +#include "threadprogress.h" #include "rv34vlc.h" #include "rv34data.h" @@ -719,8 +719,8 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { /* wait for the referenced mb row to be finished */ int mb_row = s->mb_y + ((yoff + my + 5 + 8 * height) >> 4); - const ThreadFrame *f = dir ? &s->next_pic.ptr->tf : &s->last_pic.ptr->tf; - ff_thread_await_progress(f, mb_row, 0); + const ThreadProgress *p = dir ? &s->next_pic.ptr->progress : &s->last_pic.ptr->progress; + ff_thread_progress_await(p, mb_row); } dxy = ly*4 + lx; @@ -899,7 +899,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) //surprisingly, it uses motion scheme from next reference frame /* wait for the current mb row to be finished */ if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_await_progress(&s->next_pic.ptr->tf, FFMAX(0, s->mb_y-1), 0); + ff_thread_progress_await(&s->next_pic.ptr->progress, FFMAX(0, s->mb_y-1)); next_bt = s->next_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride]; if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){ @@ -1483,8 +1483,8 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int r->loop_filter(r, s->mb_y - 2); if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_report_progress(&s->cur_pic.ptr->tf, - s->mb_y - 2, 0); + ff_thread_progress_report(&s->cur_pic.ptr->progress, + s->mb_y - 2); } if(s->mb_x == s->resync_mb_x) @@ -1582,7 +1582,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) s->mb_num_left = 0; if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) - ff_thread_report_progress(&s->cur_pic.ptr->tf, INT_MAX, 0); + ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX); if (s->pict_type == AV_PICTURE_TYPE_B) { if ((ret = av_frame_ref(pict, s->cur_pic.ptr->f)) < 0) @@ -1810,7 +1810,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); s->mb_num_left = 0; - ff_thread_report_progress(&s->cur_pic.ptr->tf, INT_MAX, 0); + ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX); return AVERROR_INVALIDDATA; } } From patchwork Sat May 11 20:51:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48779 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299831pzb; Sat, 11 May 2024 14:00:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWItzzyuit/s8T1GOtaMhqof5dX9fPJcvXiPYPbArXfGbfLt3Af8AZVICCtVwEf5FKhICAEmn/Evh9cJ1zv3/R76bY+hfidmRHmrQ== X-Google-Smtp-Source: AGHT+IEQRtXkv/8FuNTv7FT6nBNj5nmIfgTstzaDU63bmni0xZp1J0V65z/MOq/4fKIEPOZGn9HJ X-Received: by 2002:a2e:9844:0:b0:2e5:5c83:3359 with SMTP id 38308e7fff4ca-2e55c83336emr28388971fa.42.1715461214136; Sat, 11 May 2024 14:00:14 -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 38308e7fff4ca-2e4d183c949si19900961fa.478.2024.05.11.14.00.13; Sat, 11 May 2024 14:00:14 -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=SDNTwsF5; 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 1DFFC68D7FF; Sat, 11 May 2024 23:55:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2022.outbound.protection.outlook.com [40.92.90.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1614968D220 for ; Sat, 11 May 2024 23:55:28 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mo1AJSxHcddMZ32+fVyLLV/9Lif4flPlbEoVAulId9XJzxzw2qEPOJYduKYdh5wgtB68Nz+wVElKzhRA0+FbWzOA6iZ50+5kdeuuxCzoqlDeR5cn0DMFshMZKarMtWfOPUlutP0ZSp3Pymzn9ljbA3475F6+grK8zAu1xo3jUzqlevkquMxWdcVIryBjIKo6pxvANabMx3+SvJlY/nSECGuU1OkZ9fOXMCk6rVX1uQRFOZSDHRenCoc4EM8l4qdcanIcrmFN5fdszb4C25+kzPc2/24B26dp55cxkB6Cvw6Roi1TY9469xw5sCw+ZQOJlwjWSK+JOQe6dKObGRPWNw== 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=2U9G3Zq7sFoycJRcQ7kwMoa9MlnWC7yIdLGm4xOUREI=; b=SMkQd3EnLXRCDrUx70sZwwjrP4D+WF641Gz/6gXjzv0tBoeZNWLNanrfF+4W3WxECq3gWqFKmfwrD5HasZ/XnWMOO8bSVMqAV1w483G6rLLCnCFJzxeelIlit/e4vSyGh01Kc/N84Y2HGLwq0XkEDaxQjVFI5Pj7TULMmJKaz85ZkCf2/f0T/fCEt3eLwQ5nGaRzKTrNlUIDkor0QmscfgGzVwSVRRauZNTuIUwicmzNjuRHDpB2hGWuAgrqKkuHYzO38Yh2MWVPuZsO5oHd5tSR1HvU7bcxVny+z4hbP8Qa84ijq8EgHP55xBBYDs2psdxqzcGjUp3YcYfNSC6qCQ== 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=2U9G3Zq7sFoycJRcQ7kwMoa9MlnWC7yIdLGm4xOUREI=; b=SDNTwsF5tMeAINKP7PUa8y1BnFI1gzOuy9gbNGIuopfB4qtVh7LC3v/qqmlrD5glsvNNXZ6GpNoBvvR2cbtDXfkYAvGuspdSosHPlGN+2RITflsHLHgPwWZ9BHWsniQtn/hOqUJjFgQd3Nn4mJYl5hd25+WHQU+PAp++kRAppQaLOCd4oD0vVsKzl8a/3LvMPj9QUQyL+Iu1VqxyjKmr8gkSYZpA4GWd81tBYQpgggwyTrTu0dvMqB05bAp6JBvVcfhR2yj83prfp+mwkpZ7txQu9TQtIiJ+qgxWKH6rKXJKCocvjknNsbJHbz2yE1fnX694R1KAIvSgWVfe+KTvyA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:27 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:27 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:22 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [LK7jUsTbpkUiiTG5d8VUP7N9YqPCEpvsBkvCNhBPA9w=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-57-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 612f15d4-2c4e-4e7f-933e-08dc71fcafa8 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 9S9uARaISWv56K2YzQ9Wa0fWDmbM5HtakoXs4C3EZFuaIZChqV8WJcPZTwh8djsHv5MIgx0M0SUrpCGH01t8O4wOTi9hI9q5I5efq6r7oh6rN1mQVKDQh+irtWJm8OB3HUoG/C1hHCu6V/XLUKemzScaTaKIu/Q6C64bsCHz+hRy3a2wsmpF1NuVpvW25MyDvakFmUiqL6d2B+wwQNaCWBUr1gciHmR/3Ua8/qMyKcvHp/zQpyqvAvSHeIIKQguNvT8i5uUQp93nfdVpTE2GNvKG7UfOZ5a9Fu+gvd3FD7659+S7ALbkd5V82+xV4BVflCVi+23KeGkYaBengjInih90hrgymHBmHiz+dnRWDjgIPUMyDmH8j5gLbfphmEsvqCfsJWAz2zBOjy3WFQRgWo/cuo4F4L9J1XyPsOCiGONcIIS5bC/3m+kXTYAhfLtnFZoKFBkeyyB3saE3HTBD7F7Qnw8zO/YRGZ1uWX8CxWmdzGPgvMK5/etKXy7KyDvHs5ALHGb59jcrTjKssP+9Zj6wR/tMytTMXqKfOC+WYbiU7I5LAid9qMV9QXEBoCxrYBvRk5Wi2GtJ6Dqa6KhGH8l/o+8nCrvM8c7JSyKXISABBMlDlq/UbX9j1Jy24PXe X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GxthdX4apHl+zu81l7560gTXOYCVtY/ff2ssKCIjliVWF2Czee/Gb2lU14yXhPAmiihQ3H3Ei5b/qyRZ6B3lyVRoFkxpALHXyxwqSfG+eTP8K3LwaM+vnMi6dBfTlyV9M4+it77JBhIje5TJXTAlG+7O22OiZZKY3WTy//QVoUlVz9hr5cnITKxTZqc9hzC1TrZnzwX000JQPyETDievigg3TFn57GgAbEgeLUV24cwxf8vuZK4vaOUwIgMVHeHRIv0v04OOud5YCBV8Ce8dGKEDyiK4Kvd3XAw3yxiu+uGsk9QW101mpQMjufmny3KcG37taH9xQempXBF7hHWZYq2HAQfz0ZOHA1VDtrqwgLXRFVQJGjfXh6qF/AuRV1f3d0nakvoDseFpjum7Np7jO93WLS2tdPvhZQ75VVQnah5karXbh/DHtBIFg85VnbrUSOP2crI1fFUIigZctvYzkORvO4KeZmDvBjLa/CWtOMMAOPfZ6hRHZ80gqGE/u+fnphX8atAftcTwq7K7Y4CkESZ2pRfHZkLijQ2fvqerqQ6tcHiOkNdc0vbn3f/2DHFj3R9NdhcIstjApnvMx/+eCmU8QJ9AeM0xpYFK5M6dVrroBr8n9tr9YQhhLIsiXd3vWFAlwajNWAxG8Ch34wY7HdLG2Lb/2FTk8/4qgN8tREERZezlj2eocW0tCQJYwhwI3XDBanajNHnEHuuNqQdCTdNx9yqB/xayqwoP2Inm81I83XqSEQr+93+0UIT7wy0gg9/bhsFZh7JJIFgc6vz3Iw5kBc1DMbZKyOfc6TvGNkFCX9dKvOugnQ1NYGOg7DWMo3PDkNQjK6sBVXVrFBw7924dwa5OzWIATsyfx8sbWAQ4bEdR/ft/lqtuDUG/BGUYKyDA4U4raZz5L1vJfpJ2YStcl9jY+y8oTaZG+xGa+l8+8ulrelSyygk5RJbuWA0uWpJujzyUcZ431VbflOTbyVFncrWfU2PBP9ueL9V/OTXJa/4VgdSDCmjG8ImAGfZO5ULEhFBgpqwLpqxEllRBpvU9PwAer/8CkP19RiHplwDpur83YvK93OCEgC17QlqyVxaWWCX4q2sox+2FrITd9f0SCl0TGwSNuQu7YyJTREcDU176MZWLVh5UvOyCAlHSGwTyCqsVcEFnWnDWx9zw+CcJqBY0VhCH07i00moLIYNS19ahUtvgjOoqaAqYRYYg+9lO5jF0PPCNZ+bfIsr+n5WxCCYVUrQH29F/oj69Yih0KeTnLIuF0TzF6q2Yoh/V+t8Kro6CzhawYBRznCnXqw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 612f15d4-2c4e-4e7f-933e-08dc71fcafa8 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:27.5027 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 58/71] avcodec/mpegpicture: Avoid loop and branch when setting motion_val 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: htL/u2SuaMFt Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index ea5d54c670..9308fce97c 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -223,6 +223,7 @@ static int alloc_picture_tables(BufferPoolContext *pools, MPVPicture *pic, for (int i = 0; i < 2; i++) { GET_BUFFER(ref_index,, [i]); GET_BUFFER(motion_val, _base, [i]); + pic->motion_val[i] = pic->motion_val_base[i] + 4; } } #undef GET_BUFFER @@ -231,6 +232,9 @@ static int alloc_picture_tables(BufferPoolContext *pools, MPVPicture *pic, pic->mb_height = mb_height; pic->mb_stride = pools->alloc_mb_stride; + pic->qscale_table = pic->qscale_table_base + 2 * pic->mb_stride + 1; + pic->mb_type = pic->mb_type_base + 2 * pic->mb_stride + 1; + return 0; } @@ -250,13 +254,6 @@ int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *wpic, if (ret < 0) goto fail; - pic->qscale_table = pic->qscale_table_base + 2 * pic->mb_stride + 1; - pic->mb_type = pic->mb_type_base + 2 * pic->mb_stride + 1; - - if (pic->motion_val_base[0]) { - for (int i = 0; i < 2; i++) - pic->motion_val[i] = pic->motion_val_base[i] + 4; - } set_workpic_from_pic(wpic, pic); return 0; From patchwork Sat May 11 20:51:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48780 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299897pzb; Sat, 11 May 2024 14:00:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHE+rtwRUmXb6QQCkIoux2pVWW2Sh0Uud5mPgMIptSntiPbKOnQCIsHgPKIfViP2kfV64UnfEFvc6zLEcdZO6QwfSB8qGYD03BFg== X-Google-Smtp-Source: AGHT+IE3mGxjMREepAvSNpG6E1RPbmomgdxjg+aToyFxkmqWjHv91QTAxFV0l6SAH1Euc9I/alZJ X-Received: by 2002:a50:bb0f:0:b0:56f:e7b9:e67d with SMTP id 4fb4d7f45d1cf-5734d5cec3bmr6814944a12.12.1715461222698; Sat, 11 May 2024 14:00:22 -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 4fb4d7f45d1cf-5733beace29si3550459a12.3.2024.05.11.14.00.22; Sat, 11 May 2024 14:00:22 -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=pGksQq7A; 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 67ED168D7E1; Sat, 11 May 2024 23:55:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2068.outbound.protection.outlook.com [40.92.90.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3081F68D7AA for ; Sat, 11 May 2024 23:55:34 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=chEYMLAy/51gAEgcPERfuATfIq9cPYUeaNJ5TJbLh+Iy+Wh9iSStHO9L7Ef8h6GrdFZPVwNcm12WuiFG3HPHDzTA0QBKygyY/ZZlO8M+VMEYwxdVm0CA6A0CvRf/0Lis1h0LI4x4b6Om5W2EPRrzUAVOWucJIABnxCESiq/YdJEHHbVJRv1blW+kQG4wAMYpWJdi7nbz1viwsk2RpIiQwIN30l8nPlkBu2PcAi+9qHymKx1Y20wjDvmg3DG3GI7ZSGsoQ4NmiOZVAXnREZTRzYTn257o8zagjWsQsHkDisjAOS+/hCfeXLdPpA5jlumk82oI0e7mkhNJ9OJOSfGViw== 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=MHB07eaZIi+0k1OtXWhkmhhqOj82XjYOu2tIdWMU38U=; b=kK7ljWi7pMA4W6+A+Di3ZDOGJVnBVPmXv68lr9u/6/Pz0mL9f85zykAVcMPQVjQcdjUIYbt+QeePZoNIPbOkJPlWBsznW1KkLbd3g/i8Ur/S21tGk2d1a3e4ePR2RQegM2qRNm3sUzQ9HdWBCHEirvtKHIv5TCmzinLlxuD2e1MZAdcGK/45ANXAR+S306oNiMUT5FMzgpK+f/YIqJjuSlJTPLBaVIobJ5elNAA4KIAkxDhJAoVHH5LEQR1My4/cVWzAf3YmyW4CukC4V0VJKPgwLyFSFSbH9lEHRZ9DLEnPVAAZnYJ3RdJy6KFC9bWynsT3bH3YQkQn5Cd4Mnjb4A== 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=MHB07eaZIi+0k1OtXWhkmhhqOj82XjYOu2tIdWMU38U=; b=pGksQq7AVR7dGDQl40x57MOmVAYSfj54cVEL5PZP1HI7B2GPp5rDXPL6Hc3sn3ZXNHxJHaCYUqwdjkArCWinWOmj5/WvLofMlRjkqU0EWRxV20tQ2VnCkmd6J10gTG6vqd9ZHc6KuOC6wD6KGGVw+dJFtzFl3/LZLaHR87r/7e/0LdFZESxsH2xMLeHInbQnosipVxK9zQpnd+5fIVQ4fkHDUZkDg9R3xQW7xgjV0SLURZBhdnxU/XaSI4FCiavIW9BfCe15Rt2LpxSbOJTNGTUdoYvM+CDiA5yCQKJVM05cPwItOLEGSZdIndxJG4/KKEKieXX0+xNuitKITAvEOA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:33 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:23 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [xlYKxCW4KEbG6vTrdyuxGupDXPn/tCEzp5VcqCp4gtI=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-58-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: ce9ad96a-9ccb-46ff-3b60-08dc71fcb343 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: c5jsnpGGb0Su9vXT996HcxCPkdFYE/HgjE7PM95slrZg4gn4piVrK9bDkpxMyLVcr/mgFnPzxG5Xx1IYcZMRB46NeysmOSqKAoRXOEn2GV3jIY7zm4FfGW4JCaDZhp4cQiLvGf5FC8rWAxK4exznGMdsNK5FbUwaIUH5gmM7sKU98OtLDTcyZnuWcT+PMp52TwoSdMb2wPBIGD0mgdF2rEU4/fSt6ks1dQyN/xKXIj1uLdwZ65I7h7VROpSG6JaHocHFZo+JWi0Svomxsk5p1FqD9kKPK6340vgOPiWvo4TPFD6LpAX9aXdZzv1+PLNIoRhfunEvklp2AGLg8MGAcD4odYtD4G1omj28c+i0yWSM4ZL6hz/gN6t+5qzSilwKmpAicPv+DiUS26z2lEWkXjmFADIKXWTAUFoc7RxmZvRd/ARUuPHWcsbi+UKoHBA28EJ/xBF1PSLw8OO4wvNBENdUy5WRIlYQf3qEsl4bMleOK6LubCx5l9xOXAfJJS090wuv4RM8V6pBMlxyWzM2DZ330o/yoxacuaKachsE77Y45UpNp5Jq3F0WDahsd7rLQn+SpxcTXcymii5NQyE3TuF7rRqQneX2XPd67SofoflKCN/wylW3rs7AeyRIMNDT X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B1k641prRMhYpfqOWd+wWWyAm3Bz6hpc4prAIK8wUI9Wb4xL72/PxyJxvlHcRaF8IjtBxqH2WnNi+CfP9ge3QUmiHHPDVJRxCwO/CbEFJ8GRqxrTQ2hEhihSisYp1U3AoNn7hIHthttikd1Ful3GOM6NdcIsQ8n/mqm/WqRuPg1E34CKUmefWvt+LRCBojzN8Pp6wKRrjN4qWFGasPoi8SOFCyIBuViZs4nimBm90XT+dXmRJamsvQs+n97+v3lwtouV4xBQ5a3ZMMfTzGsvUyEGIgQrBruCilZEJQ9PPIHsF1nA7Z5SNWq3w4hjTCIAB5OOhGtfotWmjuvsHS/uNVXzV/ZoZEYpcRfOdhJsPedEKji8mRvGPhDhO+oo7IeR0SmpXRX6Etq7oyQXLZtQzcx7+05FPtD5P/4jjwMXsBLRGW3aLDSl/OmH8Cyj2Z2R3pQ8AOlfVJjdkYwu31kEIWrh/vSAr9QyEji2z4PjKACmLHa/y4ofZ97vQbo+z0IpcB3Yp8rt3o8Th7AHzVAC1i4qWrI5VRwlK6jrOeW+i5aCiVXlZ3BZmroI1QZ/PPD8OiLGNctpWCSvb89UqQjvn71MF1fip8/Okv8v/PLJ/H8tu+jWfzmAA/RlEV3ISiSTW510JM3hKvoU3l4Qh4Am4OAupJRM9Sljz2bPgr/8HsSZQULqFoT92JFqjNVG2A1OaDwZhIcSYmYpH3JUFrHn/xfbFQU4d9MHvwQCIqY791sZ/w3xRod8+r/RixxiLFmKtzeuZxHyJKPpx4oIUJ6IDXe8kdbdT/YrCTCrSddTM7Xj1a78EFjLDlyplwJojbxFkecPuT827uu4ricgFFBikgv95xRN2Fpt7Xw69NYF/2R7Tf1dca2KnTDu9y1K9+RD7NhhzV9jjRRbDlvrRZHDZBmtOReHghGKyW/PjEy0FmQkkFPC4oOIigKfGgvn+rpJHKsniSBZbiFwlXODlvRXv3OqU7gYYNJBllzkqgBWlZVEhtFbguut7CehhmeLh5/SzSO8TjlGsUQ/MCrh4s7PN/JuKwi1Q9PzuK7wprrrr5jqKH/PXKsUYRs+3WCooyF11fnebFBSryFx7JZ4V7nQh7DBtuFGL+L0BTkhMZqK4ISswkU1B3SCAxtoZl44e7iXIhGQVNNFKTumPQPRojUfQUww+2u5+1irKumqANdu0rrr1njJBhpYCpwmBQ8+ZCnyv188hAvL/UUq9E+Dd7n/CnvnwPxEvbC79O5HTwP93dW2zkHOYKym6451v6sCcJmSLG8j8C5VpA08J0RrCjC5kg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce9ad96a-9ccb-46ff-3b60-08dc71fcb343 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:33.5879 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 59/71] avcodec/mpegpicture: Use union for b_scratchpad and rd_scratchpad 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: SccWyEMpCftc These pointers point to the same buffers, so one can just use a union for them and avoid synchronising one of them. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 1 - libavcodec/mpegpicture.h | 6 ++++-- libavcodec/mpegvideo.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 9308fce97c..43d35934c8 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -175,7 +175,6 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, sc->linesize = linesizeabs; me->temp = me->scratchpad; - sc->rd_scratchpad = me->scratchpad; sc->b_scratchpad = me->scratchpad; sc->obmc_scratchpad = me->scratchpad + 16; diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index f9633e11db..ddb3ac5a2b 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -33,9 +33,11 @@ typedef struct ScratchpadContext { uint8_t *edge_emu_buffer; ///< temporary buffer for if MVs point to out-of-frame data - uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision uint8_t *obmc_scratchpad; - uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers + union { + uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers + uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision + }; int linesize; ///< linesize that the buffers in this context have been allocated for } ScratchpadContext; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 42b4d7f395..36947c6e31 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -440,7 +440,6 @@ static void free_duplicate_context(MpegEncContext *s) av_freep(&s->sc.edge_emu_buffer); av_freep(&s->me.scratchpad); s->me.temp = - s->sc.rd_scratchpad = s->sc.b_scratchpad = s->sc.obmc_scratchpad = NULL; s->sc.linesize = 0; From patchwork Sat May 11 20:51:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48781 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp299985pzb; Sat, 11 May 2024 14:00:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGWytCDrN7LI9RXnVhmQzBytPQmhoON+/Kh0IQ9M/RgN9s5J/+5j2EDQdHYCnUtYjn4FWRMJbpXUDMQOw9k6+C29s15eIlMG89yQ== X-Google-Smtp-Source: AGHT+IEeC96GcflHPhRPbpPeFNV6rJLN4ibEQl4Rb3jH6iZg/f5d64mxmIL2jxYpariLeWK8+cug X-Received: by 2002:a17:906:31d7:b0:a59:c7d9:9d39 with SMTP id a640c23a62f3a-a5a2d54c0b5mr411449666b.10.1715461231988; Sat, 11 May 2024 14:00:31 -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 a640c23a62f3a-a5a1797cac5si322198766b.244.2024.05.11.14.00.31; Sat, 11 May 2024 14:00:31 -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=XLqzxJrX; 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 1EE2B68D813; Sat, 11 May 2024 23:55:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2069.outbound.protection.outlook.com [40.92.90.69]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7473268D80F for ; Sat, 11 May 2024 23:55:40 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UIQ8P/h9toHIQmUUgPjYyyCu0HOUFLE6VHpWzxDI68mNKPrkgtbE06fzdr5Yyk49c8oKKk0aEDOLE1i0+6+Eg3R0sKJye5gQutrDYBPM5DHtbGOJ11dgW8GMnVF05wJPot7ryu91Q4XUKFFVEb0K7lCBU56AFGHvxHJYqFjW0hEiIwe03WO76EQPs1B12TX7vVmxsSUytVgfGgiuxaLe2TDHCyR1J061eoIpx9yW+ILOxK4q9RBvymbLFH+srGVu5szGQ6J1Ocnqm+vHapKW6L91dv4FvShjjnT8C0R6nh4Kl/ACXG8uzruLuGRo/cA6gk/b8agba6QjzxSZ94iUPg== 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=CyBRe1lLXxNwgC6EpQT71HRSQqqIs8RCmM5tZT1Ir2I=; b=IM1JpRJQUeZz9oznLS95SDuJBBrhU5SFAkFBo1QjH1mLg5g0Swq8ACUifdbbr8Kelvzuk58f0kG6wfA9IcfaxMQKLcBKaytYQMRvoLaqwPO+v0S2joQzoL50pIDyaMoSzDs94fT39tT7U9xGJi/HuaUeYlBQHfDU9l60EyaSCOFtTJeJtRjbu7a8KkzWyR6v8WxwNJp+g30GmK/ppaxgX+pSVvWP5lF3VmXVlQtx0/b8ylN9HMDuWFf2iwEQxgAu2cLdlLFpnrAVaI44UyBFJB4FPD/9dCfQy7CU7lOOvCluVnVoXDrHAFIg3fjF92kl4nnsFc5yCzPiOtl7n+ejcA== 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=CyBRe1lLXxNwgC6EpQT71HRSQqqIs8RCmM5tZT1Ir2I=; b=XLqzxJrXgwIY/wMuK1qvsfjOtuStQ+2h5p3H09eKbmMZRK83BZWehod5p0scDTwkkBX7AFLT6l9USt79ZRtpsk6bBxgRfqEYTkMF5402x7OsIpDmgEbVUvJWpun2JZpxFzxwljrN6yug1zWP06hexM+rpjxy3pC9Wjevj0TCE4KvDe+MawkjeDZPR78fPAZ5f3xDj+3hFWj/tWYd2kH1VXhnRNX/G0/9JT4tVf2niPTojZTYrvcQXHipp0FeFUKRlFhDdrjUTUBmOstXVbsPhyKyaK6T9zATtw7cVPZYULw48Cv3K/E9TLwEoALBnVZV1tkGd5EtoR2QK1W/ontYZg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:39 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:38 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:24 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [c/tmF2MV2oGLeIrveNS84gsUgX/9pss2GTNATC2gCwk=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-59-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 219f414a-f416-4d4c-2ef4-08dc71fcb676 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: UilKI4t+8K6X7+F2ICUer0nU0ubgmO1ReuxWHLFgs1Pbbgx9oaBHVuavVtgul/TZy4WIFCH5ZVd4ZsLQiuJb6E6NHjAR88mnIdDeSG0GZRG5IFHJ9NyCZ8xiLGILdw09fviqyObAJU5C5T0+lUeRizxID7bX6FHTOWHdEz07rqwxMoXrGNUrEK8LN/YHsVGYnFiI8tivdq06poX2M4eM+FDEEW6HxH15544ZLHpjWm/zPws2zQ32FVT8bhefzWvJlW4E8Ndu0JKT8w4vhO8JGkeVvLK8Ko5nFj0BR1W02B1RX9ieYkpy/E5WodJVggIHJQmFnzHJU6tQ6W8MeV9I6xqhjuEZjzotSQDTgsGVoJN+ZANmS8pm7JB/tYZmPoT7nyv3tdu93CP6D8+ITaA0qCRJuJtiHqz55TRH2cznp2DfU/0CxTpYgA1JTYjavFR1RvOxT98pKBEA6cGs1m71zh760gpXN3kBARZNh6jYP9cNCSpjRGXNuXoq5Ca3Se6LTUjN6jyCP8PeaOycI3scARLwHYVNWVuL4B4b3323imwrPXZQeHnATSGwe6UEXkYJF33q4lYZiccKyf4Y/0Vdh8OZ4nzbneby/624YRTmOuw= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: siAitXjdAEEHYBjsIrT2AXNI+NCnfvt5SW6anR7eCZqEx7JE1S69dInTYY/9S5tzQZqIwnTrSYxx4CT7M83O26TEZtq3ZMrBzV2srI/riikNIK9q6oDt+gQUtY6GxWS04kGauV02fWAUqxECIbTj1/nGiTN6NwvtOxabbc5TfYV9/3lZzIHfGFwFwECSsg8qW4ALNEiIc6Suo52C2NcoqXGAa93adFay0bJFIkMPRC/msXHRfYwA3gRfgnw+dkSStz782z/LDLkP1RlLQo/LIC7RH19WDtH8NccA+FsEe+FZIHU4KJ5Z9fqyu3MKHWLGRRMLZa/JPcnr5+15AU2Sag3sP/YNbPhpFokx2bna5t3P9JGikBtsrlOsvYI1BkWDqFp1hipsAJuY2iX0288oqnGa2KjSGaUYPTklciVilkW7o3M/4/zILrrY6L+h3xpFu/lBnaSBVkXHDTkfilaURsMR0M7IY+9VdpZACIDyXMH16Y1K5oY2T4fzklS8IVn77JVWRWZqa3eFdeL8p8Hx7U7G/EV3MYNUUFX+BhQBWXr5sQxbmNT07OEzp7prN2/m+bUPye2shnAnI+9UYjXUeoX/m15i/w/+WWqHCJHdNnPSpCAofNFDo0Td3oeXS7/eimHgXo9YEI80H9L4diTWhMajTOqEIDzlNFePQSnkmAPiWNArCP9gm2HmJJH1YHvzFP+R6sO5ptvOpLgD2v0c+m3OrMdA2DZtU2DNYZPsIAG5r/MojtPoOf1KFUCqd6d0/srPAnE7GtMAo2pKtRxBt7Vcowuhlk4eCltn7873koNoqgmTPHHrK7dCObsLAgIMAQPWmKQxnSQnEge60s/MnAewOI9brNPEiJClcjaDQBqr+mOnG2ocoPoUbympF0UdtDdLV1J84iOuk82htkAvqBGRqW6XJXsz+nBdTyTFff0UaQAYgoHbYw8uz+PWH1VSZw4MuDeo7/ZMYzWKwLHO4otjTw2/lj0lXpyMQe1nEZkjlkAEAcKYywAJBqXH+nbsKCtsphrnHqFwZfx8WQOEhe2eUy/AkOnEl5aVC87KASv6B+5XnP2Cx94+kR0Gn7Lpn62w972u3L7w9Wd5mn8TooxRV1rX4fBdpL8gcErGC+4EbNGpO/PL/TUEA4GTdULkPIyqWlxCNabDWXKtj11dHkLYAfLCZp9CyA6KpkNPAoatWO9+yUBGHSkRvNqD3uqdQcoSr7cGN92INq3bDeS4yMTxmCW0aJhtktnnu5beng53CvXrKKaYm+PDrWgHbzRLBAhuujzQJv+yTLT9AU0X4Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 219f414a-f416-4d4c-2ef4-08dc71fcb676 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:38.8835 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 60/71] avcodec/mpegpicture: Avoid MotionEstContext in ff_mpeg_framesize_alloc() 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: R+fG8s691V/B Only set the ScratchpadContext and let the users that need it (i.e. encoders) set the MotionEstContext stuff themselves. Also add an explicit pointer to ScratchpadContext to point to the allocated buffer so that none of the other scratchpad pointers is singled out as being used for the allocations. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 18 +++++++----------- libavcodec/mpegpicture.h | 8 ++++---- libavcodec/mpegvideo.c | 10 +++------- libavcodec/mpegvideo_dec.c | 5 ++--- libavcodec/mpegvideo_enc.c | 7 +++++-- libavcodec/svq1enc.c | 6 +++--- 6 files changed, 24 insertions(+), 30 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 43d35934c8..cde060aa1f 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -25,7 +25,6 @@ #include "libavutil/imgutils.h" #include "avcodec.h" -#include "motion_est.h" #include "mpegpicture.h" #include "refstruct.h" @@ -136,8 +135,8 @@ void ff_mpv_workpic_from_pic(MPVWorkPicture *wpic, MPVPicture *pic) set_workpic_from_pic(wpic, pic); } -int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, - ScratchpadContext *sc, int linesize) +int ff_mpv_framesize_alloc(AVCodecContext *avctx, + ScratchpadContext *sc, int linesize) { # define EMU_EDGE_HEIGHT (4 * 70) int linesizeabs = FFABS(linesize); @@ -158,7 +157,7 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, return AVERROR(ENOMEM); av_freep(&sc->edge_emu_buffer); - av_freep(&me->scratchpad); + av_freep(&sc->scratchpad_buf); // edge emu needs blocksize + filter length - 1 // (= 17x17 for halfpel / 21x21 for H.264) @@ -167,16 +166,14 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, // linesize * interlaced * MBsize // we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines if (!FF_ALLOCZ_TYPED_ARRAY(sc->edge_emu_buffer, alloc_size * EMU_EDGE_HEIGHT) || - !FF_ALLOCZ_TYPED_ARRAY(me->scratchpad, alloc_size * 4 * 16 * 2)) { + !FF_ALLOCZ_TYPED_ARRAY(sc->scratchpad_buf, alloc_size * 4 * 16 * 2)) { sc->linesize = 0; av_freep(&sc->edge_emu_buffer); return AVERROR(ENOMEM); } sc->linesize = linesizeabs; - me->temp = me->scratchpad; - sc->b_scratchpad = me->scratchpad; - sc->obmc_scratchpad = me->scratchpad + 16; + sc->obmc_scratchpad = sc->scratchpad_buf + 16; return 0; } @@ -238,14 +235,13 @@ static int alloc_picture_tables(BufferPoolContext *pools, MPVPicture *pic, } int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *wpic, - MotionEstContext *me, ScratchpadContext *sc, + ScratchpadContext *sc, BufferPoolContext *pools, int mb_height) { MPVPicture *pic = wpic->ptr; int ret; - ret = ff_mpeg_framesize_alloc(avctx, me, sc, - pic->f->linesize[0]); + ret = ff_mpv_framesize_alloc(avctx, sc, pic->f->linesize[0]); if (ret < 0) goto fail; diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h index ddb3ac5a2b..86504fe8ca 100644 --- a/libavcodec/mpegpicture.h +++ b/libavcodec/mpegpicture.h @@ -25,7 +25,6 @@ #include #include "avcodec.h" -#include "motion_est.h" #include "threadprogress.h" #define MPV_MAX_PLANES 3 @@ -35,6 +34,7 @@ typedef struct ScratchpadContext { uint8_t *edge_emu_buffer; ///< temporary buffer for if MVs point to out-of-frame data uint8_t *obmc_scratchpad; union { + uint8_t *scratchpad_buf; ///< the other *_scratchpad point into this buffer uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision }; @@ -121,7 +121,7 @@ struct FFRefStructPool *ff_mpv_alloc_pic_pool(int init_progress); * and set the MPVWorkPicture's fields. */ int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *pic, - MotionEstContext *me, ScratchpadContext *sc, + ScratchpadContext *sc, BufferPoolContext *pools, int mb_height); /** @@ -133,8 +133,8 @@ int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *pic, int ff_mpv_pic_check_linesize(void *logctx, const struct AVFrame *f, ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep); -int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, - ScratchpadContext *sc, int linesize); +int ff_mpv_framesize_alloc(AVCodecContext *avctx, + ScratchpadContext *sc, int linesize); void ff_mpv_unref_picture(MPVWorkPicture *pic); void ff_mpv_workpic_from_pic(MPVWorkPicture *wpic, MPVPicture *pic); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 36947c6e31..89d19a743a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -438,9 +438,8 @@ static void free_duplicate_context(MpegEncContext *s) return; av_freep(&s->sc.edge_emu_buffer); - av_freep(&s->me.scratchpad); - s->me.temp = - s->sc.b_scratchpad = + av_freep(&s->sc.scratchpad_buf); + s->me.temp = s->me.scratchpad = s->sc.obmc_scratchpad = NULL; s->sc.linesize = 0; @@ -465,8 +464,6 @@ static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src) { #define COPY(a) bak->a = src->a COPY(sc); - COPY(me.scratchpad); - COPY(me.temp); COPY(me.map); COPY(me.score_map); COPY(blocks); @@ -500,8 +497,7 @@ int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src) // exchange uv FFSWAP(void *, dst->pblocks[4], dst->pblocks[5]); } - ret = ff_mpeg_framesize_alloc(dst->avctx, &dst->me, - &dst->sc, dst->linesize); + ret = ff_mpv_framesize_alloc(dst->avctx, &dst->sc, dst->linesize); if (ret < 0) { av_log(dst->avctx, AV_LOG_ERROR, "failed to allocate context " "scratch buffers.\n"); diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index b7f72ad460..9d2b7671e3 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -155,8 +155,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, } // linesize-dependent scratch buffer allocation - ret = ff_mpeg_framesize_alloc(s->avctx, &s->me, - &s->sc, s1->linesize); + ret = ff_mpv_framesize_alloc(s->avctx, &s->sc, s1->linesize); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate context " "scratch buffers.\n"); @@ -264,7 +263,7 @@ static int alloc_picture(MpegEncContext *s, MPVWorkPicture *dst, int reference) av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height || FFALIGN(s->mb_height, 2) == s->buffer_pools.alloc_mb_height); av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); - ret = ff_mpv_alloc_pic_accessories(s->avctx, dst, &s->me, &s->sc, + ret = ff_mpv_alloc_pic_accessories(s->avctx, dst, &s->sc, &s->buffer_pools, s->mb_height); if (ret < 0) goto fail; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 85ed52d9ad..aac1fad535 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1663,12 +1663,13 @@ static int select_input_picture(MpegEncContext *s) av_assert1(s->mb_width == s->buffer_pools.alloc_mb_width); av_assert1(s->mb_height == s->buffer_pools.alloc_mb_height); av_assert1(s->mb_stride == s->buffer_pools.alloc_mb_stride); - ret = ff_mpv_alloc_pic_accessories(s->avctx, &s->cur_pic, &s->me, + ret = ff_mpv_alloc_pic_accessories(s->avctx, &s->cur_pic, &s->sc, &s->buffer_pools, s->mb_height); if (ret < 0) { ff_mpv_unref_picture(&s->cur_pic); return ret; } + s->me.temp = s->me.scratchpad = s->sc.scratchpad_buf; s->picture_number = s->cur_pic.ptr->display_picture_number; } @@ -3616,9 +3617,11 @@ static int encode_picture(MpegEncContext *s) s->mb_intra=0; //for the rate distortion & bit compare functions for(i=1; ithread_context[i], s); + MpegEncContext *const slice = s->thread_context[i]; + ret = ff_update_duplicate_context(slice, s); if (ret < 0) return ret; + slice->me.temp = slice->me.scratchpad = slice->sc.scratchpad_buf; } /* Estimate motion for every MB */ diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 9c9be8c6b3..35413b8afd 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -543,15 +543,15 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) s->rd_total / (double)(avctx->width * avctx->height * avctx->frame_num)); - s->m.mb_type = NULL; - ff_mpv_common_end(&s->m); - av_freep(&s->m.me.scratchpad); av_freep(&s->m.me.map); av_freep(&s->mb_type); av_freep(&s->dummy); av_freep(&s->scratchbuf); + s->m.mb_type = NULL; + ff_mpv_common_end(&s->m); + for (i = 0; i < 3; i++) { av_freep(&s->motion_val8[i]); av_freep(&s->motion_val16[i]); From patchwork Sat May 11 20:51:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48782 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300061pzb; Sat, 11 May 2024 14:00:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5+xiFvHdTNRoVK5VDeOnRPAQ56rRhLAdOsKX9htRtPxN+5MqrdjrryCjWx287oRAbWuGgvbhuN16XlxXAE+VRseltswcftR4O/w== X-Google-Smtp-Source: AGHT+IG7Eb/p3D+vjoHiVsxIjIa0xBMc1sYoP76cLUptH0sEUgYCVUWZDEOrQoRvHUm68MY8U9uC X-Received: by 2002:ac2:54b9:0:b0:51f:d72:cd2d with SMTP id 2adb3069b0e04-5220fc7aeb4mr3597070e87.22.1715461241528; Sat, 11 May 2024 14:00:41 -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 a640c23a62f3a-a5a17c2d11esi339248966b.1019.2024.05.11.14.00.41; Sat, 11 May 2024 14:00:41 -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=vKw8Vz5w; 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 99A6368D81D; Sat, 11 May 2024 23:55:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2015.outbound.protection.outlook.com [40.92.90.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 09AD368D7FD for ; Sat, 11 May 2024 23:55:48 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C3t6sqFj7LK5GGpMOMNQUrCVoZf8LDF0qu8eRvnKB930s8aRNN3YBigjWpa8qkb9R4hpJI7VwwZ4S6NMvov21XyL3uiN2EIllzbKLVAWgMCDutMSx6/nIRC3PxYg2kmx/ZGYvtxQj4ipGqePlBzZM1VzuBTxl458oKuX4Wl/UigcrHrD7b/3TBGdjyOB1Lxl+8Bw2i5uaOPu23yuqx7kec59JgsIuGxmEhwEzRw+9EEC8qhBFuWc9BoiGw4TVjLPAVAGdWNPSwual3nmxUF8SMR/xsc0CQVOXG9/C/5qx/w1r7bB0/hw456GTGf62trx7exjptgI1/hDa+1mZ3GAaQ== 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=R3EXu7q9UYUzxfBcWLJWSmEt84bFANYhfpUUEv94cAg=; b=HjhGpkZ0v9boreWiWFI+dGKAM8ozfV6CTJE3B1ZKs7tNOL+jbJk8ty6YZjPEHyUuwQjn5VgXd0y4yOnyNcGDIfEhldTtDVy4/ihlXm0TaTS51hkowuCXUgAXUIgokso9CJQaR5BY3sEpJf2Mz7sV3M/RyLZRDborFRslSMzqmX05PYICxvzbIxrYdk7S3GEl3kLqMJahkOE5wUMbX8IlFReQ/Alm2GSFW8HM750npRtv3R9PzrLp1y9brye+ekDTd653psW67Uu5XyNghMQJCVkEOIiIYshttKvvGim2QILgYTPirwrT74gMTJDBjc/687SEdCiCejjN1hJ9JjmbNQ== 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=R3EXu7q9UYUzxfBcWLJWSmEt84bFANYhfpUUEv94cAg=; b=vKw8Vz5wNl1/tErRjHr56If6DpkQG2vRHdspVbO4Oj6xi2AU8VvZJYsQpz5DkPo4pH3QC26ObIdmSQzHlYjsY6Nx4E4teK41iWNIpyDjJBOLmilsoq4PY90C31A165GTJ/fc+Ls7ITbro4+Tk6Y9hUmYm8w/rkOPOLQ/58t78JpelYW/v8oPqFFhIBMCCRTnk6FwUcHMMxXATQXaZPLLVvtohC7Qipvyxo+sZzqgdXK+O1lRkXl+Kp0rFeVexSzCyLvvj4j3e7oD5I7/mD9liyS993NSXejIWWm35TdOZ4XjDT+nQOFaop0prq1uKHe9TTWnHifVFUGweHgj5vbcRQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:47 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:47 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:25 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [uOXzI+Xt/HvqmeOxuV+6/4xUz+cxZfnVwgRLIZ8qFXo=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-60-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e894e41-2630-4c53-31e3-08dc71fcbb7d X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: uj7HaX2FAno+9AEAbnHkZPyDQWtKrp5iAFtpENuaKcfJ97j4ftNjztERueosT6aw/Cn/frkNQV23xmVPpLk2BZqAulx3fHI7aA1uyAZf4k3+b/XAJiFeuD9pMiQu6okX8hKRj6KrpYszjDcf6VMKayYuMfLSiZACE/a4XtLS9hdxZrZXk1JfJfVl7yYNmo01iNTiMg5d4PLxuk330Th5H8khyoNDLf//qK2/ggGhcRSjejte735keA/1H/W1KRxVDNo1YiM7GZZVsR0j5OYz8z62FpqidwKO6rRCN5WjeT0u+M8D3MQPbMNmtnsnS+utEqR2ax1dj6YQ+JRa+U+h+qpK0ZKESFwdq3rmg+wdDMHv6gBf3RCdW6wPA3DJ0RB2VZqUgTxmBUDWtrR9EUbr5gyqa2Zp7juLlJXGE8RsoD2yPLZ6Xc8q2KpSw4a5QOpN151zGYOpns8wW4o4ZNJPiUV5O8yhwuju+mYXVwerDonsF8bvQ3qq+0KBtEv4+MscUiv6hORkBJBeW1IvL8fGkPgJbBowX1pQ4aqc1KYJx5Zrqbmq/hc9Ha6CrrThFWXP7l+2kfHb2oLNFR9uR69kiLtr8xENg03oMdfxym7vRAd94ow4DLp7oAtF4NvRlerC X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lStoFXNnMhde6w1Em9GakQFq9LJGYmKVDSBV4/2UdEKi7lrA1oTkbKg9nElzRL+VlXVb/3DKoIs6YHUD72t89plRe3DgDYMbeIQPV4eXzv0tp2nj7+KagHPvcdj0cBdbtcrn+LRUy0OXL5d7zYECXNJX7Ujgr5J8VYQr8R/38+twYPDBUVeewxmrQXYcSDTx8rb4pA3+q59pSn7xW2l5PLp+X1vnevQSqIVfSjxk1HUHFDTKJ0AVoHJetAM7FfsPBSdEqG35/Yfvra/oN6om0dtTi/fWZ2UjTmze2hDF6itHPc0gvcrmc8w4suC82GDQKI+wSdXXstgaSvEz4GK4xFbllv6SHepzaeV+mIT4hKtQMRl6m1mQkj3A9+zlCPVZOX6EcDRJnrn/QFRsUa85mqkFibCAHSNvG0f5uP1G3XY2S+xyKeTbLqxebPHou5hPH5pXVdu7VjT4X5bf9INcfkQnd01rOVbFrm3Lm5Qng5ZjPRv4xAq1RA2t3KivzQIc0M8NCIq13turWSiwUYGtxSoV0vRu0rWydctlzVxKhG/dcjsVbTY5vCa+wyudDjt86KJL3scnKolZNrEypbxwUBeu9p1XJxOFVoFxUJDMMYV5XxUN2r2RBRXGinuif6atghVpjQxnWIzzPXAPjFgmG0esLqNx4YLMbq0r+oh3a6CxOuxKXF95vn45/tGUQNSUa3oEktZm6PS2sISrSM3x/oQV79LttxS+2w/TYhCtDrVctdVYGImueHJkDRVjID48kV7yJQKJYKvMD517dcZGR4MXaaEUNogHap0lJ3ekH6YepeKcYYp1qZ5vaPGQLkPp3128IXpIDq30umsKyt8jLIh7zvLIE4MgNNedIIX3b0HWMsih07JcIMmorOi/UfWjJY7eLAJiQr/j/boHtekT0p3Ao74fabw9AU5RbJVfn6mukM5IU8Z8MOPeAIZCH4f8+eDMgs9rhv328LruL/W38175br6FM73Pb60V7PY7CkdEG+GxoQnWOPjqs7ULSXO+OaedLz/RHv9oOp8mmi5dS85YUzwU4Dc9o+kYfC/YFkWF39u0bbKZ/NZ/1hoKxBQQYEQSH9GUvX8kDWCv9aTmhnNhHkcGsWgW9o4hj+CNcMgwRYPR0J5lxAQWTLCshwmIJd3MbVJrpqJqwYw5G3Bu/RjGUrx1oE281dfTHtjleGp7pANeItjnBEfCZUn6oSv2zCCyuNHaupUt1I6Yr36htBuwVygB8/L8uMCgi74W8diAxpIuwyrgOmAHgBFh2IGoqvOkznnONqVDb7A0iy2Z5w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e894e41-2630-4c53-31e3-08dc71fcbb7d X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:47.3510 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 61/71] avcodec/mpegvideo_enc: Unify initializing PutBitContexts 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: ClxEZUKy8qyI This also rids us of the requirement to preserve the PutBitContext in ff_update_duplicate_context(). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 1 - libavcodec/mpegvideo_enc.c | 42 +++++++++++++++++--------------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 89d19a743a..93df8a315d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -471,7 +471,6 @@ static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src) COPY(start_mb_y); COPY(end_mb_y); COPY(me.map_generation); - COPY(pb); COPY(dct_error_sum); COPY(dct_count[0]); COPY(dct_count[1]); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index aac1fad535..195d1e3465 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -84,7 +84,7 @@ #define QMAT_SHIFT_MMX 16 #define QMAT_SHIFT 21 -static int encode_picture(MpegEncContext *s); +static int encode_picture(MpegEncContext *s, const AVPacket *pkt); static int dct_quantize_refine(MpegEncContext *s, int16_t *block, int16_t *weight, int16_t *orig, int n, int qscale); static int sse_mb(MpegEncContext *s); static void denoise_dct_c(MpegEncContext *s, int16_t *block); @@ -1669,7 +1669,6 @@ static int select_input_picture(MpegEncContext *s) ff_mpv_unref_picture(&s->cur_pic); return ret; } - s->me.temp = s->me.scratchpad = s->sc.scratchpad_buf; s->picture_number = s->cur_pic.ptr->display_picture_number; } @@ -1755,7 +1754,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet) { MpegEncContext *s = avctx->priv_data; - int i, stuffing_count, ret; + int stuffing_count, ret; int context_count = s->slice_context_count; ff_mpv_unref_picture(&s->cur_pic); @@ -1791,21 +1790,11 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0; } - for (i = 0; i < context_count; i++) { - int start_y = s->thread_context[i]->start_mb_y; - int end_y = s->thread_context[i]-> end_mb_y; - int h = s->mb_height; - uint8_t *start = pkt->data + (size_t)(((int64_t) pkt->size) * start_y / h); - uint8_t *end = pkt->data + (size_t)(((int64_t) pkt->size) * end_y / h); - - init_put_bits(&s->thread_context[i]->pb, start, end - start); - } - s->pict_type = s->new_pic->pict_type; //emms_c(); frame_start(s); vbv_retry: - ret = encode_picture(s); + ret = encode_picture(s, pkt); if (growing_buffer) { av_assert0(s->pb.buf == avctx->internal->byte_buffer); pkt->data = s->pb.buf; @@ -1849,10 +1838,6 @@ vbv_retry: s->time_base = s->last_time_base; s->last_non_b_time = s->time - s->pp_time; } - for (i = 0; i < context_count; i++) { - PutBitContext *pb = &s->thread_context[i]->pb; - init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); - } s->vbv_ignore_qmax = 1; av_log(avctx, AV_LOG_VERBOSE, "reencoding frame due to VBV\n"); goto vbv_retry; @@ -3564,7 +3549,7 @@ static void set_frame_distances(MpegEncContext * s){ } } -static int encode_picture(MpegEncContext *s) +static int encode_picture(MpegEncContext *s, const AVPacket *pkt) { int i, ret; int bits; @@ -3616,12 +3601,23 @@ static int encode_picture(MpegEncContext *s) return -1; s->mb_intra=0; //for the rate distortion & bit compare functions - for(i=1; ithread_context[i]; - ret = ff_update_duplicate_context(slice, s); - if (ret < 0) - return ret; + uint8_t *start, *end; + int h; + + if (i) { + ret = ff_update_duplicate_context(slice, s); + if (ret < 0) + return ret; + } slice->me.temp = slice->me.scratchpad = slice->sc.scratchpad_buf; + + h = s->mb_height; + start = pkt->data + (size_t)(((int64_t) pkt->size) * slice->start_mb_y / h); + end = pkt->data + (size_t)(((int64_t) pkt->size) * slice-> end_mb_y / h); + + init_put_bits(&s->thread_context[i]->pb, start, end - start); } /* Estimate motion for every MB */ From patchwork Sat May 11 20:51:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48783 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300134pzb; Sat, 11 May 2024 14:00:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVncBTVWRFBKu4ZznYFRlg3RCIKrfE91Sr7gN8xHjW8IcnTgv5zuk71WXdbNvZP0WxuHcnr9LbVByRSxraKD6U265GV2qRRWZ3NOg== X-Google-Smtp-Source: AGHT+IEtxr9uj4AhXvyaVfCijUsi7K5WmVighi/CuBumQ+J9EP7cvAwsiyr3T+KuB45m05SQXuS9 X-Received: by 2002:a50:d50f:0:b0:573:1e9e:2d71 with SMTP id 4fb4d7f45d1cf-5734d70885bmr5309868a12.19.1715461250664; Sat, 11 May 2024 14:00:50 -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 4fb4d7f45d1cf-5733c37930fsi3309254a12.692.2024.05.11.14.00.50; Sat, 11 May 2024 14:00:50 -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=qQf917jo; 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 E1F4F68D7F7; Sat, 11 May 2024 23:55:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2031.outbound.protection.outlook.com [40.92.90.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 409CF68D814 for ; Sat, 11 May 2024 23:55:51 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CH7oTBEhY1SSos/5S9Cc2rqIMpO/lq3nu5cYys/+FimVopXrqTwSY5Gwf2ul7Ya2Z3UsBi57rEa3NB7TphrsMy+D6pjDEsMdwQCMoXhSis2/km3ZEDbBbLDqa3i8lSPI94d5866cD7e0GisvNQwjL//no9A8U4e/0pNL0qH841Arou+/3PIiDGMzb3FNVbju6u0OHoAXUr548LfygtermZSkP1ZwoMZA4VrhpCPbboPkLa3YPrXqrI1D25eYcFOMV0SKIXFAwAMRgncKVLMHKwrlMHhBOwvG3lGv0MN7nfQjVdndtUotaye0Aszb0no/Lqmlc3h2hRt5HfCy6yfjlA== 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=Dc6exQBxRhyoVQL8zrAtkZSzEJ+Lpj7P4uUPWAURAKw=; b=UPl0LYNArMAHDSuK/4P8IqnYA1yrVaSBGU/IjVuMXpYi8gGje11CuDlLM6IlbWQkNST+B8YWj1AN2/vXq8+AMnk/Ewfbpf2ZEALM//sBpQ1WP0z1c2TlkYoLyBaOFUJYvGQDXZzZhiqsTcCisVN3suo6bj6D2SD1jRDTblySAJ9tQYa2MwyXGaYTHhn3s1XPQMlmq+xtnUELKZ0Djo9iDYBNkTyXJVBp/nryRRbk+bs/lSpVaCxVbpUzsOb01A8UZo/jy6xAstjQ0uiwWJBb5CQ4faADLtHZQbAB2E78BbFZjJQ6PRwG9Pru7xLL6bZ4FySuMLEVXV9EIwqPOsxEwg== 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=Dc6exQBxRhyoVQL8zrAtkZSzEJ+Lpj7P4uUPWAURAKw=; b=qQf917jo4GI7aO7Woh4HHh68mlXNfihcU6rWEKHv5m9aZL5nOmSfA8FZ5IjPraddoqKHwCtvwy5xrOcT55eyBEz4zN/SRUR65hvZl+OAqPTf9ebpnpLfJ6TEyY7ah8PeznjYkSaGrlZxui6KvhrwUnPEjU5dpWRV5ss4L4mNQD9CVHjYxuEdCZBMoVTx/igNFoYhk+1rhUdU/S+BRs9hNpHsCFVlNgX5R+3adpPyKKUp4ovibpL7bAR8YrzfbMlus+NB46ty4WaiF9Lg2oi51hzgg+P/iBVjf/3A+muAi8VjkV2NM0INi2AK7U0St8Ddxf0prdgv4X4WVLPku2nw3A== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:49 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:26 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [cmdmjWMJXEQwj1lQjV0RN4PFC3iqgb9YVsbyDXKSNR0=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-61-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ec381ca-6e68-4142-0657-08dc71fcbcd1 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: WmgifnP2LxBFMDrpA2kNwz4x89ZxdvWpLFb5dgVGobEEvEsYyqrhdrvAJcW5Pzfmb9eXAtcNCbra3HyZyuiSXP7in1cg/Mo1WcffoodFxCGTQDcxBmP9E+oLBdeIM8/4aTaWufnGTuIl31YAMkEUVY/J+YYI4MOK3JSH6GJ5vWuFwZ8NC6FdRcp72HXxM4HhkrxBheGW2WN+RbjYA5JvFgZS1XOHBgX7gOuAO/zMBDJopAYkXgvKjaPfeJf4Ld0jMA8LVd/wNk6fi9qttBve1js91lFTL7Krb+GlpTlVicx/cyTs2Kg4I9ivZhU7IEWdxpqasP8iifqga/NQv3Bg0E4TPXi+GbYG93xYsAWPv7rEivVLRIabkjdYILeimwBGI+z7SbvAB2btek6aOamNQVoFUM2tjaCnMwXXonfmTlfxtN/Jg+ej0c1XXN6K0S7wA1eB4maqH16/8YcwQEExjXvUk9aAdHys2h4uzEYbDAtpIc6/TrC/RLr6k5i+cNEEREn0wa1olJBDFJ5nIrTtP4L8uURAS1gS4imjFCHJD0f8Uybjf7Z36dFQ4BSJBWh22GZGY9a+JLdnMGahivRF0FfHW5EWwgcCwRVNLqanjnR0R5FGTLHpwvdScNgWw6Hw X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6WZDHH702CVcAxr7nwXNrTRYV3Eo8UT1EcAypjH0MbDN2xQHDH99X4IPZZwqQRA8dVOZ7LCpbZZsm48gEDYQExaZZ7ZgrRvPAgs9o8fqWPc2X1+Ybp0uc+b7Hyl2Fy1RWN/BsxROUHUCA3c+pXjd6TvmRH0ARAQunOZ4UidwGKb4lp+C50XiBKx2EBFk+jhOveHLIuXD6lXUJq6EXekJinnFFIv8lWxvUhYfAzUJxq/2nBHc1Wl3yFE4htOIsi8GsiQli+qrluFysSVH0v0k3Hi1HHckNs7xadiqeucJ9wK84HMh8pgKpOxauEIV32ODHE+INPlNfjKKk5de90hZoJGgZdNY8y7veSNESo8zNFYkiqsZUHAThc0V/oTS6iyzCK69KABj+7tB+G2iLDx3q81mJ08oQ475evfl4DKRUlkyWBwhmGwMqhJKZILIV+MVsUX1diverNFiY6G1fy0xsbStLW5RIUFrWgGS/hMZG3uR4OWTyzBWV4MRnqIHi6j4ZxY/Do8YOsLaNT1Z3RdYaJzFvD3l1Zm+NY63h1Si0EQEzvahI440tYj1IJV0vWP9k/rfhn5ig9q9tITsk/xJy4UZu9V10RZ7IDUStzVKmpgy40kz3msg8jJui29y1dzBOQXLyKM+9QIxk7MHieQZxmm545G0r2VZPHrlv/ZK+gbLT+J4LxB7XEmAbwV2qdL40bQfa/9VarVPVMlMuMTfZMReZxiHZFc/WkDtkVXaITp8ZSpb5KhqUPVlxA1MU62d9yAGVVGtfb6jsBgqhnUYYWE3c/xVZMsepAzk/rR1VnfjxbnFKByEyFm/rFCXNr68jM877MEU7K4i0dIui15T7l8Ec54aG0LdD7Bhoi7Wl0eFqIdfHD8z6cuyUl5GvZxcO9oATi1r5F5MpP/2cgpZZwgzEj/ZtNPe4v1CRIaKXsLzO+nmsaAUPnx0O1RAO4GIxIjUdhdck44IfCNgNZ73XRFeFETN7zLfhkVNgCIIo1iivENIJPChbhCoSVBcxThEZVkDx6cSudoDOOHhVX0bQe/AhvnuyGB3gk8fMEiI4MPHDcdkEGDEVvOBbwDDFdFu4PQUEaCOcMouVj6aXyClg6W/PAIxAqYe6xrwHnb1ikiZyyTCgNThTjXN44mZXoRIfedxxETlKs5Qpyv/471dc2O0KvuBqf6A3ciLD/8FSMpB002W07aVR3XO63LruqqKRCnKpmoZQvyTE30hAO4IDic08TpQLR/DDXGyGikaNUlL/fE3otFxzTD8pgQkS1bWYmN32SQy2J0YRePWmxplmQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ec381ca-6e68-4142-0657-08dc71fcbcd1 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:49.6875 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 62/71] avcodec/mpeg12enc: Simplify writing startcodes 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: Fl2HOa/3oL4v Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 304cfb9046..ba56f0c37a 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -271,11 +271,10 @@ static av_cold int encode_init(AVCodecContext *avctx) return 0; } -static void put_header(MpegEncContext *s, int header) +static void put_header(MpegEncContext *s, uint32_t header) { align_put_bits(&s->pb); - put_bits(&s->pb, 16, header >> 16); - put_sbits(&s->pb, 16, header); + put_bits32(&s->pb, header); } /* put sequence header if needed */ From patchwork Sat May 11 20:51:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48784 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300205pzb; Sat, 11 May 2024 14:01:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUCVs9cZI1+cNDxqtB1M7G+6DWMv46wPIud1fFae5LE0xYa8nOOa9WN4bDGMDwypj95W6byLCoVKxrCPryt7kIyFoauB8Chc8LlFQ== X-Google-Smtp-Source: AGHT+IEBkphsRV+LiuxYCXAI9QrACFh0OyI53AucSgGxQFCkeDAiCsOkuSsJabQqV2qYqTtCIliD X-Received: by 2002:a2e:a683:0:b0:2d4:2b05:a671 with SMTP id 38308e7fff4ca-2e52038a94cmr33223931fa.32.1715461260234; Sat, 11 May 2024 14:01:00 -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 38308e7fff4ca-2e569205dc3si6586061fa.450.2024.05.11.14.00.59; Sat, 11 May 2024 14:01: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=SPbwxGzc; 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 2229E68D7E8; Sat, 11 May 2024 23:55:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2090.outbound.protection.outlook.com [40.92.90.90]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD57868D7E8 for ; Sat, 11 May 2024 23:55:55 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MiZQueQfEvNttYMbQ2mqL+nBPv1aNDPS0i4hdvA162bsqVF2NxW3OI+l628lxVleoaT5GdVx5W5bJKqUIRYnaP6m3rv3RfrBz66tGsbpukJhpOAKxBnCNwVG7Wkx1bQs9P1jQDGcPILkyrXtVGEErpFzprRRLm7AwobntEpScukBfN8JPgHvmVMdTNWXRefVcc/EnTxn9C1LxpfWD0bvMOuGkQQ4M2LGlt+2yOTO4vFXjmwNQplWQeTOlajJv+7rMZ97da02gONCVyHPiK/3N0VR/H2iCpyn3H5t7/WhG3TPMWlhnaMXbxapbKhlPiKAGctrjy/HXT+cj5h2Ejm0XQ== 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=ibnchw65lmN3hFVAROeyoHd2gNbwJTiIesRZMgm0oF8=; b=F+XqmJJSuphCPoQqwD+PhvgkgrJyb0LyOlsYEMv9Yfw00c0UcEw2CZtwbfEQgSnm3RyVangbbGDdBGja/nhIqDaAawBhnLlZ/nZiDtp0o4bOWBU6mg8UyYCxuc8lYkj4bWmPJkEpfvkhtmgmvdhqvQ/CfB7y1NgII8xSFJoc/eg/yv2dYahgzzbwbKaT+L/T4VdvWL08rKAuNTtKjgH7ON5on3K1UyRgX96Wh2FHO/YGO0WAD7GNVCQRxtuhCdzO133MLB3pGLA7BlOk3f/AI9oGB/FZisPyJVS/K0IHaF/l59qSQwIIyC5ukgA0r9+/UlUXblil+pyse2Nw7bzRuA== 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=ibnchw65lmN3hFVAROeyoHd2gNbwJTiIesRZMgm0oF8=; b=SPbwxGzc6pPYP+/EmhCL02dOrNkIzYjxMS3N0D2v/xBpHH4+MMT5tuTh0bs6F1Kqihvo8+V50OHyCZ1y528RRgPTPgOLCKoJFIJFWGmI5hrZ1Tc8m0AKNyjSMy9Qf602PbP7/l1xfl/0T70oLJ5FOrbMcvHqSF0/90FmR7ym4CtDs3e6lbdACMUlay0dlvZ+CGfPQGFz475KlOZ0H7d2DOX/85aUmJyyNYm7lXMEAUpD9jt5XVPjH5gxEAckutOmeh7neBdV2XyRpyb7DrPgy7h00SQjUd72VTkha5otPIbzeonYW/QoFZkbey5gdnHrnK7iWjlu+cIdNnSPdG5J3Q== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:54 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:27 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [wUIIDRvxDRARQ95cgk5Y7mjlq1Qj9F5uXENapfY4+5Y=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-62-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: e6d8c651-9c09-4996-2d80-08dc71fcbf80 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: rrKM3v+WSF88LW65Pi9yWVTsQ1EIwCuo/TUP+KXIIzjfAEscg13k3D4O22o02uTgocOSdQm2WFuNw7zeGwjGbls40KfTwpa17jPntujNr7pQign+AEs/oU39iNMRQnMLngi3oGWyKZkW3e2gbrO1SGzQeWituJrJYJ9uSO7HJXkRpNQ9HjNbJHnCZuD3OnNRYPVpDCUbx4cT96DStxTnQpvSmHQlQ3ClZ42frKg2Zfny1vdWFjeID2IQsXhoz8rQjpXCIjJxH8wdMUu5hKco7xXCk3T92umdVW28V/1OdmZc0z9+gjX5V5+ViEu3akWIeNXIw88tpOw0TbfoG5+Hnd6ijbfq345t8exEu9xpv7lzVLDYxHEHfPKMwKDKDARI8xx/Y9OLtBA+M3mHBUZ3v5eMRh0b+bCxtbqZtA2cdzxgYe9RdZPfM3JgmbIbtL+IXnTIrwQPPVQbn2V77upXpziRdyQbWnt9FC1bjlOdQwfLaIM6ktTpVpHtRZQmSTQ/3phIiOC00xJTSYAa8jOgETNQoOpRi/R2TRvXxGFJzrWPqhrxDjqjiVlQ/ib3TXDEoXzfuF6t7auL53NG0HV2Amba4E5jsjIbvMfzVOrS2Q/8OAFljYFqZiWa4XTliSj5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UGpWan0thlAHpsWSbWnsGeJ2hW6nddsM3Q/H7DetV5F7OvleUwIQNByqx1bxRtdZj89phP8hX0O56/2od2lEjLy0WEINk0KnE4Fc+xRcEOYo/G0QdLTW3GV56697SS4stsbM9+/ZSj/YKZUCa6jyuCu8J2+a2zjzhhEN5eQs1mv1fS3/d0I9hM35GyMqIMG8y0MeMILxwO00VgRH54GEDTlYXs5lUGfmB8lBgQQn/NacaKi4KGB3krbkwpbJgE2kvrmVpaa9Z99YLnGXqi3lslQpTZQEMiD6GCEYDZF3O7G954T4qO2PAEJEUj7cPJw1MHIV9zoJU0onLKy9IpNXxUOykhV/nQqSWbmOG6T/jG9tFz9twVJOowhLvYRDH3EG/b9jnacBDljXxSbbcNx20LGHgxrQ+HWpjk7k3rOA86LhZfRordfrsNIRrr+iOuiAA8ZhpRcmL2hDUcEPSYJk8MYvJs5Q5gcdThRT1kQiDPAM3MrcBUAVdwk7QeZKY8Du4YNNSyJqgvustRwyaCB+h1NlDIFc9pE3L5JcKyyt0sMgtQsSuPC/1BZNHHMPk8PROJK6+bZSFd2MHyXj6xVUxfEmeUGEaVNykOi8wpN28kf/+EzrNb4xdUHqCIavA/Rxt0g6p8Okuocm1GKu63EiJTWYsJXbhfosWRvAq57Gws8zIcWUlEZE+w+WuV7QhYEo7au0zwsaoR5SCYKVxlehkbJy5SWS3tj1+lrORQkMwLqVWhKetMaq4l1EqSRqXmNoyVqQpsmbp8Glw4zKc6a7q2kXsGoMqjGSXHEDHDsi0r70C7ZW3GT8bRV3/nzViueARH6cCAxKTl95wDIRFKroUQZaJQJCZogaIgDJfPvWRpY8r9wLITKrO5e4wf12PtGTWPLNKBURsLNqbfEfrJ2jybbk3OY66OMjkXBT7ZOxFoIvYHmNk6ZAyjukFu4moEFi8Y9K+DCLszyhkT4VBpqC4YaGfGWjhOBKnwSzwC72+iNnGqLd5D1ipyeyUHCt4FCNfvYo/pMaWhNBmbv0eX5csz6pvEp6Ar+oSgM8Hk14hmRFObiiQdKRKqfucDuL9dAyBbofFCkNVOuak0hUGbu8ANlD5oRxFUmieP9DTWVljA886HZvLkJWZJc91iBGL+UG2lpgQPJo2h5y4YRG08m8u7Ot9bLc4Qic5rj05YBXCANubtBLDq8UrH7kiT9DVrObP0kWpV8tGaWSySW5/wOldPCqkK5iWu+IzgLbZ872Gsd69hl/6/eecNNuIyNHlNiLyrkW8gNwlyOHcPjiwyL0Rg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6d8c651-9c09-4996-2d80-08dc71fcbf80 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:54.3162 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 63/71] avcodec/mpegvideo_dec, rv34: Simplify check for "does pic exist?" 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: /vwT4jwPK19U The days in which an MPVPicture* is set with the corresponding frame being blank are over; this allows to simplify some checks. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 10 +++++----- libavcodec/rv34.c | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 9d2b7671e3..f840dc9ffc 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -312,9 +312,10 @@ int ff_mpv_alloc_dummy_frames(MpegEncContext *s) AVCodecContext *avctx = s->avctx; int ret; - if ((!s->last_pic.ptr || !s->last_pic.ptr->f->buf[0]) && - (s->pict_type != AV_PICTURE_TYPE_I)) { - if (s->pict_type == AV_PICTURE_TYPE_B && s->next_pic.ptr && s->next_pic.ptr->f->buf[0]) + av_assert1(!s->last_pic.ptr || s->last_pic.ptr->f->buf[0]); + av_assert1(!s->next_pic.ptr || s->next_pic.ptr->f->buf[0]); + if (!s->last_pic.ptr && s->pict_type != AV_PICTURE_TYPE_I) { + if (s->pict_type == AV_PICTURE_TYPE_B && s->next_pic.ptr) av_log(avctx, AV_LOG_DEBUG, "allocating dummy last picture for B frame\n"); else if (s->codec_id != AV_CODEC_ID_H261 /* H.261 has no keyframes */ && @@ -332,8 +333,7 @@ int ff_mpv_alloc_dummy_frames(MpegEncContext *s) color_frame(s->last_pic.ptr->f, luma_val); } } - if ((!s->next_pic.ptr || !s->next_pic.ptr->f->buf[0]) && - s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->next_pic.ptr && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ ret = alloc_dummy_frame(s, &s->next_pic); if (ret < 0) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index d3816df059..f667023266 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1655,8 +1655,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); return AVERROR_INVALIDDATA; } - if ((!s->last_pic.ptr || !s->last_pic.ptr->f->data[0]) && - si.type == AV_PICTURE_TYPE_B) { + if (!s->last_pic.ptr && si.type == AV_PICTURE_TYPE_B) { av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference data.\n"); faulty_b = 1; From patchwork Sat May 11 20:51:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48776 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300266pzb; Sat, 11 May 2024 14:01:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUrP9KKqTXSTBQVVh4QcHYpRt38SZSDvLYPvjBfhAdOg6pNqpPWjSD6+F9asO6dVPbM/8M743CM7waOPi5E9aYu1nwZZaGQPg7vqQ== X-Google-Smtp-Source: AGHT+IH11nbn1/kbdH1fI+BoewSHM2hbKnDUpS6CyAnDQqb7slZIETUEmqOEpPmrYvpov9gEsL0m X-Received: by 2002:a17:906:da8d:b0:a5a:7a1:5da3 with SMTP id a640c23a62f3a-a5a2d09e4b4mr591245466b.0.1715461268292; Sat, 11 May 2024 14:01:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17946443si333114066b.148.2024.05.11.14.01.07; Sat, 11 May 2024 14:01:08 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=XLhmtWeL; 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 7C00068D833; Sat, 11 May 2024 23:56:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2104.outbound.protection.outlook.com [40.92.90.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 55B7A68D827 for ; Sat, 11 May 2024 23:56:00 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iZcbAJffZm0cSAX5IYNWIoEYVWxPsKvmHFluP1gsYVJPttwxAm0IFRxGcYckYhQrFXUa9wp7fJRdl1i0GSVjmJ9WTYMzRKgVy2cmCZa2hL9Q5SRMl6KpNEQDm5VBd7RKd1I49MCPnpeX7i8XP29Fa7lXGXuoBS2b18a5ugPN+6bFQKjnD2IzO2CJIRp2U3n7nYZ+XveimxXaSYmZJBVQEg1oCJ+9ebGDPaeGD9tcpb3dqDAq9ylht7+sDSqOEdyLmwTlkMSgikxxC++oMo1w9ZTs0MLtxgAPDrWuGrRiWqUM9SeFAUCzHkQymvk84cvLnZR8CdVUaLRXWyVBMEfQzg== 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=/+qBN5ra/56BGcDMsiG2oJKR+/UxNu7IOsWniDnWO98=; b=TyPRwZosgfjbHpGVcJMnar/f3+ltxggN7lCcKHSoKKjalU1RJRHjybYWiEuMOwPGxfqwt/wHqnhDTsA51wmo08i8jG+XHl+NP+9BqWAEb6ZTuDZ7ZtGMhy0LtWdYMkhGeZPwM1/eECJMNkbc/3APOluX295qAEO6N36liGB1Dq+bi6wvo+eFxhbhVa6ryn2e3YI7qe7W3cXgEkN5b/9IOsNxdmfxhyoGJYw8D8uT5gLjVZBZl8HY8K467IjJQ3jkbWSZpi4gzWgvtU7BFxTwiRDleU5yVwGgM6NViTi9P9QJk50Lmc4JPJEDPER94kU94R3IlCmu3LgqQVOofjXSGA== 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=/+qBN5ra/56BGcDMsiG2oJKR+/UxNu7IOsWniDnWO98=; b=XLhmtWeL7efB2JL/h5T4P26gjVXAIo2TfTWaIOvtnsl8W91sH+wB2MW3yopLLe9gzc0lgwXe6AUbzIIr7ae5ze2MA95tjMicPqDB7WkMmPRpMGpxzNPmCspq88QHT8JKP/UrEdos2rt5bXLX3j3NJIiInHgCB8T25BxXBUT1RnNUKrFA/XVGC5ubMXmQmvPColUnOnj5BwovKzVNO27KyVN6EYQR/rv8j4VhSYRIC6g8+P8tbxwyl23kH2HD4l3i20/UDQmLd/5ftabVmKhPyupbC7BMzyBk/NhNJWbWrof8Z+8DF/paR3mo69mtXwqUsTCyMBhvdLaJeRinpSAdsQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:55:58 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:55:58 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:28 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [2FEXDFcSTtvejyGuUXnifvtqQDGzvPOg2X91LWcRibY=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-63-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 8781a2c8-aef4-43aa-6b0a-08dc71fcc246 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: TxcpMKaNupMe1ScMCXpMVZmdykEIX0d5Kwop6Nl5SOFhiFnoZVYOStfWaLDfmjGKfdqGf+sPthMvizwn+5bKH3211T4ctH/56DtlFji/SUZhM6lWy9V6yU5gHfXKYruyUDTdlqpOCdsDkSyb+YXsXbry/12ULMNn8RD2wSFAp6WRzwfRD5jPamumnrV6UCn9S55EBPvjazFtvfdn1t1Yz9+aVbFnko8e/xs0l5f2WgtaRT6WggF27jQUd233l1stli7tYx3+ZFdqWGBxpWcn0PT0jOoBiH2PquvnwVtKfQwuvzuGOI9Uqe5NImGwBpIuT14Mrh77xAw7i8RojTlloj+GYxdOgnpaWnwieNHcejACEcuYuJunb7aMIb+LvXzDlkkpOvKADRyLIbnFBvq1SQh/VqC9g+nMwcaOyuaKw2Xl6u0JadnQhHDCjCEjEjQG5LEJAW0OBgGU6qbC50juU+SW3LJSHp701/qvgSLrJfiHyI3K0z3mJBrMsj/ypy4PnKhDt5ufqkzfPTQ94tV09MmwaOm4XFYISIa6Slo610e4tB7eLBZbr4u+qwL9hJ+cYyAi32e+fQkGh/TA0Vm7v7PR0H7p9fmhA+EmTuRhAVMI8pjNwzPZa+/u01s9jHSD X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7RFmMkerqSCTpOz95TyrxcD4oRsbkatnRtIYR/5+Fl+eEeS/Ztqm2xENx/sc4tDzvBbsachLwC0JFquJuxNtiuL9U/RCxS+/sPWyqlYvng7MWSNlppfA6/CSU+v5IwWT4wTabT75UtF31wLoMCyvO9cr4sjHDeHcHuvZzAH3wN4qCqMt+X3hxw5tpbC9JHRhGfNS7iWMqlv0uLAh3GI3yBwhovCkQFVyybX9hcgMIlNnK6H1jRHppiG8BUzKRgyYfAvNh+Vn26bDAzkO+TEjWNhXOdZlgwpCU5J0juDfRnwD11YWE8WDbvFkUAK4R6Mx/6R7uCf3GrFTRdXjZoO/BAGJdwzOgzePuKjRz7KGrRWqpQm609YkEtyHpWH7V9NifAMLE+fxlb100MjH3Ve6fjOsSKI54TxCAQoMLOgVc8r9pduYo8CjFni2W4/DasHiEy/1ZXKvdCwj4EYAsNQp83yNA2MExFcmpOOAsV9alX9EdL/QL6BxqyupYmv6tjyrxgWd6aHXfFeSQ/omD2eu/rtEcN1K/rNtC5i517WAd2gO0M0athPgwju/I05fEeSReQCbSS0jmsIEzAmksAy9Hrhj1e47j6ZMZU/5WU2oWgz052RDISZ8xrLaYlDyEveWxpDSCHDoMSSRQGv5XkWoGFi5PtI6nV1Tyj0nzTALqq1zENPNnZ9C0nU8Xkx3vD0AQ+zM9iFH3A0Fvq5DvG4SewfsujwYxTFgaz63FI9ApEmLqRk5dMxu/U+jF+W/F3HZG+IpbNrDiS3C0/AW+SNWgZFmfTsQCDcGPUa0SIiqUDC4a4tNr3rvnZKZy2P6pPxiztqzfl5rTOCpw+0f336e1v8Fd9OrMbLMnPf501XdFaGYnGF1Bc+wo33hsZ9deunREisO0pb6Q3HWQ7t8ImWtvcdmXQoB9O/Gf+EKIj8yu3VZYjeH4pWpTMluJ7IC9rfV8OBLxbQgon3LtmCMonkLAvAwI0MzJBqdnObcgfU0+6F0vzyOiPnt6AFocBKEVG6ZuLxjSStJHlNZoKyJrl5pHxsNdqr5MYUq6gJG3CKNBWHfe2UALFLpnubnm4KdW09GX0WAHesh3cCVTESkAd1z0jueQ/m0L+AZ9Se5w09fOU/vlKqpr+TV4HQpTYkX16oIRzISys/PhiAKJshl2in+xhASHgYTy/BTuKgfx2E8/IOD1irpYzJMR+etubvvap08oIm2OPl5Rtl1HfmtLVp6CDjmdAkDpuq156YZrYDOGqUmxb1yV10wVFHVki1T/gUhmLGO86SP0NZSCxUOAkSrDA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8781a2c8-aef4-43aa-6b0a-08dc71fcc246 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:55:58.7921 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 64/71] avcodec/mpegvideo_dec: Don't sync encoder-only coded_picture_number 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: 2kQDZgcVvcLz Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 1 - libavcodec/mpegvideo_dec.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 93df8a315d..8a8ff2fbd9 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -520,7 +520,6 @@ void ff_mpv_common_defaults(MpegEncContext *s) s->progressive_sequence = 1; s->picture_structure = PICT_FRAME; - s->coded_picture_number = 0; s->picture_number = 0; s->f_code = 1; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index f840dc9ffc..0a50cfac5b 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -114,7 +114,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, s->quarter_sample = s1->quarter_sample; - s->coded_picture_number = s1->coded_picture_number; s->picture_number = s1->picture_number; ff_mpv_replace_picture(&s->cur_pic, &s1->cur_pic); From patchwork Sat May 11 20:51:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48777 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300328pzb; Sat, 11 May 2024 14:01:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVoH27vDA9ZhdcMX9BKprYKiCauzSURj8veq10rEABS0X8WgjJBuh9GdwGrdwX6VDSQ/rfb8YD0UFMoFqfHzY874wnVZNec+qeZ2A== X-Google-Smtp-Source: AGHT+IG57rltWZdXpCEwTvlpJFqzdRhG0ssSHwLqmQINMrB1ZLQB4h8y5h6lP7guPBmuwWHRzzPE X-Received: by 2002:a17:906:1992:b0:a59:b359:3e14 with SMTP id a640c23a62f3a-a5a2d5356d3mr401261366b.10.1715461276518; Sat, 11 May 2024 14:01:16 -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 a640c23a62f3a-a5a17c2c830si315747766b.971.2024.05.11.14.01.16; Sat, 11 May 2024 14:01:16 -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=N8RMlmOR; 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 8F63368D834; Sat, 11 May 2024 23:56:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2011.outbound.protection.outlook.com [40.92.90.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 57B8D68D835 for ; Sat, 11 May 2024 23:56:02 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UVfsy9acxScVY4m2z5CjLuaoZaKlzfrsT1SaQqK4yfCA/TfdIobx/BI687Isseov9GnMw2ESTYp5yhk1Zz0uq3SQA3Z49+HbkmkGVK43R1/AgfM3a/UdB0FnMr/ZUbbXbe3CLS4Wh5AqAr8Hbg0JipYiGHIFd7CFh5/380chy1JlFMWc+kr2y22r3RNQAyGUpX6hPfDUYTGw5vA0olHzXudZMbt5oL4ggRW0xzlG2XjpI/gkQhjJbzIkhjW0A7FqOvTuTMC4wq5vSqxZBhcsdFxWjgP4/yIyYzZDPektRbu28unvHKdBHMy83auLmOuJnVMJEB3cTFoPtfZiG0+HoA== 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=YEnensl/ZX8Dl2y7vsKnPGU3f+BVqGEMoIgjql0xz+A=; b=cypwJu5lEtz2K8A3cpd5Vp5erYme2/eNcUAdedqVX+BsKoSJUrVbGhRAsvSh4WOSPozhu3jqFAXEIyQyyl9hU+V4E1HU0FFTxPWeltsXrNzaCPILuAldg/42t1T9b/WBJINGj/B3da3soQrPrjltlWjE7iLimN3qektyGFreL7AeioisyZfQijv1SxrRt6tNT2lh/Lf0nyZEUz+/uxb15lQnEEvih0x+3NpuNfUuSQHHyznoC37hQyVWQ3NJlxuDUce5rI/mHgK5yp1z75i4sfs4rZvJPFCqHx5F6eNkShdF3tgWmlynlJjAktDhGdhoqPyOSTq8yQwz5vXIchEqmw== 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=YEnensl/ZX8Dl2y7vsKnPGU3f+BVqGEMoIgjql0xz+A=; b=N8RMlmORXfVBeriIYt1moh+TsDjIxfZWoimjnWK0SWVexZMtGRm61YFyTQw9qSvvmB7F7UCyd9cAm8tb+cW7MAlrFCo6i8LX20FBrdHlj2cWeWsefYKL7tPcdkMapWuqf+hYiZQIvi+QabYXNi/HyS01rXUyX+evI3aNX+/tHEEMDhQEDC5awa6mZRzKfgD3tgP/bU9vJXO3L3/buxB4rYVIdBjAY1m+QNg59e/IpKrcBBZ+XE4NW+CrfzExFiQlCcnKMTXXwUhIGFMJ0NK7cMcVQ+uX/OhZxEfO32uayi9ZxrxpQk4A6CNwAK9SQJcwsxB1OrnYrKZQUPm084YtTg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:00 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:00 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:29 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [x7EOUWpOZ2xJAgq9O1XTnTcvfOQ9KjGznhlm7a3zoOI=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-64-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b04f690-16ef-4fe9-5a65-08dc71fcc372 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: AhX8+VExKUkSEU1CBg+v6udKVFGn0wfh8yqjrUavEasT6G9bPkm6u90oRN33YepeWGNVK/CFAq5THlHzG52XPbYfmtu4FunForer97kw23qz1q/Gppa9kAu8Vqm/tAQ+RJjtFS/5kM/cB8P+0G+xnGzgdEoXvxiC756XPeigaqD8064ComFNeZNweiCHoANO0Oa7H/m6ZRepjZU5unFQrNN90uMoDZeSgKCXR5Hwz4eGx4aDkWgkU+GVK3RmY+TVmgW16Qz89fqtEaVE0j+D8J4s8Ng0WonLkTzukdHNkOMUSG0+toimg7SoBveDCTP01HND/Z9MGRaySzpYVtWSKDrmuAJOYlw8lZ7n836CRJRoKkjl0TpjHK1LavYvidOXu3NEJzaIs4L3Pnumsvt0wAHlSa2AkDsHl/E9azBJB4yGbfm2/tju+Yu/Av2kEkAa/dR3gcNmCNvnWVNtym7mjqdavHRD4YG2EOuwqXk0tdwpovIX3mqGQeU5Cv4q8de4U74bY6okX+aHul2RfZzd6r3WNJtwDJEwH3EM19oTFRhjItzHhqbSBhSoiQorSho3q4mnWu02kUwSqTPwNVdIEe2QPoZz9wb8Lw/Z6jcoCCxnYBGofJmpbrLp+NUcgd4s X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6UCfL4JWbgj23wu02lzZFi6abVjxm5ELyDawV4fVD5pYDsJBLD+xCTANTIDiXaWqgIrQYRj2bsKhbnKtAbHsXWtEe7KKuiizRFrLZ2i3IvBABYoA3z4HKBbQpB3qJMybaf7EU20qF1j1yquD27cBFZWIsD/p0fPQOqCyBDpo4uPmwVWd4y1jUBVVfpHXKO3kPNTmKUL0/+qntXnCW8Je10mqPFtnGmukeM/2ZCovCm3iQYw8EOLYg+E0O4KGcfxYFiQC//xDHCG3v7/FLpqtmmwjCnmcMQgkEFcGWKqaj1FkhToXkyfkoqG81NZHEOVHTihCz/KQHwYbTFTfQZR0dbBDBMx9zkiZGIeAgrQYfyeXbO5HyLOJHMOXepYR0ZQktBE9w5oCuCUoJvsOnAXKAZuzD5Df8DOSwWZcxhKSDNler/LZFMHy02gN1gaShZK+u42yvW0nXoIZ0MdveGfe6aB/a0H6T7RlLnK2pyfUwzSAGx05NruoN0lKps9EeD5lyXI+U8foeiz1Vruf6DrlXdk7FJdBRZPFRfd3Bze98JDqdjDvib0m6kiTJYd4Dv3Fnyj8Me0YsFGGtEnN4Kdx7lyF8ICpaLPdE5HbFYte595iaoACpGg7fsjbGiJaNEPnO3F1eyuWoLIUuFFxqm2SBGE+dIua/6g4foXCQJGMMfygo1FLdpaLp9N+xA5Qq6Y58kdmnjtD7wusVOOn1RfZJ1OYEcHASQeCpxgpLV7qn6boJgWCCJnKCnJKpPgqI8VIBSwzssLMgTeXb1baM96y7iy5Ku1MPjRdMQXvQKbgS4THjL7sSOcjRkynmIuGQKnm1yZzY5D3yiV+Ka6piqt90ePOyDCKMNSZ+q767YMKL1xLXf8ZLxNkz9o1k0+NA8AFAKGsU+IUcFnyGxastux+hkxoVSQHEw25eFkgAwyln7jGD15kxrstNvRb5Q3dsm4XeVd1y6/2tTvqYqN/kRxOC0GdxBxzcKBamLue+IJ2+cDw5iERAGNxZaQIS2+L6Vmw85VG9SgexaxtO4RC/sJUC+APn6S+FWRcrfHLJNST6CVY1qlHxjOGikGwo7jHlNxipkabtHy2ULDBkkM46zyXQh77V3GX7yUpRn+D+fjo19RaqxibWa84v3QC5MmFzUPNYQExZCEvB2moYn9b+cz7baf+5p0pck5vVCDOoj/Lst2TU86D93xFB3PMZC9ZnEPEJdwVPby/K3u/Dy4YIo7xIyc0jrMKTEVymLQns+rt1B9wOtf7Q7khRZq4Q79LyOEZ/zFx3KcWBBaqbG2T+CYFsg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b04f690-16ef-4fe9-5a65-08dc71fcc372 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:00.7631 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 65/71] avcodec/mpeg12dec: Pass Mpeg1Context* in mpeg_field_start() 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: kUCWOhbn6o0n Avoids a cast. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 0d5540fd2f..52f98986f6 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1278,10 +1278,10 @@ static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1) return 0; } -static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) +static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) { + MpegEncContext *s = &s1->mpeg_enc_ctx; AVCodecContext *avctx = s->avctx; - Mpeg1Context *s1 = (Mpeg1Context *) s; int ret; if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { @@ -2460,7 +2460,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, if (s->first_slice) { skip_frame = 0; s->first_slice = 0; - if ((ret = mpeg_field_start(s2, buf, buf_size)) < 0) + if ((ret = mpeg_field_start(s, buf, buf_size)) < 0) return ret; } if (!s2->cur_pic.ptr) { From patchwork Sat May 11 20:51:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48785 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300383pzb; Sat, 11 May 2024 14:01:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9RtBdxgCf7xFlTFIkvMJrc7NRfuaS2UV59bladLi9QJ/WhDBDc9dDt8AQFO2F6ynZYl8J/lX7retQMqooe8XoWaGmZY33MWe5WA== X-Google-Smtp-Source: AGHT+IGO/NblmSV4/05wFDFeYU3GH+k3vR+5HU5OmeFjstKYUjbw9Y9bRj6ehmzHvZX1SCCuTOjs X-Received: by 2002:a50:d482:0:b0:56e:2b80:d87e with SMTP id 4fb4d7f45d1cf-5734d597b89mr5934741a12.2.1715461284762; Sat, 11 May 2024 14:01:24 -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 4fb4d7f45d1cf-5733beacde2si3298228a12.139.2024.05.11.14.01.24; Sat, 11 May 2024 14:01:24 -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=HzDEXOqg; 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 AA6E468D7EB; Sat, 11 May 2024 23:56:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2040.outbound.protection.outlook.com [40.92.90.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26A4268D83E for ; Sat, 11 May 2024 23:56:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NXvk86qstMLZgjU35bGS2OudE5G0uOwFrjxWR+AGTYc2dE1aIo9SiP03DGWm6DNAUiNzrQpMrGLBE1QDeM1jAw5w4mdkchv+5UxdIOOQxnS9tbuN4SkcIFf768NeBM5j8A63H/0eF2LAqOvsLMdBNXkypISMTQj0JGFpanbfrPdmw9B7GesseMLmGhxYi3V3CnzTM1Zt04qpzcXPMs4VLwaq/wLS39Z8fMSEz6P88KgjG1omODwsmxJwtijn5Ti1g8N/cV0QwyGpQwIGtLzSOwx0d9ZrwnUXVdYsjqkXJVn4RzRHVKMTa1vpxOOmU6D+0tfAKQGMgd7dsYhI6/dbeA== 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=RlW1gxCee07aXann0RL5MVJPKN6BXCXWtvGEN6nLWqw=; b=KVR1HFF15hm05ugZXyzWq3W/SwFodC2wa1UmMHhpkAkvLRtyD2cWcVp+CQw1lh9eN8LB0gWozYmci37GynkUcRmlw5HyUP8+f0fe5VO1JyfZFX/jz+Ttrdp3SuIPsUg1HaPD777eS/9v5YSp07RDqY0kLT0HZgkLCAKn+I985Ici9rAfAVomCcBsxsUPyFb/05Ys7sFMblXVN9gaJp4JDV1YWOW6FHc3jMp4EQjkxpuCnT8tbV9cU68GJgfqtRmDEDULkvgHekJNqPWMBjajAq8Nc342NpTHP61+1FJW03TMeY1gTJ9dc0ioG33vD7axGdvvizoLIMv68VdFPlHguA== 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=RlW1gxCee07aXann0RL5MVJPKN6BXCXWtvGEN6nLWqw=; b=HzDEXOqgggOqm4DkJEJccSU2SOoe9nQaPsVKD8B3IcUD236grVOWEqB6H4vAK0B0Wgoy6WBuQooydoxjqVjRz6o986sGVV27w416C5DVkEsoUw3eZvmuVEhGpbjrRgKe4F/aKeC1ie2DMcLoB5EIwHg1foI11dON9SQgMjTdNZWvr259grCkvG4kCB66v/MUps9Nnf2W7t5k2PcFzJXJqshKUklSzUaHjszrfnP+HLKD8MPVlYjB+MPmbnZ3YkzWO0+WoFSRpigUlWcYOaNSkuKNtrqR2q7XbGWVgkqYacTwba0Zy8AKq4qNP4+oXezkgqBRn+uol72ipw90RU7yng== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:05 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:30 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [qIbzMnvyDMiUNwyP8LDDK5/clGe2vbT5gtIRst/Az9M=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-65-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 80ae76f4-9e56-4e2c-f4f4-08dc71fcc650 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: wvD46gXoxjk7Ma0xSM9acJEbO0Bsn76ByZ+XTS+buyrZ582njM2HQdJyN6onfQ06tlAjafXX3XggtNsgdfPp3mJSRt37E5KcuFcivHMT7Vo+/F0NDOAfrpWtxqTn1Jicz6gJGHfIx+DEbJh4InBHrHHuNtUTl32L5jxiRqVoG2WVt8s6l81yPIYfvNOLLrqIign442TgM2p3d8j+FQ1nUDe3CXA8zbYQhrChsOE9jZUEdDTXKx/Ycjl7Em38n2yRw249iXSRgAWDe9icPhsUsa1+1BvUnN1nUotYGW2ubtJ/4oRA7tpIY/luRvO2tFT1eKQ+Cn6B53wc6+/OP16la6/4wAVsGC03A108ub4tIzPG/EBoSjZd2RNyO7ze6pxkUWbOSzCLZkpSNHc/w/9wvHUq2B3EIeASA8j/z+Z55n1DsIXOzrJ2AuZFnopITvcs7nVwzLrbyoIhTArHqPdYXxaVOEtbjk9HuOIMjriqgKv2TnAFJTYMKsGINtuh08IHcy5uiEjzB4FSFgLUx0nePq3p6KDyDfgx/8WdJptWDqyR41BM2xUlZuh1Gs0lvt0bH7tm8yPm1jrCVrDj31QWuoDP+Rp+NFdP8VyDfDnDechX7vilfu5WCtbeQh+1h4ms X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nm1XoSZ5KpRkFP/+LmuQ+/hKSpQ6M9UK/7svoLtW1akH+i5ymrJhwl5lHGsNH3g48fAwVqigheJx1y1iPUun2X3hNjyASMm+1guqPnpDdK2gGIblyV1Fmph66r1rp3afjsp5SEZN7qKqg1IwpX9Rvf/8Q0tGWr+STag34FVAEFOGnlbreW+b/wP87Guf227srKCJ0oLcXz66MEjMgcrhFksg1xIJ2Lw5OJVPmsjjlPmYms4YLdiV7TIAuOLVhCU5IIfypqp5Y0UyRNRU4BdtxjJz/GCdTPHtwDf9DgJwZKPGljo8f30eA3i0/9rRe1EOSTGFk67TH5ODIKZGpBhajYOvE3RwwOefMUYI3Nicn6cZGQsZLOTKFuiQKBFAONPcUHzgWzWE1xizvokPTkx9I6Ul4li3UC83oPz+GWYgJbCGAbFJVoTEumnJtEpfexvfIeyiFYvN0Sz3o2Scv31WkPV9RP+0Iloi1rKyv8UNy1tT6RkQrEqbdhSkt8mIIVpCjCsGlRuTBpP7ksWV5J++okfY7U/rcDS8qXDXKT7PoOZiaHZAGvfgFxQI1xlF4CWCqIWDhLG+KHSQr6zK4/2nTw0wtA+Vi/tEPTa1jha6RSzb5NkEeLQKMtJiOzpli/zHPz992AIu6O05G7jI9E854f9oudGRRy5vRlkMQIyoKVoLb5jHeg+wgNAMFSTvDmwSPixu5mxJSDuz3Xzs+yfmSqK7th+1viDZJfiQKTEvyStrfxv+ZrfSb1mKL3jKPDREq80gkIddllk/gscxsjy6YRAhMZ1uxlw8HImODiwnQPpJ+vr8G4n0v2k56/SEPYexrNHXWt5189xRCdJ5fBIIMy+0JvcD9ma/6tvuEPbtuPXom6mseCjhJcEdsldFgDUMgDNbUa6UYAmTBIpqnqcKODjRETSnNG2kD+/24He201Wcd7LZjlSjoSN9sDsA7T6V9kCXtlqWNT4rI08TzwZkHirVbSPt6s9yF15dtEz0bmADURB1scHZgKXEytAL6GoIYoY4E4Ots8RrC3QOmrRKS+jpyMpLtE+/axr9wXHBp3OL6P4xtg5p4cVoRhmmNDDL/fmgHSne+9UuYBNBNDqHDWmfp1MZyAj5corH+Ou2O0K4+gHqw/rjEKARO7WDXuzIDj6L+SUao7e/eoCd8BsJ3LY10IPU8pfjF6ykPJ/W3PAmFPxqjuwuesDTSnXuhszV2cnCCjJZn5xsMDRdiKr7qocw6AWHTon6V1zYTA2nUaLQ6UiBqXX5TujPh8d9gR5lG8ATjD5503+hhdz9ludLPg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80ae76f4-9e56-4e2c-f4f4-08dc71fcc650 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:05.5182 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 66/71] avcodec/mpeg12dec: Don't initialize inter_scantable 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: JTDszvUvCIE/ MPEG-1/2 only needs one scantable and therefore all code already uses the intra one. So stop initializing the inter one altogether. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 52f98986f6..55e3a31e95 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1256,13 +1256,10 @@ static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1) s->chroma_420_type = get_bits1(&s->gb); s->progressive_frame = get_bits1(&s->gb); - if (s->alternate_scan) { - ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan); - ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); - } else { - ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct); - ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); - } + // We only initialize intra_scantable, as both scantables always coincide + // and all code therefore only uses the intra one. + ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, + s->alternate_scan ? ff_alternate_vertical_scan : ff_zigzag_direct); /* composite display not parsed */ ff_dlog(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision); From patchwork Sat May 11 20:51:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48786 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300429pzb; Sat, 11 May 2024 14:01:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJCKLOZ/+Ofy4KuQ0RQrEGbMYKkGs/66BFi1567Futn3h9XVKp+8Za6BP9zMwVCiJG4B+K/RlyxmiatCxdoeULakxVipSeLXFhfg== X-Google-Smtp-Source: AGHT+IErLUXCGPniKCQAdnqhrC7S7UYfbyF8HRZOdk8ha/TN1cB6z/IhCDWuUz7AuDTrgYX995GW X-Received: by 2002:a5d:628c:0:b0:34d:a7bc:e647 with SMTP id ffacd0b85a97d-3504aa63277mr5499175f8f.62.1715461293181; Sat, 11 May 2024 14:01:33 -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 a640c23a62f3a-a5a17c2be48si330984266b.924.2024.05.11.14.01.32; Sat, 11 May 2024 14:01:33 -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=mTJwBRM5; 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 62C5B68D82A; Sat, 11 May 2024 23:56:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2066.outbound.protection.outlook.com [40.92.90.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0204668D849 for ; Sat, 11 May 2024 23:56:35 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KqGDm2kVnEDdimw43hvd46A5eN4st9PcN74V+unBW9HcfaLAUuKAS7RTsJuk0UOGAToMObEUrjzwlUvH8OYib11hCKofgi8CXz63L8Z2rxg2o0jf/tnrZbcQ9ZIyc53exyLMyF4uaYvfpadvHI+V8Ld+ksnVQ7Z1D2ON5B40ypnI/oCq7S5Tv0UtyG3ZaDMBE9MNEm/c+2ZM26yMISTycaLF+mD0SwmTw6zL3MTujo0pg0b6tTa7fBhLgiGzztycp1d3poZamzfQDWYWbXBWBCuIyzn6lF5ev59+RqW2qV4eYzfNuas1K7CaGHPsD+uQx9x0KjVm3MRGqdyy1XcouA== 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=+YCOwgmVqD+fbh+PeE+5AlR0/kSW0z4Ay9oslWXFsu4=; b=U0aXEAZuehLZH+akwEap910/0rXEfaZMKrtQOFj61aWdKwPCRyu/KIzXs5ocdY/KXY4RyBk9Yhs+euk79KeWWhb5QmO2wwjK702QINktIRIAzmzHjBCnI2O0OScKBy11amFliaqBSakAA+IHwj/GnGRy0NsJV4ma66ssaVhB9x8vJGqKMN3s4ByFdtW3Kjut1KHH0mTGxULAYfNXIxiv1h8KcSCzV+VVNh/PzEYoy17q6diiCfmzhFWhT0Xh8H4lOcZNRK+RqCNseY6WUmkMh9iHir2YK2fenOPRyjQmYAJkBneus/k4uJBlUn+pTm9fqOaxYoBUTy+FteqfLxUu8w== 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=+YCOwgmVqD+fbh+PeE+5AlR0/kSW0z4Ay9oslWXFsu4=; b=mTJwBRM5qcMBFPvhimo9z1xiV3kWYmVYJAYbNmMp5S5FIPvyYfHpxvoRZ5LteFrjK70mdi0QuOqVFKq/tZ+kX2ZzK2oh2nODl14Tz3i8VddWZKFRAgNZr/Cr8baMNFrDpF6356UplZqDlnaspqoVZ177nL2eHnlTCH87CcBGNmtKRssk+9MUwYXMoHgb98nPWRtRe7wQP1dWNr/JZ2thNapA6GbkvE2kgVNCaHJ5vv1x2EmSUl9oxyQg5KYTJ05KFGRnDjzdUbv0whDzM4VqLnb1GSJWXRg8y1Yed/gczCEHWIydWCx9p/azQOglwuUqX4vbXORBizOK7UlK25Nd/g== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0070.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:34 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:31 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [UWU8eHsN1+UHPiD47FUsnofVC+HFlW0L/rMmJwZqopA=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-66-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0070:EE_ X-MS-Office365-Filtering-Correlation-Id: 69d37510-3420-4cea-ed9b-08dc71fcd798 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: 15V4bJh24NQpSsRNKl+M5eFdN3Hjty8aBqAD2px1EuJcD1NTR94AYYRJMquKkLFvKoVm74P0cwoK19BfE/a2dGjHJT5y4flKOtlzEJqNWpfu/WDRgMITGtJWcNCPuDk7JldKzDtNdOCPUcXb75A9Ym+ALHkR+OdgrHLwNjJ9zXP90ZaLtv7DS0sZZgrpCepjJQLsj0W31ur5P6IbZVej/02xZDzfHeO8TtGojJipaBm5ZFly6sk/sf02zH+yM0hkAmWCGy8J7KYjhjNfDaCxRTStGr5rZK+mv3APmEPp5X1Cc/eYj0zGYLQwlX5V2be+xtRG67tS6tDZL2Cje175bvvGsDyxscbmVmteuK2BvkJj197sCmspti3l22UeX0pyHJtM+stY5+alivLVpq/StC1zaR50zOA4IXWV006hR3fHMR1e2sy9eStiPjvhW4Nmi6wV807G0SJJvzJuBNu7eyv2R5dR6LzrHMmTFnHNqWb70VFtTYP2dPKPT7ZKUxkGEA87eOHT/JaiocaNF7HVkbmJXauFusl9EsU0prb5RwEN1T5waE9ah/meL+2YRtQpchjIJjL4n6ooHvnJ4/pVTO88ftrl4WZ/MxHi+ZCpr1f/db/PkBOZkUNXvFjelxtd X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XT3bPNLJMlPuzsR3dLtJIWawPJg5FQsEG98lMxBmSv61+O8aqYDmGehECpilpFin96W0BnKtDe5hAQbUF+oApSAqcaCU8bbfrLAS2G5pOv1ExPAi8rOSyOUI1Jr1VQHd2SvHX1DG2/Inr5QPkwZQOvZPBTEyuV2H59HnLeNNjJjiFDlxd25LkQupeNNIf6OqdNXo3Ncu8GcXUipMWpHcySLLBjdfgS2rQlvmPdbUxuwQV2t8EqNhG9/6fXx0y1EVFrd904ec4a2zEnA5qXroeiPMTxTZIqkZucrmSAC0avY96EmuFabHPGf1UStAzVFoLXaaZnbFlKbsnbXL5gC58nQJFDtkeiPfbYh319xHxCv02MghLxO2eND28T0aArFCdNxDov7Pgs/xeXo7vEQv6J/aa8QCwO2Y61N7kfAAoTfFEgbKR+uKEETJ5bKGTQ/Tg0FnAMEbvkrCwB2nBHgAsciwOPh1jGkIOK0QGrY9m1UuAVA8ortvfIWPgolZoNLny717C6OTbdjf7tvxdQ/DBxVbjo52lMJqrRd+WanLrnxD8fFX6kXFlpoDERCiv0dG8Sl/58K+PUOS8Kwk6f0Pe5TjWxpSp6LwN4gdlV0cUgZUbvs/LHk3SXGWjiq5tY67PcwOMAJNE1DTFO00rNNY5KWPMkG/tJhnHpzrCsZD/yJbe6DWJK5sOIrJFVMOzC67NPriFjJ2oHpeIIXaKx2Z7kJPtWdg85XapW9INdfknukf94MUu2vcaSJGBwfmmJrhCcOmb3ghmiAUi0OpL1GxqFv8WenfGD06mVLs58BhlCQHTKQ30fee/SoSc8dBU9Rl36uAnnA4UCKF1F2/bDSj7MxAR8zukZaWHbdbvlL/b/eQCkoQE7kJrgp8kR+rs7c4DkxEoC0H8oeYsKFd0WsD61LQPSDiJi1ZKMgqEt9lqM0tgsNAzEEGoBWNhe39xKHEm1Q6TojpUCO+S08sZ/UwMGvY7+mFzYJEDxfnJv2kFeNuJQ2M1d3yvX4vbyF+NN5kgNNhADsxe1Ubckj/KPg3nfelJp19W9jvbP5zMlE+pjovMfiZOzbnjfRjY/plvvGqULPlsHpEHsJdmZHodrU+OwC8xiMX79sPj9E7vax51OAmt8IWhB2D8IAxb8lu5l8xyNX+ZWRpG7iorST1kTeu0bKQc2JvJ3RyAvsnI6gT4M3BH66ys7JMPnIXQ/yB2Z3OgxZqv8nde/Ey/0Ji/KwMPxkqDsgpFg0qdQQ2LYKQWvZ9sxfsM7vUWLNafvpVciFVidiot+wqBe9L7m5wGwHWzw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69d37510-3420-4cea-ed9b-08dc71fcd798 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:34.5126 (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: AS8P250MB0070 Subject: [FFmpeg-devel] [PATCH v2 67/71] avcodec/mpegvideo: Remove pblocks 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: fTr9rd2Li+WS It has been added in a579db0c4fe026d49c71d1ff64a2d1d07c152d68 due to XvMC, but today it is only used to swap U and V for VCR2, a MPEG-2 variant with U and V swapped. This can be done in a simpler fashion, namely by simply swapping the U and V pointers of the corresponding MPVWorkPictures. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 20 ++++++++++++++++---- libavcodec/mpegvideo.c | 22 ++-------------------- libavcodec/mpegvideo.h | 1 - 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 55e3a31e95..139e825216 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -535,14 +535,14 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { for (i = 0; i < mb_block_count; i++) - if ((ret = mpeg2_decode_block_intra(s, *s->pblocks[i], i)) < 0) + if ((ret = mpeg2_decode_block_intra(s, s->block[i], i)) < 0) return ret; } else { for (i = 0; i < 6; i++) { ret = ff_mpeg1_decode_block_intra(&s->gb, s->intra_matrix, s->intra_scantable.permutated, - s->last_dc, *s->pblocks[i], + s->last_dc, s->block[i], i, s->qscale); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", @@ -760,7 +760,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) for (i = 0; i < mb_block_count; i++) { if (cbp & (1 << 11)) { - if ((ret = mpeg2_decode_block_non_intra(s, *s->pblocks[i], i)) < 0) + if ((ret = mpeg2_decode_block_non_intra(s, s->block[i], i)) < 0) return ret; } else { s->block_last_index[i] = -1; @@ -770,7 +770,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) } else { for (i = 0; i < 6; i++) { if (cbp & 32) { - if ((ret = mpeg1_decode_block_inter(s, *s->pblocks[i], i)) < 0) + if ((ret = mpeg1_decode_block_inter(s, s->block[i], i)) < 0) return ret; } else { s->block_last_index[i] = -1; @@ -1279,6 +1279,7 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) { MpegEncContext *s = &s1->mpeg_enc_ctx; AVCodecContext *avctx = s->avctx; + int second_field = 0; int ret; if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { @@ -1362,6 +1363,7 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_finish_setup(avctx); } else { // second field + second_field = 1; if (!s->cur_pic.ptr) { av_log(s->avctx, AV_LOG_ERROR, "first field missing\n"); return AVERROR_INVALIDDATA; @@ -1389,6 +1391,16 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size) if (avctx->hwaccel) { if ((ret = FF_HW_CALL(avctx, start_frame, buf, buf_size)) < 0) return ret; + } else if (s->codec_tag == MKTAG('V', 'C', 'R', '2')) { + // Exchange UV + FFSWAP(uint8_t*, s->cur_pic.data[1], s->cur_pic.data[2]); + FFSWAP(ptrdiff_t, s->cur_pic.linesize[1], s->cur_pic.linesize[2]); + if (!second_field) { + FFSWAP(uint8_t*, s->next_pic.data[1], s->next_pic.data[2]); + FFSWAP(ptrdiff_t, s->next_pic.linesize[1], s->next_pic.linesize[2]); + FFSWAP(uint8_t*, s->last_pic.data[1], s->last_pic.data[2]); + FFSWAP(ptrdiff_t, s->last_pic.linesize[1], s->last_pic.linesize[2]); + } } return 0; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 8a8ff2fbd9..c5ed4701d0 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -365,8 +365,6 @@ av_cold void ff_mpv_idct_init(MpegEncContext *s) static int init_duplicate_context(MpegEncContext *s) { - int i; - if (s->encoding) { s->me.map = av_mallocz(2 * ME_MAP_SIZE * sizeof(*s->me.map)); if (!s->me.map) @@ -382,15 +380,6 @@ static int init_duplicate_context(MpegEncContext *s) return AVERROR(ENOMEM); s->block = s->blocks[0]; - for (i = 0; i < 12; i++) { - s->pblocks[i] = &s->block[i]; - } - - if (s->avctx->codec_tag == AV_RL32("VCR2")) { - // exchange uv - FFSWAP(void *, s->pblocks[4], s->pblocks[5]); - } - if (s->out_format == FMT_H263) { int mb_height = s->msmpeg4_version == 6 /* VC-1 like */ ? FFALIGN(s->mb_height, 2) : s->mb_height; @@ -484,18 +473,12 @@ static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src) int ff_update_duplicate_context(MpegEncContext *dst, const MpegEncContext *src) { MpegEncContext bak; - int i, ret; + int ret; // FIXME copy only needed parts backup_duplicate_context(&bak, dst); memcpy(dst, src, sizeof(MpegEncContext)); backup_duplicate_context(dst, &bak); - for (i = 0; i < 12; i++) { - dst->pblocks[i] = &dst->block[i]; - } - if (dst->avctx->codec_tag == AV_RL32("VCR2")) { - // exchange uv - FFSWAP(void *, dst->pblocks[4], dst->pblocks[5]); - } + ret = ff_mpv_framesize_alloc(dst->avctx, &dst->sc, dst->linesize); if (ret < 0) { av_log(dst->avctx, AV_LOG_ERROR, "failed to allocate context " @@ -682,7 +665,6 @@ static void clear_context(MpegEncContext *s) s->dct_error_sum = NULL; s->block = NULL; s->blocks = NULL; - memset(s->pblocks, 0, sizeof(s->pblocks)); s->ac_val_base = NULL; s->ac_val[0] = s->ac_val[1] = diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 4339a145aa..5af74acf95 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -466,7 +466,6 @@ typedef struct MpegEncContext { int rtp_payload_size; uint8_t *ptr_lastgob; - int16_t (*pblocks[12])[64]; int16_t (*block)[64]; ///< points to one of the following blocks int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block From patchwork Sat May 11 20:51:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48787 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300492pzb; Sat, 11 May 2024 14:01:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVFirM3mb+veB3+FWzSxcxf4UI8mQpBA5eC6WqJXqdKHR8cwt1/2kDa+WkWsoorWpkrK9ITYjUrKlDYzTiAP6Ss8wO51si4SAd91w== X-Google-Smtp-Source: AGHT+IEL/2RXRGtWMQiYIAM4k/o9laeThCOWWByUVDToT77bZr706ftJB7gIvuBoUnVQLaId0EOb X-Received: by 2002:a17:906:408f:b0:a59:b491:5d79 with SMTP id a640c23a62f3a-a5a2d585a7fmr375577466b.24.1715461301905; Sat, 11 May 2024 14:01:41 -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 a640c23a62f3a-a5a17c2c156si324716466b.949.2024.05.11.14.01.41; Sat, 11 May 2024 14:01:41 -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=Fw+LZ3M6; 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 4776968D84D; Sat, 11 May 2024 23:56:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2102.outbound.protection.outlook.com [40.92.89.102]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C38BF68D83C for ; Sat, 11 May 2024 23:56:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8bSEXDb4JqU3FjbwIuTzcX7sGInk7N4CYMvDYM4K5FNgOJy+ZGK2ni20aHR1aqmKZx12VrtCaWlwwgp534hY0ZDxUDAA/p3rw+xA6BvOBzU7Fpxnd6EiOcAyBkNsKq6dVLEYrf2t3JoG0CLIIBW3wPy0tsNfL5v381Cp8vJICde7LaWb5lLQyZGpbjFEOEDd/MgeD7Nv91AmYZE6ZOnKDABjguPYwMCWks8u3P0tKnou++0BlOzVgtUNa50uQsxStx1UBEkVnEAvlOhuyfWZXhXN097Z8wyxFFVDaJJ9uu9kvZ6QQfzRf3GQviGNzQs17zXnqNI7FcntHNkUhVZgg== 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=yMTlaBjdELP9cBpp9Cr/6KByQGRPMP1zjDzWPMKZY0o=; b=KERl0zXFR2EkNATQmg2fd1EznmpP/JxrX3OWRih34WoYimza12p9MtHtqOUg0XYBkgjKDHRmVMn5luS54+PUF55tbr8IardDVdaqiby845R+rZzEppBBsm7CxnKKJDm7Bn9mhhT+AvGNTdsbQnM/6Ivo4VMVtoCyNmv1RyG+JrkwvG9VTFigEZb10mOeq0A8WHKywBto9lcJuAaDm8HmtVlvnfUqnIyyOKFqqVkvnDnR2fWcV2h4xDfsA4B3GfA+ZBpnUQmnxdwWUGvBQr5dXSpupNy/WLvVqSArHa1OFRVmA3+3Pglzl5Jw6NKZnOQnx2CT0nUpg+thAKDa0aOIfQ== 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=yMTlaBjdELP9cBpp9Cr/6KByQGRPMP1zjDzWPMKZY0o=; b=Fw+LZ3M6C09Fq+P6e3gBgEaZCr6/heIYNKwO6OyXWGd4w6M8iwTtPbSs1tZGNZJw3uQ7gbcQ/eq6A910BOibI1Ku3mhNZHRlIPJZoAtMtkgNzL12TL+OV4wlteqhDJi9msQ9j2Nzhy5aczTCxNtUhNjVZYKnMdw5d0Zyc/dQiTsKQ4EX9C0s70j5yqpfUBsT7SD9Kx4ySFQPpTBf8RBEG4Q0UFwxfxFyO8+OK35i2O3RLIUAQq4If223cZdFNO74RlKK9E2WGOkmVyxKsRofUn4eA52x77uNK00EKBYkpe77lP+SwhrYNrOwc/8oXycemtG2OxROqhpMoE/qyUwaLg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AM8P250MB0074.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:36 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:32 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [MEBC8mLXUwG/oAvYeT6fcyrPG0j4is5/HhVBhSowFT4=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-67-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AM8P250MB0074:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f695975-7290-48e5-bd42-08dc71fcd867 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: sEX+x1koqVXnsIBuGB29XnmR/383JAOF/2yBBcHI67u9b3WdgkUX9szGY1PgOBi5iPzVu/xA8A7vudms0s8xt1fRaCsu682KTIbkWY6cX503aPS03lAVQ1M0K/rcDhA2TZjVS+qDtjh/EUtxqYk3UUIh8u2N0xL8Ew9MPmy+JsvIcQKGbqambaKNjPybEYCXrDq5xftbEWD7agyXVz0+pv8ZK9BR3KFq+0gh8BgmuQHQkWJ+NMxjsOaVzNkrtjTVT4tIXB8oZtO669vNZvsxfB71WeIghq77A/TjmbtV912dY8L7MSKBvNYsQfSJnFjnOyHgJY/tMEQwyTjB9SKaEISGcgoRjEYKNgmxXcxivVfhbQXap7ZqYjWvHYl7xWNR14nrTASoYdpuRfOdu+RvdTQDUrmma+OAcniRfZp+nKYlLzuEnCDF/Hz9wplxVhUW8fkghWoM7jg9w/X2CLIDTC8mxsKh+fNgUM9XLXWtznuKKEwM3e6CyEkS9GWFsMYrBMp3mEGKsASyKOtcsCwu7gE7FF2sfXectXjZC7PH+QvPKlGSkBcUNnQHlQx/sRILr2RGvIFrmWZfAB5epYW3ym9wM6EaemM+nLjaBi1CmlA= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nSClMsOOaU9SUr4QkkV5SBn7gaRtXjBtyiNNQ1NGJC+/9iOB1fCOZpcyHYXTDhzGwhlRdQKoJZRTPU5UxGRCFN0Ox13PAfZOVOY7q8vl/eNngppK9CvIOmLraARiBQumyUplzDnXQ+ljXXp4LMPqlRnrqGAIU1IVZmK8ygbrUOkNcwuEwXadnuGbvZi0TptsXMSJCDZcEVTzq/VPjjglvFBOQGZEo5VeYXWgnDhGxGN6rMlDmCrnOYMsvKsIxcqFjHCbO1MA4o/aNOp8wEEdH+14d0u15r0zdG95buEM9r8wgyM2uD3e+lQ01BatWEVlPZGQK/KV34+cIRHwSc46O6fl78plLTdC6mV32+8Zeimu/jhrxGcWezJTJf6M0yTWf5Puti+UivwSczF8Bf7ttgSQD9TeJx8JyA+8xCeK8jnFeuzBgfvyReX3uVYcMP4R7wSm6n2kbrgXAFtvyCZQ0df8Wlc1Hqwa78txo3CCytJYid3fiPLEwXFJdg7FdtvjYyFq5FgSpFzk3yNe2WPX3Ggq7DydKis23O5q2znCVbQQzCUYRAGonvyRcHSBnktUXnY+HmMQaHW1dwzaRXk2XXz4SJY0/F5zYNS856hjBNwImcW9EK3lLJZ9dt9BjfWsrCwcUiZaBqMGMwlnude57HG35J571mbtxmHEbaiKPKCY/pk/iev1+xBnCKzdXC5NhEVXb1ldO7Ur2OJqGahyqA4MICcm81gHPYDmfOKKk7OM2EWcpc8RtF+mVQxzlqSEWbcpYJTXJrVqNbO4XKH7oggYtaE4OmP7u7I77ftvqi7P7Kg5bsaGNsu6dsu5WXlltAK1MKC+EDKIeCEakxl5aVl+ixOeNa+DUs8iiVJJGkUO7l5Tb25HgQYvFeGaGP9U5zBny8FVGzl26Q9pxYcUMGcLrpOtIxoinbpr13+P7cOVvllLuFbxIv9ab0tULJbIq3wf221ZKwlJw2tFICkRqhgoXcGypE0jUijdrlAOV8j68N4w+RtXDKkugA/1fYGFseZ7lxQWeqJ0wNM4m0UeU0BCnYETfAY5Dj8tE7kAtvJBDPYRrXFNhejF12QDn2ytF7mVRtwxaBlPuFlvx1oxqVubRYSMsAO1sB5rPy4WO4H0yldDqRvsAspgyhyelnlxTWfVYdFiSGH1OruxR6KWMhtUVdOuVIUgcOucNW3DVICmm3Sdgv6OhA+ARHYa2EdgOiTg6Vqm5a1oIUyvuvPNc92ESQQxgvwUjWlUtXCmtoARYdNDFJmso8gqbHCGl+RCput9i2e94Fx5ToTqTG3xcQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f695975-7290-48e5-bd42-08dc71fcd867 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:35.9046 (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: AM8P250MB0074 Subject: [FFmpeg-devel] [PATCH v2 68/71] avcodec/mpegvideo: Use enum for msmpeg4_version 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: lExWv3kJ1VfY Improves readability. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 34 ++++++------ libavcodec/motion_est.c | 8 +-- libavcodec/mpegvideo.c | 6 +-- libavcodec/mpegvideo.h | 10 +++- libavcodec/mpegvideo_enc.c | 28 ++++++---- libavcodec/mpv_reconstruct_mb_template.c | 2 +- libavcodec/msmpeg4.c | 17 +++--- libavcodec/msmpeg4dec.c | 68 ++++++++++++------------ libavcodec/msmpeg4enc.c | 37 ++++++------- libavcodec/vc1dec.c | 2 +- 10 files changed, 114 insertions(+), 98 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index b9762be9c9..eee7978452 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -113,23 +113,23 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) break; case AV_CODEC_ID_MSMPEG4V1: s->h263_pred = 1; - s->msmpeg4_version = 1; + s->msmpeg4_version = MSMP4_V1; break; case AV_CODEC_ID_MSMPEG4V2: s->h263_pred = 1; - s->msmpeg4_version = 2; + s->msmpeg4_version = MSMP4_V2; break; case AV_CODEC_ID_MSMPEG4V3: s->h263_pred = 1; - s->msmpeg4_version = 3; + s->msmpeg4_version = MSMP4_V3; break; case AV_CODEC_ID_WMV1: s->h263_pred = 1; - s->msmpeg4_version = 4; + s->msmpeg4_version = MSMP4_WMV1; break; case AV_CODEC_ID_WMV2: s->h263_pred = 1; - s->msmpeg4_version = 5; + s->msmpeg4_version = MSMP4_WMV2; break; case AV_CODEC_ID_H263I: break; @@ -227,7 +227,7 @@ static int decode_slice(MpegEncContext *s) for (; s->mb_y < s->mb_height; s->mb_y++) { /* per-row end of slice checks */ - if (s->msmpeg4_version) { + if (s->msmpeg4_version != MSMP4_UNUSED) { if (s->resync_mb_y + s->slice_height == s->mb_y) { ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, ER_MB_END); @@ -236,7 +236,7 @@ static int decode_slice(MpegEncContext *s) } } - if (s->msmpeg4_version == 1) { + if (s->msmpeg4_version == MSMP4_V1) { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128; @@ -375,12 +375,12 @@ static int decode_slice(MpegEncContext *s) } // handle formats which don't have unique end markers - if (s->msmpeg4_version || (s->workaround_bugs & FF_BUG_NO_PADDING)) { // FIXME perhaps solve this more cleanly + if (s->msmpeg4_version != MSMP4_UNUSED || (s->workaround_bugs & FF_BUG_NO_PADDING)) { // FIXME perhaps solve this more cleanly int left = get_bits_left(&s->gb); int max_extra = 7; /* no markers in M$ crap */ - if (s->msmpeg4_version && s->pict_type == AV_PICTURE_TYPE_I) + if (s->msmpeg4_version != MSMP4_UNUSED && s->pict_type == AV_PICTURE_TYPE_I) max_extra += 17; /* buggy padding but the frame should still end approximately at @@ -474,10 +474,12 @@ retry: return ret; /* let's go :-) */ - if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { + if (CONFIG_WMV2_DECODER && s->msmpeg4_version == MSMP4_WMV2) { ret = ff_wmv2_decode_picture_header(s); - } else if (CONFIG_MSMPEG4DEC && s->msmpeg4_version) { +#if CONFIG_MSMPEG4DEC + } else if (s->msmpeg4_version != MSMP4_UNUSED) { ret = ff_msmpeg4_decode_picture_header(s); +#endif } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0); s->skipped_last_frame = (ret == FRAME_SKIPPED); @@ -583,13 +585,15 @@ retry: /* the second part of the wmv2 header contains the MB skip bits which * are stored in current_picture->mb_type which is not available before * ff_mpv_frame_start() */ - if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { +#if CONFIG_WMV2_DECODER + if (s->msmpeg4_version == MSMP4_WMV2) { ret = ff_wmv2_decode_secondary_picture_header(s); if (ret < 0) return ret; if (ret == 1) goto frame_end; } +#endif /* decode each macroblock */ s->mb_x = 0; @@ -597,7 +601,7 @@ retry: slice_ret = decode_slice(s); while (s->mb_y < s->mb_height) { - if (s->msmpeg4_version) { + if (s->msmpeg4_version != MSMP4_UNUSED) { if (s->slice_height == 0 || s->mb_x != 0 || slice_ret < 0 || (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0) break; @@ -609,14 +613,14 @@ retry: s->er.error_occurred = 1; } - if (s->msmpeg4_version < 4 && s->h263_pred) + if (s->msmpeg4_version < MSMP4_WMV1 && s->h263_pred) ff_mpeg4_clean_buffers(s); if (decode_slice(s) < 0) slice_ret = AVERROR_INVALIDDATA; } - if (s->msmpeg4_version && s->msmpeg4_version < 4 && + if (s->msmpeg4_version != MSMP4_UNUSED && s->msmpeg4_version < MSMP4_WMV1 && s->pict_type == AV_PICTURE_TYPE_I) if (!CONFIG_MSMPEG4DEC || ff_msmpeg4_decode_ext_header(s, buf_size) < 0) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index fcef47a623..162472d693 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1609,7 +1609,7 @@ int ff_get_best_fcode(MpegEncContext * s, const int16_t (*mv_table)[2], int type int best_fcode=-1; int best_score=-10000000; - if(s->msmpeg4_version) + if (s->msmpeg4_version != MSMP4_UNUSED) range= FFMIN(range, 16); else if(s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) range= FFMIN(range, 256); @@ -1660,9 +1660,9 @@ void ff_fix_long_p_mvs(MpegEncContext * s, int type) int y, range; av_assert0(s->pict_type==AV_PICTURE_TYPE_P); - range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code); + range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version != MSMP4_UNUSED) ? 8 : 16) << f_code); - av_assert0(range <= 16 || !s->msmpeg4_version); + av_assert0(range <= 16 || s->msmpeg4_version == MSMP4_UNUSED); av_assert0(range <=256 || !(s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)); if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; @@ -1709,7 +1709,7 @@ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_ int y, h_range, v_range; // RAL: 8 in MPEG-1, 16 in MPEG-4 - int range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code); + int range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version != MSMP4_UNUSED) ? 8 : 16) << f_code); if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c5ed4701d0..4fe9350c40 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -381,7 +381,7 @@ static int init_duplicate_context(MpegEncContext *s) s->block = s->blocks[0]; if (s->out_format == FMT_H263) { - int mb_height = s->msmpeg4_version == 6 /* VC-1 like */ ? + int mb_height = s->msmpeg4_version == MSMP4_VC1 ? FFALIGN(s->mb_height, 2) : s->mb_height; int y_size = s->b8_stride * (2 * mb_height + 1); int c_size = s->mb_stride * (mb_height + 1); @@ -535,7 +535,7 @@ int ff_mpv_init_context_frame(MpegEncContext *s) /* VC-1 can change from being progressive to interlaced on a per-frame * basis. We therefore allocate certain buffers so big that they work * in both instances. */ - mb_height = s->msmpeg4_version == 6 /* VC-1 like*/ ? + mb_height = s->msmpeg4_version == MSMP4_VC1 ? FFALIGN(s->mb_height, 2) : s->mb_height; s->mb_width = (s->width + 15) / 16; @@ -602,7 +602,7 @@ int ff_mpv_init_context_frame(MpegEncContext *s) } } - if (s->msmpeg4_version >= 3) { + if (s->msmpeg4_version >= MSMP4_V3) { s->coded_block_base = av_mallocz(y_size); if (!s->coded_block_base) return AVERROR(ENOMEM); diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 5af74acf95..8351f806b4 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -418,7 +418,15 @@ typedef struct MpegEncContext { int slice_height; ///< in macroblocks int first_slice_line; ///< used in MPEG-4 too to handle resync markers int flipflop_rounding; - int msmpeg4_version; ///< 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8 + enum { + MSMP4_UNUSED, + MSMP4_V1, + MSMP4_V2, + MSMP4_V3, + MSMP4_WMV1, + MSMP4_WMV2, + MSMP4_VC1, ///< for VC1 (image), WMV3 (image) and MSS2. + } msmpeg4_version; int per_mb_rl_table; int esc3_level_length; int esc3_run_length; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 195d1e3465..58f68ef5f3 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -754,7 +754,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; - s->msmpeg4_version = 2; + s->msmpeg4_version = MSMP4_V2; avctx->delay = 0; s->low_delay = 1; break; @@ -762,7 +762,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; - s->msmpeg4_version = 3; + s->msmpeg4_version = MSMP4_V3; s->flipflop_rounding = 1; avctx->delay = 0; s->low_delay = 1; @@ -771,7 +771,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; - s->msmpeg4_version = 4; + s->msmpeg4_version = MSMP4_WMV1; s->flipflop_rounding = 1; avctx->delay = 0; s->low_delay = 1; @@ -780,7 +780,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; - s->msmpeg4_version = 5; + s->msmpeg4_version = MSMP4_WMV2; s->flipflop_rounding = 1; avctx->delay = 0; s->low_delay = 1; @@ -916,8 +916,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) { ff_h263_encode_init(s); - if (CONFIG_MSMPEG4ENC && s->msmpeg4_version) +#if CONFIG_MSMPEG4ENC + if (s->msmpeg4_version != MSMP4_UNUSED) ff_msmpeg4_encode_init(s); +#endif } /* init q matrix */ @@ -3456,9 +3458,12 @@ static int encode_thread(AVCodecContext *c, void *arg){ } } +#if CONFIG_MSMPEG4ENC //not beautiful here but we must write it before flushing so it has to be here - if (CONFIG_MSMPEG4ENC && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == AV_PICTURE_TYPE_I) + if (s->msmpeg4_version != MSMP4_UNUSED && s->msmpeg4_version < MSMP4_WMV1 && + s->pict_type == AV_PICTURE_TYPE_I) ff_msmpeg4_encode_ext_header(s); +#endif write_slice_end(s); @@ -3561,7 +3566,7 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt) /* we need to initialize some time vars before we can encode B-frames */ // RAL: Condition added for MPEG1VIDEO - if (s->out_format == FMT_MPEG1 || (s->h263_pred && !s->msmpeg4_version)) + if (s->out_format == FMT_MPEG1 || (s->h263_pred && s->msmpeg4_version == MSMP4_UNUSED)) set_frame_distances(s); if(CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4) ff_set_mpeg4_time(s); @@ -3571,8 +3576,7 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt) // s->lambda= s->cur_pic.ptr->quality; //FIXME qscale / ... stuff for ME rate distortion if(s->pict_type==AV_PICTURE_TYPE_I){ - if(s->msmpeg4_version >= 3) s->no_rounding=1; - else s->no_rounding=0; + s->no_rounding = s->msmpeg4_version >= MSMP4_V3; }else if(s->pict_type!=AV_PICTURE_TYPE_B){ if(s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_MPEG4) s->no_rounding ^= 1; @@ -3654,7 +3658,7 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt) s->pict_type= AV_PICTURE_TYPE_I; for(i=0; imb_stride*s->mb_height; i++) s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; - if(s->msmpeg4_version >= 3) + if (s->msmpeg4_version >= MSMP4_V3) s->no_rounding=1; ff_dlog(s, "Scene change detected, encoding as I Frame %"PRId64" %"PRId64"\n", s->mb_var_sum, s->mc_mb_var_sum); @@ -3798,8 +3802,10 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt) case FMT_H263: if (CONFIG_WMV2_ENCODER && s->codec_id == AV_CODEC_ID_WMV2) ff_wmv2_encode_picture_header(s); - else if (CONFIG_MSMPEG4ENC && s->msmpeg4_version) +#if CONFIG_MSMPEG4ENC + else if (s->msmpeg4_version != MSMP4_UNUSED) ff_msmpeg4_encode_picture_header(s); +#endif else if (CONFIG_MPEG4_ENCODER && s->h263_pred) { ret = ff_mpeg4_encode_picture_header(s); if (ret < 0) diff --git a/libavcodec/mpv_reconstruct_mb_template.c b/libavcodec/mpv_reconstruct_mb_template.c index 9aacf380a1..6ad353ddfd 100644 --- a/libavcodec/mpv_reconstruct_mb_template.c +++ b/libavcodec/mpv_reconstruct_mb_template.c @@ -173,7 +173,7 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], } /* add dct residue */ - if (!(IS_MPEG12(s) || s->msmpeg4_version || + if (!(IS_MPEG12(s) || s->msmpeg4_version != MSMP4_UNUSED || (s->codec_id == AV_CODEC_ID_MPEG4 && !s->mpeg_quant))) #endif /* !IS_ENCODER */ { diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index f7ebb8ba89..50fd581a83 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -120,12 +120,12 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s) static AVOnce init_static_once = AV_ONCE_INIT; switch(s->msmpeg4_version){ - case 1: - case 2: + case MSMP4_V1: + case MSMP4_V2: s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; break; - case 3: + case MSMP4_V3: if(s->workaround_bugs){ s->y_dc_scale_table= ff_old_ff_y_dc_scale_table; s->c_dc_scale_table= ff_wmv1_c_dc_scale_table; @@ -134,14 +134,14 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s) s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; } break; - case 4: - case 5: + case MSMP4_WMV1: + case MSMP4_WMV2: s->y_dc_scale_table= ff_wmv1_y_dc_scale_table; s->c_dc_scale_table= ff_wmv1_c_dc_scale_table; break; } - if(s->msmpeg4_version>=4){ + if (s->msmpeg4_version >= MSMP4_WMV1) { ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]); ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]); ff_permute_scantable(s->permutated_intra_h_scantable, ff_wmv1_scantable[2], @@ -218,9 +218,8 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, b = dc_val[ - 1 - wrap]; c = dc_val[ - wrap]; - if(s->first_slice_line && (n&2)==0 && s->msmpeg4_version<4){ + if (s->first_slice_line && !(n & 2) && s->msmpeg4_version < MSMP4_WMV1) b=c=1024; - } /* XXX: the following solution consumes divisions, but it does not necessitate to modify mpegvideo.c. The problem comes from the @@ -259,7 +258,7 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, #endif /* XXX: WARNING: they did not choose the same test as MPEG-4. This is very important ! */ - if(s->msmpeg4_version>3){ + if (s->msmpeg4_version > MSMP4_V3) { if(s->inter_intra_pred){ uint8_t *dest; int wrap; diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 4143c46c15..209e1fe1b2 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -125,7 +125,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) } } - if(s->msmpeg4_version==2) + if (s->msmpeg4_version == MSMP4_V2) code = get_vlc2(&s->gb, v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 1); else code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 2); @@ -139,7 +139,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) cbp = code & 0x3; } else { s->mb_intra = 1; - if(s->msmpeg4_version==2) + if (s->msmpeg4_version == MSMP4_V2) cbp = get_vlc2(&s->gb, v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 1); else cbp = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 2); @@ -159,7 +159,8 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) } cbp|= cbpy<<2; - if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; + if (s->msmpeg4_version == MSMP4_V1 || (cbp&3) != 3) + cbp ^= 0x3C; ff_h263_pred_motion(s, 0, 0, &mx, &my); mx= msmpeg4v2_decode_motion(s, mx, 1); @@ -172,7 +173,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; } else { int v; - if(s->msmpeg4_version==2){ + if (s->msmpeg4_version == MSMP4_V2) { s->ac_pred = get_bits1(&s->gb); v = get_vlc2(&s->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1); if (v < 0) { @@ -366,16 +367,16 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) ff_msmpeg4_common_init(s); - switch(s->msmpeg4_version){ - case 1: - case 2: + switch (s->msmpeg4_version) { + case MSMP4_V1: + case MSMP4_V2: s->decode_mb= msmpeg4v12_decode_mb; break; - case 3: - case 4: + case MSMP4_V3: + case MSMP4_WMV1: s->decode_mb= msmpeg4v34_decode_mb; break; - case 5: + case MSMP4_WMV2: break; } @@ -398,7 +399,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16)) return AVERROR_INVALIDDATA; - if(s->msmpeg4_version==1){ + if (s->msmpeg4_version == MSMP4_V1) { int start_code = get_bits_long(&s->gb, 32); if(start_code!=0x00000100){ av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n"); @@ -422,7 +423,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) if (s->pict_type == AV_PICTURE_TYPE_I) { code = get_bits(&s->gb, 5); - if(s->msmpeg4_version==1){ + if (s->msmpeg4_version == MSMP4_V1) { if(code==0 || code>s->mb_height){ av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code); return -1; @@ -440,20 +441,20 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) } switch(s->msmpeg4_version){ - case 1: - case 2: + case MSMP4_V1: + case MSMP4_V2: s->rl_chroma_table_index = 2; s->rl_table_index = 2; s->dc_table_index = 0; //not used break; - case 3: + case MSMP4_V3: s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); s->dc_table_index = get_bits1(&s->gb); break; - case 4: + case MSMP4_WMV1: ff_msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); @@ -479,9 +480,9 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) s->slice_height); } else { switch(s->msmpeg4_version){ - case 1: - case 2: - if(s->msmpeg4_version==1) + case MSMP4_V1: + case MSMP4_V2: + if (s->msmpeg4_version == MSMP4_V1) s->use_skip_mb_code = 1; else s->use_skip_mb_code = get_bits1(&s->gb); @@ -490,7 +491,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) s->dc_table_index = 0; //not used s->mv_table_index = 0; break; - case 3: + case MSMP4_V3: s->use_skip_mb_code = get_bits1(&s->gb); s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; @@ -499,7 +500,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) s->mv_table_index = get_bits1(&s->gb); break; - case 4: + case MSMP4_WMV1: s->use_skip_mb_code = get_bits1(&s->gb); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); @@ -545,13 +546,13 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size) { int left= buf_size*8 - get_bits_count(&s->gb); - int length= s->msmpeg4_version>=3 ? 17 : 16; + int length = s->msmpeg4_version >= MSMP4_V3 ? 17 : 16; /* the alt_bitstream reader could read over the end so we need to check it */ if(left>=length && leftgb, 5); /* fps */ s->bit_rate= get_bits(&s->gb, 11)*1024; - if(s->msmpeg4_version>=3) + if (s->msmpeg4_version >= MSMP4_V3) s->flipflop_rounding= get_bits1(&s->gb); else s->flipflop_rounding= 0; @@ -559,7 +560,7 @@ int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size) else if(leftflipflop_rounding= 0; - if(s->msmpeg4_version != 2) + if (s->msmpeg4_version != MSMP4_V2) av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left); } else @@ -574,7 +575,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) { int level, pred; - if(s->msmpeg4_version<=2){ + if (s->msmpeg4_version <= MSMP4_V2) { if (n < 4) { level = get_vlc2(&s->gb, v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 3); } else { @@ -600,7 +601,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) } } - if(s->msmpeg4_version==1){ + if (s->msmpeg4_version == MSMP4_V1) { int32_t *dc_val; pred = msmpeg4v1_pred_dc(s, n, &dc_val); level += pred; @@ -658,7 +659,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, } block[0] = level; - run_diff = s->msmpeg4_version >= 4; + run_diff = s->msmpeg4_version >= MSMP4_WMV1; i = 0; if (!coded) { goto not_coded; @@ -678,7 +679,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, i = -1; rl = &ff_rl_table[3 + s->rl_table_index]; - if(s->msmpeg4_version==2) + if (s->msmpeg4_version == MSMP4_V2) run_diff = 0; else run_diff = 1; @@ -700,12 +701,13 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, int cache; cache= GET_CACHE(re, &s->gb); /* escape */ - if (s->msmpeg4_version==1 || (cache&0x80000000)==0) { - if (s->msmpeg4_version==1 || (cache&0x40000000)==0) { + if (s->msmpeg4_version == MSMP4_V1 || (cache&0x80000000)==0) { + if (s->msmpeg4_version == MSMP4_V1 || (cache&0x40000000)==0) { /* third escape */ - if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2); + if (s->msmpeg4_version != MSMP4_V1) + LAST_SKIP_BITS(re, &s->gb, 2); UPDATE_CACHE(re, &s->gb); - if(s->msmpeg4_version<=3){ + if (s->msmpeg4_version <= MSMP4_V3) { last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1); run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6); level= SHOW_SBITS(re, &s->gb, 8); @@ -804,7 +806,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, int16_t * block, i = 63; /* XXX: not optimal */ } } - if(s->msmpeg4_version>=4 && i>0) i=63; //FIXME/XXX optimize + if (s->msmpeg4_version >= MSMP4_WMV1 && i > 0) i=63; //FIXME/XXX optimize s->block_last_index[n] = i; return 0; diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c index 5e6bc231d4..642a0ff100 100644 --- a/libavcodec/msmpeg4enc.c +++ b/libavcodec/msmpeg4enc.c @@ -141,7 +141,7 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s) static AVOnce init_static_once = AV_ONCE_INIT; ff_msmpeg4_common_init(s); - if (s->msmpeg4_version >= 4) { + if (s->msmpeg4_version >= MSMP4_WMV1) { s->min_qcoeff = -255; s->max_qcoeff = 255; } @@ -226,7 +226,7 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s) put_bits(&s->pb, 2, s->pict_type - 1); put_bits(&s->pb, 5, s->qscale); - if(s->msmpeg4_version<=2){ + if (s->msmpeg4_version <= MSMP4_V2) { s->rl_table_index = 2; s->rl_chroma_table_index = 2; } @@ -235,7 +235,7 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s) s->mv_table_index = 1; /* only if P-frame */ s->use_skip_mb_code = 1; /* only if P-frame */ s->per_mb_rl_table = 0; - if(s->msmpeg4_version==4) + if (s->msmpeg4_version == MSMP4_WMV1) s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P); ff_dlog(s, "%d %"PRId64" %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); @@ -244,13 +244,13 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s) s->slice_height= s->mb_height/1; put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height); - if(s->msmpeg4_version==4){ + if (s->msmpeg4_version == MSMP4_WMV1) { ff_msmpeg4_encode_ext_header(s); if(s->bit_rate>MBAC_BITRATE) put_bits(&s->pb, 1, s->per_mb_rl_table); } - if(s->msmpeg4_version>2){ + if (s->msmpeg4_version > MSMP4_V2) { if(!s->per_mb_rl_table){ ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index); ff_msmpeg4_code012(&s->pb, s->rl_table_index); @@ -261,10 +261,10 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s) } else { put_bits(&s->pb, 1, s->use_skip_mb_code); - if(s->msmpeg4_version==4 && s->bit_rate>MBAC_BITRATE) + if (s->msmpeg4_version == MSMP4_WMV1 && s->bit_rate > MBAC_BITRATE) put_bits(&s->pb, 1, s->per_mb_rl_table); - if(s->msmpeg4_version>2){ + if (s->msmpeg4_version > MSMP4_V2) { if(!s->per_mb_rl_table) ff_msmpeg4_code012(&s->pb, s->rl_table_index); @@ -298,7 +298,7 @@ FF_ENABLE_DEPRECATION_WARNINGS put_bits(&s->pb, 11, FFMIN(s->bit_rate / 1024, 2047)); - if (s->msmpeg4_version >= 3) + if (s->msmpeg4_version >= MSMP4_V3) put_bits(&s->pb, 1, s->flipflop_rounding); else av_assert0(!s->flipflop_rounding); @@ -340,7 +340,7 @@ void ff_msmpeg4_encode_motion(MpegEncContext * s, void ff_msmpeg4_handle_slices(MpegEncContext *s){ if (s->mb_x == 0) { if (s->slice_height && (s->mb_y % s->slice_height) == 0) { - if(s->msmpeg4_version < 4){ + if (s->msmpeg4_version < MSMP4_WMV1) { ff_mpeg4_clean_buffers(s); } s->first_slice_line = 1; @@ -410,7 +410,7 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, if (s->use_skip_mb_code) put_bits(&s->pb, 1, 0); /* mb coded */ - if(s->msmpeg4_version<=2){ + if (s->msmpeg4_version <= MSMP4_V2) { put_bits(&s->pb, ff_v2_mb_type[cbp&3][1], ff_v2_mb_type[cbp&3][0]); @@ -452,7 +452,7 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, int val = (s->block_last_index[i] >= 1); cbp |= val << (5 - i); } - if(s->msmpeg4_version<=2){ + if (s->msmpeg4_version <= MSMP4_V2) { if (s->pict_type == AV_PICTURE_TYPE_I) { put_bits(&s->pb, ff_v2_intra_cbpc[cbp&3][1], ff_v2_intra_cbpc[cbp&3][0]); @@ -524,7 +524,7 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr /* do the prediction */ level -= pred; - if(s->msmpeg4_version<=2){ + if (s->msmpeg4_version <= MSMP4_V2) { if (n < 4) { put_bits(&s->pb, ff_v2_dc_lum_table[level + 256][1], @@ -575,20 +575,17 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n) } else { rl = &ff_rl_table[3 + s->rl_chroma_table_index]; } - run_diff = s->msmpeg4_version>=4; + run_diff = s->msmpeg4_version >= MSMP4_WMV1; scantable= s->intra_scantable.permutated; } else { i = 0; rl = &ff_rl_table[3 + s->rl_table_index]; - if(s->msmpeg4_version<=2) - run_diff = 0; - else - run_diff = 1; + run_diff = s->msmpeg4_version > MSMP4_V2; scantable= s->inter_scantable.permutated; } /* recalculate block_last_index for M$ wmv1 */ - if (s->msmpeg4_version >= 4 && s->block_last_index[n] > 0) { + if (s->msmpeg4_version >= MSMP4_WMV1 && s->block_last_index[n] > 0) { for(last_index=63; last_index>=0; last_index--){ if(block[scantable[last_index]]) break; } @@ -634,7 +631,7 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n) if (run1 < 0) goto esc3; code = get_rl_index(rl, last, run1+1, level); - if (s->msmpeg4_version == 4 && code == rl->n) + if (s->msmpeg4_version == MSMP4_WMV1 && code == rl->n) goto esc3; code = get_rl_index(rl, last, run1, level); if (code == rl->n) { @@ -642,7 +639,7 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n) /* third escape */ put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, last); - if(s->msmpeg4_version>=4){ + if (s->msmpeg4_version >= MSMP4_WMV1) { if(s->esc3_level_length==0){ s->esc3_level_length=8; s->esc3_run_length= 6; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 17da7ed7cd..4b31860c3f 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -610,7 +610,7 @@ av_cold void ff_vc1_init_common(VC1Context *v) s->out_format = FMT_H263; s->h263_pred = 1; - s->msmpeg4_version = 6; + s->msmpeg4_version = MSMP4_VC1; ff_vc1dsp_init(&v->vc1dsp); From patchwork Sat May 11 20:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48788 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300539pzb; Sat, 11 May 2024 14:01:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVkJ3Prkg9uquM5r4yYRMjZJWXdYYdT8Gyd4FHnD07Pbej3YrdQqChqAvJDHLsm0Ktv/T2txAUVpqAc3ZnTspQPiAKiyxCoR7eiEg== X-Google-Smtp-Source: AGHT+IHTvZC0STztvPjzN4I/CGlt2DKGwoAJ+6e9upx3IpKRtNWwEQF2F9Im6T50jEbJYdQ+3qP5 X-Received: by 2002:a17:906:416:b0:a59:79fc:f922 with SMTP id a640c23a62f3a-a5a11557a1fmr693071666b.6.1715461310975; Sat, 11 May 2024 14:01:50 -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 a640c23a62f3a-a5a17946063si338706366b.100.2024.05.11.14.01.50; Sat, 11 May 2024 14:01:50 -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=dfcfmTtx; 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 6285668D861; Sat, 11 May 2024 23:56:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2102.outbound.protection.outlook.com [40.92.89.102]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6165C68D857 for ; Sat, 11 May 2024 23:56:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YXIV4vKUI2QI3alhNOeAFri5rBaioRMbxMWOMXC4z39zpBJErSipO5tLHm5PVFzDhcdMd08RLdkenld99D2BLauLO+W/Vs0OdKwRRd8Alk3z6h7zh00AzitzLhYpEAPUnlDMe9VodoR9A1eYkl6SMVLDBTfqjTAE2o4jw0feWlCc0D5n6mOAfEvEtszi/a4XDxQJ8n/M3raqy7+0N0L1omy734D0AjVmZdOCl4DmrBalh6LX+/tc/rvGWKUPrzNEX+YurLtrsGhVogqGqjlZWqhWx/fgRVq8jiZcNQ/cq9oX3ibhP9GsInrjHNmHD4WBD7TTEYcxMbcUlNqjUr+JRQ== 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=QKtGpCS23EDRINruZawH3OLy+xjxh1RNCNcQFZ2z6CQ=; b=SqbvwvgAaHadLm+Dvpu3Y/2BbHVd31zjsAzWUFRdZTUe5Fsgzj6sCuX/1TiHaVQcSrKexBtcqhOvqYMkBthxRClKi6lIcSRd1J2zR5qbQKtJ80gXZ3y0moQLf9nsT2BCNGR9V8M1lq5M60xGArLeJrlmuNbxX/Vx+XiHxGowP7Rc+TOd7Fg2qK/EvL/wkRbEfq8VteQvpf+P+KHoXNTdNl2DBAKNDL8oUl/EQpf1TWVOVas7xNOYE7viPQa2qBCtnOhv22GSuS+UXg2wmSzxSQ45525RmZm9Mg8EL2WLOCTT5JsEY8ZXIBiQxLBlL6bUZdLuhL0ckJVuYZmZHkBBOg== 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=QKtGpCS23EDRINruZawH3OLy+xjxh1RNCNcQFZ2z6CQ=; b=dfcfmTtxc4tsKVmfDsRP1vEH0zIHIVw1WhlmtNuI5gu6kIFKwA6YBRlwicxu02CLSeqMm6UAezX+LOTjFrquiHdoCNyBof9evkTEykOwXD7RTdYQTOk39NOJR0+bJ8vQ3lsyF4VKtCIq60yQniZOPsd74GaTpKD3OXG5jKA6CfbQ+v7cJJetepl8zqkfEgOy/aTiH2J7kLI91xVusU9csgewjqz/7iGvMsqnaOhbYd6vaz4fAEn9CTdYZ5kxh8/tUzpnChIitYlcgoaP19B79OTAC1Kb/hvaXgOCjmf4Fm+sauGJHwBJXs/hRkLF1KcVw9/BIRWz38zGTzP+bzBufg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AM8P250MB0074.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:37 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:33 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [TGlB8vfXwMApHSB8rAP53+lHYJPObq6RJx1BUCOW9aM=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-68-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AM8P250MB0074:EE_ X-MS-Office365-Filtering-Correlation-Id: 2571a505-0dce-4800-3e96-08dc71fcd993 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: 6yBz6mu5KaAlu/hXkxdq6pRYv48zTyjjbcUHcMdFrRR8adkB3Rlm4CgS/3yxa1OWr2fUhAwn8tN/1Vbc6Yi85E33QoVssliCvEAwZJtZYcc31etcbgCsfnNjfYRDXSH47SJLbPquolTsT/HTfGuSWhGile6QEEYG16lxpzrMz1V2nA6cghDUzuoY9eWVG/PVAI5UEXqbMAy6cZH8mVFH0xQP6yoIBx5wiZOXxRX8mdiEDWIObDCk56df1TVKo4MuzPfRLhEKuP4EvJkzmLVGTzeL0a/MWUxXkl5Q+u+mgmhLKg2zQzgXSvFX3mXbkuQ9qPjvdphSLZTi4/vvBxmSmEoUnrx2S4LaRbKCW5qRkdwEfy3rqm57bw/E443xqTyDJKaY8bFacMuKB7RNdxlRveE16MvyfX9gelFi7WYm6zQYWPwUFq0gTOxo76W6JpLqTaAR+Halou0qiFKyzjFtphUP1UNdZV5PsY1c3PWysXAGINMgCEEF7J7hHV2O2gnsyQhvOv33DUTDcDNs7Lj8QvZNXrT/2oRlf8Md+wW5mQJ6eS/vl0RdAEdvU8SVbvG8AdT11JwZsx6PpKwZav22ihdnyuvZPrQ6Oj3cGeIyzzXbcnHcTT1ucfd5MkbC99qg X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wifpw6WUvJRAd+zTHMs68BYk059Ra2rfZOBsYh+KTdwAfMnDjEMHzw4XRkNkGlVPIIShP+SHiYx+g2dpRKSgA5rmNdM88uTaIU6xz5OXdksVrpgvsIltFiyGlHL7vIG1vWaXF+c7UTBQg39R1+8apd6B+BiMu+qPLmlIWZrqzkKaKdNzeDaXFgS/MUizctsfDy7qrS8cJeUnB0ou0AhcudZDXb4V8OPD6Um1PrOA8eMgLFZwpOR7u8SYciNdpIBomUehbHlggLFiK7xFx4PPrb3OltEJR681faZRHOAJX7ITB50X5z1DQzgAgzz17szWjCPNJcFmKhXVq19iBdtZ9zF1FqmIaCnyjFKQfuFpOlmSkxCvbbjbyIe5kF9f2k/NFqjHEgIyCtl5FDaKGJkzHbzWRo6nXl1UNuHHjPR/kN0VTnGLDtQVmhm+aP/A68B6C9cBVVYoqhSDoA2RRQWx0h998y47W+Npihe1PQZD3Y06eEVniZ86egBAwx/7mVyUez0LGq8ZWVNjpz4bsZhbz+ln5NSxOUxVY2v/XnJI5KLJ7Ww2m+8ao8dMQfmUoz+ldiuEp8VXvi30YS+0c5JtFaHg9/BMXWU2VQMqL+uNLvnT9KzxeQRmbfmfAZkY3uYkz6COb2AYWswPBBejsvWKBDS90sOc8XpW/69A8jz8H1g2AfFKof/zn3rWnalyb9K0pMidModur60jKoPA58/O9C6Zjfvufp8olcEDt8Cs5kW5qvMVE+tB9woK3iEzPKgOoAcW8F+Jge/uUMgVqqnXodjja9F4fYoQXx2mAu/JgIxuU110oEGzxErtiKEo4hnasQCoZePwOSuwzv0+juOKqZ3L7f0fDa1bNsZJbYXTta/qCdB61owxwzIDdDMN+DKYItov5b+fAn3AW1tum1652kHSvqgopQexQkZ4Tir1n9B1pEUL212G1iNlfw0cFBHlrQyA1d6iT6/RavboeApy0+r8AUUuhW2FELt9rxLtbP8/X9fzMMZ/+X0KNWeLXBrQ/ttWI7SA8sUg5h6JJTg6d/bhqlylHxNrnOZLrY60bK+4enYPQcRfIVbhAVRCVlofMU1DmwivKyh4rpyCHHWXty83Xtx/O9R9//SlV1tD+Yhagi1gnDxl2RmoGLRrnFS2jFK5pUduXUav/OmjVBcBl2DrUbTVjuEJiLN7hmf7cLXCvHD9885WRngsL+xPwGar+PY349xzK9KtuAJ/TKR+jTvvlxCybI6Rgfq66A5BK9L9e+ld4KQGSCM5M2KJ6P3B5KBXOErIoUjfOC5SRINBXw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2571a505-0dce-4800-3e96-08dc71fcd993 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:37.8623 (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: AM8P250MB0074 Subject: [FFmpeg-devel] [PATCH v2 69/71] avcodec/ituh263enc: Remove redundant 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: +SaQ+80LLBDT It is redundant due to the identical check in ff_mpv_encode_init(). Signed-off-by: Andreas Rheinhardt --- libavcodec/ituh263enc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index b7c9f124a9..4b3c55896f 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -881,11 +881,6 @@ av_cold void ff_h263_encode_init(MpegEncContext *s) s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } - if (s->lmin > s->lmax) { - av_log(s->avctx, AV_LOG_WARNING, "Clipping lmin value to %d\n", s->lmax); - s->lmin = s->lmax; - } - ff_thread_once(&init_static_once, h263_encode_init_static); } From patchwork Sat May 11 20:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48789 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300593pzb; Sat, 11 May 2024 14:02:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUdchMpR6kWf56ytvYE6koCxUwUyvjU18e5eR8SBNzZP3uLfOOCkzsbqSkIexaQDtF3Ba/7R3h8sEg6loApyrxHEcl546/rOamkjQ== X-Google-Smtp-Source: AGHT+IGyVlA+kJsqMiEPNR0LA+niOea2Pwf+UMNbCMZSrS2+Iyde0IrV91G7vUT2l3aLCEbkEJ/P X-Received: by 2002:a2e:a7d5:0:b0:2e1:5684:8fa3 with SMTP id 38308e7fff4ca-2e51ff5ce98mr46429521fa.22.1715461319853; Sat, 11 May 2024 14:01:59 -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 38308e7fff4ca-2e5136f95c1si14992331fa.380.2024.05.11.14.01.59; Sat, 11 May 2024 14:01:59 -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=aU6GeUyd; 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 C8A1468D864; Sat, 11 May 2024 23:56:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2045.outbound.protection.outlook.com [40.92.89.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC52A68D862 for ; Sat, 11 May 2024 23:56:42 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0WX8RJWyx4Y1QUgmVJ6pz+jUEW2u1pkQsRbjjBWGOkyL+X606WNREk+MuX+1ac9oGwJ5d8psvLvsZTYS7RWlS60CAwbSDZLaqbHDnw9z/34kq5gNHFTAXsVaxo8m6Rao4tp6EFCWGWfzc1LMUbweA2KNcnmBMFHnosJ6qhQ35LwgU0K8l1xjbMvTwnLldrko9GEvcNmHzxa6pJci88XTvWmGb8c/7KSBOy12KhXbg7HbI4AUQe3AQ+DnlEH68yvTKyhUWgXkmvGsuAmlbj8nzfPtmHvZJpw0jc0zO0ityLveS0mV3xAsV61YOhj/IReA9vfiaGcBpciCSwtYDyy6A== 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=DzUuRoKvMK784glWYYhDXbMYlNHncoLWO/5GJrV3vm4=; b=i87xgM0aUyD9q4EA2yxN6a6IN5uX0+Y4Br4Yxg+LGeAjaVmsuW4i2FOKYfCWoOsB5nWXNHHSz7hZ1XI5Q2op78UG7p4CvS2pUClRB2DmSykNNCy3I1axf4v3+BOB2+j/xonmQLxCknpZSYZbhZ+cDpzrLqHQNMeROr9vTSKFpEdiautsfouPWcHdfIpy94X75sSukLTnA6tnfjg/3aDCBUEPweQG6eHEOcSIg1em/N2nkKu1nZQGNO+6jkHlPXzPuEw0OZT1OX1eLZ2Ncn3oxkty2X24rA6eICJu2NAKvLAjmcFPTEt0OB8rx19RtUnRfnIUOrF4hC7S14hEcttXoA== 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=DzUuRoKvMK784glWYYhDXbMYlNHncoLWO/5GJrV3vm4=; b=aU6GeUydxuG0ylI6KnxlVlfigg7MwWpmh+fZBpvsBXUTbnymoAmn6WSg0vjXbPQHXcgK6Ze5sOKYqqRA1GOJ0N9Pfd7eQ/xIuYXGsjpCnRUPDxdUDh3ha8VWqP3ohWMNY7CrwOYBnuvAtoCA4FNtRs9H9ZWIipVCdv9BaNYdK6xp/Z2BjcjKqdS6Forp90CA13d0n3Vfb8T8d7r23k8nQ1nxiXKi3rLCBif3ybqYPdNxdMW8Kv/HFKCGCRg/ZYbQGnpZrVHD9OIJ2Hi7oN4cnyNnhGtOE6xCI0NtnuuNivPEmnxGZ0skgHv0DRfvgdXdZuXQMQQuizBtgy9zBI2XIg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AM8P250MB0074.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:41 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:34 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [JRuewSxvVKNgRSfAJ1dJMzF6yD0lVgjuGr7LPStkmTA=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-69-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AM8P250MB0074:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c999b9f-a216-473e-7f54-08dc71fcdb6d X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: oGEScgQ5X4/vwbY5tW0JDRItrbk2EWWcCD9czQP8OguwgJAWGiWTYXVcSlOsadOTz8WxUc5rVunUSKE0xZv9MRsnbwfZ+ueodAmc1GZ0SPCAnR5JCJd+e2Nee7sGK4aaPpmoFRH+TqaWUfVpV+pLVSxhPV701RL15gL4UpJYTL/AK+eTsrMZhTlY/G+Dg39JuYnkdM5mvPi+i6D5yQBntRh9LvwIyCZVnNmX7XwQYCIZQmiDtnVHPO5HnjLDkWYVtu7wuoMhRyWhD2h604PAQpLbxoT2pJsvhxWGrPbaR8Fz8kImkfsx4lX6t8n2Izu1vm8uoP2tFYIQUDVNDH8n9bQUYXm187cHRMW/2qmaCsLOd93BSRb/tanBByPKqGq4sTv+Q76f5DtwlCVxV0AE6oNHUniBV8SZOhtwbWo4US7EPJowRLNL6UTKU+FuKGrYMQyyhuoPEh2p4ZO964VqaFbX88nNowqu/9yYwppAiSde56Gm7c0Jpe/V6zrxpwQM+DmO2qh54SoVBjzkkU5VuoFzbVdNBThHtynKWCpfKX0JDoo2sKdZcwKvzoXq5qRm489Vfk13teD4Qi+p5hDG357QZL6tM2BPqwmh5XYCm34UtKmfi56jASbR53f262kd X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3bSqKqHA7hGB9XRbvZTlnkUMS7LT8DnehIQ4G7jy5tCGXZM/iupP90y9qEOgCDtyBmQI//cAKCxBqJXTWRNzGo1LWWeOpodECsdVaWUBdDKH+0AWO96VE8izN0e/TLxKx/SwqIWnuzPkaDGJGykanvxB8E2XOuNHiqmkIwOfrU6vhuZcbO53ToQhK/SbJxvc2atfV1rVpJ5uieN+Mz8LayxijJGGCo29LNOdbgnjZtvlg7YDcuEJwrHZExrNaA4/5XsLcGE8axirOsRHoolZvQkU3PG2qT3Eqa23BPiKu7hiUzO0rPkJL4QHlV44Q/1X9eenm9vRKSfkE5iIntFcBTneDTxXIc7IGOMAnMZcRWg78XibxY/iM/wbr7nu8fE9v06n+6nN0x656cdD7T1zb+K9nVyaWajkZiWRxch8+IzRH9LDNGv1okjfWFD+j7IUZ3fsKW3A6MiufTkk2jXoWnSnAa3JcxbVGXHEYlm7DhRt58VZoHVMILxTF7r/XCjqnROXHc8vS4porT+bYU0A9OROQ5ao4FecgNdAjHRFnDM7dQ4YoUj+wAn88fPRGMduiW2AiQVf3vj6UU+FaRtC8CW99VzOVBL0IPrnim++SeCWFeMrewfgsG/kYLoYa9b6p7xk8uEhiqopKwupoQwbFbWX5XFeB75zOAumkulnpf9XrMTQsnx9wVS5M1NQeD+DC7NXI8JB9LMbQEaB/Wifn/0E86xHv0i4nKV3db7a8tjczsXGGyGs5JTjlar8SXG9UhmwiKn3WlY2V7LlYZtEyJbZhlUI32L2L7omS8eRKLfVuNIVAq0m69hkSL1qr51evvZoYFPQj6pmKnUnlbNEESlsE7GPjtWqMJkT0g2tZD1vXMEMMXEj7aLqgn7l2gKPah56qC7QCKutmtfCIiLZt2hhhWvODMdW/GQBiS38pIqclQqPnDeouAw47fTNxqvUE44tRcwDXY22cvWtk1sW+9D5PUDdlxLUXF0os+Am1qTosWqKmDAZnjBw1jQKI/uulSFsGgM4oX45CR1+WPdLTtYL3odFjo3IKWx3rcuNK4/UF/XPRh3LwMRjtZeXvfEWU23K8wuzwqpzJoO/lUy28RoBTBpEe85O24JuYZ+mnUhAQbZl+hlMZL3/hTx5ehsbF2yc3sXtULHx4u5MicIwpH3pYpqtt+6hKv92XEMoaW5Ac+FmrQ2cIIuiDxUjnl2zZNL0rG6sULqh55JLbUXtvF+jAJB6YFZaB7XNKUbY43iVNmbfsgcnCPbnOt56woAE94uNiy/FtlpGdhzGXa+mVQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c999b9f-a216-473e-7f54-08dc71fcdb6d X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:40.9669 (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: AM8P250MB0074 Subject: [FFmpeg-devel] [PATCH v2 70/71] avcodec/mpegvideo_enc: Binarize reference 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: x0j+IgzQxjPT The H.264 decoder used reference to store its picture_structure into it; yet it does not use mpegvideo any more since commit 2c541554076cc8a72e7145d4da30389ca763f32f. Afterwards commit 629259bdb58061b7b7c1ae4cdc44599f6c0bb050 removed the last remnants. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_enc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 58f68ef5f3..401ba8ca5a 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1639,8 +1639,7 @@ static int select_input_picture(MpegEncContext *s) if (s->reordered_input_picture[0]) { s->reordered_input_picture[0]->reference = - s->reordered_input_picture[0]->f->pict_type != - AV_PICTURE_TYPE_B ? 3 : 0; + s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_B; if (s->reordered_input_picture[0]->shared || s->avctx->rc_buffer_size) { // input is a shared pix, so we can't modify it -> allocate a new From patchwork Sat May 11 20:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48790 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp300649pzb; Sat, 11 May 2024 14:02:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVjJN+ehMCKyCqhbtrLLmieXv2tvSXVPVDnjj22LpT7Ph0yCquOXGqw0uKVDetG7wJ6sJlLmo4RM+PHDGd9lQi7G+iSs8/zv44APg== X-Google-Smtp-Source: AGHT+IFl1mxw6DVepE3pGK8cKgOb74eTiGigIPkQOicRNHRTVuy8l83RP0JjfI7WouXPPtxPAOje X-Received: by 2002:a17:907:980d:b0:a5a:5496:3c76 with SMTP id a640c23a62f3a-a5a54963cdfmr140509366b.6.1715461327731; Sat, 11 May 2024 14:02:07 -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 a640c23a62f3a-a5a17c2c830si315809466b.971.2024.05.11.14.02.07; Sat, 11 May 2024 14:02:07 -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=Wx9F70rv; 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 2905568D870; Sat, 11 May 2024 23:56:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2044.outbound.protection.outlook.com [40.92.89.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0B6B768D869 for ; Sat, 11 May 2024 23:56:43 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L+JvhRH2O+NVv7QvfV4bQYnnjWMUhxbwNonqzjxrrMhe7Dbx9g0274JzL/xifSXLABZpy0S77g8n3YK0oWV+4mwSLiC4BYBIp0a6ZSd3xu/N5l3LTSUv6L9RoKsvte2jQWIVQJwdmA07aiiTAqV8dWl+whMjHebSzpLrM3AYfYWpJ6x7HqF5ILwp/qO54R++nXKWlCRYZuNEljpyPeG/vPOX+XXoEIjthKynWRw/Z7EuESkSEjMMhvK0LNv04gtg0daxUepjcyWgtiI0L6a1qpTXY9z1wzTj8pzKWU6VIIE9QaA0b3yXt49Oq7e1PQybwADkG6t01uC1AmadvCISrg== 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=8eIvKs6wV9Ghn2lrwytod+snnNPoYK4usjZYQLDOIzU=; b=DDpGMGOYazSDICm1R278m6w9bo4KtYihIR3gUkALNu1zWq76Kht3nw6Hrkiz2p7LvGUOKapOsBYeBtT0t4eNNwa1dFFs4hVYw0KqSVJ/4pHHW3bykH+EjT0D+vLt6eUHM9Gk1iQydSiP0+Yw4wQ9OaDWc0ECOgGi8nr63K/h/NrT50VgBHe2fGO7/wYoVa0Wc1mijSjhrjGLxfWwa9mYBjl9498JV7TnxkpB0o9pRcgNrXyHg4fvXQIOB1WfUfANh0tln/MZ0DC6g0dyt+EZxcsYts0nVVTeUq5wQT549hofZnODQapcJtJibiqV1H+m+yxveXAFI7OXAoArcbwDPA== 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=8eIvKs6wV9Ghn2lrwytod+snnNPoYK4usjZYQLDOIzU=; b=Wx9F70rvbvju8LIKZI++tdlj9sgDT1wmkYLlgFdf9i9HUL5B2EG3rJRiTUBVy8aMjvGgmFQnX6/TV/FACu1LK74r/W8iB0rWEmgz3kX/NiJEUUeaFkGV6+afFzQdLz9xrJ2MhkiwhCexzLfTKYhSL6LFStSaiQVT27Ejc75OfrtSkHU+lqQomRw8lXt5XDtcTI6OqNqgFYi4YTTuGG/F7LILBxNgPtu5NYRo/7b5xwxs5tSzIxnVJmYj3d0rtz7gmJCJvSRFlm9CWvD7LI1qeH92U9vOKuh808W7IgzCfw9QtjC0rv0WJZzceJszSE+q1ho5HilsjG2E/5qK0ciQpQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AM8P250MB0074.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:36d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:56:42 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:56:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:51:35 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [CiEiXoTcipSc5/4srZnhtwjo9eDMCAvRtHLF2DKPA5M=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-70-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AM8P250MB0074:EE_ X-MS-Office365-Filtering-Correlation-Id: 521d649d-c68b-403e-a937-08dc71fcdc3b X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: NKkBzoo82umpixrBbSyW3JKsMF2+o+oeP7MrB/ZJDz2cReRoo6Ld2tx3bzWjESuhg+ypWMbeDKa8ljCpeKt+K+BaD+NKJG9WGfqmbCNgULkU9qjCTPzGhTfhKMFmt01vy/cVn3SoHMFW9DrcDJUKQ7mpFGLl78V5quWrWy9hGUbULX3033LrvybUPPxBKNgLQR9LHNGk0xTZgHMoAy6bg+KnwB1YneHrcfBB3AMn1ZHcpSrwiyor9g73e55KVfn3mBjWYomf9GEfyX/rIG04tyZa4CeqXLmhBrES17TY7S8p+nfPj23lG4qMdtfYmbJqgGDx9M9khGxle1E75sO8ncQfkOnfMUu2duVuWBUcBeed7HLjyTFoOfGediLMC8QDigzmv+h9VDiPt4sRRaLDZ2z7nh4TBdOkYipa8bDrBbK+ceShIGH5lDeVUWcuFf5XE42aa7c9EcjBMJmfLoDIVFCQs/X82rYfOUtmyBFr1jQ/yVZ8++Od9Uzr4jm3L4L9XDpGsO99BMLnZtCvPeoF5RGluIcRR1+4fFHzblGoLmEHDqCh3P4OtcPHxnWMqg0lDUubbi/EhUketOWApb80bCFQQoeC0no5gmg94RdpmajHCzL0JbVfy2k4KnyYAGw0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Myo+e0yfSLWVYGJO71Xk6gGs+wWhWkgRIS8MMxmr4Ywv8MVTh/nw52/Q+xFwxfc2coqcf2unzo4ZaIQN0FtRXiBAtx2xrVhZyg+MZ4tM14bUrrXV8C05/44vnwM2PmxOuRV63aNcouz5bWZtRj7fbUufOZ80yt/lqH9+qV3A7N/QOEcuRuAUQSlFDofoxjODkxQVWDIesuHZ8ipUmZCPAprcF+N9uIGn/rAakDb0i5BFBSy4pI4/iuJjYz6X1mV7+l9d9brj3dNfo7jNYbAExYOOk+eh3JwHIq29OrT+LwtfQNwnYCZK+ItD4ie0U6Hu+s9WgTHkETjZRU5bqk+l/F7NTNYPzrZOHvDrQxQq7Lrg+5raIRbRPWvQsddDwXQvWPpi6Twc+YtlVSbmdTPjfegbaUSr0P+HE9sSL4ovLdlzGCFkJBQD2FDHZ3WdVJsC9sRnrxrIbBFeLn6GpvisHjTRqUUZV8fMr1FRmzsqTzuGyqqXl/cp69gmRRxr2EtdDEklS/2w1aEt0fwmUGbkdrezBf08hOkeSYEXUodibGYNpqHrK2hl6SsS8W6I/KYINZUYhIYayK7a/Ddd0UUrIwo5+sJmqCdwcX1wtSi6+bLAz4BDXOEv9g2KgiEp3jL28cCfyGGn9OoRFD37CK7lgl004dNSZ5LD2O4wkFLuAj4ra1/EOAekwOw8KhQZdqBzxjjEzOCOyOkw9SVfBAaSzXWq66yg0+9suzAYALr3XtoIhJ+3gHsRgmwfoEDj7PPS5J+RXdgMkQpsjdvruz/JQmmMwIRg1gY1RvoroEWJEfI0cnfitSqzFMBbSEL7pkv9hpKXUHLwwSpTl07TaC92lfcBgwkcRMMHZTNcouWiWPmJ7b0l9SddpqFmi7OaRel+TCfkRkcqGTihiXuSYaJafss5FVyd0TcNHMozTKx8v+K1vhQ94Bw3oLpGuz34HyJ66tkdVgI8qk6XrD9hHfeanQJ4HL99b88lJispZkeCN3g5BQ+tJ99GwS0ITeKYMPnXlYx+h2fwEw5iUIOhCWH2gQHZwOM2FBwWJ7IQT1pidWc56dB0fm7UnU6eYHYwpiRyiVbWHxtnylatplHMfuLKT12EFuKrU6gMcGQps3TPc01+M2Ho5Y7Gz+KJk2AaA2mpnpKUzaUPuKYI+Fjp1Ur+efEGv6ydoGedKOwo7r/+RvRU5nT55KcMtfDRUgGOXkkWc40A83i88nlTI4bDiG6LYjjWKKsYfzOSBUa+lhEJ0pvX1ysVtBx0GHR6NkVAnTxj+gcEtEpMR2GfsH0b5BG+jg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 521d649d-c68b-403e-a937-08dc71fcdc3b X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:56:42.2798 (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: AM8P250MB0074 Subject: [FFmpeg-devel] [PATCH v2 71/71] avcodec/vc1_pred: Fix indentation 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: uhxy5lAP5ll/ Forgotten after 41f974205317f6f40e72c9689374ab52d490dc6a. Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1_pred.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c index 6e260fa053..87d9b6d6dc 100644 --- a/libavcodec/vc1_pred.c +++ b/libavcodec/vc1_pred.c @@ -719,19 +719,19 @@ void ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], s->cur_pic.motion_val[1][xy][1] = 0; return; } - if (direct && s->next_pic.ptr->field_picture) - av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); - - s->mv[0][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][0][1] = scale_mv(s->next_pic.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][0][1] = scale_mv(s->next_pic.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample); - - /* Pullback predicted motion vectors as specified in 8.4.5.4 */ - s->mv[0][0][0] = av_clip(s->mv[0][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); - s->mv[0][0][1] = av_clip(s->mv[0][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); - s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); - s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); + if (direct && s->next_pic.ptr->field_picture) + av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); + + s->mv[0][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][0][1] = scale_mv(s->next_pic.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][0][0] = scale_mv(s->next_pic.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][0][1] = scale_mv(s->next_pic.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample); + + /* Pullback predicted motion vectors as specified in 8.4.5.4 */ + s->mv[0][0][0] = av_clip(s->mv[0][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); + s->mv[0][0][1] = av_clip(s->mv[0][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); + s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); + s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); if (direct) { s->cur_pic.motion_val[0][xy][0] = s->mv[0][0][0]; s->cur_pic.motion_val[0][xy][1] = s->mv[0][0][1];