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

Side by Side Diff: webrtc/video/video_quality_test.cc

Issue 2998123002: Revert of Add Jpeg frame writer for test support.
Patch Set: Created 3 years, 4 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
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 #include "webrtc/video/video_quality_test.h" 10 #include "webrtc/video/video_quality_test.h"
(...skipping 15 matching lines...) Expand all
26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
31 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" 31 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
33 #include "webrtc/rtc_base/checks.h" 33 #include "webrtc/rtc_base/checks.h"
34 #include "webrtc/rtc_base/cpu_time.h" 34 #include "webrtc/rtc_base/cpu_time.h"
35 #include "webrtc/rtc_base/event.h" 35 #include "webrtc/rtc_base/event.h"
36 #include "webrtc/rtc_base/flags.h"
37 #include "webrtc/rtc_base/format_macros.h" 36 #include "webrtc/rtc_base/format_macros.h"
38 #include "webrtc/rtc_base/logging.h"
39 #include "webrtc/rtc_base/memory_usage.h" 37 #include "webrtc/rtc_base/memory_usage.h"
40 #include "webrtc/rtc_base/optional.h" 38 #include "webrtc/rtc_base/optional.h"
41 #include "webrtc/rtc_base/pathutils.h"
42 #include "webrtc/rtc_base/platform_file.h" 39 #include "webrtc/rtc_base/platform_file.h"
43 #include "webrtc/rtc_base/timeutils.h" 40 #include "webrtc/rtc_base/timeutils.h"
44 #include "webrtc/system_wrappers/include/cpu_info.h" 41 #include "webrtc/system_wrappers/include/cpu_info.h"
45 #include "webrtc/system_wrappers/include/field_trial.h" 42 #include "webrtc/system_wrappers/include/field_trial.h"
46 #include "webrtc/test/gtest.h" 43 #include "webrtc/test/gtest.h"
47 #include "webrtc/test/layer_filtering_transport.h" 44 #include "webrtc/test/layer_filtering_transport.h"
48 #include "webrtc/test/run_loop.h" 45 #include "webrtc/test/run_loop.h"
49 #include "webrtc/test/statistics.h" 46 #include "webrtc/test/statistics.h"
50 #include "webrtc/test/testsupport/fileutils.h" 47 #include "webrtc/test/testsupport/fileutils.h"
51 #include "webrtc/test/testsupport/frame_writer.h" 48 #include "webrtc/test/testsupport/frame_writer.h"
52 #include "webrtc/test/testsupport/test_output.h"
53 #include "webrtc/test/vcm_capturer.h" 49 #include "webrtc/test/vcm_capturer.h"
54 #include "webrtc/test/video_renderer.h" 50 #include "webrtc/test/video_renderer.h"
55 #include "webrtc/voice_engine/include/voe_base.h" 51 #include "webrtc/voice_engine/include/voe_base.h"
56 52
57 #include "webrtc/test/rtp_file_writer.h" 53 #include "webrtc/test/rtp_file_writer.h"
58 54
59 DEFINE_bool(save_worst_frame,
60 false,
61 "Enable saving a frame with the lowest PSNR to a jpeg file in the "
62 "test_output_dir");
63
64 namespace { 55 namespace {
65 56
66 constexpr int kSendStatsPollingIntervalMs = 1000; 57 constexpr int kSendStatsPollingIntervalMs = 1000;
67 58
68 constexpr size_t kMaxComparisons = 10; 59 constexpr size_t kMaxComparisons = 10;
69 constexpr char kSyncGroup[] = "av_sync"; 60 constexpr char kSyncGroup[] = "av_sync";
70 constexpr int kOpusMinBitrateBps = 6000; 61 constexpr int kOpusMinBitrateBps = 6000;
71 constexpr int kOpusBitrateFbBps = 32000; 62 constexpr int kOpusBitrateFbBps = 32000;
72 constexpr int kFramesSentInQuickTest = 1; 63 constexpr int kFramesSentInQuickTest = 1;
73 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000; 64 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 dropped_frames_); 817 dropped_frames_);
827 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), 818 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(),
828 GetCpuUsagePercent()); 819 GetCpuUsagePercent());
829 820
830 #if defined(WEBRTC_WIN) 821 #if defined(WEBRTC_WIN)
831 // On Linux and Mac in Resident Set some unused pages may be counted. 822 // On Linux and Mac in Resident Set some unused pages may be counted.
832 // Therefore this metric will depend on order in which tests are run and 823 // Therefore this metric will depend on order in which tests are run and
833 // will be flaky. 824 // will be flaky.
834 PrintResult("memory_usage", memory_usage_, " bytes"); 825 PrintResult("memory_usage", memory_usage_, " bytes");
835 #endif 826 #endif
827 // TODO(ilnik): enable frame writing for android, once jpeg frame writer
828 // is implemented.
836 829
837 // LibJpeg is not available on iOS. 830 #if !defined(WEBRTC_ANDROID)
838 #if !defined(WEBRTC_IOS) 831 if (worst_frame_) {
839 // Saving only the worst frame for manual analysis. Intention here is to 832 test::Y4mFrameWriterImpl frame_writer(test_label_ + ".y4m",
840 // only detect video corruptions and not to track picture quality. Thus, 833 worst_frame_->frame.width(),
841 // jpeg is used here. 834 worst_frame_->frame.height(), 1);
842 if (FLAG_save_worst_frame && worst_frame_) { 835 bool res = frame_writer.Init();
843 std::string output_dir; 836 RTC_DCHECK(res);
844 test::GetTestOutputDir(&output_dir); 837 size_t length =
845 std::string output_path = 838 CalcBufferSize(VideoType::kI420, worst_frame_->frame.width(),
846 rtc::Pathname(output_dir, test_label_ + ".jpg").pathname(); 839 worst_frame_->frame.height());
847 LOG(LS_INFO) << "Saving worst frame to " << output_path; 840 rtc::Buffer extracted_buffer(length);
848 test::JpegFrameWriter frame_writer(output_path); 841 size_t extracted_length =
849 RTC_CHECK(frame_writer.WriteFrame(worst_frame_->frame, 842 ExtractBuffer(worst_frame_->frame.video_frame_buffer()->ToI420(),
850 100 /*best quality*/)); 843 length, extracted_buffer.data());
844 RTC_DCHECK_EQ(extracted_length, frame_writer.FrameLength());
845 res = frame_writer.WriteFrame(extracted_buffer.data());
846 RTC_DCHECK(res);
847 frame_writer.Close();
851 } 848 }
852 #endif 849 #endif
853 850
854 // Disable quality check for quick test, as quality checks may fail 851 // Disable quality check for quick test, as quality checks may fail
855 // because too few samples were collected. 852 // because too few samples were collected.
856 if (!is_quick_test_enabled_) { 853 if (!is_quick_test_enabled_) {
857 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); 854 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_);
858 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); 855 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_);
859 } 856 }
860 } 857 }
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 if (!params_.logging.encoded_frame_base_path.empty()) { 2119 if (!params_.logging.encoded_frame_base_path.empty()) {
2123 std::ostringstream str; 2120 std::ostringstream str;
2124 str << receive_logs_++; 2121 str << receive_logs_++;
2125 std::string path = 2122 std::string path =
2126 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 2123 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
2127 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 2124 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
2128 100000000); 2125 100000000);
2129 } 2126 }
2130 } 2127 }
2131 } // namespace webrtc 2128 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698