From patchwork Sat Jan 9 19:19:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 24868 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 1852444ABA6 for ; Sat, 9 Jan 2021 21:20:00 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EC67368A72F; Sat, 9 Jan 2021 21:19:59 +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 C2C7F68089D for ; Sat, 9 Jan 2021 21:19:53 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 6EE731060309 for ; Sat, 9 Jan 2021 19:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1610219993; 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=bEAg1RhIFtTVFD+pCmT6JnWFwT+EIoPpfiD0oBORlHE=; b=VgTC+ztUUkyId/ZzjWaMk0Tg18LRjWZE+qCAYYBQPz0Xe3zTBTpiIOE15BLxqgiJ Cm1oq/WsriSgQ9nCctQDD91xbbWpiyoK1S9xEzEzST571ecO2ZUuEaDon8zAXS7pqth i5Bp1PxSS9beHhBel9lVcgqFUfXQ8VAvobZIWVnu1GifEJoy9VkiPEk1Y2wkW/rrjwE 2VaR/I7M9CV1v4+oxIy+ylvgb2KbCwsiFVEasUvu5Z2YZU9CtfcVkDh0G6CIgR/iDTE RsYIFOmZBxGAIJs8HUbmz6Gbg+cc5maEZLp40TKm9a2S9uU+vy/GsMRueti0/ngqFwD XAlqZhBHcw== Date: Sat, 9 Jan 2021 20:19:53 +0100 (CET) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] 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 2/6] 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);