X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fopusenc_psy.c;h=b7126033441e3b27ba423a691f34bfe52b649d26;hb=9d68c0191cdd570ece2c4d006b20230ac08085fe;hp=5393c9d7deaba9fa57b3cc66fc8b84f1637c0471;hpb=aa6f43c2e959a960792f76d006b8699d733f258f;p=ffmpeg diff --git a/libavcodec/opusenc_psy.c b/libavcodec/opusenc_psy.c index 5393c9d7dea..b7126033441 100644 --- a/libavcodec/opusenc_psy.c +++ b/libavcodec/opusenc_psy.c @@ -366,7 +366,7 @@ static int bands_dist(OpusPsyContext *s, CeltFrame *f, float *total_dist) OpusRangeCoder dump; ff_opus_rc_enc_init(&dump); - ff_celt_enc_bitalloc(f, &dump); + ff_celt_bitalloc(f, &dump, 1); for (i = 0; i < CELT_MAX_BANDS; i++) { float bits = 0.0f; @@ -383,6 +383,10 @@ static void celt_search_for_dual_stereo(OpusPsyContext *s, CeltFrame *f) { float td1, td2; f->dual_stereo = 0; + + if (s->avctx->channels < 2) + return; + bands_dist(s, f, &td1); f->dual_stereo = 1; bands_dist(s, f, &td2); @@ -396,6 +400,9 @@ static void celt_search_for_intensity(OpusPsyContext *s, CeltFrame *f) int i, best_band = CELT_MAX_BANDS - 1; float dist, best_dist = FLT_MAX; + if (s->avctx->channels < 2) + return; + /* TODO: fix, make some heuristic up here using the lambda value */ float end_band = 0;