Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: source/libvpx/vp9/common/vp9_idct.h

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_filter.h ('k') | source/libvpx/vp9/common/vp9_idct.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef VP9_COMMON_VP9_IDCT_H_ 11 #ifndef VP9_COMMON_VP9_IDCT_H_
12 #define VP9_COMMON_VP9_IDCT_H_ 12 #define VP9_COMMON_VP9_IDCT_H_
13 13
14 #include <assert.h> 14 #include <assert.h>
15 15
16 #include "./vpx_config.h" 16 #include "./vpx_config.h"
17 #include "vpx/vpx_integer.h"
18 #include "vp9/common/vp9_common.h" 17 #include "vp9/common/vp9_common.h"
19 #include "vp9/common/vp9_enums.h" 18 #include "vp9/common/vp9_enums.h"
20 19
21 #ifdef __cplusplus 20 #ifdef __cplusplus
22 extern "C" { 21 extern "C" {
23 #endif 22 #endif
24 23
25
26 // Constants and Macros used by all idct/dct functions 24 // Constants and Macros used by all idct/dct functions
27 #define DCT_CONST_BITS 14 25 #define DCT_CONST_BITS 14
28 #define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1)) 26 #define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1))
29 27
30 #define UNIT_QUANT_SHIFT 2 28 #define UNIT_QUANT_SHIFT 2
31 #define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT) 29 #define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT)
32 30
33 #define pair_set_epi16(a, b) \ 31 #define pair_set_epi16(a, b) \
34 _mm_set_epi16(b, a, b, a, b, a, b, a) 32 _mm_set_epi16(b, a, b, a, b, a, b, a)
35 33
36 #define dual_set_epi16(a, b) \ 34 #define dual_set_epi16(a, b) \
37 _mm_set_epi16(b, b, b, b, a, a, a, a) 35 _mm_set_epi16(b, b, b, b, a, a, a, a)
38 36
39 // Note:
40 // tran_low_t is the datatype used for final transform coefficients.
41 // tran_high_t is the datatype used for intermediate transform stages.
42 #if CONFIG_VP9_HIGHBITDEPTH
43 typedef int64_t tran_high_t;
44 typedef int32_t tran_low_t;
45 #else
46 typedef int32_t tran_high_t;
47 typedef int16_t tran_low_t;
48 #endif
49
50 // Constants: 37 // Constants:
51 // for (int i = 1; i< 32; ++i) 38 // for (int i = 1; i< 32; ++i)
52 // printf("static const int cospi_%d_64 = %.0f;\n", i, 39 // printf("static const int cospi_%d_64 = %.0f;\n", i,
53 // round(16384 * cos(i*M_PI/64))); 40 // round(16384 * cos(i*M_PI/64)));
54 // Note: sin(k*Pi/64) = cos((32-k)*Pi/64) 41 // Note: sin(k*Pi/64) = cos((32-k)*Pi/64)
55 static const tran_high_t cospi_1_64 = 16364; 42 static const tran_high_t cospi_1_64 = 16364;
56 static const tran_high_t cospi_2_64 = 16305; 43 static const tran_high_t cospi_2_64 = 16305;
57 static const tran_high_t cospi_3_64 = 16207; 44 static const tran_high_t cospi_3_64 = 16207;
58 static const tran_high_t cospi_4_64 = 16069; 45 static const tran_high_t cospi_4_64 = 16069;
59 static const tran_high_t cospi_5_64 = 15893; 46 static const tran_high_t cospi_5_64 = 15893;
(...skipping 23 matching lines...) Expand all
83 static const tran_high_t cospi_29_64 = 2404; 70 static const tran_high_t cospi_29_64 = 2404;
84 static const tran_high_t cospi_30_64 = 1606; 71 static const tran_high_t cospi_30_64 = 1606;
85 static const tran_high_t cospi_31_64 = 804; 72 static const tran_high_t cospi_31_64 = 804;
86 73
87 // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3 74 // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3
88 static const tran_high_t sinpi_1_9 = 5283; 75 static const tran_high_t sinpi_1_9 = 5283;
89 static const tran_high_t sinpi_2_9 = 9929; 76 static const tran_high_t sinpi_2_9 = 9929;
90 static const tran_high_t sinpi_3_9 = 13377; 77 static const tran_high_t sinpi_3_9 = 13377;
91 static const tran_high_t sinpi_4_9 = 15212; 78 static const tran_high_t sinpi_4_9 = 15212;
92 79
93 static INLINE tran_low_t dct_const_round_shift(tran_high_t input) { 80 static INLINE tran_low_t check_range(tran_high_t input) {
94 tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
95 #if CONFIG_VP9_HIGHBITDEPTH 81 #if CONFIG_VP9_HIGHBITDEPTH
96 // For valid highbitdepth VP9 streams, intermediate stage coefficients will 82 // For valid highbitdepth VP9 streams, intermediate stage coefficients will
97 // stay within the ranges: 83 // stay within the ranges:
98 // - 8 bit: signed 16 bit integer 84 // - 8 bit: signed 16 bit integer
99 // - 10 bit: signed 18 bit integer 85 // - 10 bit: signed 18 bit integer
100 // - 12 bit: signed 20 bit integer 86 // - 12 bit: signed 20 bit integer
101 #elif CONFIG_COEFFICIENT_RANGE_CHECKING 87 #elif CONFIG_COEFFICIENT_RANGE_CHECKING
102 // For valid VP9 input streams, intermediate stage coefficients should always 88 // For valid VP9 input streams, intermediate stage coefficients should always
103 // stay within the range of a signed 16 bit integer. Coefficients can go out 89 // stay within the range of a signed 16 bit integer. Coefficients can go out
104 // of this range for invalid/corrupt VP9 streams. However, strictly checking 90 // of this range for invalid/corrupt VP9 streams. However, strictly checking
105 // this range for every intermediate coefficient can burdensome for a decoder, 91 // this range for every intermediate coefficient can burdensome for a decoder,
106 // therefore the following assertion is only enabled when configured with 92 // therefore the following assertion is only enabled when configured with
107 // --enable-coefficient-range-checking. 93 // --enable-coefficient-range-checking.
108 assert(INT16_MIN <= rv); 94 assert(INT16_MIN <= input);
109 assert(rv <= INT16_MAX); 95 assert(input <= INT16_MAX);
110 #endif 96 #endif
111 return (tran_low_t)rv; 97 return (tran_low_t)input;
98 }
99
100 static INLINE tran_low_t dct_const_round_shift(tran_high_t input) {
101 tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
102 return check_range(rv);
112 } 103 }
113 104
114 typedef void (*transform_1d)(const tran_low_t*, tran_low_t*); 105 typedef void (*transform_1d)(const tran_low_t*, tran_low_t*);
115 106
116 typedef struct { 107 typedef struct {
117 transform_1d cols, rows; // vertical and horizontal 108 transform_1d cols, rows; // vertical and horizontal
118 } transform_2d; 109 } transform_2d;
119 110
120 #if CONFIG_VP9_HIGHBITDEPTH 111 #if CONFIG_VP9_HIGHBITDEPTH
121 typedef void (*high_transform_1d)(const tran_low_t*, tran_low_t*, int bd); 112 typedef void (*highbd_transform_1d)(const tran_low_t*, tran_low_t*, int bd);
122 113
123 typedef struct { 114 typedef struct {
124 high_transform_1d cols, rows; // vertical and horizontal 115 highbd_transform_1d cols, rows; // vertical and horizontal
125 } high_transform_2d; 116 } highbd_transform_2d;
126 #endif // CONFIG_VP9_HIGHBITDEPTH 117 #endif // CONFIG_VP9_HIGHBITDEPTH
127 118
128 void vp9_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride, 119 void vp9_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
129 int eob); 120 int eob);
130 void vp9_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride, 121 void vp9_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
131 int eob); 122 int eob);
132 void vp9_idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride, 123 void vp9_idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride,
133 int eob); 124 int eob);
134 void vp9_idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride, int 125 void vp9_idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride, int
135 eob); 126 eob);
136 void vp9_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride, 127 void vp9_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride,
137 int eob); 128 int eob);
138 129
139 void vp9_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest, 130 void vp9_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
140 int stride, int eob); 131 int stride, int eob);
141 void vp9_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest, 132 void vp9_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
142 int stride, int eob); 133 int stride, int eob);
143 void vp9_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest, 134 void vp9_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
144 int stride, int eob); 135 int stride, int eob);
145 136
146 #if CONFIG_VP9_HIGHBITDEPTH 137 #if CONFIG_VP9_HIGHBITDEPTH
147 void vp9_high_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride, 138 void vp9_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
148 int eob, int bd);
149 void vp9_high_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
150 int eob, int bd);
151 void vp9_high_idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride,
152 int eob, int bd);
153 void vp9_high_idct16x16_add(const tran_low_t *input, uint8_t *dest, int stride,
154 int eob, int bd); 139 int eob, int bd);
155 void vp9_high_idct32x32_add(const tran_low_t *input, uint8_t *dest, int stride, 140 void vp9_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
156 int eob, int bd); 141 int eob, int bd);
157 void vp9_high_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input, 142 void vp9_highbd_idct8x8_add(const tran_low_t *input, uint8_t *dest, int stride,
158 uint8_t *dest, int stride, int eob, int bd); 143 int eob, int bd);
159 void vp9_high_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input, 144 void vp9_highbd_idct16x16_add(const tran_low_t *input, uint8_t *dest,
160 uint8_t *dest, int stride, int eob, int bd); 145 int stride, int eob, int bd);
161 void vp9_high_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input, 146 void vp9_highbd_idct32x32_add(const tran_low_t *input, uint8_t *dest,
147 int stride, int eob, int bd);
148 void vp9_highbd_iht4x4_add(TX_TYPE tx_type, const tran_low_t *input,
162 uint8_t *dest, int stride, int eob, int bd); 149 uint8_t *dest, int stride, int eob, int bd);
150 void vp9_highbd_iht8x8_add(TX_TYPE tx_type, const tran_low_t *input,
151 uint8_t *dest, int stride, int eob, int bd);
152 void vp9_highbd_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input,
153 uint8_t *dest, int stride, int eob, int bd);
163 #endif // CONFIG_VP9_HIGHBITDEPTH 154 #endif // CONFIG_VP9_HIGHBITDEPTH
164 #ifdef __cplusplus 155 #ifdef __cplusplus
165 } // extern "C" 156 } // extern "C"
166 #endif 157 #endif
167 158
168 #endif // VP9_COMMON_VP9_IDCT_H_ 159 #endif // VP9_COMMON_VP9_IDCT_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_filter.h ('k') | source/libvpx/vp9/common/vp9_idct.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698