}
}
-/**
- * Downmix the output to mono or stereo.
- */
-void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2],
- int out_ch, int in_ch, int len)
-{
- int i, j;
- float v0, v1;
- if (out_ch == 2) {
- for (i = 0; i < len; i++) {
- v0 = v1 = 0.0f;
- for (j = 0; j < in_ch; j++) {
- v0 += samples[j][i] * matrix[j][0];
- v1 += samples[j][i] * matrix[j][1];
- }
- samples[0][i] = v0;
- samples[1][i] = v1;
- }
- } else if (out_ch == 1) {
- for (i = 0; i < len; i++) {
- v0 = 0.0f;
- for (j = 0; j < in_ch; j++)
- v0 += samples[j][i] * matrix[j][0];
- samples[0][i] = v0;
- }
- }
-}
-
/**
* Upmix delay samples from stereo to original channel layout.
*/
if (s->eac3 && get_bits1(gbc)) {
/* TODO: parse enhanced coupling strategy info */
av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
/* determine which channels are coupled */
do_imdct(s, s->channels);
if (downmix_output) {
- s->dsp.ac3_downmix(s->output, s->downmix_coeffs,
- s->out_channels, s->fbw_channels, 256);
+ s->ac3dsp.downmix(s->output, s->downmix_coeffs,
+ s->out_channels, s->fbw_channels, 256);
}
} else {
if (downmix_output) {
- s->dsp.ac3_downmix(s->transform_coeffs + 1, s->downmix_coeffs,
- s->out_channels, s->fbw_channels, 256);
+ s->ac3dsp.downmix(s->transform_coeffs + 1, s->downmix_coeffs,
+ s->out_channels, s->fbw_channels, 256);
}
if (downmix_output && !s->downmixed) {
s->downmixed = 1;
- s->dsp.ac3_downmix(s->delay, s->downmix_coeffs, s->out_channels,
- s->fbw_channels, 128);
+ s->ac3dsp.downmix(s->delay, s->downmix_coeffs, s->out_channels,
+ s->fbw_channels, 128);
}
do_imdct(s, s->out_channels);
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
/* get output buffer */
+ avctx->channels = s->out_channels;
s->frame.nb_samples = s->num_blocks * 256;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
#define OFFSET(x) offsetof(AC3DecodeContext, x)
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
static const AVOption options[] = {
- { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {1.0}, 0.0, 1.0, PAR },
+ { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 1.0, PAR },
{ NULL},
};
AVCodec ff_ac3_decoder = {
.name = "ac3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AC3,
+ .id = AV_CODEC_ID_AC3,
.priv_data_size = sizeof (AC3DecodeContext),
.init = ac3_decode_init,
.close = ac3_decode_end,
AVCodec ff_eac3_decoder = {
.name = "eac3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_EAC3,
+ .id = AV_CODEC_ID_EAC3,
.priv_data_size = sizeof (AC3DecodeContext),
.init = ac3_decode_init,
.close = ac3_decode_end,