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 VideoFrame* denoised_frame = &denoised_frame_[0]; | 99 rtc::scoped_refptr<I420Buffer>* denoised_frame = &denoised_buffer_[0]; |
100 VideoFrame* denoised_frame_prev = &denoised_frame_[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_frame = &denoised_frame_[1]; | 103 denoised_frame = &denoised_buffer_[1]; |
104 denoised_frame_prev = &denoised_frame_[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, denoised_frame, denoised_frame_prev, | 108 denoiser_->DenoiseFrame(current_frame->video_frame_buffer(), denoised_frame, |
109 true); | 109 denoised_frame_prev, true); |
110 current_frame = denoised_frame; | 110 denoised_frame_.ShallowCopy(*current_frame); |
| 111 denoised_frame_.set_video_frame_buffer(*denoised_frame); |
| 112 current_frame = &denoised_frame_; |
111 } | 113 } |
112 | 114 |
113 if (spatial_resampler_->ApplyResample(current_frame->width(), | 115 if (spatial_resampler_->ApplyResample(current_frame->width(), |
114 current_frame->height())) { | 116 current_frame->height())) { |
115 if (spatial_resampler_->ResampleFrame(*current_frame, &resampled_frame_) != | 117 if (spatial_resampler_->ResampleFrame(*current_frame, &resampled_frame_) != |
116 VPM_OK) { | 118 VPM_OK) { |
117 return nullptr; | 119 return nullptr; |
118 } | 120 } |
119 current_frame = &resampled_frame_; | 121 current_frame = &resampled_frame_; |
120 } | 122 } |
121 | 123 |
122 ++frame_cnt_; | 124 ++frame_cnt_; |
123 return current_frame; | 125 return current_frame; |
124 } | 126 } |
125 | 127 |
126 } // namespace webrtc | 128 } // namespace webrtc |
OLD | NEW |