1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-28 04:06:12 +02:00
Commit Graph

38 Commits

Author SHA1 Message Date
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
Michael Niedermayer
2c874548d6 avcodec/hevcdec: do basic validity check on delta_chroma_weight and offset
Fixes: runtime error: signed integer overflow: 2147483520 + 128 cannot be represented in type 'int'
Fixes: 2385/clusterfuzz-testcase-minimized-6594333576790016

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-27 23:21:12 +02:00
wm4
70143a3954 dxva: add support for new dxva2 and d3d11 hwaccel APIs
This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Merges Libav commit f9e7a2f95a.
Also adds untested VP9 support.
The check for DXVA2 COBJs is removed. Just update your MinGW to
something newer than a 5 year old release.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
Michael Niedermayer
89f8bff798 avcodec/hevcdec: Do not check the first ff_init_cabac_decoder() call in hls_decode_entry_wpp() for failure
The result of the call is not used in any testcase but breaks some cases if
its failure is considered.

Fixes regression found by jamrial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-25 04:25:56 +02:00
Michael Niedermayer
2476067680 avcodec/hevcdec: Use error path if init_get_bits8() fails
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Michael Niedermayer
933aa91e31 avcodec/hevcdec: check ff_init_cabac_decoder() for failure
Fixes: runtime error: left shift of 1965559808 by 4 places cannot be represented in type 'int'
Fixes: 2333/clusterfuzz-testcase-minimized-5223935677300736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Michael Niedermayer
fdfbcbdd14 avcodec/hevcdec: Check beta and tc offset in hls_slice_header()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-21 02:25:23 +02:00
Michael Niedermayer
1edbf5e20c avcodec/hevcdec: Fix signed integer overflow in decode_lt_rps()
Fixes: runtime error: signed integer overflow: 2147483647 + 6 cannot be represented in type 'int'
Fixes: 2263/clusterfuzz-testcase-minimized-4800359627227136

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-17 00:34:48 +02:00
Michael Niedermayer
bc40674462 avcodec/hevcdec: Check nb_sps
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-15 03:09:40 +02:00
James Almer
000fb61a71 avcodec/hevcdec: export cropping information instead of handling it internally
This merges commit a02ae1c683 from libav,
originally written by Anton Khirnov and skipped in
fc63d5ceb3.

 libavcodec/hevc_parser.c |  6 ++++--
 libavcodec/hevc_ps.c     | 31 ++++++++++++-------------------
 libavcodec/hevc_ps.h     |  2 --
 libavcodec/hevc_refs.c   | 18 +++++-------------
 libavcodec/hevcdec.c     |  7 ++++---
 libavcodec/hevcdec.h     |  2 --
 6 files changed, 25 insertions(+), 41 deletions(-)

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-26 11:15:45 -03:00
Ronald S. Bultje
ca2209d67a hevc: fix race condition in max_ra/seq_decode.
These variables are shared between frame threads, but they are updated
post-setup_finished() if a EOB/EOS slice type occurs. Moving the EOB/EOS
slices to the next frame thread instance (by parsing them leading into
the next picture instead of trailing behind the last picture) effectively
prevents this race condition.

This fixes tsan failures on hevc-conformance-NoOutPrior_A_Qualcomm_1.
2017-05-25 10:29:07 -04:00
James Almer
6a72578cc2 avcodec/hevc_parse: decode SEI message NALUs in extradata
They may be available in hvcc style extradata.

Based on a patch by Hendrik Leppkes.

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:38 -03:00
James Almer
1d53b8e907 avcodec/hevcdec: remove HEVCContext usage from ff_hevc_compute_poc()
Move it to hevc_ps as well. This is in preparation for a following patch.

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:36 -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
Clément Bœsch
78a5fc4579 lavc/hevcdec: fix invalid use of ff_get_format()
Regression since 76cc100afb.

Spotted-by: James Almer <jamrial@gmail.com>
2017-04-26 17:35:28 +02:00
Clément Bœsch
84a368f6fe Merge commit '373fd76b4dbd9aa03ed28e502f33f2ca8c1ce19a'
* commit '373fd76b4dbd9aa03ed28e502f33f2ca8c1ce19a':
  hevcdec: do not set decoder-global SPS prematurely

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-26 17:25:54 +02:00
Clément Bœsch
76cc100afb Merge commit '86157e6db2c7a9222f77fa7e7f50fb9aebc3aa81'
* commit '86157e6db2c7a9222f77fa7e7f50fb9aebc3aa81':
  hevc: decouple calling get_format() from exporting the SPS parameters

See 786032cad8 (which has been reverted
and replaced with Anton's version to reduce diffs between the two
projects).

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-26 14:32:09 +02:00
James Almer
4588063f3e avcodec/hevcdec: remove duplicate extradata parsing function
Use ff_hevc_decode_extradata() instead, which correctly only tries
to decode parameter set NAL units and not any other NAL that may be
present in extradata.

Reviewed-by: nevcairiel
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-09 14:09:05 -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
Ronald S. Bultje
1f50baa2b2 hevc: only write to max_ra and pocTid0 in the first slice.
Values from subsequent values are guaranteed to be identical (since
poc and nal_unit_type are checked to be the same between slices), so
this doesn't affect output in any way, but does resolve the remaining
reported race conditions (by tsan) in fate-hevc.

In practice, this fixes tsan warnings like this:

WARNING: ThreadSanitizer: data race (pid=25334)
  Read of size 4 at 0x7d9c0001adcc by main thread (mutexes: write M1386):
    #0 hevc_update_thread_context src/libavcodec/hevcdec.c:3310 (ffmpeg+0x000000b41c7c)
[..]
  Previous write of size 4 at 0x7d9c0001adcc by thread T1 (mutexes: write M1383):
    #0 hls_slice_header src/libavcodec/hevcdec.c:596 (ffmpeg+0x000000b43a22)
2017-04-03 09:51:10 -04:00
Ronald S. Bultje
bddabfaab6 hevc: initialize no_rasl_output_flag in hevc_frame_start().
This prevents a race condition in files with multiple slices per frame.
2017-03-28 18:04:27 -04:00
James Almer
dc39ccdc3b Merge commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f'
* commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f':
  hevc: move the SliceType enum to hevc.h

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 20:02:11 -03:00
James Almer
4a5810b659 Merge commit 'f6e2f8a9ffda2247bffba991450990d075ea68e3'
* commit 'f6e2f8a9ffda2247bffba991450990d075ea68e3':
  hevcdec: move parameter set parsing into a separate header

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 15:53:00 -03:00
James Almer
b29c8c995f Merge commit '150c896a9e46b23b97debb0a5f66fbaeaa32f153'
* commit '150c896a9e46b23b97debb0a5f66fbaeaa32f153':
  hevcdec: split ff_hevc_diag_scan* declarations into a separate header

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 15:14:06 -03: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
Anton Khirnov
373fd76b4d hevcdec: do not set decoder-global SPS prematurely
It should only be set after the decoder state has been fully initialized
for using that SPS.
Fixes possible invalid reads on get_format() failure.

CC: libav-stable@libav.org
2016-12-19 08:07:15 +01:00
Anton Khirnov
86157e6db2 hevc: decouple calling get_format() from exporting the SPS parameters
This makes sure ff_get_format() does not get called unnecessarily from
update_thread_context().
2016-12-14 09:06:45 +01:00
Diego Biurrun
e4382a4ab4 hevc: Eliminate pointless variable indirection 2016-11-30 14:11:44 +01:00
Vittorio Giovara
47a795727f hevc: Support extradata changes from multiple stsd
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-11-08 11:22:29 -05:00
Vittorio Giovara
2fe30b4743 hevc: Allow parsing external extradata buffers 2016-11-08 11:22:29 -05:00
Vittorio Giovara
5be2153111 hevc: Move hevc_decode_extradata before frame decoding
Avoids a forward-declaration in the following commit.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-11-08 11:22:29 -05:00
Anton Khirnov
0bfdcce4d4 hevc: move the SliceType enum to hevc.h
Those values are decoder-independent and are also use by the VA-API
encoder.
2016-10-21 10:11:20 +02:00
Anton Khirnov
59c90097a0 hevc: factor out a repeated condition 2016-10-21 10:11:20 +02:00
Anton Khirnov
f6e2f8a9ff hevcdec: move parameter set parsing into a separate header
This code is independent from the decoder, so it makes more sense for it
to to have its own header.
2016-10-16 20:26:47 +02:00
Anton Khirnov
150c896a9e hevcdec: split ff_hevc_diag_scan* declarations into a separate header
This will be useful in the following commits.
2016-10-16 20:26:40 +02: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