wip(av1): loop restoration CDF tables (restore_wiener/sgrproj/switchable)
Browse files at this commited590d6cc5459b4d4f6d5e418a2300756c4f482eParent: d3d40012 changed files +25 -0
- crates/ec-av1/src/cdf.rs +10 -0
- crates/ec-av1/src/cdf_state.rs +15 -0
crates/ec-av1/src/cdf.rsmodified+10 -0
| @@ -419,6 +419,16 @@ pub const PALETTE_UV_MODE: [[u16; 3]; 2] = [[32461, 32768, 0], [21488, 32768, 0] | ||
| 419 | 419 | /// `default_intrabc_cdf` (entropymode.c): the `use_intrabc` flag on an |
| 420 | 420 | /// intra frame with `allow_intrabc` set. |
| 421 | 421 | pub const INTRABC: [u16; 3] = [30531, 32768, 0]; |
| 422 | +/// `default_wiener_restore_cdf` (entropymode.c): a `RESTORE_WIENER`-plane | |
| 423 | +/// LR unit's own `use_wiener` flag (spec 5.11.57 `read_lr_unit`). | |
| 424 | +pub const RESTORE_WIENER: [u16; 3] = [11570, 32768, 0]; | |
| 425 | +/// `default_sgrproj_restore_cdf`: a `RESTORE_SGRPROJ`-plane LR unit's own | |
| 426 | +/// `use_sgrproj` flag. | |
| 427 | +pub const RESTORE_SGRPROJ: [u16; 3] = [16855, 32768, 0]; | |
| 428 | +/// `default_switchable_restore_cdf`: a `RESTORE_SWITCHABLE`-plane LR unit's | |
| 429 | +/// own `restoration_type` (3-way: `RESTORE_NONE`/`RESTORE_WIENER`/ | |
| 430 | +/// `RESTORE_SGRPROJ`). | |
| 431 | +pub const RESTORE_SWITCHABLE: [u16; 4] = [9413, 22581, 32768, 0]; | |
| 422 | 432 | |
| 423 | 433 | /// `default_tx_size_cdf[0]` (entropymode.c): an 8x8 block's `tx_depth` flag |
| 424 | 434 | /// (`TX8` vs `TX4`), indexed by `tx_size_context` (0..=2). |
crates/ec-av1/src/cdf_state.rsmodified+15 -0
| @@ -433,6 +433,15 @@ pub(crate) struct Cdfs { | ||
| 433 | 433 | pub palette_uv_size: [[u16; 8]; 7], |
| 434 | 434 | /// The `use_intrabc` flag -- see [`cdf::INTRABC`]. |
| 435 | 435 | pub intrabc: [u16; 3], |
| 436 | + /// A `RESTORE_WIENER`-plane LR unit's `use_wiener` flag -- see | |
| 437 | + /// [`cdf::RESTORE_WIENER`]. | |
| 438 | + pub restore_wiener: [u16; 3], | |
| 439 | + /// A `RESTORE_SGRPROJ`-plane LR unit's `use_sgrproj` flag -- see | |
| 440 | + /// [`cdf::RESTORE_SGRPROJ`]. | |
| 441 | + pub restore_sgrproj: [u16; 3], | |
| 442 | + /// A `RESTORE_SWITCHABLE`-plane LR unit's `restoration_type` -- see | |
| 443 | + /// [`cdf::RESTORE_SWITCHABLE`]. | |
| 444 | + pub restore_switchable: [u16; 4], | |
| 436 | 445 | } |
| 437 | 446 | |
| 438 | 447 | /// One motion vector component's adapting state (spec 9.4's `Default_Mv_*`, |
| @@ -654,6 +663,9 @@ impl Cdfs { | ||
| 654 | 663 | reset2(&mut self.palette_uv_mode); |
| 655 | 664 | reset2(&mut self.palette_uv_size); |
| 656 | 665 | reset1(&mut self.intrabc); |
| 666 | + reset1(&mut self.restore_wiener); | |
| 667 | + reset1(&mut self.restore_sgrproj); | |
| 668 | + reset1(&mut self.restore_switchable); | |
| 657 | 669 | } |
| 658 | 670 | |
| 659 | 671 | /// The defaults a key frame starts from (spec 8.4, `init_coeff_cdfs` and |
| @@ -1114,6 +1126,9 @@ impl Cdfs { | ||
| 1114 | 1126 | palette_uv_mode: cdf::PALETTE_UV_MODE, |
| 1115 | 1127 | palette_uv_size: cdf::PALETTE_UV_SIZE, |
| 1116 | 1128 | intrabc: cdf::INTRABC, |
| 1129 | + restore_wiener: cdf::RESTORE_WIENER, | |
| 1130 | + restore_sgrproj: cdf::RESTORE_SGRPROJ, | |
| 1131 | + restore_switchable: cdf::RESTORE_SWITCHABLE, | |
| 1117 | 1132 | } |
| 1118 | 1133 | } |
| 1119 | 1134 |