Skip to content

Commit

Permalink
Enable CDEF filter for 4:2:2
Browse files Browse the repository at this point in the history
Add missing logic to map CDEF direction for chroma planes.

AWCY results on derf-720p-422 at the default speed show a 9.9% decrease
in encoding speed:

   PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
-2.5572 |  0.4582 | -1.0744 |  -2.0057 | -0.1799 | -1.0506 |    -2.9736
  • Loading branch information
barrbrain committed May 11, 2020
1 parent 62ced16 commit 11b2c1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/cdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ pub fn cdef_filter_superblock<T: Pixel, U: Pixel>(
let local_pri_strength;
let local_sec_strength;
let mut local_damping: i32 = cdef_damping + coeff_shift;
// See `Cdef_Uv_Dir` constant lookup table in Section 7.15.1
// <https://aomediacodec.github.io/av1-spec/#cdef-block-process>
let local_dir = if p == 0 {
local_pri_strength =
adjust_strength(cdef_pri_y_strength << coeff_shift, var);
Expand All @@ -535,7 +537,11 @@ pub fn cdef_filter_superblock<T: Pixel, U: Pixel>(
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
}
Expand Down
4 changes: 1 addition & 3 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 11b2c1f

Please sign in to comment.