Coverage Report

Created: 2026-08-13 06:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libavif/ext/aom/av1/encoder/mv_prec.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2019, 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_ENCODER_MV_PREC_H_
13
#define AOM_AV1_ENCODER_MV_PREC_H_
14
15
#include "av1/encoder/encoder.h"
16
#include "av1/encoder/speed_features.h"
17
18
// Q threshold for high precision mv.
19
28.2k
#define HIGH_PRECISION_MV_QTHRESH 128
20
#if !CONFIG_REALTIME_ONLY
21
void av1_collect_mv_stats(AV1_COMP *cpi, int current_q);
22
23
0
static inline int av1_frame_allows_smart_mv(const AV1_COMP *cpi) {
24
0
  const int gf_group_index = cpi->gf_frame_index;
25
0
  const int gf_update_type = cpi->ppi->gf_group.update_type[gf_group_index];
26
0
  return !frame_is_intra_only(&cpi->common) &&
27
0
         !(gf_update_type == INTNL_OVERLAY_UPDATE ||
28
0
           gf_update_type == OVERLAY_UPDATE);
29
0
}
Unexecuted instantiation: encoder.c:av1_frame_allows_smart_mv
Unexecuted instantiation: encoder_utils.c:av1_frame_allows_smart_mv
Unexecuted instantiation: mv_prec.c:av1_frame_allows_smart_mv
30
#endif  // !CONFIG_REALTIME_ONLY
31
32
static inline void av1_set_high_precision_mv(AV1_COMP *cpi,
33
                                             int allow_high_precision_mv,
34
1.07M
                                             int cur_frame_force_integer_mv) {
35
1.07M
  MvCosts *const mv_costs = cpi->td.mb.mv_costs;
36
  // Avoid accessing 'mv_costs' when it is not allocated.
37
1.07M
  if (mv_costs == NULL) return;
38
39
358k
  const int copy_hp = cpi->common.features.allow_high_precision_mv =
40
358k
      allow_high_precision_mv && !cur_frame_force_integer_mv;
41
42
358k
  mv_costs->nmv_cost[0] = &mv_costs->nmv_cost_alloc[0][MV_MAX];
43
358k
  mv_costs->nmv_cost[1] = &mv_costs->nmv_cost_alloc[1][MV_MAX];
44
358k
  mv_costs->nmv_cost_hp[0] = &mv_costs->nmv_cost_hp_alloc[0][MV_MAX];
45
358k
  mv_costs->nmv_cost_hp[1] = &mv_costs->nmv_cost_hp_alloc[1][MV_MAX];
46
358k
  mv_costs->mv_cost_stack =
47
358k
      copy_hp ? mv_costs->nmv_cost_hp : mv_costs->nmv_cost;
48
358k
}
encoder.c:av1_set_high_precision_mv
Line
Count
Source
34
1.04M
                                             int cur_frame_force_integer_mv) {
35
1.04M
  MvCosts *const mv_costs = cpi->td.mb.mv_costs;
36
  // Avoid accessing 'mv_costs' when it is not allocated.
37
1.04M
  if (mv_costs == NULL) return;
38
39
329k
  const int copy_hp = cpi->common.features.allow_high_precision_mv =
40
329k
      allow_high_precision_mv && !cur_frame_force_integer_mv;
41
42
329k
  mv_costs->nmv_cost[0] = &mv_costs->nmv_cost_alloc[0][MV_MAX];
43
329k
  mv_costs->nmv_cost[1] = &mv_costs->nmv_cost_alloc[1][MV_MAX];
44
329k
  mv_costs->nmv_cost_hp[0] = &mv_costs->nmv_cost_hp_alloc[0][MV_MAX];
45
329k
  mv_costs->nmv_cost_hp[1] = &mv_costs->nmv_cost_hp_alloc[1][MV_MAX];
46
329k
  mv_costs->mv_cost_stack =
47
329k
      copy_hp ? mv_costs->nmv_cost_hp : mv_costs->nmv_cost;
48
329k
}
Unexecuted instantiation: encoder_utils.c:av1_set_high_precision_mv
mv_prec.c:av1_set_high_precision_mv
Line
Count
Source
34
28.2k
                                             int cur_frame_force_integer_mv) {
35
28.2k
  MvCosts *const mv_costs = cpi->td.mb.mv_costs;
36
  // Avoid accessing 'mv_costs' when it is not allocated.
37
28.2k
  if (mv_costs == NULL) return;
38
39
28.2k
  const int copy_hp = cpi->common.features.allow_high_precision_mv =
40
28.2k
      allow_high_precision_mv && !cur_frame_force_integer_mv;
41
42
28.2k
  mv_costs->nmv_cost[0] = &mv_costs->nmv_cost_alloc[0][MV_MAX];
43
28.2k
  mv_costs->nmv_cost[1] = &mv_costs->nmv_cost_alloc[1][MV_MAX];
44
28.2k
  mv_costs->nmv_cost_hp[0] = &mv_costs->nmv_cost_hp_alloc[0][MV_MAX];
45
28.2k
  mv_costs->nmv_cost_hp[1] = &mv_costs->nmv_cost_hp_alloc[1][MV_MAX];
46
28.2k
  mv_costs->mv_cost_stack =
47
28.2k
      copy_hp ? mv_costs->nmv_cost_hp : mv_costs->nmv_cost;
48
28.2k
}
49
50
void av1_pick_and_set_high_precision_mv(AV1_COMP *cpi, int qindex);
51
52
#endif  // AOM_AV1_ENCODER_MV_PREC_H_