The inter-block gates take the reference bank as a RefPix handle
Browse files at this commit386b5068487455f180211c9a7c75fb213ba9df12Parent: b8ec726- test
- the inter-block gates take the reference bank as a RefPix handle
1 changed file +23 -35
- crates/ec-av1/src/decode.rs +23 -35
crates/ec-av1/src/decode.rsmodified+23 -35
| @@ -34914,6 +34914,14 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 34914 | 34914 | ||
| 34915 | #[cfg(test)] | 34915 | #[cfg(test)] |
| 34916 | mod tests { | 34916 | mod tests { |
| 34917 | + /// lane-twostage: the reference bank these gates decode against -- | ||
| 34918 | + /// `LAST_FRAME` alone, already in hand (`ref_frame` index 1). | ||
| 34919 | + fn last_only(reference: &Picture) -> RefPix<'_> { | ||
| 34920 | + let mut refs: [Option<&Picture>; 8] = [None; 8]; | ||
| 34921 | + refs[1] = Some(reference); | ||
| 34922 | + RefPix::ready(refs) | ||
| 34923 | + } | ||
| 34924 | + | ||
| 34917 | 34925 | ||
| 34918 | /// lane-perf6 step 2: the CDEF kernel now reads a pre-gathered window and | 34926 | /// lane-perf6 step 2: the CDEF kernel now reads a pre-gathered window and |
| 34919 | /// a pre-resolved damping shift instead of a bounds-testing closure and a | 34927 | /// a pre-resolved damping shift instead of a bounds-testing closure and a |
| @@ -35960,8 +35968,7 @@ mod tests { | |||
| 35960 | 40, | 35968 | 40, |
| 35961 | 64, | 35969 | 64, |
| 35962 | 64, | 35970 | 64, |
| 35963 | - &reference, | 35971 | + &last_only(&reference), |
| 35964 | - [None; 8], | ||
| 35965 | &CdefParams::default(), | 35972 | &CdefParams::default(), |
| 35966 | &LoopFilterParams::default(), | 35973 | &LoopFilterParams::default(), |
| 35967 | false, | 35974 | false, |
| @@ -36302,8 +36309,7 @@ mod tests { | |||
| 36302 | frame.base_q_idx, | 36309 | frame.base_q_idx, |
| 36303 | width as u32, | 36310 | width as u32, |
| 36304 | height as u32, | 36311 | height as u32, |
| 36305 | - &reference, | 36312 | + &last_only(&reference), |
| 36306 | - [None; 8], | ||
| 36307 | &CdefParams::default(), | 36313 | &CdefParams::default(), |
| 36308 | &LoopFilterParams::default(), | 36314 | &LoopFilterParams::default(), |
| 36309 | false, | 36315 | false, |
| @@ -36421,37 +36427,21 @@ mod tests { | |||
| 36421 | 36427 | ||
| 36422 | let (width, height) = (64usize, 64usize); | 36428 | let (width, height) = (64usize, 64usize); |
| 36423 | let ref_pattern: Vec<u16> = (0..width * height).map(|i| (i % 251) as u16).collect(); | 36429 | let ref_pattern: Vec<u16> = (0..width * height).map(|i| (i % 251) as u16).collect(); |
| 36424 | - let ref_plane = |scale: usize| PlaneBuf { | 36430 | + let chroma: Vec<u16> = ref_pattern |
| 36425 | - data: std::borrow::Cow::Owned( | 36431 | + .iter() |
| 36426 | - ref_pattern | 36432 | + .step_by(2) |
| 36427 | - .iter() | 36433 | + .take((width / 2) * (height / 2)) |
| 36428 | - .step_by(scale.max(1)) | 36434 | + .copied() |
| 36429 | - .take((width / scale) * (height / scale)) | 36435 | + .collect(); |
| 36430 | - .copied() | 36436 | + let reference = Picture { |
| 36431 | - .collect(), | ||
| 36432 | - ), | ||
| 36433 | - width: width / scale, | ||
| 36434 | - height: height / scale, | ||
| 36435 | - true_width: width / scale, | ||
| 36436 | - true_height: height / scale, | ||
| 36437 | - tile_x0: 0, | ||
| 36438 | - tile_y0: 0, | ||
| 36439 | - tile_x1: width / scale, | ||
| 36440 | - tile_y1: height / scale, | ||
| 36441 | - }; | ||
| 36442 | - let ref_y = PlaneBuf { | ||
| 36443 | - data: std::borrow::Cow::Owned(ref_pattern.clone()), | ||
| 36444 | width, | 36437 | width, |
| 36445 | height, | 36438 | height, |
| 36446 | - true_width: width, | 36439 | + y: ref_pattern.clone(), |
| 36447 | - true_height: height, | 36440 | + u: chroma.clone(), |
| 36448 | - tile_x0: 0, | 36441 | + v: chroma, |
| 36449 | - tile_y0: 0, | ||
| 36450 | - tile_x1: width, | ||
| 36451 | - tile_y1: height, | ||
| 36452 | }; | 36442 | }; |
| 36453 | - let ref_u = ref_plane(2); | 36443 | + let refpix = &last_only(&reference); |
| 36454 | - let ref_v = ref_plane(2); | 36444 | + let ref_y = whole_plane(&reference.y, width, height); |
| 36455 | 36445 | ||
| 36456 | let mut y = PlaneBuf { | 36446 | let mut y = PlaneBuf { |
| 36457 | data: std::borrow::Cow::Owned(vec![0u16; width * height]), | 36447 | data: std::borrow::Cow::Owned(vec![0u16; width * height]), |
| @@ -36503,7 +36493,6 @@ mod tests { | |||
| 36503 | &mut u, | 36493 | &mut u, |
| 36504 | &mut v, | 36494 | &mut v, |
| 36505 | refpix, | 36495 | refpix, |
| 36506 | - &[None; 8], | ||
| 36507 | &NO_SIGN_BIAS, | 36496 | &NO_SIGN_BIAS, |
| 36508 | &[ec_av1_syntax::WarpParams::default(); 7], | 36497 | &[ec_av1_syntax::WarpParams::default(); 7], |
| 36509 | 100, | 36498 | 100, |
| @@ -36629,8 +36618,7 @@ mod tests { | |||
| 36629 | frame.base_q_idx, | 36618 | frame.base_q_idx, |
| 36630 | coded_w, | 36619 | coded_w, |
| 36631 | coded_h, | 36620 | coded_h, |
| 36632 | - &reference, | 36621 | + &last_only(&reference), |
| 36633 | - [None; 8], | ||
| 36634 | &CdefParams::default(), | 36622 | &CdefParams::default(), |
| 36635 | &LoopFilterParams::default(), | 36623 | &LoopFilterParams::default(), |
| 36636 | false, | 36624 | false, |