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

Side by Side Diff: webrtc/modules/video_processing/deflickering.cc

Issue 1508793002: Clang format of video_processing folder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC 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 22 matching lines...) Expand all
33 // Compute the quantiles over 1 / DownsamplingFactor of the image. 33 // Compute the quantiles over 1 / DownsamplingFactor of the image.
34 enum { kDownsamplingFactor = 8 }; 34 enum { kDownsamplingFactor = 8 };
35 enum { kLog2OfDownsamplingFactor = 3 }; 35 enum { kLog2OfDownsamplingFactor = 3 };
36 36
37 // To generate in Matlab: 37 // To generate in Matlab:
38 // >> probUW16 = round(2^11 * 38 // >> probUW16 = round(2^11 *
39 // [0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.97]); 39 // [0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.97]);
40 // >> fprintf('%d, ', probUW16) 40 // >> fprintf('%d, ', probUW16)
41 // Resolution reduced to avoid overflow when multiplying with the 41 // Resolution reduced to avoid overflow when multiplying with the
42 // (potentially) large number of pixels. 42 // (potentially) large number of pixels.
43 const uint16_t VPMDeflickering::prob_uw16_[kNumProbs] = {102, 205, 410, 614, 43 const uint16_t VPMDeflickering::prob_uw16_[kNumProbs] = {
44 819, 1024, 1229, 1434, 1638, 1843, 1946, 1987}; // <Q11> 44 102, 205, 410, 614, 819, 1024,
45 1229, 1434, 1638, 1843, 1946, 1987}; // <Q11>
45 46
46 // To generate in Matlab: 47 // To generate in Matlab:
47 // >> numQuants = 14; maxOnlyLength = 5; 48 // >> numQuants = 14; maxOnlyLength = 5;
48 // >> weightUW16 = round(2^15 * 49 // >> weightUW16 = round(2^15 *
49 // [linspace(0.5, 1.0, numQuants - maxOnlyLength)]); 50 // [linspace(0.5, 1.0, numQuants - maxOnlyLength)]);
50 // >> fprintf('%d, %d,\n ', weightUW16); 51 // >> fprintf('%d, %d,\n ', weightUW16);
51 const uint16_t VPMDeflickering::weight_uw16_[kNumQuants - kMaxOnlyLength] = 52 const uint16_t VPMDeflickering::weight_uw16_[kNumQuants - kMaxOnlyLength] = {
52 {16384, 18432, 20480, 22528, 24576, 26624, 28672, 30720, 32768}; // <Q15> 53 16384, 18432, 20480, 22528, 24576, 26624, 28672, 30720, 32768}; // <Q15>
53 54
54 VPMDeflickering::VPMDeflickering() { 55 VPMDeflickering::VPMDeflickering() {
55 Reset(); 56 Reset();
56 } 57 }
57 58
58 VPMDeflickering::~VPMDeflickering() {} 59 VPMDeflickering::~VPMDeflickering() {}
59 60
60 void VPMDeflickering::Reset() { 61 void VPMDeflickering::Reset() {
61 mean_buffer_length_ = 0; 62 mean_buffer_length_ = 0;
62 detection_state_ = 0; 63 detection_state_ = 0;
63 frame_rate_ = 0; 64 frame_rate_ = 0;
64 65
65 memset(mean_buffer_, 0, sizeof(int32_t) * kMeanBufferLength); 66 memset(mean_buffer_, 0, sizeof(int32_t) * kMeanBufferLength);
66 memset(timestamp_buffer_, 0, sizeof(int32_t) * kMeanBufferLength); 67 memset(timestamp_buffer_, 0, sizeof(int32_t) * kMeanBufferLength);
67 68
68 // Initialize the history with a uniformly distributed histogram. 69 // Initialize the history with a uniformly distributed histogram.
69 quant_hist_uw8_[0][0] = 0; 70 quant_hist_uw8_[0][0] = 0;
70 quant_hist_uw8_[0][kNumQuants - 1] = 255; 71 quant_hist_uw8_[0][kNumQuants - 1] = 255;
71 for (int32_t i = 0; i < kNumProbs; i++) { 72 for (int32_t i = 0; i < kNumProbs; i++) {
72 // Unsigned round. <Q0> 73 // Unsigned round. <Q0>
73 quant_hist_uw8_[0][i + 1] = static_cast<uint8_t>( 74 quant_hist_uw8_[0][i + 1] =
74 (prob_uw16_[i] * 255 + (1 << 10)) >> 11); 75 static_cast<uint8_t>((prob_uw16_[i] * 255 + (1 << 10)) >> 11);
75 } 76 }
76 77
77 for (int32_t i = 1; i < kFrameHistory_size; i++) { 78 for (int32_t i = 1; i < kFrameHistory_size; i++) {
78 memcpy(quant_hist_uw8_[i], quant_hist_uw8_[0], 79 memcpy(quant_hist_uw8_[i], quant_hist_uw8_[0],
79 sizeof(uint8_t) * kNumQuants); 80 sizeof(uint8_t) * kNumQuants);
80 } 81 }
81 } 82 }
82 83
83 int32_t VPMDeflickering::ProcessFrame( 84 int32_t VPMDeflickering::ProcessFrame(VideoFrame* frame,
84 VideoFrame* frame, 85 VideoProcessing::FrameStats* stats) {
85 VideoProcessing::FrameStats* stats) {
86 assert(frame); 86 assert(frame);
87 uint32_t frame_memory; 87 uint32_t frame_memory;
88 uint8_t quant_uw8[kNumQuants]; 88 uint8_t quant_uw8[kNumQuants];
89 uint8_t maxquant_uw8[kNumQuants]; 89 uint8_t maxquant_uw8[kNumQuants];
90 uint8_t minquant_uw8[kNumQuants]; 90 uint8_t minquant_uw8[kNumQuants];
91 uint16_t target_quant_uw16[kNumQuants]; 91 uint16_t target_quant_uw16[kNumQuants];
92 uint16_t increment_uw16; 92 uint16_t increment_uw16;
93 uint8_t map_uw8[256]; 93 uint8_t map_uw8[256];
94 94
95 uint16_t tmp_uw16; 95 uint16_t tmp_uw16;
96 uint32_t tmp_uw32; 96 uint32_t tmp_uw32;
97 int width = frame->width(); 97 int width = frame->width();
98 int height = frame->height(); 98 int height = frame->height();
99 99
100 if (frame->IsZeroSize()) { 100 if (frame->IsZeroSize()) {
101 return VPM_GENERAL_ERROR; 101 return VPM_GENERAL_ERROR;
102 } 102 }
103 103
104 // Stricter height check due to subsampling size calculation below. 104 // Stricter height check due to subsampling size calculation below.
105 if (height < 2) { 105 if (height < 2) {
106 LOG(LS_ERROR) << "Invalid frame size."; 106 LOG(LS_ERROR) << "Invalid frame size.";
107 return VPM_GENERAL_ERROR; 107 return VPM_GENERAL_ERROR;
108 } 108 }
109 109
110 if (!VideoProcessing::ValidFrameStats(*stats)) { 110 if (!VideoProcessing::ValidFrameStats(*stats)) {
111 return VPM_GENERAL_ERROR; 111 return VPM_GENERAL_ERROR;
112 } 112 }
113 113
114 if (PreDetection(frame->timestamp(), *stats) == -1) return VPM_GENERAL_ERROR; 114 if (PreDetection(frame->timestamp(), *stats) == -1)
115 return VPM_GENERAL_ERROR;
115 116
116 // Flicker detection 117 // Flicker detection
117 int32_t det_flicker = DetectFlicker(); 118 int32_t det_flicker = DetectFlicker();
118 if (det_flicker < 0) { 119 if (det_flicker < 0) {
119 return VPM_GENERAL_ERROR; 120 return VPM_GENERAL_ERROR;
120 } else if (det_flicker != 1) { 121 } else if (det_flicker != 1) {
121 return 0; 122 return 0;
122 } 123 }
123 124
124 // Size of luminance component. 125 // Size of luminance component.
125 const uint32_t y_size = height * width; 126 const uint32_t y_size = height * width;
126 127
127 const uint32_t y_sub_size = width * (((height - 1) >> 128 const uint32_t y_sub_size =
128 kLog2OfDownsamplingFactor) + 1); 129 width * (((height - 1) >> kLog2OfDownsamplingFactor) + 1);
129 uint8_t* y_sorted = new uint8_t[y_sub_size]; 130 uint8_t* y_sorted = new uint8_t[y_sub_size];
130 uint32_t sort_row_idx = 0; 131 uint32_t sort_row_idx = 0;
131 for (int i = 0; i < height; i += kDownsamplingFactor) { 132 for (int i = 0; i < height; i += kDownsamplingFactor) {
132 memcpy(y_sorted + sort_row_idx * width, 133 memcpy(y_sorted + sort_row_idx * width, frame->buffer(kYPlane) + i * width,
133 frame->buffer(kYPlane) + i * width, width); 134 width);
134 sort_row_idx++; 135 sort_row_idx++;
135 } 136 }
136 137
137 webrtc::Sort(y_sorted, y_sub_size, webrtc::TYPE_UWord8); 138 webrtc::Sort(y_sorted, y_sub_size, webrtc::TYPE_UWord8);
138 139
139 uint32_t prob_idx_uw32 = 0; 140 uint32_t prob_idx_uw32 = 0;
140 quant_uw8[0] = 0; 141 quant_uw8[0] = 0;
141 quant_uw8[kNumQuants - 1] = 255; 142 quant_uw8[kNumQuants - 1] = 255;
142 143
143 // Ensure we won't get an overflow below. 144 // Ensure we won't get an overflow below.
144 // In practice, the number of subsampled pixels will not become this large. 145 // In practice, the number of subsampled pixels will not become this large.
145 if (y_sub_size > (1 << 21) - 1) { 146 if (y_sub_size > (1 << 21) - 1) {
146 LOG(LS_ERROR) << "Subsampled number of pixels too large."; 147 LOG(LS_ERROR) << "Subsampled number of pixels too large.";
147 return -1; 148 return -1;
148 } 149 }
149 150
150 for (int32_t i = 0; i < kNumProbs; i++) { 151 for (int32_t i = 0; i < kNumProbs; i++) {
151 // <Q0>. 152 // <Q0>.
152 prob_idx_uw32 = WEBRTC_SPL_UMUL_32_16(y_sub_size, prob_uw16_[i]) >> 11; 153 prob_idx_uw32 = WEBRTC_SPL_UMUL_32_16(y_sub_size, prob_uw16_[i]) >> 11;
153 quant_uw8[i + 1] = y_sorted[prob_idx_uw32]; 154 quant_uw8[i + 1] = y_sorted[prob_idx_uw32];
154 } 155 }
155 156
156 delete [] y_sorted; 157 delete[] y_sorted;
157 y_sorted = NULL; 158 y_sorted = NULL;
158 159
159 // Shift history for new frame. 160 // Shift history for new frame.
160 memmove(quant_hist_uw8_[1], quant_hist_uw8_[0], 161 memmove(quant_hist_uw8_[1], quant_hist_uw8_[0],
161 (kFrameHistory_size - 1) * kNumQuants * sizeof(uint8_t)); 162 (kFrameHistory_size - 1) * kNumQuants * sizeof(uint8_t));
162 // Store current frame in history. 163 // Store current frame in history.
163 memcpy(quant_hist_uw8_[0], quant_uw8, kNumQuants * sizeof(uint8_t)); 164 memcpy(quant_hist_uw8_[0], quant_uw8, kNumQuants * sizeof(uint8_t));
164 165
165 // We use a frame memory equal to the ceiling of half the frame rate to 166 // We use a frame memory equal to the ceiling of half the frame rate to
166 // ensure we capture an entire period of flicker. 167 // ensure we capture an entire period of flicker.
167 frame_memory = (frame_rate_ + (1 << 5)) >> 5; // Unsigned ceiling. <Q0> 168 frame_memory = (frame_rate_ + (1 << 5)) >> 5; // Unsigned ceiling. <Q0>
168 // frame_rate_ in Q4. 169 // frame_rate_ in Q4.
169 if (frame_memory > kFrameHistory_size) { 170 if (frame_memory > kFrameHistory_size) {
170 frame_memory = kFrameHistory_size; 171 frame_memory = kFrameHistory_size;
171 } 172 }
(...skipping 11 matching lines...) Expand all
183 minquant_uw8[i] = quant_hist_uw8_[j][i]; 184 minquant_uw8[i] = quant_hist_uw8_[j][i];
184 } 185 }
185 } 186 }
186 } 187 }
187 188
188 // Get target quantiles. 189 // Get target quantiles.
189 for (int32_t i = 0; i < kNumQuants - kMaxOnlyLength; i++) { 190 for (int32_t i = 0; i < kNumQuants - kMaxOnlyLength; i++) {
190 // target = w * maxquant_uw8 + (1 - w) * minquant_uw8 191 // target = w * maxquant_uw8 + (1 - w) * minquant_uw8
191 // Weights w = |weight_uw16_| are in Q15, hence the final output has to be 192 // Weights w = |weight_uw16_| are in Q15, hence the final output has to be
192 // right shifted by 8 to end up in Q7. 193 // right shifted by 8 to end up in Q7.
193 target_quant_uw16[i] = static_cast<uint16_t>(( 194 target_quant_uw16[i] = static_cast<uint16_t>(
194 weight_uw16_[i] * maxquant_uw8[i] + 195 (weight_uw16_[i] * maxquant_uw8[i] +
195 ((1 << 15) - weight_uw16_[i]) * minquant_uw8[i]) >> 8); // <Q7> 196 ((1 << 15) - weight_uw16_[i]) * minquant_uw8[i]) >>
197 8); // <Q7>
196 } 198 }
197 199
198 for (int32_t i = kNumQuants - kMaxOnlyLength; i < kNumQuants; i++) { 200 for (int32_t i = kNumQuants - kMaxOnlyLength; i < kNumQuants; i++) {
199 target_quant_uw16[i] = ((uint16_t)maxquant_uw8[i]) << 7; 201 target_quant_uw16[i] = ((uint16_t)maxquant_uw8[i]) << 7;
200 } 202 }
201 203
202 // Compute the map from input to output pixels. 204 // Compute the map from input to output pixels.
203 uint16_t mapUW16; // <Q7> 205 uint16_t mapUW16; // <Q7>
204 for (int32_t i = 1; i < kNumQuants; i++) { 206 for (int32_t i = 1; i < kNumQuants; i++) {
205 // As quant and targetQuant are limited to UWord8, it's safe to use Q7 here. 207 // As quant and targetQuant are limited to UWord8, it's safe to use Q7 here.
206 tmp_uw32 = static_cast<uint32_t>(target_quant_uw16[i] - 208 tmp_uw32 =
207 target_quant_uw16[i - 1]); 209 static_cast<uint32_t>(target_quant_uw16[i] - target_quant_uw16[i - 1]);
208 tmp_uw16 = static_cast<uint16_t>(quant_uw8[i] - quant_uw8[i - 1]); // <Q0> 210 tmp_uw16 = static_cast<uint16_t>(quant_uw8[i] - quant_uw8[i - 1]); // <Q0>
209 211
210 if (tmp_uw16 > 0) { 212 if (tmp_uw16 > 0) {
211 increment_uw16 = static_cast<uint16_t>(WebRtcSpl_DivU32U16(tmp_uw32, 213 increment_uw16 =
212 tmp_uw16)); // <Q7> 214 static_cast<uint16_t>(WebRtcSpl_DivU32U16(tmp_uw32,
215 tmp_uw16)); // <Q7>
213 } else { 216 } else {
214 // The value is irrelevant; the loop below will only iterate once. 217 // The value is irrelevant; the loop below will only iterate once.
215 increment_uw16 = 0; 218 increment_uw16 = 0;
216 } 219 }
217 220
218 mapUW16 = target_quant_uw16[i - 1]; 221 mapUW16 = target_quant_uw16[i - 1];
219 for (uint32_t j = quant_uw8[i - 1]; j < (uint32_t)(quant_uw8[i] + 1); j++) { 222 for (uint32_t j = quant_uw8[i - 1]; j < (uint32_t)(quant_uw8[i] + 1); j++) {
220 // Unsigned round. <Q0> 223 // Unsigned round. <Q0>
221 map_uw8[j] = (uint8_t)((mapUW16 + (1 << 6)) >> 7); 224 map_uw8[j] = (uint8_t)((mapUW16 + (1 << 6)) >> 7);
222 mapUW16 += increment_uw16; 225 mapUW16 += increment_uw16;
(...skipping 17 matching lines...) Expand all
240 DetectFlicker(). 243 DetectFlicker().
241 244
242 \param[in] timestamp Timestamp of the current frame. 245 \param[in] timestamp Timestamp of the current frame.
243 \param[in] stats Statistics of the current frame. 246 \param[in] stats Statistics of the current frame.
244 247
245 \return 0: Success\n 248 \return 0: Success\n
246 2: Detection not possible due to flickering frequency too close to 249 2: Detection not possible due to flickering frequency too close to
247 zero.\n 250 zero.\n
248 -1: Error 251 -1: Error
249 */ 252 */
250 int32_t VPMDeflickering::PreDetection(const uint32_t timestamp, 253 int32_t VPMDeflickering::PreDetection(
251 const VideoProcessing::FrameStats& stats) { 254 const uint32_t timestamp,
255 const VideoProcessing::FrameStats& stats) {
252 int32_t mean_val; // Mean value of frame (Q4) 256 int32_t mean_val; // Mean value of frame (Q4)
253 uint32_t frame_rate = 0; 257 uint32_t frame_rate = 0;
254 int32_t meanBufferLength; // Temp variable. 258 int32_t meanBufferLength; // Temp variable.
255 259
256 mean_val = ((stats.sum << kmean_valueScaling) / stats.num_pixels); 260 mean_val = ((stats.sum << kmean_valueScaling) / stats.num_pixels);
257 // Update mean value buffer. 261 // Update mean value buffer.
258 // This should be done even though we might end up in an unreliable detection. 262 // This should be done even though we might end up in an unreliable detection.
259 memmove(mean_buffer_ + 1, mean_buffer_, 263 memmove(mean_buffer_ + 1, mean_buffer_,
260 (kMeanBufferLength - 1) * sizeof(int32_t)); 264 (kMeanBufferLength - 1) * sizeof(int32_t));
261 mean_buffer_[0] = mean_val; 265 mean_buffer_[0] = mean_val;
262 266
263 // Update timestamp buffer. 267 // Update timestamp buffer.
264 // This should be done even though we might end up in an unreliable detection. 268 // This should be done even though we might end up in an unreliable detection.
265 memmove(timestamp_buffer_ + 1, timestamp_buffer_, (kMeanBufferLength - 1) * 269 memmove(timestamp_buffer_ + 1, timestamp_buffer_,
266 sizeof(uint32_t)); 270 (kMeanBufferLength - 1) * sizeof(uint32_t));
267 timestamp_buffer_[0] = timestamp; 271 timestamp_buffer_[0] = timestamp;
268 272
269 /* Compute current frame rate (Q4) */ 273 /* Compute current frame rate (Q4) */
270 if (timestamp_buffer_[kMeanBufferLength - 1] != 0) { 274 if (timestamp_buffer_[kMeanBufferLength - 1] != 0) {
271 frame_rate = ((90000 << 4) * (kMeanBufferLength - 1)); 275 frame_rate = ((90000 << 4) * (kMeanBufferLength - 1));
272 frame_rate /= 276 frame_rate /=
273 (timestamp_buffer_[0] - timestamp_buffer_[kMeanBufferLength - 1]); 277 (timestamp_buffer_[0] - timestamp_buffer_[kMeanBufferLength - 1]);
274 } else if (timestamp_buffer_[1] != 0) { 278 } else if (timestamp_buffer_[1] != 0) {
275 frame_rate = (90000 << 4) / (timestamp_buffer_[0] - timestamp_buffer_[1]); 279 frame_rate = (90000 << 4) / (timestamp_buffer_[0] - timestamp_buffer_[1]);
276 } 280 }
277 281
278 /* Determine required size of mean value buffer (mean_buffer_length_) */ 282 /* Determine required size of mean value buffer (mean_buffer_length_) */
279 if (frame_rate == 0) { 283 if (frame_rate == 0) {
(...skipping 28 matching lines...) Expand all
308 /** 312 /**
309 This function detects flicker in the video stream. As a side effect the 313 This function detects flicker in the video stream. As a side effect the
310 mean value buffer is updated with the new mean value. 314 mean value buffer is updated with the new mean value.
311 315
312 \return 0: No flickering detected\n 316 \return 0: No flickering detected\n
313 1: Flickering detected\n 317 1: Flickering detected\n
314 2: Detection not possible due to unreliable frequency interval 318 2: Detection not possible due to unreliable frequency interval
315 -1: Error 319 -1: Error
316 */ 320 */
317 int32_t VPMDeflickering::DetectFlicker() { 321 int32_t VPMDeflickering::DetectFlicker() {
318 uint32_t i; 322 uint32_t i;
319 int32_t freqEst; // (Q4) Frequency estimate to base detection upon 323 int32_t freqEst; // (Q4) Frequency estimate to base detection upon
320 int32_t ret_val = -1; 324 int32_t ret_val = -1;
321 325
322 /* Sanity check for mean_buffer_length_ */ 326 /* Sanity check for mean_buffer_length_ */
323 if (mean_buffer_length_ < 2) { 327 if (mean_buffer_length_ < 2) {
324 /* Not possible to estimate frequency */ 328 /* Not possible to estimate frequency */
325 return(2); 329 return (2);
pbos-webrtc 2015/12/07 18:45:48 nit: remove ()s
mflodman 2015/12/08 05:59:06 Done.
326 } 330 }
327 // Count zero crossings with a dead zone to be robust against noise. If the 331 // Count zero crossings with a dead zone to be robust against noise. If the
328 // noise std is 2 pixel this corresponds to about 95% confidence interval. 332 // noise std is 2 pixel this corresponds to about 95% confidence interval.
329 int32_t deadzone = (kZeroCrossingDeadzone << kmean_valueScaling); // Q4 333 int32_t deadzone = (kZeroCrossingDeadzone << kmean_valueScaling); // Q4
330 int32_t meanOfBuffer = 0; // Mean value of mean value buffer. 334 int32_t meanOfBuffer = 0; // Mean value of mean value buffer.
331 int32_t numZeros = 0; // Number of zeros that cross the dead-zone. 335 int32_t numZeros = 0; // Number of zeros that cross the dead-zone.
332 int32_t cntState = 0; // State variable for zero crossing regions. 336 int32_t cntState = 0; // State variable for zero crossing regions.
333 int32_t cntStateOld = 0; // Previous state for zero crossing regions. 337 int32_t cntStateOld = 0; // Previous state for zero crossing regions.
334 338
335 for (i = 0; i < mean_buffer_length_; i++) { 339 for (i = 0; i < mean_buffer_length_; i++) {
336 meanOfBuffer += mean_buffer_[i]; 340 meanOfBuffer += mean_buffer_[i];
337 } 341 }
338 meanOfBuffer += (mean_buffer_length_ >> 1); // Rounding, not truncation. 342 meanOfBuffer += (mean_buffer_length_ >> 1); // Rounding, not truncation.
339 meanOfBuffer /= mean_buffer_length_; 343 meanOfBuffer /= mean_buffer_length_;
340 344
341 // Count zero crossings. 345 // Count zero crossings.
342 cntStateOld = (mean_buffer_[0] >= (meanOfBuffer + deadzone)); 346 cntStateOld = (mean_buffer_[0] >= (meanOfBuffer + deadzone));
343 cntStateOld -= (mean_buffer_[0] <= (meanOfBuffer - deadzone)); 347 cntStateOld -= (mean_buffer_[0] <= (meanOfBuffer - deadzone));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 ret_val = 1; 393 ret_val = 1;
390 } else if (freqState == 0) { 394 } else if (freqState == 0) {
391 ret_val = 2; 395 ret_val = 2;
392 } else { 396 } else {
393 ret_val = 0; 397 ret_val = 0;
394 } 398 }
395 return ret_val; 399 return ret_val;
396 } 400 }
397 401
398 } // namespace webrtc 402 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698