forge
Explore
Log in

Don't you dare go Hollow

EC_OPUS_ALIGN=1 turns the libopus input alignment on process-wide

Browse files at this commit

28054d0589c55e94c15c4947cda51c262a9d6097Ahmet Kaan GümüşParent: 247d2f4
  • feat
    • EC_OPUS_ALIGN=1 turns the libopus input alignment on process-wide
Show full message
feat(opus): EC_OPUS_ALIGN=1 turns the libopus input alignment on process-wide

The knob is otherwise API-only, so the gate could not sweep it; this is how
the rows recorded at set_libopus_input_alignment were produced.
crates/ec-opus/src/encoder.rsmodified+8 -2
@@ -158,7 +158,7 @@ impl Encoder {
158 "one stream carries at most two channels; use MultistreamEncoder",158 "one stream carries at most two channels; use MultistreamEncoder",
159 ));159 ));
160 }160 }
161- Ok(Encoder {161+ let mut enc = Encoder {
162 celt: CeltEncoder::new(channels, upsample),162 celt: CeltEncoder::new(channels, upsample),
163 range: RangeEncoder::new(),163 range: RangeEncoder::new(),
164 sample_rate,164 sample_rate,
@@ -182,7 +182,13 @@ impl Encoder {
182 align_input: false,182 align_input: false,
183 hp_mem: [0.0; 2],183 hp_mem: [0.0; 2],
184 hp_buf: Vec::new(),184 hp_buf: Vec::new(),
185- })185+ };
186+ // `EC_OPUS_ALIGN=1` turns the alignment on for a whole process — how
187+ // the gate rows at `set_libopus_input_alignment` were produced.
188+ if std::env::var_os("EC_OPUS_ALIGN").is_some() {
189+ enc.set_libopus_input_alignment(true);
190+ }
191+ Ok(enc)
186 }192 }
187 193
188 /// Overrides the automatic SILK/Hybrid/CELT choice `wants_silk` and194 /// Overrides the automatic SILK/Hybrid/CELT choice `wants_silk` and