Coverage Report

Created: 2025-06-13 07:07

/src/aom/av1/common/reconintra.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2016, 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_RECONINTRA_H_
13
#define AOM_AV1_COMMON_RECONINTRA_H_
14
15
#include <stdlib.h>
16
17
#include "aom/aom_integer.h"
18
#include "av1/common/av1_common_int.h"
19
#include "av1/common/blockd.h"
20
21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24
25
void av1_init_intra_predictors(void);
26
void av1_predict_intra_block_facade(const AV1_COMMON *cm, MACROBLOCKD *xd,
27
                                    int plane, int blk_col, int blk_row,
28
                                    TX_SIZE tx_size);
29
void av1_predict_intra_block(const MACROBLOCKD *xd, BLOCK_SIZE sb_size,
30
                             int enable_intra_edge_filter, int wpx, int hpx,
31
                             TX_SIZE tx_size, PREDICTION_MODE mode,
32
                             int angle_delta, int use_palette,
33
                             FILTER_INTRA_MODE filter_intra_mode,
34
                             const uint8_t *ref, int ref_stride, uint8_t *dst,
35
                             int dst_stride, int col_off, int row_off,
36
                             int plane);
37
38
// Mapping of interintra to intra mode for use in the intra component
39
static const PREDICTION_MODE interintra_to_intra_mode[INTERINTRA_MODES] = {
40
  DC_PRED, V_PRED, H_PRED, SMOOTH_PRED
41
};
42
43
// Mapping of intra mode to the interintra mode
44
static const INTERINTRA_MODE intra_to_interintra_mode[INTRA_MODES] = {
45
  II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED,      II_SMOOTH_PRED, II_V_PRED,
46
  II_H_PRED,  II_H_PRED, II_V_PRED, II_SMOOTH_PRED, II_SMOOTH_PRED
47
};
48
49
#define FILTER_INTRA_SCALE_BITS 4
50
51
143M
static inline int av1_is_directional_mode(PREDICTION_MODE mode) {
52
143M
  return mode >= V_PRED && mode <= D67_PRED;
53
143M
}
Unexecuted instantiation: decodeframe.c:av1_is_directional_mode
decodemv.c:av1_is_directional_mode
Line
Count
Source
51
18.3M
static inline int av1_is_directional_mode(PREDICTION_MODE mode) {
52
18.3M
  return mode >= V_PRED && mode <= D67_PRED;
53
18.3M
}
Unexecuted instantiation: decoder.c:av1_is_directional_mode
Unexecuted instantiation: pred_common.c:av1_is_directional_mode
Unexecuted instantiation: reconinter.c:av1_is_directional_mode
reconintra.c:av1_is_directional_mode
Line
Count
Source
51
125M
static inline int av1_is_directional_mode(PREDICTION_MODE mode) {
52
125M
  return mode >= V_PRED && mode <= D67_PRED;
53
125M
}
Unexecuted instantiation: thread_common.c:av1_is_directional_mode
Unexecuted instantiation: filterintra_sse4.c:av1_is_directional_mode
54
55
0
static inline int av1_is_diagonal_mode(PREDICTION_MODE mode) {
56
0
  return mode >= D45_PRED && mode <= D67_PRED;
57
0
}
Unexecuted instantiation: decodeframe.c:av1_is_diagonal_mode
Unexecuted instantiation: decodemv.c:av1_is_diagonal_mode
Unexecuted instantiation: decoder.c:av1_is_diagonal_mode
Unexecuted instantiation: pred_common.c:av1_is_diagonal_mode
Unexecuted instantiation: reconinter.c:av1_is_diagonal_mode
Unexecuted instantiation: reconintra.c:av1_is_diagonal_mode
Unexecuted instantiation: thread_common.c:av1_is_diagonal_mode
Unexecuted instantiation: filterintra_sse4.c:av1_is_diagonal_mode
58
59
10.9M
static inline int av1_use_angle_delta(BLOCK_SIZE bsize) {
60
10.9M
  return bsize >= BLOCK_8X8;
61
10.9M
}
Unexecuted instantiation: decodeframe.c:av1_use_angle_delta
decodemv.c:av1_use_angle_delta
Line
Count
Source
59
10.9M
static inline int av1_use_angle_delta(BLOCK_SIZE bsize) {
60
10.9M
  return bsize >= BLOCK_8X8;
61
10.9M
}
Unexecuted instantiation: decoder.c:av1_use_angle_delta
Unexecuted instantiation: pred_common.c:av1_use_angle_delta
Unexecuted instantiation: reconinter.c:av1_use_angle_delta
Unexecuted instantiation: reconintra.c:av1_use_angle_delta
Unexecuted instantiation: thread_common.c:av1_use_angle_delta
Unexecuted instantiation: filterintra_sse4.c:av1_use_angle_delta
62
63
9.51M
static inline int av1_allow_intrabc(const AV1_COMMON *const cm) {
64
9.51M
  return frame_is_intra_only(cm) && cm->features.allow_screen_content_tools &&
65
9.51M
         cm->features.allow_intrabc;
66
9.51M
}
decodeframe.c:av1_allow_intrabc
Line
Count
Source
63
176k
static inline int av1_allow_intrabc(const AV1_COMMON *const cm) {
64
176k
  return frame_is_intra_only(cm) && cm->features.allow_screen_content_tools &&
65
176k
         cm->features.allow_intrabc;
66
176k
}
decodemv.c:av1_allow_intrabc
Line
Count
Source
63
9.25M
static inline int av1_allow_intrabc(const AV1_COMMON *const cm) {
64
9.25M
  return frame_is_intra_only(cm) && cm->features.allow_screen_content_tools &&
65
9.25M
         cm->features.allow_intrabc;
66
9.25M
}
Unexecuted instantiation: decoder.c:av1_allow_intrabc
Unexecuted instantiation: pred_common.c:av1_allow_intrabc
Unexecuted instantiation: reconinter.c:av1_allow_intrabc
Unexecuted instantiation: reconintra.c:av1_allow_intrabc
thread_common.c:av1_allow_intrabc
Line
Count
Source
63
91.5k
static inline int av1_allow_intrabc(const AV1_COMMON *const cm) {
64
91.5k
  return frame_is_intra_only(cm) && cm->features.allow_screen_content_tools &&
65
91.5k
         cm->features.allow_intrabc;
66
91.5k
}
Unexecuted instantiation: filterintra_sse4.c:av1_allow_intrabc
67
68
static inline int av1_filter_intra_allowed_bsize(const AV1_COMMON *const cm,
69
4.34M
                                                 BLOCK_SIZE bs) {
70
4.34M
  if (!cm->seq_params->enable_filter_intra || bs == BLOCK_INVALID) return 0;
71
72
2.49M
  return block_size_wide[bs] <= 32 && block_size_high[bs] <= 32;
73
4.34M
}
Unexecuted instantiation: decodeframe.c:av1_filter_intra_allowed_bsize
decodemv.c:av1_filter_intra_allowed_bsize
Line
Count
Source
69
4.34M
                                                 BLOCK_SIZE bs) {
70
4.34M
  if (!cm->seq_params->enable_filter_intra || bs == BLOCK_INVALID) return 0;
71
72
2.49M
  return block_size_wide[bs] <= 32 && block_size_high[bs] <= 32;
73
4.34M
}
Unexecuted instantiation: decoder.c:av1_filter_intra_allowed_bsize
Unexecuted instantiation: pred_common.c:av1_filter_intra_allowed_bsize
Unexecuted instantiation: reconinter.c:av1_filter_intra_allowed_bsize
Unexecuted instantiation: reconintra.c:av1_filter_intra_allowed_bsize
Unexecuted instantiation: thread_common.c:av1_filter_intra_allowed_bsize
Unexecuted instantiation: filterintra_sse4.c:av1_filter_intra_allowed_bsize
74
75
static inline int av1_filter_intra_allowed(const AV1_COMMON *const cm,
76
10.9M
                                           const MB_MODE_INFO *mbmi) {
77
10.9M
  return mbmi->mode == DC_PRED &&
78
10.9M
         mbmi->palette_mode_info.palette_size[0] == 0 &&
79
10.9M
         av1_filter_intra_allowed_bsize(cm, mbmi->bsize);
80
10.9M
}
Unexecuted instantiation: decodeframe.c:av1_filter_intra_allowed
decodemv.c:av1_filter_intra_allowed
Line
Count
Source
76
10.9M
                                           const MB_MODE_INFO *mbmi) {
77
10.9M
  return mbmi->mode == DC_PRED &&
78
10.9M
         mbmi->palette_mode_info.palette_size[0] == 0 &&
79
10.9M
         av1_filter_intra_allowed_bsize(cm, mbmi->bsize);
80
10.9M
}
Unexecuted instantiation: decoder.c:av1_filter_intra_allowed
Unexecuted instantiation: pred_common.c:av1_filter_intra_allowed
Unexecuted instantiation: reconinter.c:av1_filter_intra_allowed
Unexecuted instantiation: reconintra.c:av1_filter_intra_allowed
Unexecuted instantiation: thread_common.c:av1_filter_intra_allowed
Unexecuted instantiation: filterintra_sse4.c:av1_filter_intra_allowed
81
82
extern const int8_t av1_filter_intra_taps[FILTER_INTRA_MODES][8][8];
83
84
static const int16_t dr_intra_derivative[90] = {
85
  // More evenly spread out angles and limited to 10-bit
86
  // Values that are 0 will never be used
87
  //                    Approx angle
88
  0,    0, 0,        //
89
  1023, 0, 0,        // 3, ...
90
  547,  0, 0,        // 6, ...
91
  372,  0, 0, 0, 0,  // 9, ...
92
  273,  0, 0,        // 14, ...
93
  215,  0, 0,        // 17, ...
94
  178,  0, 0,        // 20, ...
95
  151,  0, 0,        // 23, ... (113 & 203 are base angles)
96
  132,  0, 0,        // 26, ...
97
  116,  0, 0,        // 29, ...
98
  102,  0, 0, 0,     // 32, ...
99
  90,   0, 0,        // 36, ...
100
  80,   0, 0,        // 39, ...
101
  71,   0, 0,        // 42, ...
102
  64,   0, 0,        // 45, ... (45 & 135 are base angles)
103
  57,   0, 0,        // 48, ...
104
  51,   0, 0,        // 51, ...
105
  45,   0, 0, 0,     // 54, ...
106
  40,   0, 0,        // 58, ...
107
  35,   0, 0,        // 61, ...
108
  31,   0, 0,        // 64, ...
109
  27,   0, 0,        // 67, ... (67 & 157 are base angles)
110
  23,   0, 0,        // 70, ...
111
  19,   0, 0,        // 73, ...
112
  15,   0, 0, 0, 0,  // 76, ...
113
  11,   0, 0,        // 81, ...
114
  7,    0, 0,        // 84, ...
115
  3,    0, 0,        // 87, ...
116
};
117
118
// Get the shift (up-scaled by 256) in X w.r.t a unit change in Y.
119
// If angle > 0 && angle < 90, dx = -((int)(256 / t));
120
// If angle > 90 && angle < 180, dx = (int)(256 / t);
121
// If angle > 180 && angle < 270, dx = 1;
122
10.6M
static inline int av1_get_dx(int angle) {
123
10.6M
  if (angle > 0 && angle < 90) {
124
1.23M
    return dr_intra_derivative[angle];
125
9.40M
  } else if (angle > 90 && angle < 180) {
126
2.92M
    return dr_intra_derivative[180 - angle];
127
6.47M
  } else {
128
    // In this case, we are not really going to use dx. We may return any value.
129
6.47M
    return 1;
130
6.47M
  }
131
10.6M
}
Unexecuted instantiation: decodeframe.c:av1_get_dx
Unexecuted instantiation: decodemv.c:av1_get_dx
Unexecuted instantiation: decoder.c:av1_get_dx
Unexecuted instantiation: pred_common.c:av1_get_dx
Unexecuted instantiation: reconinter.c:av1_get_dx
reconintra.c:av1_get_dx
Line
Count
Source
122
10.6M
static inline int av1_get_dx(int angle) {
123
10.6M
  if (angle > 0 && angle < 90) {
124
1.23M
    return dr_intra_derivative[angle];
125
9.40M
  } else if (angle > 90 && angle < 180) {
126
2.92M
    return dr_intra_derivative[180 - angle];
127
6.47M
  } else {
128
    // In this case, we are not really going to use dx. We may return any value.
129
6.47M
    return 1;
130
6.47M
  }
131
10.6M
}
Unexecuted instantiation: thread_common.c:av1_get_dx
Unexecuted instantiation: filterintra_sse4.c:av1_get_dx
132
133
// Get the shift (up-scaled by 256) in Y w.r.t a unit change in X.
134
// If angle > 0 && angle < 90, dy = 1;
135
// If angle > 90 && angle < 180, dy = (int)(256 * t);
136
// If angle > 180 && angle < 270, dy = -((int)(256 * t));
137
10.6M
static inline int av1_get_dy(int angle) {
138
10.6M
  if (angle > 90 && angle < 180) {
139
2.92M
    return dr_intra_derivative[angle - 90];
140
7.70M
  } else if (angle > 180 && angle < 270) {
141
1.88M
    return dr_intra_derivative[270 - angle];
142
5.82M
  } else {
143
    // In this case, we are not really going to use dy. We may return any value.
144
5.82M
    return 1;
145
5.82M
  }
146
10.6M
}
Unexecuted instantiation: decodeframe.c:av1_get_dy
Unexecuted instantiation: decodemv.c:av1_get_dy
Unexecuted instantiation: decoder.c:av1_get_dy
Unexecuted instantiation: pred_common.c:av1_get_dy
Unexecuted instantiation: reconinter.c:av1_get_dy
reconintra.c:av1_get_dy
Line
Count
Source
137
10.6M
static inline int av1_get_dy(int angle) {
138
10.6M
  if (angle > 90 && angle < 180) {
139
2.92M
    return dr_intra_derivative[angle - 90];
140
7.70M
  } else if (angle > 180 && angle < 270) {
141
1.88M
    return dr_intra_derivative[270 - angle];
142
5.82M
  } else {
143
    // In this case, we are not really going to use dy. We may return any value.
144
5.82M
    return 1;
145
5.82M
  }
146
10.6M
}
Unexecuted instantiation: thread_common.c:av1_get_dy
Unexecuted instantiation: filterintra_sse4.c:av1_get_dy
147
148
static inline int av1_use_intra_edge_upsample(int bs0, int bs1, int delta,
149
18.3M
                                              int type) {
150
18.3M
  const int d = abs(delta);
151
18.3M
  const int blk_wh = bs0 + bs1;
152
18.3M
  if (d == 0 || d >= 40) return 0;
153
4.49M
  return type ? (blk_wh <= 8) : (blk_wh <= 16);
154
18.3M
}
Unexecuted instantiation: decodeframe.c:av1_use_intra_edge_upsample
Unexecuted instantiation: decodemv.c:av1_use_intra_edge_upsample
Unexecuted instantiation: decoder.c:av1_use_intra_edge_upsample
Unexecuted instantiation: pred_common.c:av1_use_intra_edge_upsample
Unexecuted instantiation: reconinter.c:av1_use_intra_edge_upsample
reconintra.c:av1_use_intra_edge_upsample
Line
Count
Source
149
18.3M
                                              int type) {
150
18.3M
  const int d = abs(delta);
151
18.3M
  const int blk_wh = bs0 + bs1;
152
18.3M
  if (d == 0 || d >= 40) return 0;
153
4.49M
  return type ? (blk_wh <= 8) : (blk_wh <= 16);
154
18.3M
}
Unexecuted instantiation: thread_common.c:av1_use_intra_edge_upsample
Unexecuted instantiation: filterintra_sse4.c:av1_use_intra_edge_upsample
155
#ifdef __cplusplus
156
}  // extern "C"
157
#endif
158
#endif  // AOM_AV1_COMMON_RECONINTRA_H_