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

Side by Side Diff: webrtc/common_video/video_frame.cc

Issue 1578373003: Clean the code for external denoiser. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 16 matching lines...) Expand all
27 for (int y = 0; y < height; ++y) { 27 for (int y = 0; y < height; ++y) {
28 if (memcmp(data1, data2, width) != 0) 28 if (memcmp(data1, data2, width) != 0)
29 return false; 29 return false;
30 data1 += stride; 30 data1 += stride;
31 data2 += stride; 31 data2 += stride;
32 } 32 }
33 return true; 33 return true;
34 } 34 }
35 35
36 int ExpectedSize(int plane_stride, int image_height, PlaneType type) { 36 int ExpectedSize(int plane_stride, int image_height, PlaneType type) {
37 if (type == kYPlane) { 37 if (type == kYPlane)
38 return (plane_stride * image_height); 38 return plane_stride * image_height;
39 } else { 39 return plane_stride * (image_height + 1) / 2;
tommi 2016/01/13 09:45:10 hmm... is the failure caused by this change?
40 int half_height = (image_height + 1) / 2;
41 return (plane_stride * half_height);
42 }
43 } 40 }
44 41
45 VideoFrame::VideoFrame() { 42 VideoFrame::VideoFrame() {
46 // Intentionally using Reset instead of initializer list so that any missed 43 // Intentionally using Reset instead of initializer list so that any missed
47 // fields in Reset will be caught by memory checkers. 44 // fields in Reset will be caught by memory checkers.
48 Reset(); 45 Reset();
49 } 46 }
50 47
51 VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, 48 VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
52 uint32_t timestamp, 49 uint32_t timestamp,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 216
220 VideoFrame VideoFrame::ConvertNativeToI420Frame() const { 217 VideoFrame VideoFrame::ConvertNativeToI420Frame() const {
221 RTC_DCHECK(native_handle()); 218 RTC_DCHECK(native_handle());
222 VideoFrame frame; 219 VideoFrame frame;
223 frame.ShallowCopy(*this); 220 frame.ShallowCopy(*this);
224 frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer()); 221 frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer());
225 return frame; 222 return frame;
226 } 223 }
227 224
228 bool VideoFrame::EqualsFrame(const VideoFrame& frame) const { 225 bool VideoFrame::EqualsFrame(const VideoFrame& frame) const {
229 if ((this->width() != frame.width()) || (this->height() != frame.height()) || 226 if (width() != frame.width() || height() != frame.height() ||
230 (this->stride(kYPlane) != frame.stride(kYPlane)) || 227 stride(kYPlane) != frame.stride(kYPlane) ||
231 (this->stride(kUPlane) != frame.stride(kUPlane)) || 228 stride(kUPlane) != frame.stride(kUPlane) ||
232 (this->stride(kVPlane) != frame.stride(kVPlane)) || 229 stride(kVPlane) != frame.stride(kVPlane) ||
233 (this->timestamp() != frame.timestamp()) || 230 timestamp() != frame.timestamp() ||
234 (this->ntp_time_ms() != frame.ntp_time_ms()) || 231 ntp_time_ms() != frame.ntp_time_ms() ||
235 (this->render_time_ms() != frame.render_time_ms())) { 232 render_time_ms() != frame.render_time_ms()) {
236 return false; 233 return false;
237 } 234 }
238 const int half_width = (this->width() + 1) / 2; 235 const int half_width = (width() + 1) / 2;
239 const int half_height = (this->height() + 1) / 2; 236 const int half_height = (height() + 1) / 2;
240 return EqualPlane(this->buffer(kYPlane), frame.buffer(kYPlane), 237 return EqualPlane(buffer(kYPlane), frame.buffer(kYPlane),
241 this->stride(kYPlane), this->width(), this->height()) && 238 stride(kYPlane), width(), height()) &&
242 EqualPlane(this->buffer(kUPlane), frame.buffer(kUPlane), 239 EqualPlane(buffer(kUPlane), frame.buffer(kUPlane),
243 this->stride(kUPlane), half_width, half_height) && 240 stride(kUPlane), half_width, half_height) &&
244 EqualPlane(this->buffer(kVPlane), frame.buffer(kVPlane), 241 EqualPlane(buffer(kVPlane), frame.buffer(kVPlane),
245 this->stride(kVPlane), half_width, half_height); 242 stride(kVPlane), half_width, half_height);
246 } 243 }
247 244
248 } // namespace webrtc 245 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698