diff options
author | Christophe Gisquet <christophe.gisquet@gmail.com> | 2021-06-18 00:12:22 +0300 |
---|---|---|
committer | Henrik Gramner <henrik@gramner.com> | 2021-08-20 00:22:09 +0300 |
commit | e3dbc3de9751e2e946b96ebfad06132b222c4252 (patch) | |
tree | 0baf4a164ad77669e6a07ec8a714959f78292da6 /src/refmvs.h | |
parent | 3bae53c0b684b7fedf2f5b0b662a3bbd84631aaf (diff) |
refmvs: Make splat_mv into a DSP function
Diffstat (limited to 'src/refmvs.h')
-rw-r--r-- | src/refmvs.h | 102 |
1 files changed, 9 insertions, 93 deletions
diff --git a/src/refmvs.h b/src/refmvs.h index 976d209..92208d0 100644 --- a/src/refmvs.h +++ b/src/refmvs.h @@ -35,7 +35,6 @@ #include "common/intops.h" #include "src/intra_edge.h" -#include "src/levels.h" #include "src/tables.h" #define INVALID_MV 0x80008000 @@ -97,6 +96,14 @@ typedef struct refmvs_candidate { int weight; } refmvs_candidate; +#define decl_splat_mv_fn(name) \ +void (name)(refmvs_block **rr, const refmvs_block *rmv, int bx4, int bw4, int bh4) +typedef decl_splat_mv_fn(*splat_mv_fn); + +typedef struct Dav1dRefmvsDSPContext { + splat_mv_fn splat_mv; +} Dav1dRefmvsDSPContext; + // call once per frame thread void dav1d_refmvs_init(refmvs_frame *rf); void dav1d_refmvs_clear(refmvs_frame *rf); @@ -137,97 +144,6 @@ void dav1d_refmvs_find(const refmvs_tile *rt, int *ctx, const refmvs_refpair ref, enum BlockSize bs, enum EdgeFlags edge_flags, int by4, int bx4); -static inline void splat_oneref_mv(refmvs_tile *const rt, - const int by4, const int bx4, - const enum BlockSize bs, - const enum InterPredMode mode, - const int ref, const mv mv, - const int is_interintra) -{ - const int bw4 = dav1d_block_dimensions[bs][0]; - int bh4 = dav1d_block_dimensions[bs][1]; - refmvs_block **rr = &rt->r[(by4 & 31) + 5]; - - const refmvs_block tmpl = (refmvs_block) { - .ref.ref = { ref + 1, is_interintra ? 0 : -1 }, - .mv.mv[0] = mv, - .bs = bs, - .mf = (mode == GLOBALMV && imin(bw4, bh4) >= 2) | ((mode == NEWMV) * 2), - }; - do { - refmvs_block *r = *rr++ + bx4; - for (int x = 0; x < bw4; x++) - r[x] = tmpl; - } while (--bh4); -} - -static inline void splat_intrabc_mv(refmvs_tile *const rt, - const int by4, const int bx4, - const enum BlockSize bs, const mv mv) -{ - const int bw4 = dav1d_block_dimensions[bs][0]; - int bh4 = dav1d_block_dimensions[bs][1]; - refmvs_block **rr = &rt->r[(by4 & 31) + 5]; - - const refmvs_block tmpl = (refmvs_block) { - .ref.ref = { 0, -1 }, - .mv.mv[0] = mv, - .bs = bs, - .mf = 0, - }; - do { - refmvs_block *r = *rr++ + bx4; - for (int x = 0; x < bw4; x++) { - r[x] = tmpl; - } - } while (--bh4); -} - -static inline void splat_tworef_mv(refmvs_tile *const rt, - const int by4, const int bx4, - const enum BlockSize bs, - const enum CompInterPredMode mode, - const refmvs_refpair ref, - const refmvs_mvpair mv) -{ - const int bw4 = dav1d_block_dimensions[bs][0]; - int bh4 = dav1d_block_dimensions[bs][1]; - refmvs_block **rr = &rt->r[(by4 & 31) + 5]; - - assert(bw4 >= 2 && bh4 >= 2); - const refmvs_block tmpl = (refmvs_block) { - .ref.pair = ref.pair + 0x0101, - .mv = mv, - .bs = bs, - .mf = (mode == GLOBALMV_GLOBALMV) | !!((1 << mode) & (0xbc)) * 2, - }; - do { - refmvs_block *r = *rr++ + bx4; - for (int x = 0; x < bw4; x++) - r[x] = tmpl; - } while (--bh4); -} - -static inline void splat_intraref(refmvs_tile *const rt, - const int by4, const int bx4, - const enum BlockSize bs) -{ - const int bw4 = dav1d_block_dimensions[bs][0]; - int bh4 = dav1d_block_dimensions[bs][1]; - refmvs_block **rr = &rt->r[(by4 & 31) + 5]; - - const refmvs_block tmpl = (refmvs_block) { - .ref.ref = { 0, -1 }, - .mv.mv[0].n = INVALID_MV, - .bs = bs, - .mf = 0, - }; - do { - refmvs_block *r = *rr++ + bx4; - for (int x = 0; x < bw4; x++) { - r[x] = tmpl; - } - } while (--bh4); -} +void dav1d_refmvs_dsp_init(Dav1dRefmvsDSPContext *dsp); #endif /* DAV1D_SRC_REF_MVS_H */ |