diff options
author | Ben Chang <benc@nvidia.com> | 2017-04-26 00:57:56 +0300 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2017-04-26 22:57:54 +0300 |
commit | 8de3458a07376b0a96772e586b6dba5e93432f52 (patch) | |
tree | 1349f65fd1d08cdc1f1dc7372cf4027b8a2d3af4 /libavcodec/nvenc_h264.c | |
parent | 78a5fc4579deb63e1e6b93cd4d6e2ec2dceff931 (diff) |
avcodec/nvenc: surface allocation reduction
This patch aims to reduce the number of input/output surfaces
NVENC allocates per session. Previous default sets allocated surfaces to 32
(unless there is user specified param or lookahead involved). Having large
number of surfaces consumes extra video memory (esp for higher resolution
encoding). The patch changes the surfaces calculation for default, B-frames,
lookahead scenario respectively.
The other change involves surface selection. Previously, if a session
allocates x surfaces, only x-1 surfaces are used (due to combination
of output delay and lock toggle logic). To prevent unused surfaces,
changing surface rotation to using predefined fifo.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc_h264.c')
-rw-r--r-- | libavcodec/nvenc_h264.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c index 2c55b60789..8d44b1f350 100644 --- a/libavcodec/nvenc_h264.c +++ b/libavcodec/nvenc_h264.c @@ -79,8 +79,8 @@ static const AVOption options[] = { 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP }, 0, 0, VE, "rc" }, { "vbr_2pass", "Multi-pass variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_2_PASS_VBR }, 0, 0, VE, "rc" }, { "rc-lookahead", "Number of frames to look ahead for rate-control", - OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE }, - { "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, MAX_REGISTERED_FRAMES, VE }, + OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, + { "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE }, { "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE }, { "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", |