forge
Explore
Log in

Don't you dare go Hollow

Name and sweep the search's motion-vector weight

Browse files at this commit

a5aa64ea0d1c1bcff5c6cc6335f29dcdea729dd0Ahmet Kaan GümüşParent: f7bce7d
  • docs
    • name and sweep the search's motion-vector weight
Show full message
docs(h264): name and sweep the search's motion-vector weight

The motion search halved a vector's signalling cost with a bare `/ 2.0`. Swept
on consecutive pictures it holds: 0.25/0.5/1.0/2.0 read -1.074/-1.043/-1.225/
-1.618 dB BD-PSNR against x264 on the film clip and -0.676/-0.661/-0.795/-1.201
on the screen capture, so a half is the flat part and charging the whole rate
is worse on both contents.
crates/ec-h264/src/enc/mb.rsmodified+9 -1
@@ -469,6 +469,14 @@ fn intra_pre_cost(
469469 }
470470 }
471471
472+/// How much of a motion vector's signalling the search pays for. Half, which
473+/// is not the true rate: swept on consecutive pictures (BD-PSNR against x264,
474+/// GOP 10), 0.25/0.5/1.0/2.0 read -1.074/-1.043/-1.225/-1.618 on the film clip
475+/// and -0.676/-0.661/-0.795/-1.201 on the screen capture. Charging the whole
476+/// rate is worse than charging half on both contents, and the curve is flat
477+/// below a half and falls away above it.
478+const MV_BITS_WEIGHT: f64 = 0.5;
479+
472480 /// What going intra costs to signal in a P picture, in bits: the macroblock
473481 /// type and, when Intra_4x4 wins later, sixteen prediction modes. Swept at the
474482 /// decision site above.
@@ -581,7 +589,7 @@ fn choose_inter(pic: &Picture, e: &MbEnc<'_>, mb_x: usize, mb_y: usize) -> Inter
581589 let bits = motion_rate(
582590 e,
583591 f64::from(se_bits(i32::from(mv[0] - mvp[0])) + se_bits(i32::from(mv[1] - mvp[1])))
584- / 2.0,
592+ * MV_BITS_WEIGHT,
585593 );
586594 if !satd && mv[0] & 3 == 0 && mv[1] & 3 == 0 {
587595 let o = integer_origin(
lanes/h264x264-r2.report.mdmodified+6 -0
@@ -140,3 +140,9 @@ Iterating our own sub-sample refinement to convergence at `Fast` (it stopped
140140 after one pass) is the first 0.111 dB of that, for 2% of the comparison's wall
141141 clock: film -1.154 -> -1.043, screen capture -0.696 -> -0.661, synthetic
142142 -4.542 -> -4.449.
143+
144+The search's motion-vector weight was swept with it and held at a half:
145+0.25/0.5/1.0/2.0 read -1.074/-1.043/-1.225/-1.618 on film and
146+-0.676/-0.661/-0.795/-1.201 on screen capture. Charging a vector's whole
147+signalling cost is worse than charging half on both contents; it now says so in
148+a named constant rather than a bare `/ 2.0`.