Commit Graph

20842 Commits

Author SHA1 Message Date
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