forge
Explore
Log in

Don't you dare go Hollow

Both entropy coders across the encoder sweep

Browse files at this commit

db36daa71b203f3a0cfca86de55851f56b30b42eAhmet Kaan GümüşParent: 466f297
  • test
    • both entropy coders across the encoder sweep
Show full message
test(h264): both entropy coders across the encoder sweep

The encoder defaults to CABAC now, so the reconstruction sweep and the ffmpeg
bit-exactness sweep both run each configuration under CAVLC as well: an
entropy coder nothing exercises is one that silently rots.
crates/ec-h264/tests/encode.rsmodified+9 -1
@@ -129,12 +129,18 @@ fn reconstruction_matches_the_decoder() {
129 for (w, h) in [(176, 144), (208, 122), (64, 48)] {129 for (w, h) in [(176, 144), (208, 122), (64, 48)] {
130 let mut clip = Clip::new(w, h);130 let mut clip = Clip::new(w, h);
131 for qp in [12, 24, 33, 44] {131 for qp in [12, 24, 33, 44] {
132- for (threads, preset) in [(1usize, Preset::Fast), (4, Preset::Balanced)] {132+ for (threads, preset, cabac) in [
133+ (1usize, Preset::Fast, true),
134+ (4, Preset::Balanced, true),
135+ (1, Preset::Fast, false),
136+ (3, Preset::Balanced, false),
137+ ] {
133 let mut cfg = EncoderConfig::new(w as u32, h as u32);138 let mut cfg = EncoderConfig::new(w as u32, h as u32);
134 cfg.qp = qp;139 cfg.qp = qp;
135 cfg.gop_size = 5;140 cfg.gop_size = 5;
136 cfg.threads = threads;141 cfg.threads = threads;
137 cfg.preset = preset;142 cfg.preset = preset;
143+ cfg.cabac = cabac;
138 let mut enc = Encoder::new(cfg).expect("encoder");144 let mut enc = Encoder::new(cfg).expect("encoder");
139 let mut stream = Vec::new();145 let mut stream = Vec::new();
140 let mut recons = Vec::new();146 let mut recons = Vec::new();
@@ -337,8 +343,10 @@ fn ffmpeg_decodes_bit_exactly() {
337 }343 }
338 for (w, h) in [(176, 144), (322, 242)] {344 for (w, h) in [(176, 144), (322, 242)] {
339 for qp in [10, 20, 28, 37, 47] {345 for qp in [10, 20, 28, 37, 47] {
346+ let cavlc = qp % 2 == 0; // both entropy coders across the sweep
340 let (stream, recons) = encode_clip(w, h, 6, |cfg| {347 let (stream, recons) = encode_clip(w, h, 6, |cfg| {
341 cfg.qp = qp;348 cfg.qp = qp;
349+ cfg.cabac = !cavlc;
342 });350 });
343 let decoded = ffmpeg_decode(&stream, w, h, &[]).expect("ffmpeg decodes our stream");351 let decoded = ffmpeg_decode(&stream, w, h, &[]).expect("ffmpeg decodes our stream");
344 assert_eq!(decoded.len(), recons.len(), "{w}x{h} qp {qp}: frame count");352 assert_eq!(decoded.len(), recons.len(), "{w}x{h} qp {qp}: frame count");