Coverage Report

Created: 2025-08-03 06:57

/src/libvpx/vp8/common/findnearmv.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
 *  that can be found in the LICENSE file in the root of the source
6
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
9
 */
10
11
#ifndef VPX_VP8_COMMON_FINDNEARMV_H_
12
#define VPX_VP8_COMMON_FINDNEARMV_H_
13
14
#include "./vpx_config.h"
15
#include "mv.h"
16
#include "blockd.h"
17
#include "modecont.h"
18
#include "treecoder.h"
19
20
#ifdef __cplusplus
21
extern "C" {
22
#endif
23
24
static INLINE void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
25
13.8M
                           int_mv *mvp, const int *ref_frame_sign_bias) {
26
13.8M
  if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
27
813k
    mvp->as_mv.row *= -1;
28
813k
    mvp->as_mv.col *= -1;
29
813k
  }
30
13.8M
}
Unexecuted instantiation: alloccommon.c:mv_bias
decodemv.c:mv_bias
Line
Count
Source
25
13.8M
                           int_mv *mvp, const int *ref_frame_sign_bias) {
26
13.8M
  if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
27
813k
    mvp->as_mv.row *= -1;
28
813k
    mvp->as_mv.col *= -1;
29
813k
  }
30
13.8M
}
Unexecuted instantiation: findnearmv.c:mv_bias
31
32
19.2M
#define LEFT_TOP_MARGIN (16 << 3)
33
16.1M
#define RIGHT_BOTTOM_MARGIN (16 << 3)
34
5.22M
static INLINE void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
35
5.22M
  if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN)) {
36
1.05M
    mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
37
4.17M
  } else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN) {
38
39.9k
    mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
39
39.9k
  }
40
41
5.22M
  if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN)) {
42
567k
    mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
43
4.65M
  } else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN) {
44
40.0k
    mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
45
40.0k
  }
46
5.22M
}
Unexecuted instantiation: alloccommon.c:vp8_clamp_mv2
decodemv.c:vp8_clamp_mv2
Line
Count
Source
34
5.22M
static INLINE void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
35
5.22M
  if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN)) {
36
1.05M
    mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
37
4.17M
  } else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN) {
38
39.9k
    mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
39
39.9k
  }
40
41
5.22M
  if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN)) {
42
567k
    mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
43
4.65M
  } else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN) {
44
40.0k
    mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
45
40.0k
  }
46
5.22M
}
Unexecuted instantiation: findnearmv.c:vp8_clamp_mv2
47
48
static INLINE void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge,
49
                                int mb_to_right_edge, int mb_to_top_edge,
50
0
                                int mb_to_bottom_edge) {
51
0
  mv->as_mv.col =
52
0
      (mv->as_mv.col < mb_to_left_edge) ? mb_to_left_edge : mv->as_mv.col;
53
0
  mv->as_mv.col =
54
0
      (mv->as_mv.col > mb_to_right_edge) ? mb_to_right_edge : mv->as_mv.col;
55
0
  mv->as_mv.row =
56
0
      (mv->as_mv.row < mb_to_top_edge) ? mb_to_top_edge : mv->as_mv.row;
57
0
  mv->as_mv.row =
58
0
      (mv->as_mv.row > mb_to_bottom_edge) ? mb_to_bottom_edge : mv->as_mv.row;
59
0
}
Unexecuted instantiation: alloccommon.c:vp8_clamp_mv
Unexecuted instantiation: decodemv.c:vp8_clamp_mv
Unexecuted instantiation: findnearmv.c:vp8_clamp_mv
60
static INLINE unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
61
                                               int mb_to_right_edge,
62
                                               int mb_to_top_edge,
63
12.8M
                                               int mb_to_bottom_edge) {
64
12.8M
  unsigned int need_to_clamp;
65
12.8M
  need_to_clamp = (mv->as_mv.col < mb_to_left_edge);
66
12.8M
  need_to_clamp |= (mv->as_mv.col > mb_to_right_edge);
67
12.8M
  need_to_clamp |= (mv->as_mv.row < mb_to_top_edge);
68
12.8M
  need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge);
69
12.8M
  return need_to_clamp;
70
12.8M
}
Unexecuted instantiation: alloccommon.c:vp8_check_mv_bounds
decodemv.c:vp8_check_mv_bounds
Line
Count
Source
63
12.8M
                                               int mb_to_bottom_edge) {
64
12.8M
  unsigned int need_to_clamp;
65
12.8M
  need_to_clamp = (mv->as_mv.col < mb_to_left_edge);
66
12.8M
  need_to_clamp |= (mv->as_mv.col > mb_to_right_edge);
67
12.8M
  need_to_clamp |= (mv->as_mv.row < mb_to_top_edge);
68
12.8M
  need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge);
69
12.8M
  return need_to_clamp;
70
12.8M
}
Unexecuted instantiation: findnearmv.c:vp8_check_mv_bounds
71
72
void vp8_find_near_mvs(MACROBLOCKD *xd, const MODE_INFO *here, int_mv *nearest,
73
                       int_mv *nearby, int_mv *best_mv, int near_mv_ref_cnts[4],
74
                       int refframe, int *ref_frame_sign_bias);
75
76
int vp8_find_near_mvs_bias(MACROBLOCKD *xd, const MODE_INFO *here,
77
                           int_mv mode_mv_sb[2][MB_MODE_COUNT],
78
                           int_mv best_mv_sb[2], int cnt[4], int refframe,
79
                           int *ref_frame_sign_bias);
80
81
vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS - 1],
82
                           const int near_mv_ref_ct[4]);
83
84
extern const unsigned char vp8_mbsplit_offset[4][16];
85
86
0
static INLINE uint32_t left_block_mv(const MODE_INFO *cur_mb, int b) {
87
0
  if (!(b & 3)) {
88
0
    /* On L edge, get from MB to left of us */
89
0
    --cur_mb;
90
0
91
0
    if (cur_mb->mbmi.mode != SPLITMV) return cur_mb->mbmi.mv.as_int;
92
0
    b += 4;
93
0
  }
94
0
95
0
  return (cur_mb->bmi + b - 1)->mv.as_int;
96
0
}
Unexecuted instantiation: alloccommon.c:left_block_mv
Unexecuted instantiation: decodemv.c:left_block_mv
Unexecuted instantiation: findnearmv.c:left_block_mv
97
98
static INLINE uint32_t above_block_mv(const MODE_INFO *cur_mb, int b,
99
0
                                      int mi_stride) {
100
0
  if (!(b >> 2)) {
101
0
    /* On top edge, get from MB above us */
102
0
    cur_mb -= mi_stride;
103
0
104
0
    if (cur_mb->mbmi.mode != SPLITMV) return cur_mb->mbmi.mv.as_int;
105
0
    b += 16;
106
0
  }
107
0
108
0
  return (cur_mb->bmi + (b - 4))->mv.as_int;
109
0
}
Unexecuted instantiation: alloccommon.c:above_block_mv
Unexecuted instantiation: decodemv.c:above_block_mv
Unexecuted instantiation: findnearmv.c:above_block_mv
110
static INLINE B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb,
111
11.1G
                                                int b) {
112
11.1G
  if (!(b & 3)) {
113
    /* On L edge, get from MB to left of us */
114
2.78G
    --cur_mb;
115
2.78G
    switch (cur_mb->mbmi.mode) {
116
2.76G
      case B_PRED: return (cur_mb->bmi + b + 3)->as_mode;
117
15.3M
      case DC_PRED: return B_DC_PRED;
118
228k
      case V_PRED: return B_VE_PRED;
119
213k
      case H_PRED: return B_HE_PRED;
120
202k
      case TM_PRED: return B_TM_PRED;
121
0
      default: return B_DC_PRED;
122
2.78G
    }
123
2.78G
  }
124
125
8.35G
  return (cur_mb->bmi + b - 1)->as_mode;
126
11.1G
}
Unexecuted instantiation: alloccommon.c:left_block_mode
decodemv.c:left_block_mode
Line
Count
Source
111
11.1G
                                                int b) {
112
11.1G
  if (!(b & 3)) {
113
    /* On L edge, get from MB to left of us */
114
2.78G
    --cur_mb;
115
2.78G
    switch (cur_mb->mbmi.mode) {
116
2.76G
      case B_PRED: return (cur_mb->bmi + b + 3)->as_mode;
117
15.3M
      case DC_PRED: return B_DC_PRED;
118
228k
      case V_PRED: return B_VE_PRED;
119
213k
      case H_PRED: return B_HE_PRED;
120
202k
      case TM_PRED: return B_TM_PRED;
121
0
      default: return B_DC_PRED;
122
2.78G
    }
123
2.78G
  }
124
125
8.35G
  return (cur_mb->bmi + b - 1)->as_mode;
126
11.1G
}
Unexecuted instantiation: findnearmv.c:left_block_mode
127
128
static INLINE B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b,
129
11.1G
                                                 int mi_stride) {
130
11.1G
  if (!(b >> 2)) {
131
    /* On top edge, get from MB above us */
132
2.78G
    cur_mb -= mi_stride;
133
134
2.78G
    switch (cur_mb->mbmi.mode) {
135
2.77G
      case B_PRED: return (cur_mb->bmi + b + 12)->as_mode;
136
8.96M
      case DC_PRED: return B_DC_PRED;
137
271k
      case V_PRED: return B_VE_PRED;
138
257k
      case H_PRED: return B_HE_PRED;
139
272k
      case TM_PRED: return B_TM_PRED;
140
0
      default: return B_DC_PRED;
141
2.78G
    }
142
2.78G
  }
143
144
8.35G
  return (cur_mb->bmi + b - 4)->as_mode;
145
11.1G
}
Unexecuted instantiation: alloccommon.c:above_block_mode
decodemv.c:above_block_mode
Line
Count
Source
129
11.1G
                                                 int mi_stride) {
130
11.1G
  if (!(b >> 2)) {
131
    /* On top edge, get from MB above us */
132
2.78G
    cur_mb -= mi_stride;
133
134
2.78G
    switch (cur_mb->mbmi.mode) {
135
2.77G
      case B_PRED: return (cur_mb->bmi + b + 12)->as_mode;
136
8.96M
      case DC_PRED: return B_DC_PRED;
137
271k
      case V_PRED: return B_VE_PRED;
138
257k
      case H_PRED: return B_HE_PRED;
139
272k
      case TM_PRED: return B_TM_PRED;
140
0
      default: return B_DC_PRED;
141
2.78G
    }
142
2.78G
  }
143
144
8.35G
  return (cur_mb->bmi + b - 4)->as_mode;
145
11.1G
}
Unexecuted instantiation: findnearmv.c:above_block_mode
146
147
#ifdef __cplusplus
148
}  // extern "C"
149
#endif
150
151
#endif  // VPX_VP8_COMMON_FINDNEARMV_H_