Coverage Report

Created: 2025-12-31 06:49

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.71M
                                                 void *fun_ctxt) {
24
2.71M
  if (!xd->up_available) return;
25
26
2.60M
  const int num_planes = av1_num_planes(cm);
27
2.60M
  int nb_count = 0;
28
2.60M
  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.60M
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
2.60M
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
2.60M
  uint8_t mi_step;
34
5.62M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
3.01M
       above_mi_col += mi_step) {
36
3.01M
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
3.01M
    mi_step =
38
3.01M
        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.01M
    if (mi_step == 1) {
45
213k
      above_mi_col &= ~1;
46
213k
      above_mi = prev_row_mi + above_mi_col + 1;
47
213k
      mi_step = 2;
48
213k
    }
49
3.01M
    if (is_neighbor_overlappable(*above_mi)) {
50
2.60M
      ++nb_count;
51
2.60M
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
2.60M
          *above_mi, fun_ctxt, num_planes);
53
2.60M
    }
54
3.01M
  }
55
2.60M
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
408k
                                                 void *fun_ctxt) {
24
408k
  if (!xd->up_available) return;
25
26
408k
  const int num_planes = av1_num_planes(cm);
27
408k
  int nb_count = 0;
28
408k
  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
408k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
408k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
408k
  uint8_t mi_step;
34
863k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
455k
       above_mi_col += mi_step) {
36
455k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
455k
    mi_step =
38
455k
        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
455k
    if (mi_step == 1) {
45
31.4k
      above_mi_col &= ~1;
46
31.4k
      above_mi = prev_row_mi + above_mi_col + 1;
47
31.4k
      mi_step = 2;
48
31.4k
    }
49
455k
    if (is_neighbor_overlappable(*above_mi)) {
50
400k
      ++nb_count;
51
400k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
400k
          *above_mi, fun_ctxt, num_planes);
53
400k
    }
54
455k
  }
55
408k
}
reconinter.c:foreach_overlappable_nb_above
Line
Count
Source
23
2.30M
                                                 void *fun_ctxt) {
24
2.30M
  if (!xd->up_available) return;
25
26
2.19M
  const int num_planes = av1_num_planes(cm);
27
2.19M
  int nb_count = 0;
28
2.19M
  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.19M
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
2.19M
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
2.19M
  uint8_t mi_step;
34
4.75M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
2.56M
       above_mi_col += mi_step) {
36
2.56M
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
2.56M
    mi_step =
38
2.56M
        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.56M
    if (mi_step == 1) {
45
182k
      above_mi_col &= ~1;
46
182k
      above_mi = prev_row_mi + above_mi_col + 1;
47
182k
      mi_step = 2;
48
182k
    }
49
2.56M
    if (is_neighbor_overlappable(*above_mi)) {
50
2.20M
      ++nb_count;
51
2.20M
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
2.20M
          *above_mi, fun_ctxt, num_planes);
53
2.20M
    }
54
2.56M
  }
55
2.19M
}
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.15M
                                                void *fun_ctxt) {
61
1.15M
  if (!xd->left_available) return;
62
63
1.13M
  const int num_planes = av1_num_planes(cm);
64
1.13M
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
1.13M
  const int mi_row = xd->mi_row;
68
1.13M
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
1.13M
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
1.13M
  uint8_t mi_step;
71
2.42M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
1.28M
       left_mi_row += mi_step) {
73
1.28M
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
1.28M
    mi_step =
75
1.28M
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
1.28M
    if (mi_step == 1) {
77
114k
      left_mi_row &= ~1;
78
114k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
114k
      mi_step = 2;
80
114k
    }
81
1.28M
    if (is_neighbor_overlappable(*left_mi)) {
82
1.10M
      ++nb_count;
83
1.10M
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
1.10M
          fun_ctxt, num_planes);
85
1.10M
    }
86
1.28M
  }
87
1.13M
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
410k
                                                void *fun_ctxt) {
61
410k
  if (!xd->left_available) return;
62
63
410k
  const int num_planes = av1_num_planes(cm);
64
410k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
410k
  const int mi_row = xd->mi_row;
68
410k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
410k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
410k
  uint8_t mi_step;
71
859k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
449k
       left_mi_row += mi_step) {
73
449k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
449k
    mi_step =
75
449k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
449k
    if (mi_step == 1) {
77
42.8k
      left_mi_row &= ~1;
78
42.8k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
42.8k
      mi_step = 2;
80
42.8k
    }
81
449k
    if (is_neighbor_overlappable(*left_mi)) {
82
395k
      ++nb_count;
83
395k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
395k
          fun_ctxt, num_planes);
85
395k
    }
86
449k
  }
87
410k
}
reconinter.c:foreach_overlappable_nb_left
Line
Count
Source
60
747k
                                                void *fun_ctxt) {
61
747k
  if (!xd->left_available) return;
62
63
723k
  const int num_planes = av1_num_planes(cm);
64
723k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
723k
  const int mi_row = xd->mi_row;
68
723k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
723k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
723k
  uint8_t mi_step;
71
1.56M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
837k
       left_mi_row += mi_step) {
73
837k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
837k
    mi_step =
75
837k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
837k
    if (mi_step == 1) {
77
72.0k
      left_mi_row &= ~1;
78
72.0k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
72.0k
      mi_step = 2;
80
72.0k
    }
81
837k
    if (is_neighbor_overlappable(*left_mi)) {
82
712k
      ++nb_count;
83
712k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
712k
          fun_ctxt, num_planes);
85
712k
    }
86
837k
  }
87
723k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_