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
124124
125125 float3 yuv2lrgb(float3 yuv) {
126126 float3 rgb = yuv2rgb(yuv.x, yuv.y, yuv.z);
127+#ifdef linearize
127128 float r = linearize(rgb.x);
128129 float g = linearize(rgb.y);
129130 float b = linearize(rgb.z);
130131 return (float3)(r, g, b);
132+#else
133+ return rgb;
134+#endif
131135 }
132136
133137 float3 rgb2yuv(float r, float g, float b) {
@@ -151,19 +155,25 @@ float rgb2y(float r, float g, float b) { · 17 unmodified lines
151155 }
152156
153157 float3 lrgb2yuv(float3 c) {
158+#ifdef delinearize
154159 float r = delinearize(c.x);
155160 float g = delinearize(c.y);
156161 float b = delinearize(c.z);
157−
158162 return rgb2yuv(r, g, b);
163+#else
164+ return rgb2yuv(c.x, c.y, c.z);
165+#endif
159166 }
160167
161168 float lrgb2y(float3 c) {
169+#ifdef delinearize
162170 float r = delinearize(c.x);
163171 float g = delinearize(c.y);
164172 float b = delinearize(c.z);
165−
166173 return rgb2y(r, g, b);
174+#else
175+ return rgb2y(c.x, c.y, c.z);
176+#endif
167177 }
168178
169179 float3 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