@@ -986,6 +986,20 @@ If set to 0, disables the use of phase inversion for intensity stereo,
improving the quality of mono downmixes, but slightly reducing normal stereo
quality. The default is 1 (phase inversion enabled).
+@item signal (@emph{music} and @emph{speech})
+Set signal type. This option acts as a tuning bias for low bitrates encoding.
+Valid options are listed below:
+
+@table @samp
+@item auto (N.A.)
+No bias, automatic signal type detection (the default).
+
+@item voice (@emph{speech})
+Bias thresholds towards choosing LPC or Hybrid modes.
+
+@item music (@emph{music})
+Bias thresholds towards choosing MDCT modes.
+@end table
@end table
@anchor{libshine}
@@ -42,6 +42,7 @@ typedef struct LibopusEncOpts {
#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
int apply_phase_inv;
#endif
+ int signal_type;
} LibopusEncOpts;
typedef struct LibopusEncContext {
@@ -165,6 +166,12 @@ static int libopus_configure_encoder(AVCodecContext *avctx, OpusMSEncoder *enc,
"Unable to set phase inversion: %s\n",
opus_strerror(ret));
#endif
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_SIGNAL(opts->signal_type));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set signal type: %s\n", opus_strerror(ret));
+
return OPUS_OK;
}
@@ -544,6 +551,10 @@ static const AVOption libopus_options[] = {
#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
{ "apply_phase_inv", "Apply intensity stereo phase inversion", OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
#endif
+ { "signal", "Signal type", OFFSET(signal_type), AV_OPT_TYPE_INT, { .i64 = OPUS_AUTO }, OPUS_AUTO, OPUS_SIGNAL_MUSIC, FLAGS, "signal" },
+ { "auto", "Automatic detection", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_AUTO }, 0, 0, FLAGS, "signal" },
+ { "voice", "Tune for speech", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_SIGNAL_VOICE }, 0, 0, FLAGS, "signal" },
+ { "music", "Tune for music", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_SIGNAL_MUSIC }, 0, 0, FLAGS, "signal" },
{ NULL },
};