Ignore super-res below 16 pixels
Suggested patch:
From 7e58c9e17ca13129da385bf8946851f7dfdffad4 Mon Sep 17 00:00:00 2001
From: "Ronald S. Bultje" <rsbultje@gmail.com>
Date: Sat, 28 Dec 2019 13:52:34 -0500
Subject: [PATCH] x
---
src/decode.c | 10 +++++-----
src/recon_tmpl.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/decode.c b/src/decode.c
index a2a13c8..da3f3c9 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -2341,7 +2341,7 @@ static void setup_tile(Dav1dTileState *const ts,
// Reference Restoration Unit (used for exp coding)
int sb_idx, unit_idx;
- if (f->frame_hdr->super_res.enabled) {
+ if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
// vertical components only
sb_idx = (ts->tiling.row_start >> 5) * f->sr_sb128w;
unit_idx = (ts->tiling.row_start & 16) >> 3;
@@ -2354,7 +2354,7 @@ static void setup_tile(Dav1dTileState *const ts,
if (!((f->lf.restore_planes >> p) & 1U))
continue;
- if (f->frame_hdr->super_res.enabled) {
+ if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
const int ss_hor = p && f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
const int d = f->frame_hdr->super_res.width_scale_denominator;
const int unit_size_log2 = f->frame_hdr->restoration.unit_size[!!p];
@@ -2534,7 +2534,7 @@ int dav1d_decode_tile_sbrow(Dav1dTileContext *const t) {
const enum Dav1dRestorationType frame_type = f->frame_hdr->restoration.type[p];
- if (f->frame_hdr->super_res.enabled) {
+ if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
const int w = (f->sr_cur.p.p.w + ss_hor) >> ss_hor;
const int n_units = imax(1, (w + half_unit) >> unit_size_log2);
@@ -3326,14 +3326,14 @@ int dav1d_submit_frame(Dav1dContext *const c) {
res = dav1d_thread_picture_alloc(c, f, bpc);
if (res < 0) goto error;
- if (f->frame_hdr->super_res.enabled) {
+ if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
res = dav1d_picture_alloc_copy(c, &f->cur, f->frame_hdr->width[0], &f->sr_cur.p);
if (res < 0) goto error;
} else {
dav1d_picture_ref(&f->cur, &f->sr_cur.p);
}
- if (f->frame_hdr->super_res.enabled) {
+ if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
f->resize_step[0] = scale_fac(f->cur.p.w, f->sr_cur.p.p.w);
const int ss_hor = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I444;
const int in_cw = (f->cur.p.w + ss_hor) >> ss_hor;
diff --git a/src/recon_tmpl.c b/src/recon_tmpl.c
index 6c8f8f5..b0e3993 100644
--- a/src/recon_tmpl.c
+++ b/src/recon_tmpl.c
@@ -1991,7 +1991,7 @@ void bytefn(dav1d_filter_sbrow)(Dav1dFrameContext *const f, const int sby) {
bytefn(dav1d_cdef_brow)(f, f->lf.p, f->lf.mask_ptr, sby * sbsz,
imin(sby * sbsz + n_blks, f->bh));
}
- if (f->frame_hdr->super_res.enabled) {
+ if (f->frame_hdr->width[0] != f->frame_hdr->width[1]) {
const int has_chroma = f->cur.p.layout != DAV1D_PIXEL_LAYOUT_I400;
for (int pl = 0; pl < 1 + 2 * has_chroma; pl++) {
const int ss_ver = pl && f->cur.p.layout == DAV1D_PIXEL_LAYOUT_I420;
--
2.8.