@@ -65,7 +65,7 @@ typedef struct VulkanQueueCtx {
/* Buffer dependencies */
AVBufferRef **buf_deps;
int nb_buf_deps;
- int buf_deps_alloc_size;
+ size_t buf_deps_alloc_size;
} VulkanQueueCtx;
typedef struct VulkanExecCtx {
@@ -1226,8 +1226,8 @@ static int add_buf_dep_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd,
if (!deps || !nb_deps)
return 0;
- dst = av_fast_realloc(q->buf_deps, &q->buf_deps_alloc_size,
- (q->nb_buf_deps + nb_deps) * sizeof(*dst));
+ dst = av_realloc_reuse(q->buf_deps, &q->buf_deps_alloc_size,
+ (q->nb_buf_deps + nb_deps) * sizeof(*dst));
if (!dst)
goto err;
@@ -443,7 +443,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
int ret = 0;
AVTXContext *sub = NULL;
TXCodeletMatch *cd_tmp, *cd_matches = NULL;
- unsigned int cd_matches_size = 0;
+ size_t cd_matches_size = 0;
int nb_cd_matches = 0;
#if !CONFIG_SMALL
AVBPrint bp = { 0 };
@@ -533,8 +533,8 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
continue;
/* Realloc array and append */
- cd_tmp = av_fast_realloc(cd_matches, &cd_matches_size,
- sizeof(*cd_tmp) * (nb_cd_matches + 1));
+ cd_tmp = av_realloc_reuse(cd_matches, &cd_matches_size,
+ sizeof(*cd_tmp) * (nb_cd_matches + 1));
if (!cd_tmp) {
av_free(cd_matches);
return AVERROR(ENOMEM);
@@ -284,8 +284,8 @@ int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer *buf, uint8_t *mem[],
};
if (buf[i].flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
continue;
- inval_list = av_fast_realloc(s->scratch, &s->scratch_size,
- (++inval_count)*sizeof(*inval_list));
+ inval_list = av_realloc_reuse(s->scratch, &s->scratch_size,
+ (++inval_count)*sizeof(*inval_list));
if (!inval_list)
return AVERROR(ENOMEM);
inval_list[inval_count - 1] = ival_buf;
@@ -322,8 +322,8 @@ int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer *buf, int nb_buffers,
};
if (buf[i].flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
continue;
- flush_list = av_fast_realloc(s->scratch, &s->scratch_size,
- (++flush_count)*sizeof(*flush_list));
+ flush_list = av_realloc_reuse(s->scratch, &s->scratch_size,
+ (++flush_count)*sizeof(*flush_list));
if (!flush_list)
return AVERROR(ENOMEM);
flush_list[flush_count - 1] = flush_buf;
@@ -516,43 +516,43 @@ int ff_vk_add_exec_dep(FFVulkanContext *s, FFVkExecContext *e, AVFrame *frame,
int planes = av_pix_fmt_count_planes(fc->sw_format);
for (int i = 0; i < planes; i++) {
- e->sem_wait = av_fast_realloc(e->sem_wait, &e->sem_wait_alloc,
- (e->sem_wait_cnt + 1)*sizeof(*e->sem_wait));
+ e->sem_wait = av_realloc_reuse(e->sem_wait, &e->sem_wait_alloc,
+ (e->sem_wait_cnt + 1)*sizeof(*e->sem_wait));
if (!e->sem_wait) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
}
- e->sem_wait_dst = av_fast_realloc(e->sem_wait_dst, &e->sem_wait_dst_alloc,
- (e->sem_wait_cnt + 1)*sizeof(*e->sem_wait_dst));
+ e->sem_wait_dst = av_realloc_reuse(e->sem_wait_dst, &e->sem_wait_dst_alloc,
+ (e->sem_wait_cnt + 1)*sizeof(*e->sem_wait_dst));
if (!e->sem_wait_dst) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
}
- e->sem_wait_val = av_fast_realloc(e->sem_wait_val, &e->sem_wait_val_alloc,
- (e->sem_wait_cnt + 1)*sizeof(*e->sem_wait_val));
+ e->sem_wait_val = av_realloc_reuse(e->sem_wait_val, &e->sem_wait_val_alloc,
+ (e->sem_wait_cnt + 1)*sizeof(*e->sem_wait_val));
if (!e->sem_wait_val) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
}
- e->sem_sig = av_fast_realloc(e->sem_sig, &e->sem_sig_alloc,
- (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig));
+ e->sem_sig = av_realloc_reuse(e->sem_sig, &e->sem_sig_alloc,
+ (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig));
if (!e->sem_sig) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
}
- e->sem_sig_val = av_fast_realloc(e->sem_sig_val, &e->sem_sig_val_alloc,
- (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig_val));
+ e->sem_sig_val = av_realloc_reuse(e->sem_sig_val, &e->sem_sig_val_alloc,
+ (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig_val));
if (!e->sem_sig_val) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
}
- e->sem_sig_val_dst = av_fast_realloc(e->sem_sig_val_dst, &e->sem_sig_val_dst_alloc,
- (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig_val_dst));
+ e->sem_sig_val_dst = av_realloc_reuse(e->sem_sig_val_dst, &e->sem_sig_val_dst_alloc,
+ (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig_val_dst));
if (!e->sem_sig_val_dst) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
@@ -569,8 +569,8 @@ int ff_vk_add_exec_dep(FFVulkanContext *s, FFVkExecContext *e, AVFrame *frame,
e->sem_sig_cnt++;
}
- dst = av_fast_realloc(q->frame_deps, &q->frame_deps_alloc_size,
- (q->nb_frame_deps + 1) * sizeof(*dst));
+ dst = av_realloc_reuse(q->frame_deps, &q->frame_deps_alloc_size,
+ (q->nb_frame_deps + 1) * sizeof(*dst));
if (!dst) {
ff_vk_discard_exec_deps(e);
return AVERROR(ENOMEM);
@@ -645,8 +645,8 @@ int ff_vk_add_dep_exec_ctx(FFVulkanContext *s, FFVkExecContext *e,
if (!deps || !nb_deps)
return 0;
- dst = av_fast_realloc(q->buf_deps, &q->buf_deps_alloc_size,
- (q->nb_buf_deps + nb_deps) * sizeof(*dst));
+ dst = av_realloc_reuse(q->buf_deps, &q->buf_deps_alloc_size,
+ (q->nb_buf_deps + nb_deps) * sizeof(*dst));
if (!dst)
goto err;
@@ -143,12 +143,12 @@ typedef struct FFVkQueueCtx {
/* Buffer dependencies */
AVBufferRef **buf_deps;
int nb_buf_deps;
- int buf_deps_alloc_size;
+ size_t buf_deps_alloc_size;
/* Frame dependencies */
AVFrame **frame_deps;
int nb_frame_deps;
- int frame_deps_alloc_size;
+ size_t frame_deps_alloc_size;
} FFVkQueueCtx;
typedef struct FFVkExecContext {
@@ -165,24 +165,24 @@ typedef struct FFVkExecContext {
FFVulkanPipeline *bound_pl;
VkSemaphore *sem_wait;
- int sem_wait_alloc; /* Allocated sem_wait */
+ size_t sem_wait_alloc; /* Allocated sem_wait */
int sem_wait_cnt;
uint64_t *sem_wait_val;
- int sem_wait_val_alloc;
+ size_t sem_wait_val_alloc;
VkPipelineStageFlagBits *sem_wait_dst;
- int sem_wait_dst_alloc; /* Allocated sem_wait_dst */
+ size_t sem_wait_dst_alloc; /* Allocated sem_wait_dst */
VkSemaphore *sem_sig;
- int sem_sig_alloc; /* Allocated sem_sig */
+ size_t sem_sig_alloc; /* Allocated sem_sig */
int sem_sig_cnt;
uint64_t *sem_sig_val;
- int sem_sig_val_alloc;
+ size_t sem_sig_val_alloc;
uint64_t **sem_sig_val_dst;
- int sem_sig_val_dst_alloc;
+ size_t sem_sig_val_dst_alloc;
} FFVkExecContext;
typedef struct FFVulkanContext {
@@ -222,7 +222,7 @@ typedef struct FFVulkanContext {
int pipelines_num;
void *scratch; /* Scratch memory used only in functions */
- unsigned int scratch_size;
+ size_t scratch_size;
} FFVulkanContext;
/* Identity mapping - r = r, b = b, g = g, a = a */