Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7cd58a8a
Commit
7cd58a8a
authored
Jul 12, 2018
by
Danil Iashchenko
Committed by
Mark Thompson
Jul 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/convolution_opencl: use CL_FAIL_ON_ERROR for error handling
Switch to use CL_FAIL_ON_ERROR for error handling
parent
3c26ce46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
35 deletions
+11
-35
vf_convolution_opencl.c
libavfilter/vf_convolution_opencl.c
+11
-35
No files found.
libavfilter/vf_convolution_opencl.c
View file @
7cd58a8a
...
@@ -67,12 +67,8 @@ static int convolution_opencl_init(AVFilterContext *avctx)
...
@@ -67,12 +67,8 @@ static int convolution_opencl_init(AVFilterContext *avctx)
ctx
->
command_queue
=
clCreateCommandQueue
(
ctx
->
ocf
.
hwctx
->
context
,
ctx
->
command_queue
=
clCreateCommandQueue
(
ctx
->
ocf
.
hwctx
->
context
,
ctx
->
ocf
.
hwctx
->
device_id
,
ctx
->
ocf
.
hwctx
->
device_id
,
0
,
&
cle
);
0
,
&
cle
);
if
(
!
ctx
->
command_queue
)
{
CL_FAIL_ON_ERROR
(
AVERROR
(
EIO
),
"Failed to create OpenCL "
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to create OpenCL "
"command queue %d.
\n
"
,
cle
);
"command queue: %d.
\n
"
,
cle
);
err
=
AVERROR
(
EIO
);
goto
fail
;
}
if
(
!
strcmp
(
avctx
->
filter
->
name
,
"convolution_opencl"
))
{
if
(
!
strcmp
(
avctx
->
filter
->
name
,
"convolution_opencl"
))
{
kernel_name
=
"convolution_global"
;
kernel_name
=
"convolution_global"
;
...
@@ -84,11 +80,8 @@ static int convolution_opencl_init(AVFilterContext *avctx)
...
@@ -84,11 +80,8 @@ static int convolution_opencl_init(AVFilterContext *avctx)
kernel_name
=
"roberts_global"
;
kernel_name
=
"roberts_global"
;
}
}
ctx
->
kernel
=
clCreateKernel
(
ctx
->
ocf
.
program
,
kernel_name
,
&
cle
);
ctx
->
kernel
=
clCreateKernel
(
ctx
->
ocf
.
program
,
kernel_name
,
&
cle
);
if
(
!
ctx
->
kernel
)
{
CL_FAIL_ON_ERROR
(
AVERROR
(
EIO
),
"Failed to create "
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to create kernel: %d.
\n
"
,
cle
);
"kernel %d.
\n
"
,
cle
);
err
=
AVERROR
(
EIO
);
goto
fail
;
}
ctx
->
initialised
=
1
;
ctx
->
initialised
=
1
;
return
0
;
return
0
;
...
@@ -243,12 +236,8 @@ static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
...
@@ -243,12 +236,8 @@ static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
cle
=
clEnqueueNDRangeKernel
(
ctx
->
command_queue
,
ctx
->
kernel
,
2
,
NULL
,
cle
=
clEnqueueNDRangeKernel
(
ctx
->
command_queue
,
ctx
->
kernel
,
2
,
NULL
,
global_work
,
NULL
,
global_work
,
NULL
,
0
,
NULL
,
NULL
);
0
,
NULL
,
NULL
);
if
(
cle
!=
CL_SUCCESS
)
{
CL_FAIL_ON_ERROR
(
AVERROR
(
EIO
),
"Failed to enqueue "
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to enqueue kernel: %d.
\n
"
,
"kernel: %d.
\n
"
,
cle
);
cle
);
err
=
AVERROR
(
EIO
);
goto
fail
;
}
}
else
{
}
else
{
if
(
!
(
ctx
->
planes
&
(
1
<<
p
)))
{
if
(
!
(
ctx
->
planes
&
(
1
<<
p
)))
{
err
=
ff_opencl_filter_work_size_from_image
(
avctx
,
region
,
output
,
p
,
0
);
err
=
ff_opencl_filter_work_size_from_image
(
avctx
,
region
,
output
,
p
,
0
);
...
@@ -257,12 +246,8 @@ static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
...
@@ -257,12 +246,8 @@ static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
cle
=
clEnqueueCopyImage
(
ctx
->
command_queue
,
src
,
dst
,
cle
=
clEnqueueCopyImage
(
ctx
->
command_queue
,
src
,
dst
,
origin
,
origin
,
region
,
0
,
NULL
,
NULL
);
origin
,
origin
,
region
,
0
,
NULL
,
NULL
);
if
(
cle
!=
CL_SUCCESS
)
{
CL_FAIL_ON_ERROR
(
AVERROR
(
EIO
),
"Failed to copy plane %d: %d.
\n
"
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to copy plane %d: %d.
\n
"
,
p
,
cle
);
p
,
cle
);
err
=
AVERROR
(
EIO
);
goto
fail
;
}
}
else
{
}
else
{
CL_SET_KERNEL_ARG
(
ctx
->
kernel
,
0
,
cl_mem
,
&
dst
);
CL_SET_KERNEL_ARG
(
ctx
->
kernel
,
0
,
cl_mem
,
&
dst
);
CL_SET_KERNEL_ARG
(
ctx
->
kernel
,
1
,
cl_mem
,
&
src
);
CL_SET_KERNEL_ARG
(
ctx
->
kernel
,
1
,
cl_mem
,
&
src
);
...
@@ -280,23 +265,14 @@ static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
...
@@ -280,23 +265,14 @@ static int convolution_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
cle
=
clEnqueueNDRangeKernel
(
ctx
->
command_queue
,
ctx
->
kernel
,
2
,
NULL
,
cle
=
clEnqueueNDRangeKernel
(
ctx
->
command_queue
,
ctx
->
kernel
,
2
,
NULL
,
global_work
,
NULL
,
global_work
,
NULL
,
0
,
NULL
,
NULL
);
0
,
NULL
,
NULL
);
if
(
cle
!=
CL_SUCCESS
)
{
CL_FAIL_ON_ERROR
(
AVERROR
(
EIO
),
"Failed to enqueue "
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to enqueue kernel: %d.
\n
"
,
"kernel: %d.
\n
"
,
cle
);
cle
);
err
=
AVERROR
(
EIO
);
goto
fail
;
}
}
}
}
}
}
}
cle
=
clFinish
(
ctx
->
command_queue
);
cle
=
clFinish
(
ctx
->
command_queue
);
if
(
cle
!=
CL_SUCCESS
)
{
CL_FAIL_ON_ERROR
(
AVERROR
(
EIO
),
"Failed to finish command queue: %d.
\n
"
,
cle
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Failed to finish command queue: %d.
\n
"
,
cle
);
err
=
AVERROR
(
EIO
);
goto
fail
;
}
err
=
av_frame_copy_props
(
output
,
input
);
err
=
av_frame_copy_props
(
output
,
input
);
if
(
err
<
0
)
if
(
err
<
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment