Anton Khirnov
a0f2946068
h264: use properly allocated AVFrames
2015-04-29 05:52:58 +02:00
Anton Khirnov
7a4f74eed5
h264: embed the DPB in the context
...
It now has a fixed size and is initialized only once, so there is no
point in allocating it separately.
2015-04-29 05:52:58 +02:00
Anton Khirnov
440e8dd374
h264: drop a comment that carries no useful information
2015-04-29 05:52:58 +02:00
Anton Khirnov
11f024ef0a
h264: move freeing the escaped RBSP buffer to free_context()
...
It does not logically belong in free_tables(), since it's not allocated
in alloc_tables() and its size has nothing to do with the frame size.
2015-04-29 05:52:58 +02:00
Anton Khirnov
ee62b364be
h264: eliminate ff_h264_set_parameter_from_sps()
...
That function currently does two things -- reinitializing the DSP
contexts and setting low_delay based on the SPS values.
The former more appropriately belongs in h264_slice_header_init(), while
the latter only really makes sense in decode_slice_header().
The third call to ff_h264_set_parameter_from_sps(), done immediately
after parsing a new SPS, appears to serve no useful purpose, so it is
just dropped.
Also, drop now unneeded H264Context.cur_chroma_format_idc.
2015-04-29 05:52:57 +02:00
Anton Khirnov
a6cd154463
h264: move the DPB init/uninit to init_context()/free_context()
...
Currently, the DPB is initialized in alloc_tables() and uninitialized in
free_tables(), but those functions manage frame size-dependent
variables, so DPB management does not logically belong in there.
Since we want the init/uninit to happen exactly once per the context
lifetime, init_context()/free_context() are the proper place for this
code.
2015-04-29 05:52:57 +02:00
Anton Khirnov
9d33bab583
h264: drop H264Context.ouputed_poc
...
It is only set, but never used for anything.
2015-04-29 05:52:57 +02:00
Anton Khirnov
27b0e6ebfd
h264: drop needs_realloc
...
It is not needed anymore since switching to refcounted frames.
2015-04-29 05:52:57 +02:00
Vittorio Giovara
6a85dfc830
lavc: Replace av_dlog and tprintf with internal macros
2015-04-19 12:41:59 +01:00
Anton Khirnov
bd737b5178
h264: reset the private data in init_thread_copy()
...
The generic code copies the main context's private data to all the
others. However that is quite dangerous, as it might end up copying some
pointers that are or will become invalid.
Since everything we actually need will be copied later in
update_thread_context(), it's safest to zero the private data in
init_thread_copy(), so it works the same way as init for the main
context.
2015-04-05 12:03:07 +02:00
Anton Khirnov
a939e5b252
h264: remove a commented out nonsense line
2015-04-05 12:03:02 +02:00
Anton Khirnov
65afa65e73
h264: drop redundant initialization of the scaling matrices
...
It will always be initialized when actually parsing the PPS.
2015-04-05 12:02:57 +02:00
Anton Khirnov
e1f907711a
h264: factor out common code from init() and init_thread_copy()
2015-04-05 12:02:35 +02:00
Anton Khirnov
43fd3dd80c
h264: drop redundant initialization in init()
...
There is no real advantage to initializing any of those in init,
assuming yuv420, before the real stream parameters are known.
2015-04-05 12:02:26 +02:00
Anton Khirnov
050324d020
h264: initialize cur_chroma_format_idc
...
This makes sure the various DSP contexts get properly initialized in
ff_h264_set_parameter_from_sps() whatever the value of
raw_bits_per_sample.
2015-04-05 12:02:20 +02:00
Anton Khirnov
a4d34e218f
h264: disable ER by default
...
The way it is currently designed is fundamentally unsafe and cannot be
reasonably fixed without completely rewriting it.
2015-04-03 13:14:43 +02:00
Anton Khirnov
2b4c38d3c6
h264: drop some mpegvideo remnants from draw_horiz_band()
...
This code makes no sense for h.264.
2015-03-21 11:27:16 +01:00
Anton Khirnov
5bf3c0fa49
h264: drop the now unused per-slice H264Contexts
2015-03-21 11:27:16 +01:00
Anton Khirnov
51d8725a6e
h264: use the main H264Context as the parent for all slice contexts
...
There is now no need to have per-slice copies of the H264Context.
2015-03-21 11:27:15 +01:00
Anton Khirnov
3178f4d33f
h264: move rbsp_buffer into the per-slice context
2015-03-21 11:27:15 +01:00
Anton Khirnov
582683b6ac
h264: move remaining ER stuff into the per-slice context
2015-03-21 11:27:15 +01:00
Anton Khirnov
5bc69f38c1
error_resilience: do not require mbintra/skip tables
...
h264dec does not use them at all and only allocates them for ER.
2015-03-21 11:27:15 +01:00
Anton Khirnov
c377e04d8a
h264: move top_borders into the per-slice context
...
Also change the method for allocating to the same one as used by
edge_emu_buffer.
2015-03-21 11:27:15 +01:00
Anton Khirnov
36d04801ba
h264: move the scratch buffers into the per-slice context
...
Also change the method for allocating them. Instead of two possible
alloc calls from different places, just ensure they are allocated at the
start of each slice. This should be simpler and less bug-prone than the
previous method.
2015-03-21 11:27:15 +01:00
Anton Khirnov
5c4b98de4d
h264.c: constify all uses of H264Context in slice and lower-level functions
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
2015-03-21 11:27:15 +01:00
Anton Khirnov
f42485dbce
h264: use a separate GetBitContext for slice data
2015-03-21 11:27:14 +01:00
Anton Khirnov
2ea00e35e4
h264: do not abuse the context as a temporary storage in get_last_needed_nal()
...
Use a local variable instead.
2015-03-21 11:27:14 +01:00
Anton Khirnov
404a416d4b
h264: remove some remnants of data partitioning
2015-03-21 11:27:14 +01:00
Anton Khirnov
d4d9068cdf
h264: move mb_{x,y} into the per-slice context
2015-03-21 11:27:14 +01:00
Anton Khirnov
0edbe6faa7
h264: move mb_xy into the per-slice context
2015-03-21 11:27:14 +01:00
Anton Khirnov
9951907f6f
h264: move redundant_pic_count into the per-slice context
2015-03-21 11:27:14 +01:00
Anton Khirnov
a67f8ae9a2
h264: move mvd_table into the per-slice context
2015-03-21 11:27:14 +01:00
Anton Khirnov
95eb35f305
h264: move the ref lists variables into the per-slice context
2015-03-21 11:27:13 +01:00
Anton Khirnov
066aafced4
h264: move direct_spatial_mv_pred into the per-slice context
2015-03-21 11:27:13 +01:00
Anton Khirnov
56febc993b
h264: move the slice type variables into the per-slice context
2015-03-21 11:27:13 +01:00
Anton Khirnov
e6287f077c
h264: move {mv,ref}_cache into the per-slice context
2015-03-21 11:27:13 +01:00
Anton Khirnov
f69574cf7a
h264: move non_zero_count_cache into the per-slice context
2015-03-21 11:27:12 +01:00
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