1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

102 Commits

Author SHA1 Message Date
Anton Khirnov
1e9615c5d4 h264_sei: use a separate reader for the individual SEI messages
This tells the parsing functions the payload size and prevents them from
overreading.
2020-04-10 15:50:26 +02:00
Limin Wang
5e5bbd21e6 avcodec/h264_sei: fix the size of user data unregistered
According to the specifications, the payloadSize includes the 16-byte size of UUID.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-12-20 22:46:04 -03:00
Josh de Kock
76a8c3b522 h264/pic_timing: support multiple timecodes 2018-10-23 15:46:30 +01:00
Devin Heitmueller
4241e44a3c lavc/h264: create AVFrame side data from H.264 timecodes
Create SMPTE ST 12-1 timecodes based on H.264 SEI picture timing
info.

For framerates > 30 FPS, the field flag is used in conjunction with
pairs of frames which contain the same frame timestamp in S12M.
Ensure the field is properly set per the spec.
2018-10-23 15:46:30 +01:00
Kieran Kunhya
c85852d3de h264: Support multi-field closed captions by using AVBufferRef and not resetting per field
Signed-off-by: Josh de Kock <joshdk@obe.tv>
2018-08-17 16:24:19 +01:00
Michael Niedermayer
8c20ea8ee0 avcodec/h264_slice: Fix overflow in recovery_frame computation
Fixes: signed integer overflow: 15 + 2147483646 cannot be represented in type 'int'
Fixes: 8381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6225533137321984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-11 00:51:20 +02:00
James Almer
5e9b39b373 avcodec/h264_sei: remove redundant prefix to H264SEIFramePacking fields
Cosmetic change.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-12-01 01:10:11 -03:00
James Almer
d268094f88 Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'
* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa':
  stereo3d: Support view type for frame sequence type

Merged-by: James Almer <jamrial@gmail.com>
2017-11-29 21:06:49 -03:00
Vittorio Giovara
99e9697e3a stereo3d: Support view type for frame sequence type
Implement detection in h264 and hevc and insertion in framepack filter.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-11-28 14:56:51 -05:00
Kieran Kunhya
1f28a991ef libavcodec/h264_sei: Don't log random user data. This prevents terminal junk. 2017-11-17 22:22:11 +00:00
James Almer
9669c05baf avcodec/h264_sei: add namespace prefix to frame packingarrangement enum values
Missed in 6eb102a616.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-12 19:59:23 -03: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
Vittorio Giovara
8c34a2024d h264: Add support for alternative transfer characterics SEI
The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-08-10 15:40:16 +02:00
Vittorio Giovara
ebf3b9e8a8 h264: Add support for alternative transfer characterics SEI
The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-08-10 15:32:59 +02:00
Mark Thompson
6ea220cbee 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.
2017-05-16 22:23:14 +01:00
Michael Niedermayer
d7b2bb5391 h264_sei: Check actual presence of picture timing SEI message
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-02-28 10:32:50 -05: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
Diego Biurrun
d4c2103bd3 golomb: Convert to the new bitstream reader 2017-01-31 17:46:19 +01:00
James Almer
4c121ad546 Merge commit '1cf2f3d334f52849aae2be868bad1e5fa5f59aa0'
* commit '1cf2f3d334f52849aae2be868bad1e5fa5f59aa0':
  h264_sei: drop an unnecessary h264dec.h include

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:04:30 -03:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Benoit Fouet
879330c561 h264: make H264ParamSets sps const 2016-06-30 09:24:39 +02:00
Michael Niedermayer
9981b70da5 avcodec/h264_sei: Do not skip subsequent SEIs on errors potentially caused by missing parameter sets.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-26 00:44:47 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +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
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
Clément Bœsch
5584f019b5 Merge commit '728d90a0c1973661a9e73da697bf4f90c9d19577'
* commit '728d90a0c1973661a9e73da697bf4f90c9d19577':
  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
7dd8cd1933 lavc/h264_sei: fix broken style around green metadata code 2016-06-14 08:23:23 +02:00
Clément Bœsch
5342bb624d lavc/h264: rename GreenMetaData to H264SEIGreenMetaData
Reduces diff for the next merge with Libav.
2016-06-14 08:23:23 +02:00
Clément Bœsch
b0ec36c9b1 lavc/h264_sei: reduce scope of parameters for green meta decode
This is again will help the merge as ff_h264_decode_sei will not have
access to H264Context anymore.
2016-06-14 08:23:23 +02:00
Clément Bœsch
fef89aae98 lavc/h264: move green meta logging out of the sei decoding
This will simplify the next Libav merge where SEI decoding doesn't have
access to the debug level anymore.
2016-06-14 08:23:23 +02:00
Clément Bœsch
7a2a8b541a lavc/h264_sei: fix green metadata typo 2016-06-13 22:41:38 +02:00
Clément Bœsch
1534ef87c7 Merge commit '3176217c60ca7828712985092d9102d331ea4f3d'
* commit '3176217c60ca7828712985092d9102d331ea4f3d':
  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
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +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
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
Mark Harris
c51c08e0e7 avcodec: Use get_ue_golomb_long() when needed
get_ue_golomb() cannot decode values larger than 8190 (the maximum
value that can be golomb encoded in 25 bits) and produces the error
"Invalid UE golomb code" if a larger value is encountered.  Use
get_ue_golomb_long() instead (which supports 63 bits, up to 4294967294)
when valid h264/hevc values can exceed 8190.

This updates decoding of the following values:   (maximum)
  first_mb_in_slice                                36863* for level 5.2
  abs_diff_pic_num_minus1                         131071
  difference_of_pic_nums_minus1                   131071
  idr_pic_id                                       65535
  recovery_frame_cnt                               65535
  frame_packing_arrangement_id                4294967294
  frame_packing_arrangement_repetition_period      16384
  display_orientation_repetition_period            16384

An alternative would be to modify get_ue_golomb() to handle encoded
values of up to 49 bits as was done for get_se_golomb() in a92816c.
In that case get_ue_golomb() could continue to be used for all of
these except frame_packing_arrangement_id.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-29 13:11:51 +01:00
Hendrik Leppkes
3ff6d40cbc Merge commit 'b4a82e740743744136e07054525560351e4892ae'
* commit 'b4a82e740743744136e07054525560351e4892ae':
  h264: Print the complete user message

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:54:34 +01:00
Hendrik Leppkes
ed6d451d93 Merge commit '8487987b87a252963b27b6adfd82887ea5933918'
* commit '8487987b87a252963b27b6adfd82887ea5933918':
  h264: Print user data SEI under normal debug verbosity

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:53:55 +01:00
Vittorio Giovara
b4a82e7407 h264: Print the complete user message
Previously the message was cut off at 256th byte.
This will allow dumping the complete x264 encode info when needed.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-30 12:46:56 +01:00
Vittorio Giovara
8487987b87 h264: Print user data SEI under normal debug verbosity
Drop the need of setting -debug bugs since it's not a bug, and the
message is already under a AV_LOG_DEBUG log level. Instead only print
it when there is an actual string in it.
2015-10-30 12:46:56 +01:00
Michael Niedermayer
91ca8105dd avcodec/h264_sei: Remove "Subtitles with data type 0x%02x" sample request
Suggested-by: Carl and Hendrik
2015-09-09 00:17:59 +02:00
Hendrik Leppkes
a4c13f95fb Merge commit 'f9ab4fe1f7c1e9d410ca5ee2c9ff8d2892aad068'
* commit 'f9ab4fe1f7c1e9d410ca5ee2c9ff8d2892aad068':
  h264: Discard currently unsupported registered sei

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-24 10:36:07 +02:00
Luca Barbato
61d8fa2a1a h264: Fix faulty call to avpriv_request_sample
Broken in f9ab4fe1f7
2015-08-22 01:42:19 +02:00
John Högberg
f9ab4fe1f7 h264: Discard currently unsupported registered sei
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-08-21 12:03:36 +02:00
Hendrik Leppkes
db395bef7f Merge commit '80ea66112817c719b476de8f7d8d3b325f4c7dd1'
* commit '80ea66112817c719b476de8f7d8d3b325f4c7dd1':
  avcodec: h264: Extract decoder methods

Conflicts:
	libavcodec/h264_sei.c

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-02 10:59:06 +02:00
David Holm
80ea661128 avcodec: h264: Extract decoder methods
Extract two methods from decode_registered_user_data in order to improve
code readability. Also make the constant holding the allocation size a
64-bit unsigned integer so that the size comparison against INT_MAX makes
sense.

Bug-Id: CID1312090

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-08-01 14:29:53 +02:00
Michael Niedermayer
441d5a7084 Merge commit 'b0017579b6e8de3d0d13dcfe0a4dd848dc6baa37'
* commit 'b0017579b6e8de3d0d13dcfe0a4dd848dc6baa37':
  h264: Add support for Closed Caption export

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_sei.c

See: 8234f0e3b4
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-17 14:13:19 +02:00
Kieran Kunhya
b0017579b6 h264: Add support for Closed Caption export
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-17 01:44:22 +01:00
Kieran Kunhya
8234f0e3b4 avcodec: Add support for Closed Caption export in h264
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-06 15:25:22 +02:00
Nicolas DEROUINEAU
04a68f4348 avcodec/h264: Greenmetadata SEI parsing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-30 23:20:36 +02:00