From fb08f7e9b1566b3c7a247bd6a5614e9035a2ef72 Mon Sep 17 00:00:00 2001 From: David Michael Barr Date: Mon, 11 May 2020 18:39:42 +0900 Subject: [PATCH] Enable CDEF filter for 4:2:2 The logic to map CDEF direction for chroma planes was missing. --- src/cdef.rs | 6 +++++- src/encoder.rs | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cdef.rs b/src/cdef.rs index 8f6d7636d2..1dd4ba3abe 100644 --- a/src/cdef.rs +++ b/src/cdef.rs @@ -535,7 +535,11 @@ pub fn cdef_filter_superblock( local_sec_strength = cdef_sec_uv_strength << coeff_shift; local_damping -= 1; if cdef_pri_uv_strength != 0 { - dir as usize + if xdec != ydec { + [7, 0, 2, 4, 5, 6, 6, 6][dir as usize] + } else { + dir as usize + } } else { 0 } diff --git a/src/encoder.rs b/src/encoder.rs index 3a1011043e..c02d93167f 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -242,9 +242,7 @@ impl Sequence { enable_ref_frame_mvs: false, enable_warped_motion: false, enable_superres: false, - enable_cdef: config.speed_settings.cdef - && config.chroma_sampling != ChromaSampling::Cs422 - && enable_restoration_filters, + enable_cdef: config.speed_settings.cdef && enable_restoration_filters, enable_restoration: config.speed_settings.lrf && config.chroma_sampling != ChromaSampling::Cs422 && enable_restoration_filters,