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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 VideoFrame* out_frame = NULL; | 243 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; |
253 resampled_source_frame.CopyFrame(*out_frame); | 253 resampled_source_frame.ShallowCopy(*out_frame); |
254 // Compute PSNR against the cropped source frame and check expectation. | 254 // Compute PSNR against the cropped source frame and check expectation. |
255 PreprocessFrameAndVerify(resampled_source_frame, cropped_source.width(), | 255 PreprocessFrameAndVerify(resampled_source_frame, |
| 256 cropped_source.width(), |
256 cropped_source.height(), vpm, out_frame); | 257 cropped_source.height(), vpm, out_frame); |
257 WriteProcessedFrameForVisualInspection(resampled_source_frame, *out_frame); | 258 WriteProcessedFrameForVisualInspection(resampled_source_frame, *out_frame); |
258 | 259 |
259 // Compute PSNR against the cropped source frame and check expectation. | 260 // Compute PSNR against the cropped source frame and check expectation. |
260 double psnr = | 261 double psnr = |
261 I420PSNR(cropped_source, *out_frame->video_frame_buffer()); | 262 I420PSNR(cropped_source, *out_frame->video_frame_buffer()); |
262 EXPECT_GT(psnr, expected_psnr); | 263 EXPECT_GT(psnr, expected_psnr); |
263 printf( | 264 printf( |
264 "PSNR: %f. PSNR is between source of size %d %d, and a modified " | 265 "PSNR: %f. PSNR is between source of size %d %d, and a modified " |
265 "source which is scaled down/up to: %d %d, and back to source size \n", | 266 "source which is scaled down/up to: %d %d, and back to source size \n", |
(...skipping 14 matching lines...) Expand all Loading... |
280 std::cout << "Watch " << filename.str() << " and verify that it is okay." | 281 std::cout << "Watch " << filename.str() << " and verify that it is okay." |
281 << std::endl; | 282 << std::endl; |
282 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); | 283 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); |
283 if (PrintVideoFrame(processed, stand_alone_file) < 0) | 284 if (PrintVideoFrame(processed, stand_alone_file) < 0) |
284 std::cerr << "Failed to write: " << filename.str() << std::endl; | 285 std::cerr << "Failed to write: " << filename.str() << std::endl; |
285 if (stand_alone_file) | 286 if (stand_alone_file) |
286 fclose(stand_alone_file); | 287 fclose(stand_alone_file); |
287 } | 288 } |
288 | 289 |
289 } // namespace webrtc | 290 } // namespace webrtc |
OLD | NEW |