History

lavfi/colorspace_common: add ifdef check to be more compatible.

Some filters may not need to do linearize/delinearize, thus will even not define them. Add ifdef check, so they could easily re-use the .cl file.

Ruiling Song committed 7 years ago

Commit b073fb91 parent 8b951cd1 file · +12 −2Browse files

Showing the changes to libavfilter/opencl (1 of 1 file). Show all

Unified · Split

libavfilter/opencl/colorspace_common.cl+12−2
@@ -124,10 +124,14 @@ float3 yuv2rgb(float y, float u, float v) { · 123 unmodified lines
124 124
125float3 yuv2lrgb(float3 yuv) {125float3 yuv2lrgb(float3 yuv) {
126 float3 rgb = yuv2rgb(yuv.x, yuv.y, yuv.z);126 float3 rgb = yuv2rgb(yuv.x, yuv.y, yuv.z);
127#ifdef linearize
127 float r = linearize(rgb.x);128 float r = linearize(rgb.x);
128 float g = linearize(rgb.y);129 float g = linearize(rgb.y);
129 float b = linearize(rgb.z);130 float b = linearize(rgb.z);
130 return (float3)(r, g, b);131 return (float3)(r, g, b);
132#else
133 return rgb;
134#endif
131}135}
132 136
133float3 rgb2yuv(float r, float g, float b) {137float3 rgb2yuv(float r, float g, float b) {
@@ -151,19 +155,25 @@ float rgb2y(float r, float g, float b) { · 17 unmodified lines
151}155}
152 156
153float3 lrgb2yuv(float3 c) {157float3 lrgb2yuv(float3 c) {
158#ifdef delinearize
154 float r = delinearize(c.x);159 float r = delinearize(c.x);
155 float g = delinearize(c.y);160 float g = delinearize(c.y);
156 float b = delinearize(c.z);161 float b = delinearize(c.z);
157
158 return rgb2yuv(r, g, b);162 return rgb2yuv(r, g, b);
163#else
164 return rgb2yuv(c.x, c.y, c.z);
165#endif
159}166}
160 167
161float lrgb2y(float3 c) {168float lrgb2y(float3 c) {
169#ifdef delinearize
162 float r = delinearize(c.x);170 float r = delinearize(c.x);
163 float g = delinearize(c.y);171 float g = delinearize(c.y);
164 float b = delinearize(c.z);172 float b = delinearize(c.z);
165
166 return rgb2y(r, g, b);173 return rgb2y(r, g, b);
174#else
175 return rgb2y(c.x, c.y, c.z);
176#endif
167}177}
168 178
169float3 lrgb2lrgb(float3 c) {179float3 lrgb2lrgb(float3 c) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t