Coverage Report

Created: 2024-09-06 07:53

/src/libvpx/vpx_dsp/inv_txfm.h
Line
Count
Source (jump to first uncovered line)
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
38.5M
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
38.5M
  return input;
36
38.5M
}
Unexecuted instantiation: vp9_encoder.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_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
inv_txfm.c:check_range
Line
Count
Source
24
34.9M
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
34.9M
  return input;
36
34.9M
}
inv_txfm_sse2.c:check_range
Line
Count
Source
24
3.61M
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
3.61M
  return input;
36
3.61M
}
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
37
38
33.2M
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
33.2M
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
33.2M
  return (tran_high_t)rv;
41
33.2M
}
Unexecuted instantiation: vp9_encoder.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_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
Unexecuted instantiation: inv_txfm.c:dct_const_round_shift
inv_txfm_sse2.c:dct_const_round_shift
Line
Count
Source
38
33.2M
static INLINE tran_high_t dct_const_round_shift(tran_high_t input) {
39
33.2M
  tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
40
33.2M
  return (tran_high_t)rv;
41
33.2M
}
Unexecuted instantiation: inv_txfm_ssse3.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct4x4_add_sse2.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct8x8_add_sse2.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct16x16_add_sse2.c:dct_const_round_shift
Unexecuted instantiation: highbd_idct32x32_add_sse2.c:dct_const_round_shift
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
42
43
#if CONFIG_VP9_HIGHBITDEPTH
44
0
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
0
  (void)bd;
58
0
  return input;
59
0
}
Unexecuted instantiation: vp9_encoder.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_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
Unexecuted instantiation: inv_txfm.c:highbd_check_range
Unexecuted instantiation: inv_txfm_sse2.c:highbd_check_range
Unexecuted instantiation: inv_txfm_ssse3.c:highbd_check_range
Unexecuted instantiation: highbd_idct4x4_add_sse2.c:highbd_check_range
Unexecuted instantiation: highbd_idct8x8_add_sse2.c:highbd_check_range
Unexecuted instantiation: highbd_idct16x16_add_sse2.c:highbd_check_range
Unexecuted instantiation: highbd_idct32x32_add_sse2.c:highbd_check_range
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
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
38.5M
#define WRAPLOW(x) ((int32_t)check_range(x))
88
#if CONFIG_VP9_HIGHBITDEPTH
89
0
#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
0
                                             int bd) {
112
0
  trans = HIGHBD_WRAPLOW(trans, bd);
113
0
  return clip_pixel_highbd(dest + (int)trans, bd);
114
0
}
Unexecuted instantiation: vp9_encoder.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_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
Unexecuted instantiation: inv_txfm.c:highbd_clip_pixel_add
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
115
#endif
116
117
31.0M
static INLINE uint8_t clip_pixel_add(uint8_t dest, tran_high_t trans) {
118
31.0M
  trans = WRAPLOW(trans);
119
31.0M
  return clip_pixel(dest + (int)trans);
120
31.0M
}
Unexecuted instantiation: vp9_encoder.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_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
inv_txfm.c:clip_pixel_add
Line
Count
Source
117
31.0M
static INLINE uint8_t clip_pixel_add(uint8_t dest, tran_high_t trans) {
118
31.0M
  trans = WRAPLOW(trans);
119
31.0M
  return clip_pixel(dest + (int)trans);
120
31.0M
}
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
121
#ifdef __cplusplus
122
}  // extern "C"
123
#endif
124
125
#endif  // VPX_VPX_DSP_INV_TXFM_H_