Commit Graph

96508 Commits

Author SHA1 Message Date
Andreas Rheinhardt
2899995a6f avformat/av1, avc, hevc: Remove av_freep()
ff_av1_filter_obus_buf() and ff_avc_parse_nal_units_buf() both have a
pointer-to-pointer parameter which they use to pass a newly allocated
buffer to the caller. And both functions freed what this pointer points to
before overwriting it. But no caller of these functions used this feature,
but some had to initialize the pointer just because of this. So remove
it and update the documentation of ff_av1_filter_obus_buf() wrt this fact.

ff_hevc_annexb2mp4_buf in contrast did not free the pointer. This has been
documented, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-26 12:41:32 -03:00
Andreas Rheinhardt
d4bbc0db01 avformat/av1: Improve filtering AV1 OBUs
Both ISOBMFF as well as Matroska require certain OBUs to be stripped
before muxing them. There are two functions for this purpose; one writes
directly into an AVIOContext, the other returns a freshly allocated
buffer with the undesired units stripped away.

The latter one actually relies on the former by means of a dynamic
buffer. This has several drawbacks: The underlying buffer might have to
be reallocated multiple times; the buffer will eventually be
overallocated; the data will not be directly copied into the final
buffer, but rather first in the write buffer (in chunks of 1024 byte)
and then written in these chunks. Moreover, the API for dynamic buffers
is defective wrt error checking and as a consequence, the earlier code
would indicate a length of -AV_INPUT_BUFFER_PADDING_SIZE on allocation
failure, but it would not return an error; there would also be no error
in case the arbitrary limit of INT_MAX/2 that is currently imposed on
dynamic buffers is hit.

This commit changes this: The buffer is now parsed twice, once to get
the precise length which will then be allocated; and once to actually
write the data.

For a 22.7mb/s file with average framesize 113 kB this improved the time
for the calls to ff_av1_filter_obus_buf() when writing Matroska from
753662 decicycles to 313319 decicycles (based upon 50 runs a 2048 frames
each); for another 1.5mb/s file (with average framesize of 7.3 kB) it
improved from 79270 decicycles to 34539 decicycles (based upon 50 runs a
4096 frames).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-26 12:41:32 -03:00
Andreas Rheinhardt
e8518c2580 avformat/movenc: Check for reformatting errors when writing hint tracks
If this is not done, the avio_write() calls will cause segfaults
immediately afterwards on error.

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
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
Andreas Rheinhardt
e4749a4497 avformat/matroskaenc: Cosmetics
Add {, } in situations like
if ()
    ...
else if ()
    /* Comment */
    ...
else ...

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
58428bef4b avformat/matroskaenc: Check for reformatting errors
This is needed especially for AV1: If a reformatting error happens (e.g.
if the length field of an OBU contained in the current packet indicates
that said OBU extends beyond the current packet), the data pointer is
still NULL, yet the size is unchanged, so that writing the data leads
to a segmentation fault.

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
Gyan Doshi
6e6b34917e avfilter/scale: don't fail for circular expressions
Due to conditional expressions, it is possible for them to be resolved
successfully. A warning is still printed.
2020-01-26 21:06:53 +05:30
Paul B Mahol
ecd95858d4 avfilter/vf_tonemap_opencl: fix long filter description 2020-01-26 14:51:52 +01:00
Carl Eugen Hoyos
c2d0321661 doc/outdevs: Mention "sdl2" alias for "sdl".
Fixes ticket #8498.
2020-01-26 13:15:07 +01:00
Zane van Iperen
dc3aa376dc avformat: add demuxer for argonaut games' ASF format
Adds support for the custom ASF container used by some Argonaut Games'
games, such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Can also handle the sample files in:
https://samples.ffmpeg.org/game-formats/brender/part2.zip

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-01-26 10:24:00 +01:00
Zane van Iperen
bf890ae0d7 avcodec: add decoder for argonaut games' adpcm codec
Adds support for the ADPCM variant used by some Argonaut Games' games,
such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-01-26 10:23:54 +01:00
Marton Balint
15d160cc0b avformat/udp: increase the default buffer size of a receiving socket to 384K
It is a common mistake that people only increase fifo_size when they experience
drops, unfortunately this does not help for higher bitrate (> 100 Mbps) streams
when the reader thread simply might not receive the packets in time (especially
under high CPU load) if the default 64 KB of kernel buffer size is used.

New default is determined so that common linux systems can set this buffer size
without tuning kernel parameters.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-25 23:16:47 +01:00
Marton Balint
67f39b32db avformat/udp: properly use return value of pthread_cond_timedwait
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-25 23:16:47 +01:00
Marton Balint
f61e9f8aef avformat/udp: add newline after warning
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-25 23:16:47 +01:00
Marton Balint
1812b42554 avutil/thread: fix strict_pthread_cond_timedwait
Timeout error was assumed to be fatal which it is not.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-25 23:16:18 +01:00
Paul B Mahol
4b4bcb126c avfilter/vf_v360: do not remap alpha plane if that will be overwritten later 2020-01-25 20:00:53 +01:00
Gyan Doshi
75d1d9eb34 avformat/movenc: allow ISMV timescale to be user-set
As per the PIFF standard, the timescale of 10000000
is recommended but not mandatory, so don't override
the user-set value.

A warning is shown for non-recommended values.
2020-01-25 21:36:17 +05:30
Paul B Mahol
9990cb16d3 avfilter/vf_v360: mark another hemisphere not visible for flat input format 2020-01-25 14:34:05 +01:00
Paul B Mahol
8d861cd850 avfilter/vf_v360: add mask option, unset pixels are marked as transparent 2020-01-25 14:34:05 +01:00
Paul B Mahol
31350de997 avfilter/vf_deshake_opencl: silence warning about usage of uninitialized value 2020-01-25 11:42:32 +01:00
Andreas Rheinhardt
1ab302da6e avcodec/cbs_av1_syntax_template: Remove unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-24 20:03:47 -03:00
James Almer
c461500c5e avcodec/libaomenc: add an option to set the encoder "usage"
This allows the user enable the realtime encoding speed mode

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-24 20:03:46 -03:00
Paul B Mahol
a4f2fc9341 avfilter/vf_v360: fix fov calculation from dfov for fisheye input/output 2020-01-24 23:22:38 +01:00
Martin Storsjö
cbb254cb4c checkasm: Check HAVE_GETSTDHANDLE here as well
This was missed in 63418e374f.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-24 22:17:18 +02:00
Marton Balint
e931119a41 avdevice/xcbgrab: check if frame size fits in INT_MAX
Also fixes a possible overflow and sets stream bitrate.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-24 01:17:14 +01:00
Marton Balint
b7e94adb4e avdevice/xcbgrab: move some initialization code from pixfmt_from_pixmap_format to create_stream
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-24 01:17:14 +01:00
Marton Balint
fee4cafbf5 avformat/libsrt: add missing SRT_VERSION_VALUE check
This was missed in d7e2a2bb35.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-23 22:41:43 +01:00
Martin Storsjö
1001b6a750 libavutil: x86: Include stdlib.h before using _byteswap_ulong
When clang works in MSVC mode, it does have the _byteswap_ulong
builtin, but one has to include stdlib.h before using it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-23 18:30:26 +02:00
Martin Storsjö
63418e374f configure: Check for GetStdHandle in addition to SetConsoleTextAttribute
SetConsoleTextAttribute used to be unavailable for Windows Store apps,
but is available to them now. But GetStdHandle still is unavailable,
thus make sure to check for both functions before using code that
requires both.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-01-23 18:30:09 +02:00
Andreas Rheinhardt
e3fb9af6f1 avcodec/ra144enc: Fix invalid left shift of negative number
by replacing it with a multiplication. Said multiplication can't
overflow an int32_t because lpc_coefs is limited to 16 bit precision.

Fixes the FACE-test acodec-ra144 as well as part of #8217.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-23 12:19:07 +01:00
Paul B Mahol
d033f403d6 avfilter/vf_v360: support input flips for tetrahedron format 2020-01-23 11:20:18 +01:00
Paul B Mahol
05d3d09cf5 avfilter/vf_v360: fix small artifacts with tetrahedron inputs 2020-01-23 11:20:18 +01:00
Gyan Doshi
41f283ec7a avformat/utils: log corrupt packets 2020-01-23 12:08:20 +05:30
Paul B Mahol
ec4f764249 avfilter/vf_v360: add tetrahedron format 2020-01-22 23:49:32 +01:00
Michael Niedermayer
5f7727e1c9 tools/target_dec_fuzzer: Use codec_tags list
This should make it much quicker for the fuzzer to test
real relevant codec_tags

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 21:50:49 +01:00
Michael Niedermayer
576bf05aa9 avcodec/hapdec: Add codec_tags list
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 21:50:49 +01:00
Michael Niedermayer
550a6b4212 avcodec/avcodec: Add codec_tags array to AVCodec
This allows the fuzzer to target meaningfull codec tags instead
of hunting the 4gb space, which it seems to have problems with.

Suggested-by: James
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 21:50:49 +01:00
Michael Niedermayer
d48e510124 swscale/input: Fix several invalid shifts related to rgb2yuv constants
Fixes: Invalid shifts
Fixes: #8140
Fixes: #8146

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 21:50:49 +01:00
Paul B Mahol
a3e67c2d2f avfilter/vf_stack: add fill option for xstack 2020-01-22 19:13:51 +01:00
Michael Niedermayer
07b3dbbbb2 avutil/log: Move log_level_offset_offset code from av_log() to v_log()
Suggested-by: Anton
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 18:41:46 +01:00
Michael Niedermayer
7b7f97532b swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()
Fixes: Invalid shifts
Fixes: #8320

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 18:41:46 +01:00
Michael Niedermayer
a6ca22c118 swscale/swscale: Fix several invalid shifts related to vChrDrop
Fixes: Invalid shifts
Fixes: #8166
Fixes: filter-crop_scale_vflip FATE-test

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-22 18:41:46 +01:00
Paul B Mahol
a00fa73f47 avfilter/vf_v360: improve fisheye input format 2020-01-22 12:59:35 +01:00
Paul B Mahol
2bae3da79e avcodec/exr: fix some small cosmetics nits 2020-01-22 10:43:49 +01:00
Gonzalo Garramuño
44b1c5ddcf avcodec/exr.c: make channel name comparisons case insensitive
Allow matching channel names in lowercase, like Diffuse.r in addition to Diffuse.R
2020-01-22 10:43:49 +01:00
Matt Oliver
fc6fde22c3 avutil/thread: Add pthread_cond_timedwait function
v2: fix calculating milisecond times and use SleepConditionVariableSRW.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2020-01-21 22:34:15 +01:00
Michael Niedermayer
00447b6f52 tools/target_dec_fuzzer: Also Fuzz with CPU optimizations disabled
This should improve coverage of *_c()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-21 21:38:38 +01:00
Michael Niedermayer
4b733a7f5f tools/target_dec_fuzzer: Fuzz private options of AC3/E-AC3
This should improve AC-3 coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-21 21:38:38 +01:00
Michael Niedermayer
48083f1890 tools/target_dec_fuzzer: Fuzz idct_algo value
This should improve coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-21 21:38:38 +01:00