1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
Commit Graph

216 Commits

Author SHA1 Message Date
Andreas Rheinhardt
11bc790893 avcodec: Remove deprecated AVCodecContext.coded_frame
Deprecated in 40cf1bbacc.
(The currently disabled filter vf_mcdeint and vf_uspp were users of
this field; they have not been changed, so that whoever wants to fix
them can see the state of these filters when they were disabled.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:12 -03:00
Timo Rothenpieler
988f2e9eb0 avcodec/nvenc: fix lossless tuning logic
Relying on the order of the enum is bad.
It clashes with the new presets having to sit at the end of the list, so
that they can be properly filtered out by the options parser on builds
with older SDKs.

So this refactors nvenc.c to instead rely on the internal NVENC_LOSSLESS
flag. For this, the preset mapping has to happen much earlier, so it's
moved from nvenc_setup_encoder to nvenc_setup_device and thus runs
before the device capability check.
2021-04-18 11:39:45 +02:00
Timo Rothenpieler
7555d6f74c avcodec/nvenc: add support for gbrp rgb input 2021-04-11 09:21:21 +02:00
James Almer
238e08b12e avcodec/nvenc: use AVCodecContext.get_encode_buffer()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 13:44:16 -03:00
Martin Storsjö
30cd7feb2d avcodec/nvenc: base timestamps on frameIntervalP
If b-frames were enabled implicitly (if max_b_frames wasn't set by
the caller at all, since a0949d0bcb),
we wouldn't offset dts at all, producing invalid pts/dts combinations
(causing loud warnings by ffmpeg, or muxer errors if passed without
an extra cleanup pass).

Instead use frameIntervalP for offsetting, which should always be
accurate.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-03-12 22:11:39 +01:00
Mark Thompson
773857df59 hevc: Use common SEI types 2021-01-21 17:13:54 +00:00
Timo Rothenpieler
7a2d94cf1a avcodec/nvenc: fix timestamp offset ticks logic 2021-01-09 16:34:59 +01:00
Mark Thompson
cd322794ee lavc: Mark hw_config pointer arrays as const
They are read-only just like the HWConfig structures they point to.
2020-11-08 18:54:42 +00:00
Timo Rothenpieler
45e3131c44 avcodec/nvenc: fix build with older SDKs 2020-10-30 20:44:49 +01:00
Timo Rothenpieler
91b8e00538 avcodec/nvenc: only enforce explicitly set twopass mode 2020-10-30 17:27:03 +01:00
Timo Rothenpieler
d5b0a8e503 avcodec/nvenc: only auto-pick vbr rc in cq mode 2020-10-30 17:27:03 +01:00
Timo Rothenpieler
bb6edf618a avcodec/nvenc: all presets are SDK10 presets now 2020-10-29 21:59:37 +01:00
Timo Rothenpieler
1bf86ee907 avcodec/nvenc: removed unused and deprecated field 2020-10-21 18:47:30 +02:00
Timo Rothenpieler
e0c8e517b6 avcodec/nvenc: reduce automated use of deprecated modes 2020-10-21 18:45:52 +02:00
Timo Rothenpieler
cde3c08033 avcodec/nvenc: mark newly deprecated rc modes 2020-10-21 18:17:08 +02:00
Timo Rothenpieler
11a8e93681 avcodec/nvenc: use alias to provide deprecated profiles 2020-10-21 18:03:45 +02:00
Timo Rothenpieler
62073cfa97 avcodec/nvenc: update driver versions for SDK 11.0 2020-10-17 23:10:42 +02:00
Limin Wang
d7af6d1469 avcodec/utils: calculate frame number of HEVC if the framerate > 30FPS
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-16 22:51:11 +08:00
James Almer
0de01da1d2 avcodec: move ff_alloc_a53_sei() to atsc_53
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-15 13:01:25 -03:00
Timo Rothenpieler
466c14d107 avcodec/nvenc: fix B-Ref-Mode support check for recent HEVC 2020-07-28 21:44:11 +02:00
Roman Arzumanyan
9115d77222 avcodec/nvenc: add new Video SDK 10 features
1. new Nvenc presets
2. new multipass encode modes
3. low delay key frame scale

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-07-01 16:10:00 +02:00
Timo Rothenpieler
9aef4ae975 avcodec/nvenc: rename tc option to something more unique
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-06-30 19:03:56 +02:00
Limin Wang
fdead2a31a avcodec/nvenc: support for HEVC timecode passthrough
Reviewed-by:   Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-28 21:40:49 +08:00
Limin Wang
4ef766e73c avcodec/nvenc: add more sei data support
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-28 21:00:52 +08:00
James Almer
827d6fe73d avcodec/encode: restructure the core encoding code
This commit follows the same logic as 061a0c14bb, but for the encode API: The
new public encoding API will no longer be a wrapper around the old deprecated
one, and the internal API used by the encoders now consists of a single
receive_packet() callback that pulls frames as required.

amf encoders adapted by James Almer
librav1e encoder adapted by James Almer
nvidia encoders adapted by James Almer
MediaFoundation encoders adapted by James Almer
vaapi encoders adapted by Linjie Fu
v4l2_m2m encoders adapted by Andriy Gelman

Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-18 17:11:37 -03:00
Roman Arzumanyan
470bbf60d4 avcodec/nvenc: honor max bitrate in CQ mode
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-06-04 15:33:19 +02:00
James Almer
6e1903938b avcodec/internal: move packet related functions to their own header
Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-02 19:02:12 -03:00
Roman Arzumanyan
0842fd2c25 avcodec/nvenc: zero avg and max bitrate in CQ mode
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-06-01 19:23:47 +02:00
Zachariah Brown
b18fd2b95b avcodec/nvenc: use framerate if available
The h264_nvenc and hevc_nvenc encoders aren't respecting the framerate in the codec context.
Instead it was using the timebase which in our use-case was 1/1000 so the encoder was behaving
as if we wanted 1000fps. This resulted in poor encoding results due to an extremely low bitrate.

Both the amf and qsv encoders already contain similar logic to first check the framerate before
falling back to the timebase.

Signed-off-by: Zachariah Brown <zachariah@renewedvision.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-05-15 00:44:31 +02:00
Timo Rothenpieler
9ce7de9038 avcodec/nvenc: refactor dts calculation logic
The old approach used some highly complex delta computation math and
output-delaying.
I do not remember what the initial reasoning behind that was, but given
that we can just offset the dts by the amount of bframes, it seems wholy
unnecessary.

This leaves open an issue with VFR content, for which some more complex
logic might be needed.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-05-02 01:33:49 +02:00
Timo Rothenpieler
aaadf0dce8 avcodec/nvenc: offset dts to account for b-frame reordering
Fixes ticket #7303

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-05-01 20:52:36 +02:00
Mark Thompson
1dff97b7bc avcodec/nvenc: add hardware config metadata
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-04-27 23:06:06 +02:00
Philip Langdale
3ea7057677 nvenc: implement flush to help allow an encoder to be re-used
It can be useful to re-use an encoder instance when doing segmented
encodings, and this requires flushing the encoder at the start of
each segment.
2020-01-08 19:20:36 -08:00
Timo Rothenpieler
4fb6ce27f0 avcodec/nvenc: make sure newly allocated packets are refcounted
Fixes ticket 8383

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-11-17 01:37:34 +01:00
hydra3333
ba6b20df3f avcodec/nvenc: turn feature check failures into warnings
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-10-29 13:38:24 +01:00
Timo Rothenpieler
ab0ef1abdf avcodec/nvenc: make use of new GetLastErrorString function
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Timo Rothenpieler
51a23343d9 avcodec/nvenc: pass CUstream to nvenc when available
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Roman Arzumanyan
567b5e33d9 avcodec/nvenc: add multiple reference frames support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Timo Rothenpieler
e929b2f248 avcodec/nvenc: switch to dedicated dpb_size option
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Timo Rothenpieler
89cbbe9f70 avcodec/nvenc: fix typo in new Windows driver version
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-24 12:00:00 +02:00
Timo Rothenpieler
648f5c9382 avcodec/nvenc: add driver version info for SDK 9.1
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-23 15:47:27 +02:00
Timo Rothenpieler
2e254bb897 avcodec/nvenc: fix indentation 2019-04-27 12:33:08 +02:00
Timo Rothenpieler
23ed147e8f avcodec/nvenc: only unregister input resources when absolutely needed
This reverts nvenc to old behaviour, which in some super rare edge cases
performs better.
The implication of this is that any potential API user who relies on
nvenc cleaning up every frames device resources after it's done using
them will have to change their usage pattern.

That should not be a problem, since pretty much every normal usage
pattern automatically implies that surfaces are reused from a common
pool, since constant re-allocation is also very expensive.
2019-04-27 12:33:08 +02:00
Timo Rothenpieler
1144d5c96d avcodec/nvenc: add minimum driver version for SDK 8.2 and 9.0
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-03-10 00:25:31 +01:00
Roman Arzumanyan
f1f66df6a2 avcodec/nvenc: add b_as_ref support for HEVC
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-02-14 13:22:09 +01:00
Philip Langdale
19d3d0c057 avutil/hwcontext_cuda: Define and use common CHECK_CU()
We have a pattern of wrapping CUDA calls to print errors and
normalise return values that is used in a couple of places. To
avoid duplication and increase consistency, let's put the wrapper
implementation in a shared place and use it everywhere.

Affects:

* avcodec/cuviddec
* avcodec/nvdec
* avcodec/nvenc
* avfilter/vf_scale_cuda
* avfilter/vf_scale_npp
* avfilter/vf_thumbnail_cuda
* avfilter/vf_transpose_npp
* avfilter/vf_yadif_cuda
2018-11-14 17:39:42 -08:00
Timo Rothenpieler
dc2d56a66b avcodec/nvenc: add option to turn off a53 closed caption embedding 2018-08-21 15:14:56 +02:00
Pavel Koshevoy
f7d117b484 avcodec/nvenc: enable nvenc encoder instance reuse
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2018-06-15 11:18:47 +02:00
Timo Rothenpieler
2e700b082c Revert "avcodec/nvenc: make hw_frames_ctx fully optional"
This reverts commit 7d4e1f7cfb.

Accidentially pushed this with a batch of other patches, and it didn't
seem to break anything, so I went with it.
Except it does, so reverting it it is.
2018-05-10 00:34:21 +02:00
Timo Rothenpieler
fdbb4b9a78 avcodec/nvenc: move reconfig_encoder call inside of push/pop ctx
Also make it void, it must not fail the encode anyway.
2018-05-04 23:35:38 +02:00