Skip to content

Commit 7dfc7a3

Browse files
committed
fix: incorporate patch for AOMediaCodec/libavif#1190
This should fix the monochrome AOM_USAGE_REALTIME bug as described in AOMediaCodec/libavif#1190 until the next release of libaom.
1 parent 2b79659 commit 7dfc7a3

3 files changed

Lines changed: 48 additions & 36 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+

wheelbuild/config.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ function build_aom {
232232
&& patch -p1 -i $CONFIG_DIR/aom-fix-stack-size.patch)
233233
extra_cmake_flags+=("-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,stack-size=2097152")
234234
fi
235+
236+
# Fix for https://github.com/AOMediaCodec/libavif/issues/1190
237+
(cd libaom-$AOM_VERSION \
238+
&& patch -p1 -i $CONFIG_DIR/aom-3.5.0-monochrome-realtime-encode.patch)
239+
235240
mkdir libaom-$AOM_VERSION/build/work
236241
(cd libaom-$AOM_VERSION/build/work \
237242
&& cmake \
@@ -498,9 +503,6 @@ function build_libavif {
498503

499504
echo "::group::Build libavif"
500505

501-
(cd libavif-$LIBAVIF_VERSION \
502-
&& patch -p1 -i $CONFIG_DIR/libavif-disable-aom_usage_realtime.patch)
503-
504506
mkdir -p libavif-$LIBAVIF_VERSION/build
505507

506508
(cd libavif-$LIBAVIF_VERSION/build \

wheelbuild/libavif-disable-aom_usage_realtime.patch

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)