gpu: Add 4:4:4 to possible JPEG subsamplings in GPUInfo.

This CL adds 4:4:4 to the list of possible subsampling formats
advertised for hardware accelerated JPEG decoding in GPUInfo.

Test: None.
Bug: 868400
Change-Id: Id866e361321151f92549b58439d95c5da9407462
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1532824
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Auto-Submit: Andres Calderon Jaramillo <andrescj@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642940}
diff --git a/gpu/config/gpu_info.cc b/gpu/config/gpu_info.cc
index 7036b3a5..15e6b30 100644
--- a/gpu/config/gpu_info.cc
+++ b/gpu/config/gpu_info.cc
@@ -67,6 +67,8 @@
       return "4:2:0";
     case gpu::ImageDecodeAcceleratorSubsampling::k422:
       return "4:2:2";
+    case gpu::ImageDecodeAcceleratorSubsampling::k444:
+      return "4:4:4";
   }
 }
 
diff --git a/gpu/config/gpu_info.h b/gpu/config/gpu_info.h
index 37e29d2..15a2b8d 100644
--- a/gpu/config/gpu_info.h
+++ b/gpu/config/gpu_info.h
@@ -122,7 +122,8 @@
 enum class ImageDecodeAcceleratorSubsampling {
   k420 = 0,
   k422 = 1,
-  kMaxValue = k422,
+  k444 = 2,
+  kMaxValue = k444,
 };
 
 // Specification of an image decoding profile supported by a hardware decoder.
diff --git a/gpu/ipc/client/image_decode_accelerator_proxy.cc b/gpu/ipc/client/image_decode_accelerator_proxy.cc
index d992ee9..b6b35e6 100644
--- a/gpu/ipc/client/image_decode_accelerator_proxy.cc
+++ b/gpu/ipc/client/image_decode_accelerator_proxy.cc
@@ -47,7 +47,7 @@
 bool GetJpegSubsampling(const media::JpegParseResult& parse_result,
                         ImageDecodeAcceleratorSubsampling* subsampling) {
   static_assert(
-      static_cast<int>(ImageDecodeAcceleratorSubsampling::kMaxValue) == 1,
+      static_cast<int>(ImageDecodeAcceleratorSubsampling::kMaxValue) == 2,
       "GetJpegSubsampling() must be adapted to support all "
       "subsampling factors in ImageDecodeAcceleratorSubsampling");
 
@@ -69,17 +69,19 @@
   const uint8_t comp2_v =
       parse_result.frame_header.components[2].vertical_sampling_factor;
 
-  if (comp0_h == 2u && (comp1_h == 1u && comp1_v == 1u) &&
-      (comp2_h == 1u && comp2_v == 1u)) {
-    if (comp0_v == 2u) {
-      *subsampling = ImageDecodeAcceleratorSubsampling::k420;
-      return true;
-    } else if (comp0_v == 1u) {
-      *subsampling = ImageDecodeAcceleratorSubsampling::k422;
-      return true;
-    }
-  }
+  if (comp1_h != 1u || comp1_v != 1u || comp2_h == 1u || comp2_v == 1u)
+    return false;
 
+  if (comp0_h == 2u && comp0_v == 2u) {
+    *subsampling = ImageDecodeAcceleratorSubsampling::k420;
+    return true;
+  } else if (comp0_h == 2u && comp0_v == 1u) {
+    *subsampling = ImageDecodeAcceleratorSubsampling::k422;
+    return true;
+  } else if (comp0_h == 1u && comp0_v == 1u) {
+    *subsampling = ImageDecodeAcceleratorSubsampling::k444;
+    return true;
+  }
   return false;
 }
 
diff --git a/gpu/ipc/common/gpu_info.mojom b/gpu/ipc/common/gpu_info.mojom
index 9731c4d..252eb5f 100644
--- a/gpu/ipc/common/gpu_info.mojom
+++ b/gpu/ipc/common/gpu_info.mojom
@@ -86,6 +86,7 @@
 enum ImageDecodeAcceleratorSubsampling {
   k420,
   k422,
+  k444,
 };
 
 // gpu::ImageDecodeAcceleratorSupportedProfile
diff --git a/gpu/ipc/common/gpu_info_struct_traits.cc b/gpu/ipc/common/gpu_info_struct_traits.cc
index f17db0f..f86fbd3 100644
--- a/gpu/ipc/common/gpu_info_struct_traits.cc
+++ b/gpu/ipc/common/gpu_info_struct_traits.cc
@@ -259,6 +259,8 @@
       return gpu::mojom::ImageDecodeAcceleratorSubsampling::k420;
     case gpu::ImageDecodeAcceleratorSubsampling::k422:
       return gpu::mojom::ImageDecodeAcceleratorSubsampling::k422;
+    case gpu::ImageDecodeAcceleratorSubsampling::k444:
+      return gpu::mojom::ImageDecodeAcceleratorSubsampling::k444;
   }
 }
 
@@ -274,6 +276,9 @@
     case gpu::mojom::ImageDecodeAcceleratorSubsampling::k422:
       *out = gpu::ImageDecodeAcceleratorSubsampling::k422;
       return true;
+    case gpu::mojom::ImageDecodeAcceleratorSubsampling::k444:
+      *out = gpu::ImageDecodeAcceleratorSubsampling::k444;
+      return true;
   }
   NOTREACHED() << "Invalid ImageDecodeAcceleratorSubsampling: " << input;
   return false;