Coverage Report

Created: 2026-09-07 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/aom/av1/common/obmc.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2017, Alliance for Open Media. All rights reserved.
3
 *
4
 * This source code is subject to the terms of the BSD 2 Clause License and
5
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
 * was not distributed with this source code in the LICENSE file, you can
7
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
 * Media Patent License 1.0 was not distributed with this source code in the
9
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
 */
11
12
#ifndef AOM_AV1_COMMON_OBMC_H_
13
#define AOM_AV1_COMMON_OBMC_H_
14
15
typedef void (*overlappable_nb_visitor_t)(MACROBLOCKD *xd, int rel_mi_row,
16
                                          int rel_mi_col, uint8_t op_mi_size,
17
                                          int dir, MB_MODE_INFO *nb_mi,
18
                                          void *fun_ctxt, const int num_planes);
19
20
static inline void foreach_overlappable_nb_above(const AV1_COMMON *cm,
21
                                                 MACROBLOCKD *xd, int nb_max,
22
                                                 overlappable_nb_visitor_t fun,
23
2.92M
                                                 void *fun_ctxt) {
24
2.92M
  if (!xd->up_available) return;
25
26
2.75M
  const int num_planes = av1_num_planes(cm);
27
2.75M
  int nb_count = 0;
28
2.75M
  const int mi_col = xd->mi_col;
29
  // prev_row_mi points into the mi array, starting at the beginning of the
30
  // previous row.
31
2.75M
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
2.75M
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
2.75M
  uint8_t mi_step;
34
5.97M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
3.21M
       above_mi_col += mi_step) {
36
3.21M
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
3.21M
    mi_step =
38
3.21M
        AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]);
39
    // If we're considering a block with width 4, it should be treated as
40
    // half of a pair of blocks with chroma information in the second. Move
41
    // above_mi_col back to the start of the pair if needed, set above_mbmi
42
    // to point at the block with chroma information, and set mi_step to 2 to
43
    // step over the entire pair at the end of the iteration.
44
3.21M
    if (mi_step == 1) {
45
207k
      above_mi_col &= ~1;
46
207k
      above_mi = prev_row_mi + above_mi_col + 1;
47
207k
      mi_step = 2;
48
207k
    }
49
3.21M
    if (is_neighbor_overlappable(*above_mi)) {
50
2.83M
      ++nb_count;
51
2.83M
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
2.83M
          *above_mi, fun_ctxt, num_planes);
53
2.83M
    }
54
3.21M
  }
55
2.75M
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
413k
                                                 void *fun_ctxt) {
24
413k
  if (!xd->up_available) return;
25
26
413k
  const int num_planes = av1_num_planes(cm);
27
413k
  int nb_count = 0;
28
413k
  const int mi_col = xd->mi_col;
29
  // prev_row_mi points into the mi array, starting at the beginning of the
30
  // previous row.
31
413k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
413k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
413k
  uint8_t mi_step;
34
877k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
464k
       above_mi_col += mi_step) {
36
464k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
464k
    mi_step =
38
464k
        AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]);
39
    // If we're considering a block with width 4, it should be treated as
40
    // half of a pair of blocks with chroma information in the second. Move
41
    // above_mi_col back to the start of the pair if needed, set above_mbmi
42
    // to point at the block with chroma information, and set mi_step to 2 to
43
    // step over the entire pair at the end of the iteration.
44
464k
    if (mi_step == 1) {
45
31.5k
      above_mi_col &= ~1;
46
31.5k
      above_mi = prev_row_mi + above_mi_col + 1;
47
31.5k
      mi_step = 2;
48
31.5k
    }
49
464k
    if (is_neighbor_overlappable(*above_mi)) {
50
413k
      ++nb_count;
51
413k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
413k
          *above_mi, fun_ctxt, num_planes);
53
413k
    }
54
464k
  }
55
413k
}
reconinter.c:foreach_overlappable_nb_above
Line
Count
Source
23
2.50M
                                                 void *fun_ctxt) {
24
2.50M
  if (!xd->up_available) return;
25
26
2.34M
  const int num_planes = av1_num_planes(cm);
27
2.34M
  int nb_count = 0;
28
2.34M
  const int mi_col = xd->mi_col;
29
  // prev_row_mi points into the mi array, starting at the beginning of the
30
  // previous row.
31
2.34M
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
2.34M
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
2.34M
  uint8_t mi_step;
34
5.09M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
2.75M
       above_mi_col += mi_step) {
36
2.75M
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
2.75M
    mi_step =
38
2.75M
        AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]);
39
    // If we're considering a block with width 4, it should be treated as
40
    // half of a pair of blocks with chroma information in the second. Move
41
    // above_mi_col back to the start of the pair if needed, set above_mbmi
42
    // to point at the block with chroma information, and set mi_step to 2 to
43
    // step over the entire pair at the end of the iteration.
44
2.75M
    if (mi_step == 1) {
45
176k
      above_mi_col &= ~1;
46
176k
      above_mi = prev_row_mi + above_mi_col + 1;
47
176k
      mi_step = 2;
48
176k
    }
49
2.75M
    if (is_neighbor_overlappable(*above_mi)) {
50
2.42M
      ++nb_count;
51
2.42M
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
2.42M
          *above_mi, fun_ctxt, num_planes);
53
2.42M
    }
54
2.75M
  }
55
2.34M
}
Unexecuted instantiation: rdopt.c:foreach_overlappable_nb_above
Unexecuted instantiation: reconinter_enc.c:foreach_overlappable_nb_above
Unexecuted instantiation: reconinter_enc_sse2.c:foreach_overlappable_nb_above
56
57
static inline void foreach_overlappable_nb_left(const AV1_COMMON *cm,
58
                                                MACROBLOCKD *xd, int nb_max,
59
                                                overlappable_nb_visitor_t fun,
60
1.20M
                                                void *fun_ctxt) {
61
1.20M
  if (!xd->left_available) return;
62
63
1.15M
  const int num_planes = av1_num_planes(cm);
64
1.15M
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
1.15M
  const int mi_row = xd->mi_row;
68
1.15M
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
1.15M
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
1.15M
  uint8_t mi_step;
71
2.50M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
1.34M
       left_mi_row += mi_step) {
73
1.34M
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
1.34M
    mi_step =
75
1.34M
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
1.34M
    if (mi_step == 1) {
77
113k
      left_mi_row &= ~1;
78
113k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
113k
      mi_step = 2;
80
113k
    }
81
1.34M
    if (is_neighbor_overlappable(*left_mi)) {
82
1.18M
      ++nb_count;
83
1.18M
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
1.18M
          fun_ctxt, num_planes);
85
1.18M
    }
86
1.34M
  }
87
1.15M
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
415k
                                                void *fun_ctxt) {
61
415k
  if (!xd->left_available) return;
62
63
415k
  const int num_planes = av1_num_planes(cm);
64
415k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
415k
  const int mi_row = xd->mi_row;
68
415k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
415k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
415k
  uint8_t mi_step;
71
872k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
456k
       left_mi_row += mi_step) {
73
456k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
456k
    mi_step =
75
456k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
456k
    if (mi_step == 1) {
77
43.2k
      left_mi_row &= ~1;
78
43.2k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
43.2k
      mi_step = 2;
80
43.2k
    }
81
456k
    if (is_neighbor_overlappable(*left_mi)) {
82
406k
      ++nb_count;
83
406k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
406k
          fun_ctxt, num_planes);
85
406k
    }
86
456k
  }
87
415k
}
reconinter.c:foreach_overlappable_nb_left
Line
Count
Source
60
791k
                                                void *fun_ctxt) {
61
791k
  if (!xd->left_available) return;
62
63
741k
  const int num_planes = av1_num_planes(cm);
64
741k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
741k
  const int mi_row = xd->mi_row;
68
741k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
741k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
741k
  uint8_t mi_step;
71
1.63M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
888k
       left_mi_row += mi_step) {
73
888k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
888k
    mi_step =
75
888k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
888k
    if (mi_step == 1) {
77
69.9k
      left_mi_row &= ~1;
78
69.9k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
69.9k
      mi_step = 2;
80
69.9k
    }
81
888k
    if (is_neighbor_overlappable(*left_mi)) {
82
774k
      ++nb_count;
83
774k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
774k
          fun_ctxt, num_planes);
85
774k
    }
86
888k
  }
87
741k
}
Unexecuted instantiation: rdopt.c:foreach_overlappable_nb_left
Unexecuted instantiation: reconinter_enc.c:foreach_overlappable_nb_left
Unexecuted instantiation: reconinter_enc_sse2.c:foreach_overlappable_nb_left
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_