This commit is contained in:
Robert-André Mauchin 2021-07-10 14:07:04 +02:00
parent 67b040ccac
commit 8c7452f9b8
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From f553646d70fba8e265d436103a73520eb7adec8c Mon Sep 17 00:00:00 2001
From: David Michael Barr <b@rr-dav.id.au>
Date: Thu, 8 Jul 2021 13:39:59 +0900
Subject: [PATCH] Initialise residual when less than the transform width is
visible
The input stride for forward transforms did not match the output
stride of residual computation in this case. Extend the residual
stride to the transform width and zero the non-visible portion.
Fixes #2662. Fixes #2757.
---
src/encoder.rs | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/encoder.rs b/src/encoder.rs
index 564d78d7e..1ccf8c831 100644
--- a/src/encoder.rs
+++ b/src/encoder.rs
@@ -1209,12 +1209,20 @@ pub fn encode_tx_block<T: Pixel, W: Writer>(
residual,
&ts.input_tile.planes[p].subregion(area),
&rec.subregion(area),
- visible_tx_w,
+ tx_size.width(),
visible_tx_h,
);
+ if visible_tx_w < tx_size.width() {
+ for row in residual.chunks_mut(tx_size.width()).take(visible_tx_h) {
+ for a in &mut row[visible_tx_w..] {
+ *a = 0;
+ }
+ }
+ }
}
- let visible_area = visible_tx_w * visible_tx_h;
- for a in residual[visible_area..].iter_mut() {
+ let initialized_area =
+ if visible_tx_w == 0 { 0 } else { tx_size.width() * visible_tx_h };
+ for a in residual[initialized_area..].iter_mut() {
*a = 0;
}

View File

@ -17,7 +17,7 @@
Name: rust-%{crate}
Version: 0.4.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Fastest and safest AV1 encoder
# Upstream license specification: BSD-2-Clause
@ -28,6 +28,8 @@ Source: %{crates_source}
# Initial patched metadata
# * Remove fuzzing dependencies
Patch0: rav1e-fix-metadata.diff
# Patch to fix https://github.com/xiph/rav1e/issues/2662
Patch1: https://github.com/xiph/rav1e/commit/f553646d70fba8e265d436103a73520eb7adec8c.patch
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}
@ -599,6 +601,9 @@ rm -v %{buildroot}%{_libdir}/librav1e.a
%endif
%changelog
* Sat Jul 10 12:15:47 CEST 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.1-2
- Add patch to fix https://github.com/xiph/rav1e/issues/2662
* Wed Apr 7 17:07:05 CEST 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.1-1
- Update to 0.4.1
- Close: rhbz#1915864