Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 132ed59

Browse files
committed
Removes OPUS_FRAMESIZE_VARIABLE
That experiment never actually worked
1 parent e619ea7 commit 132ed59

File tree

8 files changed

+30
-370
lines changed

8 files changed

+30
-370
lines changed

celt/celt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ typedef struct {
7474

7575
/* Encoder/decoder Requests */
7676

77-
/* Expose this option again when variable framesize actually works */
78-
#define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size dynamically */
79-
8077

8178
#define CELT_SET_PREDICTION_REQUEST 10002
8279
/** Controls the use of interframe prediction.

celt/celt_encoder.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ struct OpusCustomEncoder {
7373
int constrained_vbr; /* If zero, VBR can do whatever it likes with the rate */
7474
int loss_rate;
7575
int lsb_depth;
76-
int variable_duration;
7776
int lfe;
7877
int disable_inv;
7978
int arch;
@@ -1220,7 +1219,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
12201219
int LM, opus_int32 bitrate, int lastCodedBands, int C, int intensity,
12211220
int constrained_vbr, opus_val16 stereo_saving, int tot_boost,
12221221
opus_val16 tf_estimate, int pitch_change, opus_val16 maxDepth,
1223-
int variable_duration, int lfe, int has_surround_mask, opus_val16 surround_masking,
1222+
int lfe, int has_surround_mask, opus_val16 surround_masking,
12241223
opus_val16 temporal_vbr)
12251224
{
12261225
/* The target rate in 8th bits per frame */
@@ -1264,8 +1263,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
12641263
/* Boost the rate according to dynalloc (minus the dynalloc average for calibration). */
12651264
target += tot_boost-(16<<LM);
12661265
/* Apply transient boost, compensating for average boost. */
1267-
tf_calibration = variable_duration==OPUS_FRAMESIZE_VARIABLE ?
1268-
QCONST16(0.02f,14) : QCONST16(0.04f,14);
1266+
tf_calibration = QCONST16(0.04f,14);
12691267
target += (opus_int32)SHL32(MULT16_32_Q15(tf_estimate-tf_calibration, target),1);
12701268

12711269
#ifndef DISABLE_FLOAT_API
@@ -1582,7 +1580,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
15821580
int enabled;
15831581
int qg;
15841582
enabled = ((st->lfe&&nbAvailableBytes>3) || nbAvailableBytes>12*C) && !hybrid && !silence && !st->disable_pf
1585-
&& st->complexity >= 5 && !(st->consec_transient && LM!=3 && st->variable_duration==OPUS_FRAMESIZE_VARIABLE);
1583+
&& st->complexity >= 5;
15861584

15871585
prefilter_tapset = st->tapset_decision;
15881586
pf_on = run_prefilter(st, in, prefilter_mem, CC, N, prefilter_tapset, &pitch_index, &gain1, &qg, enabled, nbAvailableBytes);
@@ -1990,7 +1988,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
19901988
target = compute_vbr(mode, &st->analysis, base_target, LM, equiv_rate,
19911989
st->lastCodedBands, C, st->intensity, st->constrained_vbr,
19921990
st->stereo_saving, tot_boost, tf_estimate, pitch_change, maxDepth,
1993-
st->variable_duration, st->lfe, st->energy_mask!=NULL, surround_masking,
1991+
st->lfe, st->energy_mask!=NULL, surround_masking,
19941992
temporal_vbr);
19951993
} else {
19961994
target = base_target;
@@ -2409,12 +2407,6 @@ int opus_custom_encoder_ctl(CELTEncoder * OPUS_RESTRICT st, int request, ...)
24092407
*value=st->lsb_depth;
24102408
}
24112409
break;
2412-
case OPUS_SET_EXPERT_FRAME_DURATION_REQUEST:
2413-
{
2414-
opus_int32 value = va_arg(ap, opus_int32);
2415-
st->variable_duration = value;
2416-
}
2417-
break;
24182410
case OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST:
24192411
{
24202412
opus_int32 value = va_arg(ap, opus_int32);

include/opus_defines.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ extern "C" {
573573
* <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd>
574574
* <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd>
575575
* <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd>
576-
* <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd>
577576
* </dl>
578577
* @hideinitializer */
579578
#define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int(x)
@@ -591,7 +590,6 @@ extern "C" {
591590
* <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd>
592591
* <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd>
593592
* <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd>
594-
* <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd>
595593
* </dl>
596594
* @hideinitializer */
597595
#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)

src/analysis.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ typedef struct {
6262
int last_music;
6363
int last_transition;
6464
int count;
65-
float subframe_mem[3];
6665
int analysis_offset;
6766
/** Probability of having speech for time i to DETECT_SIZE-1 (and music before).
6867
pspeech[0] is the probability that all frames in the window are speech. */

src/opus_demo.c

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,6 @@ int main(int argc, char *argv[])
415415
check_encoder_option(decode_only, "-cvbr");
416416
cvbr = 1;
417417
args++;
418-
} else if( strcmp( argv[ args ], "-variable-duration" ) == 0 ) {
419-
check_encoder_option(decode_only, "-variable-duration");
420-
variable_duration = OPUS_FRAMESIZE_VARIABLE;
421-
args++;
422418
} else if( strcmp( argv[ args ], "-delayed-decision" ) == 0 ) {
423419
check_encoder_option(decode_only, "-delayed-decision");
424420
delayed_decision = 1;
@@ -606,28 +602,25 @@ int main(int argc, char *argv[])
606602
}
607603
if(delayed_decision)
608604
{
609-
if (variable_duration!=OPUS_FRAMESIZE_VARIABLE)
610-
{
611-
if (frame_size==sampling_rate/400)
612-
variable_duration = OPUS_FRAMESIZE_2_5_MS;
613-
else if (frame_size==sampling_rate/200)
614-
variable_duration = OPUS_FRAMESIZE_5_MS;
615-
else if (frame_size==sampling_rate/100)
616-
variable_duration = OPUS_FRAMESIZE_10_MS;
617-
else if (frame_size==sampling_rate/50)
618-
variable_duration = OPUS_FRAMESIZE_20_MS;
619-
else if (frame_size==sampling_rate/25)
620-
variable_duration = OPUS_FRAMESIZE_40_MS;
621-
else if (frame_size==3*sampling_rate/50)
622-
variable_duration = OPUS_FRAMESIZE_60_MS;
623-
else if (frame_size==4*sampling_rate/50)
624-
variable_duration = OPUS_FRAMESIZE_80_MS;
625-
else if (frame_size==5*sampling_rate/50)
626-
variable_duration = OPUS_FRAMESIZE_100_MS;
627-
else
628-
variable_duration = OPUS_FRAMESIZE_120_MS;
629-
opus_encoder_ctl(enc, OPUS_SET_EXPERT_FRAME_DURATION(variable_duration));
630-
}
605+
if (frame_size==sampling_rate/400)
606+
variable_duration = OPUS_FRAMESIZE_2_5_MS;
607+
else if (frame_size==sampling_rate/200)
608+
variable_duration = OPUS_FRAMESIZE_5_MS;
609+
else if (frame_size==sampling_rate/100)
610+
variable_duration = OPUS_FRAMESIZE_10_MS;
611+
else if (frame_size==sampling_rate/50)
612+
variable_duration = OPUS_FRAMESIZE_20_MS;
613+
else if (frame_size==sampling_rate/25)
614+
variable_duration = OPUS_FRAMESIZE_40_MS;
615+
else if (frame_size==3*sampling_rate/50)
616+
variable_duration = OPUS_FRAMESIZE_60_MS;
617+
else if (frame_size==4*sampling_rate/50)
618+
variable_duration = OPUS_FRAMESIZE_80_MS;
619+
else if (frame_size==5*sampling_rate/50)
620+
variable_duration = OPUS_FRAMESIZE_100_MS;
621+
else
622+
variable_duration = OPUS_FRAMESIZE_120_MS;
623+
opus_encoder_ctl(enc, OPUS_SET_EXPERT_FRAME_DURATION(variable_duration));
631624
frame_size = 2*48000;
632625
}
633626
while (!stop)

0 commit comments

Comments
 (0)