Coverage Report

Created: 2025-11-16 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvpx/vpx_dsp/inv_txfm.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_VPX_DSP_INV_TXFM_H_
12
#define VPX_VPX_DSP_INV_TXFM_H_
13
14
#include <assert.h>
15
16
#include "./vpx_config.h"
17
#include "vpx_dsp/txfm_common.h"
18
#include "vpx_ports/mem.h"
19
20
#ifdef __cplusplus
21
extern "C" {
22
#endif
23
24
43.7M
static INLINE tran_high_t check_range(tran_high_t input) {
25
#if CONFIG_COEFFICIENT_RANGE_CHECKING
26
  // For valid VP9 input streams, intermediate stage coefficients should always
27
  // stay within the range of a signed 16 bit integer. Coefficients can go out
28
  // of this range for invalid/corrupt VP9 streams. However, strictly checking
29
  // this range for every intermediate coefficient can burdensome for a decoder,
30
  // therefore the following assertion is only enabled when configured with
31
  // --enable-coefficient-range-checking.
32
  assert(INT16_MIN <= input);
33
  assert(input <= INT16_MAX);
34
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
35
43.7M
  return input;
36
43.7M
}
Unexecuted instantiation: vp9_decodeframe.c:check_range
Unexecuted instantiation: vp9_idct.c:check_range
Unexecuted instantiation: vp9_idct_intrin_sse2.c:check_range
Unexecuted instantiation: vp9_highbd_iht4x4_add_sse4.c:check_range
Unexecuted instantiation: vp9_highbd_iht8x8_add_sse4.c:check_range
Unexecuted instantiation: vp9_highbd_iht16x16_add_sse4.c:check_range
Unexecuted instantiation: vp9_encoder.c:check_range
inv_txfm.c:check_range
Line
Count
Source
24
37.4M
static INLINE tran_high_t check_range(tran_high_t input) {
25
#if CONFIG_COEFFICIENT_RANGE_CHECKING
26
  // For valid VP9 input streams, intermediate stage coefficients should always
27
  // stay within the range of a signed 16 bit integer. Coefficients can go out
28
  // of this range for invalid/corrupt VP9 streams. However, strictly checking
29
  // this range for every intermediate coefficient can burdensome for a decoder,
30
  // therefore the following assertion is only enabled when configured with
31
  // --enable-coefficient-range-checking.
32
  assert(INT16_MIN <= input);
33
  assert(input <= INT16_MAX);
34
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
35
37.4M
  return input;
36
37.4M
}
inv_txfm_sse2.c:check_range
Line
Count
Source
24
6.33M
static INLINE tran_high_t check_range(tran_high_t input) {
25
#if CONFIG_COEFFICIENT_RANGE_CHECKING
26
  // For valid VP9 input streams, intermediate stage coefficients should always
27
  // stay within the range of a signed 16 bit integer. Coefficients can go out
28
  // of this range for invalid/corrupt VP9 streams. However, strictly checking
29
  // this range for every intermediate coefficient can burdensome for a decoder,
30
  // therefore the following assertion is only enabled when configured with
31
  // --enable-coefficient-range-checking.
32
  assert(INT16_MIN <= input);
33
  assert(input <= INT16_MAX);
34
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
35
6.33M
  return input;
36
6.33M
}
Unexecuted instantiation: inv_txfm_ssse3.c:check_range
Unexecuted instantiation: highbd_idct4x4_add_sse2.c:check_range
Unexecuted instantiation: highbd_idct8x8_add_sse2.c:check_range
Unexecuted instantiation: highbd_idct16x16_add_sse2.c:check_range
Unexecuted instantiation: highbd_idct32x32_add_sse2.c:check_range
Unexecuted instantiation: highbd_idct4x4_add_sse4.c:check_range
Unexecuted instantiation: highbd_idct8x8_add_sse4.c:check_range
Unexecuted instantiation: highbd_idct16x16_add_sse4.c:check_range
Unexecuted instantiation: highbd_idct32x32_add_sse4.c:check_range
Unexecuted instantiation: vp9_dct.c:check_range
Unexecuted instantiation: vp9_encodeframe.c:check_range
Unexecuted instantiation: vp9_encodemb.c:check_range
Unexecuted instantiation: vp9_rdopt.c:check_range
37
38
51.2M
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
51.2M
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
51.2M
  return (tran_high_t)rv;
41
51.2M
}
Unexecuted instantiation: vp9_decodeframe.c:dct_const_round_shift
Unexecuted instantiation: vp9_idct.c:dct_const_round_shift
Unexecuted instantiation: vp9_idct_intrin_sse2.c:dct_const_round_shift
Unexecuted instantiation: vp9_highbd_iht4x4_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: vp9_highbd_iht8x8_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: vp9_highbd_iht16x16_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: vp9_encoder.c:dct_const_round_shift
Unexecuted instantiation: inv_txfm.c:dct_const_round_shift
inv_txfm_sse2.c:dct_const_round_shift
Line
Count
Source
38
50.3M
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
50.3M
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
50.3M
  return (tran_high_t)rv;
41
50.3M
}
Unexecuted instantiation: inv_txfm_ssse3.c:dct_const_round_shift
highbd_idct4x4_add_sse2.c:dct_const_round_shift
Line
Count
Source
38
386k
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
386k
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
386k
  return (tran_high_t)rv;
41
386k
}
highbd_idct8x8_add_sse2.c:dct_const_round_shift
Line
Count
Source
38
119k
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
119k
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
119k
  return (tran_high_t)rv;
41
119k
}
highbd_idct16x16_add_sse2.c:dct_const_round_shift
Line
Count
Source
38
181k
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
181k
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
181k
  return (tran_high_t)rv;
41
181k
}
highbd_idct32x32_add_sse2.c:dct_const_round_shift
Line
Count
Source
38
181k
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
181k
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
181k
  return (tran_high_t)rv;
41
181k
}
Unexecuted instantiation: highbd_idct4x4_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct8x8_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct16x16_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct32x32_add_sse4.c:dct_const_round_shift
Unexecuted instantiation: vp9_dct.c:dct_const_round_shift
Unexecuted instantiation: vp9_encodeframe.c:dct_const_round_shift
Unexecuted instantiation: vp9_encodemb.c:dct_const_round_shift
Unexecuted instantiation: vp9_rdopt.c:dct_const_round_shift
42
43
#if CONFIG_VP9_HIGHBITDEPTH
44
15.1M
static INLINE tran_high_t highbd_check_range(tran_high_t input, int bd) {
45
#if CONFIG_COEFFICIENT_RANGE_CHECKING
46
  // For valid highbitdepth VP9 streams, intermediate stage coefficients will
47
  // stay within the ranges:
48
  // - 8 bit: signed 16 bit integer
49
  // - 10 bit: signed 18 bit integer
50
  // - 12 bit: signed 20 bit integer
51
  const int32_t int_max = (1 << (7 + bd)) - 1;
52
  const int32_t int_min = -int_max - 1;
53
  assert(int_min <= input);
54
  assert(input <= int_max);
55
  (void)int_min;
56
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
57
15.1M
  (void)bd;
58
15.1M
  return input;
59
15.1M
}
Unexecuted instantiation: vp9_decodeframe.c:highbd_check_range
Unexecuted instantiation: vp9_idct.c:highbd_check_range
Unexecuted instantiation: vp9_idct_intrin_sse2.c:highbd_check_range
Unexecuted instantiation: vp9_highbd_iht4x4_add_sse4.c:highbd_check_range
Unexecuted instantiation: vp9_highbd_iht8x8_add_sse4.c:highbd_check_range
Unexecuted instantiation: vp9_highbd_iht16x16_add_sse4.c:highbd_check_range
Unexecuted instantiation: vp9_encoder.c:highbd_check_range
inv_txfm.c:highbd_check_range
Line
Count
Source
44
14.2M
static INLINE tran_high_t highbd_check_range(tran_high_t input, int bd) {
45
#if CONFIG_COEFFICIENT_RANGE_CHECKING
46
  // For valid highbitdepth VP9 streams, intermediate stage coefficients will
47
  // stay within the ranges:
48
  // - 8 bit: signed 16 bit integer
49
  // - 10 bit: signed 18 bit integer
50
  // - 12 bit: signed 20 bit integer
51
  const int32_t int_max = (1 << (7 + bd)) - 1;
52
  const int32_t int_min = -int_max - 1;
53
  assert(int_min <= input);
54
  assert(input <= int_max);
55
  (void)int_min;
56
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
57
14.2M
  (void)bd;
58
14.2M
  return input;
59
14.2M
}
Unexecuted instantiation: inv_txfm_sse2.c:highbd_check_range
Unexecuted instantiation: inv_txfm_ssse3.c:highbd_check_range
highbd_idct4x4_add_sse2.c:highbd_check_range
Line
Count
Source
44
386k
static INLINE tran_high_t highbd_check_range(tran_high_t input, int bd) {
45
#if CONFIG_COEFFICIENT_RANGE_CHECKING
46
  // For valid highbitdepth VP9 streams, intermediate stage coefficients will
47
  // stay within the ranges:
48
  // - 8 bit: signed 16 bit integer
49
  // - 10 bit: signed 18 bit integer
50
  // - 12 bit: signed 20 bit integer
51
  const int32_t int_max = (1 << (7 + bd)) - 1;
52
  const int32_t int_min = -int_max - 1;
53
  assert(int_min <= input);
54
  assert(input <= int_max);
55
  (void)int_min;
56
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
57
386k
  (void)bd;
58
386k
  return input;
59
386k
}
highbd_idct8x8_add_sse2.c:highbd_check_range
Line
Count
Source
44
119k
static INLINE tran_high_t highbd_check_range(tran_high_t input, int bd) {
45
#if CONFIG_COEFFICIENT_RANGE_CHECKING
46
  // For valid highbitdepth VP9 streams, intermediate stage coefficients will
47
  // stay within the ranges:
48
  // - 8 bit: signed 16 bit integer
49
  // - 10 bit: signed 18 bit integer
50
  // - 12 bit: signed 20 bit integer
51
  const int32_t int_max = (1 << (7 + bd)) - 1;
52
  const int32_t int_min = -int_max - 1;
53
  assert(int_min <= input);
54
  assert(input <= int_max);
55
  (void)int_min;
56
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
57
119k
  (void)bd;
58
119k
  return input;
59
119k
}
highbd_idct16x16_add_sse2.c:highbd_check_range
Line
Count
Source
44
181k
static INLINE tran_high_t highbd_check_range(tran_high_t input, int bd) {
45
#if CONFIG_COEFFICIENT_RANGE_CHECKING
46
  // For valid highbitdepth VP9 streams, intermediate stage coefficients will
47
  // stay within the ranges:
48
  // - 8 bit: signed 16 bit integer
49
  // - 10 bit: signed 18 bit integer
50
  // - 12 bit: signed 20 bit integer
51
  const int32_t int_max = (1 << (7 + bd)) - 1;
52
  const int32_t int_min = -int_max - 1;
53
  assert(int_min <= input);
54
  assert(input <= int_max);
55
  (void)int_min;
56
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
57
181k
  (void)bd;
58
181k
  return input;
59
181k
}
highbd_idct32x32_add_sse2.c:highbd_check_range
Line
Count
Source
44
181k
static INLINE tran_high_t highbd_check_range(tran_high_t input, int bd) {
45
#if CONFIG_COEFFICIENT_RANGE_CHECKING
46
  // For valid highbitdepth VP9 streams, intermediate stage coefficients will
47
  // stay within the ranges:
48
  // - 8 bit: signed 16 bit integer
49
  // - 10 bit: signed 18 bit integer
50
  // - 12 bit: signed 20 bit integer
51
  const int32_t int_max = (1 << (7 + bd)) - 1;
52
  const int32_t int_min = -int_max - 1;
53
  assert(int_min <= input);
54
  assert(input <= int_max);
55
  (void)int_min;
56
#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
57
181k
  (void)bd;
58
181k
  return input;
59
181k
}
Unexecuted instantiation: highbd_idct4x4_add_sse4.c:highbd_check_range
Unexecuted instantiation: highbd_idct8x8_add_sse4.c:highbd_check_range
Unexecuted instantiation: highbd_idct16x16_add_sse4.c:highbd_check_range
Unexecuted instantiation: highbd_idct32x32_add_sse4.c:highbd_check_range
Unexecuted instantiation: vp9_dct.c:highbd_check_range
Unexecuted instantiation: vp9_encodeframe.c:highbd_check_range
Unexecuted instantiation: vp9_encodemb.c:highbd_check_range
Unexecuted instantiation: vp9_rdopt.c:highbd_check_range
60
#endif  // CONFIG_VP9_HIGHBITDEPTH
61
62
#if CONFIG_EMULATE_HARDWARE
63
// When CONFIG_EMULATE_HARDWARE is 1 the transform performs a
64
// non-normative method to handle overflows. A stream that causes
65
// overflows  in the inverse transform is considered invalid in VP9,
66
// and a hardware implementer is free to choose any reasonable
67
// method to handle overflows. However to aid in hardware
68
// verification they can use a specific implementation of the
69
// WRAPLOW() macro below that is identical to their intended
70
// hardware implementation (and also use configure options to trigger
71
// the C-implementation of the transform).
72
//
73
// The particular WRAPLOW implementation below performs strict
74
// overflow wrapping to match common hardware implementations.
75
// bd of 8 uses trans_low with 16bits, need to remove 16bits
76
// bd of 10 uses trans_low with 18bits, need to remove 14bits
77
// bd of 12 uses trans_low with 20bits, need to remove 12bits
78
// bd of x uses trans_low with 8+x bits, need to remove 24-x bits
79
#define WRAPLOW(x) ((((int32_t)check_range(x)) << 16) >> 16)
80
#if CONFIG_VP9_HIGHBITDEPTH
81
#define HIGHBD_WRAPLOW(x, bd) \
82
  ((((int32_t)highbd_check_range((x), bd)) << (24 - bd)) >> (24 - bd))
83
#endif  // CONFIG_VP9_HIGHBITDEPTH
84
85
#else  // CONFIG_EMULATE_HARDWARE
86
87
43.7M
#define WRAPLOW(x) ((int32_t)check_range(x))
88
#if CONFIG_VP9_HIGHBITDEPTH
89
15.1M
#define HIGHBD_WRAPLOW(x, bd) ((int32_t)highbd_check_range((x), bd))
90
#endif  // CONFIG_VP9_HIGHBITDEPTH
91
#endif  // CONFIG_EMULATE_HARDWARE
92
93
void idct4_c(const tran_low_t *input, tran_low_t *output);
94
void idct8_c(const tran_low_t *input, tran_low_t *output);
95
void idct16_c(const tran_low_t *input, tran_low_t *output);
96
void idct32_c(const tran_low_t *input, tran_low_t *output);
97
void iadst4_c(const tran_low_t *input, tran_low_t *output);
98
void iadst8_c(const tran_low_t *input, tran_low_t *output);
99
void iadst16_c(const tran_low_t *input, tran_low_t *output);
100
101
#if CONFIG_VP9_HIGHBITDEPTH
102
void vpx_highbd_idct4_c(const tran_low_t *input, tran_low_t *output, int bd);
103
void vpx_highbd_idct8_c(const tran_low_t *input, tran_low_t *output, int bd);
104
void vpx_highbd_idct16_c(const tran_low_t *input, tran_low_t *output, int bd);
105
106
void vpx_highbd_iadst4_c(const tran_low_t *input, tran_low_t *output, int bd);
107
void vpx_highbd_iadst8_c(const tran_low_t *input, tran_low_t *output, int bd);
108
void vpx_highbd_iadst16_c(const tran_low_t *input, tran_low_t *output, int bd);
109
110
static INLINE uint16_t highbd_clip_pixel_add(uint16_t dest, tran_high_t trans,
111
5.16M
                                             int bd) {
112
5.16M
  trans = HIGHBD_WRAPLOW(trans, bd);
113
5.16M
  return clip_pixel_highbd(dest + (int)trans, bd);
114
5.16M
}
Unexecuted instantiation: vp9_decodeframe.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_idct.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_idct_intrin_sse2.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_highbd_iht4x4_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_highbd_iht8x8_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_highbd_iht16x16_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_encoder.c:highbd_clip_pixel_add
inv_txfm.c:highbd_clip_pixel_add
Line
Count
Source
111
5.16M
                                             int bd) {
112
5.16M
  trans = HIGHBD_WRAPLOW(trans, bd);
113
5.16M
  return clip_pixel_highbd(dest + (int)trans, bd);
114
5.16M
}
Unexecuted instantiation: inv_txfm_sse2.c:highbd_clip_pixel_add
Unexecuted instantiation: inv_txfm_ssse3.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct4x4_add_sse2.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct8x8_add_sse2.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct16x16_add_sse2.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct32x32_add_sse2.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct4x4_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct8x8_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct16x16_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: highbd_idct32x32_add_sse4.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_dct.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_encodeframe.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_encodemb.c:highbd_clip_pixel_add
Unexecuted instantiation: vp9_rdopt.c:highbd_clip_pixel_add
115
#endif
116
117
33.2M
static INLINE uint8_t clip_pixel_add(uint8_t dest, tran_high_t trans) {
118
33.2M
  trans = WRAPLOW(trans);
119
33.2M
  return clip_pixel(dest + (int)trans);
120
33.2M
}
Unexecuted instantiation: vp9_decodeframe.c:clip_pixel_add
Unexecuted instantiation: vp9_idct.c:clip_pixel_add
Unexecuted instantiation: vp9_idct_intrin_sse2.c:clip_pixel_add
Unexecuted instantiation: vp9_highbd_iht4x4_add_sse4.c:clip_pixel_add
Unexecuted instantiation: vp9_highbd_iht8x8_add_sse4.c:clip_pixel_add
Unexecuted instantiation: vp9_highbd_iht16x16_add_sse4.c:clip_pixel_add
Unexecuted instantiation: vp9_encoder.c:clip_pixel_add
inv_txfm.c:clip_pixel_add
Line
Count
Source
117
33.2M
static INLINE uint8_t clip_pixel_add(uint8_t dest, tran_high_t trans) {
118
33.2M
  trans = WRAPLOW(trans);
119
33.2M
  return clip_pixel(dest + (int)trans);
120
33.2M
}
Unexecuted instantiation: inv_txfm_sse2.c:clip_pixel_add
Unexecuted instantiation: inv_txfm_ssse3.c:clip_pixel_add
Unexecuted instantiation: highbd_idct4x4_add_sse2.c:clip_pixel_add
Unexecuted instantiation: highbd_idct8x8_add_sse2.c:clip_pixel_add
Unexecuted instantiation: highbd_idct16x16_add_sse2.c:clip_pixel_add
Unexecuted instantiation: highbd_idct32x32_add_sse2.c:clip_pixel_add
Unexecuted instantiation: highbd_idct4x4_add_sse4.c:clip_pixel_add
Unexecuted instantiation: highbd_idct8x8_add_sse4.c:clip_pixel_add
Unexecuted instantiation: highbd_idct16x16_add_sse4.c:clip_pixel_add
Unexecuted instantiation: highbd_idct32x32_add_sse4.c:clip_pixel_add
Unexecuted instantiation: vp9_dct.c:clip_pixel_add
Unexecuted instantiation: vp9_encodeframe.c:clip_pixel_add
Unexecuted instantiation: vp9_encodemb.c:clip_pixel_add
Unexecuted instantiation: vp9_rdopt.c:clip_pixel_add
121
#ifdef __cplusplus
122
}  // extern "C"
123
#endif
124
125
#endif  // VPX_VPX_DSP_INV_TXFM_H_