Name and sweep the search's motion-vector weight
Browse files at this commita5aa64ea0d1c1bcff5c6cc6335f29dcdea729dd0Parent: f7bce7d- docs
- name and sweep the search's motion-vector weight
2 changed files +15 -1
crates/ec-h264/src/enc/mb.rsmodified+9 -1
| @@ -469,6 +469,14 @@ fn intra_pre_cost( | |||
| 469 | } | 469 | } |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 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 | + | ||
| 472 | /// What going intra costs to signal in a P picture, in bits: the macroblock | 480 | /// What going intra costs to signal in a P picture, in bits: the macroblock |
| 473 | /// type and, when Intra_4x4 wins later, sixteen prediction modes. Swept at the | 481 | /// type and, when Intra_4x4 wins later, sixteen prediction modes. Swept at the |
| 474 | /// decision site above. | 482 | /// decision site above. |
| @@ -581,7 +589,7 @@ fn choose_inter(pic: &Picture, e: &MbEnc<'_>, mb_x: usize, mb_y: usize) -> Inter | |||
| 581 | let bits = motion_rate( | 589 | let bits = motion_rate( |
| 582 | e, | 590 | e, |
| 583 | f64::from(se_bits(i32::from(mv[0] - mvp[0])) + se_bits(i32::from(mv[1] - mvp[1]))) | 591 | 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, |
| 585 | ); | 593 | ); |
| 586 | if !satd && mv[0] & 3 == 0 && mv[1] & 3 == 0 { | 594 | if !satd && mv[0] & 3 == 0 && mv[1] & 3 == 0 { |
| 587 | let o = integer_origin( | 595 | 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 | |||
| 140 | after one pass) is the first 0.111 dB of that, for 2% of the comparison's wall | 140 | after one pass) is the first 0.111 dB of that, for 2% of the comparison's wall |
| 141 | clock: film -1.154 -> -1.043, screen capture -0.696 -> -0.661, synthetic | 141 | clock: film -1.154 -> -1.043, screen capture -0.696 -> -0.661, synthetic |
| 142 | -4.542 -> -4.449. | 142 | -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`. | ||