audioconvert: add dither passthrough flag

This commit is contained in:
Wim Taymans 2022-06-28 11:31:40 +02:00
parent b5e0151cc0
commit a84bf672e8
3 changed files with 8 additions and 3 deletions

View file

@ -1409,9 +1409,10 @@ static int setup_dither(struct impl *this)
if ((res = dither_init(&this->dither)) < 0) if ((res = dither_init(&this->dither)) < 0)
return res; return res;
spa_log_info(this->log, "%p:got dither %08x:%08x noise:%d quantize:%d", this, spa_log_info(this->log, "%p: got dither %08x:%08x quantize:%d:%d passthrough:%d", this,
this->cpu_flags, this->dither.cpu_flags, this->cpu_flags, this->dither.cpu_flags,
this->dither.noise, this->dither.quantize); this->dither.quantize, this->dither.noise,
this->dither.is_passthrough);
return 0; return 0;
} }
@ -2485,7 +2486,7 @@ static int impl_node_process(void *object)
} }
this->out_offset += n_samples; this->out_offset += n_samples;
if (this->dither.process != NULL) { if (!this->dither.is_passthrough) {
in_datas = (const void**)out_datas; in_datas = (const void**)out_datas;
if (out_passthrough) if (out_passthrough)
out_datas = dst_datas; out_datas = dst_datas;

View file

@ -98,5 +98,8 @@ int dither_init(struct dither *d)
d->free = impl_dither_free; d->free = impl_dither_free;
d->process = info->process; d->process = info->process;
d->is_passthrough = d->noise == 0 && d->method == DITHER_METHOD_NONE;
return 0; return 0;
} }

View file

@ -42,6 +42,7 @@ struct dither {
uint32_t method; uint32_t method;
uint32_t n_channels; uint32_t n_channels;
uint32_t cpu_flags; uint32_t cpu_flags;
unsigned int is_passthrough:1;
struct spa_log *log; struct spa_log *log;