Anton Khirnov
64c81b2cd0
h264: move *_samples_available into the per-slice context
2015-03-21 11:27:12 +01:00
Anton Khirnov
7d8154edd5
h264: move intra4x4_pred_mode[_cache] into the per-slice context
2015-03-21 11:27:12 +01:00
Anton Khirnov
92c6c2a605
h264: split weighted pred-related vars into per-slice context
2015-03-21 11:27:09 +01:00
Anton Khirnov
a06b0b1295
h264: initialize H264Context.avctx in init_thread_copy
...
This prevents using a wrong (first thread's) AVCodecContext if decoding
a frame in the first pass over all threads fails.
2015-02-21 09:29:48 +01:00
Michael Niedermayer
61928b68dc
h264: Do not share rbsp_buffer across threads
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
CC: libav-stable@libav.org
2015-01-28 16:28:58 +01:00
Anton Khirnov
167e004e1a
h264: drop any pretense of support for data partitioning
...
It does not work correctly and apparently never did. There is no
indication that this (mis)feature is ever used in the wild or even that
any software other than the reference supports it.
Since the code that attempts to support it adds some nontrivial
complexity and has resulted in several bugs in the past, it is better to
just drop it.
2015-01-27 09:10:12 +01:00
Anton Khirnov
ecab21ac47
h264: do not reset the ref lists in flush_change()
...
They are always constructed anew when needed, so there is no need to
reset them explicitly.
2015-01-27 09:09:29 +01:00
Anton Khirnov
9404a47a2d
h264: move parser-only variables to their own context
2015-01-27 09:08:31 +01:00
Anton Khirnov
cf1e0786ed
error_resilience: move the MECmpContext initialization into ER code
...
Currently, it needs to be initialized by the ER caller (which is
currently either a mpegvideo decoder or h264dec). However, since none of
those decoders use MECmpContext for anything except ER, it makes more
sense to handle it purely inside ER.
2015-01-27 09:07:59 +01:00
Anton Khirnov
f9f883af4f
h264: simplify code in flush_dpb()
...
There is no point in clearing reference explicitly, since that will be
done as a part of ff_h264_unref_picture() right below.
2015-01-27 08:34:24 +01:00
Anton Khirnov
60d4c6ff76
h264: restore a block mistakenly removed in e10fd08a
...
CC: libav-stable@libav.org
Bug-ID: 781
2014-12-27 10:44:48 +01:00
Michael Niedermayer
d69d787dad
h264: proper cleanup in ff_h264_alloc_tables() if DPB alloc fails
...
CC: libav-devel@libav.org
2014-12-03 02:51:27 +00:00
Dale Curtis
56de2897a6
h264: Fix memory leak on ff_h264_decode_init() failure
...
CC: libav-devel@libav.org
2014-12-03 02:51:18 +00:00
Vittorio Giovara
b1b1a7370e
display: fix order of operands
...
CC: libav-stable@libav.org
Bug-Id: CID 1238828 / CID 1238832
2014-11-13 01:41:25 +01:00
Anton Khirnov
7ea1b3472a
lavc: deprecate the use of AVCodecContext.time_base for decoding
...
When decoding, this field holds the inverse of the framerate that can be
written in the headers for some codecs. Using a field called 'time_base'
for this is very misleading, as there are no timestamps associated with
it. Furthermore, this field is used for a very different purpose during
encoding.
Add a new field, called 'framerate', to replace the use of time_base for
decoding.
2014-10-15 06:37:43 +00:00
Michael Niedermayer
2cd7c99498
h264: reset ret to avoid propagating minor failures
...
Unbreak 772d150a6e
.
CC: libav-stable@libav.org
Bug-Id: 750 / 905753
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-09-29 12:33:55 +01:00
Gabriel Dume
f929ab0569
cosmetics: Write NULL pointer equality checks more compactly
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Felix Abecassis
a7e541c992
h264: fix interpretation of interleved stereo modes
...
Column and row frame packing arrangements were inverted.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-07 11:31:47 +01:00
Diego Biurrun
2d60444331
dsputil: Split motion estimation compare bits off into their own context
2014-07-17 09:07:10 -07:00
Luca Barbato
2db953f846
h264: K&R formatting cosmetics
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-07-17 03:05:24 -07:00
Vittorio Giovara
18e3d61e9e
h264: parse display orientation SEI message
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-07-09 10:17:42 -04:00
Vittorio Giovara
772d150a6e
h264: error out from decode_nal_units() when AV_EF_EXPLODE is set
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-06-23 18:58:57 -04:00
Luca Barbato
e10fd08aa7
h264: Refactor decode_nal_units
2014-04-06 23:33:17 +02:00
Luca Barbato
f51d0f39c0
h264: Split h264 slice decoding from nal decoding
2014-03-23 22:41:12 +01:00
Vittorio Giovara
e9a77f4bc0
h264: move macroblock decoding into its own file
2014-03-23 22:41:12 +01:00
Vittorio Giovara
d24e9a99a4
h264 does not depend on mpegvideo any more
2014-03-16 23:05:47 +01:00
Vittorio Giovara
e0c16e4e32
mpegvideo: move mpegvideo formats-related defines to mpegutils.h
2014-03-16 23:04:41 +01:00
Vittorio Giovara
136034d86b
h264: Remove MotionEstContext and move the relevant fields to H264Context
...
Unused buffers scratchpad and temp have been dropped too.
2014-03-16 23:01:01 +01:00
Vittorio Giovara
e3c2d0f3d4
h264: Replace mpegvideo-specific MAX_THREADS by private define
2014-03-16 23:01:01 +01:00
Vittorio Giovara
5d1c2e53ab
h264: Replace mpegvideo-specific MAX_PICTURE_COUNT by private define
2014-03-16 23:01:01 +01:00
Vittorio Giovara
9b749c8274
h264: move relevant fields from Picture to H264Picture
2014-03-16 23:01:00 +01:00
Vittorio Giovara
d66e305bd1
er: move relevant fields from Picture to ERPicture
...
This is done to disentangle ER from mpegvideo. In order to use a
classic Picture, callers can use ff_mpeg_set_erpic() or use a custom function
to set the fields. Please note that buffers need to be allocated before
calling ff_er_frame_end().
2014-03-16 23:01:00 +01:00
Vittorio Giovara
1c79b1625d
h264: directly use frames in ff_h264_draw_horiz_band()
2014-03-16 23:01:00 +01:00
Diego Biurrun
f2408ec9d7
Give IDCT matrix transpose macro a more descriptive name
...
This also avoids a macro name clash and related warning on ARM.
2014-02-27 13:38:00 -08:00
Luca Barbato
d922c5a5fb
h264: Fix a typo from the previous commit
...
f777504f64
changed a - in +
CC: libav-stable@libav.org
2014-02-22 12:26:32 +01:00
Vittorio Giovara
f777504f64
h264: Lower bound check for slice offsets
...
And use the value from the specification.
Sample-Id: 00000451-google
Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-02-20 18:58:38 +01:00
Luca Barbato
fea6db064b
h264: informative error reporting in decode_slice_header()
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-02-18 23:47:55 +01:00
Luca Barbato
96f9fbe109
h264: fix slice_type value reported in decode_slice_header()
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-02-18 23:47:32 +01:00
Vittorio Giovara
15210354cf
h264: drop outdated comments
2014-02-14 05:08:37 +01:00
Vittorio Giovara
3a05767028
h264: store current_sps_id inside the current sps
...
In preparation for MVC support.
2014-02-14 05:05:46 +01:00
Vittorio Giovara
73e8fab31d
h264: print values in case of error
...
Also make error style consistent and drop redundant information.
2014-02-14 05:05:35 +01:00
Janne Grunau
f795a8a8bf
h264: make context_count unsigned
...
Removes the bogus but scary looking warning 'libavcodec/h264.c:4529:49:
warning: array subscript is below array bounds [-Warray-bounds]'.
2014-02-12 15:48:03 +01:00
Anton Khirnov
1f097d168d
h264: reset data partitioning at the beginning of each decode call
...
Prevents using GetBitContexts with data from previous calls.
Fixes access to freed memory.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-02-04 11:26:17 +01:00
Janne Grunau
fb0c9d41d6
avutil: remove timer.h include from internal.h
...
Added libavutil/timer.h include to all files with {START,STOP}_TIMER.
2014-01-25 21:50:20 +01:00
Janne Grunau
ea49f60523
h264: skip chroma edges at the picture boundary while deblocking 4:4:4
...
This handles macroblock edges for the chroma components in the same way
as for the luma compoment for 4:4:4 streams. The Spec explicitly states
that the deblocking filter is not applied to edges at the boundary of
the picture.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-01-22 13:44:28 +01:00
Anton Khirnov
8b2e5e42bb
h264: check that an IDR NAL only contains I slices
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-18 20:53:31 +01:00
Anton Khirnov
0652e024c6
h264: reset ref count if decoding the slice header fails
...
Otherwise the ER code might try to use some already freed references.
Fixes possible access to freed memory.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-18 20:51:04 +01:00
Anton Khirnov
00dbff4c3e
h264: do not call field_end if we do not have a current picture
...
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-18 20:42:21 +01:00
Anton Khirnov
7f0e81db3c
h264: limit allowed pred modes in ff_h264_check_intra_pred_mode() to 3
...
Higher modes are not allowed for 16x16/chroma, which is what this
function is used for. Otherwise this function would return 0 (vertical
prediction) for invalid higher modes, which could result in invalid
reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-18 20:41:59 +01:00
Anton Khirnov
d1b3fabe69
h264: reset first_field if frame_start() fails for missing refs
...
In this case we may not have a current frame, while first_field being
set implies we do.
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-18 20:41:24 +01:00
Anton Khirnov
9eef9eb301
h264: check that execute_decode_slices() is not called too many times
...
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-06 08:25:25 +01:00
Anton Khirnov
bfd26b7ce6
h264: reject mismatching luma/chroma bit depths during sps parsing
...
There is no point in delaying the check and it avoids bugs with a
half-initialized context.
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-06 08:23:45 +01:00
Anton Khirnov
9a026c7298
h264: rebuild the default ref list if the reference count changes
...
Fixes possible access to freed memory.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-06 08:23:17 +01:00
Anton Khirnov
58312b2472
h264: reset data_partitioning if decoding the slice header for NAL_DPA fails
...
If it was set before then we can end up trying to decode a slice without
a valid slice header, which can lead to invalid memory access.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-01-03 16:42:02 +01:00
Luca Barbato
4d2bb28931
h264: namespace the decode function
...
Make much easier debugging.
2013-12-27 07:48:13 +01:00
Anton Khirnov
598ce4ab4f
h264: call av_frame_unref() instead of avcodec_get_frame_defaults().
...
This is a temporary workaround to allow deprecating
avcodec_get_frame_defaults(). The proper solution will be using a
properly allocated AVFrame in Picture.
2013-12-11 20:39:55 +01:00
Vittorio Giovara
5b10ef729f
h264: parse frame packing arrangement SEI messages and save relevant stereo3d information
2013-12-09 16:02:43 +01:00
Anton Khirnov
f0259a587e
h264: check buffer size before accessing it
...
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2013-11-21 20:54:20 +01:00
Anton Khirnov
a553c6a347
lavc: use buf[0] instead of data[0] in checks whether a frame is allocated
...
data[0] may be NULL for valid frames with hwaccel pixel formats.
2013-11-18 18:09:48 +01:00
Ronald S. Bultje
458446acfa
lavc: Edge emulation with dst/src linesize
...
Allow supporting files for which the image stride is smaller than
the maximum block size + number of subpel mc taps, e.g. a 64x64 VP9
file or a 16x16 VP8 file with -fflags +emu_edge.
2013-11-15 10:16:27 +01:00
Anton Khirnov
9eda9d3322
h264: free the tables and uninitialize the context on flush
...
Prevents referencing empty frames when the first packet after the flush
does not contain a frame.
2013-11-14 19:00:20 +01:00
Luca Barbato
08303d7741
hwaccel: Simplify ff_find_hwaccel
...
It is always called by passing fields from an AVCodecContext.
2013-11-10 13:59:48 +01:00
John Stebbins
28096e0a80
h264: wait for initial complete frame before outputing frames
...
This can be optionally disabled whith the "output_corrupt" flags
option. When in "output_corrupt" mode, incomplete frames are
signalled through AVFrame.flags FRAME_FLAG_INCOMPLETE_FRAME.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-31 20:14:14 +01:00
Derek Buitenhuis
58d13cea30
h264: Check all allocations
...
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-10-29 14:00:29 +00:00
Ronald S. Bultje
93f305473f
lavc: Convert some remaining strides to ptrdiff_t
2013-10-15 23:58:20 +02:00
Yusuke Nakamura
4baba6c813
h264_parser: Fix POC parsing for the case where MMCO_RESET is present.
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-15 20:02:55 +02:00
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
2013-10-03 23:32:01 +02:00
Anton Khirnov
cab8c5f8e1
h264: do not reinitialize the global cabac tables at each slice header
2013-09-24 17:13:52 +02:00
Rainer Hochecker
71cabb521a
h264: do not discard NAL_SEI when skipping frames
...
Setting AVDISCARD_NONREF (e.g. after flushing) resulted in 100% dropped frames.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-24 13:24:29 +02:00
Vittorio Giovara
edaba18021
h264: log extradata skip only for non-ignored NALs
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-24 13:24:28 +02:00
Vittorio Giovara
1cad7171dd
h264: remove an unused static constant
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-20 14:40:10 +03:00
Diego Biurrun
c4e43560fe
h264data: Move some tables to the only place they are used
2013-08-20 20:49:37 +02:00
Diego Biurrun
2a61592573
avcodec: Remove some commented-out debug cruft
2013-08-20 19:59:50 +02:00
Vittorio Giovara
c1076d8479
h264: check one context_init() allocation
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-10 13:36:38 +02:00
Vittorio Giovara
5eb488bfa8
h264: use explicit variable names for *_field_flag
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-10 13:36:25 +02:00
Vittorio Giovara
b3dc260e7f
h264: return meaningful values
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-10 13:28:51 +02:00
Rémi Denis-Courmont
578ea75a9e
vdpau: remove old-style decoders
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-05 11:15:49 +02:00
Yusuke Nakamura
a8b19271c3
avcodec: Add output_picture_number to AVCodecParserContext
...
Set output_picture_number in H.264 parser.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-08-02 20:59:45 +02:00
Diego Biurrun
16c22122c7
h264: K&R formatting cosmetics
2013-07-27 10:47:38 +02:00
Yusuke Nakamura
3f1a7ceb2c
h264_parser: Set field_order and picture_structure.
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-05-24 08:45:05 +02:00
Diego Biurrun
fce99322b0
h264: Drop unused variable
2013-04-22 12:05:09 +02:00
Ronald S. Bultje
c443117f25
dsputil: Remove dct_bits
...
dct_bits is never set except in h264, where it is never used,
thus remove it.
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-19 23:29:22 +03:00
Anton Khirnov
5e83d9aced
h264: fully support cropping.
...
Based on a patch by Vittorio Giovara <vittorio.giovara@gmail.com>
Fixes Bug 378.
2013-04-19 09:28:08 +02:00
Ronald S. Bultje
85deb51a01
h264: Only initialize dsputil if error resilience is enabled
...
It is only used for error resilience. This allows building the
h264 decoder without dsputil, if error resilience is disabled.
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-10 11:03:53 +03:00
Ronald S. Bultje
62844c3fd6
h264: Integrate clear_blocks calls with IDCT
...
The non-intra-pcm branch in hl_decode_mb (simple, 8bpp) goes from 700
to 672 cycles, and the complete loop of decode_mb_cabac and hl_decode_mb
(in the decode_slice loop) goes from 1759 to 1733 cycles on the clip
tested (cathedral), i.e. almost 30 cycles per mb faster.
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-10 11:03:06 +03:00
Martin Storsjö
e8cafd2773
h264: Clear the mb members via memset instead of using dsputil
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-10 11:01:21 +03:00
Janne Grunau
05fa79b844
hwaccel: fix use with frame based multithreading
...
Allows use of AVHWAccel based decoders with frame based multithreading.
The decoders will be forced into an non-concurrent mode by delaying
ff_thread_finish_setup() calls after decoding of the current frame
is finished.
This wastes memory by unnecessarily using multiple threads and thus
copies of the decoder context but allows seamless switching between
hardware accelerated and frame threaded software decoding when the
hardware decoder does not support the stream.
2013-03-26 19:44:50 +01:00
Ronald S. Bultje
0b499c9b06
h264: Make it possible to compile without error_resilience
...
Error resilience is enabled by the h264 decoder, unless explicitly
disabled. --disable-everything --enable-decoder=h264 will produce
a h264 decoder with error resilience enabled, while
--disable-everything --enable-decoder=h264 --disable-error-resilience
will produce a h264 decoder with error resilience disabled.
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-26 09:55:05 +02:00
Martin Storsjö
ccd349e555
h264: Remove an unused variable
...
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-25 15:00:05 +02:00
Anton Khirnov
fcf75022d7
h264: remove redundant freeing of DPB in h264_decode_end
...
free_tables() frees it already.
2013-03-21 10:21:11 +01:00
Anton Khirnov
23e85be58f
h264: add a parameter to the CHROMA444 macro.
...
This way it does not look like a constant.
2013-03-21 10:21:02 +01:00
Anton Khirnov
e962bd08ee
h264: add a parameter to the CHROMA422 macro.
...
This way it does not look like a constant.
2013-03-21 10:20:58 +01:00
Anton Khirnov
6d2b6f21eb
h264: add a parameter to the CABAC macro.
...
This way it does not look like a constant.
2013-03-21 10:20:52 +01:00
Anton Khirnov
a6931d8ece
h264: add a parameter to the FIELD_OR_MBAFF_PICTURE macro.
...
This way it does not look like a constant.
2013-03-21 10:20:48 +01:00
Anton Khirnov
7fa00653a5
h264: add a parameter to the FIELD_PICTURE macro.
...
This way it does not look like a constant.
2013-03-21 10:20:44 +01:00
Anton Khirnov
7bece9b22f
h264: add a parameter to the FRAME_MBAFF macro.
...
This way it does not look like a constant.
2013-03-21 10:20:39 +01:00
Anton Khirnov
da6be8fcec
h264: add a parameter to the MB_FIELD macro.
...
This way it does not look like a constant.
2013-03-21 10:20:35 +01:00
Anton Khirnov
82313eaa34
h264: add a parameter to the MB_MBAFF macro.
...
This way it does not look like a constant.
2013-03-21 10:20:30 +01:00
Anton Khirnov
48d0fd2d62
h264: merge common_init() into ff_h264_decode_init.
...
There is no point in keeping those separate.
2013-03-21 10:20:10 +01:00
Anton Khirnov
25408b2a06
h264: make ff_h264_frame_start static.
...
It is not called from outside h264.c
2013-03-21 10:19:54 +01:00