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

98785 Commits

Author SHA1 Message Date
James Almer
5eb4405fc5 avcodec/libdav1d: use av_image_get_buffer_size() to calculate frame size
Calling av_image_fill_arrays() with NULL as src argument may result in UB.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-22 11:42:54 -03:00
Brian Kim
c40d36076a libavcodec/decode: avoid UB when getting plane sizes
This uses av_image_fill_plane_sizes instead of av_image_fill_pointers
when we are getting plane sizes to avoid UB from adding offsets to NULL.

Signed-off-by: Brian Kim <bkkim@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-22 11:42:54 -03:00
Brian Kim
fccbd1245f libavutil/frame: avoid UB when getting plane sizes
This uses av_image_fill_plane_sizes instead of av_image_fill_pointers
when we are getting plane sizes to avoid UB from adding offsets to NULL.

Signed-off-by: Brian Kim <bkkim@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-22 11:42:54 -03:00
Brian Kim
3a8e927176 avutil/imgutils: add utility to get plane sizes
This utility helps avoid undefined behavior when doing things like
checking how much memory we need to allocate for an image before we have
allocated a buffer.

Signed-off-by: Brian Kim <bkkim@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-22 11:41:57 -03:00
James Zern
b5f1e057e1 avcodec/libvpxenc: use pix_fmt descriptors where useful
similar to:
36e51c190b avcodec/libaomenc: use pix_fmt descriptors where useful

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
2020-07-21 14:56:44 -07:00
Paul B Mahol
17f6bd6e58 avfilter/vf_xfade: add hblur transition 2020-07-21 23:29:55 +02:00
Zane van Iperen
e35a0f8f3f avcodec/adpcmenc: cleanup trellis checks
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:36:14 +10:00
Zane van Iperen
932edaaa60 fate: add adpcm_ima_apm encoding test
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:36:14 +10:00
Zane van Iperen
4eb6ec3a85 avformat: add apm muxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:36:14 +10:00
Zane van Iperen
80dda80981 avcodec: add adpcm_ima_apm encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:36:14 +10:00
Zane van Iperen
8598fc4010 avcodec/apm: fix sample_rate check
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:33:00 +10:00
Michael Niedermayer
081e3001ed avcodec/tdsc: Fix tile checks
Fixes: out of array access
Fixes: crash.asf

Found-by: anton listov <greyfarn7@yandex.ru>
Reviewed-by: anton listov <greyfarn7@yandex.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-20 22:31:54 +02:00
Fei Wang
8544783280 swscale/yuv2rgb: consider x2rgb10le on big endian hardware
This fixed FATE fail report by filter-pixfmts* for x2rgb10le on big
endian hardware.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-20 21:00:00 +02:00
Michael Niedermayer
b6663adaae avformat/sbgdec: Check for overflow in parse_timestamp()
Fixes: signed integer overflow: 33986707200000000 + 9195561788997000192 cannot be represented in type 'long'
Fixes: 23790/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554232198266880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-20 19:47:27 +02:00
Steinar H. Gunderson
80286671c5 avcodec/put_bits: Fix LZW warning
lzwenc stores a function pointer to either put_bits or put_bits_le;
however, after the recent change, the function pointer's prototype
would depend on BitBuf. BitBuf is defined in put_bits.h, whose
definition depends on whether BITSTREAM_WRITER_LE is #defined or not.
For safety, we set a boolean flag for little/big endian instead,
which also allows the definition to be inlined.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-20 18:41:09 +02:00
Paul B Mahol
c4c989c7ca avfilter/vf_yaepblur: fix naming of filter class 2020-07-20 16:12:56 +02:00
Jun Zhao
ba31fdfd7b lavf/dashdec: enable custom interrup callback in sub-demuxer
Enable the custom callback in sub-demuxer

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-20 19:23:15 +08:00
Jun Zhao
4239a8c983 lavf/hls: enable custom interrup callback in sub-demuxer
Enable the custom callback in sub-demuxer

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-20 19:17:42 +08:00
Linjie Fu
43a08d907b lavc/vaapi_encode_h265: add h265 tile encoding support
Default to enable uniform_spacing_flag. Guess level by the tile
rows/cols. Supported for ICL+ platforms.

Also add documentations.

To encode with 4 rows 2 columns:
    ffmpeg ... -c:v hevc_vaapi -tiles 4x2 ...
    ffmpeg ... -c:v hevc_vaapi -tile_rows 4 -tile_cols 2 ...

Suggested-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-07-20 15:27:05 +08:00
Linjie Fu
a7c2cdf0f6 lavc/vaapi_encode: add tile slice encoding support
Add functions to initialize tile slice structure and make tile slice:
 - vaapi_encode_init_tile_slice_structure
 - vaapi_encode_make_tile_slice

Tile slice is not allowed to cross the boundary of a tile due to
the constraints of media-driver. Currently adding support for one
slice per tile.

N x N tile encoding is supposed to be supported with the the
capability of ARBITRARY_MACROBLOCKS slice structures.

N X 1 tile encoding should also work in ARBITRARY_ROWS slice
structure.

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-07-20 15:26:50 +08:00
Linjie Fu
65f4d561c9 lavc/vaapi_encode: wrap slice codes into row slice functions
Wrap current whole-row slice codes into following functions:
 - vaapi_encode_make_row_slice()
 - vaapi_encode_init_row_slice_structure()

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-07-20 15:26:35 +08:00
Steven Liu
2c1cc326e9 avformat/crypto.c: remove unnecessary code
Because the newpos variable is set value before use it.
The newpos variable declared at the head partition of crypto_seek.
Make the code clean.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2020-07-20 10:14:53 +08:00
Carl Eugen Hoyos
c4b6ee55c0 lavc/sgienc: Fix default 16bit encoding.
Broken since 7c56b879
2020-07-19 21:57:41 +02:00
Shiyou Yin
12614a589f avcodec/mips: fix type mismatch in h264dsp_msa.c
gcc warning: assignment from incompatible pointer type.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-19 10:59:43 +02:00
Steinar H. Gunderson
88d80cb975 avcodec/put_bits: Make bit buffers 64-bit
Change BitBuf into uint64_t on 64-bit x86. This means we need to flush the
buffer less often, which is a significant speed win. All other platforms,
including all 32-bit ones, are unchanged. Output bitstream is the same.

All API constraints are kept in place, e.g., you still cannot put_bits()
more than 31 bits at a time. This is so that codecs cannot accidentally
become 64-bit-only or similar.

Benchmarking on transcoding to various formats shows consistently
positive results:

  dnxhd                 25.60 fps ->  26.26 fps ( +2.6%)
  dvvideo               24.88 fps ->  25.17 fps ( +1.2%)
  ffv1                  14.32 fps ->  14.58 fps ( +1.8%)
  huffyuv               58.75 fps ->  63.27 fps ( +7.7%)
  jpegls                 6.22 fps ->   6.34 fps ( +1.8%)
  magicyuv              57.10 fps ->  63.29 fps (+10.8%)
  mjpeg                 48.65 fps ->  49.01 fps ( +0.7%)
  mpeg1video            76.41 fps ->  77.01 fps ( +0.8%)
  mpeg2video            75.99 fps ->  77.43 fps ( +1.9%)
  mpeg4                 80.66 fps ->  81.37 fps ( +0.9%)
  prores                12.35 fps ->  12.88 fps ( +4.3%)
  prores_ks             16.20 fps ->  16.80 fps ( +3.7%)
  rv20                  62.80 fps ->  62.99 fps ( +0.3%)
  utvideo               68.41 fps ->  76.32 fps (+11.6%)

Note that this includes video decoding and all other encoding work,
such as DCTs. If you isolate the actual bit-writing routines, it is
likely to be much more.

Benchmark details: Transcoding the first 30 seconds of Big Buck Bunny
in 1080p, Haswell 2.1 GHz, GCC 8.3, generally quantizer locked to
5.0. (Exceptions: DNxHD needs fixed bitrate, and JPEG-LS is so slow
that I only took the first 10 seconds, not 30.) All runs were done
ten times and single-threaded, top and bottom two results discarded to
get rid of outliers, arithmetic mean between the remaining six.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-19 10:59:43 +02:00
Steinar H. Gunderson
c63c303a1f avcodec/put_bits: Parametrize bit buffer type
Preparatory patch for making the bit buffer different size on different
platforms; make a typedef and make all the hardcoded sizes into expressions
deriving from this size.

No functional change; generated assembler is near-identical.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-19 10:59:43 +02:00
Gautam Ramakrishnan
e39490615f libavcodec/jpeg2000dec: Support for Parameterless Markers
The JPEG2000 standard reserves marker values 0xFF30
to 0xFF3F to be used as parameterless markers. This
patch adds support to decode codestream with such
markers. This allows decoding of p0_02.j2k.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-19 10:59:43 +02:00
Linjie Fu
489c5db079 lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure
VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS is added to in the latest
libva (1.8.0) which matches the hardware behaviour:

/** \brief Driver supports any number of rows per slice but they must
*    be the same for all slices except for the last one, which must be
*    equal or smaller to the previous slices.
*/

And VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS is kind of deprecated for iHD
since it's somehow introduced in [1] which is misleading from what we
actually handles.

[1]<0e6d5441f1>

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-07-19 14:38:26 +08:00
Zane van Iperen
91a9f86edf avformat/apm: fix variable/structure names and cosmetics 2020-07-19 14:43:04 +10:00
Zane van Iperen
1b0a0da63a avformat/apm: use the entire APMState structure as extradata
Is the "actual" codec extradata instead of the hand-crafted one
from the previous revision.
2020-07-19 14:42:51 +10:00
Zane van Iperen
3bf1be2101 avformat/apm: read header correctly
The leading WAVEFORMATEX in .APM files is malformed:
* The nAvgBytesPerSec field is wrong, and
* sizeof(cbSize) is 4 instead of 2.
2020-07-19 14:38:40 +10:00
Jun Zhao
68c56082d3 doc/http: Update HTTP protocol options
remove the timeout option docs part for HTTP protocol and add
auth_type option part.

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-19 08:41:32 +08:00
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