external/libgav1: backport prediction border extension fix | DO NOT MERGE
cl/281117442: Fully use the frame border for reference block.
Bug: b/147491764
Test: upstream test vectors, repro test case
Change-Id: I9bc9b8490e8da1d493664145a54232414b57964c
(cherry picked from commit 22ec187ca12f72d313fe307bae3433f2719da834)
diff --git a/README.version b/README.version
index 665e6ef..261189a 100644
--- a/README.version
+++ b/README.version
@@ -3,3 +3,4 @@
BugComponent: 324837
Local Modifications:
- ab3390a external/libgav1,cosmetics: add license headers
+- backport cl/281117442: Fully use the frame border for reference block.
diff --git a/libgav1/src/tile.h b/libgav1/src/tile.h
index fd7b7c0..61637cd 100644
--- a/libgav1/src/tile.h
+++ b/libgav1/src/tile.h
@@ -352,7 +352,8 @@
int width, int height, int ref_start_x,
int ref_last_x, int ref_start_y,
int ref_last_y, int start_x, int start_y,
- int step_x, int step_y, int right_border,
+ int step_x, int step_y, int left_border,
+ int right_border, int top_border,
int bottom_border, int* ref_block_start_x,
int* ref_block_start_y, int* ref_block_end_x,
int* ref_block_end_y);
diff --git a/libgav1/src/tile/prediction.cc b/libgav1/src/tile/prediction.cc
index dbf314d..fa6b4e0 100644
--- a/libgav1/src/tile/prediction.cc
+++ b/libgav1/src/tile/prediction.cc
@@ -943,8 +943,9 @@
const int height, const int ref_start_x, const int ref_last_x,
const int ref_start_y, const int ref_last_y, const int start_x,
const int start_y, const int step_x, const int step_y,
- const int right_border, const int bottom_border, int* ref_block_start_x,
- int* ref_block_start_y, int* ref_block_end_x, int* ref_block_end_y) {
+ const int left_border, const int right_border, const int top_border,
+ const int bottom_border, int* ref_block_start_x, int* ref_block_start_y,
+ int* ref_block_end_x, int* ref_block_end_y) {
*ref_block_start_x = GetPixelPositionFromHighScale(start_x, 0, 0);
*ref_block_start_y = GetPixelPositionFromHighScale(start_y, 0, 0);
if (reference_frame_index == -1) {
@@ -964,11 +965,11 @@
kSubPixelTaps;
*ref_block_end_y = *ref_block_start_y + block_height - 1;
}
- const bool extend_left = *ref_block_start_x < ref_start_x;
- const bool extend_right = *ref_block_end_x > (ref_last_x + right_border);
- const bool extend_top = *ref_block_start_y < ref_start_y;
- const bool extend_bottom = *ref_block_end_y > (ref_last_y + bottom_border);
- return extend_left || extend_right || extend_top || extend_bottom;
+ // Determines if we need to extend beyond the left/right/top/bottom border.
+ return *ref_block_start_x < (ref_start_x - left_border) ||
+ *ref_block_end_x > (ref_last_x + right_border) ||
+ *ref_block_start_y < (ref_start_y - top_border) ||
+ *ref_block_end_y > (ref_last_y + bottom_border);
}
// Builds a block as the input for convolve, by copying the content of
@@ -1098,7 +1099,9 @@
bool extend_block = GetReferenceBlockPosition(
reference_frame_index, is_scaled, width, height, ref_start_x, ref_last_x,
ref_start_y, ref_last_y, start_x, start_y, step_x, step_y,
+ reference_buffer->left_border(plane),
reference_buffer->right_border(plane),
+ reference_buffer->top_border(plane),
reference_buffer->bottom_border(plane), &ref_block_start_x,
&ref_block_start_y, &ref_block_end_x, &ref_block_end_y);
const uint8_t* block_start = nullptr;