mozilla-bmo1511604.patch
branchfirefox69
changeset 1109 972f68ac6b1a
parent 1101 a4709640638e
equal deleted inserted replaced
1108:33b03cfb3747 1109:972f68ac6b1a
     1 # HG changeset patch
     1 # HG changeset patch
     2 # User A. Wilcox <AWilcox@Wilcox-Tech.com>
     2 # User A. Wilcox <AWilcox@Wilcox-Tech.com>
     3 # Date 1543674229 0
     3 # Date 1543674229 0
     4 #      Sat Dec 01 14:23:49 2018 +0000
     4 #      Sat Dec 01 14:23:49 2018 +0000
     5 # Node ID 0309ff19e46b126c527e633518d7de8570442114
     5 # Node ID 0309ff19e46b126c527e633518d7de8570442114
     6 # Parent  53107afbc21ec78e7ac46d37af212505f2032d5d
     6 # Parent  ba2c9b0542c95cc5ee26c264e8338fc9ba94c958
     7 Bug 1511604 - Swizzle YCbCr->RGB data on big-endian machines
     7 Bug 1511604 - Swizzle YCbCr->RGB data on big-endian machines
     8 Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1511604
     8 Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1511604
     9 
     9 
    10 This is very closely related to mozilla-bmo1504834
    10 This is very closely related to mozilla-bmo1504834
    11 
    11 
    12 Again, input for skia is swizzled to LE, as skia only understands LE.
    12 Again, input for skia is swizzled to LE, as skia only understands LE.
    13 
    13 
    14 diff -r 53107afbc21e -r 0309ff19e46b gfx/ycbcr/YCbCrUtils.cpp
    14 diff --git a/gfx/ycbcr/YCbCrUtils.cpp b/gfx/ycbcr/YCbCrUtils.cpp
    15 --- a/gfx/ycbcr/YCbCrUtils.cpp  Wed Nov 07 04:50:21 2018 +0000
    15 --- a/gfx/ycbcr/YCbCrUtils.cpp
    16 +++ b/gfx/ycbcr/YCbCrUtils.cpp  Sat Dec 01 14:23:49 2018 +0000
    16 +++ b/gfx/ycbcr/YCbCrUtils.cpp
    17 @@ -3,7 +3,9 @@
    17 @@ -1,14 +1,16 @@
       
    18  /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       
    19   * This Source Code Form is subject to the terms of the Mozilla Public
    18   * License, v. 2.0. If a copy of the MPL was not distributed with this
    20   * License, v. 2.0. If a copy of the MPL was not distributed with this
    19   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    21   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    20  
    22  
    21 +#include "mozilla/EndianUtils.h"
    23 +#include "mozilla/EndianUtils.h"
    22  #include "gfx2DGlue.h"
    24  #include "gfx2DGlue.h"
    23 +#include "mozilla/gfx/Swizzle.h"
    25 +#include "mozilla/gfx/Swizzle.h"
    24  
    26  
    25  #include "YCbCrUtils.h"
    27  #include "YCbCrUtils.h"
    26  #include "yuv_convert.h"
    28  #include "yuv_convert.h"
    27 @@ -236,6 +238,13 @@
    29  #include "ycbcr_to_rgb565.h"
       
    30  
       
    31  namespace mozilla {
       
    32  namespace gfx {
       
    33  
       
    34 @@ -231,16 +233,23 @@ ConvertYCbCrToRGB(const layers::PlanarYC
       
    35                            srcData.mPicSize.width,
       
    36                            srcData.mPicSize.height,
       
    37                            srcData.mYStride,
       
    38                            srcData.mCbCrStride,
       
    39                            aStride,
    28                            yuvtype,
    40                            yuvtype,
    29                            srcData.mYUVColorSpace);
    41                            srcData.mYUVColorSpace);
    30    }
    42    }
    31 +#ifdef MOZ_BIG_ENDIAN
    43 +#if MOZ_BIG_ENDIAN
    32 +  // libyuv makes endian-correct result, which needs to be swapped to BGRX
    44 +  // libyuv makes endian-correct result, which needs to be swapped to BGRX
    33 +  if (aDestFormat != SurfaceFormat::R5G6B5_UINT16)
    45 +  if (aDestFormat != SurfaceFormat::R5G6B5_UINT16)
    34 +    gfx::SwizzleData(aDestBuffer, aStride, gfx::SurfaceFormat::X8R8G8B8,
    46 +    gfx::SwizzleData(aDestBuffer, aStride, gfx::SurfaceFormat::X8R8G8B8,
    35 +                     aDestBuffer, aStride, gfx::SurfaceFormat::B8G8R8X8,
    47 +                     aDestBuffer, aStride, gfx::SurfaceFormat::B8G8R8X8,
    36 +                     srcData.mPicSize);
    48 +                     srcData.mPicSize);
    37 +#endif
    49 +#endif
    38  }
    50  }
    39  
    51  
    40  void
    52  void
    41 @@ -257,6 +266,12 @@
    53  ConvertYCbCrAToARGB(const uint8_t* aSrcY,
       
    54                      const uint8_t* aSrcU,
       
    55                      const uint8_t* aSrcV,
       
    56                      const uint8_t* aSrcA,
       
    57                      int aSrcStrideYA, int aSrcStrideUV,
       
    58 @@ -252,12 +261,18 @@ ConvertYCbCrAToARGB(const uint8_t* aSrcY
       
    59                          aSrcV,
       
    60                          aSrcA,
       
    61                          aDstARGB,
       
    62                          aWidth,
       
    63                          aHeight,
    42                          aSrcStrideYA,
    64                          aSrcStrideYA,
    43                          aSrcStrideUV,
    65                          aSrcStrideUV,
    44                          aDstStrideARGB);
    66                          aDstStrideARGB);
    45 +#ifdef MOZ_BIG_ENDIAN
    67 +#if MOZ_BIG_ENDIAN
    46 +  // libyuv makes endian-correct result, which needs to be swapped to BGRA
    68 +  // libyuv makes endian-correct result, which needs to be swapped to BGRA
    47 +  gfx::SwizzleData(aDstARGB, aDstStrideARGB, gfx::SurfaceFormat::A8R8G8B8,
    69 +  gfx::SwizzleData(aDstARGB, aDstStrideARGB, gfx::SurfaceFormat::A8R8G8B8,
    48 +                   aDstARGB, aDstStrideARGB, gfx::SurfaceFormat::B8G8R8A8,
    70 +                   aDstARGB, aDstStrideARGB, gfx::SurfaceFormat::B8G8R8A8,
    49 +                   IntSize(aWidth, aHeight));
    71 +                   IntSize(aWidth, aHeight));
    50 +#endif
    72 +#endif
    51  }
    73  }
    52  
    74  
    53  } // namespace gfx
    75  } // namespace gfx
    54 
    76  } // namespace mozilla