Commit Graph

39 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
Carl Eugen Hoyos fc410ce572 lavf/hevc: Fix type specifiers, missed in 8b5d1553
Fixes several warnings with msvc:
warning: format specifies type 'unsigned char' but the argument has type 'unsigned int'
2022-10-23 20:45:25 +02:00
Andreas Rheinhardt c421000434 avformat/hevc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:42:20 +02:00
Andreas Rheinhardt 8b5d155301 avformat/hevc: Fix crash on allocation failure, avoid allocations
The HEVC code currently uses an array of arrays of NALUs; one such array
contains all the SPS NALUs, one all PPS NALUs etc. The array of arrays
is grown dynamically via av_reallocp_array(), but given that the latter
function automatically frees its buffer upon reallocation error,
it may only be used with PODs, which this case is not. Even worse:
While the pointer to the arrays is reset, the counter for the number
of arrays is not, leading to a segfault in hvcc_close().

Fix this by avoiding the allocations of the array of arrays altogether.
This is easily possible because their number is bounded (by five).
Furthermore, as a byproduct we can ensure that the code always
produces the recommended ordering of VPS-SPS-PPS-SEI (which was
not guaranteed before).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:40:45 +02:00
Jun Zhao 101e154c28 lavf/hevc: replace the unicode signal quotation with normal quotation
replace the unicode left/right signal quotation mark with normal
signal quotation.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2022-08-05 00:58:49 +08:00
Anton Khirnov 5620d18e66 lavf/hevc: drop unnecessary avcodec.h include 2021-06-10 16:51:44 +02:00
Andreas Rheinhardt 1884d887ba avformat/hevc: Defer initializations in ff_isom_write_hvcc()
Saves initialization of an HEVCDecoderConfigurationRecord when
the data is already in ISOBMFF-format or if it is plainly invalid.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-02 02:09:59 +02:00
Andreas Rheinhardt 22ec35a428 avformat/av1, hevc: Make *_buf-functions return 0 on success
The output size is already returned via a pointer argument, so there is
no need to return it via the ordinary return value as well. The
rationale behind this is to not poison the return value on success.
It also unifies the behaviour of the *_buf-functions for AVC, AV1 and
HEVC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-26 12:41:31 -03:00
Andreas Rheinhardt 680cd59bb2 avformat/hevc: Fix potential leak in case of ff_hevc_annexb2mp4_buf failure
ff_hevc_annexb2mp4_buf() could indicate an error, yet leave cleaning
after itself to the caller, so that a caller could not simply return the
error, but had to free the buffer first.

(Given that all current callers have set filter_ps = 0, this error can
currently not be triggered.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-26 12:41:31 -03:00
Baptiste Coudurier b401a4ab8a avformat/mxfenc: support XAVC long gop 2019-05-20 11:58:12 -07:00
James Almer 9482ec1b20 avformat/hvcc: zero initialize the nal buffers past the last written byte
Prevents use of uninitialized values.

Fixes ticket #7038.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-24 00:30:28 -03:00
Mark Thompson b1374e925c hevc: Improve stream constraint values in common header
Add comments to describe the sources of the constraint values expressed here,
and add some more related values which will be used in following patches.

Fix the incorrect values for SPS and PPS count (they are not the same as those
used for H.264), and remove HEVC_MAX_CU_SIZE because it is not used anywhere.

(cherry picked from commit b88da98b34)
2017-10-17 20:56:29 +01: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 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
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Michael Niedermayer ee155c18a2 avformat/hevc: Check num_long_term_ref_pics_sps to avoid potentially long loops
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-24 13:04:38 +02:00
Arthur Grant 781efd0741 avformat/hevc: Fix parsing errors
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-24 12:44:34 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Michael Niedermayer b457da4ce2 Merge commit '0e7c0ec344f542e68e3cc9680e8d41dffeffdb4e'
* commit '0e7c0ec344f542e68e3cc9680e8d41dffeffdb4e':
  lavf/hevc: pad the RBSP buffer as required by the bistream reader

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-09 03:54:31 +02:00
Anton Khirnov 0e7c0ec344 lavf/hevc: pad the RBSP buffer as required by the bistream reader 2015-07-08 23:36:10 +02:00
Deliang Fu 6e1f8780c8 avformat: Fix bug in parse_rps for HEVC.
Make the logic in libavformat/hevc.c parse_rps align with libavcodec/hevc_ps.c ff_hevc_decode_short_term_rps

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-11 02:31:53 +02:00
Michael Niedermayer b62b3292d8 avformat/hevc: Check num_negative_pics and num_positive_pics
Fixes CID1238994

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-12 19:28:15 +02:00
Michael Niedermayer 2cddc0b19a avformat/hevc: Check cpb_cnt_minus1
Fixes CID1239014

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-12 19:09:06 +02:00
Michael Niedermayer 40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +02:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Lou Logan 88f2586adb fix various typos
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 10:58:19 -08:00
Michael Niedermayer 7f90055470 Merge commit '34bbc81de8a49fbddb92b76dc733f40890480b2b'
* commit '34bbc81de8a49fbddb92b76dc733f40890480b2b':
  lavf: simplify ff_hevc_annexb2mp4_buf

Conflicts:
	libavformat/hevc.c
	libavformat/hevc.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 23:38:01 +01:00
Michael Niedermayer b73cf4eb15 Merge commit 'ee17be3fdd37f63f4b77676820e387858908b0f4'
* commit 'ee17be3fdd37f63f4b77676820e387858908b0f4':
  hevc: Use get_se_golomb_long

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 22:51:49 +01:00
Michael Niedermayer 77e9123fe5 lavf: always use av_free
Signed-off-by: Tim Walker <tdskywalker@gmail.com>
2014-03-10 18:02:55 +01:00
Tim Walker 34bbc81de8 lavf: simplify ff_hevc_annexb2mp4_buf
Use ff_hevc_annexb2mp4 instead of duplicating
its functionality, and update the documentation
to match the new behavior.
2014-03-10 18:02:36 +01:00
Luca Barbato ee17be3fdd hevc: Use get_se_golomb_long
Do not use inline functions that refer to tables present in other
libraries.
2014-03-10 10:59:48 +01:00
Michael Niedermayer 88c8e4afea avformat/hevc: fix mix of av_malloc() with free()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 23:27:31 +01:00
Michael Niedermayer a379813cee Merge commit 'b6c61fb83e876d404ac3b0b3657ebfcafdcd1926'
* commit 'b6c61fb83e876d404ac3b0b3657ebfcafdcd1926':
  movenc: enable Annex B to MP4 conversion for HEVC tracks.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 23:08:33 +01:00
Michael Niedermayer 1b1d77ae9b Merge commit '20b40a597cdd4969cf1147d7c7efee2b6232524b'
* commit '20b40a597cdd4969cf1147d7c7efee2b6232524b':
  movenc: write hvcC tag for HEVC.

Conflicts:
	libavformat/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 22:48:08 +01:00
Tim Walker b6c61fb83e movenc: enable Annex B to MP4 conversion for HEVC tracks. 2014-03-09 18:09:40 +01:00
Tim Walker 20b40a597c movenc: write hvcC tag for HEVC. 2014-03-09 18:09:40 +01:00