Bug 1341543: don't use internal-only I4xxToARGBMatrix() functions from libyuv r=sotaro
authorRandell Jesup <rjesup@jesup.org>
Fri, 24 Feb 2017 14:01:56 -0500
changeset 373836 b21f4e412b6667a67d257cf52618c848ad06d8de
parent 373835 558258e4712afe8272ea73a705876cd34a6c48f7
child 373837 ea1dda72c26d426d8b474af394455a3b44ac6837
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1341543
milestone54.0a1
Bug 1341543: don't use internal-only I4xxToARGBMatrix() functions from libyuv r=sotaro MozReview-Commit-ID: H0o6ufAlnGx
gfx/ycbcr/yuv_convert.cpp
--- a/gfx/ycbcr/yuv_convert.cpp
+++ b/gfx/ycbcr/yuv_convert.cpp
@@ -97,57 +97,74 @@ void ConvertYCbCrToRGB32(const uint8* y_
   }
   if (use_deprecated) {
     ConvertYCbCrToRGB32_deprecated(y_buf, u_buf, v_buf, rgb_buf,
                                    pic_x, pic_y, pic_width, pic_height,
                                    y_pitch, uv_pitch, rgb_pitch, yuv_type);
     return;
   }
 
-  libyuv::YuvConstants* yuvconstants = nullptr;
-  if (yuv_color_space == mozilla::YUVColorSpace::BT709) {
-    yuvconstants = const_cast<libyuv::YuvConstants*>(&libyuv::kYuvH709Constants);
-  } else {
-    yuvconstants = const_cast<libyuv::YuvConstants*>(&libyuv::kYuvI601Constants);
-  }
-                                    
   if (yuv_type == YV24) {
     const uint8* src_y = y_buf + y_pitch * pic_y + pic_x;
     const uint8* src_u = u_buf + uv_pitch * pic_y + pic_x;
     const uint8* src_v = v_buf + uv_pitch * pic_y + pic_x;
-    DebugOnly<int> err = libyuv::I444ToARGBMatrix(src_y, y_pitch,
-                                                  src_u, uv_pitch,
-                                                  src_v, uv_pitch,
-                                                  rgb_buf, rgb_pitch,
-                                                  yuvconstants,
-                                                  pic_width, pic_height);
-    MOZ_ASSERT(!err);
+    if (yuv_color_space == mozilla::YUVColorSpace::BT709) {
+      DebugOnly<int> err = libyuv::H444ToARGB(src_y, y_pitch,
+                                              src_u, uv_pitch,
+                                              src_v, uv_pitch,
+                                              rgb_buf, rgb_pitch,
+                                              pic_width, pic_height);
+      MOZ_ASSERT(!err);
+    } else {
+      DebugOnly<int> err = libyuv::I444ToARGB(src_y, y_pitch,
+                                              src_u, uv_pitch,
+                                              src_v, uv_pitch,
+                                              rgb_buf, rgb_pitch,
+                                              pic_width, pic_height);
+      MOZ_ASSERT(!err);
+    }
   } else if (yuv_type == YV16) {
     const uint8* src_y = y_buf + y_pitch * pic_y + pic_x;
     const uint8* src_u = u_buf + uv_pitch * pic_y + pic_x / 2;
     const uint8* src_v = v_buf + uv_pitch * pic_y + pic_x / 2;
-    DebugOnly<int> err = libyuv::I422ToARGBMatrix(src_y, y_pitch,
-                                                  src_u, uv_pitch,
-                                                  src_v, uv_pitch,
-                                                  rgb_buf, rgb_pitch,
-                                                  yuvconstants,
-                                                  pic_width, pic_height);
-    MOZ_ASSERT(!err);
+    if (yuv_color_space == mozilla::YUVColorSpace::BT709) {
+      DebugOnly<int> err = libyuv::H422ToARGB(src_y, y_pitch,
+                                              src_u, uv_pitch,
+                                              src_v, uv_pitch,
+                                              rgb_buf, rgb_pitch,
+                                              pic_width, pic_height);
+      MOZ_ASSERT(!err);
+    } else {
+      DebugOnly<int> err = libyuv::I422ToARGB(src_y, y_pitch,
+                                              src_u, uv_pitch,
+                                              src_v, uv_pitch,
+                                              rgb_buf, rgb_pitch,
+                                              pic_width, pic_height);
+      MOZ_ASSERT(!err);
+    }
   } else {
     MOZ_ASSERT(yuv_type == YV12);
     const uint8* src_y = y_buf + y_pitch * pic_y + pic_x;
     const uint8* src_u = u_buf + (uv_pitch * pic_y + pic_x) / 2;
     const uint8* src_v = v_buf + (uv_pitch * pic_y + pic_x) / 2;
-    DebugOnly<int> err = libyuv::I420ToARGBMatrix(src_y, y_pitch,
-                                                  src_u, uv_pitch,
-                                                  src_v, uv_pitch,
-                                                  rgb_buf, rgb_pitch,
-                                                  yuvconstants,
-                                                  pic_width, pic_height);
-    MOZ_ASSERT(!err);
+    if (yuv_color_space == mozilla::YUVColorSpace::BT709) {
+      DebugOnly<int> err = libyuv::H420ToARGB(src_y, y_pitch,
+                                              src_u, uv_pitch,
+                                              src_v, uv_pitch,
+                                              rgb_buf, rgb_pitch,
+                                              pic_width, pic_height);
+      MOZ_ASSERT(!err);
+    } else {
+      DebugOnly<int> err = libyuv::I420ToARGB(src_y, y_pitch,
+                                              src_u, uv_pitch,
+                                              src_v, uv_pitch,
+                                              rgb_buf, rgb_pitch,
+                                              pic_width, pic_height);
+      MOZ_ASSERT(!err);
+    }
   }
 }
 
 // Convert a frame of YUV to 32 bit ARGB.
 void ConvertYCbCrToRGB32_deprecated(const uint8* y_buf,
                                     const uint8* u_buf,
                                     const uint8* v_buf,
                                     uint8* rgb_buf,