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

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

Issue 812033011: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 5 years, 11 months 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_entropymode.c ('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
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static const tran_high_t cospi_30_64 = 1606; 73 static const tran_high_t cospi_30_64 = 1606;
74 static const tran_high_t cospi_31_64 = 804; 74 static const tran_high_t cospi_31_64 = 804;
75 75
76 // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3 76 // 16384 * sqrt(2) * sin(kPi/9) * 2 / 3
77 static const tran_high_t sinpi_1_9 = 5283; 77 static const tran_high_t sinpi_1_9 = 5283;
78 static const tran_high_t sinpi_2_9 = 9929; 78 static const tran_high_t sinpi_2_9 = 9929;
79 static const tran_high_t sinpi_3_9 = 13377; 79 static const tran_high_t sinpi_3_9 = 13377;
80 static const tran_high_t sinpi_4_9 = 15212; 80 static const tran_high_t sinpi_4_9 = 15212;
81 81
82 static INLINE tran_low_t check_range(tran_high_t input) { 82 static INLINE tran_low_t check_range(tran_high_t input) {
83 #if CONFIG_VP9_HIGHBITDEPTH 83 #if CONFIG_COEFFICIENT_RANGE_CHECKING
84 // For valid highbitdepth VP9 streams, intermediate stage coefficients will
85 // stay within the ranges:
86 // - 8 bit: signed 16 bit integer
87 // - 10 bit: signed 18 bit integer
88 // - 12 bit: signed 20 bit integer
89 #elif CONFIG_COEFFICIENT_RANGE_CHECKING
90 // For valid VP9 input streams, intermediate stage coefficients should always 84 // For valid VP9 input streams, intermediate stage coefficients should always
91 // stay within the range of a signed 16 bit integer. Coefficients can go out 85 // stay within the range of a signed 16 bit integer. Coefficients can go out
92 // of this range for invalid/corrupt VP9 streams. However, strictly checking 86 // of this range for invalid/corrupt VP9 streams. However, strictly checking
93 // this range for every intermediate coefficient can burdensome for a decoder, 87 // this range for every intermediate coefficient can burdensome for a decoder,
94 // therefore the following assertion is only enabled when configured with 88 // therefore the following assertion is only enabled when configured with
95 // --enable-coefficient-range-checking. 89 // --enable-coefficient-range-checking.
96 assert(INT16_MIN <= input); 90 assert(INT16_MIN <= input);
97 assert(input <= INT16_MAX); 91 assert(input <= INT16_MAX);
98 #endif 92 #endif // CONFIG_COEFFICIENT_RANGE_CHECKING
99 return (tran_low_t)input; 93 return (tran_low_t)input;
100 } 94 }
101 95
102 static INLINE tran_low_t dct_const_round_shift(tran_high_t input) { 96 static INLINE tran_low_t dct_const_round_shift(tran_high_t input) {
103 tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS); 97 tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
104 return check_range(rv); 98 return check_range(rv);
105 } 99 }
106 100
101 #if CONFIG_VP9_HIGHBITDEPTH
102 static INLINE tran_low_t highbd_check_range(tran_high_t input,
103 int bd) {
104 #if CONFIG_COEFFICIENT_RANGE_CHECKING
105 // For valid highbitdepth VP9 streams, intermediate stage coefficients will
106 // stay within the ranges:
107 // - 8 bit: signed 16 bit integer
108 // - 10 bit: signed 18 bit integer
109 // - 12 bit: signed 20 bit integer
110 const int32_t int_max = (1 << (7 + bd)) - 1;
111 const int32_t int_min = -int_max - 1;
112 assert(int_min <= input);
113 assert(input <= int_max);
114 (void) int_min;
115 #endif // CONFIG_COEFFICIENT_RANGE_CHECKING
116 (void) bd;
117 return (tran_low_t)input;
118 }
119
120 static INLINE tran_low_t highbd_dct_const_round_shift(tran_high_t input,
121 int bd) {
122 tran_high_t rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
123 return highbd_check_range(rv, bd);
124 }
125 #endif // CONFIG_VP9_HIGHBITDEPTH
126
107 typedef void (*transform_1d)(const tran_low_t*, tran_low_t*); 127 typedef void (*transform_1d)(const tran_low_t*, tran_low_t*);
108 128
109 typedef struct { 129 typedef struct {
110 transform_1d cols, rows; // vertical and horizontal 130 transform_1d cols, rows; // vertical and horizontal
111 } transform_2d; 131 } transform_2d;
112 132
113 #if CONFIG_VP9_HIGHBITDEPTH 133 #if CONFIG_VP9_HIGHBITDEPTH
114 typedef void (*highbd_transform_1d)(const tran_low_t*, tran_low_t*, int bd); 134 typedef void (*highbd_transform_1d)(const tran_low_t*, tran_low_t*, int bd);
115 135
116 typedef struct { 136 typedef struct {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 int bd) { 202 int bd) {
183 trans = WRAPLOW(trans, bd); 203 trans = WRAPLOW(trans, bd);
184 return clip_pixel_highbd(WRAPLOW(dest + trans, bd), bd); 204 return clip_pixel_highbd(WRAPLOW(dest + trans, bd), bd);
185 } 205 }
186 #endif // CONFIG_VP9_HIGHBITDEPTH 206 #endif // CONFIG_VP9_HIGHBITDEPTH
187 #ifdef __cplusplus 207 #ifdef __cplusplus
188 } // extern "C" 208 } // extern "C"
189 #endif 209 #endif
190 210
191 #endif // VP9_COMMON_VP9_IDCT_H_ 211 #endif // VP9_COMMON_VP9_IDCT_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_entropymode.c ('k') | source/libvpx/vp9/common/vp9_idct.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698