Coverage Report

Created: 2025-08-03 06:57

/src/libvpx/vp9/common/vp9_entropymv.h
Line
Count
Source
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
 *  that can be found in the LICENSE file in the root of the source
6
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
9
 */
10
11
#ifndef VPX_VP9_COMMON_VP9_ENTROPYMV_H_
12
#define VPX_VP9_COMMON_VP9_ENTROPYMV_H_
13
14
#include "./vpx_config.h"
15
16
#include "vpx_dsp/prob.h"
17
18
#include "vp9/common/vp9_mv.h"
19
20
#ifdef __cplusplus
21
extern "C" {
22
#endif
23
24
struct VP9Common;
25
26
void vp9_init_mv_probs(struct VP9Common *cm);
27
28
void vp9_adapt_mv_probs(struct VP9Common *cm, int allow_hp);
29
30
12.2M
static INLINE int use_mv_hp(const MV *ref) {
31
12.2M
  const int kMvRefThresh = 64;  // threshold for use of high-precision 1/8 mv
32
12.2M
  return abs(ref->row) < kMvRefThresh && abs(ref->col) < kMvRefThresh;
33
12.2M
}
Unexecuted instantiation: vp9_dx_iface.c:use_mv_hp
Unexecuted instantiation: vp9_decodeframe.c:use_mv_hp
Unexecuted instantiation: vp9_detokenize.c:use_mv_hp
Unexecuted instantiation: vp9_decoder.c:use_mv_hp
Unexecuted instantiation: yv12config.c:use_mv_hp
Unexecuted instantiation: vp9_alloccommon.c:use_mv_hp
Unexecuted instantiation: vp9_blockd.c:use_mv_hp
Unexecuted instantiation: vp9_entropy.c:use_mv_hp
Unexecuted instantiation: vp9_entropymode.c:use_mv_hp
Unexecuted instantiation: vp9_entropymv.c:use_mv_hp
Unexecuted instantiation: vp9_idct.c:use_mv_hp
Unexecuted instantiation: vp9_pred_common.c:use_mv_hp
Unexecuted instantiation: vp9_seg_common.c:use_mv_hp
Unexecuted instantiation: vp9_tile_common.c:use_mv_hp
Unexecuted instantiation: vp9_loopfilter.c:use_mv_hp
Unexecuted instantiation: vp9_thread_common.c:use_mv_hp
Unexecuted instantiation: vp9_reconinter.c:use_mv_hp
Unexecuted instantiation: vp9_reconintra.c:use_mv_hp
Unexecuted instantiation: vp9_scan.c:use_mv_hp
vp9_decodemv.c:use_mv_hp
Line
Count
Source
30
12.2M
static INLINE int use_mv_hp(const MV *ref) {
31
12.2M
  const int kMvRefThresh = 64;  // threshold for use of high-precision 1/8 mv
32
12.2M
  return abs(ref->row) < kMvRefThresh && abs(ref->col) < kMvRefThresh;
33
12.2M
}
34
35
4.20M
#define MV_UPDATE_PROB 252
36
37
/* Symbols for coding which components are zero jointly */
38
204k
#define MV_JOINTS 4
39
typedef enum {
40
  MV_JOINT_ZERO = 0,   /* Zero vector */
41
  MV_JOINT_HNZVZ = 1,  /* Vert zero, hor nonzero */
42
  MV_JOINT_HZVNZ = 2,  /* Hor zero, vert nonzero */
43
  MV_JOINT_HNZVNZ = 3, /* Both components nonzero */
44
} MV_JOINT_TYPE;
45
46
11.0M
static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
47
11.0M
  return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
48
11.0M
}
Unexecuted instantiation: vp9_dx_iface.c:mv_joint_vertical
Unexecuted instantiation: vp9_decodeframe.c:mv_joint_vertical
Unexecuted instantiation: vp9_detokenize.c:mv_joint_vertical
Unexecuted instantiation: vp9_decoder.c:mv_joint_vertical
Unexecuted instantiation: yv12config.c:mv_joint_vertical
Unexecuted instantiation: vp9_alloccommon.c:mv_joint_vertical
Unexecuted instantiation: vp9_blockd.c:mv_joint_vertical
Unexecuted instantiation: vp9_entropy.c:mv_joint_vertical
Unexecuted instantiation: vp9_entropymode.c:mv_joint_vertical
vp9_entropymv.c:mv_joint_vertical
Line
Count
Source
46
5.40M
static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
47
5.40M
  return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
48
5.40M
}
Unexecuted instantiation: vp9_idct.c:mv_joint_vertical
Unexecuted instantiation: vp9_pred_common.c:mv_joint_vertical
Unexecuted instantiation: vp9_seg_common.c:mv_joint_vertical
Unexecuted instantiation: vp9_tile_common.c:mv_joint_vertical
Unexecuted instantiation: vp9_loopfilter.c:mv_joint_vertical
Unexecuted instantiation: vp9_thread_common.c:mv_joint_vertical
Unexecuted instantiation: vp9_reconinter.c:mv_joint_vertical
Unexecuted instantiation: vp9_reconintra.c:mv_joint_vertical
Unexecuted instantiation: vp9_scan.c:mv_joint_vertical
vp9_decodemv.c:mv_joint_vertical
Line
Count
Source
46
5.62M
static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
47
5.62M
  return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
48
5.62M
}
49
50
11.0M
static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
51
11.0M
  return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
52
11.0M
}
Unexecuted instantiation: vp9_dx_iface.c:mv_joint_horizontal
Unexecuted instantiation: vp9_decodeframe.c:mv_joint_horizontal
Unexecuted instantiation: vp9_detokenize.c:mv_joint_horizontal
Unexecuted instantiation: vp9_decoder.c:mv_joint_horizontal
Unexecuted instantiation: yv12config.c:mv_joint_horizontal
Unexecuted instantiation: vp9_alloccommon.c:mv_joint_horizontal
Unexecuted instantiation: vp9_blockd.c:mv_joint_horizontal
Unexecuted instantiation: vp9_entropy.c:mv_joint_horizontal
Unexecuted instantiation: vp9_entropymode.c:mv_joint_horizontal
vp9_entropymv.c:mv_joint_horizontal
Line
Count
Source
50
5.40M
static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
51
5.40M
  return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
52
5.40M
}
Unexecuted instantiation: vp9_idct.c:mv_joint_horizontal
Unexecuted instantiation: vp9_pred_common.c:mv_joint_horizontal
Unexecuted instantiation: vp9_seg_common.c:mv_joint_horizontal
Unexecuted instantiation: vp9_tile_common.c:mv_joint_horizontal
Unexecuted instantiation: vp9_loopfilter.c:mv_joint_horizontal
Unexecuted instantiation: vp9_thread_common.c:mv_joint_horizontal
Unexecuted instantiation: vp9_reconinter.c:mv_joint_horizontal
Unexecuted instantiation: vp9_reconintra.c:mv_joint_horizontal
Unexecuted instantiation: vp9_scan.c:mv_joint_horizontal
vp9_decodemv.c:mv_joint_horizontal
Line
Count
Source
50
5.62M
static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
51
5.62M
  return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
52
5.62M
}
53
54
/* Symbols for coding magnitude class of nonzero components */
55
2.27M
#define MV_CLASSES 11
56
typedef enum {
57
  MV_CLASS_0 = 0,   /* (0, 2]     integer pel */
58
  MV_CLASS_1 = 1,   /* (2, 4]     integer pel */
59
  MV_CLASS_2 = 2,   /* (4, 8]     integer pel */
60
  MV_CLASS_3 = 3,   /* (8, 16]    integer pel */
61
  MV_CLASS_4 = 4,   /* (16, 32]   integer pel */
62
  MV_CLASS_5 = 5,   /* (32, 64]   integer pel */
63
  MV_CLASS_6 = 6,   /* (64, 128]  integer pel */
64
  MV_CLASS_7 = 7,   /* (128, 256] integer pel */
65
  MV_CLASS_8 = 8,   /* (256, 512] integer pel */
66
  MV_CLASS_9 = 9,   /* (512, 1024] integer pel */
67
  MV_CLASS_10 = 10, /* (1024,2048] integer pel */
68
} MV_CLASS_TYPE;
69
70
20.5M
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
71
13.2M
#define CLASS0_SIZE (1 << CLASS0_BITS)
72
1.47M
#define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
73
1.10M
#define MV_FP_SIZE 4
74
75
#define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2)
76
#define MV_MAX ((1 << MV_MAX_BITS) - 1)
77
#define MV_VALS ((MV_MAX << 1) + 1)
78
79
22.4M
#define MV_IN_USE_BITS 14
80
16.8M
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
81
22.4M
#define MV_LOW (-(1 << MV_IN_USE_BITS))
82
83
extern const vpx_tree_index vp9_mv_joint_tree[];
84
extern const vpx_tree_index vp9_mv_class_tree[];
85
extern const vpx_tree_index vp9_mv_class0_tree[];
86
extern const vpx_tree_index vp9_mv_fp_tree[];
87
88
typedef struct {
89
  vpx_prob sign;
90
  vpx_prob classes[MV_CLASSES - 1];
91
  vpx_prob class0[CLASS0_SIZE - 1];
92
  vpx_prob bits[MV_OFFSET_BITS];
93
  vpx_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
94
  vpx_prob fp[MV_FP_SIZE - 1];
95
  vpx_prob class0_hp;
96
  vpx_prob hp;
97
} nmv_component;
98
99
typedef struct {
100
  vpx_prob joints[MV_JOINTS - 1];
101
  nmv_component comps[2];
102
} nmv_context;
103
104
5.40M
static INLINE MV_JOINT_TYPE vp9_get_mv_joint(const MV *mv) {
105
5.40M
  if (mv->row == 0) {
106
1.32M
    return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ;
107
4.07M
  } else {
108
4.07M
    return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ;
109
4.07M
  }
110
5.40M
}
Unexecuted instantiation: vp9_dx_iface.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_decodeframe.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_detokenize.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_decoder.c:vp9_get_mv_joint
Unexecuted instantiation: yv12config.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_alloccommon.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_blockd.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_entropy.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_entropymode.c:vp9_get_mv_joint
vp9_entropymv.c:vp9_get_mv_joint
Line
Count
Source
104
5.40M
static INLINE MV_JOINT_TYPE vp9_get_mv_joint(const MV *mv) {
105
5.40M
  if (mv->row == 0) {
106
1.32M
    return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ;
107
4.07M
  } else {
108
4.07M
    return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ;
109
4.07M
  }
110
5.40M
}
Unexecuted instantiation: vp9_idct.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_pred_common.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_seg_common.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_tile_common.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_loopfilter.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_thread_common.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_reconinter.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_reconintra.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_scan.c:vp9_get_mv_joint
Unexecuted instantiation: vp9_decodemv.c:vp9_get_mv_joint
111
112
MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset);
113
114
typedef struct {
115
  unsigned int sign[2];
116
  unsigned int classes[MV_CLASSES];
117
  unsigned int class0[CLASS0_SIZE];
118
  unsigned int bits[MV_OFFSET_BITS][2];
119
  unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
120
  unsigned int fp[MV_FP_SIZE];
121
  unsigned int class0_hp[2];
122
  unsigned int hp[2];
123
} nmv_component_counts;
124
125
typedef struct {
126
  unsigned int joints[MV_JOINTS];
127
  nmv_component_counts comps[2];
128
} nmv_context_counts;
129
130
void vp9_inc_mv(const MV *mv, nmv_context_counts *counts);
131
132
#ifdef __cplusplus
133
}  // extern "C"
134
#endif
135
136
#endif  // VPX_VP9_COMMON_VP9_ENTROPYMV_H_