*/
/**
- * @file libavcodec/vorbis_enc.c
+ * @file
* Native Vorbis encoder.
* @author Oded Shimon <ods15@ods15.dyndns.org>
*/
float average = averages[i];
int j;
- average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); // MAGIC!
+ average = sqrt(tot_average * average) * pow(1.25f, position*0.005f); // MAGIC!
for (j = 0; j < range - 1; j++)
if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average)
break;
}
}
-static int apply_window_and_mdct(vorbis_enc_context *venc, signed short *audio,
+static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *audio,
int samples)
{
int i, j, channel;
float * offset = venc->samples + channel*window_len*2 + window_len;
j = channel;
for (i = 0; i < samples; i++, j += venc->channels)
- offset[i] = -audio[j] / 32768. / n * win[window_len - i - 1]; //FIXME find out why the sign has to be fliped
+ offset[i] = audio[j] / 32768. / n * win[window_len - i - 1];
}
} else {
for (channel = 0; channel < venc->channels; channel++)
float *offset = venc->saved + channel * window_len;
j = channel;
for (i = 0; i < samples; i++, j += venc->channels)
- offset[i] = -audio[j] / 32768. / n * win[i]; //FIXME find out why the sign has to be fliped
+ offset[i] = audio[j] / 32768. / n * win[i];
}
venc->have_saved = 1;
} else {
if (avccontext->flags & CODEC_FLAG_QSCALE)
venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA / 10.;
else
- venc->quality = 1.;
+ venc->quality = 0.03;
venc->quality *= venc->quality;
avccontext->extradata_size = put_main_header(venc, (uint8_t**)&avccontext->extradata);
int buf_size, void *data)
{
vorbis_enc_context *venc = avccontext->priv_data;
- signed short *audio = data;
+ const signed short *audio = data;
int samples = data ? avccontext->frame_size : 0;
vorbis_enc_mode *mode;
vorbis_enc_mapping *mapping;
vorbis_encode_init,
vorbis_encode_frame,
vorbis_encode_close,
- .capabilities= CODEC_CAP_DELAY,
+ .capabilities= CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
};