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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
#include "vl_data.h"
/*
* Represents 8 triangles (4 quads, 1 per block) in noormalized coords
* that render a macroblock.
* Need to be scaled to cover mbW*mbH macroblock pixels and translated into
* position on target surface.
*/
const struct VL_VERTEX2F vl_mb_vertex_positions[24] =
{
{0.0f, 0.0f}, {0.0f, 0.5f}, {0.5f, 0.0f},
{0.5f, 0.0f}, {0.0f, 0.5f}, {0.5f, 0.5f},
{0.5f, 0.0f}, {0.5f, 0.5f}, {1.0f, 0.0f},
{1.0f, 0.0f}, {0.5f, 0.5f}, {1.0f, 0.5f},
{0.0f, 0.5f}, {0.0f, 1.0f}, {0.5f, 0.5f},
{0.5f, 0.5f}, {0.0f, 1.0f}, {0.5f, 1.0f},
{0.5f, 0.5f}, {0.5f, 1.0f}, {1.0f, 0.5f},
{1.0f, 0.5f}, {0.5f, 1.0f}, {1.0f, 1.0f}
};
/*
* Represents texcoords for the above for rendering 4 luma blocks arranged
* in a bW*(bH*4) texture. First luma block located at 0,0->bW,bH; second at
* 0,bH->bW,2bH; third at 0,2bH->bW,3bH; fourth at 0,3bH->bW,4bH.
*/
const struct VL_TEXCOORD2F vl_luma_texcoords[24] =
{
{0.0f, 0.0f}, {0.0f, 0.25f}, {1.0f, 0.0f},
{1.0f, 0.0f}, {0.0f, 0.25f}, {1.0f, 0.25f},
{0.0f, 0.25f}, {0.0f, 0.5f}, {1.0f, 0.25f},
{1.0f, 0.25f}, {0.0f, 0.5f}, {1.0f, 0.5f},
{0.0f, 0.5f}, {0.0f, 0.75f}, {1.0f, 0.5f},
{1.0f, 0.5f}, {0.0f, 0.75f}, {1.0f, 0.75f},
{0.0f, 0.75f}, {0.0f, 1.0f}, {1.0f, 0.75f},
{1.0f, 0.75f}, {0.0f, 1.0f}, {1.0f, 1.0f}
};
/*
* Represents texcoords for the above for rendering 1 chroma block.
* Straight forward 0,0->1,1 mapping so we can reuse the MB pos vectors.
*/
const struct VL_TEXCOORD2F *vl_chroma_420_texcoords = (const struct VL_TEXCOORD2F*)vl_mb_vertex_positions;
/*
* Represents texcoords for the above for rendering 2 chroma blocks arranged
* in a bW*(bH*2) texture. First chroma block located at 0,0->bW,bH; second at
* 0,bH->bW,2bH. We can render this with 0,0->1,1 mapping.
* Straight forward 0,0->1,1 mapping so we can reuse MB pos vectors.
*/
const struct VL_TEXCOORD2F *vl_chroma_422_texcoords = (const struct VL_TEXCOORD2F*)vl_mb_vertex_positions;
/*
* Represents texcoords for the above for rendering 4 chroma blocks.
* Same case as 4 luma blocks.
*/
const struct VL_TEXCOORD2F *vl_chroma_444_texcoords = vl_luma_texcoords;
/*
* Represents 2 triangles in a strip in normalized coords.
* Used to render the surface onto the frame buffer.
*/
const struct VL_VERTEX2F vl_surface_vertex_positions[4] =
{
{0.0f, 0.0f},
{0.0f, 1.0f},
{1.0f, 0.0f},
{1.0f, 1.0f}
};
/*
* Represents texcoords for the above. We can use the position values directly.
*/
const struct VL_TEXCOORD2F *vl_surface_texcoords = (const struct VL_TEXCOORD2F*)vl_surface_vertex_positions;
/*
* Used when rendering P and B macroblocks, multiplier is applied to the A channel,
* which is then added to the L channel, then the bias is subtracted from that to
* get back the differential. The differential is then added to the samples from the
* reference surface(s).
*/
const struct VL_MC_FS_CONSTS vl_mc_fs_consts =
{
{256.0f, 256.0f, 256.0f, 0.0f},
{256.0f / 255.0f, 256.0f / 255.0f, 256.0f / 255.0f, 0.0f},
{0.5f, 2.0f, 0.0f, 0.0f}
};
/*
* Identity color conversion constants, for debugging
*/
const struct VL_CSC_FS_CONSTS vl_csc_fs_consts_identity =
{
{
0.0f, 0.0f, 0.0f, 0.0f
},
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
};
/*
* Converts ITU-R BT.601 YCbCr pixels to RGB pixels where:
* Y is in [16,235], Cb and Cr are in [16,240]
* R, G, and B are in [16,235]
*/
const struct VL_CSC_FS_CONSTS vl_csc_fs_consts_601 =
{
{
0.0f, 0.501960784f, 0.501960784f, 0.0f
},
{
1.0f, 0.0f, 1.371f, 0.0f,
1.0f, -0.336f, -0.698f, 0.0f,
1.0f, 1.732f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
};
/*
* Converts ITU-R BT.601 YCbCr pixels to RGB pixels where:
* Y is in [16,235], Cb and Cr are in [16,240]
* R, G, and B are in [0,255]
*/
const struct VL_CSC_FS_CONSTS vl_csc_fs_consts_601_full =
{
{
0.062745098f, 0.501960784f, 0.501960784f, 0.0f
},
{
1.164f, 0.0f, 1.596f, 0.0f,
1.164f, -0.391f, -0.813f, 0.0f,
1.164f, 2.018f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
};
/*
* Converts ITU-R BT.709 YCbCr pixels to RGB pixels where:
* Y is in [16,235], Cb and Cr are in [16,240]
* R, G, and B are in [16,235]
*/
const struct VL_CSC_FS_CONSTS vl_csc_fs_consts_709 =
{
{
0.0f, 0.501960784f, 0.501960784f, 0.0f
},
{
1.0f, 0.0f, 1.540f, 0.0f,
1.0f, -0.183f, -0.459f, 0.0f,
1.0f, 1.816f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
};
/*
* Converts ITU-R BT.709 YCbCr pixels to RGB pixels where:
* Y is in [16,235], Cb and Cr are in [16,240]
* R, G, and B are in [0,255]
*/
const struct VL_CSC_FS_CONSTS vl_csc_fs_consts_709_full =
{
{
0.062745098f, 0.501960784f, 0.501960784f, 0.0f
},
{
1.164f, 0.0f, 1.793f, 0.0f,
1.164f, -0.213f, -0.534f, 0.0f,
1.164f, 2.115f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}
};
|