Commit bde96717 authored by Reimar Döffinger's avatar Reimar Döffinger

dca: allow selecting float output at runtime.

parent 5aff31b1
...@@ -1626,12 +1626,8 @@ static int dca_decode_frame(AVCodecContext * avctx, ...@@ -1626,12 +1626,8 @@ static int dca_decode_frame(AVCodecContext * avctx,
int lfe_samples; int lfe_samples;
int num_core_channels = 0; int num_core_channels = 0;
int i; int i;
/* ffdshow custom code */ float *samples_flt = data;
#if CONFIG_AUDIO_FLOAT
float *samples = data;
#else
int16_t *samples = data; int16_t *samples = data;
#endif
DCAContext *s = avctx->priv_data; DCAContext *s = avctx->priv_data;
int channels; int channels;
int core_ss_end; int core_ss_end;
...@@ -1840,13 +1836,13 @@ static int dca_decode_frame(AVCodecContext * avctx, ...@@ -1840,13 +1836,13 @@ static int dca_decode_frame(AVCodecContext * avctx,
} }
/* interleave samples */ /* interleave samples */
#if CONFIG_AUDIO_FLOAT if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
/* ffdshow custom code */ float_interleave(samples_flt, s->samples_chanptr, 256, channels);
float_interleave(samples, s->samples_chanptr, 256, channels); samples_flt += 256 * channels;
#else } else {
s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
#endif samples += 256 * channels;
samples += 256 * channels; }
} }
/* update lfe history */ /* update lfe history */
...@@ -1882,12 +1878,8 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) ...@@ -1882,12 +1878,8 @@ static av_cold int dca_decode_init(AVCodecContext * avctx)
for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++) for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++)
s->samples_chanptr[i] = s->samples + i * 256; s->samples_chanptr[i] = s->samples + i * 256;
/* ffdshow custom code */ avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
#if CONFIG_AUDIO_FLOAT AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
#else
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
#endif
s->scale_bias = 1.0; s->scale_bias = 1.0;
......
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