From 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Mon Sep 17 00:00:00 2001 From: Magnus Jedvert Date: Fri, 24 Aug 2018 14:56:03 +0200 Subject: [PATCH] Reland "Update video_quality_analysis to align videos instead of using barcodes" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it won't automatically pick up change to the source file. Therefore, restore all old code to be backwards compatible. Original change's description: > Update video_quality_analysis to align videos instead of using barcodes > > This CL is a follow-up to the previous CL > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > logic for aligning videos. This will allow us to easily extend > video_quality_analysis with new sophisticated video quality metrics. > Also, we can use any kind of video that does not necessarily need to > contain bar codes. Removing the need to decode barcodes also leads to a > big speedup for the tests. > > Bug: webrtc:9642 > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > Reviewed-on: https://webrtc-review.googlesource.com/94845 > Reviewed-by: Paulina Hensman > Reviewed-by: Patrik Höglund > Commit-Queue: Magnus Jedvert > Cr-Commit-Position: refs/heads/master@{#24423} TBR=phensman@webrtc.org,phoglund@webrtc.org Bug: webrtc:9642 Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 Reviewed-on: https://webrtc-review.googlesource.com/96000 Reviewed-by: Magnus Jedvert Reviewed-by: Patrik Höglund Commit-Queue: Magnus Jedvert Cr-Commit-Position: refs/heads/master@{#24429} --- .../video_quality_loopback_test.py | 13 +- rtc_tools/frame_analyzer/frame_analyzer.cc | 65 ++-- .../frame_analyzer/video_quality_analysis.cc | 322 +++--------------- .../frame_analyzer/video_quality_analysis.h | 78 ++--- .../video_quality_analysis_unittest.cc | 224 ++---------- 5 files changed, 133 insertions(+), 569 deletions(-) diff --git a/examples/androidtests/video_quality_loopback_test.py b/examples/androidtests/video_quality_loopback_test.py index 225f885273..52ae3b1f6f 100755 --- a/examples/androidtests/video_quality_loopback_test.py +++ b/examples/androidtests/video_quality_loopback_test.py @@ -165,8 +165,6 @@ def SetUpTools(android_device, temp_dir, processes): def RunTest(android_device, adb_path, build_dir, temp_dir, num_retries, chartjson_result_file): ffmpeg_path = os.path.join(TOOLCHAIN_DIR, 'ffmpeg') - def ConvertVideo(input_video, output_video): - _RunCommand([ffmpeg_path, '-y', '-i', input_video, output_video]) # Start loopback call and record video. test_script = os.path.join( @@ -183,13 +181,6 @@ def RunTest(android_device, adb_path, build_dir, temp_dir, num_retries, reference_video = os.path.join(SRC_DIR, 'resources', 'reference_video_640x360_30fps.y4m') - test_video_yuv = os.path.join(temp_dir, 'test_video.yuv') - reference_video_yuv = os.path.join( - temp_dir, 'reference_video_640x360_30fps.yuv') - - ConvertVideo(test_video, test_video_yuv) - ConvertVideo(reference_video, reference_video_yuv) - # Run comparison script. compare_script = os.path.join(SRC_DIR, 'rtc_tools', 'compare_videos.py') frame_analyzer = os.path.join(TOOLCHAIN_DIR, 'frame_analyzer') @@ -198,8 +189,8 @@ def RunTest(android_device, adb_path, build_dir, temp_dir, num_retries, stats_file_test = os.path.join(temp_dir, 'stats_test.txt') args = [ - '--ref_video', reference_video_yuv, - '--test_video', test_video_yuv, + '--ref_video', reference_video, + '--test_video', test_video, '--yuv_frame_width', '640', '--yuv_frame_height', '360', '--stats_file_ref', stats_file_ref, diff --git a/rtc_tools/frame_analyzer/frame_analyzer.cc b/rtc_tools/frame_analyzer/frame_analyzer.cc index f5a9c2b827..443a8681a7 100644 --- a/rtc_tools/frame_analyzer/frame_analyzer.cc +++ b/rtc_tools/frame_analyzer/frame_analyzer.cc @@ -16,6 +16,7 @@ #include #include "rtc_tools/frame_analyzer/video_quality_analysis.h" +#include "rtc_tools/frame_analyzer/video_temporal_aligner.h" #include "rtc_tools/simple_command_line_parser.h" #include "rtc_tools/y4m_file_reader.h" #include "test/testsupport/perf_test.h" @@ -24,12 +25,7 @@ * A command line tool running PSNR and SSIM on a reference video and a test * video. The test video is a record of the reference video which can start at * an arbitrary point. It is possible that there will be repeated frames or - * skipped frames as well. In order to have a way to compare corresponding - * frames from the two videos, two stats files should be provided. One for the - * reference video and one for the test video. The stats file - * is a text file assumed to be in the format: - * frame_xxxx yyyy where xxxx is the frame number in and yyyy is the - * corresponding barcode. The video files should be 1420 YUV videos. + * skipped frames as well. The video files should be 1420 Y4M videos. * The tool prints the result to standard output in the Chromium perf format: * RESULT :