Coverage Report

Created: 2026-10-17 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/avm/av2/common/pred_common.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2021, Alliance for Open Media. All rights reserved
3
 *
4
 * This source code is subject to the terms of the BSD 3-Clause Clear License
5
 * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
6
 * License was not distributed with this source code in the LICENSE file, you
7
 * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/.  If the
8
 * Alliance for Open Media Patent License 1.0 was not distributed with this
9
 * source code in the PATENTS file, you can obtain it at
10
 * aomedia.org/license/patent-license/.
11
 */
12
13
#ifndef AVM_AV2_COMMON_PRED_COMMON_H_
14
#define AVM_AV2_COMMON_PRED_COMMON_H_
15
16
#include "av2/common/av2_common_int.h"
17
#include "av2/common/blockd.h"
18
#include "av2/common/mvref_common.h"
19
#include "avm_dsp/avm_dsp_common.h"
20
21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24
25
static INLINE void init_ref_map_pair(AV2_COMMON *cm,
26
                                     RefFrameMapPair *ref_frame_map_pairs,
27
                                     int is_key, int is_ras,
28
0
                                     int use_olk_tu_ref_only) {
29
0
  if (is_key) {
30
0
    memset(ref_frame_map_pairs, -1, sizeof(*ref_frame_map_pairs) * REF_FRAMES);
31
0
    return;
32
0
  }
33
34
0
  int olk_ref_flags = 0;
35
0
  for (int layer = 0; layer <= cm->seq_params.max_mlayer_id; layer++) {
36
0
    if (cm->olk_refresh_frame_flags[layer] == -1) continue;
37
0
    olk_ref_flags |= cm->olk_refresh_frame_flags[layer];
38
0
  }
39
  // For the decoder, at this point cm->olk_co_vcl_refresh_frame_flags is
40
  // already set with the current frame's refresh flags. Use
41
  // cm->prev_olk_co_vcl_refresh_frame_flags since that is without the refresh
42
  // flag of the current frame.
43
  //
44
  // At the encoder side either of them is set, but all such
45
  // flags are in combined in cm->olk_refresh_frame_flags.
46
0
  for (int layer = 0; layer <= cm->seq_params.max_mlayer_id; layer++) {
47
0
    if (cm->prev_olk_co_vcl_refresh_frame_flags[layer] == -1) continue;
48
0
    olk_ref_flags |= cm->prev_olk_co_vcl_refresh_frame_flags[layer];
49
0
  }
50
51
0
  memset(ref_frame_map_pairs, 0, sizeof(*ref_frame_map_pairs) * REF_FRAMES);
52
0
  for (int map_idx = 0; map_idx < cm->seq_params.ref_frames; map_idx++) {
53
    // Get reference frame buffer
54
0
    const RefCntBuffer *const buf = cm->ref_frame_map[map_idx];
55
0
    if (buf == NULL ||
56
0
        !is_tlayer_scalable_and_dependent(
57
0
            &cm->seq_params, cm->current_frame.tlayer_id, buf->tlayer_id,
58
0
            cm->current_frame.mlayer_id) ||
59
0
        !is_mlayer_scalable_and_dependent(
60
0
            &cm->seq_params, cm->current_frame.mlayer_id, buf->mlayer_id) ||
61
0
        (is_ras && buf->frame_type != KEY_FRAME)) {
62
0
      ref_frame_map_pairs[map_idx].ref_frame_for_inference = -1;
63
0
      continue;
64
0
    }
65
66
0
    if (use_olk_tu_ref_only && !((olk_ref_flags >> map_idx) & 1u)) {
67
      // This is a frame in the same TU as OLK. It can only refer to the frames
68
      // on / after the OLK.
69
0
      ref_frame_map_pairs[map_idx].ref_frame_for_inference = -1;
70
0
      continue;
71
0
    }
72
73
0
    if (buf != NULL && buf->is_restricted) {
74
0
      ref_frame_map_pairs[map_idx].ref_frame_restricted = 1;
75
0
      continue;
76
0
    }
77
78
0
    if (buf) {
79
0
      ref_frame_map_pairs[map_idx].width = buf->buf.y_crop_width;
80
0
      ref_frame_map_pairs[map_idx].height = buf->buf.y_crop_height;
81
0
      ref_frame_map_pairs[map_idx].disp_order = (int)buf->display_order_hint;
82
0
      ref_frame_map_pairs[map_idx].disp_order_removed =
83
0
          (int)buf->display_order_hint_restricted;
84
0
      ref_frame_map_pairs[map_idx].pyr_level = buf->pyramid_level;
85
0
      ref_frame_map_pairs[map_idx].tlayer_id = buf->tlayer_id;
86
0
      ref_frame_map_pairs[map_idx].mlayer_id = buf->mlayer_id;
87
0
      ref_frame_map_pairs[map_idx].base_qindex = buf->base_qindex;
88
0
      ref_frame_map_pairs[map_idx].frame_type = buf->frame_type;
89
0
    }
90
0
    if (ref_frame_map_pairs[map_idx].ref_frame_for_inference == -1) continue;
91
0
    ref_frame_map_pairs[map_idx].ref_frame_for_inference = 1;
92
93
0
    if (cm->bridge_frame_info.is_bridge_frame &&
94
0
        map_idx != cm->bridge_frame_info.bridge_frame_ref_idx) {
95
0
      ref_frame_map_pairs[map_idx].ref_frame_for_inference = -1;
96
0
      continue;
97
0
    }
98
0
    if (buf->ref_count > 1) {
99
      // Once the keyframe is coded, the slots in ref_frame_map will all
100
      // point to the same frame. In that case, all subsequent pointers
101
      // matching the current are considered "free" slots. This will find
102
      // the next occurance of the current pointer if ref_count indicates
103
      // there are multiple instances of it and mark it as free.
104
0
      for (int idx2 = map_idx + 1; idx2 < cm->seq_params.ref_frames; ++idx2) {
105
0
        const RefCntBuffer *const buf2 = cm->ref_frame_map[idx2];
106
0
        if (buf2 == buf) {
107
0
          ref_frame_map_pairs[idx2].ref_frame_for_inference = -1;
108
0
        }
109
0
      }
110
0
    }
111
0
  }
112
0
}
Unexecuted instantiation: av2_dx_iface.c:init_ref_map_pair
Unexecuted instantiation: decodeframe.c:init_ref_map_pair
Unexecuted instantiation: decodemv.c:init_ref_map_pair
Unexecuted instantiation: decoder.c:init_ref_map_pair
Unexecuted instantiation: decodetxb.c:init_ref_map_pair
Unexecuted instantiation: av2_loopfilter.c:init_ref_map_pair
Unexecuted instantiation: gdf.c:init_ref_map_pair
Unexecuted instantiation: gdf_block.c:init_ref_map_pair
Unexecuted instantiation: level.c:init_ref_map_pair
Unexecuted instantiation: pred_common.c:init_ref_map_pair
Unexecuted instantiation: restoration.c:init_ref_map_pair
Unexecuted instantiation: bru.c:init_ref_map_pair
Unexecuted instantiation: gdf_block_avx2.c:init_ref_map_pair
113
114
/*!\cond */
115
typedef struct {
116
  // Scoring function for usefulness of references (the lower score, the more
117
  // useful)
118
  int score;
119
  // Index in the reference buffer
120
  int index;
121
  // Temporal distance to the current frame
122
  int distance;
123
  // Display order hint
124
  int disp_order;
125
  // Quality of the reference frame
126
  int base_qindex;
127
  // Embedded layer id of the reference frame
128
  int mlayer_id;
129
  // log2 of resolution ratio
130
  int res_ratio_log2;
131
} RefScoreData;
132
/*!\endcond */
133
134
void av2_get_past_future_cur_ref_lists(AV2_COMMON *cm, RefScoreData *scores);
135
int av2_get_ref_frames(AV2_COMMON *cm, int cur_frame_disp,
136
                       int resolution_available, int key_frame_only,
137
                       RefFrameMapPair *ref_frame_map_pairs);
138
139
int is_layer_dropped(const int current_layer_id, const int max_layer_id);
140
141
int av2_get_op_constrained_ref_frames(AV2_COMMON *cm, int cur_frame_disp,
142
                                      int key_frame_only,
143
                                      RefFrameMapPair *ref_frame_map_pairs,
144
                                      const int mlayer_mask,
145
                                      const int tlayer_mask);
146
147
// Derive the primary & secondary reference frame from the reference list based
148
// on qindex and frame distances.
149
void choose_primary_secondary_ref_frame(const AV2_COMMON *const cm,
150
                                        int *ref_frame,
151
                                        int signal_primary_ref_frame);
152
153
// Find the reference that is furthest in the future
154
0
static INLINE int get_furthest_future_ref_index(const AV2_COMMON *const cm) {
155
0
  int index = NONE_FRAME;
156
0
  int ref_disp_order = -1;
157
0
  for (int i = 0; i < cm->ref_frames_info.num_future_refs; i++) {
158
0
    const int ref = cm->ref_frames_info.future_refs[i];
159
0
    const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref);
160
0
    if (buf == NULL) continue;
161
0
    if ((int)buf->display_order_hint > ref_disp_order) {
162
0
      index = ref;
163
0
      ref_disp_order = (int)buf->display_order_hint;
164
0
    }
165
0
  }
166
0
  return index;
167
0
}
Unexecuted instantiation: av2_dx_iface.c:get_furthest_future_ref_index
Unexecuted instantiation: decodeframe.c:get_furthest_future_ref_index
Unexecuted instantiation: decodemv.c:get_furthest_future_ref_index
Unexecuted instantiation: decoder.c:get_furthest_future_ref_index
Unexecuted instantiation: decodetxb.c:get_furthest_future_ref_index
Unexecuted instantiation: av2_loopfilter.c:get_furthest_future_ref_index
Unexecuted instantiation: gdf.c:get_furthest_future_ref_index
Unexecuted instantiation: gdf_block.c:get_furthest_future_ref_index
Unexecuted instantiation: level.c:get_furthest_future_ref_index
Unexecuted instantiation: pred_common.c:get_furthest_future_ref_index
Unexecuted instantiation: restoration.c:get_furthest_future_ref_index
Unexecuted instantiation: bru.c:get_furthest_future_ref_index
Unexecuted instantiation: gdf_block_avx2.c:get_furthest_future_ref_index
168
169
// Get the past reference that is temporally closest to the current frame
170
0
static INLINE int get_closest_past_ref_index(const AV2_COMMON *const cm) {
171
0
  int index = NONE_FRAME;
172
0
  int best_dist = INT_MAX;
173
0
  for (int i = 0; i < cm->ref_frames_info.num_past_refs; i++) {
174
0
    const int ref = cm->ref_frames_info.past_refs[i];
175
0
    const int dist = cm->ref_frames_info.ref_frame_distance[ref];
176
0
    if (dist < best_dist) {
177
0
      index = ref;
178
0
      best_dist = dist;
179
0
    }
180
0
  }
181
0
  return index;
182
0
}
Unexecuted instantiation: av2_dx_iface.c:get_closest_past_ref_index
Unexecuted instantiation: decodeframe.c:get_closest_past_ref_index
Unexecuted instantiation: decodemv.c:get_closest_past_ref_index
Unexecuted instantiation: decoder.c:get_closest_past_ref_index
Unexecuted instantiation: decodetxb.c:get_closest_past_ref_index
Unexecuted instantiation: av2_loopfilter.c:get_closest_past_ref_index
Unexecuted instantiation: gdf.c:get_closest_past_ref_index
Unexecuted instantiation: gdf_block.c:get_closest_past_ref_index
Unexecuted instantiation: level.c:get_closest_past_ref_index
Unexecuted instantiation: pred_common.c:get_closest_past_ref_index
Unexecuted instantiation: restoration.c:get_closest_past_ref_index
Unexecuted instantiation: bru.c:get_closest_past_ref_index
Unexecuted instantiation: gdf_block_avx2.c:get_closest_past_ref_index
183
184
// Get the temporally closest reference frame:
185
// 1. Get current frame if it is available in the reference list.
186
// 2. Otherwise get the closest past reference if there is any past reference.
187
// 3. Otherwise use ref 0.
188
0
static INLINE int get_closest_pastcur_ref_or_ref0(const AV2_COMMON *const cm) {
189
0
  if (cm->ref_frames_info.num_cur_refs > 0)
190
0
    return cm->ref_frames_info.cur_refs[0];
191
0
  if (cm->ref_frames_info.num_past_refs > 0)
192
0
    return get_closest_past_ref_index(cm);
193
0
  return 0;
194
0
}
Unexecuted instantiation: av2_dx_iface.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: decodeframe.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: decodemv.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: decoder.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: decodetxb.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: av2_loopfilter.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: gdf.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: gdf_block.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: level.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: pred_common.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: restoration.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: bru.c:get_closest_pastcur_ref_or_ref0
Unexecuted instantiation: gdf_block_avx2.c:get_closest_pastcur_ref_or_ref0
195
196
0
static INLINE int get_best_past_ref_index(const AV2_COMMON *const cm) {
197
0
  const int index = cm->ref_frames_info.num_past_refs > 0
198
0
                        ? cm->ref_frames_info.past_refs[0]
199
0
                        : NONE_FRAME;
200
0
  assert(index < INTER_REFS_PER_FRAME);
201
0
  return index;
202
0
}
Unexecuted instantiation: av2_dx_iface.c:get_best_past_ref_index
Unexecuted instantiation: decodeframe.c:get_best_past_ref_index
Unexecuted instantiation: decodemv.c:get_best_past_ref_index
Unexecuted instantiation: decoder.c:get_best_past_ref_index
Unexecuted instantiation: decodetxb.c:get_best_past_ref_index
Unexecuted instantiation: av2_loopfilter.c:get_best_past_ref_index
Unexecuted instantiation: gdf.c:get_best_past_ref_index
Unexecuted instantiation: gdf_block.c:get_best_past_ref_index
Unexecuted instantiation: level.c:get_best_past_ref_index
Unexecuted instantiation: pred_common.c:get_best_past_ref_index
Unexecuted instantiation: restoration.c:get_best_past_ref_index
Unexecuted instantiation: bru.c:get_best_past_ref_index
Unexecuted instantiation: gdf_block_avx2.c:get_best_past_ref_index
203
204
// Gets directional i.e. past/future ref rank from overall rank
205
// in dir_refrank[0]/[1] respectively. Returns 0 if found in past
206
// list, 1 if found in future list, -1 if not found in either (error).
207
// Note dir_refrank can be NULL, in which case only the direction
208
// is returned, the ranks are not output.
209
static INLINE int get_dir_rank(const AV2_COMMON *const cm, int refrank,
210
0
                               int *dir_refrank) {
211
0
  if (!is_inter_ref_frame(refrank)) return -1;
212
0
  if (is_tip_ref_frame(refrank)) {
213
0
    if (dir_refrank) {
214
0
      dir_refrank[0] = -1;
215
0
      dir_refrank[1] = -1;
216
0
    }
217
0
    return 1;
218
0
  }
219
0
  assert(refrank < cm->ref_frames_info.num_total_refs);
220
0
  if (dir_refrank) {
221
0
    dir_refrank[0] = -1;
222
0
    dir_refrank[1] = -1;
223
0
  }
224
0
  for (int i = 0; i < cm->ref_frames_info.num_past_refs; ++i) {
225
0
    if (cm->ref_frames_info.past_refs[i] == refrank) {
226
0
      if (dir_refrank) dir_refrank[0] = i;
227
0
      return 0;
228
0
    }
229
0
  }
230
0
  for (int i = 0; i < cm->ref_frames_info.num_future_refs; ++i) {
231
0
    if (cm->ref_frames_info.future_refs[i] == refrank) {
232
0
      if (dir_refrank) dir_refrank[1] = i;
233
0
      return 1;
234
0
    }
235
0
  }
236
  // If refrank has the same distance as a reference return 0 (past)
237
  // but the dir_refrank[0] is -1
238
0
  if (cm->ref_frames_info.cur_refs[0] == refrank) return 0;
239
0
  return -1;
240
0
}
Unexecuted instantiation: av2_dx_iface.c:get_dir_rank
Unexecuted instantiation: decodeframe.c:get_dir_rank
Unexecuted instantiation: decodemv.c:get_dir_rank
Unexecuted instantiation: decoder.c:get_dir_rank
Unexecuted instantiation: decodetxb.c:get_dir_rank
Unexecuted instantiation: av2_loopfilter.c:get_dir_rank
Unexecuted instantiation: gdf.c:get_dir_rank
Unexecuted instantiation: gdf_block.c:get_dir_rank
Unexecuted instantiation: level.c:get_dir_rank
Unexecuted instantiation: pred_common.c:get_dir_rank
Unexecuted instantiation: restoration.c:get_dir_rank
Unexecuted instantiation: bru.c:get_dir_rank
Unexecuted instantiation: gdf_block_avx2.c:get_dir_rank
241
242
0
static INLINE int get_tip_ctx(const MACROBLOCKD *xd) {
243
0
  int ctx = 0;
244
0
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
245
0
    const MB_MODE_INFO *const neighbor = xd->neighbors_line_buffer[i];
246
0
    if (neighbor != NULL) {
247
0
      ctx += is_tip_ref_frame(neighbor->ref_frame[0]);
248
0
    }
249
0
  }
250
251
0
  return ctx;
252
0
}
Unexecuted instantiation: av2_dx_iface.c:get_tip_ctx
Unexecuted instantiation: decodeframe.c:get_tip_ctx
Unexecuted instantiation: decodemv.c:get_tip_ctx
Unexecuted instantiation: decoder.c:get_tip_ctx
Unexecuted instantiation: decodetxb.c:get_tip_ctx
Unexecuted instantiation: av2_loopfilter.c:get_tip_ctx
Unexecuted instantiation: gdf.c:get_tip_ctx
Unexecuted instantiation: gdf_block.c:get_tip_ctx
Unexecuted instantiation: level.c:get_tip_ctx
Unexecuted instantiation: pred_common.c:get_tip_ctx
Unexecuted instantiation: restoration.c:get_tip_ctx
Unexecuted instantiation: bru.c:get_tip_ctx
Unexecuted instantiation: gdf_block_avx2.c:get_tip_ctx
253
254
static INLINE int is_tip_allowed(const AV2_COMMON *const cm,
255
0
                                 const MACROBLOCKD *const xd) {
256
0
  const MB_MODE_INFO *const mbmi = xd->mi[0];
257
0
  const int is_allowed_bsize = is_tip_allowed_bsize(mbmi);
258
259
0
  if (cm->features.tip_frame_mode && is_allowed_bsize) {
260
0
    return 1;
261
0
  }
262
263
0
  return 0;
264
0
}
Unexecuted instantiation: av2_dx_iface.c:is_tip_allowed
Unexecuted instantiation: decodeframe.c:is_tip_allowed
Unexecuted instantiation: decodemv.c:is_tip_allowed
Unexecuted instantiation: decoder.c:is_tip_allowed
Unexecuted instantiation: decodetxb.c:is_tip_allowed
Unexecuted instantiation: av2_loopfilter.c:is_tip_allowed
Unexecuted instantiation: gdf.c:is_tip_allowed
Unexecuted instantiation: gdf_block.c:is_tip_allowed
Unexecuted instantiation: level.c:is_tip_allowed
Unexecuted instantiation: pred_common.c:is_tip_allowed
Unexecuted instantiation: restoration.c:is_tip_allowed
Unexecuted instantiation: bru.c:is_tip_allowed
Unexecuted instantiation: gdf_block_avx2.c:is_tip_allowed
265
266
static INLINE int is_skip_mode_allowed(const AV2_COMMON *const cm,
267
0
                                       const MACROBLOCKD *const xd) {
268
0
  MB_MODE_INFO *const mi = xd->mi[0];
269
0
  if (!cm->current_frame.skip_mode_info.skip_mode_flag) return 0;
270
271
0
  if (mi->region_type == INTRA_REGION) return 0;
272
273
0
  if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP)) {
274
0
    return 0;
275
0
  }
276
277
0
  if (!is_comp_ref_allowed(mi->sb_type[xd->tree_type == CHROMA_PART])) {
278
0
    return 0;
279
0
  }
280
281
0
  if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_GLOBALMV)) {
282
    // These features imply single-reference mode, while skip mode implies
283
    // compound reference. Hence, the two are mutually exclusive.
284
    // In other words, skip_mode is implicitly 0 here.
285
0
    return 0;
286
0
  }
287
288
0
  return 1;
289
0
}
Unexecuted instantiation: av2_dx_iface.c:is_skip_mode_allowed
Unexecuted instantiation: decodeframe.c:is_skip_mode_allowed
Unexecuted instantiation: decodemv.c:is_skip_mode_allowed
Unexecuted instantiation: decoder.c:is_skip_mode_allowed
Unexecuted instantiation: decodetxb.c:is_skip_mode_allowed
Unexecuted instantiation: av2_loopfilter.c:is_skip_mode_allowed
Unexecuted instantiation: gdf.c:is_skip_mode_allowed
Unexecuted instantiation: gdf_block.c:is_skip_mode_allowed
Unexecuted instantiation: level.c:is_skip_mode_allowed
Unexecuted instantiation: pred_common.c:is_skip_mode_allowed
Unexecuted instantiation: restoration.c:is_skip_mode_allowed
Unexecuted instantiation: bru.c:is_skip_mode_allowed
Unexecuted instantiation: gdf_block_avx2.c:is_skip_mode_allowed
290
291
static INLINE void set_skip_mode_ref_frame(const AV2_COMMON *const cm,
292
                                           const MACROBLOCKD *const xd,
293
0
                                           MV_REFERENCE_FRAME ref_frame[2]) {
294
0
  const SkipModeInfo *const skip_mode_info = &cm->current_frame.skip_mode_info;
295
296
0
  ref_frame[0] = skip_mode_info->ref_frame_idx_0;
297
0
  ref_frame[1] = skip_mode_info->ref_frame_idx_1;
298
0
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
299
0
    const MB_MODE_INFO *const neighbor = xd->neighbors_line_buffer[i];
300
0
    if (neighbor != NULL && is_inter_ref_frame(neighbor->ref_frame[0])) {
301
0
      if (is_tip_ref_frame(neighbor->ref_frame[0])) {
302
0
        ref_frame[0] =
303
0
            AVMMIN(cm->tip_ref.ref_frame[0], cm->tip_ref.ref_frame[1]);
304
0
        ref_frame[1] =
305
0
            AVMMAX(cm->tip_ref.ref_frame[0], cm->tip_ref.ref_frame[1]);
306
0
      } else if (is_inter_ref_frame(neighbor->ref_frame[1])) {
307
0
        ref_frame[0] = neighbor->ref_frame[0];
308
0
        ref_frame[1] = neighbor->ref_frame[1];
309
0
      }
310
0
      return;
311
0
    }
312
0
  }
313
0
}
Unexecuted instantiation: av2_dx_iface.c:set_skip_mode_ref_frame
Unexecuted instantiation: decodeframe.c:set_skip_mode_ref_frame
Unexecuted instantiation: decodemv.c:set_skip_mode_ref_frame
Unexecuted instantiation: decoder.c:set_skip_mode_ref_frame
Unexecuted instantiation: decodetxb.c:set_skip_mode_ref_frame
Unexecuted instantiation: av2_loopfilter.c:set_skip_mode_ref_frame
Unexecuted instantiation: gdf.c:set_skip_mode_ref_frame
Unexecuted instantiation: gdf_block.c:set_skip_mode_ref_frame
Unexecuted instantiation: level.c:set_skip_mode_ref_frame
Unexecuted instantiation: pred_common.c:set_skip_mode_ref_frame
Unexecuted instantiation: restoration.c:set_skip_mode_ref_frame
Unexecuted instantiation: bru.c:set_skip_mode_ref_frame
Unexecuted instantiation: gdf_block_avx2.c:set_skip_mode_ref_frame
314
315
static INLINE int get_segment_id(const CommonModeInfoParams *const mi_params,
316
                                 const uint8_t *segment_ids, BLOCK_SIZE bsize,
317
487k
                                 int mi_row, int mi_col) {
318
487k
  const int mi_offset = mi_row * mi_params->mi_cols + mi_col;
319
487k
  const int bw = mi_size_wide[bsize];
320
487k
  const int bh = mi_size_high[bsize];
321
487k
  const int xmis = AVMMIN(mi_params->mi_cols - mi_col, bw);
322
487k
  const int ymis = AVMMIN(mi_params->mi_rows - mi_row, bh);
323
487k
  int segment_id = MAX_SEGMENTS;
324
325
975k
  for (int y = 0; y < ymis; ++y) {
326
975k
    for (int x = 0; x < xmis; ++x) {
327
487k
      segment_id = AVMMIN(segment_id,
328
487k
                          segment_ids[mi_offset + y * mi_params->mi_cols + x]);
329
487k
    }
330
487k
  }
331
332
487k
  assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
333
487k
  return segment_id;
334
487k
}
Unexecuted instantiation: av2_dx_iface.c:get_segment_id
Unexecuted instantiation: decodeframe.c:get_segment_id
decodemv.c:get_segment_id
Line
Count
Source
317
487k
                                 int mi_row, int mi_col) {
318
487k
  const int mi_offset = mi_row * mi_params->mi_cols + mi_col;
319
487k
  const int bw = mi_size_wide[bsize];
320
487k
  const int bh = mi_size_high[bsize];
321
487k
  const int xmis = AVMMIN(mi_params->mi_cols - mi_col, bw);
322
487k
  const int ymis = AVMMIN(mi_params->mi_rows - mi_row, bh);
323
487k
  int segment_id = MAX_SEGMENTS;
324
325
975k
  for (int y = 0; y < ymis; ++y) {
326
975k
    for (int x = 0; x < xmis; ++x) {
327
487k
      segment_id = AVMMIN(segment_id,
328
487k
                          segment_ids[mi_offset + y * mi_params->mi_cols + x]);
329
487k
    }
330
487k
  }
331
332
  assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
333
487k
  return segment_id;
334
487k
}
Unexecuted instantiation: decoder.c:get_segment_id
Unexecuted instantiation: decodetxb.c:get_segment_id
Unexecuted instantiation: av2_loopfilter.c:get_segment_id
Unexecuted instantiation: gdf.c:get_segment_id
Unexecuted instantiation: gdf_block.c:get_segment_id
Unexecuted instantiation: level.c:get_segment_id
Unexecuted instantiation: pred_common.c:get_segment_id
Unexecuted instantiation: restoration.c:get_segment_id
Unexecuted instantiation: bru.c:get_segment_id
Unexecuted instantiation: gdf_block_avx2.c:get_segment_id
335
336
static INLINE int av2_get_spatial_seg_pred(const AV2_COMMON *const cm,
337
                                           const MACROBLOCKD *const xd,
338
200k
                                           int *cdf_index, int rd) {
339
200k
  int prev_ul = -1;  // top left segment_id
340
200k
  int prev_l = -1;   // left segment_id
341
200k
  int prev_u = -1;   // top segment_id
342
200k
  const int mi_row = xd->mi_row;
343
200k
  const int mi_col = xd->mi_col;
344
200k
  const CommonModeInfoParams *const mi_params = &cm->mi_params;
345
200k
  const uint8_t *seg_map = cm->cur_frame->seg_map;
346
347
200k
  if ((xd->up_available) && (xd->left_available)) {
348
146k
    prev_ul = rd ? mi_params
349
0
                       ->mi_grid_base[(mi_row - 1) * mi_params->mi_stride +
350
0
                                      (mi_col - 1)]
351
0
                       ->segment_id
352
146k
                 : get_segment_id(mi_params, seg_map, BLOCK_4X4, mi_row - 1,
353
146k
                                  mi_col - 1);
354
146k
  }
355
200k
  if (xd->up_available) {
356
185k
    prev_u = rd ? mi_params
357
0
                      ->mi_grid_base[(mi_row - 1) * mi_params->mi_stride +
358
0
                                     (mi_col - 0)]
359
0
                      ->segment_id
360
185k
                : get_segment_id(mi_params, seg_map, BLOCK_4X4, mi_row - 1,
361
185k
                                 mi_col - 0);
362
185k
  }
363
200k
  if (xd->left_available) {
364
156k
    prev_l = rd ? mi_params
365
0
                      ->mi_grid_base[(mi_row - 0) * mi_params->mi_stride +
366
0
                                     (mi_col - 1)]
367
0
                      ->segment_id
368
156k
                : get_segment_id(mi_params, seg_map, BLOCK_4X4, mi_row - 0,
369
156k
                                 mi_col - 1);
370
156k
  }
371
  // This property follows from the fact that get_segment_id() returns a
372
  // nonnegative value. This allows us to test for all edge cases with a simple
373
  // prev_ul < 0 check.
374
200k
  assert(IMPLIES(prev_ul >= 0, prev_u >= 0 && prev_l >= 0));
375
376
  // Pick CDF index based on number of matching/out-of-bounds segment IDs.
377
200k
  if (prev_ul < 0) /* Edge cases */
378
54.3k
    *cdf_index = 0;
379
146k
  else if ((prev_ul == prev_u) && (prev_ul == prev_l))
380
38.7k
    *cdf_index = 2;
381
107k
  else if ((prev_ul == prev_u) || (prev_ul == prev_l) || (prev_u == prev_l))
382
77.6k
    *cdf_index = 1;
383
30.0k
  else
384
30.0k
    *cdf_index = 0;
385
386
  // If 2 or more are identical returns that as predictor, otherwise prev_l.
387
200k
  if (prev_u == -1)  // edge case
388
15.4k
    return prev_l == -1 ? 0 : prev_l;
389
185k
  if (prev_l == -1)  // edge case
390
38.9k
    return prev_u;
391
146k
  return (prev_ul == prev_u) ? prev_u : prev_l;
392
185k
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_spatial_seg_pred
Unexecuted instantiation: decodeframe.c:av2_get_spatial_seg_pred
decodemv.c:av2_get_spatial_seg_pred
Line
Count
Source
338
200k
                                           int *cdf_index, int rd) {
339
200k
  int prev_ul = -1;  // top left segment_id
340
200k
  int prev_l = -1;   // left segment_id
341
200k
  int prev_u = -1;   // top segment_id
342
200k
  const int mi_row = xd->mi_row;
343
200k
  const int mi_col = xd->mi_col;
344
200k
  const CommonModeInfoParams *const mi_params = &cm->mi_params;
345
200k
  const uint8_t *seg_map = cm->cur_frame->seg_map;
346
347
200k
  if ((xd->up_available) && (xd->left_available)) {
348
146k
    prev_ul = rd ? mi_params
349
0
                       ->mi_grid_base[(mi_row - 1) * mi_params->mi_stride +
350
0
                                      (mi_col - 1)]
351
0
                       ->segment_id
352
146k
                 : get_segment_id(mi_params, seg_map, BLOCK_4X4, mi_row - 1,
353
146k
                                  mi_col - 1);
354
146k
  }
355
200k
  if (xd->up_available) {
356
185k
    prev_u = rd ? mi_params
357
0
                      ->mi_grid_base[(mi_row - 1) * mi_params->mi_stride +
358
0
                                     (mi_col - 0)]
359
0
                      ->segment_id
360
185k
                : get_segment_id(mi_params, seg_map, BLOCK_4X4, mi_row - 1,
361
185k
                                 mi_col - 0);
362
185k
  }
363
200k
  if (xd->left_available) {
364
156k
    prev_l = rd ? mi_params
365
0
                      ->mi_grid_base[(mi_row - 0) * mi_params->mi_stride +
366
0
                                     (mi_col - 1)]
367
0
                      ->segment_id
368
156k
                : get_segment_id(mi_params, seg_map, BLOCK_4X4, mi_row - 0,
369
156k
                                 mi_col - 1);
370
156k
  }
371
  // This property follows from the fact that get_segment_id() returns a
372
  // nonnegative value. This allows us to test for all edge cases with a simple
373
  // prev_ul < 0 check.
374
200k
  assert(IMPLIES(prev_ul >= 0, prev_u >= 0 && prev_l >= 0));
375
376
  // Pick CDF index based on number of matching/out-of-bounds segment IDs.
377
200k
  if (prev_ul < 0) /* Edge cases */
378
54.3k
    *cdf_index = 0;
379
146k
  else if ((prev_ul == prev_u) && (prev_ul == prev_l))
380
38.7k
    *cdf_index = 2;
381
107k
  else if ((prev_ul == prev_u) || (prev_ul == prev_l) || (prev_u == prev_l))
382
77.6k
    *cdf_index = 1;
383
30.0k
  else
384
30.0k
    *cdf_index = 0;
385
386
  // If 2 or more are identical returns that as predictor, otherwise prev_l.
387
200k
  if (prev_u == -1)  // edge case
388
15.4k
    return prev_l == -1 ? 0 : prev_l;
389
185k
  if (prev_l == -1)  // edge case
390
38.9k
    return prev_u;
391
146k
  return (prev_ul == prev_u) ? prev_u : prev_l;
392
185k
}
Unexecuted instantiation: decoder.c:av2_get_spatial_seg_pred
Unexecuted instantiation: decodetxb.c:av2_get_spatial_seg_pred
Unexecuted instantiation: av2_loopfilter.c:av2_get_spatial_seg_pred
Unexecuted instantiation: gdf.c:av2_get_spatial_seg_pred
Unexecuted instantiation: gdf_block.c:av2_get_spatial_seg_pred
Unexecuted instantiation: level.c:av2_get_spatial_seg_pred
Unexecuted instantiation: pred_common.c:av2_get_spatial_seg_pred
Unexecuted instantiation: restoration.c:av2_get_spatial_seg_pred
Unexecuted instantiation: bru.c:av2_get_spatial_seg_pred
Unexecuted instantiation: gdf_block_avx2.c:av2_get_spatial_seg_pred
393
394
0
static INLINE int av2_get_pred_context_seg_id(const MACROBLOCKD *xd) {
395
0
  const MB_MODE_INFO *const above_mi = xd->above_mbmi;
396
0
  const MB_MODE_INFO *const left_mi = xd->left_mbmi;
397
0
  const int above_sip = (above_mi != NULL) ? above_mi->seg_id_predicted : 0;
398
0
  const int left_sip = (left_mi != NULL) ? left_mi->seg_id_predicted : 0;
399
400
0
  return above_sip + left_sip;
401
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_pred_context_seg_id
Unexecuted instantiation: decodeframe.c:av2_get_pred_context_seg_id
Unexecuted instantiation: decodemv.c:av2_get_pred_context_seg_id
Unexecuted instantiation: decoder.c:av2_get_pred_context_seg_id
Unexecuted instantiation: decodetxb.c:av2_get_pred_context_seg_id
Unexecuted instantiation: av2_loopfilter.c:av2_get_pred_context_seg_id
Unexecuted instantiation: gdf.c:av2_get_pred_context_seg_id
Unexecuted instantiation: gdf_block.c:av2_get_pred_context_seg_id
Unexecuted instantiation: level.c:av2_get_pred_context_seg_id
Unexecuted instantiation: pred_common.c:av2_get_pred_context_seg_id
Unexecuted instantiation: restoration.c:av2_get_pred_context_seg_id
Unexecuted instantiation: bru.c:av2_get_pred_context_seg_id
Unexecuted instantiation: gdf_block_avx2.c:av2_get_pred_context_seg_id
402
403
static INLINE int derive_comp_one_ref_context(const AV2_COMMON *cm,
404
0
                                              const MB_MODE_INFO *const mi) {
405
0
  MV_REFERENCE_FRAME furthest_future_ref = get_furthest_future_ref_index(cm);
406
0
  int ctx = 0;
407
0
  if (mi) {
408
0
    if (has_second_ref(mi))
409
0
      ctx = mi->comp_group_idx;
410
0
    else if (mi->ref_frame[0] == furthest_future_ref)
411
0
      ctx = 2;
412
0
  }
413
414
0
  return ctx;
415
0
}
Unexecuted instantiation: av2_dx_iface.c:derive_comp_one_ref_context
Unexecuted instantiation: decodeframe.c:derive_comp_one_ref_context
Unexecuted instantiation: decodemv.c:derive_comp_one_ref_context
Unexecuted instantiation: decoder.c:derive_comp_one_ref_context
Unexecuted instantiation: decodetxb.c:derive_comp_one_ref_context
Unexecuted instantiation: av2_loopfilter.c:derive_comp_one_ref_context
Unexecuted instantiation: gdf.c:derive_comp_one_ref_context
Unexecuted instantiation: gdf_block.c:derive_comp_one_ref_context
Unexecuted instantiation: level.c:derive_comp_one_ref_context
Unexecuted instantiation: pred_common.c:derive_comp_one_ref_context
Unexecuted instantiation: restoration.c:derive_comp_one_ref_context
Unexecuted instantiation: bru.c:derive_comp_one_ref_context
Unexecuted instantiation: gdf_block_avx2.c:derive_comp_one_ref_context
416
417
static INLINE int get_comp_group_idx_context(const AV2_COMMON *cm,
418
0
                                             const MACROBLOCKD *xd) {
419
0
  (void)cm;
420
0
  MB_MODE_INFO *mbmi = xd->mi[0];
421
0
  const RefCntBuffer *const bck_buf = get_ref_frame_buf(cm, mbmi->ref_frame[0]);
422
0
  const RefCntBuffer *const fwd_buf = get_ref_frame_buf(cm, mbmi->ref_frame[1]);
423
0
  int bck_frame_index = 0, fwd_frame_index = 0;
424
0
  int cur_frame_index = cm->cur_frame->display_order_hint;
425
0
  if (bck_buf != NULL) bck_frame_index = bck_buf->display_order_hint;
426
0
  if (fwd_buf != NULL) fwd_frame_index = fwd_buf->display_order_hint;
427
428
0
  int fwd = abs(get_relative_dist(&cm->seq_params.order_hint_info,
429
0
                                  fwd_frame_index, cur_frame_index));
430
0
  int bck = abs(get_relative_dist(&cm->seq_params.order_hint_info,
431
0
                                  cur_frame_index, bck_frame_index));
432
0
  const int offset = (fwd == bck);
433
434
0
  const int ctx0 =
435
0
      derive_comp_one_ref_context(cm, xd->neighbors_line_buffer[0]);
436
0
  const int ctx1 =
437
0
      derive_comp_one_ref_context(cm, xd->neighbors_line_buffer[1]);
438
439
0
  const int ctxmap[3 * 3] = { 0, 1, 2, 1, 3, 4, 2, 4, 5 };
440
441
0
  return ctxmap[3 * ctx0 + ctx1] + offset * 6;
442
0
}
Unexecuted instantiation: av2_dx_iface.c:get_comp_group_idx_context
Unexecuted instantiation: decodeframe.c:get_comp_group_idx_context
Unexecuted instantiation: decodemv.c:get_comp_group_idx_context
Unexecuted instantiation: decoder.c:get_comp_group_idx_context
Unexecuted instantiation: decodetxb.c:get_comp_group_idx_context
Unexecuted instantiation: av2_loopfilter.c:get_comp_group_idx_context
Unexecuted instantiation: gdf.c:get_comp_group_idx_context
Unexecuted instantiation: gdf_block.c:get_comp_group_idx_context
Unexecuted instantiation: level.c:get_comp_group_idx_context
Unexecuted instantiation: pred_common.c:get_comp_group_idx_context
Unexecuted instantiation: restoration.c:get_comp_group_idx_context
Unexecuted instantiation: bru.c:get_comp_group_idx_context
Unexecuted instantiation: gdf_block_avx2.c:get_comp_group_idx_context
443
444
static INLINE avm_cdf_prob *av2_get_pred_cdf_seg_id(
445
0
    struct segmentation_probs *segp, const MACROBLOCKD *xd) {
446
0
  return segp->pred_cdf[av2_get_pred_context_seg_id(xd)];
447
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: decodeframe.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: decodemv.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: decoder.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: decodetxb.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: av2_loopfilter.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: gdf.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: gdf_block.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: level.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: pred_common.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: restoration.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: bru.c:av2_get_pred_cdf_seg_id
Unexecuted instantiation: gdf_block_avx2.c:av2_get_pred_cdf_seg_id
448
449
0
static INLINE int av2_get_skip_mode_context(const MACROBLOCKD *xd) {
450
0
  int ctx = 0;
451
0
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
452
0
    const MB_MODE_INFO *const neighbor = xd->neighbors_line_buffer[i];
453
0
    if (neighbor != NULL) {
454
0
      ctx += neighbor->skip_mode;
455
0
    }
456
0
  }
457
458
0
  return ctx;
459
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_skip_mode_context
Unexecuted instantiation: decodeframe.c:av2_get_skip_mode_context
Unexecuted instantiation: decodemv.c:av2_get_skip_mode_context
Unexecuted instantiation: decoder.c:av2_get_skip_mode_context
Unexecuted instantiation: decodetxb.c:av2_get_skip_mode_context
Unexecuted instantiation: av2_loopfilter.c:av2_get_skip_mode_context
Unexecuted instantiation: gdf.c:av2_get_skip_mode_context
Unexecuted instantiation: gdf_block.c:av2_get_skip_mode_context
Unexecuted instantiation: level.c:av2_get_skip_mode_context
Unexecuted instantiation: pred_common.c:av2_get_skip_mode_context
Unexecuted instantiation: restoration.c:av2_get_skip_mode_context
Unexecuted instantiation: bru.c:av2_get_skip_mode_context
Unexecuted instantiation: gdf_block_avx2.c:av2_get_skip_mode_context
460
461
81.8k
static INLINE int av2_get_skip_txfm_context(const MACROBLOCKD *xd) {
462
81.8k
  int ctx = 0;
463
245k
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
464
163k
    const MB_MODE_INFO *const neighbor = xd->neighbors_line_buffer[i];
465
163k
    if (neighbor != NULL) {
466
162k
      ctx += neighbor->skip_txfm[xd->tree_type == CHROMA_PART];
467
162k
    }
468
163k
  }
469
470
81.8k
  if (xd->mi[0]->skip_mode) ctx += (SKIP_CONTEXTS >> 1);
471
81.8k
  return ctx;
472
81.8k
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_skip_txfm_context
Unexecuted instantiation: decodeframe.c:av2_get_skip_txfm_context
decodemv.c:av2_get_skip_txfm_context
Line
Count
Source
461
81.8k
static INLINE int av2_get_skip_txfm_context(const MACROBLOCKD *xd) {
462
81.8k
  int ctx = 0;
463
245k
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
464
163k
    const MB_MODE_INFO *const neighbor = xd->neighbors_line_buffer[i];
465
163k
    if (neighbor != NULL) {
466
162k
      ctx += neighbor->skip_txfm[xd->tree_type == CHROMA_PART];
467
162k
    }
468
163k
  }
469
470
81.8k
  if (xd->mi[0]->skip_mode) ctx += (SKIP_CONTEXTS >> 1);
471
81.8k
  return ctx;
472
81.8k
}
Unexecuted instantiation: decoder.c:av2_get_skip_txfm_context
Unexecuted instantiation: decodetxb.c:av2_get_skip_txfm_context
Unexecuted instantiation: av2_loopfilter.c:av2_get_skip_txfm_context
Unexecuted instantiation: gdf.c:av2_get_skip_txfm_context
Unexecuted instantiation: gdf_block.c:av2_get_skip_txfm_context
Unexecuted instantiation: level.c:av2_get_skip_txfm_context
Unexecuted instantiation: pred_common.c:av2_get_skip_txfm_context
Unexecuted instantiation: restoration.c:av2_get_skip_txfm_context
Unexecuted instantiation: bru.c:av2_get_skip_txfm_context
Unexecuted instantiation: gdf_block_avx2.c:av2_get_skip_txfm_context
473
474
1.37M
static INLINE int get_intrabc_ctx(const MACROBLOCKD *xd) {
475
1.37M
  int ctx = 0;
476
4.13M
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
477
2.75M
    const MB_MODE_INFO *const neighbor = xd->neighbors[i];
478
2.75M
    if (neighbor != NULL) {
479
2.56M
      ctx += is_intrabc_block(neighbor, xd->tree_type);
480
2.56M
    }
481
2.75M
  }
482
483
1.37M
  return ctx;
484
1.37M
}
Unexecuted instantiation: av2_dx_iface.c:get_intrabc_ctx
Unexecuted instantiation: decodeframe.c:get_intrabc_ctx
decodemv.c:get_intrabc_ctx
Line
Count
Source
474
1.37M
static INLINE int get_intrabc_ctx(const MACROBLOCKD *xd) {
475
1.37M
  int ctx = 0;
476
4.13M
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
477
2.75M
    const MB_MODE_INFO *const neighbor = xd->neighbors[i];
478
2.75M
    if (neighbor != NULL) {
479
2.56M
      ctx += is_intrabc_block(neighbor, xd->tree_type);
480
2.56M
    }
481
2.75M
  }
482
483
1.37M
  return ctx;
484
1.37M
}
Unexecuted instantiation: decoder.c:get_intrabc_ctx
Unexecuted instantiation: decodetxb.c:get_intrabc_ctx
Unexecuted instantiation: av2_loopfilter.c:get_intrabc_ctx
Unexecuted instantiation: gdf.c:get_intrabc_ctx
Unexecuted instantiation: gdf_block.c:get_intrabc_ctx
Unexecuted instantiation: level.c:get_intrabc_ctx
Unexecuted instantiation: pred_common.c:get_intrabc_ctx
Unexecuted instantiation: restoration.c:get_intrabc_ctx
Unexecuted instantiation: bru.c:get_intrabc_ctx
Unexecuted instantiation: gdf_block_avx2.c:get_intrabc_ctx
485
486
65.7k
static INLINE int get_morph_pred_ctx(const MACROBLOCKD *xd) {
487
65.7k
  int ctx = 0;
488
197k
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
489
131k
    const MB_MODE_INFO *const neighbor = xd->neighbors[i];
490
131k
    if (neighbor != NULL) {
491
131k
      ctx +=
492
131k
          (is_intrabc_block(neighbor, xd->tree_type) && neighbor->morph_pred);
493
131k
    }
494
131k
  }
495
65.7k
  return ctx;
496
65.7k
}
Unexecuted instantiation: av2_dx_iface.c:get_morph_pred_ctx
Unexecuted instantiation: decodeframe.c:get_morph_pred_ctx
decodemv.c:get_morph_pred_ctx
Line
Count
Source
486
65.7k
static INLINE int get_morph_pred_ctx(const MACROBLOCKD *xd) {
487
65.7k
  int ctx = 0;
488
197k
  for (int i = 0; i < MAX_NUM_NEIGHBORS; ++i) {
489
131k
    const MB_MODE_INFO *const neighbor = xd->neighbors[i];
490
131k
    if (neighbor != NULL) {
491
131k
      ctx +=
492
131k
          (is_intrabc_block(neighbor, xd->tree_type) && neighbor->morph_pred);
493
131k
    }
494
131k
  }
495
65.7k
  return ctx;
496
65.7k
}
Unexecuted instantiation: decoder.c:get_morph_pred_ctx
Unexecuted instantiation: decodetxb.c:get_morph_pred_ctx
Unexecuted instantiation: av2_loopfilter.c:get_morph_pred_ctx
Unexecuted instantiation: gdf.c:get_morph_pred_ctx
Unexecuted instantiation: gdf_block.c:get_morph_pred_ctx
Unexecuted instantiation: level.c:get_morph_pred_ctx
Unexecuted instantiation: pred_common.c:get_morph_pred_ctx
Unexecuted instantiation: restoration.c:get_morph_pred_ctx
Unexecuted instantiation: bru.c:get_morph_pred_ctx
Unexecuted instantiation: gdf_block_avx2.c:get_morph_pred_ctx
497
498
12.3M
static INLINE int is_cctx_enabled(const AV2_COMMON *cm, const MACROBLOCKD *xd) {
499
12.3M
  const MB_MODE_INFO *const mbmi = xd->mi[0];
500
12.3M
  return cm->seq_params.enable_cctx && !xd->lossless[mbmi->segment_id];
501
12.3M
}
Unexecuted instantiation: av2_dx_iface.c:is_cctx_enabled
decodeframe.c:is_cctx_enabled
Line
Count
Source
498
11.8M
static INLINE int is_cctx_enabled(const AV2_COMMON *cm, const MACROBLOCKD *xd) {
499
11.8M
  const MB_MODE_INFO *const mbmi = xd->mi[0];
500
11.8M
  return cm->seq_params.enable_cctx && !xd->lossless[mbmi->segment_id];
501
11.8M
}
Unexecuted instantiation: decodemv.c:is_cctx_enabled
Unexecuted instantiation: decoder.c:is_cctx_enabled
decodetxb.c:is_cctx_enabled
Line
Count
Source
498
487k
static INLINE int is_cctx_enabled(const AV2_COMMON *cm, const MACROBLOCKD *xd) {
499
487k
  const MB_MODE_INFO *const mbmi = xd->mi[0];
500
487k
  return cm->seq_params.enable_cctx && !xd->lossless[mbmi->segment_id];
501
487k
}
Unexecuted instantiation: av2_loopfilter.c:is_cctx_enabled
Unexecuted instantiation: gdf.c:is_cctx_enabled
Unexecuted instantiation: gdf_block.c:is_cctx_enabled
Unexecuted instantiation: level.c:is_cctx_enabled
Unexecuted instantiation: pred_common.c:is_cctx_enabled
Unexecuted instantiation: restoration.c:is_cctx_enabled
Unexecuted instantiation: bru.c:is_cctx_enabled
Unexecuted instantiation: gdf_block_avx2.c:is_cctx_enabled
502
503
// Determine whether to allow cctx or not for a given block
504
12.3M
static INLINE int is_cctx_allowed(const AV2_COMMON *cm, const MACROBLOCKD *xd) {
505
12.3M
  if (!is_cctx_enabled(cm, xd)) return 0;
506
507
5.42M
  if (xd->tree_type == LUMA_PART) {
508
453k
    return 0;
509
453k
  }
510
511
  // Disable cctx for 32x32 or larger blocks in 422/444 formats, in which case
512
  // the speed and quality tradeoff is worse.
513
4.97M
  const struct macroblockd_plane *const pd = &xd->plane[AVM_PLANE_U];
514
4.97M
  const int ss_x = pd->subsampling_x;
515
4.97M
  const int ss_y = pd->subsampling_y;
516
4.97M
  const BLOCK_SIZE chroma_plane_bsize =
517
4.97M
      get_mb_plane_block_size(xd, xd->mi[0], AVM_PLANE_U, ss_x, ss_y);
518
4.97M
  assert(chroma_plane_bsize <= BLOCK_SIZES_ALL);
519
4.97M
  if (ss_x == 0 || ss_y == 0)
520
630k
    return block_size_wide[chroma_plane_bsize] < 32 ||
521
263k
           block_size_high[chroma_plane_bsize] < 32;
522
4.34M
  return 1;
523
4.97M
}
Unexecuted instantiation: av2_dx_iface.c:is_cctx_allowed
decodeframe.c:is_cctx_allowed
Line
Count
Source
504
11.8M
static INLINE int is_cctx_allowed(const AV2_COMMON *cm, const MACROBLOCKD *xd) {
505
11.8M
  if (!is_cctx_enabled(cm, xd)) return 0;
506
507
5.26M
  if (xd->tree_type == LUMA_PART) {
508
453k
    return 0;
509
453k
  }
510
511
  // Disable cctx for 32x32 or larger blocks in 422/444 formats, in which case
512
  // the speed and quality tradeoff is worse.
513
4.81M
  const struct macroblockd_plane *const pd = &xd->plane[AVM_PLANE_U];
514
4.81M
  const int ss_x = pd->subsampling_x;
515
4.81M
  const int ss_y = pd->subsampling_y;
516
4.81M
  const BLOCK_SIZE chroma_plane_bsize =
517
4.81M
      get_mb_plane_block_size(xd, xd->mi[0], AVM_PLANE_U, ss_x, ss_y);
518
4.81M
  assert(chroma_plane_bsize <= BLOCK_SIZES_ALL);
519
4.81M
  if (ss_x == 0 || ss_y == 0)
520
611k
    return block_size_wide[chroma_plane_bsize] < 32 ||
521
253k
           block_size_high[chroma_plane_bsize] < 32;
522
4.20M
  return 1;
523
4.81M
}
Unexecuted instantiation: decodemv.c:is_cctx_allowed
Unexecuted instantiation: decoder.c:is_cctx_allowed
decodetxb.c:is_cctx_allowed
Line
Count
Source
504
488k
static INLINE int is_cctx_allowed(const AV2_COMMON *cm, const MACROBLOCKD *xd) {
505
488k
  if (!is_cctx_enabled(cm, xd)) return 0;
506
507
162k
  if (xd->tree_type == LUMA_PART) {
508
0
    return 0;
509
0
  }
510
511
  // Disable cctx for 32x32 or larger blocks in 422/444 formats, in which case
512
  // the speed and quality tradeoff is worse.
513
162k
  const struct macroblockd_plane *const pd = &xd->plane[AVM_PLANE_U];
514
162k
  const int ss_x = pd->subsampling_x;
515
162k
  const int ss_y = pd->subsampling_y;
516
162k
  const BLOCK_SIZE chroma_plane_bsize =
517
162k
      get_mb_plane_block_size(xd, xd->mi[0], AVM_PLANE_U, ss_x, ss_y);
518
162k
  assert(chroma_plane_bsize <= BLOCK_SIZES_ALL);
519
162k
  if (ss_x == 0 || ss_y == 0)
520
19.2k
    return block_size_wide[chroma_plane_bsize] < 32 ||
521
10.9k
           block_size_high[chroma_plane_bsize] < 32;
522
142k
  return 1;
523
162k
}
Unexecuted instantiation: av2_loopfilter.c:is_cctx_allowed
Unexecuted instantiation: gdf.c:is_cctx_allowed
Unexecuted instantiation: gdf_block.c:is_cctx_allowed
Unexecuted instantiation: level.c:is_cctx_allowed
Unexecuted instantiation: pred_common.c:is_cctx_allowed
Unexecuted instantiation: restoration.c:is_cctx_allowed
Unexecuted instantiation: bru.c:is_cctx_allowed
Unexecuted instantiation: gdf_block_avx2.c:is_cctx_allowed
524
525
int av2_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
526
527
// Get a list of palette base colors that are used in the above and left blocks,
528
// referred to as "color cache". The return value is the number of colors in the
529
// cache (<= 2 * PALETTE_MAX_SIZE). The color values are stored in "cache"
530
// in ascending order.
531
int av2_get_palette_cache(const MACROBLOCKD *const xd, int plane,
532
                          uint16_t *cache);
533
534
int av2_get_intra_inter_context(const MACROBLOCKD *xd);
535
536
bool av2_check_ccso_mbmi_inside_tile(const AV2_COMMON *cm,
537
                                     const MACROBLOCKD *xd,
538
                                     const MB_MODE_INFO *const mbmi);
539
int av2_get_ccso_context(const AV2_COMMON *cm, const MACROBLOCKD *xd,
540
                         int plane);
541
542
int av2_get_cdef_context(const AV2_COMMON *const cm,
543
                         const MACROBLOCKD *const xd);
544
545
int av2_get_reference_mode_context(const AV2_COMMON *cm, const MACROBLOCKD *xd);
546
547
static INLINE avm_cdf_prob *av2_get_reference_mode_cdf(const AV2_COMMON *cm,
548
0
                                                       const MACROBLOCKD *xd) {
549
0
  return xd->tile_ctx->comp_inter_cdf[av2_get_reference_mode_context(cm, xd)];
550
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_reference_mode_cdf
Unexecuted instantiation: decodeframe.c:av2_get_reference_mode_cdf
Unexecuted instantiation: decodemv.c:av2_get_reference_mode_cdf
Unexecuted instantiation: decoder.c:av2_get_reference_mode_cdf
Unexecuted instantiation: decodetxb.c:av2_get_reference_mode_cdf
Unexecuted instantiation: av2_loopfilter.c:av2_get_reference_mode_cdf
Unexecuted instantiation: gdf.c:av2_get_reference_mode_cdf
Unexecuted instantiation: gdf_block.c:av2_get_reference_mode_cdf
Unexecuted instantiation: level.c:av2_get_reference_mode_cdf
Unexecuted instantiation: pred_common.c:av2_get_reference_mode_cdf
Unexecuted instantiation: restoration.c:av2_get_reference_mode_cdf
Unexecuted instantiation: bru.c:av2_get_reference_mode_cdf
Unexecuted instantiation: gdf_block_avx2.c:av2_get_reference_mode_cdf
551
552
int av2_get_ref_pred_context(const MACROBLOCKD *xd, MV_REFERENCE_FRAME ref,
553
                             int num_total_refs);
554
555
// Obtain cdf of reference frame for single prediction
556
static INLINE avm_cdf_prob *av2_get_pred_cdf_single_ref(const MACROBLOCKD *xd,
557
                                                        MV_REFERENCE_FRAME ref,
558
0
                                                        int num_total_refs) {
559
0
  assert((ref + 1) < num_total_refs);
560
0
  return xd->tile_ctx
561
0
      ->single_ref_cdf[av2_get_ref_pred_context(xd, ref, num_total_refs)][ref];
562
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: decodeframe.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: decodemv.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: decoder.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: decodetxb.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: av2_loopfilter.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: gdf.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: gdf_block.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: level.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: pred_common.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: restoration.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: bru.c:av2_get_pred_cdf_single_ref
Unexecuted instantiation: gdf_block_avx2.c:av2_get_pred_cdf_single_ref
563
564
// This function checks whether the previously coded reference frame is on the
565
// same side as the frame to be coded. The returned value is used as the cdf
566
// context.
567
static INLINE int av2_get_compound_ref_bit_type(
568
0
    const RefFramesInfo *const ref_frames_info, int i, int j) {
569
0
  const int bit_type = (ref_frames_info->ref_frame_distance[i] >= 0) ^
570
0
                       (ref_frames_info->ref_frame_distance[j] >= 0);
571
0
  return bit_type;
572
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: decodeframe.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: decodemv.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: decoder.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: decodetxb.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: av2_loopfilter.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: gdf.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: gdf_block.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: level.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: pred_common.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: restoration.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: bru.c:av2_get_compound_ref_bit_type
Unexecuted instantiation: gdf_block_avx2.c:av2_get_compound_ref_bit_type
573
574
// Obtain cdf of reference frame for compound prediction
575
static INLINE avm_cdf_prob *av2_get_pred_cdf_compound_ref(
576
    const MACROBLOCKD *xd, MV_REFERENCE_FRAME ref, int n_bits, int bit_type,
577
0
    int num_total_refs) {
578
0
  assert(ref < num_total_refs);
579
0
  assert(n_bits < 2);
580
0
  assert(bit_type < COMPREF_BIT_TYPES);
581
0
  assert(IMPLIES(n_bits == 0, ref < RANKED_REF0_TO_PRUNE - 1));
582
0
  return n_bits == 0 ? xd->tile_ctx->comp_ref0_cdf[av2_get_ref_pred_context(
583
0
                           xd, ref, num_total_refs)][ref]
584
0
                     : xd->tile_ctx->comp_ref1_cdf[av2_get_ref_pred_context(
585
0
                           xd, ref, num_total_refs)][bit_type][ref];
586
0
}
Unexecuted instantiation: av2_dx_iface.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: decodeframe.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: decodemv.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: decoder.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: decodetxb.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: av2_loopfilter.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: gdf.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: gdf_block.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: level.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: pred_common.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: restoration.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: bru.c:av2_get_pred_cdf_compound_ref
Unexecuted instantiation: gdf_block_avx2.c:av2_get_pred_cdf_compound_ref
587
588
#ifdef __cplusplus
589
}  // extern "C"
590
#endif
591
592
#endif  // AVM_AV2_COMMON_PRED_COMMON_H_