|
| 1 | +From bf9d1f8d2b649ee8a02e6e8792075330bde185d4 Mon Sep 17 00:00:00 2001 |
| 2 | +From: James Zern <jzern@google.com> |
| 3 | +Date: Thu, 27 Oct 2022 18:17:47 -0700 |
| 4 | +Subject: [PATCH] fix monochrome encoding in realtime mode |
| 5 | + |
| 6 | +this is non-exhaustive, but covers the file in the issue report and the |
| 7 | +newly added MonochromeRealtimeTest. |
| 8 | + |
| 9 | +Bug: https://github.com/AOMediaCodec/libavif/issues/1190 |
| 10 | +Change-Id: I947a5d926daaae9c0a667114996ddd7bf9ff2013 |
| 11 | +--- |
| 12 | + av1/encoder/nonrd_pickmode.c | 3 ++- |
| 13 | + av1/encoder/var_based_part.c | 2 +- |
| 14 | + test/monochrome_test.cc | 47 +++++++++++++++++++++++++++++------- |
| 15 | + 3 files changed, 41 insertions(+), 11 deletions(-) |
| 16 | + |
| 17 | +diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c |
| 18 | +index 7267f9e39b..009b3c360d 100644 |
| 19 | +--- a/av1/encoder/nonrd_pickmode.c |
| 20 | ++++ b/av1/encoder/nonrd_pickmode.c |
| 21 | +@@ -2777,7 +2777,8 @@ void set_color_sensitivity(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, |
| 22 | + x->color_sensitivity[1] = 0; |
| 23 | + return; |
| 24 | + } |
| 25 | +- for (int i = 1; i <= 2; ++i) { |
| 26 | ++ const int num_planes = av1_num_planes(&cpi->common); |
| 27 | ++ for (int i = 1; i < num_planes; ++i) { |
| 28 | + if (x->color_sensitivity[i - 1] == 2 || source_variance < 50) { |
| 29 | + struct macroblock_plane *const p = &x->plane[i]; |
| 30 | + const BLOCK_SIZE bs = |
| 31 | +diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c |
| 32 | +index efcb5a71f0..63f807733b 100644 |
| 33 | +--- a/av1/encoder/var_based_part.c |
| 34 | ++++ b/av1/encoder/var_based_part.c |
| 35 | +@@ -1237,7 +1237,7 @@ static void setup_planes(AV1_COMP *cpi, MACROBLOCK *x, unsigned int *y_sad, |
| 36 | + set_ref_ptrs(cm, xd, mi->ref_frame[0], mi->ref_frame[1]); |
| 37 | + av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, |
| 38 | + cm->seq_params->sb_size, AOM_PLANE_Y, |
| 39 | +- AOM_PLANE_V); |
| 40 | ++ num_planes - 1); |
| 41 | + } |
| 42 | + } |
| 43 | + |
0 commit comments