From 0c3481b43a198e483a20dcd56b08bb402e529ba3 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 23 Dec 2018 11:02:34 +0100 Subject: [PATCH] avfilter/af_sofalizer: pick IR length after loading sofa Instead of picking it in preloading stage. --- libavfilter/af_sofalizer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index 0e478f437a..9715f78e88 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -113,7 +113,6 @@ static int close_sofa(struct MySofa *sofa) static int preload_sofa(AVFilterContext *ctx, char *filename, int *samplingrate) { - struct SOFAlizerContext *s = ctx->priv; struct MYSOFA_HRTF *mysofa; char *license; int ret; @@ -126,9 +125,8 @@ static int preload_sofa(AVFilterContext *ctx, char *filename, int *samplingrate) if (mysofa->DataSamplingRate.elements != 1) return AVERROR(EINVAL); + av_log(ctx, AV_LOG_DEBUG, "Original IR length: %d.\n", mysofa->N); *samplingrate = mysofa->DataSamplingRate.values[0]; - s->sofa.ir_samples = mysofa->N; - s->sofa.n_samples = 1 << (32 - ff_clz(s->sofa.ir_samples)); license = mysofa_getAttribute(mysofa->attributes, (char *)"License"); if (license) av_log(ctx, AV_LOG_INFO, "SOFA license: %s\n", license); @@ -591,6 +589,10 @@ static int load_data(AVFilterContext *ctx, int azim, int elev, float radius, int return AVERROR_INVALIDDATA; } + av_log(ctx, AV_LOG_DEBUG, "IR length: %d.\n", s->sofa.easy->hrtf->N); + s->sofa.ir_samples = s->sofa.easy->hrtf->N; + s->sofa.n_samples = 1 << (32 - ff_clz(s->sofa.ir_samples)); + n_samples = s->sofa.n_samples; ir_samples = s->sofa.ir_samples;