From patchwork Tue Jan 12 18:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 24926 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 7437144A3C0 for ; Tue, 12 Jan 2021 20:12:47 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5BCBF68AB8E; Tue, 12 Jan 2021 20:12:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D12B68AB8E for ; Tue, 12 Jan 2021 20:12:40 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id DE1341060159 for ; Tue, 12 Jan 2021 18:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1610475159; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=Vk2aNkekASua4tzxjTDa//JbOm4EgsR2BrgXDgWpvd4=; b=eJVoo1yq1Y/yEmjFDKbdo5WpcF8NVKZg1BE7+aq9Vnlrt6WL+/J7zT/e22DnopkU q19/6DI3nacuktqXhqyXKsF/0/hdNRkUevO0cSBTrGY2SGAdwx7w+chxod8BuLDZfKw JOn28EqL/c9UzMy07y6hRukrZuL/62shPD0U4qBB/l7gAvlbLFB2GNrEraR9KxYoeb0 O05TYHRMTxj1snZUNldODmo+znZvB1aI03DNdCcJBmH+iYWzreYPQiMu+tRe71fSjZJ 2TPObJUiXHqKFw5ncAyhjQVukEbwWThQkPtV+hnruV00rw0314DYS/VEEo+ZGwRY2u2 CfBBaO0+9A== Date: Tue, 12 Jan 2021 19:12:39 +0100 (CET) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/5] ac3enc: do not clip coefficients after transforms 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" In either encoder, its impossible for the coefficients to go past 25 bits right after the MDCT. Our MDCT is numerically stable. For the floating point encoder, in case a NaN is contained, lrintf() will raise a floating point exception during the conversion. Patch attached. Subject: [PATCH v2 2/5] ac3enc: do not clip coefficients after transforms In either encoder, its impossible for the coefficients to go past 25 bits right after the MDCT. Our MDCT is numerically stable. For the floating point encoder, in case a NaN is contained, lrintf() will raise a floating point exception during the conversion. --- libavcodec/ac3enc_template.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index de6eba71d8..4f1e181e0b 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -383,9 +383,6 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, apply_mdct(s); - clip_coefficients(&s->adsp, s->blocks[0].mdct_coef[1], - AC3_MAX_COEFS * s->num_blocks * s->channels); - s->cpl_on = s->cpl_enabled; ff_ac3_compute_coupling_strategy(s);