From patchwork Tue Oct 6 00:17:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 22734 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 4E0E944A987 for ; Tue, 6 Oct 2020 04:11:48 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D10868B534; Tue, 6 Oct 2020 04:11:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4676C68A173 for ; Tue, 6 Oct 2020 04:11:42 +0300 (EEST) Received: by mail-lf1-f65.google.com with SMTP id h6so6346605lfj.3 for ; Mon, 05 Oct 2020 18:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=WQPv2+cWcli7wuZGVv5u/KMdgxfa//yozY24jnPeGhw=; b=EGPrTlRMumB0T682zFXDf80dSJVYgs/FFNBh2/MYeQqzH3O3e8HglDufWfz0nmOvwR qAh+3NRwRhQXzr3uBhnwX3DcasIu/qrECsP4cE5Q6EZcD/PM9jdUIjczOwlq6VaUrGJg o4jGEpD7iBjXh6GrekRxKBxusB3R4FXZfBMuea7rNeFrb7aQjN8md7epvika0Qs2Be2k rHI4TlnUB2RwYUlTmOrUXEVY/p9jAoRbT/D+5WHwWi8G7OqfxZJQLUuIKpLzE9whk9OR 43dWZAWL98stBMHTubetGADvJ9K1EtAOdRn/hTE5iFB4DyUghHCifS8MG1MRtWmalet/ OJYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=WQPv2+cWcli7wuZGVv5u/KMdgxfa//yozY24jnPeGhw=; b=jXV/ZOeMptugVMeP83CoMJLNAMmDRQyJX86iIylzmtOJD/GwdKxrlesds1/T6GTvxO 3HVozrI3IFM3ojtNmNdnrXdolBo31xvC3p/vrw+QFCpDP2E1opQ8ZCpU8kW4W7ulauzB 7f7Iwhh11Wpz0VTlMHlIY4o+y+feqBD8oEln+dxSj9yhroTqEBou7bYOGZZGZhD8mnUo HoKcY9K34TurIXHbcRIc2Zi8g3/sTAFNka0HoSCn7AeHT/4JRfbL7biRTVQjtSmFKrRM a+dIDYtLqF+sNqhZsAoj6z2B5ROtzuciKj3Cbbleyd0OQsBPu3TG2+yDqjTIa1Dl+q/Y +6Xw== X-Gm-Message-State: AOAM5328/zlRrkjEWtT2iLXlhTwkULdqlAgqigCXBwnlF8WlkIiH71Ir kwgXm1DmczR5qe1AtPjpCTOTDufZE6x8TA== X-Google-Smtp-Source: ABdhPJz8d/mQGhKlIgDVuE/LAfnKUaCA3DpEvEvH7gFxcy/c8xKWlhgiBvRHdeQUJkei7zUlpi2PDw== X-Received: by 2002:aa7:dac4:: with SMTP id x4mr2388395eds.165.1601943447054; Mon, 05 Oct 2020 17:17:27 -0700 (PDT) Received: from localhost.localdomain ([109.227.55.37]) by smtp.gmail.com with ESMTPSA id q12sm1017137edj.19.2020.10.05.17.17.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 17:17:25 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Oct 2020 02:17:12 +0200 Message-Id: <20201006001714.19577-2-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201006001714.19577-1-onemda@gmail.com> References: <20201006001714.19577-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/apedec: properly calculate and store absolute value 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Paul B Mahol --- libavcodec/apedec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 273abe2490..aa4d8fa524 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -1311,7 +1311,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits) { int res; - int absres; + unsigned absres; while (count--) { /* round fixedpoint scalar product */ @@ -1335,7 +1335,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, /* Version 3.98 and later files */ /* Update the adaption coefficients */ - absres = res < 0 ? -(unsigned)res : res; + absres = FFABS(res); if (absres) *f->adaptcoeffs = APESIGN(res) * (8 << ((absres > f->avg * 3) + (absres > f->avg * 4 / 3)));