avcodec/lpc: use ptrdiff_t for length parameters

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2022-09-22 13:41:29 -03:00
parent a2d95928c3
commit c8c4a162fc
5 changed files with 9 additions and 9 deletions

View File

@ -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;

View File

@ -23,6 +23,7 @@
#define AVCODEC_LPC_H
#include <stdint.h>
#include <stddef.h>
#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

View File

@ -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

View File

@ -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;

View File

@ -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);