summaryrefslogtreecommitdiff
path: root/avstream/avscamera/sys/YUY2Synthesizer.h
blob: a304fb43a356ed175d804612444923235b752e2a (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
56
57
58
59
60
61
62
63
64
65
66
67
68
/**************************************************************************

    A/V Stream Camera Sample

    Copyright (c) 2014, Microsoft Corporation.

    File:

        YUY2Synthesizer.h

    Abstract:

        This file contains the definition of CYUY2Synthesizer.

        CYUY2Synthesizer is derived from CYUVSynthesizer.  An image 
        synthesizer for YUY2 format.  It uses the YUV color space and defines 
        a Commit() function.
        
        YUY2 is a 4:2:2 format that uses a single plane that decimates chroma 
        samples on the x axis with an effective bit rate of 16 bits per pixel.
        A plane is an array of rows.  Rows consist of pairs of pixels in the 
        sequence: Y0|U|Y1|V.

        The synthesizer stores the YUV information in 32 bit format internally
        for speed, accuracy and simplicity.  The Commit function does the 
        format conversion.

    History:

        created 4/14/2014

**************************************************************************/

class CYUY2Synthesizer : public CYUVSynthesizer
{
public:
    //
    // DEFAULT CONSTRUCTOR
    //
    CYUY2Synthesizer (
        ULONG Width=0,
        ULONG Height=0
    ) :
        CYUVSynthesizer("YUY2", Width, Height)
    {
        NT_ASSERT( ( Width % 2 ) == 0 );
        m_OutputStride = Width * sizeof(WORD);
    }

    //
    //  Commit
    //
    //  Copy (and reformat, if necessary) pixels from the internal scratch
    //  buffer.  If the output format decimates chrominance, do it here.
    //
    virtual
    _Success_(return > 0)
    ULONG
    Commit(
        _Out_writes_bytes_(Size)
        PUCHAR  Buffer,
        _In_    ULONG   Size,
        _In_    ULONG   Stride
    );

};