]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavformat/apm: read header correctly
Zane van Iperen [Tue, 30 Jun 2020 00:44:39 +0000 (10:44 +1000)]
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.

3 years agodoc/http: Update HTTP protocol options
Jun Zhao [Fri, 17 Jul 2020 02:59:05 +0000 (10:59 +0800)]
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>
3 years agoavformat/au: Avoid allocation for metadata string
Andreas Rheinhardt [Mon, 13 Jul 2020 17:31:46 +0000 (19:31 +0200)]
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>
3 years agoavformat/au: Simplify writing string into AVBPrint
Andreas Rheinhardt [Mon, 13 Jul 2020 18:04:26 +0000 (20:04 +0200)]
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>
3 years agoavformat/au: Remove redundant av_freep()
Andreas Rheinhardt [Mon, 13 Jul 2020 15:18:48 +0000 (17:18 +0200)]
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>
3 years agoavformat/au: Store strings instead of pointers to strings in array
Andreas Rheinhardt [Mon, 13 Jul 2020 15:13:51 +0000 (17:13 +0200)]
avformat/au: Store strings instead of pointers to strings in array

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_bilateral: simplify code a little
Paul B Mahol [Fri, 17 Jul 2020 18:29:48 +0000 (20:29 +0200)]
avfilter/vf_bilateral: simplify code a little

Make alpha_ calculation faster.

3 years agoavcodec/libaomenc: use pix_fmt descriptors where useful
James Almer [Fri, 17 Jul 2020 20:46:32 +0000 (17:46 -0300)]
avcodec/libaomenc: use pix_fmt descriptors where useful

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolibaomenc: enable 8, 10 and 12 bit RGB encoding
Lynne [Thu, 16 Jul 2020 10:39:05 +0000 (11:39 +0100)]
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.

3 years agoMAINTAINERS: add myself and gpg fingerprint
Zane van Iperen [Tue, 7 Jul 2020 15:26:38 +0000 (15:26 +0000)]
MAINTAINERS: add myself and gpg fingerprint

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/libx264: call x264_param_cleanup() if available
James Almer [Fri, 10 Jul 2020 20:47:57 +0000 (17:47 -0300)]
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>
3 years agoavcodec/libx264: check for param allocation failure error code
James Almer [Fri, 10 Jul 2020 20:16:49 +0000 (17:16 -0300)]
avcodec/libx264: check for param allocation failure error code

And return the proper AVERROR value.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libx264: use a function to parse x264opts
James Almer [Fri, 10 Jul 2020 20:10:33 +0000 (17:10 -0300)]
avcodec/libx264: use a function to parse x264opts

This is needed for the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/avf_showwavespic: add filter mode
Paul B Mahol [Fri, 17 Jul 2020 12:25:13 +0000 (14:25 +0200)]
avfilter/avf_showwavespic: add filter mode

3 years agoavfilter/vf_tinterlace: fix mergex2, first frame is always considered odd
Paul B Mahol [Sat, 11 Jul 2020 11:20:45 +0000 (13:20 +0200)]
avfilter/vf_tinterlace: fix mergex2, first frame is always considered odd

3 years agoavfilter/vf_tinterlace: use frame counter from lavfi
Paul B Mahol [Sat, 11 Jul 2020 11:20:02 +0000 (13:20 +0200)]
avfilter/vf_tinterlace: use frame counter from lavfi

Remove internal counter.

3 years agoavfilter/vf_bilateral: remove useless memcpy
leozhang [Wed, 30 Oct 2019 03:07:12 +0000 (11:07 +0800)]
avfilter/vf_bilateral: remove useless memcpy

Signed-off-by: leozhang <leozhang@qiyi.com>
3 years agoavfilter/vf_bilateral: stop using sigmaS as percent of width/height
Paul B Mahol [Fri, 17 Jul 2020 11:45:16 +0000 (13:45 +0200)]
avfilter/vf_bilateral: stop using sigmaS as percent of width/height

3 years agoRevert "avcodec/cbs_av1: keep separate reference frame state for reading and writing"
James Almer [Wed, 8 Jul 2020 01:29:49 +0000 (22:29 -0300)]
Revert "avcodec/cbs_av1: keep separate reference frame state for reading and writing"

This reverts commit 4e2bef6a82b356772a5919c51c9be1530268bd79.
It's no longer needed now that all the bsfs use separate contexts
for reading and writing.

3 years agoavcodec/av1_frame_merge_bsf: Use separate contexts for reading/writing
James Almer [Wed, 8 Jul 2020 01:29:47 +0000 (22:29 -0300)]
avcodec/av1_frame_merge_bsf: Use separate contexts for reading/writing

Based on code from 235a5734e0

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1_metadata_bsf: Use separate contexts for reading/writing
James Almer [Wed, 8 Jul 2020 01:29:46 +0000 (22:29 -0300)]
avcodec/av1_metadata_bsf: Use separate contexts for reading/writing

Based on code from 235a5734e0

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolibavcodec/jpeg2000 Fix RPCL Progression order check
Gautam Ramakrishnan [Tue, 14 Jul 2020 16:43:15 +0000 (22:13 +0530)]
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>
3 years agoavformat/mov: fix atom type to string conversion
Zhao Zhili [Sat, 11 Jul 2020 16:26:58 +0000 (00:26 +0800)]
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>
3 years agoswscale/tests/swscale: use 1 for indicating erros
Michael Niedermayer [Thu, 16 Jul 2020 07:27:28 +0000 (09:27 +0200)]
swscale/tests/swscale: use 1 for indicating erros

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/v4l2_m2m_dec: remove redundant packet and fix double free
Andriy Gelman [Thu, 16 Jul 2020 14:52:12 +0000 (10:52 -0400)]
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>
3 years agolibavcodec/jpeg2000 Fix PCRL Progression Order check
Gautam Ramakrishnan [Tue, 14 Jul 2020 16:43:14 +0000 (22:13 +0530)]
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>
3 years agoavformat/riffenc: indicate storage of flipped RGB bitmaps
Gyan Doshi [Wed, 8 Jul 2020 12:02:25 +0000 (17:32 +0530)]
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.

3 years agoavdevice/decklink_dec: export timecode with s12m side data
Limin Wang [Sat, 11 Jul 2020 22:29:10 +0000 (06:29 +0800)]
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>
3 years agoAPI: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType
Limin Wang [Tue, 30 Jun 2020 15:18:17 +0000 (23:18 +0800)]
API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavutil/timecode: add description for SMPTE binary format
Limin Wang [Tue, 30 Jun 2020 15:22:58 +0000 (23:22 +0800)]
avutil/timecode: add description for SMPTE binary format

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agolibavcodec/jpeg2000dec : Prevent overriding SOP marker bit
Gautam Ramakrishnan [Tue, 14 Jul 2020 16:43:13 +0000 (22:13 +0530)]
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>
3 years agoswscale/tests/swscale: Initialize res to a non random error code
Michael Niedermayer [Sat, 11 Jul 2020 21:57:41 +0000 (23:57 +0200)]
swscale/tests/swscale: Initialize res to a non random error code

Regression since: 3adffab073bc59af39dddd035168ac72bc9ffde3

-1 is consistent what other error paths return

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoswscale/tests/swscale: Fix incorrect return code check
Michael Niedermayer [Sat, 11 Jul 2020 21:35:00 +0000 (23:35 +0200)]
swscale/tests/swscale: Fix incorrect return code check

Regression since: 3adffab073bc59af39dddd035168ac72bc9ffde3

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agox86/yuv2rgb: fix crashes when storing data on unaligned buffers
James Almer [Mon, 13 Jul 2020 00:32:01 +0000 (21:32 -0300)]
x86/yuv2rgb: fix crashes when storing data on unaligned buffers

Regression since fc6a5883d6af8cae0e96af84dda0ad74b360a084 on SSSE3 enabled
CPUs.

Fixes ticket #8747

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agomailmap: add entry for myself
Ruiling Song [Mon, 13 Jul 2020 01:37:37 +0000 (09:37 +0800)]
mailmap: add entry for myself

Signed-off-by: Ruiling Song <ruiling.song83@gmail.com>
3 years agoavutil/hwcontext_vdpau: Correctly initialise pixfmts
Philip Langdale [Sun, 12 Jul 2020 03:23:03 +0000 (20:23 -0700)]
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.

3 years agoavformat/mov: fix missing line break in messages
Moritz Barsnick [Thu, 25 Jun 2020 10:40:45 +0000 (12:40 +0200)]
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>
3 years agocheckasm/vf_blend: use the correct depth parameters to initialize the blend modes
James Almer [Sat, 11 Jul 2020 23:55:32 +0000 (20:55 -0300)]
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>
3 years agox86/vf_blend: fix warnings about trailing empty parameters
James Almer [Sat, 11 Jul 2020 13:04:23 +0000 (10:04 -0300)]
x86/vf_blend: fix warnings about trailing empty parameters

Finishes fixing ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agox86/h264_deblock: fix warning about trailing empty parameter
James Almer [Thu, 9 Jul 2020 14:48:12 +0000 (11:48 -0300)]
x86/h264_deblock: fix warning about trailing empty parameter

Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavutil/x86inc: fix warnings when assembling with Nasm 2.15
Henrik Gramner [Thu, 9 Jul 2020 14:47:35 +0000 (11:47 -0300)]
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>
3 years agolavf/udp: fix the comments for default UDP socket recvbuf size
Jun Zhao [Sat, 11 Jul 2020 11:09:36 +0000 (19:09 +0800)]
lavf/udp: fix the comments for default UDP socket recvbuf size

15d160cc0b2 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>
3 years agolavfi/setpts: fix setpts/asetpts option dump error
Jun Zhao [Sat, 13 Jun 2020 06:26:39 +0000 (14:26 +0800)]
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>
3 years agolibavfilter/glslang: Remove unused header
Ben Clayton [Fri, 10 Jul 2020 15:53:12 +0000 (16:53 +0100)]
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

3 years agoavfilter/vf_chromanr: move thres calculation to filter_frame()
Paul B Mahol [Fri, 10 Jul 2020 21:04:49 +0000 (23:04 +0200)]
avfilter/vf_chromanr: move thres calculation to filter_frame()

3 years agoavformat/sdp: Fix potential write beyond end of buffer
Andreas Rheinhardt [Tue, 7 Jul 2020 19:50:33 +0000 (21:50 +0200)]
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>
3 years agoavformat/mm: Check for existence of audio stream
Andreas Rheinhardt [Thu, 9 Jul 2020 10:07:28 +0000 (12:07 +0200)]
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>
3 years agoavcodec/tiff: Check input space in dng_decode_jpeg()
Michael Niedermayer [Fri, 10 Jul 2020 15:14:43 +0000 (17:14 +0200)]
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>
3 years agoavcodec/mjpeg_parser: Adjust size rejection threshold
Michael Niedermayer [Thu, 9 Jul 2020 22:31:16 +0000 (00:31 +0200)]
avcodec/mjpeg_parser: Adjust size rejection threshold

Fixes: 86987846-429c8d80-c197-11ea-916b-bb4738e09687.jpg
Fixes: Regression since ec3d8a0e6945fe015d16cd98a1e7dbb4be815c15
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cbs_jpeg: Fix uninitialized end index in cbs_jpeg_split_fragment()
Michael Niedermayer [Fri, 10 Jul 2020 17:37:57 +0000 (19:37 +0200)]
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>
3 years agoavcodec/hevcdec: Add VDPAU to list of supported formats
ManojGuptaBonda [Sat, 27 Jun 2020 13:34:22 +0000 (19:04 +0530)]
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>
3 years agolavc/vdpau_hevc: add function to find exact vdp_profile for REXT
ManojGuptaBonda [Sat, 27 Jun 2020 13:34:21 +0000 (19:04 +0530)]
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>
3 years agoavcodec/mpeg12dec: add timecode metadata
Limin Wang [Sat, 20 Jun 2020 15:09:09 +0000 (23:09 +0800)]
avcodec/mpeg12dec: add timecode metadata

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/h264_slice: add timecode metadata
Limin Wang [Sat, 20 Jun 2020 13:09:09 +0000 (21:09 +0800)]
avcodec/h264_slice: add timecode metadata

Please test with below command:
./ffplay -vf drawtext="fontfile=/Library/Fonts/Arial.ttf:text=\\'%{metadata\\:timecode}\\'" \
                       ../fate-suite/h264/crew_cif_timecode-2.h264

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/h264_slice: replace cur->f with out for better readability
Limin Wang [Sat, 20 Jun 2020 12:08:06 +0000 (20:08 +0800)]
avcodec/h264_slice: replace cur->f with out for better readability

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/hevcdec: add timecode metadata
Limin Wang [Sat, 20 Jun 2020 11:34:47 +0000 (19:34 +0800)]
avcodec/hevcdec: add timecode metadata

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoswscale/tests: check return value of sws_scale
Lynne [Tue, 7 Jul 2020 21:19:14 +0000 (22:19 +0100)]
swscale/tests: check return value of sws_scale

3 years agoaarch64/yuv2rgb_neon: fix return value
Lynne [Tue, 7 Jul 2020 15:01:58 +0000 (16:01 +0100)]
aarch64/yuv2rgb_neon: fix return value

We return 0 for this particular architecture but should instead be
returning the number of lines.
Fixes users who check the return value matches what they expect.

3 years agolibavformat/dashenc.c: Support mpd update period
Siyuan Huang [Tue, 30 Jun 2020 05:41:46 +0000 (13:41 +0800)]
libavformat/dashenc.c: Support mpd update period

According ISO 23009-1, in live cases, mpd refresh period should be configurable

Signed-off-by: Siyuan Huang <saber.huang@samsung.com>
3 years agotests/dnn/mathunary: fix the issue of NAN
Ting Fu [Wed, 8 Jul 2020 06:09:51 +0000 (14:09 +0800)]
tests/dnn/mathunary: fix the issue of NAN

When one of output[i] & expected_output is NAN, the unit test will always pass.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
3 years agoavcodec/libaomenc: fix build w/libaom v1.0.0
James Zern [Thu, 2 Jul 2020 02:53:54 +0000 (19:53 -0700)]
avcodec/libaomenc: fix build w/libaom v1.0.0

broken since:
aa5c6f382b avcodec/libaomenc: Add command-line options to control the use of partition tools

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
3 years agoavfilter/vf_showinfo: add dump_s12m_timecode() helper function
Limin Wang [Sat, 4 Jul 2020 12:32:59 +0000 (20:32 +0800)]
avfilter/vf_showinfo: add dump_s12m_timecode() helper function

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/vf_showinfo: check sd->size before reference the sd->data
Limin Wang [Sat, 4 Jul 2020 12:32:58 +0000 (20:32 +0800)]
avfilter/vf_showinfo: check sd->size before reference the sd->data

Or it'll cause null pointer dereference if size < sizeof(uint32_t), also
in case tc[0] > 3, the code will report error directly.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED
Limin Wang [Fri, 26 Jun 2020 00:47:26 +0000 (08:47 +0800)]
avformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/dvbsubdec: Cosmetics
Limin Wang [Fri, 26 Jun 2020 13:33:37 +0000 (21:33 +0800)]
avcodec/dvbsubdec: Cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/dvbsubdec: prefer to use variable instead of type for sizeof
Limin Wang [Fri, 26 Jun 2020 00:47:22 +0000 (08:47 +0800)]
avcodec/dvbsubdec: prefer to use variable instead of type for sizeof

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/dvbsubdec: simplify code by using OFFSET() macro
Limin Wang [Fri, 26 Jun 2020 00:47:21 +0000 (08:47 +0800)]
avcodec/dvbsubdec: simplify code by using OFFSET() macro

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter: add chromanr video filter
Paul B Mahol [Fri, 16 Nov 2018 09:13:41 +0000 (10:13 +0100)]
avfilter: add chromanr video filter

3 years agoavformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default
Zhao Zhili [Sat, 4 Jul 2020 16:51:53 +0000 (00:51 +0800)]
avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/apedec: Fix undefined integer overflow with 24bit
Michael Niedermayer [Tue, 30 Jun 2020 20:01:22 +0000 (22:01 +0200)]
avcodec/apedec: Fix undefined integer overflow with 24bit

Fixes: signed integer overflow: 8683744 * 256 cannot be represented in type 'int'
Fixes: 23527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5679885932822528
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/loco: Fix integer overflow with large values from loco_get_rice()
Michael Niedermayer [Tue, 30 Jun 2020 19:11:25 +0000 (21:11 +0200)]
avcodec/loco: Fix integer overflow with large values from loco_get_rice()

Fixes: signed integer overflow: 155 + 2147483647 cannot be represented in type 'int'
Fixes: 23421/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5652849097965568
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/smjpegdec: Check the existence of referred streams
Michael Niedermayer [Mon, 6 Jul 2020 18:18:42 +0000 (20:18 +0200)]
avformat/smjpegdec: Check the existence of referred streams

Fixes: Assertion failure
Fixes: 23758/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5160954605338624.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agopthread_frame: change the criterium for updating thread contexts
Anton Khirnov [Tue, 9 Jun 2020 11:08:49 +0000 (13:08 +0200)]
pthread_frame: change the criterium for updating thread contexts

Currently the next thread's context is updated from the previous one's
if the codec descriptor is not marked as intra-only. That is not
entirely correct, since that property does not necessarily imply
anything about how a specific decoder implementation behaves.

Instead, use the presence of the update_thread_context() callback to
decide whether an update should be performed. Fixes races in CFHD,
should cause no behaviour change in any other decoders.

3 years agocodec_desc: drop the INTRA_ONLY property from TAK
Anton Khirnov [Tue, 9 Jun 2020 10:41:09 +0000 (12:41 +0200)]
codec_desc: drop the INTRA_ONLY property from TAK

It has key frames and non-key frames, so it is not intra-only.

3 years agotests/fate/hlsenc: add testcase of ac3 surround sound input in hlsenc
Steven Liu [Mon, 15 Jun 2020 12:37:41 +0000 (20:37 +0800)]
tests/fate/hlsenc: add testcase of ac3 surround sound input in hlsenc

add probeaudiostream for get audio stream's codec_name,codec_time_base,
sample_fmt,channels and channel_layout.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 years agoavformat/hlsenc: check fragment size plus start_pos large than hls_segment_size
Steven Liu [Mon, 15 Jun 2020 12:37:40 +0000 (20:37 +0800)]
avformat/hlsenc: check fragment size plus start_pos large than hls_segment_size

if vs->size + vs->start_pos > hls->max_seg_size, should split segment.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
3 years agoavfilter/vf_edgedetect: properly implement double_threshold()
Valery Kot [Mon, 22 Jun 2020 15:29:21 +0000 (17:29 +0200)]
avfilter/vf_edgedetect: properly implement double_threshold()

Important part of this algorithm is the double threshold step: pixels
above "high" threshold being kept, pixels below "low" threshold dropped,
pixels in between (weak edges) are kept if they are neighboring "high"
pixels.

The weak edge check uses a neighboring context and should not be applied
on the plane's border. The condition was incorrect and has been fixed in
the commit.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavcodec/h26[45]_metadata_bsf: Use separate contexts for reading/writing
Andreas Rheinhardt [Sun, 5 Jul 2020 22:46:40 +0000 (00:46 +0200)]
avcodec/h26[45]_metadata_bsf: Use separate contexts for reading/writing

Currently, both bsfs used the same CodedBitstreamContext for reading and
writing; as a consequence, the state of the writer's context at the
beginning of writing a fragment is exactly the state of the reader after
having read the fragment; in particular, the writer might not have
encountered one of its active parameter sets yet.

This is not nice and may lead to invalid output even when the input
is completely spec-compliant: Think of an access unit containing
a primary coded picture referencing a PPS with id id (that is known from
an earlier access unit/from extradata), then a new version of the PPS
with id id and then a redundant coded picture that is also referencing
the PPS with id id. This is spec-compliant, as the standard allows to
overwrite a PPS with a different PPS in between coded pictures and not
only at the beginning of an access unit. In this scenario, the reader
would read the primary coded picture with the old PPS and the redundant
coded picture with the new PPS (as it should); yet the writer would
write both with the new PPS as extradata which might lead to errors or
to invalid data being output without any error (e.g. if the two PPS
differed in redundant_pic_cnt_present_flag).

The above scenario does not directly translate to HEVC as long as one
restricts oneself to input with nuh_layer_id == 0 only (as cbs_h265
does: it currently strips away any NAL unit with nuh_layer_id > 0 when
decomposing); if one doesn't the same issue as above can happen.

If one also allowed input packets to contain more than one access unit,
issues like the above can happen even without redundant coded
pictures/multiple layers.

Therefore this commit uses separate contexts for reader and writer.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/cbs: Remove unused function parameters
Andreas Rheinhardt [Sun, 5 Jul 2020 22:34:25 +0000 (00:34 +0200)]
avcodec/cbs: Remove unused function parameters

Several cbs-functions had an unused CodedBitstreamContext parameter.
This commit removes these.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoSpeedhq: Decode field 2 correctly
Jean-Baptiste Kempf [Sun, 10 May 2020 16:09:51 +0000 (18:09 +0200)]
Speedhq: Decode field 2 correctly

This is similar to field 1 (effd2e72)

3 years agoavcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATA
Oliver Woodman [Fri, 8 May 2020 02:09:29 +0000 (03:09 +0100)]
avcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATA

Commit 601c238854 added support for AV_PKT_DATA_NEW_EXTRADATA, but
only for avcC extradata.
This commit adds support for sps/pps extradata as well. This makes
support consistent for passing new extradata consistent with the
types of extradata that can be passed when initializing the decoder.

Signed-off-by: Oliver Woodman <ollywoodman@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodnn_backend_native: Add overflow check for length calculation.
Reimar Döffinger [Mon, 6 Jul 2020 07:32:17 +0000 (09:32 +0200)]
dnn_backend_native: Add overflow check for length calculation.

We should not silently allocate an incorrect sized buffer.
Fixes trac issue #8718.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
3 years agolibavformat/hlsenc: Remove duplicate close of the output stream.
Andrey Semashev [Wed, 1 Jul 2020 14:59:01 +0000 (17:59 +0300)]
libavformat/hlsenc: Remove duplicate close of the output stream.

The result of the first close attempt is ignored and may be lost. By removing
it we ensure the close result code is properly analyzed.

3 years agodnn-layer-math-unary-test: add unit test for atanh
Ting Fu [Mon, 29 Jun 2020 14:54:11 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for atanh

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn_backend_native_layer_mathunary: add atanh support
Ting Fu [Mon, 29 Jun 2020 14:54:10 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add atanh support

It can be tested with the model generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')

please uncomment the part you want to test

x_sinh_1 = tf.sinh(x)
x_out = tf.divide(x_sinh_1, 1.176) # sinh(1.0)

x_cosh_1 = tf.cosh(x)
x_out = tf.divide(x_cosh_1, 1.55) # cosh(1.0)

x_tanh_1 = tf.tanh(x)
x__out = tf.divide(x_tanh_1, 0.77) # tanh(1.0)

x_asinh_1 = tf.asinh(x)
x_out = tf.divide(x_asinh_1, 0.89) # asinh(1.0/1.1)

x_acosh_1 = tf.add(x, 1.1)
x_acosh_2 = tf.acosh(x_acosh_1) # accept (1, inf)
x_out = tf.divide(x_acosh_2, 1.4) # acosh(2.1)

x_atanh_1 = tf.divide(x, 1.1)
x_atanh_2 = tf.atanh(x_atanh_1) # accept (-1, 1)
x_out = tf.divide(x_atanh_2, 1.55) # atanhh(1.0/1.1)

y = tf.identity(x_out, name='dnn_out') #please only preserve the x_out you want to test

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn-layer-math-unary-test: add unit test for acosh
Ting Fu [Mon, 29 Jun 2020 14:54:09 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for acosh

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn_backend_native_layer_mathunary: add acosh support
Ting Fu [Mon, 29 Jun 2020 14:54:08 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add acosh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn-layer-math-unary-test: add unit test for asinh
Ting Fu [Mon, 29 Jun 2020 14:54:07 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for asinh

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn_backend_native_layer_mathunary: add asinh support
Ting Fu [Mon, 29 Jun 2020 14:54:06 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add asinh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn-layer-math-unary-test: add unit test for tanh
Ting Fu [Mon, 29 Jun 2020 14:54:05 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for tanh

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn_backend_native_layer_mathunary: add tanh support
Ting Fu [Mon, 29 Jun 2020 14:54:04 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add tanh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn-layer-math-unary-test: add unit test for cosh
Ting Fu [Mon, 29 Jun 2020 14:54:03 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for cosh

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn_backend_native_layer_mathunary: add cosh support
Ting Fu [Mon, 29 Jun 2020 14:54:02 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add cosh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn-layer-math-unary-test: add unit test for sinh
Ting Fu [Mon, 29 Jun 2020 14:54:01 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for sinh

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn_backend_native_layer_mathunary: add sinh support
Ting Fu [Mon, 29 Jun 2020 14:54:00 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add sinh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agolibavcodec/jpeg2000dec.c: Enable image offsets
Gautam Ramakrishnan [Sat, 4 Jul 2020 19:03:09 +0000 (00:33 +0530)]
libavcodec/jpeg2000dec.c: Enable image offsets

This patch enables support for image offsets.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/jpeg2000dec: Enhance pix fmt selection
Gautam Ramakrishnan [Sat, 4 Jul 2020 19:03:08 +0000 (00:33 +0530)]
libavcodec/jpeg2000dec: Enhance pix fmt selection

This patch assigns default pix format values when
a match does not take place.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/tiff: Check frame parameters before blit for DNG
Michael Niedermayer [Sat, 4 Jul 2020 12:17:05 +0000 (14:17 +0200)]
avcodec/tiff: Check frame parameters before blit for DNG

Fixes: out of array access
Fixes: 23888/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6021365974171648.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mjpegdec: Limit bayer to single plane outputting format
Michael Niedermayer [Sat, 4 Jul 2020 12:15:01 +0000 (14:15 +0200)]
avcodec/mjpegdec: Limit bayer to single plane outputting format

This reduces the number of paths reachable with DNG and should
improve security

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/pnmdec: Fix misaligned reads
Michael Niedermayer [Fri, 3 Jul 2020 21:55:50 +0000 (23:55 +0200)]
avcodec/pnmdec: Fix misaligned reads

Found-by: "Steinar H. Gunderson" <steinar+ffmpeg@gunderson.no>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>