gfx/ycbcr/yuv_convert.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/ycbcr/yuv_convert.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +// Copyright (c) 2010 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef MEDIA_BASE_YUV_CONVERT_H_
     1.9 +#define MEDIA_BASE_YUV_CONVERT_H_
    1.10 +
    1.11 +#include "chromium_types.h"
    1.12 +#include "gfxCore.h"
    1.13 +
    1.14 +namespace mozilla {
    1.15 +
    1.16 +namespace gfx {
    1.17 + 
    1.18 +// Type of YUV surface.
    1.19 +// The value of these enums matter as they are used to shift vertical indices.
    1.20 +enum YUVType {
    1.21 +  YV12 = 0,           // YV12 is half width and half height chroma channels.
    1.22 +  YV16 = 1,           // YV16 is half width and full height chroma channels.
    1.23 +  YV24 = 2            // YV24 is full width and full height chroma channels.
    1.24 +};
    1.25 +
    1.26 +// Mirror means flip the image horizontally, as in looking in a mirror.
    1.27 +// Rotate happens after mirroring.
    1.28 +enum Rotate {
    1.29 +  ROTATE_0,           // Rotation off.
    1.30 +  ROTATE_90,          // Rotate clockwise.
    1.31 +  ROTATE_180,         // Rotate upside down.
    1.32 +  ROTATE_270,         // Rotate counter clockwise.
    1.33 +  MIRROR_ROTATE_0,    // Mirror horizontally.
    1.34 +  MIRROR_ROTATE_90,   // Mirror then Rotate clockwise.
    1.35 +  MIRROR_ROTATE_180,  // Mirror vertically.
    1.36 +  MIRROR_ROTATE_270   // Transpose.
    1.37 +};
    1.38 +
    1.39 +// Filter affects how scaling looks.
    1.40 +enum ScaleFilter {
    1.41 +  FILTER_NONE = 0,        // No filter (point sampled).
    1.42 +  FILTER_BILINEAR_H = 1,  // Bilinear horizontal filter.
    1.43 +  FILTER_BILINEAR_V = 2,  // Bilinear vertical filter.
    1.44 +  FILTER_BILINEAR = 3     // Bilinear filter.
    1.45 +};
    1.46 +
    1.47 +NS_GFX_(YUVType) TypeFromSize(int ywidth, int yheight, int cbcrwidth, int cbcrheight);
    1.48 +
    1.49 +// Convert a frame of YUV to 32 bit ARGB.
    1.50 +// Pass in YV16/YV12 depending on source format
    1.51 +NS_GFX_(void) ConvertYCbCrToRGB32(const uint8* yplane,
    1.52 +                                  const uint8* uplane,
    1.53 +                                  const uint8* vplane,
    1.54 +                                  uint8* rgbframe,
    1.55 +                                  int pic_x,
    1.56 +                                  int pic_y,
    1.57 +                                  int pic_width,
    1.58 +                                  int pic_height,
    1.59 +                                  int ystride,
    1.60 +                                  int uvstride,
    1.61 +                                  int rgbstride,
    1.62 +                                  YUVType yuv_type);
    1.63 +
    1.64 +// Scale a frame of YUV to 32 bit ARGB.
    1.65 +// Supports rotation and mirroring.
    1.66 +NS_GFX_(void) ScaleYCbCrToRGB32(const uint8* yplane,
    1.67 +                                const uint8* uplane,
    1.68 +                                const uint8* vplane,
    1.69 +                                uint8* rgbframe,
    1.70 +                                int source_width,
    1.71 +                                int source_height,
    1.72 +                                int width,
    1.73 +                                int height,
    1.74 +                                int ystride,
    1.75 +                                int uvstride,
    1.76 +                                int rgbstride,
    1.77 +                                YUVType yuv_type,
    1.78 +                                Rotate view_rotate,
    1.79 +                                ScaleFilter filter);
    1.80 +
    1.81 +}  // namespace gfx
    1.82 +}  // namespace mozilla
    1.83 + 
    1.84 +#endif  // MEDIA_BASE_YUV_CONVERT_H_

mercurial