ec-vp8 M3: census merge fix — above-left third-candidate merge is ALIVE in libvpx, mode records now agree read-for-read for all 60 MBs
Browse files at this commit71acae1e958707d6837a91a76d93dd919a4dec8eParent: deb802d2 changed files +12 -4
crates/ec-vp8/src/modes.rsmodified+5 -3
| @@ -462,9 +462,11 @@ pub fn find_near_mvs( | |||
| 462 | } | 462 | } |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | - // libvpx checks `cnt[CNT_SPLITMV]` BEFORE computing it (the write | 465 | + // Above-left merge (libvpx decodemv.c:366): when the above-left |
| 466 | - // happens later in the same branch), so the above-left merge is | 466 | + // pushed a THIRD distinct candidate, its count landed in |
| 467 | - // effectively dead there; ported as-is with the same dead guard. | 467 | + // cnt[CNT_SPLITMV] (cntx reached slot 3), and if that candidate |
| 468 | + // equals the nearest candidate, NEAREST absorbs it. The split count | ||
| 469 | + // is then overwritten with the SPLITMV-neighbour census below. | ||
| 468 | if cnt[CNT_SPLITMV] != 0 && mvs[idx] == mvs[CNT_NEAREST] { | 470 | if cnt[CNT_SPLITMV] != 0 && mvs[idx] == mvs[CNT_NEAREST] { |
| 469 | cnt[CNT_NEAREST] += 1; | 471 | cnt[CNT_NEAREST] += 1; |
| 470 | } | 472 | } |
scripts/vp8ref_model.pymodified+7 -1
| @@ -342,6 +342,12 @@ def main(): | |||
| 342 | cnt[cx] += wgt | 342 | cnt[cx] += wgt |
| 343 | else: | 343 | else: |
| 344 | cnt[0] += wgt | 344 | cnt[0] += wgt |
| 345 | + # libvpx decodemv.c:366 — when the above-left pushed a THIRD | ||
| 346 | + # distinct candidate it counted into cnt[CNT_SPLITMV] (cntx | ||
| 347 | + # reached slot 3), and if that candidate equals the nearest, | ||
| 348 | + # NEAREST absorbs it. Alive, not dead. | ||
| 349 | + if cnt[3] != 0 and mvs[ix] == mvs[1]: | ||
| 350 | + cnt[1] += 1 | ||
| 345 | cnt[3] = (above["split"] * 2) + (left["split"] * 2) + aboveleft["split"] | 351 | cnt[3] = (above["split"] * 2) + (left["split"] * 2) + aboveleft["split"] |
| 346 | if cnt[2] > cnt[1]: | 352 | if cnt[2] > cnt[1]: |
| 347 | cnt[1], cnt[2] = cnt[2], cnt[1] | 353 | cnt[1], cnt[2] = cnt[2], cnt[1] |
| @@ -525,7 +531,7 @@ def main(): | |||
| 525 | import traceback; traceback.print_exc() | 531 | import traceback; traceback.print_exc() |
| 526 | print(f"EXC at r={r} c={c}: {e}") | 532 | print(f"EXC at r={r} c={c}: {e}") |
| 527 | raise SystemExit(1) | 533 | raise SystemExit(1) |
| 528 | - mvref_print = 4 if mbsplit[r][c] else {-1: 3, -2: 1, -3: 2, -4: 3}.get( | 534 | + mvref_print = 4 if mbsplit[r][c] else {-1: 0, -2: 1, -3: 2, -4: 3}.get( |
| 529 | mbmode[r][c], 0 | 535 | mbmode[r][c], 0 |
| 530 | ) | 536 | ) |
| 531 | print( | 537 | print( |