Timo Rothenpieler
971351b664
avcodec/nvenc: Handle minqp-only case in set_vbr
9 years ago
Timo Rothenpieler
eae4eba9cb
avcodec/nvenc: twopass mode works in all modes
9 years ago
Timo Rothenpieler
1330a0f31f
avcodec/nvenc: Fix forcing constqp rc mode
...
The CONSTQP enum value is 0, so this check failed for it.
9 years ago
Andrey Turkin
58c6dcb4b7
avcodec/nvenc: don't enqueue timestamps until a frame was accepted
...
Otherwise timestamps/pending FIFOs would go out of sync if nvEncodePicture ever fails.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
2f53b5b74b
avcodec/nvenc: refactor encode_frame a bit
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
d3463912c1
avcodec/nvenc: extract timestamp calculations into separate function
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
0d021cc8b3
avcodec/nvenc: rework library load and GPU selection
...
Use explicit nvenc capability checks instead to determine usable devices
instead of SM versions.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
f052ef30ef
avcodec/nvenc: allow configuring number of surfaces
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
b69335304d
avcodec/nvenc: use INIT_CLEANUP to deal with init failures
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
f84dfbc74a
avcodec/nvenc: add rate control option
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
40df468ab1
avcodec/nvenc: convert tier to AVOptions
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
b0172873a8
avcodec/nvenc: convert levels to AVOptions
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
9824321b32
avcodec/nvenc: convert profile parsing to AVOptions
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
faffff88c2
avcodec/nvenc: use AVOptions to select presets
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
7aa16d59bf
avcodec/nvenc: split H264/HEVC encoder definitions into separate files
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Timo Rothenpieler
24fcb23351
avcodec/nvenc: Require Maxwell for lossless
9 years ago
Andrey Turkin
a8cf25dd92
avcodec/nvenc: CUDA frames support
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
cfb49fc6f7
avcodec/nvenc: replace custom FIFOs with AVFifos
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
e1691c44f0
avcodec/nvenc: combine input and output surface structures
...
There is no point in separate structures as they have 1:1 relationship,
they are always used together and they have same lifetime.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Andrey Turkin
82d705e245
avcodec/nvenc: split large functions into smaller ones
...
Functions names and scopes are from libav. This commit basically moves
code around without changing it; it shouldn't change any functionality
except some small leak fixes on error paths.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Timo Rothenpieler
c921ca9b5d
avcodec/nvenc: Write buffPeriod/picTime SEI in both CBR modes
9 years ago
Timo Rothenpieler
3a9df7dfec
avcodec/nvenc: Generate bufferingPeriod/pictureTiming SEI
...
For some unknown reason enabling these causes propper CBR padding,
so as there are no known downsides just always enable them in CBR mode.
9 years ago
Timo Rothenpieler
31ce01bdb9
avcodec/nvenc: don't set profile in lossless mode
9 years ago
Timo Rothenpieler
c4312b1cf4
avcodec/nvenc: Add missing lossless presets to doc string
9 years ago
Timo Rothenpieler
b3557c79dc
avcodec/nvenc: Generate AUD NAL units for better compatiblity
9 years ago
Timo Rothenpieler
f2bdf9d26a
avcodec/nvenc: Fix typo and preset error message
9 years ago
Lucas Cooper
fd55470c65
avcodec/nvenc: Add encoder stats
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Agatha Hu
362e05f1ea
avcodec/nvenc: Fix H264 and HEVC vui info update
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Anton Khirnov
871d0930d4
nvenc: support CUDA frames as input
9 years ago
Anton Khirnov
c51b2c79a7
Allow linking to CUDA dynamically instead of dlopen()ing it at runtime
9 years ago
Anton Khirnov
d005ccc630
nvenc: rename a misnamed function
...
This function copies the encoded bistream into the caller's packet,
calling it 'get_frame' is misleading.
9 years ago
Anton Khirnov
118beda355
nvenc: merge input and output surface structs
...
An input frame always corresponds to exactly one output packet, so there
is no point in complicating the situation by managing them separately.
9 years ago
Anton Khirnov
28259c13db
nvenc: factor out the pixel format list
9 years ago
Anton Khirnov
c59fec783d
nvenc: generate dts properly
...
When there is a non-zero decoding delay due to reordering, the first dts
should be lower than the first pts (since the first packet fed to the
decoder does not produce any output).
Use the same scheme used in mpegvideo_enc (which comes from x264
originally) -- wait for first two timestamps and extrapolate linearly to
the past to produce the first dts value.
9 years ago
Anton Khirnov
9d36cab4c0
nvenc: fix encoding with B-frames
...
When B-frames are enabled and the encoder returns success, all currently
pending buffers immediately become valid and can be returned to the
caller. We can only return one packet at a time, so all the other
pending buffers should be transferred to a new 'ready' fifo, from where
they can be returned in subsequent calls (in which the encoder does not
produce any new output). This bug was hidden by the incorrect testing of
the encoder return value (the return value was overwritten before it was
tested).
9 years ago
Anton Khirnov
aac7d6b284
nvenc: flush the encoder before closing it, as required by the docs
...
Otherwise, closing the encoder can crash.
9 years ago
Anton Khirnov
39571e86cb
nvenc: better error handling
...
Return proper error codes and print more descriptive error messages.
9 years ago
Agatha Hu
758be45756
avcodec/nvenc: clamp initial qp value to [1, 51]
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Agatha Hu
f1a8897375
avcodec/nvenc: set slice number to 1 to improve encoding quality
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Anton Khirnov
1520c6ff05
nvenc: export CPB props side data
9 years ago
Agatha Hu
ddbad15898
avcodec/nvenc: update nvenc default parameters
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Agatha Hu
20abda6b62
avcodec/nvenc: fix potential profile error when encoding yuv444p
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Agatha Hu
2b5dda3f48
avcodec/nvenc: fix b frame n_quant_offset
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
9 years ago
Agatha Hu
a8bedd56aa
avcodec/nvenc: merge compute initialQP sections
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
10 years ago
Agatha Hu
49046580ce
avcodec/nvenc: Optimize nvenc parameters
...
Add 3 more presets: fast, medium, slow.
Improve min/max QP calculation.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
10 years ago
Agatha Hu
81071eea7d
avcodec/nvenc: change flag of cuCtxCreate to avoid CPU spins
...
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
10 years ago
Luca Barbato
413d4e54a9
nvenc: Properly free the fifos
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
10 years ago
Timo Rothenpieler
2ae45816b2
avcodec/nvenc: Add support for 2pass rc in vbr mode
...
Thanks to WereCatf for pointing out this now exists.
Github: Closes #143
10 years ago
Timo Rothenpieler
3a20e5bc3b
avcodec/nvenc: Only set h264 parameter when encoding h264
10 years ago
Timo Rothenpieler
bef740688d
avcodec/nvenc: Fix indentation
10 years ago