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

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

Issue 2990563002: Add Jpeg frame writer for test support. (Closed)
Patch Set: Implement Pbos@ comments 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
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 18 matching lines...) Expand all
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/format_macros.h" 36 #include "webrtc/rtc_base/format_macros.h"
37 #include "webrtc/rtc_base/memory_usage.h" 37 #include "webrtc/rtc_base/memory_usage.h"
38 #include "webrtc/rtc_base/optional.h" 38 #include "webrtc/rtc_base/optional.h"
39 #include "webrtc/rtc_base/pathutils.h"
39 #include "webrtc/rtc_base/platform_file.h" 40 #include "webrtc/rtc_base/platform_file.h"
40 #include "webrtc/rtc_base/timeutils.h" 41 #include "webrtc/rtc_base/timeutils.h"
41 #include "webrtc/system_wrappers/include/cpu_info.h" 42 #include "webrtc/system_wrappers/include/cpu_info.h"
42 #include "webrtc/system_wrappers/include/field_trial.h" 43 #include "webrtc/system_wrappers/include/field_trial.h"
43 #include "webrtc/test/gtest.h" 44 #include "webrtc/test/gtest.h"
44 #include "webrtc/test/layer_filtering_transport.h" 45 #include "webrtc/test/layer_filtering_transport.h"
45 #include "webrtc/test/run_loop.h" 46 #include "webrtc/test/run_loop.h"
46 #include "webrtc/test/statistics.h" 47 #include "webrtc/test/statistics.h"
47 #include "webrtc/test/testsupport/fileutils.h" 48 #include "webrtc/test/testsupport/fileutils.h"
48 #include "webrtc/test/testsupport/frame_writer.h" 49 #include "webrtc/test/testsupport/frame_writer.h"
50 #include "webrtc/test/testsupport/test_output.h"
49 #include "webrtc/test/vcm_capturer.h" 51 #include "webrtc/test/vcm_capturer.h"
50 #include "webrtc/test/video_renderer.h" 52 #include "webrtc/test/video_renderer.h"
51 #include "webrtc/voice_engine/include/voe_base.h" 53 #include "webrtc/voice_engine/include/voe_base.h"
52 54
53 #include "webrtc/test/rtp_file_writer.h" 55 #include "webrtc/test/rtp_file_writer.h"
54 56
55 namespace { 57 namespace {
56 58
57 constexpr int kSendStatsPollingIntervalMs = 1000; 59 constexpr int kSendStatsPollingIntervalMs = 1000;
58 60
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 dropped_frames_); 819 dropped_frames_);
818 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(), 820 printf("RESULT cpu_usage: %s = %lf %%\n", test_label_.c_str(),
819 GetCpuUsagePercent()); 821 GetCpuUsagePercent());
820 822
821 #if defined(WEBRTC_WIN) 823 #if defined(WEBRTC_WIN)
822 // On Linux and Mac in Resident Set some unused pages may be counted. 824 // On Linux and Mac in Resident Set some unused pages may be counted.
823 // Therefore this metric will depend on order in which tests are run and 825 // Therefore this metric will depend on order in which tests are run and
824 // will be flaky. 826 // will be flaky.
825 PrintResult("memory_usage", memory_usage_, " bytes"); 827 PrintResult("memory_usage", memory_usage_, " bytes");
826 #endif 828 #endif
827 // TODO(ilnik): enable frame writing for android, once jpeg frame writer
828 // is implemented.
829 829
830 #if !defined(WEBRTC_ANDROID) 830 // LibJpeg is not available on iOS.
831 #if !defined(WEBRTC_IOS)
832 // Saving only the worst frame for manual analysis. Intention here is to
833 // only detect video corruptions and not to track picture quality. Thus,
834 // jpeg is used here.
831 if (worst_frame_) { 835 if (worst_frame_) {
832 test::Y4mFrameWriterImpl frame_writer(test_label_ + ".y4m", 836 std::string output_dir;
833 worst_frame_->frame.width(), 837 if (!test::GetTestOutputDir(&output_dir)) {
834 worst_frame_->frame.height(), 1); 838 output_dir = "";
sprang_webrtc 2017/08/17 15:27:50 Should not write to file instead, if flag is not s
ilnik 2017/08/18 08:42:05 Currently it always outputs the worst frame. This
835 bool res = frame_writer.Init(); 839 }
836 RTC_DCHECK(res); 840 std::string output_path =
837 size_t length = 841 rtc::Pathname(output_dir, test_label_ + ".jpg").pathname();
838 CalcBufferSize(VideoType::kI420, worst_frame_->frame.width(), 842 fprintf(stderr, "Saving worst frame to %s\n", output_path.c_str());
sprang_webrtc 2017/08/17 15:27:50 use LOG macro instead
ilnik 2017/08/18 08:42:05 Done.
839 worst_frame_->frame.height()); 843 test::JpegFrameWriter frame_writer(output_path);
840 rtc::Buffer extracted_buffer(length); 844 RTC_CHECK(frame_writer.WriteFrame(worst_frame_->frame,
841 size_t extracted_length = 845 100 /*best quality*/));
842 ExtractBuffer(worst_frame_->frame.video_frame_buffer()->ToI420(),
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();
848 } 846 }
849 #endif 847 #endif
850 848
851 // Disable quality check for quick test, as quality checks may fail 849 // Disable quality check for quick test, as quality checks may fail
852 // because too few samples were collected. 850 // because too few samples were collected.
853 if (!is_quick_test_enabled_) { 851 if (!is_quick_test_enabled_) {
854 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); 852 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_);
855 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); 853 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_);
856 } 854 }
857 } 855 }
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 if (!params_.logging.encoded_frame_base_path.empty()) { 2117 if (!params_.logging.encoded_frame_base_path.empty()) {
2120 std::ostringstream str; 2118 std::ostringstream str;
2121 str << receive_logs_++; 2119 str << receive_logs_++;
2122 std::string path = 2120 std::string path =
2123 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 2121 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
2124 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 2122 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
2125 100000000); 2123 100000000);
2126 } 2124 }
2127 } 2125 }
2128 } // namespace webrtc 2126 } // namespace webrtc
OLDNEW
« webrtc/test/testsupport/jpeg_frame_writer.cc ('K') | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698