1
0
Fork 0
Commit Graph

71 Commits

Author SHA1 Message Date
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Zhao Zhili 0f824d792d avcodec/hevc_parser: fix missing zero_byte at frame beginning
The start code is matched against 0x000001, zero_byte was treated
as last byte of last frame rather than the beginning of next frame.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-05 01:14:33 +08:00
Andreas Rheinhardt 2db94a96c8 avcodec/hevc_ps: Use RefStruct API for parameter sets
Avoids allocations and error checks for these allocations;
e.g. syncing buffers across threads can't fail any more
and needn't be checked. It also gets rid of casts and
indirections.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:28 +02:00
Andreas Rheinhardt 27f22f3383 all: Remove unnecessary libavcodec/internal.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-08 06:16:26 +01:00
Andreas Rheinhardt e5af920309 avcodec: Move all AVCodecParser.split functions to remove_extradata_bsf
The remove_extradata bsf is the only user of these functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:16 -03:00
Andreas Rheinhardt e625ae6092 avcodec: Constify all the AVCodecParsers
Possible now that the next pointer no longer exists.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:16 -03:00
Andreas Rheinhardt cbb6ba2e86 avcodec/cavsdec, h264*, hevc_parser: Use get_ue_golomb_31 where possible
instead of get_ue_golomb(). The difference between the two is that the
latter also has to take into account the case in which the read code is
more than 9 bits (four preceding zeroes + at most five value bits) long,
leading to more code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-29 05:11:54 +02:00
Anton Khirnov fb30c9107a hevc_parser: drop the use of SliceHeader
It is only used to store a few local variables within one function,
which is better accomplished by just declaring them on stack explicitly.
2020-06-08 10:51:56 +02:00
Praveen Karadugattu 31d7b17c46 avcodec/hevc: add support for Frame Duplication (Doubling/Tripling)
Parse picture_struct SEI value.
2020-02-06 17:04:41 +01:00
Andriy Gelman ad326379c6 lavc/h2645_parse: Don't automatically remove nuh_layer_id > 0 packets
HEVC standard supports multi-layer streams (ITU-T H.265 02/2018 Annex
F). Each NAL unit belongs to a particular layer defined by nuh_layer_id
in the header.

Currently, all NAL units that do not belong to a base layer are
automatically removed in ff_h2645_packet_split(). Some data may
therefore be lost when future filters/decoders are designed to support
multi-layer streams.

A better approach is to forward nuh_layer_id > 0 packets and let blocks
down the chain decide how to process them. The condition to remove
packets has been moved to hevcdec and cbs.

Found-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-17 17:43:52 -03:00
Andreas Rheinhardt 992532ee31 h2645_parse: Make ff_h2645_packet_split reference-compatible
This is in preparation for a patch for cbs_h2645. Now the packet's
rbsp_buffer can be owned by an AVBuffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
2019-01-23 22:33:43 +00:00
Linjie Fu 5764c9528b lavc/hevc_parser: report detailed log when missing picture occurs
Report the detailed log with buf_size in parse_nal_units to provide
more information when picture could not be found.

Match the behaviour in h264_parser.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-12 02:06:09 +01:00
Michael Niedermayer 449b1dcd7d avcodec/hevc_parser: very minor simplification in hevc_parse()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-30 20:08:21 +02:00
Haihao Xiang 4c14a25281 lavc/hevc: Don't parse NAL unit for a dummy buffer
hevc parser mistakenly reports the following message if a dummy buffer
is padded for EOF

   [hevc @ 0x559b63848610] missing picture in access unit

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: "Li, Zhong" <zhong.li@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-30 20:08:21 +02:00
James Almer 222d7055e2 avcodec/hevc_parser: use ff_hevc_decode_extradata() to parse extradata
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-30 12:13:20 -03:00
James Almer 2159d4bbc3 avcodec/hevc_parser: use ff_hevc_uninit_parameter_sets()
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-21 00:17:23 -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
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 1e8daf31e0 avcodec/hevc_parser: add missing call to ff_hevc_reset_sei()
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-18 19:55:44 -03:00
James Almer 859cc5c8e6 avcodec/hevc_parser: cosmetics
Reduces differences with libav slightly.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-05 20:10:17 -03:00
James Almer 214f4133c4 avcodec/hevc_parser: move hevc_find_frame_end() down in the file
Reduces differences with libav.
2017-05-05 20:10:17 -03:00
James Almer bf1e3be5a3 avcodec/hevc_parser: move slice header parsing to its own function
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:37 -03:00
James Almer 1c088632e9 avcodec/hevc_parser: remove HEVCContext usage
This gets rid of the duplicate, limited parser.

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:37 -03:00
James Almer ceb0859066 avcodec/hevc_parser: use ff_h2645_packet_split() to parse NAL units
This simplifies the code considerably.

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 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
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 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
Michael Niedermayer db3507a670 avcodec/hevc_parser: export framerate, remove one dependency on the decoder
Fixes Ticket6090

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-14 17:00:30 +01:00
Mark Thompson 0c559f7893 hevc: Return stream format information from parser 2016-10-31 19:23:40 +00: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
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
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
James Almer fc1c836def avcodec/hevc_parser: fix packet_split function name
Fixes compilation of hevc_parser without hevc_decoder

Signed-off-by: James Almer <jamrial@gmail.com>
2016-05-04 18:26:06 -03:00
Derek Buitenhuis 438ed974b8 Merge commit 'b667252a41fbf5a3f6ea8c67fdbc03db3d748977'
* commit 'b667252a41fbf5a3f6ea8c67fdbc03db3d748977':
  h2645_parse: add support for parsing h264

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-26 14:07:03 +01:00
Derek Buitenhuis 8e73574d4f Merge commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe'
* commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe':
  h2645_parse: add a function for uninitializing the packet

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-26 14:01:45 +01:00
Derek Buitenhuis 3c4ca4c5d7 Merge commit 'fa936a307f5cddfc2664600157a8207ca8080af6'
* commit 'fa936a307f5cddfc2664600157a8207ca8080af6':
  hevc_parse: rename into h2645_parse

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-26 13:56:47 +01:00
Derek Buitenhuis 4791a910c0 lavc/hevc_parse: Don't take a HEVCContext
It's not even used anymore, and the checks are no longer
functionally important.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-25 14:40:33 +01:00
Anton Khirnov b667252a41 h2645_parse: add support for parsing h264 2016-03-28 09:45:04 +02:00
Anton Khirnov 8229eff4b7 h2645_parse: add a function for uninitializing the packet 2016-03-28 09:43:18 +02:00
Anton Khirnov fa936a307f hevc_parse: rename into h2645_parse
This code will be shared with h264.
2016-03-28 09:42:44 +02:00
Andreas Cadhalpun 43ff4aed26 lavc: use get_bitsz to simplify the code
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-03 21:12:53 +01:00
Michael Niedermayer bd6610c3b3 avcodec/hevc_parser: Check init_get_bits8() for failure
Fixes: CID1322322

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-04 03:09:03 +02:00
Rainer Hochecker 62bd8deef9 avcodec/hevc_parser: fix split function of parser
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-02 02:48:43 +02:00
Michael Niedermayer 54882156dd avcodec/hevc_parser: Treat extradata parsing differently, as it should not contain an AU
Fixes ticket4718

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-19 03:24:25 +02:00
Michael Niedermayer 85b7456efe avcodec/hevc_parser: Fix memleaks in parser mix
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-13 22:26:53 +02:00
James Almer 84e847c7c8 avcodec/hevc_parser: use the old parser only when hevc decoder is available
If it's not, then the new dependence-free parser will be used instead

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-07-13 14:57:54 -03:00