From ce258fa4003c1ccaecea45311ecc063e31a241ad Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 17 Nov 2018 11:05:45 -0500 Subject: Normatively allow invalid global motion parameters --- src/decode.c | 3 +++ src/internal.h | 1 + src/obu.c | 4 ---- src/recon_tmpl.c | 23 ++++++++--------------- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/decode.c b/src/decode.c index 0a4a74a..0b27de0 100644 --- a/src/decode.c +++ b/src/decode.c @@ -3071,6 +3071,9 @@ int dav1d_submit_frame(Dav1dContext *const c) { } else { f->svc[i][0].scale = 0; } + f->gmv_warp_allowed[i] = f->frame_hdr.gmv[i].type > WM_TYPE_TRANSLATION && + !f->frame_hdr.force_integer_mv && + !dav1d_get_shear_params(&f->frame_hdr.gmv[i]); } } diff --git a/src/internal.h b/src/internal.h index 557d0d6..9149c12 100644 --- a/src/internal.h +++ b/src/internal.h @@ -132,6 +132,7 @@ struct Dav1dFrameContext { const uint8_t *prev_segmap; unsigned refpoc[7], refrefpoc[7][7]; int ref_coded_width[7]; + uint8_t gmv_warp_allowed[7]; CdfThreadContext in_cdf, out_cdf; struct { Dav1dData data; diff --git a/src/obu.c b/src/obu.c index 0e3e5cb..113dd8f 100644 --- a/src/obu.c +++ b/src/obu.c @@ -41,7 +41,6 @@ #include "src/levels.h" #include "src/obu.h" #include "src/ref.h" -#include "src/warpmv.h" static int parse_seq_hdr(Dav1dContext *const c, GetBits *const gb, Av1SequenceHeader *const hdr) @@ -994,9 +993,6 @@ static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb) { mat[0] = dav1d_get_bits_subexp(gb, ref_mat[0] >> shift, bits) * (1 << shift); mat[1] = dav1d_get_bits_subexp(gb, ref_mat[1] >> shift, bits) * (1 << shift); - - if (dav1d_get_shear_params(&hdr->gmv[i])) - goto error; } } #if DEBUG_FRAME_HDR diff --git a/src/recon_tmpl.c b/src/recon_tmpl.c index 7b2d473..34a1871 100644 --- a/src/recon_tmpl.c +++ b/src/recon_tmpl.c @@ -1169,11 +1169,9 @@ int bytefn(dav1d_recon_b_inter)(Dav1dTileContext *const t, const enum BlockSize const Dav1dThreadPicture *const refp = &f->refp[b->ref[0]]; const enum Filter2d filter_2d = b->filter2d; - if (imin(bw4, bh4) > 1 && !f->frame_hdr.force_integer_mv && - ((b->inter_mode == GLOBALMV && - f->frame_hdr.gmv[b->ref[0]].type > WM_TYPE_TRANSLATION) || - (b->motion_mode == MM_WARP && - t->warpmv.type > WM_TYPE_TRANSLATION))) + if (imin(bw4, bh4) > 1 && + ((b->inter_mode == GLOBALMV && f->gmv_warp_allowed[b->ref[0]]) || + (b->motion_mode == MM_WARP && t->warpmv.type > WM_TYPE_TRANSLATION))) { res = warp_affine(t, dst, NULL, f->cur.stride[0], b_dim, 0, refp, b->motion_mode == MM_WARP ? &t->warpmv : @@ -1285,11 +1283,9 @@ int bytefn(dav1d_recon_b_inter)(Dav1dTileContext *const t, const enum BlockSize if (res) return res; } } else { - if (imin(cbw4, cbh4) > 1 && !f->frame_hdr.force_integer_mv && - ((b->inter_mode == GLOBALMV && - f->frame_hdr.gmv[b->ref[0]].type > WM_TYPE_TRANSLATION) || - (b->motion_mode == MM_WARP && - t->warpmv.type > WM_TYPE_TRANSLATION))) + if (imin(cbw4, cbh4) > 1 && + ((b->inter_mode == GLOBALMV && f->gmv_warp_allowed[b->ref[0]]) || + (b->motion_mode == MM_WARP && t->warpmv.type > WM_TYPE_TRANSLATION))) { for (int pl = 0; pl < 2; pl++) { res = warp_affine(t, ((pixel *) f->cur.data[1 + pl]) + uvdstoff, NULL, @@ -1368,9 +1364,7 @@ int bytefn(dav1d_recon_b_inter)(Dav1dTileContext *const t, const enum BlockSize for (int i = 0; i < 2; i++) { const Dav1dThreadPicture *const refp = &f->refp[b->ref[i]]; - if (b->inter_mode == GLOBALMV_GLOBALMV && !f->frame_hdr.force_integer_mv && - f->frame_hdr.gmv[b->ref[i]].type > WM_TYPE_TRANSLATION) - { + if (b->inter_mode == GLOBALMV_GLOBALMV && f->gmv_warp_allowed[b->ref[i]]) { res = warp_affine(t, NULL, tmp[i], bw4 * 4, b_dim, 0, refp, &f->frame_hdr.gmv[b->ref[i]]); if (res) return res; @@ -1413,8 +1407,7 @@ int bytefn(dav1d_recon_b_inter)(Dav1dTileContext *const t, const enum BlockSize for (int i = 0; i < 2; i++) { const Dav1dThreadPicture *const refp = &f->refp[b->ref[i]]; if (b->inter_mode == GLOBALMV_GLOBALMV && - imin(cbw4, cbh4) > 1 && !f->frame_hdr.force_integer_mv && - f->frame_hdr.gmv[b->ref[i]].type > WM_TYPE_TRANSLATION) + imin(cbw4, cbh4) > 1 && f->gmv_warp_allowed[b->ref[i]]) { res = warp_affine(t, NULL, tmp[i], bw4 * 2, b_dim, 1 + pl, refp, &f->frame_hdr.gmv[b->ref[i]]); -- cgit v1.2.3