View Issue Details

IDProjectCategoryView StatusLast Update
0000215Cinelerra-GG[All Projects] Featurepublic2019-06-25 19:32
ReporterAndrew-RAssigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000215: OpenCL support via ffmpeg
DescriptionIt seems ffmpeg already have some filters utilizing openCL (even running arbitrary CL program).
See my mail https://lists.cinelerra-gg.org/pipermail/cin/2019-May/000650.html
Steps To Reproduceadd two hacks in usual places (thirdparty/Makefile and global_config)

system_libs += -lOpenCL for global_config
and
--enable-opencl for ffmpeg.cfg_params in thirdparty/Makefile

I don't have OpenCL-capable drivers for my again NVIDIA Corporation G92 [GeForce 8800 GS] (nv50-generation card), but new-ish AMD and Intel should work to some degree ....?

Do not forgot to install opencl-headers. I used icd loader coming with Mesa, but thing like ROCm and Beignet may require their own loader files.

https://github.com/RadeonOpenCompute/ROCm - overview advanced OpenCL for AMD (integrated in mesa clover state tracker limited to OpenCL 1.1 at the moment)

https://github.com/intel/beignet - Intel thing.
TagsNo tags attached.

Activities

MatN

MatN

2019-06-25 19:32

reporter   ~0001781

Thanks Andrew. It turned out the ffmpeg on my Mint 19.1 XFCE was too old (version 3.4.6). The
¨ffmpeg -hide_banner -v verbose -init_hw_device list¨ output was
Supported hardware device types: vdpau, cuda, vaapi, drm

When I used Fedora 30 workstation with ffmpeg installed via RPM Fusion, the ffmpeg version was 4.1.3 , and the supported hardware devices vdpau, cuda, vaapi, qsv, drm, opencl.

¨ffmpeg -hide_banner -v verbose -init_hw_device opencl¨ output:
[AVHWDeviceContext @ 0x56010e3fd440] 0.0: Clover / AMD RAVEN (DRM 3.30.0, 5.1.6-300.fc30.x86_64, LLVM 8.0.0)
[AVHWDeviceContext @ 0x56010e3fd440] 1.0: Portable Computing Language / pthread-AMD Ryzen 5 2400G with Radeon
and a third one which fails for the i915 driver.

This matches the output of ¨clinfo¨, don´t know why the i915 driver is here on this AMD machine.
¨ffmpeg -hide_banner -v verbose -init_hw_device opencl:0:0¨ ,
or the equivalent 1:0 for the POCL software implementation gives an good reply.
So any support for hardware acceleration in cin-gg should allow selecting one of possible multiple openCL implementations present, similar to what is done for playback acceleration ¨HW device¨ .

Now the ¨ffmpeg -filters | grep opencl¨ worked, and gave me:
... avgblur_opencl V->V Apply average blur filter
 ... boxblur_opencl V->V Apply boxblur filter to input video
 ... convolution_opencl V->V Apply convolution mask to input video
 ... dilation_opencl V->V Apply dilation effect
 ... erosion_opencl V->V Apply erosion effect
 ... overlay_opencl VV->V Overlay one video on top of another
 ... prewitt_opencl V->V Apply prewitt operator
 ... program_opencl |->V Filter video using an OpenCL program
 ... roberts_opencl V->V Apply roberts operator
 ... sobel_opencl V->V Apply sobel operator
 ... tonemap_opencl V->V perform HDR to SDR conversion with tonemapping
 ... unsharp_opencl V->V Apply unsharp mask to input video
 ... openclsrc |->V Generate video using an OpenCL program

There are less than in your latest. I don´t know if any of these are in frequent use for video editing.

I noticed that clinfo shows ¨max work item sizes¨ of 256x256x256 for this AMD OpenCL, and much larger for the POCL one. I have no idea if that is of consequence for video editing as done by Cin-gg.
Andrew-R

Andrew-R

2019-06-25 17:56

reporter   ~0001778

ffmpeg -filters | grep opencl

... avgblur_opencl V->V Apply average blur filter
 ... boxblur_opencl V->V Apply boxblur filter to input video
 ... colorkey_opencl V->V Turns a certain color into transparency. Operates on RGB colors.
 ... convolution_opencl V->V Apply convolution mask to input video
 ... dilation_opencl V->V Apply dilation effect
 ... erosion_opencl V->V Apply erosion effect
 ... nlmeans_opencl V->V Non-local means denoiser through OpenCL
 ... overlay_opencl VV->V Overlay one video on top of another
 ... prewitt_opencl V->V Apply prewitt operator
 ... program_opencl |->V Filter video using an OpenCL program
 ... roberts_opencl V->V Apply roberts operator
 ... sobel_opencl V->V Apply sobel operator
 ... tonemap_opencl V->V perform HDR to SDR conversion with tonemapping
 ... transpose_opencl V->V Transpose input video
 ... unsharp_opencl V->V Apply unsharp mask to input video
 ... openclsrc |->V Generate video using an OpenCL program

this is for ffmpeg-git-N-93994-gd81913e680
MatN

MatN

2019-06-25 17:39

reporter   ~0001777

I think this would be very nice to have. I tried getting a list of ffmpeg effects that can use OpenCL, but StackOverflow instructions didn´t work. Does anyone know how to get a list of effect that would potentially benefit?
I do not think we should go the proprietary Cuda route, that is useless for people with Intel or AMD hardware.
On my AMD 2400G cpu, OpenCL is version 1.1 . Version 2 should do away with the need to copy memory between CPU and GPU, which should speed up where those are on one chip (Intel and AMD).
PhyllisSmith

PhyllisSmith

2019-05-15 02:46

manager   ~0001530

This sounds like it should be at least given a test; GG should be able to eventually come up with some configuration to test this now that you have done the groundwork of what has to be done to compile it in. But no time schedule yet.

Issue History

Date Modified Username Field Change
2019-05-14 04:36 Andrew-R New Issue
2019-05-15 02:46 PhyllisSmith Note Added: 0001530
2019-06-25 17:39 MatN Note Added: 0001777
2019-06-25 17:56 Andrew-R Note Added: 0001778
2019-06-25 19:32 MatN Note Added: 0001781