Reduce CPU usage with Linux NVENC
The internal assembly routines inside libswscale perform the RGB->YUV conversion using a fully planar output format, then have to perform an additional YUV420->NV12 conversion step. NVENC can directly consume YUV420 input frames, so we can completely avoid this NV12 conversion and save quite a bit of CPU time in the process.
This commit is contained in:
@@ -409,11 +409,13 @@ static encoder_t nvenc {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
AV_HWDEVICE_TYPE_D3D11VA,
|
AV_HWDEVICE_TYPE_D3D11VA,
|
||||||
AV_PIX_FMT_D3D11,
|
AV_PIX_FMT_D3D11,
|
||||||
|
AV_PIX_FMT_NV12, AV_PIX_FMT_P010,
|
||||||
#else
|
#else
|
||||||
AV_HWDEVICE_TYPE_CUDA,
|
AV_HWDEVICE_TYPE_CUDA,
|
||||||
AV_PIX_FMT_CUDA,
|
AV_PIX_FMT_CUDA,
|
||||||
|
// Fully planar YUV formats are more efficient for sws_scale()
|
||||||
|
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10,
|
||||||
#endif
|
#endif
|
||||||
AV_PIX_FMT_NV12, AV_PIX_FMT_P010,
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ "forced-idr"s, 1 },
|
{ "forced-idr"s, 1 },
|
||||||
|
|||||||
Reference in New Issue
Block a user