Commit 1d36922f authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by James Almer

av1: skip super-resolution upscaling if width < 16

This is consistent with libaom's av1_superres_scaled(). Fixes #322.
parent 7aea6858
Pipeline #12194 passed with stages
in 8 minutes and 16 seconds
......@@ -2348,7 +2348,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;
......@@ -2361,7 +2361,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];
......@@ -2541,7 +2541,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);
......@@ -3342,14 +3342,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;
......
......@@ -1993,7 +1993,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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment