aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrYUVEffect.h
blob: 2ea41bf13cfa60c361d1693c60cfdce93a8ab18d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrYUVEffect_DEFINED
#define GrYUVEffect_DEFINED

#include "SkImageInfo.h"

class GrFragmentProcessor;
class GrTextureProxy;

namespace GrYUVEffect {
    /**
     * Creates an effect that performs color conversion from YUV to RGB. The input textures are
     * assumed to be kA8_GrPixelConfig.
     */
std::unique_ptr<GrFragmentProcessor> MakeYUVToRGB(sk_sp<GrTextureProxy> yProxy,
                                                  sk_sp<GrTextureProxy> uProxy,
                                                  sk_sp<GrTextureProxy> vProxy,
                                                  const SkISize sizes[3],
                                                  SkYUVColorSpace colorSpace, bool nv12);

/**
 * Creates a processor that performs color conversion from the passed in processor's RGB
 * channels to Y, U ,and V channels. The output color is (y, u, v, a) where a is the passed in
 * processor's alpha output.
 */
std::unique_ptr<GrFragmentProcessor> MakeRGBToYUV(std::unique_ptr<GrFragmentProcessor>,
                                                  SkYUVColorSpace);

/**
 * Creates a processor that performs color conversion from the passed in processor's RGB
 * channels to U and V channels. The output color is (u, v, 0, a) where a is the passed in
 * processor's alpha output.
 */
std::unique_ptr<GrFragmentProcessor> MakeRGBToUV(std::unique_ptr<GrFragmentProcessor>,
                                                 SkYUVColorSpace);
/**
 * Creates a processor that performs color conversion from the passed in fragment processors's
 * RGB channels to Y, U, or V (replicated across all four output color channels). The alpha
 * output of the passed in fragment processor is ignored.
 */
std::unique_ptr<GrFragmentProcessor> MakeRGBToY(std::unique_ptr<GrFragmentProcessor>,
                                                SkYUVColorSpace);
std::unique_ptr<GrFragmentProcessor> MakeRGBToU(std::unique_ptr<GrFragmentProcessor>,
                                                SkYUVColorSpace);
std::unique_ptr<GrFragmentProcessor> MakeRGBToV(std::unique_ptr<GrFragmentProcessor>,
                                                SkYUVColorSpace);
};

#endif