From patchwork Thu Apr 1 15:53:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26690 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6A40844B30B for ; Thu, 1 Apr 2021 18:54:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 46C3F68A6D6; Thu, 1 Apr 2021 18:54:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071034.outbound.protection.outlook.com [40.92.71.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5B067687FDA for ; Thu, 1 Apr 2021 18:54:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MD3jtOQf4wc5rDEagSuvDIV1xqKETLUhA/zMCtEbOptxlrXwRPhQwVYiMC1K09MJ0rOJeghn/pCj90sufhyUHINuFBiS84D1LFJeLd+uLSnkY0UUDd8sbXGJ0u7fhYz2GVVuI8QrpyThnU5LL5Iv0+wd96Rp55riUnyCmr9P79Y0iX8rCZpwOvPDFvtIaELC0WiywaMs7cL2iGO2SmtOS7/Cp4vxkLoYTN32ASps/Ioknividdk3dhBk6J0XzKkeJb9HVD5UEMHjQBO8e/EYQNiqkAJRBzI0fe3YtAv2EfF3haPVv4sK5oidTTppMMUoSvOV0chBjIMYPC+NmCo76w== 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=aoaKD0VBbpxob5y2h4PlXHni/A//dQrY4xvlZzWTDg4=; b=MfC1TMqxISLfXVAkDW82ge+meKr7b4ArxIc+ALpmjx/0KPsOWtWM6eCgpY9mtXkSxRfutc9sa+ohEvL9yMFX5PuiGsBHy3z/Z3X5hWc96uykS53RBWvFupLU6W4Qv0SiZuGUOMR4qwOn8yP5PBf2CKI1ktOPyEngVYJkJIbmwDha8Ux5BukBsNaPWnjAYBoIM08DATuLYheab8VZvHkyazjGxbid003sawQAl/OUCFnflNbvnsn2CbRk8RFPGh/P+O3Zc2vEw4ZZBZoW+5WvHs3TSdJhsnr19Xlc18MlIjiR1uGbeAZqAJZRZ4bscFy5+TrmYhhUsNgVE/cHX80xRw== 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=aoaKD0VBbpxob5y2h4PlXHni/A//dQrY4xvlZzWTDg4=; b=Fp9DwHMrDypS59WIgRiwy5F8FKuVuquxu4Z0ZxfbcRL6Q0DqPv+D0KxYTtlpE/aZ+K7BsQB5n0Wv2Zr0xdbEcsYLgDy9a6p2E23BBq0DIztUHOQ97z1yN2lzlYhCm7oZn5Z4kc/uwNFQPOudwwMQYYDfYXbwD7DLhXOwfkSz+0p78Dax8LgMMsu9oCgt+72BBpzUdPitMMx3jNQSPdw3Onz+gpkLo03473cot4BK7Bbpa7DV6khczftGH8YPoGszjeHH2RSjnO70/V8E32dmUq2J67kbTJ88aL9o1AssJ8stzBWzWwoKh6og6n2319mniGB3N0DwC7cyqg9ovk45zg== Received: from VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::43) by VE1EUR03HT044.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::432) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Thu, 1 Apr 2021 15:54:05 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e09::42) by VE1EUR03FT043.mail.protection.outlook.com (2a01:111:e400:7e09::378) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Thu, 1 Apr 2021 15:54:05 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E6F122DBF55F214B443CAF2112EECD7D3A9F5026E1EA036134D9315120C26592; UpperCasedChecksum:3DC5891C4BEF639A94C5B9F9B7DE556C8EB303EB8962AB323F7E4ED916056049; SizeAsReceived:7573; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.3999.028; Thu, 1 Apr 2021 15:54:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Apr 2021 17:53:55 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [fBvjyIktmZua4bG5jmLAIV4hlgz09NB9] X-ClientProxiedBy: AM0PR10CA0094.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::47) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210401155356.2035788-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by AM0PR10CA0094.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Thu, 1 Apr 2021 15:54:04 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: cf5f6a7c-fd62-44e3-8d27-08d8f5266069 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRmQk3JzeNKq1p0dsiv88hWotXGFf/dlYF8cjouMf/HHpdRQe8bqkyUU2uUwnDqDVw6BWVo5IK4l/d15bS65HvpWb5To0zEtOi73Wphle7RrbfUJq7g0Gq97ldlnFKQX3JfCTWwbvxASFlEjOAGNnN3abFL8N+n67BlxgChGlmAofb+VmO1WZJFt9qQn3K3o0mvbrY18r6xYyv8WG0crdPuiGd0Prxv+gSPLowrYj1EMIgCVTTNxWM3VlMv5eEfijld0oRRbSDBayuQ4tFFuePXaKaAoOJQ6gCjCpAip2dOEu1+I7xXQwJXaAYEhA6i45ZUAmZR7m2hNIWCSuTamn3uGzHLOBe/dO0E8EcshkiCLAB5VlfDzjUNDsboz/nZlS5Nc4EHQzs7NwdllMWhUjbL3XCqNvL1ulv9VqkWCg1rMj/HQcR7tDpv/9MQMLNqGFFdzVVniaRuJPwHRa07t3yPScCBkihr9gGNaAo8dcoRuOmw126zLICUF7APUlFA8sqTRnZvvPH/AfTW6Jk0WdU55swBZSITxLEG0fj4uSJUWnZ4da9CFQ2NfoTgn6ZRJY3nJUQf3ENu2sBHtzUYVw8h8aKxK46cEbdlOX+DTTaTWltp7ZHfiozPRec4EZ3Pjz2SN9X65Pr20pSQyc5/eRET2DygYP09GtQrmmlhIjDGt4PpBxfJcDW48L99Mo8wBenucM7s1H7fozhceTRmkBV8veGCQW8ht/B0p188aJ3U7El1FhpsaoaQkJxL1Qo4UTE= X-MS-TrafficTypeDiagnostic: VE1EUR03HT044: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHdbSaQ+55023Jc7o2tlDSEVPgK3lRPvj00xrsRFybmybRys181wOjuLH1AKfHv1aWokHf41ixD2h5evx7mgPYNmhRSL2tDV5hfU5EHk+ioOqtApPbbmNnfyQnDAY82yVfBVKR9ivOlcnlEZVARlE7Ky8CLIF6t+pgGwry4/GermKvsgB2ayBJ/Ebamhhg1o7HzziH7P7znla26OP26+Uo5lJTPKXO0t6anbaIQdRLew2B7mtWK6e0epmE6TAQlSm6v2ozhF/pWC7aGPPS6P9cyh7ueK2oQotv69JS7cmr6p/LwfMWu/xqT/14Tpvavb+ocqqVLeaLXq6vh16HPqChw7RDOXOTYfSeG7Wu8tjWcJOmOAKg5+kj3R1ZGUjw3zxKmE2ek+N46Qy+aDuj0j2A== X-MS-Exchange-AntiSpam-MessageData: rJMx9+Hn4tVTPNy9UNRkForJ8yj8TasP+HDA8LQUnuV62yb9RT5+CKF/r6kBf85FY0oMiiSWVtelINH6ZYeS67v7GNle0ImApuc0ZkEgESG147OYvXwz1OFxXKZrqmKLw9/drPQDIFX6XE0H7VjvNw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf5f6a7c-fd62-44e3-8d27-08d8f5266069 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2021 15:54:05.0466 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT043.eop-EUR03.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: VE1EUR03HT044 Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/[e]ac3enc: Fix indentation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Signed-off-by: Andreas Rheinhardt --- Will apply patches 1-4 tomorrow unless there are objections. libavcodec/ac3enc.c | 37 +++++++++++++++++++------------------ libavcodec/eac3enc.c | 16 ++++++++-------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index fc4d45651d..e27858e1b0 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1281,8 +1281,9 @@ static void quantize_mantissas_blk_ch(AC3Mant *s, int32_t *fixed_coef, int c = fixed_coef[i]; int e = exp[i]; int v = bap[i]; - if (v) switch (v) { + case 0: + break; case 1: v = sym_quant(c, e, 3); switch (s->mant1_cnt) { @@ -1439,8 +1440,8 @@ static void ac3_output_frame_header(AC3EncodeContext *s) put_bits(&s->pb, 9, 0); /* xbsi2 and encinfo : reserved */ } } else { - put_bits(&s->pb, 1, 0); /* no time code 1 */ - put_bits(&s->pb, 1, 0); /* no time code 2 */ + put_bits(&s->pb, 1, 0); /* no time code 1 */ + put_bits(&s->pb, 1, 0); /* no time code 2 */ } put_bits(&s->pb, 1, 0); /* no additional bit stream info */ } @@ -1697,16 +1698,16 @@ static void output_frame_end(AC3EncodeContext *s) /* compute crc2 */ crc2_partial = av_crc(crc_ctx, 0, frame + 2, s->frame_size - 5); } else { - /* compute crc1 */ - /* this is not so easy because it is at the beginning of the data... */ - crc1 = av_bswap16(av_crc(crc_ctx, 0, frame + 4, frame_size_58 - 4)); - crc_inv = s->crc_inv[s->frame_size > s->frame_size_min]; - crc1 = mul_poly(crc_inv, crc1, CRC16_POLY); - AV_WB16(frame + 2, crc1); + /* compute crc1 */ + /* this is not so easy because it is at the beginning of the data... */ + crc1 = av_bswap16(av_crc(crc_ctx, 0, frame + 4, frame_size_58 - 4)); + crc_inv = s->crc_inv[s->frame_size > s->frame_size_min]; + crc1 = mul_poly(crc_inv, crc1, CRC16_POLY); + AV_WB16(frame + 2, crc1); - /* compute crc2 */ - crc2_partial = av_crc(crc_ctx, 0, frame + frame_size_58, - s->frame_size - frame_size_58 - 3); + /* compute crc2 */ + crc2_partial = av_crc(crc_ctx, 0, frame + frame_size_58, + s->frame_size - frame_size_58 - 3); } crc2 = av_crc(crc_ctx, crc2_partial, frame + s->frame_size - 3, 1); /* ensure crc2 does not match sync word by flipping crcrsv bit if needed */ @@ -1989,13 +1990,13 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) if (!s->eac3) { if (s->has_center) { validate_mix_level(avctx, "center_mix_level", &opt->center_mix_level, - cmixlev_options, CMIXLEV_NUM_OPTIONS, 1, 0, - &s->center_mix_level); + cmixlev_options, CMIXLEV_NUM_OPTIONS, 1, 0, + &s->center_mix_level); } if (s->has_surround) { validate_mix_level(avctx, "surround_mix_level", &opt->surround_mix_level, - surmixlev_options, SURMIXLEV_NUM_OPTIONS, 1, 0, - &s->surround_mix_level); + surmixlev_options, SURMIXLEV_NUM_OPTIONS, 1, 0, + &s->surround_mix_level); } } @@ -2119,8 +2120,8 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx) av_freep(&s->mdct_window); av_freep(&s->windowed_samples); if (s->planar_samples) - for (ch = 0; ch < s->channels; ch++) - av_freep(&s->planar_samples[ch]); + for (ch = 0; ch < s->channels; ch++) + av_freep(&s->planar_samples[ch]); av_freep(&s->planar_samples); av_freep(&s->bap_buffer); av_freep(&s->bap1_buffer); diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c index 356bb677c2..06d4df8f56 100644 --- a/libavcodec/eac3enc.c +++ b/libavcodec/eac3enc.c @@ -193,8 +193,8 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) /* frame header */ if (s->num_blocks == 6) { - put_bits(&s->pb, 1, !s->use_frame_exp_strategy);/* exponent strategy syntax */ - put_bits(&s->pb, 1, 0); /* aht enabled = no */ + put_bits(&s->pb, 1, !s->use_frame_exp_strategy); /* exponent strategy syntax */ + put_bits(&s->pb, 1, 0); /* aht enabled = no */ } put_bits(&s->pb, 2, 0); /* snr offset strategy = 1 */ put_bits(&s->pb, 1, 0); /* transient pre-noise processing enabled = no */ @@ -232,12 +232,12 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) if (s->num_blocks != 6) { put_bits(&s->pb, 1, 0); } else { - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (s->use_frame_exp_strategy) - put_bits(&s->pb, 5, s->frame_exp_strategy[ch]); - else - put_bits(&s->pb, 5, 0); - } + for (ch = 1; ch <= s->fbw_channels; ch++) { + if (s->use_frame_exp_strategy) + put_bits(&s->pb, 5, s->frame_exp_strategy[ch]); + else + put_bits(&s->pb, 5, 0); + } } /* snr offsets */ put_bits(&s->pb, 6, s->coarse_snr_offset);