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

61 Commits

Author SHA1 Message Date
Michael Niedermayer
991ef6e5b9 avcodec/hevc_sei: Fix integer overflows in decode_nal_sei_message()
Fixes: signed integer overflow: 2147483520 + 255 cannot be represented in type 'int'
Fixes: 4554/clusterfuzz-testcase-minimized-4843714515042304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-17 02:09:31 +01: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
James Almer
9e2b0f32e9 avcodec/hevc_sei: reorder some parameters in static functions
Cosmetic change skipped in 0b30cb8dae
by mistake.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-31 12:48:26 -03:00
James Almer
bd8f1fa100 avcodec/hevc_sei: rename HEVCSEIContext to HEVCSEI
Cosmetic change skipped in 0b30cb8dae
by mistake.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-31 12:27:57 -03:00
Brian Matherly
876dada0b5 avcodec/hevc_sei: Support HEVC paired fields.
Correctly set the interlaced_frame and top_field_first fields when pic_struct
indicates paired fields.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-30 03:44:59 +02:00
Vittorio Giovara
969f215957 hevc: 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-06-28 09:44:09 -04:00
Vittorio Giovara
3426832ac3 hevc: 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-06-28 09:42:24 -04:00
James Almer
6655939f03 avcodec/hevc_sei: remove bugus debug message
Also Change the active_parameter_sets function name to one more in line
with the rest of the file.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-10 14:59:03 -03:00
James Almer
f738140807 avcodec/hevc_sei: fix amount of bits skipped when reading picture timing SEI message
The code was skipping the entire reported SEI message size regardless of
the amount of bits read.
While in theory safe for NALU where the picture timing SEI message is alone
or at the end as we're using the checked bitstream reader, it isn't in any
other situation, where every SEI message in the NALU after the picture
timing one would potentially fail to parse.

Change the function name to one more in line with the rest of file, and
remove the bogus "Skipped SEI" debug message while at it.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-10 14:56:17 -03:00
James Almer
cfd25488bf hevcdec: move SEI message parsing into a separate header
It doesn't depend on hevcdec anymore.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-05-09 13:42:20 +02:00
James Almer
648a0b4503 hevcdec: remove HEVCContext usage from hevc_sei
Based on the H264 SEI implementation.

This will be mainly useful once support for SEI messages that can be
used by the hevc parser are implemented, like Picture Timing.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-05-09 13:42:20 +02:00
James Almer
fb0f29f9aa avcodec/hevc_sei: actually propagate error codes 2017-05-06 22:57:43 -03:00
James Almer
a687fb9970 avcodec/hevcdec: move SEI message parsing into a separate header
It doesn't depend on hevcdec anymore.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-05 17:30:35 -03:00
James Almer
c4b08c8a4e avcodec/hevcdec: remove HEVCContext usage from hevc_sei
Based on the H264 SEI implementation.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-05 17:30:35 -03:00
Steve Lhomme
157e57a181 lavc: Add Content Light Level side metadata found in HEVC
These data are necessary when transmitting HDR over HDMI.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-06 11:38:15 -03:00
Clément Bœsch
03f5e80bdb Merge commit '67351924fa91dea4339109100a4c0689f006581f'
* commit '67351924fa91dea4339109100a4c0689f006581f':
  Drop unreachable break and return statements

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:26:29 +02:00
James Almer
6397815be0 Merge commit 'c359d624d3efc3fd1d83210d78c4152bd329b765'
* commit 'c359d624d3efc3fd1d83210d78c4152bd329b765':
  hevcdec: move decoder-independent declarations into a separate header

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 14:27:48 -03:00
Clément Bœsch
038e6aef7a Merge commit '4abe3b049d987420eb891f74a35af2cebbf52144'
* commit '4abe3b049d987420eb891f74a35af2cebbf52144':
  hevc: rename hevc.[ch] to hevcdec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-23 16:48:41 +01:00
Diego Biurrun
d4c2103bd3 golomb: Convert to the new bitstream reader 2017-01-31 17:46:19 +01:00
Diego Biurrun
67351924fa Drop unreachable break and return statements 2016-11-03 20:17:12 +01:00
Anton Khirnov
c359d624d3 hevcdec: move decoder-independent declarations into a separate header
This way they can be reused by other code without including the whole
decoder-specific hevcdec.h
Also, add the HEVC_ prefix to them, since similarly named values exist
for H.264 as well and are sometimes used in the same code.
2016-10-16 20:26:28 +02:00
Anton Khirnov
4abe3b049d hevc: rename hevc.[ch] to hevcdec.[ch]
This is more consistent with the rest of libav and frees up the hevc.h
name for decoder-independent shared declarations.
2016-10-16 20:26:17 +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
Will Kelleher
964f07f68e hevc: Fix memory leak related to a53_caption data
Signed-off-by: Will Kelleher <wkelleher@gogoair.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-15 01:30:53 +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
Neil Birkbeck
3b0974d3ef lavc/hevc Parse SEI_TYPE_MASTERING_DISPLAY_INFO and propagate content into the AVMasteringDisplayMetadata side data.
Add support for parsing SEI_TYPE_MASTERING_DISPLAY_INFO and propagate contents into
the AVMasteringDisplayMetadata side data. Primaries are ordered in RGB order and
the values are converted to rationals ([0,1] for CEI 1931 Chroma coords,
and cd/m^2 for luma).

Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-14 00:36:05 +01: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
Will Kelleher
b1a32429ef hevc: Fix a53 caption extraction
Just realized my previous patch doesn't work quite right.  I uploaded a better
sample file that actually has visible captions to /incoming/hevc_cc.ts.  I
tested with that file doing hevc->x264 and it works.

This is basically an exact copy of the existing h264 logic.

Signed-off-by: Will Kelleher <wkelleher@gogoair.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-12 13:16:25 +01:00
Will Kelleher
7f7fa90f7b hevc: extract SEI caption data
Signed-off-by: Will Kelleher <wkelleher@gogoair.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-07 12:10:55 +01:00
Hendrik Leppkes
b3e5d59537 Merge commit '979cb55103fa8e8274806e496901203742c686d1'
* commit '979cb55103fa8e8274806e496901203742c686d1':
  hevc: Split the sei parsing in 3 functions

Conflicts:
	libavcodec/hevc_sei.c

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-02 12:29:30 +02:00
Hendrik Leppkes
90ec89a629 Merge commit '043f46f5741e1a5caedf55d788e1a72aae3b7605'
* commit '043f46f5741e1a5caedf55d788e1a72aae3b7605':
  hevc: Use switch instead of if-nests in decode_nal_sei_message

Conflicts:
	libavcodec/hevc_sei.c

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-02 12:25:41 +02:00
Hendrik Leppkes
2e290d6114 Merge commit '2cd841c0776535be56e4db67485fdd9509c9b9f4'
* commit '2cd841c0776535be56e4db67485fdd9509c9b9f4':
  hevc: Use a proper enum for the SEI values

Conflicts:
	libavcodec/hevc_sei.c

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-02 12:18:40 +02:00
Luca Barbato
979cb55103 hevc: Split the sei parsing in 3 functions 2015-08-01 15:45:50 +02:00
Luca Barbato
043f46f574 hevc: Use switch instead of if-nests in decode_nal_sei_message
Makes simpler to add support for more SEI types.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-08-01 15:34:45 +02:00
Luca Barbato
2cd841c077 hevc: Use a proper enum for the SEI values
And use the correct value for decoded_picture_hash.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-08-01 15:23:05 +02:00
Michael Niedermayer
d5fcca83b9 Merge commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2'
* commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2':
  hevc: remove HEVCContext usage from hevc_ps

Conflicts:
	libavcodec/hevc.c
	libavcodec/hevc_cabac.c
	libavcodec/hevc_filter.c
	libavcodec/hevc_mvs.c
	libavcodec/hevc_ps.c
	libavcodec/hevc_refs.c
	libavcodec/hevcpred_template.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 22:28:54 +02:00
Michael Niedermayer
93b0ee21a2 avcodec/hevc_sei: Check num_sps_ids_minus1 value
Fixes CID1271794

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-13 01:42:52 +02:00
Michael Niedermayer
92c29914de avcodec/hevc_sei: factor return 1 out of if/else chain
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-10 00:19:49 +02:00
Michael Niedermayer
efc66d69bf Merge commit '0569a7e0bd2006d9a5248d17a1f4bf3ca654ae50'
* commit '0569a7e0bd2006d9a5248d17a1f4bf3ca654ae50':
  hevc: parse display orientation SEI message

Conflicts:
	libavcodec/hevc.h
	libavcodec/hevc_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-10 00:19:43 +02:00
Vittorio Giovara
0569a7e0bd hevc: parse display orientation SEI message
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-07-09 10:18:06 -04:00
Michael Niedermayer
5183fac92f avcodec/hevc_sei: fix invalid get_bits() in a comment
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-07 23:37:27 +02:00
Michael Niedermayer
4e1dc600a1 Merge commit '3a149e23d37f06d49ab0bb013a3b9cb0224bba5c'
* commit '3a149e23d37f06d49ab0bb013a3b9cb0224bba5c':
  hevc: Refactor decode_nal_sei_frame_packing_arrangement

Conflicts:
	libavcodec/hevc_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-17 19:04:32 +01:00
Luca Barbato
3a149e23d3 hevc: Refactor decode_nal_sei_frame_packing_arrangement
Directly set the fields when necessary.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2013-12-17 09:34:08 +01:00
Michael Niedermayer
180a0b1bcb avcodec/hevc_sei: fix use of uninitialized variables in decode_nal_sei_frame_packing_arrangement()
Fixes CID1135773/1135774/1135775
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-13 00:07:06 +01:00
Guillaume Martres
679a6377e4 hevc: avoid some unnecessary differences with libav
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-10 16:20:48 +01:00
Michael Niedermayer
31a52a60c9 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hevc: parse frame packing arrangement SEI messages and save relevant stereo3d information

Conflicts:
	libavcodec/hevc.h
	libavcodec/hevc_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-09 22:25:38 +01:00
Vittorio Giovara
acb77dff6a hevc: parse frame packing arrangement SEI messages and save relevant stereo3d information 2013-12-09 16:02:43 +01:00
Michael Niedermayer
8983dea426 Merge commit 'c673fc919c374c60b1e6d80d8822712eadf67f16'
* commit 'c673fc919c374c60b1e6d80d8822712eadf67f16':
  hevc_sei: drop unused parameter

Conflicts:
	libavcodec/hevc_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-19 17:59:47 +01:00
Vittorio Giovara
c673fc919c hevc_sei: drop unused parameter 2013-11-19 14:48:36 +01:00