[FFmpeg-devel] Can you implement OPENCL or CUDA support option for motion estimation in NVENC HEVC and AVC?

John Caliber ardenticus at gmail.com
Sun Dec 30 15:18:43 EET 2018


Hello FFMPEG developers!


I asked Nvidia forum about that topic. What do you think about it? What is
your own opinion about this idea?

The content of the post:

https://devtalk.nvidia.com/default/topic/1045756/can-you-implement-opencl-or-cuda-support-option-for-motion-estimation-in-nvenc-hevc-and-avc-/


"Hello Nvidia codec developers!

The X264 codec developers had a great idea, when they gave an option for
OPENCL motion estimation in their codec. I know that you can use for
example: CUDA for weighted prediction in the NVENC. So it means that you
can creatively use the various parts of the GPU in cooperative way.
"When OPENCL is enabled, lookahead thread is mostly off-loaded to your
OpenCL capable GPU device. Lowres intra cost prediction, lowres motion
search (including subpel) and bidir cost predictions are all done on the
GPU. " You can add motion perdiction too. However it went trough the CPU
and caused bottleneck.
However you can avoild this in such way, that all of that computings go
trough in the videocard only.

You can use OPENCL or CUDA acceleration for these stuff, it could greatly
improve the quality of the best compression modes.

Motion estimation modes: 1. dia, 2. hex, 3. UMH, 4. star, 5. sea, 6. full

Sub pixel precision: 1 half pixel only. 2. half and quarter pixel, 3. 2X
half + 1X quartel pixel, 4. 2X(SATD half) + 1Xquarter pixel 5. 2X(SATD
half) + 2Xquarter pixel, 6. (SATD half)+ and quarter pixel deep 7. 2X(SATD
half)+ quarter pixel deep 8. 2X(SATD half) 2X quarter pixel deep

MAx pixel search range

option for temporar motion perdiction


How can it look in command prompt?

OP = accelerated OPENCL or Cu= if you choose Cuda

Opencl Motion estimation mode =opmem

Opencl Sub pixel precision = opspp


OpenCL Max pixel search range = opmpsr

An example if you want to implement OPENCL: -opmem 4 -opspp 6 -opmpsr 57

An example if you want to implement rather the CUDA : -cumem 4 -cuspp 6
-cumpsr 57


Of course it would be part of quality encoding, so it wouldn't matter if it
is not enough fast for 4K live streaming etc. It would be only *an
option/extension for people who like the better quality encoding* like
transcoding blu-ray or compressing own video files on the computer. So even
the lack of very ultrafast speed encoding is not a huge propblem. Those who
care about speed (live streaming of high res video) don't use such options.
I think the Opencl or Cuda motion estimation can be enough fast even for
high resolution videos too, and more importantly it can make* a much better
quality motion prediction/estimation* than the motion estimation /
prediction technology of the NVENC fixed HW unit! So OPENCL and CUDA
support for NVENC HW encoding would be a great leap in video quality!"


Thank you for your reply!

Best regards!


More information about the ffmpeg-devel mailing list