Coverage Report

Created: 2022-08-24 06:15

/src/aom/av1/common/pred_common.c
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
#include "av1/common/common.h"
13
#include "av1/common/pred_common.h"
14
#include "av1/common/reconinter.h"
15
#include "av1/common/reconintra.h"
16
#include "av1/common/seg_common.h"
17
18
// Returns a context number for the given MB prediction signal
19
static InterpFilter get_ref_filter_type(const MB_MODE_INFO *ref_mbmi,
20
                                        const MACROBLOCKD *xd, int dir,
21
0
                                        MV_REFERENCE_FRAME ref_frame) {
22
0
  (void)xd;
23
24
0
  return ((ref_mbmi->ref_frame[0] == ref_frame ||
25
0
           ref_mbmi->ref_frame[1] == ref_frame)
26
0
              ? av1_extract_interp_filter(ref_mbmi->interp_filters, dir & 0x01)
27
0
              : SWITCHABLE_FILTERS);
28
0
}
29
30
0
int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir) {
31
0
  const MB_MODE_INFO *const mbmi = xd->mi[0];
32
0
  const int ctx_offset =
33
0
      (mbmi->ref_frame[1] > INTRA_FRAME) * INTER_FILTER_COMP_OFFSET;
34
0
  assert(dir == 0 || dir == 1);
35
0
  const MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame[0];
36
  // Note:
37
  // The mode info data structure has a one element border above and to the
38
  // left of the entries corresponding to real macroblocks.
39
  // The prediction flags in these dummy entries are initialized to 0.
40
0
  int filter_type_ctx = ctx_offset + (dir & 0x01) * INTER_FILTER_DIR_OFFSET;
41
0
  int left_type = SWITCHABLE_FILTERS;
42
0
  int above_type = SWITCHABLE_FILTERS;
43
44
0
  if (xd->left_available)
45
0
    left_type = get_ref_filter_type(xd->mi[-1], xd, dir, ref_frame);
46
47
0
  if (xd->up_available)
48
0
    above_type =
49
0
        get_ref_filter_type(xd->mi[-xd->mi_stride], xd, dir, ref_frame);
50
51
0
  if (left_type == above_type) {
52
0
    filter_type_ctx += left_type;
53
0
  } else if (left_type == SWITCHABLE_FILTERS) {
54
0
    assert(above_type != SWITCHABLE_FILTERS);
55
0
    filter_type_ctx += above_type;
56
0
  } else if (above_type == SWITCHABLE_FILTERS) {
57
0
    assert(left_type != SWITCHABLE_FILTERS);
58
0
    filter_type_ctx += left_type;
59
0
  } else {
60
0
    filter_type_ctx += SWITCHABLE_FILTERS;
61
0
  }
62
63
0
  return filter_type_ctx;
64
0
}
65
66
0
static void palette_add_to_cache(uint16_t *cache, int *n, uint16_t val) {
67
  // Do not add an already existing value
68
0
  if (*n > 0 && val == cache[*n - 1]) return;
69
70
0
  cache[(*n)++] = val;
71
0
}
72
73
int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane,
74
0
                          uint16_t *cache) {
75
0
  const int row = -xd->mb_to_top_edge >> 3;
76
  // Do not refer to above SB row when on SB boundary.
77
0
  const MB_MODE_INFO *const above_mi =
78
0
      (row % (1 << MIN_SB_SIZE_LOG2)) ? xd->above_mbmi : NULL;
79
0
  const MB_MODE_INFO *const left_mi = xd->left_mbmi;
80
0
  int above_n = 0, left_n = 0;
81
0
  if (above_mi) above_n = above_mi->palette_mode_info.palette_size[plane != 0];
82
0
  if (left_mi) left_n = left_mi->palette_mode_info.palette_size[plane != 0];
83
0
  if (above_n == 0 && left_n == 0) return 0;
84
0
  int above_idx = plane * PALETTE_MAX_SIZE;
85
0
  int left_idx = plane * PALETTE_MAX_SIZE;
86
0
  int n = 0;
87
0
  const uint16_t *above_colors =
88
0
      above_mi ? above_mi->palette_mode_info.palette_colors : NULL;
89
0
  const uint16_t *left_colors =
90
0
      left_mi ? left_mi->palette_mode_info.palette_colors : NULL;
91
  // Merge the sorted lists of base colors from above and left to get
92
  // combined sorted color cache.
93
0
  while (above_n > 0 && left_n > 0) {
94
0
    uint16_t v_above = above_colors[above_idx];
95
0
    uint16_t v_left = left_colors[left_idx];
96
0
    if (v_left < v_above) {
97
0
      palette_add_to_cache(cache, &n, v_left);
98
0
      ++left_idx, --left_n;
99
0
    } else {
100
0
      palette_add_to_cache(cache, &n, v_above);
101
0
      ++above_idx, --above_n;
102
0
      if (v_left == v_above) ++left_idx, --left_n;
103
0
    }
104
0
  }
105
0
  while (above_n-- > 0) {
106
0
    uint16_t val = above_colors[above_idx++];
107
0
    palette_add_to_cache(cache, &n, val);
108
0
  }
109
0
  while (left_n-- > 0) {
110
0
    uint16_t val = left_colors[left_idx++];
111
0
    palette_add_to_cache(cache, &n, val);
112
0
  }
113
0
  assert(n <= 2 * PALETTE_MAX_SIZE);
114
0
  return n;
115
0
}
116
117
// The mode info data structure has a one element border above and to the
118
// left of the entries corresponding to real macroblocks.
119
// The prediction flags in these dummy entries are initialized to 0.
120
// 0 - inter/inter, inter/--, --/inter, --/--
121
// 1 - intra/inter, inter/intra
122
// 2 - intra/--, --/intra
123
// 3 - intra/intra
124
0
int av1_get_intra_inter_context(const MACROBLOCKD *xd) {
125
0
  const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
126
0
  const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
127
0
  const int has_above = xd->up_available;
128
0
  const int has_left = xd->left_available;
129
130
0
  if (has_above && has_left) {  // both edges available
131
0
    const int above_intra = !is_inter_block(above_mbmi);
132
0
    const int left_intra = !is_inter_block(left_mbmi);
133
0
    return left_intra && above_intra ? 3 : left_intra || above_intra;
134
0
  } else if (has_above || has_left) {  // one edge available
135
0
    return 2 * !is_inter_block(has_above ? above_mbmi : left_mbmi);
136
0
  } else {
137
0
    return 0;
138
0
  }
139
0
}
140
141
#define CHECK_BACKWARD_REFS(ref_frame) \
142
0
  (((ref_frame) >= BWDREF_FRAME) && ((ref_frame) <= ALTREF_FRAME))
143
0
#define IS_BACKWARD_REF_FRAME(ref_frame) CHECK_BACKWARD_REFS(ref_frame)
144
145
0
int av1_get_reference_mode_context(const MACROBLOCKD *xd) {
146
0
  int ctx;
147
0
  const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
148
0
  const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
149
0
  const int has_above = xd->up_available;
150
0
  const int has_left = xd->left_available;
151
152
  // Note:
153
  // The mode info data structure has a one element border above and to the
154
  // left of the entries corresponding to real macroblocks.
155
  // The prediction flags in these dummy entries are initialized to 0.
156
0
  if (has_above && has_left) {  // both edges available
157
0
    if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi))
158
      // neither edge uses comp pred (0/1)
159
0
      ctx = IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame[0]) ^
160
0
            IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame[0]);
161
0
    else if (!has_second_ref(above_mbmi))
162
      // one of two edges uses comp pred (2/3)
163
0
      ctx = 2 + (IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame[0]) ||
164
0
                 !is_inter_block(above_mbmi));
165
0
    else if (!has_second_ref(left_mbmi))
166
      // one of two edges uses comp pred (2/3)
167
0
      ctx = 2 + (IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame[0]) ||
168
0
                 !is_inter_block(left_mbmi));
169
0
    else  // both edges use comp pred (4)
170
0
      ctx = 4;
171
0
  } else if (has_above || has_left) {  // one edge available
172
0
    const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
173
174
0
    if (!has_second_ref(edge_mbmi))
175
      // edge does not use comp pred (0/1)
176
0
      ctx = IS_BACKWARD_REF_FRAME(edge_mbmi->ref_frame[0]);
177
0
    else
178
      // edge uses comp pred (3)
179
0
      ctx = 3;
180
0
  } else {  // no edges available (1)
181
0
    ctx = 1;
182
0
  }
183
0
  assert(ctx >= 0 && ctx < COMP_INTER_CONTEXTS);
184
0
  return ctx;
185
0
}
186
187
0
int av1_get_comp_reference_type_context(const MACROBLOCKD *xd) {
188
0
  int pred_context;
189
0
  const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
190
0
  const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
191
0
  const int above_in_image = xd->up_available;
192
0
  const int left_in_image = xd->left_available;
193
194
0
  if (above_in_image && left_in_image) {  // both edges available
195
0
    const int above_intra = !is_inter_block(above_mbmi);
196
0
    const int left_intra = !is_inter_block(left_mbmi);
197
198
0
    if (above_intra && left_intra) {  // intra/intra
199
0
      pred_context = 2;
200
0
    } else if (above_intra || left_intra) {  // intra/inter
201
0
      const MB_MODE_INFO *inter_mbmi = above_intra ? left_mbmi : above_mbmi;
202
203
0
      if (!has_second_ref(inter_mbmi))  // single pred
204
0
        pred_context = 2;
205
0
      else  // comp pred
206
0
        pred_context = 1 + 2 * has_uni_comp_refs(inter_mbmi);
207
0
    } else {  // inter/inter
208
0
      const int a_sg = !has_second_ref(above_mbmi);
209
0
      const int l_sg = !has_second_ref(left_mbmi);
210
0
      const MV_REFERENCE_FRAME frfa = above_mbmi->ref_frame[0];
211
0
      const MV_REFERENCE_FRAME frfl = left_mbmi->ref_frame[0];
212
213
0
      if (a_sg && l_sg) {  // single/single
214
0
        pred_context = 1 + 2 * (!(IS_BACKWARD_REF_FRAME(frfa) ^
215
0
                                  IS_BACKWARD_REF_FRAME(frfl)));
216
0
      } else if (l_sg || a_sg) {  // single/comp
217
0
        const int uni_rfc =
218
0
            a_sg ? has_uni_comp_refs(left_mbmi) : has_uni_comp_refs(above_mbmi);
219
220
0
        if (!uni_rfc)  // comp bidir
221
0
          pred_context = 1;
222
0
        else  // comp unidir
223
0
          pred_context = 3 + (!(IS_BACKWARD_REF_FRAME(frfa) ^
224
0
                                IS_BACKWARD_REF_FRAME(frfl)));
225
0
      } else {  // comp/comp
226
0
        const int a_uni_rfc = has_uni_comp_refs(above_mbmi);
227
0
        const int l_uni_rfc = has_uni_comp_refs(left_mbmi);
228
229
0
        if (!a_uni_rfc && !l_uni_rfc)  // bidir/bidir
230
0
          pred_context = 0;
231
0
        else if (!a_uni_rfc || !l_uni_rfc)  // unidir/bidir
232
0
          pred_context = 2;
233
0
        else  // unidir/unidir
234
0
          pred_context =
235
0
              3 + (!((frfa == BWDREF_FRAME) ^ (frfl == BWDREF_FRAME)));
236
0
      }
237
0
    }
238
0
  } else if (above_in_image || left_in_image) {  // one edge available
239
0
    const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
240
241
0
    if (!is_inter_block(edge_mbmi)) {  // intra
242
0
      pred_context = 2;
243
0
    } else {                           // inter
244
0
      if (!has_second_ref(edge_mbmi))  // single pred
245
0
        pred_context = 2;
246
0
      else  // comp pred
247
0
        pred_context = 4 * has_uni_comp_refs(edge_mbmi);
248
0
    }
249
0
  } else {  // no edges available
250
0
    pred_context = 2;
251
0
  }
252
253
0
  assert(pred_context >= 0 && pred_context < COMP_REF_TYPE_CONTEXTS);
254
0
  return pred_context;
255
0
}
256
257
// Returns a context number for the given MB prediction signal
258
//
259
// Signal the uni-directional compound reference frame pair as either
260
// (BWDREF, ALTREF), or (LAST, LAST2) / (LAST, LAST3) / (LAST, GOLDEN),
261
// conditioning on the pair is known as uni-directional.
262
//
263
// 3 contexts: Voting is used to compare the count of forward references with
264
//             that of backward references from the spatial neighbors.
265
0
int av1_get_pred_context_uni_comp_ref_p(const MACROBLOCKD *xd) {
266
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
267
268
  // Count of forward references (L, L2, L3, or G)
269
0
  const int frf_count = ref_counts[LAST_FRAME] + ref_counts[LAST2_FRAME] +
270
0
                        ref_counts[LAST3_FRAME] + ref_counts[GOLDEN_FRAME];
271
  // Count of backward references (B or A)
272
0
  const int brf_count = ref_counts[BWDREF_FRAME] + ref_counts[ALTREF2_FRAME] +
273
0
                        ref_counts[ALTREF_FRAME];
274
275
0
  const int pred_context =
276
0
      (frf_count == brf_count) ? 1 : ((frf_count < brf_count) ? 0 : 2);
277
278
0
  assert(pred_context >= 0 && pred_context < UNI_COMP_REF_CONTEXTS);
279
0
  return pred_context;
280
0
}
281
282
// Returns a context number for the given MB prediction signal
283
//
284
// Signal the uni-directional compound reference frame pair as
285
// either (LAST, LAST2), or (LAST, LAST3) / (LAST, GOLDEN),
286
// conditioning on the pair is known as one of the above three.
287
//
288
// 3 contexts: Voting is used to compare the count of LAST2_FRAME with the
289
//             total count of LAST3/GOLDEN from the spatial neighbors.
290
0
int av1_get_pred_context_uni_comp_ref_p1(const MACROBLOCKD *xd) {
291
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
292
293
  // Count of LAST2
294
0
  const int last2_count = ref_counts[LAST2_FRAME];
295
  // Count of LAST3 or GOLDEN
296
0
  const int last3_or_gld_count =
297
0
      ref_counts[LAST3_FRAME] + ref_counts[GOLDEN_FRAME];
298
299
0
  const int pred_context = (last2_count == last3_or_gld_count)
300
0
                               ? 1
301
0
                               : ((last2_count < last3_or_gld_count) ? 0 : 2);
302
303
0
  assert(pred_context >= 0 && pred_context < UNI_COMP_REF_CONTEXTS);
304
0
  return pred_context;
305
0
}
306
307
// Returns a context number for the given MB prediction signal
308
//
309
// Signal the uni-directional compound reference frame pair as
310
// either (LAST, LAST3) or (LAST, GOLDEN),
311
// conditioning on the pair is known as one of the above two.
312
//
313
// 3 contexts: Voting is used to compare the count of LAST3_FRAME with the
314
//             total count of GOLDEN_FRAME from the spatial neighbors.
315
0
int av1_get_pred_context_uni_comp_ref_p2(const MACROBLOCKD *xd) {
316
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
317
318
  // Count of LAST3
319
0
  const int last3_count = ref_counts[LAST3_FRAME];
320
  // Count of GOLDEN
321
0
  const int gld_count = ref_counts[GOLDEN_FRAME];
322
323
0
  const int pred_context =
324
0
      (last3_count == gld_count) ? 1 : ((last3_count < gld_count) ? 0 : 2);
325
326
0
  assert(pred_context >= 0 && pred_context < UNI_COMP_REF_CONTEXTS);
327
0
  return pred_context;
328
0
}
329
330
// == Common context functions for both comp and single ref ==
331
//
332
// Obtain contexts to signal a reference frame to be either LAST/LAST2 or
333
// LAST3/GOLDEN.
334
0
static int get_pred_context_ll2_or_l3gld(const MACROBLOCKD *xd) {
335
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
336
337
  // Count of LAST + LAST2
338
0
  const int last_last2_count = ref_counts[LAST_FRAME] + ref_counts[LAST2_FRAME];
339
  // Count of LAST3 + GOLDEN
340
0
  const int last3_gld_count =
341
0
      ref_counts[LAST3_FRAME] + ref_counts[GOLDEN_FRAME];
342
343
0
  const int pred_context = (last_last2_count == last3_gld_count)
344
0
                               ? 1
345
0
                               : ((last_last2_count < last3_gld_count) ? 0 : 2);
346
347
0
  assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
348
0
  return pred_context;
349
0
}
350
351
// Obtain contexts to signal a reference frame to be either LAST or LAST2.
352
0
static int get_pred_context_last_or_last2(const MACROBLOCKD *xd) {
353
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
354
355
  // Count of LAST
356
0
  const int last_count = ref_counts[LAST_FRAME];
357
  // Count of LAST2
358
0
  const int last2_count = ref_counts[LAST2_FRAME];
359
360
0
  const int pred_context =
361
0
      (last_count == last2_count) ? 1 : ((last_count < last2_count) ? 0 : 2);
362
363
0
  assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
364
0
  return pred_context;
365
0
}
366
367
// Obtain contexts to signal a reference frame to be either LAST3 or GOLDEN.
368
0
static int get_pred_context_last3_or_gld(const MACROBLOCKD *xd) {
369
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
370
371
  // Count of LAST3
372
0
  const int last3_count = ref_counts[LAST3_FRAME];
373
  // Count of GOLDEN
374
0
  const int gld_count = ref_counts[GOLDEN_FRAME];
375
376
0
  const int pred_context =
377
0
      (last3_count == gld_count) ? 1 : ((last3_count < gld_count) ? 0 : 2);
378
379
0
  assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
380
0
  return pred_context;
381
0
}
382
383
// Obtain contexts to signal a reference frame be either BWDREF/ALTREF2, or
384
// ALTREF.
385
0
static int get_pred_context_brfarf2_or_arf(const MACROBLOCKD *xd) {
386
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
387
388
  // Counts of BWDREF, ALTREF2, or ALTREF frames (B, A2, or A)
389
0
  const int brfarf2_count =
390
0
      ref_counts[BWDREF_FRAME] + ref_counts[ALTREF2_FRAME];
391
0
  const int arf_count = ref_counts[ALTREF_FRAME];
392
393
0
  const int pred_context =
394
0
      (brfarf2_count == arf_count) ? 1 : ((brfarf2_count < arf_count) ? 0 : 2);
395
396
0
  assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
397
0
  return pred_context;
398
0
}
399
400
// Obtain contexts to signal a reference frame be either BWDREF or ALTREF2.
401
0
static int get_pred_context_brf_or_arf2(const MACROBLOCKD *xd) {
402
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
403
404
  // Count of BWDREF frames (B)
405
0
  const int brf_count = ref_counts[BWDREF_FRAME];
406
  // Count of ALTREF2 frames (A2)
407
0
  const int arf2_count = ref_counts[ALTREF2_FRAME];
408
409
0
  const int pred_context =
410
0
      (brf_count == arf2_count) ? 1 : ((brf_count < arf2_count) ? 0 : 2);
411
412
0
  assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
413
0
  return pred_context;
414
0
}
415
416
// == Context functions for comp ref ==
417
//
418
// Returns a context number for the given MB prediction signal
419
// Signal the first reference frame for a compound mode be either
420
// GOLDEN/LAST3, or LAST/LAST2.
421
0
int av1_get_pred_context_comp_ref_p(const MACROBLOCKD *xd) {
422
0
  return get_pred_context_ll2_or_l3gld(xd);
423
0
}
424
425
// Returns a context number for the given MB prediction signal
426
// Signal the first reference frame for a compound mode be LAST,
427
// conditioning on that it is known either LAST/LAST2.
428
0
int av1_get_pred_context_comp_ref_p1(const MACROBLOCKD *xd) {
429
0
  return get_pred_context_last_or_last2(xd);
430
0
}
431
432
// Returns a context number for the given MB prediction signal
433
// Signal the first reference frame for a compound mode be GOLDEN,
434
// conditioning on that it is known either GOLDEN or LAST3.
435
0
int av1_get_pred_context_comp_ref_p2(const MACROBLOCKD *xd) {
436
0
  return get_pred_context_last3_or_gld(xd);
437
0
}
438
439
// Signal the 2nd reference frame for a compound mode be either
440
// ALTREF, or ALTREF2/BWDREF.
441
0
int av1_get_pred_context_comp_bwdref_p(const MACROBLOCKD *xd) {
442
0
  return get_pred_context_brfarf2_or_arf(xd);
443
0
}
444
445
// Signal the 2nd reference frame for a compound mode be either
446
// ALTREF2 or BWDREF.
447
0
int av1_get_pred_context_comp_bwdref_p1(const MACROBLOCKD *xd) {
448
0
  return get_pred_context_brf_or_arf2(xd);
449
0
}
450
451
// == Context functions for single ref ==
452
//
453
// For the bit to signal whether the single reference is a forward reference
454
// frame or a backward reference frame.
455
0
int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
456
0
  const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0];
457
458
  // Count of forward reference frames
459
0
  const int fwd_count = ref_counts[LAST_FRAME] + ref_counts[LAST2_FRAME] +
460
0
                        ref_counts[LAST3_FRAME] + ref_counts[GOLDEN_FRAME];
461
  // Count of backward reference frames
462
0
  const int bwd_count = ref_counts[BWDREF_FRAME] + ref_counts[ALTREF2_FRAME] +
463
0
                        ref_counts[ALTREF_FRAME];
464
465
0
  const int pred_context =
466
0
      (fwd_count == bwd_count) ? 1 : ((fwd_count < bwd_count) ? 0 : 2);
467
468
0
  assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
469
0
  return pred_context;
470
0
}
471
472
// For the bit to signal whether the single reference is ALTREF_FRAME or
473
// non-ALTREF backward reference frame, knowing that it shall be either of
474
// these 2 choices.
475
0
int av1_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
476
0
  return get_pred_context_brfarf2_or_arf(xd);
477
0
}
478
479
// For the bit to signal whether the single reference is LAST3/GOLDEN or
480
// LAST2/LAST, knowing that it shall be either of these 2 choices.
481
0
int av1_get_pred_context_single_ref_p3(const MACROBLOCKD *xd) {
482
0
  return get_pred_context_ll2_or_l3gld(xd);
483
0
}
484
485
// For the bit to signal whether the single reference is LAST2_FRAME or
486
// LAST_FRAME, knowing that it shall be either of these 2 choices.
487
0
int av1_get_pred_context_single_ref_p4(const MACROBLOCKD *xd) {
488
0
  return get_pred_context_last_or_last2(xd);
489
0
}
490
491
// For the bit to signal whether the single reference is GOLDEN_FRAME or
492
// LAST3_FRAME, knowing that it shall be either of these 2 choices.
493
0
int av1_get_pred_context_single_ref_p5(const MACROBLOCKD *xd) {
494
0
  return get_pred_context_last3_or_gld(xd);
495
0
}
496
497
// For the bit to signal whether the single reference is ALTREF2_FRAME or
498
// BWDREF_FRAME, knowing that it shall be either of these 2 choices.
499
0
int av1_get_pred_context_single_ref_p6(const MACROBLOCKD *xd) {
500
0
  return get_pred_context_brf_or_arf2(xd);
501
0
}