Kieran Kunhya
03b82b3ab9
h2645_parse: Allocate a single buffer per packet
...
Drastically reduces memory usage on pathological streams.
Fixes ticket #6789
2017-11-04 18:06:45 +00:00
Mark Thompson
6eb102a616
h264_sei: Add namespace prefix to all SEI values
...
This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.
(cherry picked from commit 6ea220cbee )
2017-09-12 22:29:31 +01:00
Michael Niedermayer
09096fb687
avcodec/h264_parse: Check picture structure when initializing weight table
...
Fixes: runtime error: index 49 out of bounds for type 'int [48][2][2]'
Fixes: 2159/clusterfuzz-testcase-minimized-5267945972301824
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-10 00:48:23 +02:00
Michael Niedermayer
6a37abc59a
avcodec/h264_sei: Check actual presence of SEI picture timing instead of implying it
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-15 00:19:50 +01:00
Rodger Combs
f271a9bd99
lavc/h264_parser: export field order in more cases
2016-10-24 01:20:18 -05:00
Paul B Mahol
92dbd65700
avcodec/h264_parser: fix for possible overflow
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-14 21:14:07 +02:00
Paul B Mahol
01fa4fb69e
avcodec/h264_parser: set missing pts for top/bottom field frames
...
Adopted from 4eb49fdde8 revert.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-14 20:32:24 +02:00
Michael Niedermayer
f10ea03df3
avcodec/h264_parser: Factor get_avc_nalsize() out
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-20 00:36:38 +02:00
Michael Niedermayer
cc13bc8c4f
avcodec/h2645: Fix NAL unit padding
...
The parser changes have lost the support for the needed padding, this adds it back
Fixes out of array reads
Fixes: 03ea21d271abc8acf428d42ace51d8b4/asan_heap-oob_3358eef_5692_16f0cc01ab5225e9ce591659e5c20e35.mkv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-18 23:36:18 +02:00
James Almer
f41048f6ec
Merge commit ' 5c2fb561d9'
...
* commit '5c2fb561d9 ':
h264: add H264_ prefix to the NAL unit types
Conflicts:
libavcodec/h264_parse.c
libavcodec/h264_parser.c
libavcodec/h264_slice.c
libavcodec/h264dec.c
Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 15:11:05 -03:00
James Almer
7c8bf2dc2b
Merge commit ' b24dafe105'
...
* commit 'b24dafe105 ':
lavc: drop unnecessary h264dec.h includes
Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:03:15 -03:00
James Almer
8c7932884d
Merge commit ' f638b67e57'
...
* commit 'f638b67e57 ':
h264: move the parameter set definitions to a new header file
Conflicts:
libavcodec/h264_parse.h
libavcodec/h264_ps.c
libavcodec/h264dec.h
Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 12:58:09 -03:00
Clément Bœsch
ecf65c30cf
Merge commit ' 251cbb4400'
...
* commit '251cbb4400 ':
h264: create a new header for common h264 definitions
Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:13:44 +02:00
Clément Bœsch
15b26e88cb
Merge commit ' 9df889a5f1'
...
* commit '9df889a5f1 ':
h264: rename h264.[ch] to h264dec.[ch]
Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Michael Niedermayer
febc862b53
avcodec/h264_parser: Set sps/pps_ref
...
Fixes use of freed memory
Should fix valgrind failures of fate-h264-skip-nointra
Found-by: logan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-02 03:07:23 +02:00
Benoit Fouet
879330c561
h264: make H264ParamSets sps const
2016-06-30 09:24:39 +02:00
Clément Bœsch
8ef57a0d61
Merge commit ' 41ed7ab45f'
...
* commit '41ed7ab45f ':
cosmetics: Fix spelling mistakes
Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +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
b24dafe105
lavc: drop unnecessary h264dec.h includes
2016-06-21 11:15:11 +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
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
Matthieu Bouron
0ea58059d6
lavc/h264_ps: add ff_h264_ps_uninit and use it
2016-06-20 16:09:09 +02:00
Clément Bœsch
38a2d9aeec
lavc/h264_parser: replace AVCodecContext with logging ctx in scan_mmco_reset()
2016-06-20 10:36:16 +02:00
Clément Bœsch
4fdea02d68
lavc/h264: add a logging ctx to ff_h264_pred_weight_table()
2016-06-20 10:36:16 +02:00
Clément Bœsch
0ed14bba12
Merge commit ' 72da8d9bb2'
...
* commit '72da8d9bb2 ':
h264_parser: remove the remaining dependencies on the h264 decoder
Merged-by: Clément Bœsch <u@pkh.me>
2016-06-19 12:50:24 +02:00
Clément Bœsch
34ec084b84
lavc/h264: move history parsing variable to H264ParseContext
...
This makes h264_find_frame_end() not depend on H264Context anymore.
2016-06-19 12:38:28 +02:00
Clément Bœsch
48ea5433c8
lavc/h264_parser: pass logctx to h264_find_frame_end()
...
This helps removing the H264Context from the H264ParseContext.
2016-06-19 12:34:38 +02:00
Clément Bœsch
0bf5fd2e19
Merge commit ' 98c97994c5'
...
* commit '98c97994c5 ':
h264: decouple extradata parsing from the decoder
Main changes:
- move get_avc_nalsize() inside h264_parser.c and make it use
H264ParseContext instead of H264Context. This helps fixing
fate-flv-demux.
- Also use is_avc/nal_length_size from the H264ParseContext in various
places instead of the H264Context one as that's the fields now filled
by ff_h264_decode_extradata()
- h264_parse: dont fail decode_extradata_ps() due to nal split failure.
Change by Michael to fix decoding of h264/ref_10.avi.
Merged-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-19 12:17:41 +02:00
Clément Bœsch
5584f019b5
Merge commit ' 728d90a0c1'
...
* commit '728d90a0c1 ':
h264: decouple h264_sei from the h264 decoder
Main changes:
- SEI decoding doesn't have access to the debug flag in the codec context so a
few logging are dropped.
- naming of quincunx_sampling_flag and frame_packing_arrangement_type are kept
as they are in FFmpeg instead of respectively quincunx_subsampling and
arrangement_type used in Libav because the former match the specifications.
- don't reset the x264 build info once read in order to fix
fate-h264-lossless (change by Hendrik)
- H264Context.has_recovery_point and deprecated
AVCodecContext.dtg_active_format are set after ff_h264_sei_decode()
based on the SEI state since ff_h264_sei_decode() doesn't have access
to H264Context anymore.
- frame_packing_arrangement_type is not checked against <= 0 in
decode_postinit() since it is always read as a positive value with
get_bits(). This fixes a -Wtype-limits warning by GCC spotted by
Michael.
Side Notes:
- tested that ffprobe on the file from ticket #3652 still returns 4
keyframes
- tested that playback from ticket #3063 still works
Merged-by: Clément Bœsch <clement@stupeflix.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-18 14:04:55 +02:00
Clément Bœsch
bd3fd467fe
Merge commit ' c8dcff0cdb'
...
* commit 'c8dcff0cdb ':
h264: factor out calculating the POC count into a separate file
Merged-by: Clément Bœsch <u@pkh.me>
2016-06-12 19:01:43 +02:00
Clément Bœsch
65d5f32fd7
Merge commit ' 113aeee6ae'
...
* commit '113aeee6ae ':
h264_parser: move the H264DSPContext to the parser context
H264Context is kept locally as it is currently needed for logging
(h->avctx as log context) and for is_avc and nal_length_size. These
later fields will later be obtained when the extradata parsing is
decoupled from the decoder. This code will be updated accordingly when
that commit is merged.
Merged-by: Clément Bœsch <u@pkh.me>
2016-06-12 15:43:28 +02:00
Clément Bœsch
1534ef87c7
Merge commit ' 3176217c60'
...
* commit '3176217c60 ':
h264: decouple h264_ps from the h264 decoder
Main changes:
- a local GetBitContext is created for the various
ff_h264_decode_seq_parameter_set() attempts
- just like the old code, remove_sps() is adjusted so it doesn't remove
the pps.
Fixes decode with Ticket #631
http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20111108/dae58f17/attachment.mp4
but see next point as well.
- ff_h264_update_thread_context() is updated to work even when SPS
isn't set as it breaks current skip_frame code. This makes sure we
can still decode the sample from ticket #631 without the need for
-flags2 +chunks. (Thanks to Michael)
- keep {sps,pps}_ref pointers that stay alive even when the active
pps/sps get removed from the available lists (patch by michaelni with
additionnal frees in ff_h264_free_context() from mateo)
- added a check on sps in avpriv_h264_has_num_reorder_frames() to fix
crashes with mpegts_with_dvbsubs.ts from Ticket #4074
http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4074/mpegts_with_dvbsubs.ts
- in h264_parser.c:h264_parse(), after the ff_h264_decode_extradata() is
called, the pps and sps from the local parser context are updated with
the pps and sps from the used h264context. This fixes fate-flv-demux.
- in h264_slice.c, "PPS changed between slices" error is not triggered
anymore in one condition as it makes fate-h264-xavc-4389 fails with
THREADS=N (Thanks to Michael)
Merged-by: Clément Bœsch <clement@stupeflix.com>
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-06-12 13:26:52 +02:00
Hendrik Leppkes
2dc954e0bd
Merge commit ' 44d16df413'
...
* commit '44d16df413 ':
h264_parser: eliminate H264SliceContext usage
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-05-27 14:28:21 +02:00
Derek Buitenhuis
278dcec28d
Merge commit ' a6e27f7add'
...
* commit 'a6e27f7add ':
h264: factor out parsing the reference count into a separate file
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-17 15:16:38 +01:00
Derek Buitenhuis
7ab2c036b9
Merge commit ' e9f884416c'
...
* commit 'e9f884416c ':
h264: move reading direct_spatial_mv_pred out of ff_set_ref_count()
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-17 14:38:14 +01:00
Hendrik Leppkes
15ad023210
Merge commit ' 8d0cc8ca97'
...
* commit '8d0cc8ca97 ':
h264_parser: switch to h2645_parse for NAL unescaping
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-05-17 14:21:12 +02:00
Vittorio Giovara
41ed7ab45f
cosmetics: Fix spelling mistakes
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Derek Buitenhuis
ee38234c43
Merge commit ' e481458bc3'
...
* commit 'e481458bc3 ':
h264: factor out pred weight table parsing into a separate file
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-26 15:04:29 +01:00
Derek Buitenhuis
9809371aa5
Merge commit ' a7da517f6a'
...
* commit 'a7da517f6a ':
h264data: Move all data tables from a header to a .c file
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-24 11:54:53 +01:00
Derek Buitenhuis
64ae08ffec
Merge commit ' 02cd8bb9cb'
...
* commit '02cd8bb9cb ':
h264: Clean up #includes
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-24 11:36:44 +01:00
Anton Khirnov
72da8d9bb2
h264_parser: remove the remaining dependencies on the h264 decoder
2016-04-24 10:06:24 +02:00
Anton Khirnov
98c97994c5
h264: decouple extradata parsing from the decoder
...
This will allow decoupling the parser from the decoder.
2016-04-24 10:06:24 +02:00
Anton Khirnov
728d90a0c1
h264: decouple h264_sei from the h264 decoder
...
Make the SEI parsing independent of the H264Context, to allow
decoupling the parser from the decoder.
2016-04-24 10:06:24 +02:00
Anton Khirnov
c8dcff0cdb
h264: factor out calculating the POC count into a separate file
...
This will allow decoupling the parser from the decoder.
2016-04-24 10:06:24 +02:00
Anton Khirnov
113aeee6ae
h264_parser: move the H264DSPContext to the parser context
2016-04-24 10:06:24 +02:00
Anton Khirnov
3176217c60
h264: decouple h264_ps from the h264 decoder
...
Make the SPS/PPS parsing independent of the H264Context, to allow
decoupling the parser from the decoder. The change is modelled after the
one done earlier for HEVC.
Move the dequant buffers to the PPS to avoid complex checks whether they
changed and an expensive copy for frame threads.
2016-04-24 10:06:23 +02:00
Anton Khirnov
44d16df413
h264_parser: eliminate H264SliceContext usage
...
It is no longer needed for anything.
2016-04-24 10:06:23 +02:00
Anton Khirnov
a6e27f7add
h264: factor out parsing the reference count into a separate file
...
This will allow decoupling the parser from the decoder.
2016-04-24 10:06:23 +02:00
Anton Khirnov
e9f884416c
h264: move reading direct_spatial_mv_pred out of ff_set_ref_count()
...
It has nothing to do with the reference count and so does not belong in
this function.
2016-04-24 10:06:23 +02:00