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

98503 Commits

Author SHA1 Message Date
Andreas Rheinhardt
1998d1d6af avformat/au: Avoid allocation for metadata string
When there are potentially annotation (i.e. metadata) fields to write,
au_get_annotations() is called to produce a string with them. To do so,
it uses an AVBPrint which is finalized to create the string. This is
wasteful, because it always leads to an allocation even if the string
actually fits into the internal buffer of the AVBPrint. This commit
changes this by making au_get_annotations() modify an AVBPrint that
resides on the stack of the caller (i.e. of au_write_header()).

Furthermore, the AVBPrint is now checked for truncation; limiting
the allocations implicit in the AVBPrint allowed to offload the overflow
checks. Notice that these were not correct before: The size parameter of
avio_write() is an int, yet the string in the AVBPrint was allowed to
grow bigger than INT_MAX. And if the length of the string was so near
UINT_MAX that the length + 32 overflowed, the old code would write the
first eight bytes of the string and nothing more, leading to an invalid
file.

Finally, the special case in which the metadata dictionary of the
AVFormatContext is empty (in which case one still has to write eight
binary zeroes) is now no longer treated specially, because this case
no longer incurs any allocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-18 18:18:41 +02:00
Andreas Rheinhardt
c2e17e8d84 avformat/au: Simplify writing string into AVBPrint
by using av_bprintf() instead of several av_bprint_append().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-18 18:03:19 +02:00
Andreas Rheinhardt
84340497c0 avformat/au: Remove redundant av_freep()
This av_freep(&key) in conjunction with the fact that the loop condition
checks for key != NULL was equivalent to a av_freep(&key) + a break
immediately thereafter. But given that there is an av_freep(&key)
directly after the loop, the av_freep(&key) is unnecessary and the break
can also be added explicitly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-18 18:00:46 +02:00
Andreas Rheinhardt
8d3556b7a3 avformat/au: Store strings instead of pointers to strings in array
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-18 17:16:24 +02:00
Paul B Mahol
fa8345cf05 avfilter/vf_bilateral: simplify code a little
Make alpha_ calculation faster.
2020-07-18 10:22:12 +02:00
James Almer
36e51c190b avcodec/libaomenc: use pix_fmt descriptors where useful
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-17 18:23:45 -03:00
Lynne
6a2f3f60ae
libaomenc: enable 8, 10 and 12 bit RGB encoding
RGB pixel formats are one occasion where by pixel format we mean
pixel format, primaries, transfer characteristic, and matrix coeffs,
so we have to manually set them as they're set to unspecified by
default, despite there only being a single possible combination.
2020-07-17 21:13:10 +01:00
Zane van Iperen
dabac26fa5 MAINTAINERS: add myself and gpg fingerprint
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-17 21:57:18 +02:00
James Almer
890f2e960a avcodec/libx264: call x264_param_cleanup() if available
The documentation states it should be used to free any memory allocated
by x264_param_parse().

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-17 15:24:56 -03:00
James Almer
03ad76794e avcodec/libx264: check for param allocation failure error code
And return the proper AVERROR value.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-17 15:24:56 -03:00
James Almer
d1bd079d11 avcodec/libx264: use a function to parse x264opts
This is needed for the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-17 15:24:56 -03:00
Paul B Mahol
3a37aa597f avfilter/avf_showwavespic: add filter mode 2020-07-17 14:26:48 +02:00
Paul B Mahol
d363afb30e avfilter/vf_tinterlace: fix mergex2, first frame is always considered odd 2020-07-17 13:53:55 +02:00
Paul B Mahol
24fea4d09b avfilter/vf_tinterlace: use frame counter from lavfi
Remove internal counter.
2020-07-17 13:53:55 +02:00
leozhang
fe591393cd avfilter/vf_bilateral: remove useless memcpy
Signed-off-by: leozhang <leozhang@qiyi.com>
2020-07-17 13:53:22 +02:00
Paul B Mahol
241cdded0f avfilter/vf_bilateral: stop using sigmaS as percent of width/height 2020-07-17 13:53:22 +02:00
James Almer
d11cc743c8 Revert "avcodec/cbs_av1: keep separate reference frame state for reading and writing"
This reverts commit 4e2bef6a82.
It's no longer needed now that all the bsfs use separate contexts
for reading and writing.
2020-07-16 21:49:27 -03:00
James Almer
2493944e31 avcodec/av1_frame_merge_bsf: Use separate contexts for reading/writing
Based on code from 235a5734e0

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-16 21:49:27 -03:00
James Almer
c91be9de4c avcodec/av1_metadata_bsf: Use separate contexts for reading/writing
Based on code from 235a5734e0

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-16 21:49:27 -03:00
Gautam Ramakrishnan
db7dfb4a79 libavcodec/jpeg2000 Fix RPCL Progression order check
The RPCL progression order check was incomplete. This
patch completes the check. Tested on p1_07.j2k.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-16 17:44:53 +02:00
Zhao Zhili
af7b1031e1 avformat/mov: fix atom type to string conversion
The conversion was endian-dependent, and it may contain non-printable
characters.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-16 17:44:53 +02:00
Michael Niedermayer
663f024415 swscale/tests/swscale: use 1 for indicating erros
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-16 17:44:53 +02:00
Andriy Gelman
a9fecb8ea1 avcodec/v4l2_m2m_dec: remove redundant packet and fix double free
v4l2_receive_frame() uses two packets s->buf_pkt and avpkt. If avpkt
cannot be enqueued, the packet is buffered in s->buf_pkt and enqueued in
the next call. Currently the ownership transfer between the two packets
is not properly handled. A double free occurs if
ff_v4l2_context_enqueue_packet() returns EAGAIN and v4l2_try_start
returns EINVAL.

In fact, having two AVPackets is not needed and everything can be
handled by s->buf_pkt.

This commit removes the local avpkt from v4l2_receive_frame(), meaning
that the ownership transfer doesn't need to be handled and the double
free is fixed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-07-16 11:25:23 -04:00
Gautam Ramakrishnan
660386813d libavcodec/jpeg2000 Fix PCRL Progression Order check
The PCRL progression checks were incomplete. This patch
modifes completes the check. Tested on p1_05.j2k.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-16 10:13:22 +02:00
Gyan Doshi
1ec2b3de5a avformat/riffenc: indicate storage of flipped RGB bitmaps
Some legacy applications such as AVI2MVE expect raw RGB bitmaps
to be stored bottom-up, whereas our RIFF BITMAPINFOHEADER assumes
they are always stored top-down and thus write a negative value
for height. This can prevent reading of these files.

Option flipped_raw_rgb added to AVI and Matroska muxers
which will write positive value for height when enabled.

Note that the user has to flip the bitmaps beforehand using other
means such as the vflip filter.
2020-07-15 20:52:01 +05:30
Limin Wang
a54b367c78 avdevice/decklink_dec: export timecode with s12m side data
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-15 05:47:14 +08:00
Limin Wang
448a9aaa78 API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-15 05:47:14 +08:00
Limin Wang
c24c6a1bee avutil/timecode: add description for SMPTE binary format
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-15 05:47:14 +08:00
Gautam Ramakrishnan
05f3d37dd5 libavcodec/jpeg2000dec : Prevent overriding SOP marker bit
Currently, the COC marker overrides the SOP marker bit.
However, only the COD marker may set this value. This
patch fixes this bug.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-14 22:05:02 +02:00
Michael Niedermayer
24c575e0aa swscale/tests/swscale: Initialize res to a non random error code
Regression since: 3adffab073

-1 is consistent what other error paths return

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-14 22:05:02 +02:00
Michael Niedermayer
ec27c1827c swscale/tests/swscale: Fix incorrect return code check
Regression since: 3adffab073

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-14 22:05:02 +02:00
James Almer
ba3e771a42 x86/yuv2rgb: fix crashes when storing data on unaligned buffers
Regression since fc6a5883d6 on SSSE3 enabled
CPUs.

Fixes ticket #8747

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-14 14:06:04 -03:00
Ruiling Song
7772666e5b mailmap: add entry for myself
Signed-off-by: Ruiling Song <ruiling.song83@gmail.com>
2020-07-13 11:24:04 +08:00
Philip Langdale
93febc4e15 avutil/hwcontext_vdpau: Correctly initialise pixfmts
The number of declared vdpau formats can vary depending on which
version of libvdpau we build against, so the number of pix fmts
can vary too. Let's make sure we keep those numbers in sync.
2020-07-12 08:33:40 -07:00
Moritz Barsnick
2dabee7c0f avformat/mov: fix missing line break in messages
One of them can be triggered by https://samples.ffmpeg.org/F4V/H263_NM_f.mp4.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
2020-07-12 20:40:54 +05:30
James Almer
55e1bc39cb checkasm/vf_blend: use the correct depth parameters to initialize the blend modes
This effectively enables the tests that until now were just running
the C version alone.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-12 11:30:23 -03:00
James Almer
320694ff84 x86/vf_blend: fix warnings about trailing empty parameters
Finishes fixing ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-12 11:30:23 -03:00
James Almer
2c844c9828 x86/h264_deblock: fix warning about trailing empty parameter
Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-12 11:30:23 -03:00
Henrik Gramner
0b2b03568f avutil/x86inc: fix warnings when assembling with Nasm 2.15
Some new warnings regarding use of empty macro parameters has
been added, so adjust some x86inc code to silence those.

Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-12 11:30:23 -03:00
Jun Zhao
3205ed31a7 lavf/udp: fix the comments for default UDP socket recvbuf size
15d160cc0b increased the UDP socket receiving buffer size
(64K ->384K), but missed to update this comments.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-12 08:13:00 +08:00
Jun Zhao
04037e2966 lavfi/setpts: fix setpts/asetpts option dump error
fix the command ffmpeg -h filter=setpts/asetpts both dump the expr
option with "FVA" flags.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-12 08:11:42 +08:00
Ben Clayton
4dab04622a libavfilter/glslang: Remove unused header
The <glslang/Include/revision.h> include was not used, and revision.h has
been removed from glslang master.
See: https://github.com/KhronosGroup/glslang/pull/2277
2020-07-11 13:01:33 +01:00
Paul B Mahol
6f84e92172 avfilter/vf_chromanr: move thres calculation to filter_frame() 2020-07-10 23:09:19 +02:00
Andreas Rheinhardt
5d91b7718e avformat/sdp: Fix potential write beyond end of buffer
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-10 20:36:31 +02:00
Andreas Rheinhardt
ec59dc73f0 avformat/mm: Check for existence of audio stream
No audio stream is created unconditionally and if none has been created,
no packet with stream_index 1 may be returned. This fixes an assert in
ff_read_packet() in libavformat/utils reported in ticket #8782.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-10 20:36:31 +02:00
Michael Niedermayer
79e8d17024 avcodec/tiff: Check input space in dng_decode_jpeg()
Fixes: out of array read
Fixes: 24034/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5111884337119232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-10 20:27:07 +02:00
Michael Niedermayer
dde6077297 avcodec/mjpeg_parser: Adjust size rejection threshold
Fixes: 86987846-429c8d80-c197-11ea-916b-bb4738e09687.jpg
Fixes: Regression since ec3d8a0e69

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-10 20:27:07 +02:00
Michael Niedermayer
4a10bc8f6f avcodec/cbs_jpeg: Fix uninitialized end index in cbs_jpeg_split_fragment()
Fixes: Out of array read
Fixes: 24043/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5084566275751936.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-10 20:27:07 +02:00
ManojGuptaBonda
ed5ee04722 avcodec/hevcdec: Add VDPAU to list of supported formats
Added VDPAU to list of supported formats for HEVC10 and 12 bit formats
also added 42010 bit to surface_parameters and new VDP chroma formats to
VDPAUPixFmtMaps

Add HEVC 420 10/12 Bit  and 444 10/12 Bit support for VDPAU

YUV444P10 is defined as the 444 surface with 10bit valid data in LSBs
but H/w returns Data in MSBs Hence if we map output as YUV444p16 it
is filtering out the LSB to convert to p10 format.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-07-09 20:54:11 -07:00
ManojGuptaBonda
3c821c4ad3 lavc/vdpau_hevc: add function to find exact vdp_profile for REXT
Add vdpau_parse_rext_profile and use profile constraint flags to
determine the exact vdp_profile for HEVC_REXT.

If profile mismatch is allowed, select Main profile by default.

Add build object in Makefile for h265_profile_level dependency.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-07-09 20:54:11 -07:00