Unity 디코딩 4k 사진이 너무 느립니다. turbojpeg를 사용하여 가속하고, opencl을 사용하여 가속하고, libjpeg를 사용하고, v4l2를 사용하십시오.

추신:

아니나 다를까 libjpeg는 어떤 기사가 최신 버전이 1996년이라고 했는지 기억하지 못하고, 심지어 1996년 이후로 업데이트된 적이 없는 소위 공식 웹 사이트까지 제공했습니다. .. 제가 사용하던게 최신버전이고 정확한 주소를 찾아서 쉽게 컴파일 했습니다. 내 기사 전체를 뒤집었으므로 아래에서 읽지 마십시오. libjpeg-turbo를 직접 컴파일하지 마십시오. 미리 만들어진 버전을 다운로드하는 것이 더 나은 성능을 보이는 것 같습니다.

libjpeg 다운로드 주소:

/files의 디렉토리 목록

libjpeg-turbo 다운로드 주소:

libjpeg-turbo - SourceForge.net에서 파일 찾아보기

다음은 작동하지 않았습니다.

, 프로젝트는 Unity를 사용하여 4k 카메라 데이터를 표시해야 합니다. Unity 자체에 기성품 카메라 호출 방법이 있지만 너무 거칠고 많은 매개 변수를 설정할 수 없습니다. 밝기 채도 노출과 같은 사진 형식, jpeg, yuv와 같은. 이것이 첫 번째 질문입니다.

Linux에서 사용하므로 v4l2 인터페이스를 사용하여 카메라 데이터를 직접 가져오는 것을 고려하십시오. v4l2는 c 언어이고 Unity는 C# 언어를 사용합니다. 이것이 두 번째 질문입니다. 먼저 데이터를 얻은 후 udp를 사용하여 프로세스 간 통신을 고려하십시오 (정통적인 방법은 파이프를 사용하는 것으로 알고 있지만 사용한 적이 없으며 자료가 거의 없습니다) "hello world"전송은 성공할 수 있지만 사진 데이터 전송은 실패합니다 , 그리고 응답 패킷 길이 (기본적으로 약 1472)를 초과하는 데이터가 너무 많아서 여기에 왔으며 속도가 충분하지 않을까 두려워 tcp를 사용하고 싶지 않았습니다.

 참조:

(원본) ZedBoard 기반 웹캠 설계(1): USB 카메라(V4L2 인터페이스) 사진 모음 - Chaoqun Tianqing - 博客园

Android 시스템은 v4l2 인터페이스를 사용하여 YUYV 및 MJPEG 카메라를 열고 핫 플러깅을 지원합니다. _alterli의 블로그-CSDN Blog_v4l2_ pix_fmt_yuyv

두 번째 문제는 결국 C#만이 C언어를 호출할 수 있다는 점입니다. 다행이도 C#의 C언어 호출이 상당히 완벽해서 처음에는 잘 몰라서 좀 두려웠는데 풀고 나니 굉장히 편리하고 순조롭습니다. C++를 호출하는 일반적인 C#에 대한 많은 참조 자료가 있으며 C 언어는 dll(리눅스에서는 파일)을 생성할 수 있습니다. 주요 관심사는 두 언어 간에 값을 전송하는 방법, 특히 바이트 배열의 값 전송입니다. 여기서는 자세히 다루지 않겠습니다

참조:

C# 호출 C++_lishuangquan1987's blog-CSDN blog_c# 호출 c++

https://www.jianshu.com/p/048c7fedbcb4

c를 .so로 컴파일하고 (ubuntu)_Mihu_Tutu의 블로그-CSDN blog_c 언어 컴파일 so를 호출합니다.

세 번째 문제는 카메라가 jpeg 형식으로 30fps로만 촬영할 수 있다는 것입니다. 그러나 4k 이미지를 텍스처에 할당하는 것은 먼저 디코딩이 필요하고 unity의 디코딩 방법이 제대로 작성되지 않아 많은 사람들이 불만을 토로했습니다. 언급 한 방법은 디코딩에 turbojpeg를 사용하는 것입니다. 처음에는 libjpeg를 사용하여 디코딩을 했다고 하는데 libjpeg는 속도가 느리고 turbojpeg가 사용하는 프로세서의 특성상 속도가 2~6배 증가합니다.

turbojpeg에 액세스하는 방법은 네 번째 질문이 됩니다. turbojpeg는 오픈 소스이며 cmake로 비교적 쉽게 컴파일할 수 있습니다. c언어가 더 효율적이라는 점을 감안하면 turbojpeg는 c언어에서만 사용이 가능하며 단순히 카메라 호출에 연결되어 반환값이 jpeg형식에서 원본형식으로 변경됩니다. 원본 형식 및 bmp 형식). jpeg는 압축 파일로 길이가 고정되어 있지 않습니다. 원래 데이터 길이는 고정되어 있습니다(예: 4k, 3840*2160*3). 그런 다음 형식 변환을 사용하여 텍스처에 할당합니다. 말은 쉽지만 해결은 되지만 정교하지는 않습니다.

참조:

libjpeg-turbo_fengbingchun의 블로그-CSDN blog_libjpeg-turbo를 통한 jpeg 이미지 디코딩

Jpeg 인코딩 4~6배 성능 향상_Lockheed Martin의 블로그-CSDN 블로그_jpeg 디코딩 속도

또한 Texture2D.LoadImage를 비동기적으로 호출하는 나에게 속한 문제가 발생했습니다. [unity3d bar]_Baidu Post Bar

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));
        }
    }

지금까지는 원래 카메라보다 빠르게 사용할 수 있지만 불행히도 여전히 매우 정체되어 있습니다. 로그를 확인하고 사진을 획득하고 디코딩하는 데 0.14ms, SetPixels에 0.026ms, 적용에 0.012ms가 걸린다는 것을 확인하십시오. 디코딩하기 전에 시간이 많이 걸리는 사진 획득도 살펴 보았는데 매우 빠릅니다. 기본적으로 여전히 화상 디코딩에 가장 많은 시간이 소요되는 것으로 판단됩니다.

 다섯 번째 질문, 이 글에서 가장 중요한 질문인 어떤 방법이 더 빨리 디코딩되는지, turbojpeg는 가속을 위해 cpu라는 특수 명령어 세트를 사용하고, libjpeg 속도는 평균이라고 합니다. 더 빠른건 gpu로 가속해야 할 것 같은데 정보를 확인해보니 그래픽카드는 특별한 jpeg 하드 디코딩 기능이 없고 nvidia는 특별한 nvjpeg 라이브러리가 있습니다(정보가 너무 적어 이해가 안됨). Opencl도 gpu를 호출하는 특수한 방법인데, 해당 정보를 방금 찾았습니다. opencl을 다시 배우십시오.

참조:

Jpeg 라이브러리의 OpenCL 최적화 디코딩 - Weixin_34014277's Blog - CSDN Blog

여섯 번째 질문, opencl 학습, 먼저 cuda를 설치하고 일반적인 방법으로 디렉토리 참조 및 라이브러리 참조를 추가하십시오. 루틴은 빠르게 실행되었지만 불행하게도 위의 opencl 디코딩 프로그램에는 여전히 문제가 있었습니다. 위의 코드는 libjpeg 라이브러리를 호출하지만 함수 자체를 대체합니다. 따라서 libjpeg를 직접 컴파일해야 합니다.

참조:

CUDA 기반 OpenCL 개발 환경 구축 및 진입 프로그램 예제_Johnson Lu's Blog-CSDN Blog

일곱 번째 질문, 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>

위의 오류는 이 문서의 초점이며 많은 정보를 확인했지만 해결책을 찾을 수 없습니다. 결국 총알을 깨물고 소스코드를 읽을 수 밖에 없었습니다.. 이제 문제는 인라인문에 있는것 같습니다.인라인의 구체적인 기능은 기억이 안나네요. 모든 인라인을 주석 처리하면 컴파일이 통과됩니다.

참조:

LibJpeg 컴파일

Win10+VS2019는 Jpeg 소스 코드를 컴파일할 때 win32.mak 파일의 내용이 부족합니다_Alexabc3000's blog-CSDN blog_win32.mak

컴파일된 libjpeg using_baidu_32526299의 블로그-CSDN blog_libjpeg

C-Typhony-ChinaUnix 블로그에서 __inline__의 의미와 기능

여덟번째 문제도 있는데 정적라이브러리라고 하는 lib 파일이 생성되고 동적라이브러리가 생성되어야 합니다. 코드를 실행할 수 없기 때문에 방향) 어쨌든 동적 라이브러리가 필요합니다. 참조할 수 있습니다.

makefile.vc 파일의 100번째 줄부터 시작하는 부분을 수정하여 다음 내용으로 변경(전부 저작, 정보 없음)하면 됩니다.

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 컴파일

마지막으로 opencl decoding jpeg의 문제는 해결되지 않았고, 추후에 몇가지 문제가 해결되었습니다. 코드는 11이고 유형은 CL_BUILD_PROGRAM_FAILURE입니다.

OpenCL 오류 코드 및 설명 참조 _Javen_ManWJ의 블로그-CSDN blog_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 <kernel>: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)
                                                                                                                                                                                ^
<kernel>:24:33: error: unexpected type name 'float8': expected expression
        tmp12 = (tmp1 - tmp3) * float8(1.414213562) - tmp13; /* 2*c4 */
                                ^
<kernel>:42:31: error: unexpected type name 'float8': expected expression
        tmp11 = (z11 - z13) * float8(1.414213562); /* 2*c4 */
                              ^
<kernel>:44:28: error: unexpected type name 'float8': expected expression
        z5 = (z10 + z12) * float8(1.847759065); /* 2*c2 */
                           ^
<kernel>:45:17: error: unexpected type name 'float8': expected expression
        tmp10 = float8(1.082392200) * z12 - z5; /* 2*(c2-c6) */
                ^
<kernel>:46:17: error: unexpected type name 'float8': expected expression
        tmp12 = float8(-2.613125930) * z10 + z5; /* -2*(c2+c6) */
                ^
<kernel>:53:23: error: unexpected type name 'float8': expected expression
        tmp7 = tmp0 - float8(2)*tmp7;
                      ^
<kernel>:55:23: error: unexpected type name 'float8': expected expression
        tmp6 = tmp1 - float8(2)*tmp6;
                      ^
<kernel>:57:23: error: unexpected type name 'float8': expected expression
        tmp5 = tmp2 - float8(2)*tmp5;
                      ^
<kernel>:59:16: error: unexpected type name 'float8': expected expression
        tmp3 = float8(2)*tmp3 - tmp4;
               ^
<kernel>:76:29: error: unexpected type name 'float8': expected expression
        tmp12 = (w2 - w6) * float8(1.414213562) - tmp13;
                            ^
<kernel>:89:31: error: unexpected type name 'float8': expected expression
        tmp11 = (z11 - z13) * float8(1.414213562);
                              ^
<kernel>:91:28: error: unexpected type name 'float8': expected expression
        z5 = (z10 + z12) * float8(1.847759065); /* 2*c2 */
                           ^
<kernel>:92:17: error: unexpected type name 'float8': expected expression
        tmp10 = float8(1.082392200) * z12 - z5; /* 2*(c2-c6) */
                ^
<kernel>:93:17: error: unexpected type name 'float8': expected expression
        tmp12 = float8(-2.613125930) * z10 + z5; /* -2*(c2+c6) */
                ^
<kernel>:100:23: error: unexpected type name 'float8': expected expression
        tmp7 = tmp0 - float8(2)*tmp7;
                      ^
<kernel>:102:23: error: unexpected type name 'float8': expected expression
        tmp6 = tmp1 - float8(2)*tmp6;
                      ^
<kernel>:104:23: error: unexpected type name 'float8': expected expression
        tmp5 = tmp2 - float8(2)*tmp5;
                      ^
<kernel>:106:16: error: unexpected type name 'float8': expected expression
        tmp3 = float8(2)*tmp3 - tmp4;
               ^
<kernel>:120:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w0), 0, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:120:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:121:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w7), 7, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:121:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:122:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w1), 1, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:122:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:123:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w6), 6, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:123:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:124:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w2), 2, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:124:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:125:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w5), 5, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:125:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:126:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w4), 4, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:126:17: error: unexpected type name 'float8': expected expression
<kernel>: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)
                                        ^
<kernel>:127:17: error: unexpected type name 'float8': expected expression
        vstore8(RESULT(w3), 3, outptr);
                ^
<kernel>: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)
                                        ^
<kernel>:127:17: error: unexpected type name 'float8': expected expression
<kernel>: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

추천

출처blog.csdn.net/u010752777/article/details/126367229