From patchwork Thu Sep 22 16:42:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 38152 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp445844pzh; Thu, 22 Sep 2022 09:42:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ekPuTH1VTUOWVbi/sHOJDWzNA98B9dOOI7+Axlqa3WMt4InmLDYs2npagibeKS6TykaG0 X-Received: by 2002:a17:907:7241:b0:780:1475:63ef with SMTP id ds1-20020a170907724100b00780147563efmr3476046ejc.391.1663864976938; Thu, 22 Sep 2022 09:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663864976; cv=none; d=google.com; s=arc-20160816; b=kb8Szagss2teWkoWerbDoFitFAka7lyA/uusKRUtfM3i0S8uOU8gLohRnTXmrMRDoi 4Ej0PAY28tTTndDp4bF8jQmnahSqqPTh6jhp+PVI47NS/J6oyRABttQOiRPv/kZrgt9E oF0A6kty6CDWBLwqg+keqdF07UeXUWruejYsjxg+q76lraH+tgfv80qY6MP3vW2C/OH4 dCbo/nmYA51GkWvbb+jqYvWA3PD/zJJ2eAnF66SwWwNEBD8FJDPsJ0QNr2t+y1YTGqhE 5514N77c5ybSGgIj2BRB/QG+g/5HfYWHjyHzeFoQqfzIWbDITP7NddA+Q9eBPG9zpzx+ HVRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=Yk8W/qTljAn/2HlFHdiPRRb6hmikI3JktvR87AGhW+M=; b=GFzevL0RIpAjh8SiutRVgkrX/KbHX8SNy2OyD6Najz/Qfc+6az86NkjcsqLdMSSAOv X+maLX9CjPp1Boez0wl32qUuC/w1q+VlzKnJyZNEVPRBDt5LB5uKLOTcLU07eo0arLqT 2rolRi5YyKlgV7fcuoi5vciOl1E+XW2/mHXSvFZ0xcVBGwyc+esNUYDjApvbkxXULL99 TjwnBy7bOf8XbTe1q+IFTP6v6eRReALBH07RgT5R9wtDi1lK4RAme1Hx/OOHz36g2N59 KWFCGyIVvEQ4k5iNTtaG7W0pUngy81LZumJ7JTPk52YXQCrYbjEYuN6hB+fDqDcfG/B5 YoyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=GV8UDbxd; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h22-20020a1709070b1600b00773db392e1esi4617558ejl.997.2022.09.22.09.42.56; Thu, 22 Sep 2022 09:42:56 -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=@gmail.com header.s=20210112 header.b=GV8UDbxd; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8D3E768BBE3; Thu, 22 Sep 2022 19:42:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9213668B6AC for ; Thu, 22 Sep 2022 19:42:47 +0300 (EEST) Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-1278624b7c4so14652936fac.5 for ; Thu, 22 Sep 2022 09:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date; bh=AombSEkkFVpG5wMEDIeWyGh8wvihXEGRT56JZmIUbrc=; b=GV8UDbxdATS9wF52+IqQXvScFpY7VLgwevrubj02IqdKf5Bqrn9fUbegnOuLp+L/Ya 7Rpn61gfdyOz6zmurp0FUJ727U9gmjLY2Uxt8vyQmbRSLYgsC3vJDIXriIRK3j27KX1H JVI99dwAuQ03ppvGO1ZNUH0lDLNkhI8/f/7vnNS3+tfIuNmKJRAXc3yuaW3he6Bk4eYA 1cDEuclp9+J99m6AEPJ1WidjX/K6HMtPLsIq9nN78YX0BxD9Dkw/a4fr5T1/HPrp+R63 rK1Sjo8UQfrRDMSwzwQI5WC11qQDv91pBx43bhng6Jlsy3VQFgTXYUTnFmICJK8aChAD sWvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=AombSEkkFVpG5wMEDIeWyGh8wvihXEGRT56JZmIUbrc=; b=65AB+0rdHqkm596U3Kt4FGDWZMXe4Z3JZPsm6N87QXWFYqGlzMi+Uxw2V1KJDBSYMB 7v8Ovc24+ucd5f3HGFdNCVrdozLYvo0uwe8epROE+ovRNjB6XO3oYjfzZKpA8w4cTCsH DJvzuGtKCZGcH/oX2ZYw45HZo0AOywIaV8SfrTRFDAwgmHERuz1+T1TThj1qxDhmKwd6 Qk0O8izp+CBU+ZNQvrmtlCcRaECPAWx38y2GS2PbdQuZevxvtiVozJm2CBuqojbXVzO1 xP/oyMgFJhmbmsLyRbDkhzUXfIvwULiNUeFpj43oR5AyvEOyVTYoZ7Q+hdJl3KfDitgV Gupw== X-Gm-Message-State: ACrzQf1CSi2ThtKcqfT56Rjb7nr2uqqZ/yiJOBl2nymWsdhcDDn5CKE1 LoaKNVJ8ghqPt6y35QkoftIRRnczWyk= X-Received: by 2002:a05:6870:6490:b0:127:c6b3:c35f with SMTP id cz16-20020a056870649000b00127c6b3c35fmr2438200oab.34.1663864965609; Thu, 22 Sep 2022 09:42:45 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id y15-20020a056870458f00b0012c4bff351asm3422660oao.43.2022.09.22.09.42.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:42:45 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Sep 2022 13:42:18 -0300 Message-Id: <20220922164218.4137-1-jamrial@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/lpc: use ptrdiff_t for length parameters 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: P0lp85YIl9Vl Signed-off-by: James Almer --- libavcodec/lpc.c | 4 ++-- libavcodec/lpc.h | 5 +++-- libavcodec/x86/lpc.asm | 1 - libavcodec/x86/lpc_init.c | 6 +++--- tests/checkasm/lpc.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 4885d5cb06..8603bb9709 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -31,7 +31,7 @@ /** * Apply Welch window function to audio block */ -static void lpc_apply_welch_window_c(const int32_t *data, int len, +static void lpc_apply_welch_window_c(const int32_t *data, ptrdiff_t len, double *w_data) { int i, n2; @@ -70,7 +70,7 @@ static void lpc_apply_welch_window_c(const int32_t *data, int len, * Calculate autocorrelation data from audio samples * A Welch window function is applied before calculation. */ -static void lpc_compute_autocorr_c(const double *data, int len, int lag, +static void lpc_compute_autocorr_c(const double *data, ptrdiff_t len, int lag, double *autoc) { int i, j; diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h index e1b41bfd9b..467d0b2830 100644 --- a/libavcodec/lpc.h +++ b/libavcodec/lpc.h @@ -23,6 +23,7 @@ #define AVCODEC_LPC_H #include +#include #include "libavutil/avassert.h" #include "libavutil/lls.h" #include "aac_defines.h" @@ -64,7 +65,7 @@ typedef struct LPCContext { * @param len number of input samples * @param w_data output samples */ - void (*lpc_apply_welch_window)(const int32_t *data, int len, + void (*lpc_apply_welch_window)(const int32_t *data, ptrdiff_t len, double *w_data); /** * Perform autocorrelation on input samples with delay of 0 to lag. @@ -79,7 +80,7 @@ typedef struct LPCContext { * @param autoc output autocorrelation coefficients. * constraints: array size must be at least lag+1. */ - void (*lpc_compute_autocorr)(const double *data, int len, int lag, + void (*lpc_compute_autocorr)(const double *data, ptrdiff_t len, int lag, double *autoc); // TODO: these should be allocated to reduce ABI compatibility issues diff --git a/libavcodec/x86/lpc.asm b/libavcodec/x86/lpc.asm index 731aa7e2d8..ad74f1d8ac 100644 --- a/libavcodec/x86/lpc.asm +++ b/libavcodec/x86/lpc.asm @@ -36,7 +36,6 @@ SECTION .text %macro APPLY_WELCH_FN 0 cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2 - movsxdifnidn lenq, lend cmp lenq, 0 je .end cmp lenq, 2 diff --git a/libavcodec/x86/lpc_init.c b/libavcodec/x86/lpc_init.c index df77c966c6..f2fca53799 100644 --- a/libavcodec/x86/lpc_init.c +++ b/libavcodec/x86/lpc_init.c @@ -24,16 +24,16 @@ #include "libavutil/x86/cpu.h" #include "libavcodec/lpc.h" -void ff_lpc_apply_welch_window_sse2(const int32_t *data, int len, +void ff_lpc_apply_welch_window_sse2(const int32_t *data, ptrdiff_t len, double *w_data); -void ff_lpc_apply_welch_window_avx2(const int32_t *data, int len, +void ff_lpc_apply_welch_window_avx2(const int32_t *data, ptrdiff_t len, double *w_data); DECLARE_ASM_CONST(16, double, pd_1)[2] = { 1.0, 1.0 }; #if HAVE_SSE2_INLINE -static void lpc_compute_autocorr_sse2(const double *data, int len, int lag, +static void lpc_compute_autocorr_sse2(const double *data, ptrdiff_t len, int lag, double *autoc) { int j; diff --git a/tests/checkasm/lpc.c b/tests/checkasm/lpc.c index e072599908..da5364def0 100644 --- a/tests/checkasm/lpc.c +++ b/tests/checkasm/lpc.c @@ -38,7 +38,7 @@ static void test_window(int len) LOCAL_ALIGNED(16, double, dst0, [5000]); LOCAL_ALIGNED(16, double, dst1, [5000]); - declare_func(void, int32_t *in, int len, double *out); + declare_func(void, const int32_t *in, ptrdiff_t len, double *out); randomize_int32(src, len);