Add tool for aligning color space of video files

This class adds logic for aligning color space of a test video compared
to a reference video. If there is a color space mismatch, it typically
does not have much impact on human perception, but it has a big impact
on PSNR and SSIM calculations. For example, aligning a test run with VP8
improves PSNR and SSIM from:
Average PSNR: 29.142818, average SSIM: 0.946026
to:
Average PSNR: 38.146229, average SSIM: 0.965388.

The optiomal color transformation between the two videos were:
0.86 0.01 0.00 14.37
0.00 0.88 0.00 15.32
0.00 0.00 0.88 15.74
which is converting YUV full range to YUV limited range. There is
already a CL out for fixing this discrepancy here:
https://webrtc-review.googlesource.com/c/src/+/94543

After that, hopefully there is no color space mismatch when saving the
raw YUV values. It's good that the video quality tool is color space
agnostic anyway, and can compensate for differences when the test
video is obtained by e.g. filming a physical device screen.

Also, the linear least square logic will be used for compensating
geometric distorisions in a follow-up CL.

Bug: webrtc:9642
Change-Id: I499713960a0544d8e45c5d09886e68ec829b28a7
Reviewed-on: https://webrtc-review.googlesource.com/c/95950
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25193}
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index c0716b4..3d9804c 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -86,6 +86,10 @@
 
 rtc_static_library("video_quality_analysis") {
   sources = [
+    "frame_analyzer/linear_least_squares.cc",
+    "frame_analyzer/linear_least_squares.h",
+    "frame_analyzer/video_color_aligner.cc",
+    "frame_analyzer/video_color_aligner.h",
     "frame_analyzer/video_quality_analysis.cc",
     "frame_analyzer/video_quality_analysis.h",
     "frame_analyzer/video_temporal_aligner.cc",
@@ -93,6 +97,7 @@
   ]
   deps = [
     ":video_file_reader",
+    "../api:array_view",
     "../api/video:video_frame_i420",
     "../common_video",
     "../rtc_base:checks",
@@ -333,7 +338,9 @@
     testonly = true
 
     sources = [
+      "frame_analyzer/linear_least_squares_unittest.cc",
       "frame_analyzer/reference_less_video_analysis_unittest.cc",
+      "frame_analyzer/video_color_aligner_unittest.cc",
       "frame_analyzer/video_quality_analysis_unittest.cc",
       "frame_analyzer/video_temporal_aligner_unittest.cc",
       "frame_editing/frame_editing_unittest.cc",
@@ -363,6 +370,7 @@
       "//test:test_support",
       "//testing/gtest",
       "//third_party/abseil-cpp/absl/memory",
+      "//third_party/libyuv",
     ]
 
     if (rtc_enable_protobuf) {