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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Resample source_frame to out_frame. | 242 // Resample source_frame to out_frame. |
243 const VideoFrame* out_frame = NULL; | 243 const VideoFrame* out_frame = NULL; |
244 vpm->SetInputFrameResampleMode(kBox); | 244 vpm->SetInputFrameResampleMode(kBox); |
245 PreprocessFrameAndVerify(source_frame, target_width, target_height, vpm, | 245 PreprocessFrameAndVerify(source_frame, target_width, target_height, vpm, |
246 &out_frame); | 246 &out_frame); |
247 if (out_frame == NULL) | 247 if (out_frame == NULL) |
248 return; | 248 return; |
249 WriteProcessedFrameForVisualInspection(source_frame, *out_frame); | 249 WriteProcessedFrameForVisualInspection(source_frame, *out_frame); |
250 | 250 |
251 // Scale |resampled_source_frame| back to the source scale. | 251 // Scale |resampled_source_frame| back to the source scale. |
252 VideoFrame resampled_source_frame; | 252 VideoFrame resampled_source_frame(*out_frame); |
253 resampled_source_frame.ShallowCopy(*out_frame); | |
254 // Compute PSNR against the cropped source frame and check expectation. | 253 // Compute PSNR against the cropped source frame and check expectation. |
255 PreprocessFrameAndVerify(resampled_source_frame, | 254 PreprocessFrameAndVerify(resampled_source_frame, |
256 cropped_source.width(), | 255 cropped_source.width(), |
257 cropped_source.height(), vpm, &out_frame); | 256 cropped_source.height(), vpm, &out_frame); |
258 WriteProcessedFrameForVisualInspection(resampled_source_frame, *out_frame); | 257 WriteProcessedFrameForVisualInspection(resampled_source_frame, *out_frame); |
259 | 258 |
260 // Compute PSNR against the cropped source frame and check expectation. | 259 // Compute PSNR against the cropped source frame and check expectation. |
261 double psnr = | 260 double psnr = |
262 I420PSNR(cropped_source, *out_frame->video_frame_buffer()); | 261 I420PSNR(cropped_source, *out_frame->video_frame_buffer()); |
263 EXPECT_GT(psnr, expected_psnr); | 262 EXPECT_GT(psnr, expected_psnr); |
(...skipping 17 matching lines...) Expand all Loading... |
281 std::cout << "Watch " << filename.str() << " and verify that it is okay." | 280 std::cout << "Watch " << filename.str() << " and verify that it is okay." |
282 << std::endl; | 281 << std::endl; |
283 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); | 282 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); |
284 if (PrintVideoFrame(processed, stand_alone_file) < 0) | 283 if (PrintVideoFrame(processed, stand_alone_file) < 0) |
285 std::cerr << "Failed to write: " << filename.str() << std::endl; | 284 std::cerr << "Failed to write: " << filename.str() << std::endl; |
286 if (stand_alone_file) | 285 if (stand_alone_file) |
287 fclose(stand_alone_file); | 286 fclose(stand_alone_file); |
288 } | 287 } |
289 | 288 |
290 } // namespace webrtc | 289 } // namespace webrtc |
OLD | NEW |