From patchwork Fri May 21 09:17:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 27867 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp340724iof; Fri, 21 May 2021 02:19:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5ioQIizMPbiVWm2gBeEi0BpHjnfVXYYID+rYGMUGMC+6S+OhwA4v1U76Anw9E89dy1ODe X-Received: by 2002:a50:a446:: with SMTP id v6mr10251372edb.254.1621588793047; Fri, 21 May 2021 02:19:53 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i19si3403794edc.501.2021.05.21.02.19.52; Fri, 21 May 2021 02:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=h6l7gBpd; 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 B2A9E689CE2; Fri, 21 May 2021 12:18:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-oln040092065096.outbound.protection.outlook.com [40.92.65.96]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A814A689BDB for ; Fri, 21 May 2021 12:18:15 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCT+z6NA5527lABfjcvUH1uMEdTG23OHud1HO/eH0nhbT9AhPEblgmwrKxKvy1f+oRxn3qg/PutjOzynOMgCk6PTF1UQEYqbZ0DIuuOv2aFb+A3ANy+uJzsrWMYc6VpJlud7MUtiWk4STAydT6HIgxdkRnUt4iEa1By25Lho4fibwKGb/h6I3SOYrH3EA24BDzgZAicu2UlyJLrjQOqvx6h+OBl0kpQKXWbk5+5iXDPVTAopApi8u3cW3rUbRJAaGthGlGOjDFhaC1XGPJ3QmVEWlt6xVo8vqaPcXiYQQQWMANx85ZzIdwAVQ8TRVtl1SFDfDnUQLBIDFb6UiDiAjg== 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-SenderADCheck; bh=b3tn2M4Wme27iwdu6QUHbfXRrAc2vWMNn6pqcZr7O2Q=; b=oNSj1fN/1FNTbEApD/UpWfeuOWlSlYGVvlnY4Vm6oi8W8586T3wZqn8yylB57lM0QoSsr1GvK0q42TshfltjLOpXMT51SJjwabKVbqCB9jpUyHKDWmKYq3rPp/oDhKqzsfzGVJFTSk2d7E25MadS0JClhqYmZbLDlmWddyjajToMoc09OH/niBAPEkxHKIQnK6tKuv4yvGULqmAVIBg55fif0BvYrf1thbxYlc1xbkp+euSp+ZCCV+bFmS+GFX+VNmOuYDUABjsDitNRWX7JTbSJUyOAPBaqe2dMrbsmk/3ULQ15GNqnYgDKdI8B859Qf3Em+fRFrOmx5x2jGO3Npw== 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=b3tn2M4Wme27iwdu6QUHbfXRrAc2vWMNn6pqcZr7O2Q=; b=h6l7gBpdwS6wy19HF77AsQeqlcEBDaOrbMaGVBfFD6wZB/8/fl2PY/y2x/T5wImGe4am7oWtVRqHU5Nzqg33NWlvUkBvJ33tJRle7e89UUJtyNXnwInvF7warNfVBOGLRB5Qymdpcv4xy8sqCu9IiFCwaRQHPqxq6qHz8ntD9lgf1abezPYvbPQSqEZpvx10WtWigi9QaVdGVS35gYMV5oOIV2fBGIs9Fow4Ye8dSaFfXmH/1N/oF1b3YrWREMzdT52BGKsk7F4hRnTyyNtFDWWtIlFb6RonJ5VH3wl5w04rGoy9xhKbRZzGwQ8Oi27YGlpxArlTGKZWiqc4zVRmgw== Received: from VE1EUR01FT010.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::43) by VE1EUR01HT168.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::432) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Fri, 21 May 2021 09:18:13 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e19::41) by VE1EUR01FT010.mail.protection.outlook.com (2a01:111:e400:7e19::83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Fri, 21 May 2021 09:18:13 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:77D60517C795A4D918F635F4EBE64EEA36FE84CCF79A5927D81A59DAF9C4B507; UpperCasedChecksum:D9FF5FA2F08C82143F57CD68ABDB6A6EDE1C0C872BD6650E30EF5F2A69D52B13; SizeAsReceived:7586; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4150.025; Fri, 21 May 2021 09:18:13 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 May 2021 11:17:15 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [yj747ohY3At5VVrcOKub37mBJcOzQhvd] X-ClientProxiedBy: PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210521091742.184902-11-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.95.27) by PR0P264CA0070.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Fri, 21 May 2021 09:18:13 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 35c99635-0f73-42ae-a3c1-08d91c395c39 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNU/M7M4vrgvBd+IenKLBfauAGIIh3IpHaFq39f49f8fSR/43UHN5tBT34972iD01bTqQsV7T+weOKwIH4Xjw1Ux5B74H5du49vB68WtgWOH8glRnDNmo+YrBaPOUUVnLhNvmyps733z3zyWZpiUn5jBhd4zeDCE2t5vEGPYrAFzflOU6bSfNCe6dvHv2jG3Mrcckand5CL58q0MDbxofPk/DignFgSG2uQrkZk03id7nxqKEQ7p3iTPWCBbSkCf+IkwrrRnrhwT9X9tS5W1mil/LcAo1gfN0EmCr637GOuvb2/gxdEhzXJxnlCf5Ukpr3883uTZ3ersJ7mfGp2vVGuSCjofjdJadM3cFDGsQUECoUxRNFAbLc687x6UvKtXTJlPixcnPnj2rhEaIF2tBVRCUUtzgNx32eJrK1GWF3DgSvlUG/9c3oIk2/YmmDPw5WQhZEySyhizQFErnmR9VFwzDrMHxXuBtn9IKD8EDdJQs6jFPFdC32zawjsk4KXuwQi3vC2bgWFU0CsnkjxAgDyCDpVVaoStMxllLQZA5+qC2/hAojNZEIv/3lA+vw7qeHONl4ZlegT+p6yurTUq6cHxU/5aSmlY/gIv5E9FweB2BSOuxp2GmERyOEpPGun6Nr66Gw4vxq32xc4dHg7fbeUOBVK27PLtNk7qNBDuusORIUvjZ8Tf4SnDvFE76A+MIxERADiqOWLVc/4SZ/tLq1AnfXjXhqFT33c= X-MS-TrafficTypeDiagnostic: VE1EUR01HT168: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9M+HKJRI+Cc6zJHeXaTEAL3SNVJBCjGdilylMZRk4XdZGDUgXBHXwRKm0kFpNDVwbH7Bey+1oCEHtee5DlLp2sFjH8y9PoOH2GHZukMeRorTpfMQKKJEzc/OIeVzCrXyzVmLG3w80VD4gsOvg+YLQPzhb0OwrDGYNSKxOKwXdd72d6v+Kb+nXqSw456i/N0vvGsQQjH+NusYqADXsXSBwts/ks06bIadKyl+N9T8a6KbhNURHsGexOZ/JBYnsoMo1/ggZ+BxkF9/Xq2/puNk+8mvhppMWf7jnlbGHgNjG+0Q4ysJ5/So3foLYDr76VIEkdmfFHnFPE21Md3grpF102tF0YJX29W9RVUog8YpxQyAp3fTeuggfCNFDx+5blMIHhSY9YqUduulzH7SJhTrYA== X-MS-Exchange-AntiSpam-MessageData: vS0FPs8PLZmux5DyObVVyFJe2Pmag91+v+xUqBe1TVJv4pjeQG+5rmnrZ2MV4hlxZWLMf8W3RKwAlNOS8gJwfSBSBkly7bdYd19dpR8VC6WBeQYvnLtIi5V+728GDUNDPHaoqGWrxnXQC6Z9jKfTRA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35c99635-0f73-42ae-a3c1-08d91c395c39 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 09:18:13.7559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT010.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR01HT168 Subject: [FFmpeg-devel] [PATCH 12/39] avcodec/libvpxenc: Avoid one level of 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: 4MwRPvvcJGA6 Signed-off-by: Andreas Rheinhardt --- libavcodec/libvpxenc.c | 64 ++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 2d9e56837b..66bad444d0 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1176,42 +1176,40 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, { int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0); uint8_t *side_data; - if (ret >= 0) { - int pict_type; - memcpy(pkt->data, cx_frame->buf, pkt->size); - pkt->pts = pkt->dts = cx_frame->pts; - - if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) { - pict_type = AV_PICTURE_TYPE_I; - pkt->flags |= AV_PKT_FLAG_KEY; - } else { - pict_type = AV_PICTURE_TYPE_P; - } + int pict_type; - ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1, - cx_frame->have_sse ? 3 : 0, pict_type); + if (ret < 0) + return ret; - if (cx_frame->have_sse) { - int i; - /* Beware of the Y/U/V/all order! */ - for (i = 0; i < 3; ++i) { - avctx->error[i] += cx_frame->sse[i + 1]; - } - cx_frame->have_sse = 0; - } - if (cx_frame->sz_alpha > 0) { - side_data = av_packet_new_side_data(pkt, - AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, - cx_frame->sz_alpha + 8); - if(!side_data) { - av_packet_unref(pkt); - return AVERROR(ENOMEM); - } - AV_WB64(side_data, 1); - memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha); - } + memcpy(pkt->data, cx_frame->buf, pkt->size); + pkt->pts = pkt->dts = cx_frame->pts; + + if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) { + pict_type = AV_PICTURE_TYPE_I; + pkt->flags |= AV_PKT_FLAG_KEY; } else { - return ret; + pict_type = AV_PICTURE_TYPE_P; + } + + ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1, + cx_frame->have_sse ? 3 : 0, pict_type); + + if (cx_frame->have_sse) { + /* Beware of the Y/U/V/all order! */ + for (int i = 0; i < 3; ++i) + avctx->error[i] += cx_frame->sse[i + 1]; + cx_frame->have_sse = 0; + } + if (cx_frame->sz_alpha > 0) { + side_data = av_packet_new_side_data(pkt, + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, + cx_frame->sz_alpha + 8); + if (!side_data) { + av_packet_unref(pkt); + return AVERROR(ENOMEM); + } + AV_WB64(side_data, 1); + memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha); } return pkt->size; }