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

98723 Commits

Author SHA1 Message Date
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
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