Coverage Report

Created: 2026-01-17 06:24

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvpx/vp8/encoder/rdopt.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_VP8_ENCODER_RDOPT_H_
12
#define VPX_VP8_ENCODER_RDOPT_H_
13
14
#include "./vpx_config.h"
15
16
#ifdef __cplusplus
17
extern "C" {
18
#endif
19
20
1.32G
#define RDCOST(RM, DM, R, D) (((128 + (R) * (RM)) >> 8) + (DM) * (D))
21
22
void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex);
23
void vp8_auto_select_speed(VP8_COMP *cpi);
24
25
3.45M
static INLINE void insertsortmv(int arr[], int len) {
26
3.45M
  int i, j, k;
27
28
24.4M
  for (i = 1; i <= len - 1; ++i) {
29
101M
    for (j = 0; j < i; ++j) {
30
80.7M
      if (arr[j] > arr[i]) {
31
5.18M
        int temp;
32
33
5.18M
        temp = arr[i];
34
35
16.7M
        for (k = i; k > j; k--) arr[k] = arr[k - 1];
36
37
5.18M
        arr[j] = temp;
38
5.18M
      }
39
80.7M
    }
40
20.9M
  }
41
3.45M
}
Unexecuted instantiation: pickinter.c:insertsortmv
rdopt.c:insertsortmv
Line
Count
Source
25
3.45M
static INLINE void insertsortmv(int arr[], int len) {
26
3.45M
  int i, j, k;
27
28
24.4M
  for (i = 1; i <= len - 1; ++i) {
29
101M
    for (j = 0; j < i; ++j) {
30
80.7M
      if (arr[j] > arr[i]) {
31
5.18M
        int temp;
32
33
5.18M
        temp = arr[i];
34
35
16.7M
        for (k = i; k > j; k--) arr[k] = arr[k - 1];
36
37
5.18M
        arr[j] = temp;
38
5.18M
      }
39
80.7M
    }
40
20.9M
  }
41
3.45M
}
Unexecuted instantiation: encodeframe.c:insertsortmv
Unexecuted instantiation: encodemb.c:insertsortmv
Unexecuted instantiation: firstpass.c:insertsortmv
42
43
2.66M
static INLINE void insertsortsad(int arr[], int idx[], int len) {
44
2.66M
  int i, j, k;
45
46
18.3M
  for (i = 1; i <= len - 1; ++i) {
47
75.4M
    for (j = 0; j < i; ++j) {
48
59.7M
      if (arr[j] > arr[i]) {
49
9.21M
        int temp, tempi;
50
51
9.21M
        temp = arr[i];
52
9.21M
        tempi = idx[i];
53
54
34.5M
        for (k = i; k > j; k--) {
55
25.3M
          arr[k] = arr[k - 1];
56
25.3M
          idx[k] = idx[k - 1];
57
25.3M
        }
58
59
9.21M
        arr[j] = temp;
60
9.21M
        idx[j] = tempi;
61
9.21M
      }
62
59.7M
    }
63
15.6M
  }
64
2.66M
}
Unexecuted instantiation: pickinter.c:insertsortsad
rdopt.c:insertsortsad
Line
Count
Source
43
2.66M
static INLINE void insertsortsad(int arr[], int idx[], int len) {
44
2.66M
  int i, j, k;
45
46
18.3M
  for (i = 1; i <= len - 1; ++i) {
47
75.4M
    for (j = 0; j < i; ++j) {
48
59.7M
      if (arr[j] > arr[i]) {
49
9.21M
        int temp, tempi;
50
51
9.21M
        temp = arr[i];
52
9.21M
        tempi = idx[i];
53
54
34.5M
        for (k = i; k > j; k--) {
55
25.3M
          arr[k] = arr[k - 1];
56
25.3M
          idx[k] = idx[k - 1];
57
25.3M
        }
58
59
9.21M
        arr[j] = temp;
60
9.21M
        idx[j] = tempi;
61
9.21M
      }
62
59.7M
    }
63
15.6M
  }
64
2.66M
}
Unexecuted instantiation: encodeframe.c:insertsortsad
Unexecuted instantiation: encodemb.c:insertsortsad
Unexecuted instantiation: firstpass.c:insertsortsad
65
66
void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue);
67
void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
68
                            int recon_uvoffset, int *returnrate,
69
                            int *returndistortion, int *returnintra, int mb_row,
70
                            int mb_col);
71
void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate);
72
73
static INLINE void get_plane_pointers(const YV12_BUFFER_CONFIG *fb,
74
                                      unsigned char *plane[3],
75
                                      unsigned int recon_yoffset,
76
6.03M
                                      unsigned int recon_uvoffset) {
77
6.03M
  plane[0] = fb->y_buffer + recon_yoffset;
78
6.03M
  plane[1] = fb->u_buffer + recon_uvoffset;
79
6.03M
  plane[2] = fb->v_buffer + recon_uvoffset;
80
6.03M
}
pickinter.c:get_plane_pointers
Line
Count
Source
76
2.28M
                                      unsigned int recon_uvoffset) {
77
2.28M
  plane[0] = fb->y_buffer + recon_yoffset;
78
2.28M
  plane[1] = fb->u_buffer + recon_uvoffset;
79
2.28M
  plane[2] = fb->v_buffer + recon_uvoffset;
80
2.28M
}
rdopt.c:get_plane_pointers
Line
Count
Source
76
3.74M
                                      unsigned int recon_uvoffset) {
77
3.74M
  plane[0] = fb->y_buffer + recon_yoffset;
78
3.74M
  plane[1] = fb->u_buffer + recon_uvoffset;
79
3.74M
  plane[2] = fb->v_buffer + recon_uvoffset;
80
3.74M
}
Unexecuted instantiation: encodeframe.c:get_plane_pointers
Unexecuted instantiation: encodemb.c:get_plane_pointers
Unexecuted instantiation: firstpass.c:get_plane_pointers
81
82
static INLINE void get_predictor_pointers(const VP8_COMP *cpi,
83
                                          unsigned char *plane[4][3],
84
                                          unsigned int recon_yoffset,
85
3.40M
                                          unsigned int recon_uvoffset) {
86
3.40M
  if (cpi->ref_frame_flags & VP8_LAST_FRAME) {
87
3.40M
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx],
88
3.40M
                       plane[LAST_FRAME], recon_yoffset, recon_uvoffset);
89
3.40M
  }
90
91
3.40M
  if (cpi->ref_frame_flags & VP8_GOLD_FRAME) {
92
2.63M
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx],
93
2.63M
                       plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset);
94
2.63M
  }
95
96
3.40M
  if (cpi->ref_frame_flags & VP8_ALTR_FRAME) {
97
0
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx],
98
0
                       plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset);
99
0
  }
100
3.40M
}
pickinter.c:get_predictor_pointers
Line
Count
Source
85
1.18M
                                          unsigned int recon_uvoffset) {
86
1.18M
  if (cpi->ref_frame_flags & VP8_LAST_FRAME) {
87
1.18M
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx],
88
1.18M
                       plane[LAST_FRAME], recon_yoffset, recon_uvoffset);
89
1.18M
  }
90
91
1.18M
  if (cpi->ref_frame_flags & VP8_GOLD_FRAME) {
92
1.10M
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx],
93
1.10M
                       plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset);
94
1.10M
  }
95
96
1.18M
  if (cpi->ref_frame_flags & VP8_ALTR_FRAME) {
97
0
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx],
98
0
                       plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset);
99
0
  }
100
1.18M
}
rdopt.c:get_predictor_pointers
Line
Count
Source
85
2.21M
                                          unsigned int recon_uvoffset) {
86
2.21M
  if (cpi->ref_frame_flags & VP8_LAST_FRAME) {
87
2.21M
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx],
88
2.21M
                       plane[LAST_FRAME], recon_yoffset, recon_uvoffset);
89
2.21M
  }
90
91
2.21M
  if (cpi->ref_frame_flags & VP8_GOLD_FRAME) {
92
1.53M
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx],
93
1.53M
                       plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset);
94
1.53M
  }
95
96
2.21M
  if (cpi->ref_frame_flags & VP8_ALTR_FRAME) {
97
0
    get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx],
98
0
                       plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset);
99
0
  }
100
2.21M
}
Unexecuted instantiation: encodeframe.c:get_predictor_pointers
Unexecuted instantiation: encodemb.c:get_predictor_pointers
Unexecuted instantiation: firstpass.c:get_predictor_pointers
101
102
static INLINE void get_reference_search_order(const VP8_COMP *cpi,
103
3.40M
                                              int ref_frame_map[4]) {
104
3.40M
  int i = 0;
105
106
3.40M
  ref_frame_map[i++] = INTRA_FRAME;
107
3.40M
  if (cpi->ref_frame_flags & VP8_LAST_FRAME) ref_frame_map[i++] = LAST_FRAME;
108
3.40M
  if (cpi->ref_frame_flags & VP8_GOLD_FRAME) ref_frame_map[i++] = GOLDEN_FRAME;
109
3.40M
  if (cpi->ref_frame_flags & VP8_ALTR_FRAME) ref_frame_map[i++] = ALTREF_FRAME;
110
7.56M
  for (; i < 4; ++i) ref_frame_map[i] = -1;
111
3.40M
}
pickinter.c:get_reference_search_order
Line
Count
Source
103
1.18M
                                              int ref_frame_map[4]) {
104
1.18M
  int i = 0;
105
106
1.18M
  ref_frame_map[i++] = INTRA_FRAME;
107
1.18M
  if (cpi->ref_frame_flags & VP8_LAST_FRAME) ref_frame_map[i++] = LAST_FRAME;
108
1.18M
  if (cpi->ref_frame_flags & VP8_GOLD_FRAME) ref_frame_map[i++] = GOLDEN_FRAME;
109
1.18M
  if (cpi->ref_frame_flags & VP8_ALTR_FRAME) ref_frame_map[i++] = ALTREF_FRAME;
110
2.46M
  for (; i < 4; ++i) ref_frame_map[i] = -1;
111
1.18M
}
rdopt.c:get_reference_search_order
Line
Count
Source
103
2.21M
                                              int ref_frame_map[4]) {
104
2.21M
  int i = 0;
105
106
2.21M
  ref_frame_map[i++] = INTRA_FRAME;
107
2.21M
  if (cpi->ref_frame_flags & VP8_LAST_FRAME) ref_frame_map[i++] = LAST_FRAME;
108
2.21M
  if (cpi->ref_frame_flags & VP8_GOLD_FRAME) ref_frame_map[i++] = GOLDEN_FRAME;
109
2.21M
  if (cpi->ref_frame_flags & VP8_ALTR_FRAME) ref_frame_map[i++] = ALTREF_FRAME;
110
5.10M
  for (; i < 4; ++i) ref_frame_map[i] = -1;
111
2.21M
}
Unexecuted instantiation: encodeframe.c:get_reference_search_order
Unexecuted instantiation: encodemb.c:get_reference_search_order
Unexecuted instantiation: firstpass.c:get_reference_search_order
112
113
void vp8_mv_pred(VP8_COMP *cpi, MACROBLOCKD *xd, const MODE_INFO *here,
114
                 int_mv *mvp, int refframe, int *ref_frame_sign_bias, int *sr,
115
                 int near_sadidx[]);
116
void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x,
117
                 int recon_yoffset, int near_sadidx[]);
118
int VP8_UVSSE(MACROBLOCK *x);
119
int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]);
120
void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv);
121
122
#ifdef __cplusplus
123
}  // extern "C"
124
#endif
125
126
#endif  // VPX_VP8_ENCODER_RDOPT_H_