@@ -31,7 +31,7 @@ typedef struct ChanDelay {
int64_t delay;
size_t delay_index;
size_t index;
- unsigned int samples_size;
+ size_t samples_size;
uint8_t *samples;
} ChanDelay;
@@ -116,7 +116,7 @@ static int resize_samples_## name ##p(ChanDelay *d, int64_t new_delay)
return 0; \
} \
\
- samples = (type *) av_fast_realloc(d->samples, &d->samples_size, new_delay * sizeof(type)); \
+ samples = (type *) av_realloc_reuse(d->samples, &d->samples_size, new_delay * sizeof(type)); \
if (!samples) { \
return AVERROR(ENOMEM); \
} \
@@ -43,9 +43,9 @@ typedef struct AudioFIRSourceContext {
float *freq;
float *magnitude;
float *phase;
- int freq_size;
- int magnitude_size;
- int phase_size;
+ size_t freq_size;
+ size_t magnitude_size;
+ size_t phase_size;
int nb_freq;
int nb_magnitude;
int nb_phase;
@@ -126,12 +126,12 @@ static av_cold int query_formats(AVFilterContext *ctx)
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
-static int parse_string(char *str, float **items, int *nb_items, int *items_size)
+static int parse_string(char *str, float **items, int *nb_items, size_t *items_size)
{
float *new_items;
char *tail;
- new_items = av_fast_realloc(NULL, items_size, 1 * sizeof(float));
+ new_items = av_realloc_reuse(NULL, items_size, 1 * sizeof(float));
if (!new_items)
return AVERROR(ENOMEM);
*items = new_items;
@@ -142,7 +142,7 @@ static int parse_string(char *str, float **items, int *nb_items, int *items_size
do {
(*items)[(*nb_items)++] = av_strtod(tail, &tail);
- new_items = av_fast_realloc(*items, items_size, (*nb_items + 1) * sizeof(float));
+ new_items = av_realloc_reuse(*items, items_size, (*nb_items + 1) * sizeof(float));
if (!new_items)
return AVERROR(ENOMEM);
*items = new_items;
@@ -114,7 +114,7 @@ typedef struct ShowSpectrumContext {
AVFrame **frames;
unsigned int nb_frames;
- unsigned int frames_size;
+ size_t frames_size;
} ShowSpectrumContext;
#define OFFSET(x) offsetof(ShowSpectrumContext, x)
@@ -1300,8 +1300,8 @@ static int config_output(AVFilterLink *outlink)
if (!s->in_frame)
return AVERROR(ENOMEM);
- s->frames = av_fast_realloc(NULL, &s->frames_size,
- DEFAULT_LENGTH * sizeof(*(s->frames)));
+ s->frames = av_realloc_reuse(NULL, &s->frames_size,
+ DEFAULT_LENGTH * sizeof(*(s->frames)));
if (!s->frames)
return AVERROR(ENOMEM);
@@ -1840,7 +1840,7 @@ static int showspectrumpic_filter_frame(AVFilterLink *inlink, AVFrame *insamples
void *ptr;
if (s->nb_frames + 1ULL > s->frames_size / sizeof(*(s->frames))) {
- ptr = av_fast_realloc(s->frames, &s->frames_size, s->frames_size * 2);
+ ptr = av_realloc_reuse(s->frames, &s->frames_size, s->frames_size * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->frames = ptr;
@@ -49,7 +49,7 @@ typedef struct DrawGraphContext {
int prev_y[4];
int first[4];
float *values[4];
- int values_size[4];
+ size_t values_size[4];
int nb_values;
int64_t prev_pts;
} DrawGraphContext;
@@ -114,10 +114,10 @@ static av_cold int init(AVFilterContext *ctx)
s->first[0] = s->first[1] = s->first[2] = s->first[3] = 1;
if (s->slide == 4) {
- s->values[0] = av_fast_realloc(NULL, &s->values_size[0], 2000);
- s->values[1] = av_fast_realloc(NULL, &s->values_size[1], 2000);
- s->values[2] = av_fast_realloc(NULL, &s->values_size[2], 2000);
- s->values[3] = av_fast_realloc(NULL, &s->values_size[3], 2000);
+ s->values[0] = av_realloc_reuse(NULL, &s->values_size[0], 2000);
+ s->values[1] = av_realloc_reuse(NULL, &s->values_size[1], 2000);
+ s->values[2] = av_realloc_reuse(NULL, &s->values_size[2], 2000);
+ s->values[3] = av_realloc_reuse(NULL, &s->values_size[3], 2000);
if (!s->values[0] || !s->values[1] ||
!s->values[2] || !s->values[3]) {
@@ -174,22 +174,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
if (s->slide == 4 && s->nb_values >= s->values_size[0] / sizeof(float)) {
float *ptr;
- ptr = av_fast_realloc(s->values[0], &s->values_size[0], s->values_size[0] * 2);
+ ptr = av_realloc_reuse(s->values[0], &s->values_size[0], s->values_size[0] * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->values[0] = ptr;
- ptr = av_fast_realloc(s->values[1], &s->values_size[1], s->values_size[1] * 2);
+ ptr = av_realloc_reuse(s->values[1], &s->values_size[1], s->values_size[1] * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->values[1] = ptr;
- ptr = av_fast_realloc(s->values[2], &s->values_size[2], s->values_size[2] * 2);
+ ptr = av_realloc_reuse(s->values[2], &s->values_size[2], s->values_size[2] * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->values[2] = ptr;
- ptr = av_fast_realloc(s->values[3], &s->values_size[3], s->values_size[3] * 2);
+ ptr = av_realloc_reuse(s->values[3], &s->values_size[3], s->values_size[3] * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->values[3] = ptr;
@@ -57,7 +57,7 @@ typedef struct GraphMonitorContext {
uint8_t bg[4];
CacheItem *cache;
- unsigned int cache_size;
+ size_t cache_size;
unsigned int cache_index;
} GraphMonitorContext;
@@ -119,8 +119,8 @@ static av_cold int init(AVFilterContext *ctx)
{
GraphMonitorContext *s = ctx->priv;
- s->cache = av_fast_realloc(NULL, &s->cache_size,
- 8192 * sizeof(*(s->cache)));
+ s->cache = av_realloc_reuse(NULL, &s->cache_size,
+ 8192 * sizeof(*(s->cache)));
if (!s->cache)
return AVERROR(ENOMEM);
@@ -314,7 +314,7 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out,
s->cache[s->cache_index].previous_pts_us = l->current_pts_us;
if (s->cache_index + 1 >= s->cache_size / sizeof(*(s->cache))) {
- void *ptr = av_fast_realloc(s->cache, &s->cache_size, s->cache_size * 2);
+ void *ptr = av_realloc_reuse(s->cache, &s->cache_size, s->cache_size * 2);
if (!ptr)
return AVERROR(ENOMEM);
@@ -31,8 +31,8 @@
typedef struct ReverseContext {
int nb_frames;
AVFrame **frames;
- unsigned int frames_size;
- unsigned int pts_size;
+ size_t frames_size;
+ size_t pts_size;
int64_t *pts;
int flush_idx;
int64_t nb_samples;
@@ -42,13 +42,13 @@ static av_cold int init(AVFilterContext *ctx)
{
ReverseContext *s = ctx->priv;
- s->pts = av_fast_realloc(NULL, &s->pts_size,
- DEFAULT_LENGTH * sizeof(*(s->pts)));
+ s->pts = av_realloc_reuse(NULL, &s->pts_size,
+ DEFAULT_LENGTH * sizeof(*(s->pts)));
if (!s->pts)
return AVERROR(ENOMEM);
- s->frames = av_fast_realloc(NULL, &s->frames_size,
- DEFAULT_LENGTH * sizeof(*(s->frames)));
+ s->frames = av_realloc_reuse(NULL, &s->frames_size,
+ DEFAULT_LENGTH * sizeof(*(s->frames)));
if (!s->frames) {
av_freep(&s->pts);
return AVERROR(ENOMEM);
@@ -77,14 +77,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
void *ptr;
if (s->nb_frames + 1 > s->pts_size / sizeof(*(s->pts))) {
- ptr = av_fast_realloc(s->pts, &s->pts_size, s->pts_size * 2);
+ ptr = av_realloc_reuse(s->pts, &s->pts_size, s->pts_size * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->pts = ptr;
}
if (s->nb_frames + 1 > s->frames_size / sizeof(*(s->frames))) {
- ptr = av_fast_realloc(s->frames, &s->frames_size, s->frames_size * 2);
+ ptr = av_realloc_reuse(s->frames, &s->frames_size, s->frames_size * 2);
if (!ptr)
return AVERROR(ENOMEM);
s->frames = ptr;