OLD | NEW |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return nullptr; | 89 return nullptr; |
90 } | 90 } |
91 | 91 |
92 vd_->UpdateIncomingframe_rate(); | 92 vd_->UpdateIncomingframe_rate(); |
93 if (vd_->DropFrame()) { | 93 if (vd_->DropFrame()) { |
94 return nullptr; | 94 return nullptr; |
95 } | 95 } |
96 | 96 |
97 const VideoFrame* current_frame = &frame; | 97 const VideoFrame* current_frame = &frame; |
98 if (denoiser_) { | 98 if (denoiser_) { |
99 rtc::scoped_refptr<I420Buffer>* denoised_buffer = &denoised_buffer_[0]; | 99 rtc::scoped_refptr<I420Buffer>* denoised_frame = &denoised_buffer_[0]; |
100 rtc::scoped_refptr<I420Buffer>* denoised_buffer_prev = &denoised_buffer_[1]; | 100 rtc::scoped_refptr<I420Buffer>* denoised_frame_prev = &denoised_buffer_[1]; |
101 // Swap the buffer to save one memcpy in DenoiseFrame. | 101 // Swap the buffer to save one memcpy in DenoiseFrame. |
102 if (denoised_frame_toggle_) { | 102 if (denoised_frame_toggle_) { |
103 denoised_buffer = &denoised_buffer_[1]; | 103 denoised_frame = &denoised_buffer_[1]; |
104 denoised_buffer_prev = &denoised_buffer_[0]; | 104 denoised_frame_prev = &denoised_buffer_[0]; |
105 } | 105 } |
106 // Invert the flag. | 106 // Invert the flag. |
107 denoised_frame_toggle_ ^= 1; | 107 denoised_frame_toggle_ ^= 1; |
108 denoiser_->DenoiseFrame(current_frame->video_frame_buffer(), | 108 denoiser_->DenoiseFrame(current_frame->video_frame_buffer(), denoised_frame, |
109 denoised_buffer, | 109 denoised_frame_prev, true); |
110 denoised_buffer_prev, true); | 110 denoised_frame_.ShallowCopy(*current_frame); |
111 denoised_frame_ = VideoFrame(*denoised_buffer, | 111 denoised_frame_.set_video_frame_buffer(*denoised_frame); |
112 current_frame->timestamp(), | |
113 current_frame->render_time_ms(), | |
114 current_frame->rotation()); | |
115 current_frame = &denoised_frame_; | 112 current_frame = &denoised_frame_; |
116 } | 113 } |
117 | 114 |
118 if (spatial_resampler_->ApplyResample(current_frame->width(), | 115 if (spatial_resampler_->ApplyResample(current_frame->width(), |
119 current_frame->height())) { | 116 current_frame->height())) { |
120 if (spatial_resampler_->ResampleFrame(*current_frame, &resampled_frame_) != | 117 if (spatial_resampler_->ResampleFrame(*current_frame, &resampled_frame_) != |
121 VPM_OK) { | 118 VPM_OK) { |
122 return nullptr; | 119 return nullptr; |
123 } | 120 } |
124 current_frame = &resampled_frame_; | 121 current_frame = &resampled_frame_; |
125 } | 122 } |
126 | 123 |
127 ++frame_cnt_; | 124 ++frame_cnt_; |
128 return current_frame; | 125 return current_frame; |
129 } | 126 } |
130 | 127 |
131 } // namespace webrtc | 128 } // namespace webrtc |
OLD | NEW |