• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2015 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17header:
18summary: Conversion Functions
19description:
20 The functions below convert from a numerical vector type to another, or from one color
21 representation to another.
22end:
23
24function: convert_#3#1
25version: 9
26attrib: const
27w: 2, 3, 4
28t: u8, u16, u32, i8, i16, i32, f32
29t: u8, u16, u32, i8, i16, i32, f32
30ret: #3#1
31arg: #2#1 v, compatible(#3)
32summary: Convert numerical vectors
33description:
34 Converts a vector from one numerical type to another.  The conversion are done entry per entry.
35
36 E.g calling <code>a = convert_short3(b);</code> is equivalent to doing
37 <code>a.x = (short)b.x; a.y = (short)b.y; a.z = (short)b.z;</code>.
38
39 Converting floating point values to integer types truncates.
40
41 Converting numbers too large to fit the destination type yields undefined results.
42 For example, converting a float that contains 1.0e18 to a short is undefined.
43 Use @clamp() to avoid this.
44end:
45
46function: convert_#3#1
47version: 21
48attrib: const
49w: 2, 3, 4
50t: u64, i64, f64
51t: u64, i64, f64
52ret: #3#1
53arg: #2#1 v, compatible(#3)
54end:
55
56function: convert_#3#1
57version: 21
58attrib: const
59w: 2, 3, 4
60t: u64, i64, f64
61t: u8, u16, u32, i8, i16, i32, f32
62ret: #3#1
63arg: #2#1 v, compatible(#3)
64end:
65
66function: convert_#3#1
67version: 21
68attrib: const
69w: 2, 3, 4
70t: u8, u16, u32, i8, i16, i32, f32
71t: u64, i64, f64
72ret: #3#1
73arg: #2#1 v, compatible(#3)
74end:
75
76function: convert_#3#1
77version: 24
78attrib: const
79w: 2, 3, 4
80t: f16
81t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
82ret: #3#1
83arg: #2#1 v, compatible(#3)
84end:
85
86function: convert_#3#1
87version: 24
88attrib: const
89w: 2, 3, 4
90t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
91t: f16
92ret: #3#1
93arg: #2#1 v, compatible(#3)
94end:
95
96function: rsPackColorTo8888
97attrib: const
98ret: uchar4
99arg: float r, "Red component."
100arg: float g, "Green component."
101arg: float b, "Blue component."
102summary: Create a uchar4 RGBA from floats
103description:
104 Packs three or four floating point RGBA values into a uchar4.
105
106 The input values are typically between 0.0f and 1.0f inclusive.  For input values outside
107 of this range, the resulting outputs will be clamped to be between 0 and 255.  As this
108 clamping may be done after the input is multiplied by 255.f and converted to an integer,
109 input numbers greater than INT_MAX/255.f or less than INT_MIN/255.f result in
110 undefined behavior.
111
112 If the alpha component is not specified, it is assumed to be 1.0, i.e. the result will
113 have an alpha set to 255.
114test: none
115end:
116
117function: rsPackColorTo8888
118attrib: const
119ret: uchar4
120arg: float r
121arg: float g
122arg: float b
123arg: float a, "Alpha component."
124test: none
125end:
126
127function: rsPackColorTo8888
128attrib: const
129ret: uchar4
130arg: float3 color, "Vector of 3 or 4 floats containing the R, G, B, and A values."
131test: none
132end:
133
134function: rsPackColorTo8888
135attrib: const
136ret: uchar4
137arg: float4 color
138test: none
139end:
140
141function: rsUnpackColor8888
142# NOTE: The = below indicates that the generator should not add "overloadable" by default.
143# We're doing this to stay backward compatible with the unusual declaration used when this
144# function was introduced.
145attrib: =const
146ret: float4
147arg: uchar4 c
148summary: Create a float4 RGBA from uchar4
149description:
150 Unpacks a uchar4 color to float4.  The resulting floats will be between 0.0 and 1.0 inclusive.
151test: none
152end:
153
154function: rsYuvToRGBA_#2#1
155attrib: const
156w: 4
157t: u8, f32
158ret: #2#1
159arg: uchar y, "Luminance component."
160arg: uchar u, "U chrominance component."
161arg: uchar v, "V chrominance component."
162summary: Convert a YUV value to RGBA
163description:
164 Converts a color from a YUV representation to RGBA.
165
166 We currently don't provide a function to do the reverse conversion.
167test: none
168end:
169