、项目需要,要求用unity显示4k摄像头数据。unity自身有现成的摄像头调用方法,但是太粗糙了,很多参数无法设置。例如照片格式,jpeg,yuv,例如亮度色度曝光度。这是第一个问题,
因为是在linux上使用,考虑用v4l2接口直接获取摄像头数据。v4l2是c语言,unity用c#语言,这是第二个问题。首先考虑获取到数据后用udp在进程间通信(我知道正统的方法是用管道,但是没用过,资料也少),但是发送“hello world”就能成功,发送图片数据就失败,后来反应过来是因为数据太多,超过包长度了(默认1472左右),又不想用tcp,怕速度不够。
参考资料:
(原创)基于ZedBoard的Webcam设计(一):USB摄像头(V4L2接口)的图片采集 - 超群天晴 - 博客园
安卓系统采用v4l2接口打开YUYV和MJPEG摄像头,支持热插拔。_alterli的博客-CSDN博客_v4l2_pix_fmt_yuyv
第二个问题最后只能c#调用c语言。好在c#对c语言的调用还算完善,在不了解之前还挺害怕,解决了之后发现很方便,很顺利。常见的c#调用c++有很多可以参考的资料,c语言生成dll就可以(linux里是so文件)。主要在意的是两种语言之间怎么传值,特别是byte数组的传值。这里不细说
参考资料:
C#调用C++_lishuangquan1987的博客-CSDN博客_c# 调用c++
https://www.jianshu.com/p/048c7fedbcb4
将c编译成.so 并调用(ubuntu)_Mihu_Tutu的博客-CSDN博客_c语言编译so
第三个问题,摄像头只有使用jpeg格式才能以30fps的速度拍摄。但是4k的图片赋值给texture需要先解码,unity的解码方法写的很烂,被好多人吐槽。大家提到的方法就是用turbojpeg做解码。据说最开始是用libjpeg解码,但是libjpeg速度不够,turbojpeg利用的处理器的特性,有2-6倍的提速。
如何接入turbojpeg就成了第四个问题。turbojpeg是开源的,用cmake编译还算容易。考虑到c语言效率更高,turbojpeg也只能用c语言,干脆接在摄像头调用后面,返回值从jpeg格式变成原始格式(注意,原始格式和bmp格式还有一点区别)。jpeg是压缩文件,长度不固定。原始数据长度就固定了(以4k为例,3840*2160*3)。再用格式转换赋值给texture。说起来容易做起来难,也解决了,不细说。
参考资料:
通过libjpeg-turbo实现对jpeg图像的解码_fengbingchun的博客-CSDN博客_libjpeg-turbo
Jpeg编码4-6倍性能提升_洛克希德马丁的博客-CSDN博客_jpeg解码速度
又遇到一个专属于我的问题,异步调用Texture2D.LoadImage【unity3d吧】_百度贴吧
- internal static void recvPicCallback(IntPtr intPtr, int len)
- {
- Marshal.Copy(intPtr, buffer, 0, len);
- //Debug.Log("callbackFinish:"+len);
- lock (textureColors)
- {
- for (int y = 0; y < height; y++)
- {
- for (int x = 0; x < width; x++)
- {
- textureColors[x + (height - y - 1) * width] = new Color(buffer[(x + y * width) * 3 + 0] / 255.0f, buffer[(x + y * width) * 3 + 1] / 255.0f, buffer[(x + y * width) * 3 + 2] / 255.0f);
- }
- }
- }
- }
- void Update()
- {
- try
- {
- //Debug.Log(System.Text.Encoding.Default.GetString(buffer));
- lock (textureColors)
- {
- playTexture.SetPixels(textureColors);
- }
- long t3 = DateTime.Now.ToFileTime();
- playTexture.Apply();
- rawImage.texture = playTexture;
- long t4 = DateTime.Now.ToFileTime();
-
- }
- catch (Exception e)
- {
- text.text = e.ToString();
- }
- }
- void GetPic()
- {
- while(true)
- {
- long t1 = DateTime.Now.ToFileTime();
- v4l2Grab(recvPicCallback);
- long t2 = DateTime.Now.ToFileTime();
- Debug.Log("t1:" + (t2 - t1));
- }
- }
至此,可以用了,比原生摄像头快,可惜仍然非常卡。查看log,发现获取图片加解码耗时0.14ms,SetPixels耗时0.026ms,apply耗时0.012ms。没加解码之前的获取图片耗时我也看了,很快。基本确定仍然是图片解码耗时最多。
第五个问题,本文最重要的问题,什么方法解码更快,turbojpeg是利用的cpu的特殊指令集进行加速,libjpeg速度据说一般。更快的我认为需要用gpu加速,查了资料,显卡没有专门的jpeg硬解码功能,但是nvidia有专门的nvjpeg库(资料太少,没用明白)。opencl也是专门的调用gpu的方法,刚好找到了对应的资料。又学opencl。
参考资料:
Jpeg 库的解码OpenCL优化_weixin_34014277的博客-CSDN博客
第六个问题,opencl学习,先安装cuda,然后,按常规方法添加目录引用和库引用。例程很快就跑起来了,可惜跑上面的opencl解码程序还是出了问题。上面的代码调用了libjpeg库,只是自己替换了一个函数。所以还得自己编译libjpeg。
参考资料:
基于CUDA的OpenCL开发环境搭建与入门程序示例_Johnson Lu的博客-CSDN博客
第七个问题,libjpeg编译。简单查了一下资料,费了不少劲,没成功。最开始看到turbojpeg里边有libjpeg的编译,寻思直接用,然后发现turbojpeg有自己的修改,两边版本不对应,只能用原版。用原版也不行,出现的问题如下。
- E:\platform_external_jpeg-master> nmake /f makefile.vc nodebug=1
-
- Microsoft (R) 程序维护实用工具 14.29.30040.0 版
- 版权所有 (C) Microsoft Corporation。 保留所有权利。
-
- makefile.vc(11) : fatal error U1052: 未找到文件“win32.mak”
- Stop.
- E:\platform_external_jpeg-master> nmake /f makefile.vc nodebug=1
-
- Microsoft (R) 程序维护实用工具 14.29.30040.0 版
- 版权所有 (C) Microsoft Corporation。 保留所有权利。
-
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcapimin.c
- jcapimin.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcapistd.c
- jcapistd.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jctrans.c
- jctrans.c
- jctrans.c(278): warning C4100: “input_buf”: 未引用的形参
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcparam.c
- jcparam.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jdatadst.c
- jdatadst.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcinit.c
- jcinit.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcmaster.c
- jcmaster.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcmarker.c
- jcmarker.c
- jcmarker.c(222): warning C4100: “cinfo”: 未引用的形参
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcmainct.c
- jcmainct.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcprepct.c
- jcprepct.c
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jccoefct.c
- jccoefct.c
- jccoefct.c(341): warning C4100: “input_buf”: 未引用的形参
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jccolor.c
- jccolor.c
- jccolor.c(354): warning C4456: “inptr”的声明隐藏了上一个本地声明
- jccolor.c(345): note: 参见“inptr”的声明
- jccolor.c(359): warning C4456: “col”的声明隐藏了上一个本地声明
- jccolor.c(347): note: 参见“col”的声明
- jccolor.c(386): warning C4102: “SLOW”: 未引用的标签
- jccolor.c(409): warning C4100: “cinfo”: 未引用的形参
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jcsample.c
- jcsample.c
- jcsample.c(75): warning C4100: “cinfo”: 未引用的形参
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jchuff.c
- jchuff.c
- jchuff.c(302): warning C4431: 缺少类型说明符 - 假定为 int。注意: C 不再支持默认 int
- jchuff.c(302): error C2054: 在“__inline__”之后应输入“(”
- jchuff.c(304): error C2085: “emit_bits”: 不在形参表中
- jchuff.c(304): error C2143: 语法错误: 缺少“;”(在“{”的前面)
- jchuff.c(342): warning C4013: “emit_bits”未定义;假设外部返回 int
- NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX64\x64\cl.EXE"”: 返回代码“0x2”
- Stop.
-
- E:\platform_external_jpeg-master>
- E:\platform_external_jpeg-master> nmake /f makefile.vc nodebug=1
-
- Microsoft (R) 程序维护实用工具 14.29.30040.0 版
- 版权所有 (C) Microsoft Corporation。 保留所有权利。
-
- cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -Ox -DNDEBUG -D_MT -MT -I. jchuff.c
- jchuff.c
- jchuff.c(302): warning C4431: 缺少类型说明符 - 假定为 int。注意: C 不再支持默认 int
- jchuff.c(302): error C2054: 在“__inline__”之后应输入“(”
- jchuff.c(304): error C2085: “emit_bits”: 不在形参表中
- jchuff.c(304): error C2143: 语法错误: 缺少“;”(在“{”的前面)
- jchuff.c(342): warning C4013: “emit_bits”未定义;假设外部返回 int
- NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX64\x64\cl.EXE"”: 返回代码“0x2”
- Stop.
-
- E:\platform_external_jpeg-master>
以上错误是本文想说的重点,查了好多资料都没找到办法。最后只能硬着头皮读源码,现在看来问题都在inline语句上,inline的具体功能我都不记得,查了资料越看越懵,只知道不同平台支持程度不一样。干脆所有inline都注释掉,然后居然就编译通过了。
参考资料:
LibJpeg编译_此间的年少的博客-CSDN博客_libjpeg编译
Win10+VS2019编译Jpeg源码时缺少win32.mak文件的内容_Alexabc3000的博客-CSDN博客_win32.mak
libjpeg 编译 使用_baidu_32526299的博客-CSDN博客_libjpeg
C中__inline__的含义及作用-Typhony-ChinaUnix博客
还有第八个问题,生成了lib文件,叫静态库,还得生成动态库(其实不生成好像也没问题,我因为代码跑不起来,在这个方向试了一下),反正动态库有需要的可以参考。
修改makefile.vc文件的第100行开始的部分,改成如下内容(全是自己摸索的,没有资料),就ok了。
- all: libjpeg.lib libjpeg.dll cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
-
- libjpeg.lib: $(LIBOBJECTS)
- $(RM) libjpeg.lib
- lib -out:libjpeg.lib $(LIBOBJECTS)
-
- libjpeg.dll: $(LIBOBJECTS)
- link -dll -out:libjpeg.dll $(LIBOBJECTS)
-
- cjpeg.exe: $(COBJECTS) libjpeg.lib
- $(link) $(LDFLAGS) -out:cjpeg.exe $(COBJECTS) libjpeg.lib $(LDLIBS)
参考资料:
LibJpeg编译_此间的年少的博客-CSDN博客_libjpeg编译
最后,opencl解码jpeg的问题还没解决,后面还解决了一些问题,代码往后跑了一点点,最后一个错误日志如下,根据前面犯错学到的知识,错误代码是11,类型是 CL_BUILD_PROGRAM_FAILURE ,
参考OpenCL错误码和说明_Javen_ManWJ的博客-CSDN博客_opencl 错误代码
估计是cl语句有问题,可是cl语句完全不会啊,继续查资料,学习了一点点,感觉现有代码没有啥大问题,那只能系统的学,太浪费时间,搞不定了。以后再说
con->context = clCreateContextFromType(contextProperties, flags, NULL, NULL, &errNum);
cl_program program = clCreateProgramWithSource(c->context, 1, &sourcecode, sourcesize, &errercode);
- Platform Numbers: 1
- Platform Name: NVIDIA CUDA
- Platform Vendor: NVIDIA Corporation
- Platform Version: OpenCL 3.0 CUDA 11.6.127
- Platform Full Profile or Embeded Profile?: FULL_PROFILE
- Build log is
:4:177: error: __kernel function cannot have argument whose type is, or contains, type size_t - __kernel void idct_float(__global short* input, __global unsigned char* output, __global const float* dequantilize_table, __global const int* order, int blocks_per_mcu, size_t totalblocks)
- ^
:24:33: error: unexpected type name 'float8': expected expression - tmp12 = (tmp1 - tmp3) * float8(1.414213562) - tmp13; /* 2*c4 */
- ^
:42:31: error: unexpected type name 'float8': expected expression - tmp11 = (z11 - z13) * float8(1.414213562); /* 2*c4 */
- ^
:44:28: error: unexpected type name 'float8': expected expression - z5 = (z10 + z12) * float8(1.847759065); /* 2*c2 */
- ^
:45:17: error: unexpected type name 'float8': expected expression - tmp10 = float8(1.082392200) * z12 - z5; /* 2*(c2-c6) */
- ^
:46:17: error: unexpected type name 'float8': expected expression - tmp12 = float8(-2.613125930) * z10 + z5; /* -2*(c2+c6) */
- ^
:53:23: error: unexpected type name 'float8': expected expression - tmp7 = tmp0 - float8(2)*tmp7;
- ^
:55:23: error: unexpected type name 'float8': expected expression - tmp6 = tmp1 - float8(2)*tmp6;
- ^
:57:23: error: unexpected type name 'float8': expected expression - tmp5 = tmp2 - float8(2)*tmp5;
- ^
:59:16: error: unexpected type name 'float8': expected expression - tmp3 = float8(2)*tmp3 - tmp4;
- ^
:76:29: error: unexpected type name 'float8': expected expression - tmp12 = (w2 - w6) * float8(1.414213562) - tmp13;
- ^
:89:31: error: unexpected type name 'float8': expected expression - tmp11 = (z11 - z13) * float8(1.414213562);
- ^
:91:28: error: unexpected type name 'float8': expected expression - z5 = (z10 + z12) * float8(1.847759065); /* 2*c2 */
- ^
:92:17: error: unexpected type name 'float8': expected expression - tmp10 = float8(1.082392200) * z12 - z5; /* 2*(c2-c6) */
- ^
:93:17: error: unexpected type name 'float8': expected expression - tmp12 = float8(-2.613125930) * z10 + z5; /* -2*(c2+c6) */
- ^
:100:23: error: unexpected type name 'float8': expected expression - tmp7 = tmp0 - float8(2)*tmp7;
- ^
:102:23: error: unexpected type name 'float8': expected expression - tmp6 = tmp1 - float8(2)*tmp6;
- ^
:104:23: error: unexpected type name 'float8': expected expression - tmp5 = tmp2 - float8(2)*tmp5;
- ^
:106:16: error: unexpected type name 'float8': expected expression - tmp3 = float8(2)*tmp3 - tmp4;
- ^
:120:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w0), 0, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:120:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:121:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w7), 7, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:121:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:122:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w1), 1, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:122:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:123:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w6), 6, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:123:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:124:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w2), 2, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:124:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:125:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w5), 5, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:125:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:126:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w4), 4, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:126:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:127:17: error: unexpected type name 'float8': expected expression - vstore8(RESULT(w3), 3, outptr);
- ^
:119:44: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
:127:17: error: unexpected type name 'float8': expected expression :119:54: note: expanded from macro 'RESULT' - #define RESULT(t) convert_uchar8(clamp((t)/float8(8)+float8(128), float8(0), float8(255)))
- ^
- cl_kernel.h:8252:41: note: expanded from macro 'convert_uchar8'
- #define convert_uchar8(x) convert_uchar(x)
- ^
-
- Assertion failed: CL_SUCCESS == errercode, file D:\code2022.5\Test\testOpenCLJpegDecoder\testOpenCLJpegDecoder\opencl_package.c, line 134
-
- D:\code2022.5\Test\testOpenCLJpegDecoder\x64\Debug\testOpenCLJpegDecoder.exe (进程 10520)已退出,代码为 3。
- 要在调试停止时自动关闭控制台,请启用“工具”->“选项”->“调试”->“调试停止时自动关闭控制台”。
- 按任意键关闭此窗口. . .
- /* Error Codes */
- #define CL_SUCCESS 0
- #define CL_DEVICE_NOT_FOUND -1
- #define CL_DEVICE_NOT_AVAILABLE -2
- #define CL_COMPILER_NOT_AVAILABLE -3
- #define CL_MEM_OBJECT_ALLOCATION_FAILURE -4
- #define CL_OUT_OF_RESOURCES -5
- #define CL_OUT_OF_HOST_MEMORY -6
- #define CL_PROFILING_INFO_NOT_AVAILABLE -7
- #define CL_MEM_COPY_OVERLAP -8
- #define CL_IMAGE_FORMAT_MISMATCH -9
- #define CL_IMAGE_FORMAT_NOT_SUPPORTED -10
- #define CL_BUILD_PROGRAM_FAILURE -11
- #define CL_MAP_FAILURE -12
- #define CL_MISALIGNED_SUB_BUFFER_OFFSET -13
- #define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
- #define CL_COMPILE_PROGRAM_FAILURE -15
- #define CL_LINKER_NOT_AVAILABLE -16
- #define CL_LINK_PROGRAM_FAILURE -17
- #define CL_DEVICE_PARTITION_FAILED -18
- #define CL_KERNEL_ARG_INFO_NOT_AVAILABLE -19