Commit 1e4460c6 authored by Stefan Westerfeld's avatar Stefan Westerfeld

avfilter/asubprocess: use integer format

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent c533ea9d
...@@ -292,14 +292,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -292,14 +292,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
short buffer[100000]; short buffer[100000];
int k = 0; int k = 0;
for (int i = 0; i < in->nb_samples; i++) int32_t *xd = (int32_t *)in->data[0];
{ for (k = 0; k < in->nb_samples * inlink->ch_layout.nb_channels; k++) {
for (int j = 0; j < inlink->ch_layout.nb_channels; j++) buffer[k] = xd[k] >> 16;
{ }
float **xd = (float **)in->extended_data;
buffer[k++] = xd[j][i]*32000;
}
}
sp_write (s->sp, buffer, 2 * k); sp_write (s->sp, buffer, 2 * k);
if (s->eof) if (s->eof)
{ {
...@@ -352,14 +348,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -352,14 +348,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
} }
short buffer[100000]; // FIXME avail * inlink->ch_layout.nb_channels]; short buffer[100000]; // FIXME avail * inlink->ch_layout.nb_channels];
sp_read (s->sp, buffer, avail * 2 * inlink->ch_layout.nb_channels); sp_read (s->sp, buffer, avail * 2 * inlink->ch_layout.nb_channels);
int k = 0; int32_t *xd = (int32_t *)out->data[0];
for (int i = 0; i < avail; i++) for (int k = 0; k < avail * inlink->ch_layout.nb_channels; k++)
{ {
for (int j = 0; j < inlink->ch_layout.nb_channels; j++) xd[k] = buffer[k] << 16;
{
float **xd = (float **)out->extended_data;
xd[j][i] = buffer[k++] * (1/32000.);
}
} }
ret = ff_filter_frame(outlink, out); ret = ff_filter_frame(outlink, out);
} }
...@@ -468,6 +460,6 @@ const AVFilter ff_af_asubprocess = { ...@@ -468,6 +460,6 @@ const AVFilter ff_af_asubprocess = {
.activate = activate, .activate = activate,
FILTER_INPUTS(asubprocess_inputs), FILTER_INPUTS(asubprocess_inputs),
FILTER_OUTPUTS(ff_audio_default_filterpad), FILTER_OUTPUTS(ff_audio_default_filterpad),
FILTER_SINGLE_SAMPLEFMT(AV_SAMPLE_FMT_FLTP), FILTER_SINGLE_SAMPLEFMT(AV_SAMPLE_FMT_S32),
.process_command = process_command, .process_command = process_command,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment