shithub: dav1d

Download patch

ref: 7398f083b6d798843f6fda6136be433c00e5c6e3
parent: 5a42b8019934914074f233fd057f7f3253950b79
author: Henrik Gramner <gramner@twoorioles.com>
date: Tue May 7 13:57:49 EDT 2019

Fix all remaining symbols without a dav1d prefix

--- a/src/decode.c
+++ b/src/decode.c
@@ -231,7 +231,7 @@
                         have_top && t->bx + bw4 < t->ts->tiling.col_end &&
                         (intra_edge_flags & EDGE_I444_TOP_HAS_RIGHT);
 
-#define bs(rp) dav1d_block_dimensions[sbtype_to_bs[(rp)->sb_type]]
+#define bs(rp) dav1d_block_dimensions[dav1d_sbtype_to_bs[(rp)->sb_type]]
 #define matches(rp) ((rp)->ref[0] == ref + 1 && (rp)->ref[1] == -1)
 
     if (have_top) {
@@ -1243,11 +1243,11 @@
         candidate_mv mvstack[8];
         int n_mvs;
         mv mvlist[2][2];
-        av1_find_ref_mvs(mvstack, &n_mvs, mvlist, NULL,
-                         (int[2]) { -1, -1 }, f->bw, f->bh,
-                         bs, bp, t->by, t->bx, ts->tiling.col_start,
-                         ts->tiling.col_end, ts->tiling.row_start,
-                         ts->tiling.row_end, f->libaom_cm);
+        dav1d_find_ref_mvs(mvstack, &n_mvs, mvlist, NULL,
+                           (int[2]) { -1, -1 }, f->bw, f->bh,
+                           bs, bp, t->by, t->bx, ts->tiling.col_start,
+                           ts->tiling.col_end, ts->tiling.row_start,
+                           ts->tiling.row_end, f->libaom_cm);
 
         if (mvlist[0][0].y | mvlist[0][0].x)
             b->mv[0] = mvlist[0][0];
@@ -1388,11 +1388,11 @@
             candidate_mv mvstack[8];
             int n_mvs, ctx;
             mv mvlist[2][2];
-            av1_find_ref_mvs(mvstack, &n_mvs, mvlist, &ctx,
-                             (int[2]) { b->ref[0], b->ref[1] }, f->bw, f->bh,
-                             bs, bp, t->by, t->bx, ts->tiling.col_start,
-                             ts->tiling.col_end, ts->tiling.row_start,
-                             ts->tiling.row_end, f->libaom_cm);
+            dav1d_find_ref_mvs(mvstack, &n_mvs, mvlist, &ctx,
+                               (int[2]) { b->ref[0], b->ref[1] }, f->bw, f->bh,
+                               bs, bp, t->by, t->bx, ts->tiling.col_start,
+                               ts->tiling.col_end, ts->tiling.row_start,
+                               ts->tiling.row_end, f->libaom_cm);
 
             b->mv[0] = mvstack[0].this_mv;
             b->mv[1] = mvstack[0].comp_mv;
@@ -1468,11 +1468,11 @@
             candidate_mv mvstack[8];
             int n_mvs, ctx;
             mv mvlist[2][2];
-            av1_find_ref_mvs(mvstack, &n_mvs, mvlist, &ctx,
-                             (int[2]) { b->ref[0], b->ref[1] }, f->bw, f->bh,
-                             bs, bp, t->by, t->bx, ts->tiling.col_start,
-                             ts->tiling.col_end, ts->tiling.row_start,
-                             ts->tiling.row_end, f->libaom_cm);
+            dav1d_find_ref_mvs(mvstack, &n_mvs, mvlist, &ctx,
+                               (int[2]) { b->ref[0], b->ref[1] }, f->bw, f->bh,
+                               bs, bp, t->by, t->bx, ts->tiling.col_start,
+                               ts->tiling.col_end, ts->tiling.row_start,
+                               ts->tiling.row_end, f->libaom_cm);
 
             b->inter_mode = dav1d_msac_decode_symbol_adapt8(&ts->msac,
                                 ts->cdf.m.comp_inter_mode[ctx],
@@ -1645,11 +1645,11 @@
             candidate_mv mvstack[8];
             int n_mvs, ctx;
             mv mvlist[2][2];
-            av1_find_ref_mvs(mvstack, &n_mvs, mvlist, &ctx,
-                             (int[2]) { b->ref[0], -1 }, f->bw, f->bh, bs, bp,
-                             t->by, t->bx, ts->tiling.col_start,
-                             ts->tiling.col_end, ts->tiling.row_start,
-                             ts->tiling.row_end, f->libaom_cm);
+            dav1d_find_ref_mvs(mvstack, &n_mvs, mvlist, &ctx,
+                               (int[2]) { b->ref[0], -1 }, f->bw, f->bh, bs, bp,
+                               t->by, t->bx, ts->tiling.col_start,
+                               ts->tiling.col_end, ts->tiling.row_start,
+                               ts->tiling.row_end, f->libaom_cm);
 
             // mode parsing and mv derivation from ref_mvs
             if ((seg && (seg->skip || seg->globalmv)) ||
@@ -2463,9 +2463,9 @@
             {
                 return 1;
             }
-        av1_init_ref_mv_tile_row(f->libaom_cm,
-                                 ts->tiling.col_start, ts->tiling.col_end,
-                                 t->by, imin(t->by + sb_step, f->bh));
+        dav1d_init_ref_mv_tile_row(f->libaom_cm,
+                                   ts->tiling.col_start, ts->tiling.col_end,
+                                   t->by, imin(t->by + sb_step, f->bh));
     }
     memset(t->pal_sz_uv[1], 0, sizeof(*t->pal_sz_uv));
     const int sb128y = t->by >> 5;
@@ -2765,18 +2765,18 @@
     if ((f->frame_hdr->frame_type & 1) || f->frame_hdr->allow_intrabc) {
         f->mvs = f->mvs_ref->data;
         const int order_hint_n_bits = f->seq_hdr->order_hint * f->seq_hdr->order_hint_n_bits;
-        const int ret = av1_init_ref_mv_common(f->libaom_cm, f->bw >> 1, f->bh >> 1,
-                                               f->b4_stride, f->seq_hdr->sb128,
-                                               f->mvs, f->ref_mvs,
-                                               f->cur.frame_hdr->frame_offset,
-                                               f->refpoc,
-                                               f->refrefpoc, f->frame_hdr->gmv,
-                                               f->frame_hdr->hp, f->frame_hdr->force_integer_mv,
-                                               f->frame_hdr->use_ref_frame_mvs,
-                                               order_hint_n_bits);
+        const int ret = dav1d_init_ref_mv_common(f->libaom_cm, f->bw >> 1, f->bh >> 1,
+                                                 f->b4_stride, f->seq_hdr->sb128,
+                                                 f->mvs, f->ref_mvs,
+                                                 f->cur.frame_hdr->frame_offset,
+                                                 f->refpoc,
+                                                 f->refrefpoc, f->frame_hdr->gmv,
+                                                 f->frame_hdr->hp, f->frame_hdr->force_integer_mv,
+                                                 f->frame_hdr->use_ref_frame_mvs,
+                                                 order_hint_n_bits);
         if (ret < 0) goto error;
         if (c->n_fc == 1 && f->frame_hdr->use_ref_frame_mvs)
-            av1_init_ref_mv_tile_row(f->libaom_cm, 0, f->bw, 0, f->bh);
+            dav1d_init_ref_mv_tile_row(f->libaom_cm, 0, f->bw, 0, f->bh);
     }
     retval = -EINVAL;
 
--- a/src/lib.c
+++ b/src/lib.c
@@ -163,7 +163,7 @@
                 t->tile_thread.td.inited = 1;
             }
         }
-        f->libaom_cm = av1_alloc_ref_mv_common();
+        f->libaom_cm = dav1d_alloc_ref_mv_common();
         if (!f->libaom_cm) goto error;
         if (c->n_fc > 1) {
             if (pthread_mutex_init(&f->frame_thread.td.lock, NULL)) goto error;
@@ -509,7 +509,7 @@
         free(f->lf.lr_mask);
         free(f->lf.level);
         free(f->lf.tx_lpf_right_edge[0]);
-        if (f->libaom_cm) av1_free_ref_mv_common(f->libaom_cm);
+        if (f->libaom_cm) dav1d_free_ref_mv_common(f->libaom_cm);
         dav1d_free_aligned(f->lf.cdef_line);
         dav1d_free_aligned(f->lf.lr_lpf_line);
     }
--- a/src/recon_tmpl.c
+++ b/src/recon_tmpl.c
@@ -639,7 +639,7 @@
             // only odd blocks are considered for overlap handling, hence +1
             const refmvs *const a_r = &r[x - f->b4_stride + 1];
             const uint8_t *const a_b_dim =
-                dav1d_block_dimensions[sbtype_to_bs[a_r->sb_type]];
+                dav1d_block_dimensions[dav1d_sbtype_to_bs[a_r->sb_type]];
 
             if (a_r->ref[0] > 0) {
                 const int ow4 = iclip(a_b_dim[0], 2, b_dim[0]);
@@ -662,7 +662,7 @@
             // only odd blocks are considered for overlap handling, hence +1
             const refmvs *const l_r = &r[(y + 1) * f->b4_stride - 1];
             const uint8_t *const l_b_dim =
-                dav1d_block_dimensions[sbtype_to_bs[l_r->sb_type]];
+                dav1d_block_dimensions[dav1d_sbtype_to_bs[l_r->sb_type]];
 
             if (l_r->ref[0] > 0) {
                 const int ow4 = imin(b_dim[0], 16) >> 1;
--- a/src/ref_mvs.c
+++ b/src/ref_mvs.c
@@ -766,25 +766,6 @@
   return comp_ctx;
 }
 
-static void av1_setup_frame_buf_refs(AV1_COMMON *cm);
-void av1_setup_frame_sign_bias(AV1_COMMON *cm);
-void av1_setup_skip_mode_allowed(AV1_COMMON *cm);
-
-void av1_copy_frame_mvs(const AV1_COMMON *const cm, MB_MODE_INFO *mi,
-                        int mi_row, int mi_col, int x_mis, int y_mis);
-
-static void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
-                      MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
-                      uint8_t ref_mv_count[MODE_CTX_REF_FRAMES],
-                      CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE],
-                      int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES],
-                      int_mv *global_mvs, int mi_row, int mi_col,
-                      int16_t *mode_context);
-
-int selectSamples(MV *mv, int *pts, int *pts_inref, int len, BLOCK_SIZE bsize);
-int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
-                int *pts, int *pts_inref);
-
 #define INTRABC_DELAY_PIXELS 256  //  Delay of 256 pixels
 #define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
 #define USE_WAVE_FRONT 1  // Use only top left area of frame for reference.
@@ -1850,7 +1831,7 @@
     N_BS_SIZES,
 };
 extern const uint8_t dav1d_block_dimensions[N_BS_SIZES][4];
-const uint8_t bs_to_sbtype[N_BS_SIZES] = {
+const uint8_t dav1d_bs_to_sbtype[N_BS_SIZES] = {
     [BS_128x128] = BLOCK_128X128,
     [BS_128x64] = BLOCK_128X64,
     [BS_64x128] = BLOCK_64X128,
@@ -1874,7 +1855,7 @@
     [BS_4x8] = BLOCK_4X8,
     [BS_4x4] = BLOCK_4X4,
 };
-const uint8_t sbtype_to_bs[BLOCK_SIZES_ALL] = {
+const uint8_t dav1d_sbtype_to_bs[BLOCK_SIZES_ALL] = {
     [BLOCK_128X128] = BS_128x128,
     [BLOCK_128X64] = BS_128x64,
     [BLOCK_64X128] = BS_64x128,
@@ -1901,18 +1882,18 @@
 
 #include <stdio.h>
 
-void av1_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
-                      int *ctx, int refidx_dav1d[2],
-                      int w4, int h4, int bs, int bp, int by4, int bx4,
-                      int tile_col_start4, int tile_col_end4,
-                      int tile_row_start4, int tile_row_end4,
-                      AV1_COMMON *cm);
-void av1_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
-                      int *ctx, int refidx_dav1d[2],
-                      int w4, int h4, int bs, int bp, int by4, int bx4,
-                      int tile_col_start4, int tile_col_end4,
-                      int tile_row_start4, int tile_row_end4,
-                      AV1_COMMON *cm)
+void dav1d_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
+                        int *ctx, int refidx_dav1d[2],
+                        int w4, int h4, int bs, int bp, int by4, int bx4,
+                        int tile_col_start4, int tile_col_end4,
+                        int tile_row_start4, int tile_row_end4,
+                        AV1_COMMON *cm);
+void dav1d_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
+                        int *ctx, int refidx_dav1d[2],
+                        int w4, int h4, int bs, int bp, int by4, int bx4,
+                        int tile_col_start4, int tile_col_end4,
+                        int tile_row_start4, int tile_row_end4,
+                        AV1_COMMON *cm)
 {
     const int bw4 = dav1d_block_dimensions[bs][0];
     const int bh4 = dav1d_block_dimensions[bs][1];
@@ -1940,7 +1921,7 @@
             .partition = bp,
         },
     };
-    xd.mi->sb_type = bs_to_sbtype[bs];
+    xd.mi->sb_type = dav1d_bs_to_sbtype[bs];
     if (xd.n8_w < xd.n8_h) {
         // Only mark is_sec_rect as 1 for the last block.
         // For PARTITION_VERT_4, it would be (0, 0, 0, 1);
@@ -1980,34 +1961,26 @@
     }
 }
 
-int av1_init_ref_mv_common(AV1_COMMON *cm,
-                           const int w8, const int h8,
-                           const ptrdiff_t stride,
-                           const int allow_sb128,
-                           MV_REF *cur,
-                           MV_REF *ref_mvs[7],
-                           const unsigned cur_poc,
-                           const unsigned ref_poc[7],
-                           const unsigned ref_ref_poc[7][7],
-                           const Dav1dWarpedMotionParams gmv[7],
-                           const int allow_hp,
-                           const int force_int_mv,
-                           const int allow_ref_frame_mvs,
-                           const int order_hint);
-int av1_init_ref_mv_common(AV1_COMMON *cm,
-                           const int w8, const int h8,
-                           const ptrdiff_t stride,
-                           const int allow_sb128,
-                           MV_REF *cur,
-                           MV_REF *ref_mvs[7],
-                           const unsigned cur_poc,
-                           const unsigned ref_poc[7],
-                           const unsigned ref_ref_poc[7][7],
-                           const Dav1dWarpedMotionParams gmv[7],
-                           const int allow_hp,
-                           const int force_int_mv,
-                           const int allow_ref_frame_mvs,
-                           const int order_hint)
+int dav1d_init_ref_mv_common(AV1_COMMON *cm, const int w8, const int h8,
+                             const ptrdiff_t stride, const int allow_sb128,
+                             MV_REF *cur, MV_REF *ref_mvs[7],
+                             const unsigned cur_poc,
+                             const unsigned ref_poc[7],
+                             const unsigned ref_ref_poc[7][7],
+                             const Dav1dWarpedMotionParams gmv[7],
+                             const int allow_hp, const int force_int_mv,
+                             const int allow_ref_frame_mvs,
+                             const int order_hint);
+int dav1d_init_ref_mv_common(AV1_COMMON *cm, const int w8, const int h8,
+                             const ptrdiff_t stride, const int allow_sb128,
+                             MV_REF *cur, MV_REF *ref_mvs[7],
+                             const unsigned cur_poc,
+                             const unsigned ref_poc[7],
+                             const unsigned ref_ref_poc[7][7],
+                             const Dav1dWarpedMotionParams gmv[7],
+                             const int allow_hp, const int force_int_mv,
+                             const int allow_ref_frame_mvs,
+                             const int order_hint)
 {
     if (cm->mi_cols != (w8 << 1) || cm->mi_rows != (h8 << 1)) {
         const int align_h = (h8 + 15) & ~15;
@@ -2061,12 +2034,12 @@
     return 0;
 }
 
-void av1_init_ref_mv_tile_row(AV1_COMMON *cm,
-                              int tile_col_start4, int tile_col_end4,
-                              int row_start4, int row_end4);
-void av1_init_ref_mv_tile_row(AV1_COMMON *cm,
-                              int tile_col_start4, int tile_col_end4,
-                              int row_start4, int row_end4)
+void dav1d_init_ref_mv_tile_row(AV1_COMMON *cm,
+                                int tile_col_start4, int tile_col_end4,
+                                int row_start4, int row_end4);
+void dav1d_init_ref_mv_tile_row(AV1_COMMON *cm,
+                                int tile_col_start4, int tile_col_end4,
+                                int row_start4, int row_end4)
 {
   RefCntBuffer *const frame_bufs = cm->buffer_pool.frame_bufs;
   const int cur_order_hint = cm->cur_frame.cur_frame_offset;
@@ -2115,8 +2088,8 @@
                                   row_start4, row_end4)) --ref_stamp;
 }
 
-AV1_COMMON *av1_alloc_ref_mv_common(void);
-AV1_COMMON *av1_alloc_ref_mv_common(void) {
+AV1_COMMON *dav1d_alloc_ref_mv_common(void);
+AV1_COMMON *dav1d_alloc_ref_mv_common(void) {
     AV1_COMMON *cm = malloc(sizeof(*cm));
     if (!cm) return NULL;
     memset(cm, 0, sizeof(*cm));
@@ -2123,8 +2096,8 @@
     return cm;
 }
 
-void av1_free_ref_mv_common(AV1_COMMON *cm);
-void av1_free_ref_mv_common(AV1_COMMON *cm) {
+void dav1d_free_ref_mv_common(AV1_COMMON *cm);
+void dav1d_free_ref_mv_common(AV1_COMMON *cm) {
     if (cm->tpl_mvs) free(cm->tpl_mvs);
     free(cm);
 }
--- a/src/ref_mvs.h
+++ b/src/ref_mvs.h
@@ -32,38 +32,35 @@
 typedef struct AV1_COMMON AV1_COMMON;
 
 // call once per frame thread
-AV1_COMMON *av1_alloc_ref_mv_common(void);
-void av1_free_ref_mv_common(AV1_COMMON *cm);
+AV1_COMMON *dav1d_alloc_ref_mv_common(void);
+void dav1d_free_ref_mv_common(AV1_COMMON *cm);
 
 // call once per frame
-int av1_init_ref_mv_common(AV1_COMMON *cm,
-                           int w8, int h8,
-                           ptrdiff_t stride,
-                           int allow_sb128,
-                           refmvs *cur,
-                           refmvs *ref_mvs[7],
-                           unsigned cur_poc,
-                           const unsigned ref_poc[7],
-                           const unsigned ref_ref_poc[7][7],
-                           const Dav1dWarpedMotionParams gmv[7],
-                           int allow_hp, int force_int_mv,
-                           int allow_ref_frame_mvs, int order_hint);
+int dav1d_init_ref_mv_common(AV1_COMMON *cm, int w8, int h8,
+                             ptrdiff_t stride, int allow_sb128,
+                             refmvs *cur, refmvs *ref_mvs[7],
+                             unsigned cur_poc,
+                             const unsigned ref_poc[7],
+                             const unsigned ref_ref_poc[7][7],
+                             const Dav1dWarpedMotionParams gmv[7],
+                             int allow_hp, int force_int_mv,
+                             int allow_ref_frame_mvs, int order_hint);
 
 // call for start of each sbrow per tile
-void av1_init_ref_mv_tile_row(AV1_COMMON *cm,
-                              int tile_col_start4, int tile_col_end4,
-                              int row_start4, int row_end4);
+void dav1d_init_ref_mv_tile_row(AV1_COMMON *cm,
+                                int tile_col_start4, int tile_col_end4,
+                                int row_start4, int row_end4);
 
 // call for each block
-void av1_find_ref_mvs(candidate_mv *mvstack, int *cnt, mv (*mvlist)[2],
-                      int *ctx, int refidx[2], int w4, int h4,
-                      enum BlockSize bs, enum BlockPartition bp,
-                      int by4, int bx4, int tile_col_start4,
-                      int tile_col_end4, int tile_row_start4,
-                      int tile_row_end4, AV1_COMMON *cm);
+void dav1d_find_ref_mvs(candidate_mv *mvstack, int *cnt, mv (*mvlist)[2],
+                        int *ctx, int refidx[2], int w4, int h4,
+                        enum BlockSize bs, enum BlockPartition bp,
+                        int by4, int bx4, int tile_col_start4,
+                        int tile_col_end4, int tile_row_start4,
+                        int tile_row_end4, AV1_COMMON *cm);
 
-extern const uint8_t bs_to_sbtype[];
-extern const uint8_t sbtype_to_bs[];
+extern const uint8_t dav1d_bs_to_sbtype[];
+extern const uint8_t dav1d_sbtype_to_bs[];
 static inline void splat_oneref_mv(refmvs *r, const ptrdiff_t stride,
                                    const int by4, const int bx4,
                                    const enum BlockSize bs,
@@ -78,7 +75,7 @@
     const refmvs tmpl = (refmvs) {
         .ref = { ref + 1, is_interintra ? 0 : -1 },
         .mv = { mv },
-        .sb_type = bs_to_sbtype[bs],
+        .sb_type = dav1d_bs_to_sbtype[bs],
         .mode = N_INTRA_PRED_MODES + mode,
     };
     do {
@@ -99,7 +96,7 @@
     const refmvs tmpl = (refmvs) {
         .ref = { 0, -1 },
         .mv = { mv },
-        .sb_type = bs_to_sbtype[bs],
+        .sb_type = dav1d_bs_to_sbtype[bs],
         .mode = DC_PRED,
     };
     do {
@@ -123,7 +120,7 @@
     const refmvs tmpl = (refmvs) {
         .ref = { ref1 + 1, ref2 + 1 },
         .mv = { mv1, mv2 },
-        .sb_type = bs_to_sbtype[bs],
+        .sb_type = dav1d_bs_to_sbtype[bs],
         .mode = N_INTRA_PRED_MODES + N_INTER_PRED_MODES + mode,
     };
     do {
@@ -149,7 +146,7 @@
             r[x] = (refmvs) {
                 .ref = { 0, -1 },
                 .mv = { [0] = { .y = -0x8000, .x = -0x8000 }, },
-                .sb_type = bs_to_sbtype[bs],
+                .sb_type = dav1d_bs_to_sbtype[bs],
                 .mode = mode,
             };
         r += stride;