1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-11 09:57:54 +02:00
Commit Graph

20896 Commits

Author SHA1 Message Date
Vittorio Giovara
40dd5166d2 truemotion2rt: Use ff_set_dimensions 2016-06-21 09:38:56 -04:00
Vittorio Giovara
a816432337 pixdesc: Add new SMPTE 431, 432, and 2085 color properties
Appeared in H.264 2016/02.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-21 09:29:04 -04:00
Neil Birkbeck
5d560d38de pixfmt: Add ARIB STD-B76 color transfer characteristic
Adding hybrid log-gamma (https://en.wikipedia.org/wiki/Hybrid_Log-Gamma)
based on the standardization in ARIB STD-B67:
http://www.arib.or.jp/english/html/overview/doc/2-STD-B67v1_0.pdf

The choice of enum value of 18 is consistent with HEVC:
http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=10481

And also with latest proposal for color format in mkv:
https://mailarchive.ietf.org/arch/search/?email_list=cellar&gbt=1&q=Colour+Format+proposal

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-21 09:02:46 -04:00
Anton Khirnov
58640fe89e h264: handle frame recovery in h264_field_start()
This is a more appropriate place for this. H264Context.recovery_frame is
shared between frame threads, so modifying it where it is right now is
invalid.
2016-06-21 11:20:51 +02:00
Anton Khirnov
e26c64148b h264: discard slices of redundant pictures right after parsing the slice header
Going through the whole decoder initialization process for a slice we
are not going to decode is unnecessary and potentially dangerous.
2016-06-21 11:20:26 +02:00
Anton Khirnov
6efc463858 h264: always set redundant_pic_count during slice header parsing
It is always checked in the surrounding code, so this make sure we don't
see a value from an old slice.
2016-06-21 11:20:20 +02:00
Anton Khirnov
606fb6c032 h264: call the hwaccel frame_start() from h264_field_start()
This is a more appropriate place for it.
2016-06-21 11:19:51 +02:00
Anton Khirnov
d1d7678040 h264: fix the check for mixed IDR/non-IDR slices 2016-06-21 11:19:19 +02:00
Anton Khirnov
b13fc1e344 h264: do not pass H264Context to h264_slice_header_parse()
This should make it more clear that this function does not need any
decoder-global state other than the parameter sets.
2016-06-21 11:18:44 +02:00
Anton Khirnov
996f13413b h264: fix warnings in fill_filter_caches_inter()
The code does some weird casting to a 2-dimensional sub-array of
ref2frm. This is not necessary, since only one dimension is needed
there.
2016-06-21 11:18:15 +02:00
Anton Khirnov
bc7f426851 h264: drop tests whether the codec id is AV_CODEC_ID_H264
Those are unused remnants of the old SVQ3 code.
2016-06-21 11:17:59 +02:00
Anton Khirnov
8281cd5cb8 h264_cabac: drop an always true condition 2016-06-21 11:17:53 +02:00
Anton Khirnov
5c2fb561d9 h264: add H264_ prefix to the NAL unit types
This will prevent conflicts e.g. in code that deals with both h264 and
hevc.
2016-06-21 11:17:28 +02:00
Anton Khirnov
1cf2f3d334 h264_sei: drop an unnecessary h264dec.h include
The code does not depend on the h264 decoder anymore and only needs
information from h264_ps
2016-06-21 11:15:44 +02:00
Anton Khirnov
b24dafe105 lavc: drop unnecessary h264dec.h includes 2016-06-21 11:15:11 +02:00
Anton Khirnov
70b1dcef2d h264: tighten the valid range for ref_frame_count
This field (which the spec calls max_num_ref_frames) must be less than
or equal to MaxDpbFrames, which is at most 16.
2016-06-21 11:14:07 +02:00
Anton Khirnov
f638b67e57 h264: move the parameter set definitions to a new header file
The PS parsing code is independent from the decoder, so it makes more
sense for it to have its own separate header.
2016-06-21 11:13:29 +02:00
Anton Khirnov
4e2f621248 svq3: stop using H264Picture
The SVQ3 decoder has been decoupled from the H.264 decoder, so it can
now use its own data type.
2016-06-21 11:13:08 +02:00
Anton Khirnov
251cbb4400 h264: create a new header for common h264 definitions
Move the NAL unit types into it. This will allow to stop including the
whole decoder-specific h264dec.h in some code that is unrelated to the
decoder and only needs some enum values.
2016-06-21 11:12:41 +02:00
Anton Khirnov
9df889a5f1 h264: rename h264.[ch] to h264dec.[ch]
This is more consistent with the naming of other decoders.
2016-06-21 11:11:26 +02:00
Anton Khirnov
f651c6a259 h264: factor out setting frame properties / side data
Right now this code is mixed with selecting the next output frame. Move
it to a separate function called from h264_field_start(), which is a
more appropriate place for this.
2016-06-21 11:10:58 +02:00
Anton Khirnov
19446dc5ff h264: drop unused NAL_FF_IGNORE 2016-06-21 11:10:46 +02:00
Anton Khirnov
bcd91f1644 h264: move a per-field block from decode_slice_header() to field_start()
This is a more appropriate place for it.
2016-06-21 11:10:29 +02:00
Anton Khirnov
17e7c03e12 h264: only allow ending a field/starting a new one before finish_setup()
Doing this after ff_thread_finish_setup() is called is invalid and can
conflict with reads from the other thread.
2016-06-21 11:10:00 +02:00
Anton Khirnov
debca90863 h264: store {curr,max}_pic_num in the per-slice context
While the value of those variables will be constant for the whole frame,
they are only used in two functions called from slice header decoding.
Moving them to the per-slice context allows us to make the H264Context
passed to slice_header_parse() constant.
2016-06-21 11:09:21 +02:00
Anton Khirnov
f966498e43 h264: decode the poc values from the slice header into the per-slice context
Copy them into the decoder-global context in field_start(). This avoids
modifying the decoder-global context during bitstream parsing.
2016-06-21 11:08:56 +02:00
Anton Khirnov
54dd9b1cdd h264: set mb_aff_frame in frame_start()
Avoid unnecessary modification of the decoder-global state in per-slice
code.
2016-06-21 11:08:32 +02:00
Anton Khirnov
8d36932c8d h264: move the block starting a new field out of slice_header_parse()
There is no bitstream parsing in that block and messing with
decoder-global state is not something that belongs into header parsing.

Nothing else in this function depends on the value of current_slice,
except for two validity checks. Those checks are also moved out of
slice_header_parse().
2016-06-21 11:08:03 +02:00
Anton Khirnov
b25cd7540e h264: pass a H2645NAL to slice header decoding
Replace the decoder-global nal_unit_type/nal_ref_idc variables with the
per-NAL ones. The decoder-global ones still cannot be removed because
they are used by hwaccels.
2016-06-21 11:07:10 +02:00
Paul B Mahol
470cd0c5fe Add TrueMotion 2.0 Real Time decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-20 15:48:12 -04:00
Paul B Mahol
d78fd2fa21 Add MagicYUV decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-20 15:45:51 -04:00
Jerome Martinez
ec9f04423b ffv1: Error out on unsupported format
Transparency is supported only by YUV and within specific bit depths.
2016-06-18 12:46:43 +02:00
Vittorio Giovara
187d719760 h264: Support AV_PKT_DATA_NEW_EXTRADATA 2016-06-17 11:05:33 -04:00
Vittorio Giovara
75872d77d2 lavc: Document AV_PKT_DATA_NEW_EXTRADATA 2016-06-17 11:02:40 -04:00
Martin Storsjö
f1a9eee41c x86: Add missing movsxd for the int stride parameter
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-06-17 00:11:21 +03:00
Diego Biurrun
84b2d3fb68 h264: Drop unused function check_opcodes() 2016-06-14 11:14:06 +02:00
Vittorio Giovara
05a4bacbf7 avpacket: Error out when creating 0-sized side data
This mimics the behaviour of other av_*_new_side_data().
This is not caught by the malloc check, since padding
is always added to the allocated size.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-13 13:31:21 -04:00
Anton Mitrofanov
a833ff68f6 h264: Fix decoding delay for Intra only streams
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-06-12 20:29:29 +02:00
Anton Khirnov
90f469aa2b lavc: add H.264 MVC profiles 2016-06-12 20:27:53 +02:00
Anton Khirnov
61f168ae34 h264: factor out setting the parameter sets for a frame 2016-06-12 20:27:53 +02:00
Anton Khirnov
6e92181bf8 h264: pass just the PPS to get_chroma_qp()
It does not need the whole context. This will simplify the following
commit.
2016-06-12 20:27:53 +02:00
Anton Khirnov
d1f539c97e h264: merge the two reinit blocks in slice_header_parse()
The only difference is that the first of them contains a
ff_h264_flush_change() call. While that is not necessary in the second
block, it should cause no problems either.

Reduce the verbosity of the reinit log message from info to verbose,
since now it will be displayed during every decode session.
2016-06-12 20:27:53 +02:00
Anton Khirnov
3fba16ecd9 h264: factor starting a new field out of parsing the slice header 2016-06-12 20:27:53 +02:00
Anton Khirnov
bec993381c h264: postpone generating the implicit MMCOs
Do it right before the MMCOs are applied to the DPB. This will allow
moving the frame_start() call out of the slice header parsing, since
generating the implicit MMCOs needs to be done after frame_start().
2016-06-12 20:27:53 +02:00
Anton Khirnov
2d410ebbaa h264: decode the MMCOs into per-slice contexts
They are stored in the slice header, so technically they are per-slice
(though they must be the same in every slice). This will simplify the
following commits.
2016-06-12 20:27:53 +02:00
Anton Khirnov
39ab2ea531 h264: rename mmco_index to nb_mmco
The variable stores the number of mmco entries, so the current name is
misleading.
2016-06-12 20:27:53 +02:00
Anton Khirnov
7ab5d577a9 h264: move initializing the slice start out of h264_slice_header_parse() 2016-06-12 20:27:53 +02:00
Anton Khirnov
4cec43a9ee h264: move calculating the POC out of h264_slice_header_parse()
This function does not do any bitstream parsing and it depends on the
current frame being allocated, so this will allow the frame_start() to
be moved out eventually.
2016-06-12 20:27:52 +02:00
Anton Khirnov
6dd996c7c8 h264: move building the reference list out of h264_slice_header_parse()
This does not do any bitstream parsing and will allow moving out other
code in later commits.
2016-06-12 20:27:52 +02:00
Anton Khirnov
0bad254300 h264: move initing the implicit pred weight table out of h264_slice_header_parse()
It depends on the reference list, so this will allow moving out the
reference list construction and consequently other code it depends on.
2016-06-12 20:27:52 +02:00
Anton Khirnov
ed9a20ebe4 h264: split reading the ref list modifications and actually building the ref list
This will allow postponing the reference list construction (and by
consequence some other functions, like frame_start) until the whole
slice header has been parsed.
2016-06-12 20:27:52 +02:00
Anton Khirnov
fa57059079 h264: move initialising the implicit pred weight table for MBAFF
Do it where the normal implicit table is initialised.
2016-06-12 20:27:52 +02:00
Anton Khirnov
7b50d60442 h264: call ff_h264_fill_mbaff_ref_list() when constructing the normal ref list
There is no real reason to call it separately.
2016-06-12 20:27:52 +02:00
Anton Khirnov
b16e9b9ac9 h264: move initialising the explicit pred weight table for MBAFF
Currently it's done in the code that initialises the ref list for
MBAFF, which is not a logical place for it. Move it to the function that
parses the pred table from the bitstream, which is analogous to what is
done for the implicit weight table as well.
2016-06-12 20:27:52 +02:00
Anton Khirnov
b93c0aed79 h264: drop an outdated comment 2016-06-12 20:27:52 +02:00
Anton Khirnov
77a1e2c5f8 h264: move direct mode inits out of h264_slice_header_parse()
This code does not do any bitstream parsing, it just initializes some
internal state.
2016-06-12 20:27:52 +02:00
Anton Khirnov
d06e4d8aab h264: start splitting decode_slice_header()
That function is currently very long and entangles bitstream parsing and
decoder configuration. This makes the code much harder to read than
necessary.

Begin splitting the code that configures the decoder state based on the
slice header information from the parsing of the slice header.
2016-06-12 20:27:52 +02:00
Mark Thompson
2940e196c5 vaapi_h265: cu_qp_delta should not be used in constant-QP mode 2016-06-09 21:15:39 +01:00
Mark Thompson
02fa1ad926 vaapi_h264: Add source version identifier as unregistered SEI
Contains the libavcodec version, the VAAPI version and the libva
driver vendor string.
2016-06-09 21:15:39 +01:00
Mark Thompson
48e2967cd5 vaapi_h264: Add support for SEI messages
Send buffering_period and pic_timing messages when in modes
targetting bitrate.  Also adds NAL HRD parameters to VUI.
2016-06-09 21:15:39 +01:00
Mark Thompson
19d7667a81 vaapi_encode: Add support for writing arbitrary additional packed headers 2016-06-09 21:15:39 +01:00
Mark Thompson
081961f819 vaapi_h264: Add support for VUI parameters
Supports aspect ratio, colour format and timing information.
2016-06-09 21:15:39 +01:00
Anton Khirnov
2e4a7bd553 h264: drop unused H264Context.gb
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-06-09 11:19:15 +02:00
Diego Biurrun
4f81f8dba7 Drop unnecessary golomb.h #includes 2016-06-08 18:51:57 +02:00
Diego Biurrun
197ae68e78 Drop unnecessary unary.h #includes 2016-06-08 18:51:56 +02:00
Diego Biurrun
6ac52f05a6 dvbsub_parser: Add missing mem.h #include 2016-06-08 18:51:56 +02:00
Diego Biurrun
81f769fa12 gsm: Move requant_tab table to the gsm tables file
This avoids duplicating the table in the gsm template file.
Also adjust the table type to uint8_t to save space.
2016-06-07 13:22:22 +02:00
Diego Biurrun
42dc214323 mpc: Drop unused GetBitContext context member 2016-06-07 13:09:57 +02:00
Diego Biurrun
85b8403c6f svq1enc: Drop unused GetBitContext context member 2016-06-07 13:09:57 +02:00
Diego Biurrun
6d8fd614ff vorbis: Kill some pointless debug code 2016-06-07 13:09:57 +02:00
Diego Biurrun
59c6509d9f mss2: Drop a silly assert 2016-06-07 13:09:57 +02:00
Diego Biurrun
b668662939 get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes
This avoids the danger that get_bits.h might get indirectly #included before
BITSTREAM_READER_LE is defined.

Also sort headers into canonical order where appropriate.
2016-06-07 13:09:57 +02:00
Diego Biurrun
09c4e5c598 indeo2: Drop disabled big-endian ir2_codes table
Only the little-endian variant of the table is ever used.
2016-06-07 13:09:57 +02:00
Diego Biurrun
b7f98659f2 Remove unnecessary get_bits.h #includes 2016-06-07 13:09:57 +02:00
Paul B Mahol
2a48a75a6f sgirledec: simplify, no need to use reget buffer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-06 12:05:02 -04:00
Paul B Mahol
6e2ad28cf7 aic: add frame threading support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-06 12:03:20 -04:00
Denis Charmet
38f99017e6 vp9: Return the correct size when decoding a superframe
According to avcodec.h, avcodec_decode_video2 should return the number of
bytes used if a frame was decoded.

The current implementation returns size - used size of all the subframes.
This fixes the VLC's bug https://trac.videolan.org/vlc/ticket/16836.

The superframe is always fully consumed.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-06-05 16:58:04 +02:00
Diego Biurrun
535a742c26 build: Change structure of the linker version script templates
Split version files into one line per symbol/directive to allow compatibility
with the Solaris linker without preprocessing and eliminate $ from version file
templates to simplify the postprocessing shell command.
2016-05-29 16:43:11 +02:00
Diego Biurrun
1e9c5bf4c1 asm: FF_-prefix internal macros used in inline assembly
These warnings conflict with system macros on Solaris, producing
truckloads of warnings about macro redefinition.
2016-05-28 19:18:26 +02:00
Diego Biurrun
dc40a70c57 Drop unnecessary libavutil/x86/asm.h #includes 2016-05-28 19:18:26 +02:00
Luca Barbato
5264e7ba21 ac3: Check the array bound before dereferencing
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2016-05-27 15:49:48 +02:00
Mark Thompson
a86aa16088 vaapi_h264: Add trivial support for low-power encoding
Experimental; requires Skylake and VAAPI 0.39.1 (not yet released).
Also increases the allowed range of the quality option - in low-power
mode, the Intel driver supports levels 1-8 (and 0 meaning default).
2016-05-27 10:57:00 +01:00
Mark Thompson
b51c7c6b8a vaapi_h264: Fix frame_num after non-reference frames
Non-reference frames (nal_ref_idc == 0) should be discardable, so
frame_num does not advance after them.  Before this change, a stream
containing unreferenced B-frames would be rejected by the reference
decoder.
2016-05-27 10:56:55 +01:00
Mark Thompson
2bfa067d0b vaapi_encode: Check config attributes before creating config
This prevents attempts to use unsupported modes, such as low-power
H.264 mode on non-Skylake targets.  Also fixes a crash on invalid
configuration, when trying to destroy an invalid VA config/context.
2016-05-27 10:56:45 +01:00
Andrey Turkin
24b5cff01b lavc: handle hw_frames_ctx where necessary
avcodec_copy_context() didn't handle hw_frames_ctx references correctly
which could cause crashes.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-26 15:40:05 +02:00
Diego Biurrun
4024b566d6 golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names 2016-05-25 16:37:43 +02:00
Diego Biurrun
e47b8bbf0b avcodec: Bump micro version after changing public JPEG 2000 defines 2016-05-24 15:47:15 +02:00
Francois Cartegnie
ad61da054b jpeg2000: Fix profile define values
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-24 12:22:57 +02:00
Anton Khirnov
2ef6dab0a7 lavc: document that avcodec_close() should not be used
We cannot deprecate it until the new parser API is in place, because of
the way libavformat works. But the majority of the users can already
simply replace it with avcodec_free_context(), which will simplify the
transition once it is finally deprecated.
2016-05-23 06:46:18 +02:00
Anton Khirnov
04fc8e24a0 lavc: deprecate avcodec_get_context_defaults3()
This function is supposed to "reset" a codec context to a clean state so
that it can be opened again. The only reason it exists is to allow using
AVStream.codec as a decoding context (after it was already
opened/used/closed by avformat_find_stream_info()). Since that behaviour
is now deprecated, there is no reason for this function to exist
anymore.
2016-05-23 06:46:17 +02:00
Anton Khirnov
5f30ac2779 lavc: deprecate avcodec_copy_context()
Since AVCodecContext contains a lot of complex state, copying a codec
context is not a well-defined operation. The purpose for which it is
typically used (which is well-defined) is copying the stream parameters
from one codec context to another. That is now possible with through the
AVCodecParameters API. Therefore, there is no reason for
avcodec_copy_context() to exist.
2016-05-23 06:46:17 +02:00
Luca Barbato
74b1bf632f mp3: Make the extrasize explicit
Initialize the bit buffer with the correct size (amount of bits that will
be read) instead of relying on the bitstream reader overreading the
correct values.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-22 23:07:54 +02:00
Diego Biurrun
52567e8198 get_bits: Drop some TRACE-level debug code
It will not be provided by the new bit reader anyway.
2016-05-22 20:22:43 +02:00
Anton Khirnov
3399a26d3f nvenc: allow setting the number of slices
Based on a patch by Agatha Hu <ahu@nvidia.com>
2016-05-19 14:17:04 +02:00
Philip Langdale
10545f84b8 nvenc: De-compensate aspect ratio compensation of DVD-like content.
For reasons we are not privy to, nvidia decided that the nvenc encoder
should apply aspect ratio compensation to 'DVD like' content, assuming that
the content is not BT.601 compliant, but needs to be BT.601 compliant. In
this context, that means that they make the following, questionable,
assumptions:

1) If the input dimensions are 720x480 or 720x576, assume the content has
an active area of 704x480 or 704x576.

2) Assume that whatever the input sample aspect ratio is, it does not account
for the difference between 'physical' and 'active' dimensions.

From these assumptions, they then conclude that they can 'help', by adjusting
the sample aspect ratio by a factor of 45/44. And indeed, if you wanted to
display only the 704 wide active area with the same aspect ratio as the full
720 wide image - this would be the correct adjustment factor, but what if you
don't? And more importantly, what if you're used to lavc not making this kind
of adjustment at encode time - because none of the other encoders do this!

And, what if you had already accounted for BT.601 and your input had the
correct attributes? Well, it's going to apply the compensation anyway!
So, if you take some content, and feed it through nvenc repeatedly, it
will keep scaling the aspect ratio every time, stretching your video out
more and more and more.

So, clearly, regardless of whether you want to apply bt.601 aspect ratio
adjustments or not, this is not the way to do it. With any other lavc
encoder, you would do it as part of defining your input parameters or do
the adjustment at playback time, and there's no reason by nvenc should
be any different.

This change adds some logic to undo the compensation that nvenc would
otherwise do.

nvidia engineers have told us that they will work to make this
compensation mechanism optional in a future release of the nvenc
SDK. At that point, we can adapt accordingly.

Signed-off-by: Philip Langdale <philipl@overt.org>
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-19 14:17:04 +02:00
Anton Khirnov
9375c97460 nvenc: list the major contributors in the copyright header 2016-05-19 14:17:04 +02:00
Anton Khirnov
6f58b4dc47 nvenc: drop the hard dependency on CUDA
The code needs only a few definitions from cuda.h, so define them
directly when CUDA is not enabled. CUDA is still required for accepting
HW frames as input.

Based on the code by Timo Rothenpieler <timo@rothenpieler.org>.
2016-05-19 14:17:03 +02:00
Anton Khirnov
f11ec8cee7 nvenc: only support HW frames when CUDA is enabled
hwcontext_cuda.h includes cuda.h, so this will allow building nvenc
without depending on cuda.h
2016-05-19 14:17:03 +02:00
Anton Khirnov
2156c4c300 nvenc: write the VUI signal properties for HEVC
Bump the API version requirement to 6.

Based on a patch by Agatha Hu <ahu@nvidia.com>.
2016-05-19 14:17:03 +02:00
Anton Khirnov
a1df786503 nvenc: only write the VUI signal type fields if they are set
Based on a patch by Agatha Hu <ahu@nvidia.com>.
2016-05-19 14:17:03 +02:00