Bug 561385 - Fix YCbCr to RGB C fallback code. r=roc
authorChris Double <chris.double@double.co.nz>
Fri, 30 Apr 2010 15:04:22 +1200
changeset 41619 d349761ddc1e0bf20552269434ba21a244a938ba
parent 41618 bd072ff095af91ad712e36df693f71274aab9ff5
child 41620 1f467e996e30c79dad0031da2c9681b2f56566dc
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs561385
milestone1.9.3a5pre
Bug 561385 - Fix YCbCr to RGB C fallback code. r=roc
gfx/ycbcr/README
gfx/ycbcr/row_c_fix.patch
gfx/ycbcr/update.sh
gfx/ycbcr/yuv_row_c.cpp
layout/reftests/ogg-video/reftest.list
--- a/gfx/ycbcr/README
+++ b/gfx/ycbcr/README
@@ -13,8 +13,9 @@ convert.patch: Change Chromium code to b
 picture_region.patch: Change Chromium code to allow a picture region.
                       The YUV conversion will convert within this 
                       picture region only.
 
 remove_scale.patch: Removes Chromium scaling code.
 export.patch: Fix export for building on comm-central
 win64_mac64.patch: Fallback to C implementation on Windows and Mac OS X 64 bit
 yv24.patch: Adds YCbCr 4:4:4 support
+row_c_fix.patch: Fix broken C fallback code (See bug 561385).
new file mode 100644
--- /dev/null
+++ b/gfx/ycbcr/row_c_fix.patch
@@ -0,0 +1,23 @@
+diff --git a/gfx/ycbcr/yuv_row_c.cpp b/gfx/ycbcr/yuv_row_c.cpp
+index 36d9bda..b5c0018 100644
+--- a/gfx/ycbcr/yuv_row_c.cpp
++++ b/gfx/ycbcr/yuv_row_c.cpp
+@@ -142,17 +142,17 @@ static inline void YuvPixel(uint8 y,
+                             uint8* rgb_buf) {
+   int32 d = static_cast<int32>(u) - 128;
+   int32 e = static_cast<int32>(v) - 128;
+ 
+   int32 cb =   (516 * d + 128);
+   int32 cg = (- 100 * d - 208 * e + 128);
+   int32 cr =             (409 * e + 128);
+ 
+-  int32 C298a = ((static_cast<int32>(y) - 16) * 298 + 128);
++  int32 C298a = ((static_cast<int32>(y) - 16) * 298);
+   *reinterpret_cast<uint32*>(rgb_buf) = (clip(C298a + cb)) |
+                                         (clip(C298a + cg) << 8) |
+                                         (clip(C298a + cr) << 16) |
+                                         (0xff000000);
+ }
+ 
+ void FastConvertYUVToRGB32Row_C(const uint8* y_buf,
+                               const uint8* u_buf,
--- a/gfx/ycbcr/update.sh
+++ b/gfx/ycbcr/update.sh
@@ -7,8 +7,9 @@ cp $1/media/base/yuv_row_mac.cc yuv_row_
 cp $1/media/base/yuv_row_win.cc yuv_row_win.cpp
 cp $1/media/base/yuv_row_linux.cc yuv_row_c.cpp
 patch -p3 <convert.patch
 patch -p3 <picture_region.patch
 patch -p3 <remove_scale.patch
 patch -p3 <export.patch
 patch -p3 <win64_mac64.patch
 patch -p3 <yv24.patch
+patch -p3 <row_c_fix.patch
--- a/gfx/ycbcr/yuv_row_c.cpp
+++ b/gfx/ycbcr/yuv_row_c.cpp
@@ -142,17 +142,17 @@ static inline void YuvPixel(uint8 y,
                             uint8* rgb_buf) {
   int32 d = static_cast<int32>(u) - 128;
   int32 e = static_cast<int32>(v) - 128;
 
   int32 cb =   (516 * d + 128);
   int32 cg = (- 100 * d - 208 * e + 128);
   int32 cr =             (409 * e + 128);
 
-  int32 C298a = ((static_cast<int32>(y) - 16) * 298 + 128);
+  int32 C298a = ((static_cast<int32>(y) - 16) * 298);
   *reinterpret_cast<uint32*>(rgb_buf) = (clip(C298a + cb)) |
                                         (clip(C298a + cg) << 8) |
                                         (clip(C298a + cr) << 16) |
                                         (0xff000000);
 }
 
 void FastConvertYUVToRGB32Row_C(const uint8* y_buf,
                               const uint8* u_buf,
--- a/layout/reftests/ogg-video/reftest.list
+++ b/layout/reftests/ogg-video/reftest.list
@@ -11,17 +11,17 @@ HTTP(..) == canvas-1b.xhtml basic-1-ref.
 == clipping-1a.html clipping-1-ref.html
 == empty-1a.html empty-1-ref.html
 == empty-1b.html empty-1-ref.html
 random HTTP(..) == object-aspect-ratio-1a.xhtml aspect-ratio-1-ref.html
 random HTTP(..) == object-aspect-ratio-1b.xhtml aspect-ratio-1-ref.html
 HTTP(..) == offset-1.xhtml offset-1-ref.html
 random HTTP(..) == object-aspect-ratio-2a.xhtml aspect-ratio-2-ref.html
 random HTTP(..) == object-aspect-ratio-2b.xhtml aspect-ratio-2-ref.html
-fails-if(http.oscpu.match(/Mac\x20OS\x20X\x2010\.6$/)) skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == zoomed-1.xhtml zoomed-1-ref.html # Fails on 10.6, bug 561385
+skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == zoomed-1.xhtml zoomed-1-ref.html
 == poster-1.html poster-ref-blue250x200.html
 == poster-2.html poster-ref-black140x100.html
 == poster-3.html poster-ref-black140x100.html
 == poster-4.html poster-ref-black140x100.html
 == poster-5.html poster-ref-black140x100.html
 == poster-6.html poster-ref-black140x100.html
 == poster-7.html poster-ref-red160x120.html
 == poster-8.html poster-ref-black140x100.html