ffmpeg.git
7 weeks agoswscale: make yuv2interleavedX more asm-friendly
Nelson Gomez [Sun, 26 Apr 2020 02:37:01 +0000 (19:37 -0700)]
swscale: make yuv2interleavedX more asm-friendly

Extracting information from SwsContext in assembly is difficult, and
rearranging SwsContext just for asm access didn't look good. These
functions only need a couple of fields from it anyway, so just make
them parameters in their own right.

Signed-off-by: Nelson Gomez <nelson.gomez@microsoft.com>
7 weeks agoavcodec/smvjpegdec: remove uninitialized ret
Limin Wang [Fri, 12 Jun 2020 23:50:22 +0000 (07:50 +0800)]
avcodec/smvjpegdec: remove uninitialized ret

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/mpegvideo: remove extra space
Limin Wang [Fri, 12 Jun 2020 23:47:13 +0000 (07:47 +0800)]
avcodec/mpegvideo: remove extra space

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoswscale/utils: return better error code from initFilter()
Limin Wang [Sat, 13 Jun 2020 05:52:20 +0000 (13:52 +0800)]
swscale/utils: return better error code from initFilter()

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoswscale/utils: reindent
Limin Wang [Fri, 12 Jun 2020 23:29:43 +0000 (07:29 +0800)]
swscale/utils: reindent

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agolavf/prompeg: prompeg_write() must report data all was written
David Holroyd [Tue, 9 Jun 2020 13:37:10 +0000 (21:37 +0800)]
lavf/prompeg: prompeg_write() must report data all was written

Previously, prompeg_write() would only report to caller that bytes we
written when a FEC packet was actually created.  Not all RTP packets are
expected to generate a FEC packet however, so this behavior was causing
avio to retry writing the RTP packet, eventually forcing the FEC state
machine to send a FEC packet erroneously (and so breaking out of the
retry loop).

This was resulting in incorrect FEC data being generated, and far too
many FEC packets to be sent (~100% FEC overhead).

fix #7863

Signed-off-by: David Holroyd <david.holroyd@m2amedia.tv>
7 weeks agolavu/internal: Fix comment for avpriv_dict_set_timestamp
Jun Zhao [Sat, 6 Jun 2020 09:04:58 +0000 (17:04 +0800)]
lavu/internal: Fix comment for avpriv_dict_set_timestamp

Fix comment for avpriv_dict_set_timestamp from b72a7b96f84

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
7 weeks agolavc/qsv: fix make checkheaders warning
Jun Zhao [Sun, 31 May 2020 08:12:36 +0000 (16:12 +0800)]
lavc/qsv: fix make checkheaders warning

make checkheaders will get warning as follow:

In file included from libavcodec/qsv_internal.h.c:1:
./libavcodec/qsv_internal.h:24:5: warning: "CONFIG_VAAPI" is not defined, evaluates to 0 [-Wundef]
   24 | #if CONFIG_VAAPI
      |     ^~~~~~~~~~~~

include "config.h" to fix the warning

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
7 weeks agoavformat/sccdec: move pos variables outside of loop
Paul B Mahol [Sat, 13 Jun 2020 10:23:29 +0000 (12:23 +0200)]
avformat/sccdec: move pos variables outside of loop

Ensures that sub->pos is always correct.

7 weeks agoavcodec/ccaption_dec: switch active screen in end of caption early
Paul B Mahol [Sat, 13 Jun 2020 09:57:33 +0000 (11:57 +0200)]
avcodec/ccaption_dec: switch active screen in end of caption early

Fixes dropping of last caption.

7 weeks agoavcodec/ccaption_dec: remove unused arguments from function
Paul B Mahol [Sat, 13 Jun 2020 09:48:43 +0000 (11:48 +0200)]
avcodec/ccaption_dec: remove unused arguments from function

7 weeks agoavcodec/ccaption_dec: check for error codes
Paul B Mahol [Sat, 13 Jun 2020 09:41:53 +0000 (11:41 +0200)]
avcodec/ccaption_dec: check for error codes

7 weeks agoavutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros
Limin Wang [Tue, 2 Jun 2020 11:18:32 +0000 (19:18 +0800)]
avutil/internal: remove FF_ALLOCx{_ARRAY}_OR_GOTO macros

These functions have a terrible design, let us fix them before extending
them.
First design mistake: no error code. A helper function for testing
memory allocation failure where AVERROR(ENOMEM) does not appear is
absurd.

Second design mistake: printing a message. Return the error code, let
the caller print the error message.

Third design mistake: hard-coded use of goto.

http://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/262544.html

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoswscale/utils: remove FF_ALLOC_ARRAY_OR_GOTO macros
Limin Wang [Tue, 2 Jun 2020 13:54:21 +0000 (21:54 +0800)]
swscale/utils: remove FF_ALLOC_ARRAY_OR_GOTO macros

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/alac: remove FF_ALLOC_OR_GOTO and gotos label
Limin Wang [Fri, 29 May 2020 14:38:31 +0000 (22:38 +0800)]
avcodec/alac: remove FF_ALLOC_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/mpegvideo_enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable
Limin Wang [Tue, 2 Jun 2020 15:59:15 +0000 (23:59 +0800)]
avcodec/mpegvideo_enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/mpegpicture: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Tue, 2 Jun 2020 15:49:28 +0000 (23:49 +0800)]
avcodec/mpegpicture: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/mpegvideo: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Tue, 2 Jun 2020 15:42:30 +0000 (23:42 +0800)]
avcodec/mpegvideo: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/mpegvideo: simplify check for av_frame_alloc
Limin Wang [Tue, 2 Jun 2020 15:36:54 +0000 (23:36 +0800)]
avcodec/mpegvideo: simplify check for av_frame_alloc

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/iirfilter: remove FF_ALLOCZ_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 15:13:32 +0000 (23:13 +0800)]
avcodec/iirfilter: remove FF_ALLOCZ_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/aacenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 14:48:28 +0000 (22:48 +0800)]
avcodec/aacenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/ac3enc_template: remove FF_ALLOC_ARRAY_OR_GOTO and gotos label
Limin Wang [Fri, 29 May 2020 14:05:46 +0000 (22:05 +0800)]
avcodec/ac3enc_template: remove FF_ALLOC_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/ac3enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 16:06:55 +0000 (00:06 +0800)]
avcodec/ac3enc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/snow: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 13:49:44 +0000 (21:49 +0800)]
avcodec/snow: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/dnxhdenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 13:49:12 +0000 (21:49 +0800)]
avcodec/dnxhdenc: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/twinvq: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Limin Wang [Mon, 1 Jun 2020 14:23:57 +0000 (22:23 +0800)]
avcodec/twinvq: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/apedec: remove FF_ALLOC_OR_GOTO and gotos lable
Limin Wang [Mon, 1 Jun 2020 13:26:53 +0000 (21:26 +0800)]
avcodec/apedec: remove FF_ALLOC_OR_GOTO and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()
Limin Wang [Wed, 3 Jun 2020 13:53:11 +0000 (21:53 +0800)]
avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/alac: Add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Fri, 29 May 2020 13:08:58 +0000 (21:08 +0800)]
avcodec/alac: Add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/aacenc: add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Mon, 1 Jun 2020 14:29:13 +0000 (22:29 +0800)]
avcodec/aacenc: add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/ac3enc: add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Mon, 1 Jun 2020 14:06:46 +0000 (22:06 +0800)]
avcodec/ac3enc: add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/apedec: add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Thu, 28 May 2020 15:53:46 +0000 (23:53 +0800)]
avcodec/apedec: add FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/adpcmenc: remove FF_ALLOC_OR_GOTO macros and gotos lable
Limin Wang [Thu, 28 May 2020 15:43:41 +0000 (23:43 +0800)]
avcodec/adpcmenc: remove FF_ALLOC_OR_GOTO macros and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/h264dec: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable
Limin Wang [Thu, 28 May 2020 15:33:04 +0000 (23:33 +0800)]
avcodec/h264dec: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos lable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/h264dec: store count of the tables into const variable for long lines
Limin Wang [Thu, 28 May 2020 15:13:45 +0000 (23:13 +0800)]
avcodec/h264dec: store count of the tables into const variable for long lines

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/h264dec: cosmetics
Limin Wang [Wed, 27 May 2020 15:04:29 +0000 (23:04 +0800)]
avcodec/h264dec: cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavcodec/wmalosslessdec: Check block_align maximum
Michael Niedermayer [Tue, 9 Jun 2020 20:11:23 +0000 (22:11 +0200)]
avcodec/wmalosslessdec: Check block_align maximum

Fixes: Assertion failure
Fixes: 22737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5958388889681920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/loco: Fix signed integer overflow in loco_get_rice()
Michael Niedermayer [Tue, 9 Jun 2020 20:14:59 +0000 (22:14 +0200)]
avcodec/loco: Fix signed integer overflow in loco_get_rice()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 22975/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5658160970072064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavformat/thp: Check fps
Michael Niedermayer [Mon, 8 Jun 2020 07:28:55 +0000 (09:28 +0200)]
avformat/thp: Check fps

Fixes: division by zero
Fixes: 23162/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4856420817436672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavformat/mpl2dec: Fix integer overflow with duration
Michael Niedermayer [Mon, 8 Jun 2020 07:47:41 +0000 (09:47 +0200)]
avformat/mpl2dec: Fix integer overflow with duration

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 23167/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6425051741290496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/cbs: Allocate more CodedBitstreamUnit at once in cbs_insert_unit()
Michael Niedermayer [Fri, 10 Apr 2020 20:05:07 +0000 (22:05 +0200)]
avcodec/cbs: Allocate more CodedBitstreamUnit at once in cbs_insert_unit()

Fixes: Timeout (85sec -> 0.5sec)
Fixes: 20791/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_FRAME_SPLIT_fuzzer-5659537719951360
Fixes: 21214/clusterfuzz-testcase-minimized-ffmpeg_BSF_MPEG2_METADATA_fuzzer-5165560875974656
Fixes: 21247/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-5715175257931776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavformat/mov: Check if DTS is AV_NOPTS_VALUE in mov_find_next_sample().
Dale Curtis [Thu, 14 May 2020 21:38:07 +0000 (14:38 -0700)]
avformat/mov: Check if DTS is AV_NOPTS_VALUE in mov_find_next_sample().

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavfilter/vf_vaguedenoiser: fix small typo in option explanation
Paul B Mahol [Fri, 12 Jun 2020 22:41:16 +0000 (00:41 +0200)]
avfilter/vf_vaguedenoiser: fix small typo in option explanation

7 weeks agoavfilter/af_rubberband: adjust nb_samples after every command
Paul B Mahol [Fri, 12 Jun 2020 10:57:43 +0000 (12:57 +0200)]
avfilter/af_rubberband: adjust nb_samples after every command

7 weeks agoavformat/sccdec: split line with multiple subs
Paul B Mahol [Fri, 12 Jun 2020 18:03:42 +0000 (20:03 +0200)]
avformat/sccdec: split line with multiple subs

7 weeks agodoc/APIchanges: add new AV_PIX_FMT_X2RGB10
Lynne [Fri, 12 Jun 2020 16:48:28 +0000 (17:48 +0100)]
doc/APIchanges: add new AV_PIX_FMT_X2RGB10

7 weeks agolavu/hwcontext_vaapi: add vaapi_format_map support for x2rgb10
Fei Wang [Wed, 22 Apr 2020 05:23:03 +0000 (13:23 +0800)]
lavu/hwcontext_vaapi: add vaapi_format_map support for x2rgb10

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
7 weeks agoswscale: Add swscale input/output support for X2RGB10LE
Fei Wang [Wed, 22 Apr 2020 05:23:02 +0000 (13:23 +0800)]
swscale: Add swscale input/output support for X2RGB10LE

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
7 weeks agolavu/pix_fmt: add new pixel format x2rgb10
Fei Wang [Wed, 22 Apr 2020 05:23:01 +0000 (13:23 +0800)]
lavu/pix_fmt: add new pixel format x2rgb10

The format is packed RGB with each channel 10 bits available and
include 2 bits unused.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
7 weeks agomailmap: add entry for myself
Steven Liu [Fri, 12 Jun 2020 06:30:02 +0000 (14:30 +0800)]
mailmap: add entry for myself

7 weeks agotools/target_dec_fuzzer: Adjust threshold for lagarith
Michael Niedermayer [Sun, 7 Jun 2020 17:08:01 +0000 (19:08 +0200)]
tools/target_dec_fuzzer: Adjust threshold for lagarith

Fixes: Timeout (3minute 49 sec -> 3sec)
Fixes: 22020/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708544679870464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/mpeg12dec: remove outdated comments
Michael Niedermayer [Sat, 6 Jun 2020 17:42:07 +0000 (19:42 +0200)]
avcodec/mpeg12dec: remove outdated comments

Found-by: Kieran
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/snowdec: Avoid integer overflow with huge qlog
Michael Niedermayer [Sat, 6 Jun 2020 15:45:39 +0000 (17:45 +0200)]
avcodec/snowdec: Avoid integer overflow with huge qlog

Fixes: integer overflow
Fixes: 22285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5682428762128384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/movtextdec: Fix shift overflows in mov_text_init()
Michael Niedermayer [Fri, 5 Jun 2020 16:22:51 +0000 (18:22 +0200)]
avcodec/movtextdec: Fix shift overflows in mov_text_init()

Fixes: left shift of 243 by 24 places cannot be represented in type 'int'
Fixes: 22716/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5704263425851392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agotools/target_dem_fuzzer: Use file extensions listed in input formats
Michael Niedermayer [Mon, 8 Jun 2020 09:26:45 +0000 (11:26 +0200)]
tools/target_dem_fuzzer: Use file extensions listed in input formats

This should make it easier for the fuzzer to fuzz formats being detected only by
file extension and thus increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type
Limin Wang [Wed, 10 Jun 2020 15:34:30 +0000 (23:34 +0800)]
avutil: add AV_FRAME_DATA_SEI_UNREGISTERED side data type

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agodnn-layer-mathunary-test: add unit test for tan
Ting Fu [Sat, 6 Jun 2020 12:12:51 +0000 (20:12 +0800)]
dnn-layer-mathunary-test: add unit test for tan

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
7 weeks agodnn_backend_native_layer_mathunary: add tan support
Ting Fu [Sat, 6 Jun 2020 12:12:50 +0000 (20:12 +0800)]
dnn_backend_native_layer_mathunary: add tan support

It can be tested with the model generated with below python scripy

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')
x1 = tf.multiply(x, 0.78)
x2 = tf.tan(x1)
y = tf.identity(x2, name='dnn_out')

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>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
7 weeks agodnn-layer-mathunary-test: add unit test for cos
Ting Fu [Sat, 6 Jun 2020 12:12:49 +0000 (20:12 +0800)]
dnn-layer-mathunary-test: add unit test for cos

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
7 weeks agodnn_backend_native_layer_mathunary: add cos support
Ting Fu [Sat, 6 Jun 2020 12:12:48 +0000 (20:12 +0800)]
dnn_backend_native_layer_mathunary: add cos support

It can be tested with the model generated with below python scripy

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')
x1 = tf.multiply(x, 1.5)
x2 = tf.cos(x1)
y = tf.identity(x2, name='dnn_out')

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>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
7 weeks agodnn-layer-mathunary-test: add unit test for sin
Ting Fu [Sat, 6 Jun 2020 12:12:47 +0000 (20:12 +0800)]
dnn-layer-mathunary-test: add unit test for sin

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
7 weeks agodnn_backend_native_layer_mathunary: add sin support
Ting Fu [Sat, 6 Jun 2020 12:12:46 +0000 (20:12 +0800)]
dnn_backend_native_layer_mathunary: add sin support

It can be tested with the model file generated with below python scripy:

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')
x1 = tf.multiply(x, 3.14)
x2 = tf.sin(x1)
y = tf.identity(x2, name='dnn_out')

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>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
7 weeks agoavformat/aviobuf: Also return truncated buffer in avio_get_dyn_buf()
Andreas Rheinhardt [Mon, 25 May 2020 08:14:00 +0000 (10:14 +0200)]
avformat/aviobuf: Also return truncated buffer in avio_get_dyn_buf()

Two kinds of errors can happen when working with dynamic buffers:
(Re)allocation errors or truncation errors (one has to truncate the
buffer to a size of INT_MAX because avio_close_dyn_buf() and
avio_get_dyn_buf() both return an int). Right now, avio_get_dyn_buf()
returns an empty buffer in either case. But given that
avio_get_dyn_buf() does not destroy the dynamic buffer, one can return
the buffer in case of truncation and let the user check the error flags
and decide for himself instead of hardcoding a single way to proceed
in case of truncation.

(This actually restores the behaviour from before commit
163bb9ac0af495a5cb95441bdb5c02170440d28c.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoavformat/aviobuf: Return better error codes
Andreas Rheinhardt [Sun, 24 May 2020 02:36:05 +0000 (04:36 +0200)]
avformat/aviobuf: Return better error codes

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoavformat/aviobuf: Stop restricting dynamic buffer sizes to INT_MAX/2
Andreas Rheinhardt [Sun, 24 May 2020 02:04:29 +0000 (04:04 +0200)]
avformat/aviobuf: Stop restricting dynamic buffer sizes to INT_MAX/2

This has originally been done in 568e18b15e2ddf494fd8926707d34ca08c8edce5
as a precaution against integer overflows, but it is actually easy to
support the full range of int without overflows.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoavformat/aviobuf: Simplify dyn_buf_write() a bit
Andreas Rheinhardt [Sun, 24 May 2020 02:02:27 +0000 (04:02 +0200)]
avformat/aviobuf: Simplify dyn_buf_write() a bit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoavformat/aviobuf: Don't check for overflow after it happened
Andreas Rheinhardt [Sun, 24 May 2020 01:14:00 +0000 (03:14 +0200)]
avformat/aviobuf: Don't check for overflow after it happened

If adding two ints overflows, it doesn't matter whether the result will
be stored in an unsigned or not; and checking afterwards does not make it
retroactively defined.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoAVFormatContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
AVFormatContext: switch to child_class_iterate()

7 weeks agoAVIOContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
AVIOContext: switch to child_class_iterate()

7 weeks agoURLContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
URLContext: switch to child_class_iterate()

7 weeks agovf_spp: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
vf_spp: switch to child_class_iterate()

7 weeks agovf_scale: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
vf_scale: switch to child_class_iterate()

7 weeks agoframesync: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
framesync: switch to child_class_iterate()

7 weeks agoavfilter: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
avfilter: switch to child_class_iterate()

7 weeks agoaf_resample: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
af_resample: switch to child_class_iterate()

7 weeks agoaf_aresample: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
af_aresample: switch to child_class_iterate()

7 weeks agoAVCodecContext: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
AVCodecContext: switch to child_class_iterate()

7 weeks agobsf: switch to child_class_iterate()
Anton Khirnov [Wed, 27 May 2020 13:34:07 +0000 (15:34 +0200)]
bsf: switch to child_class_iterate()

7 weeks agofftools: switch to the new child class iteration API
Anton Khirnov [Wed, 27 May 2020 13:25:38 +0000 (15:25 +0200)]
fftools: switch to the new child class iteration API

7 weeks agolavu/opt: add a more general child class iteration API
Anton Khirnov [Wed, 27 May 2020 13:21:30 +0000 (15:21 +0200)]
lavu/opt: add a more general child class iteration API

Use opaque iteration state instead of the previous child class. This
mirrors similar changes done in lavf/lavc.

Deprecate the av_opt_child_class_next() API.

7 weeks agolavf/dump: schedule use of deprecated API for removal
Anton Khirnov [Wed, 27 May 2020 12:38:44 +0000 (14:38 +0200)]
lavf/dump: schedule use of deprecated API for removal

7 weeks agoRemove unnecessary use of avcodec_close().
Anton Khirnov [Wed, 27 May 2020 07:30:46 +0000 (09:30 +0200)]
Remove unnecessary use of avcodec_close().

Replace it with avcodec_free_context() or drop it completely as
appropriate.

7 weeks agoavformat/hls: check segment duration value of EXTINF
Steven Liu [Fri, 29 May 2020 03:39:05 +0000 (11:39 +0800)]
avformat/hls: check segment duration value of EXTINF

fix ticket: 8673
set the default EXTINF duration to 1ms if duration is smaller than 1ms

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
7 weeks agoavformat/hls: check output string is usable of ff_make_absolute_url
Steven Liu [Thu, 28 May 2020 02:41:26 +0000 (10:41 +0800)]
avformat/hls: check output string is usable of ff_make_absolute_url

fix ticket: 8688
should goto failed workflow if cannot get usable string by ff_make_absolute_url

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
7 weeks agoavformat/url: check return value of strchr
Steven Liu [Thu, 28 May 2020 02:41:25 +0000 (10:41 +0800)]
avformat/url: check return value of strchr

fix ticket: 8687
workflow should return if there have no value of strchr

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
7 weeks agoRELEASE: We are after the 4.3 branch point, update for that
Michael Niedermayer [Mon, 8 Jun 2020 21:18:27 +0000 (23:18 +0200)]
RELEASE: We are after the 4.3 branch point, update for that

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavcodec/snow: ensure current_picture is writable before modifying its data
James Almer [Fri, 29 May 2020 16:59:12 +0000 (13:59 -0300)]
avcodec/snow: ensure current_picture is writable before modifying its data

current_picture was not writable here because a reference existed in
at least avctx->coded_frame, and potentially elsewhere if the caller
created new ones from it.

Signed-off-by: James Almer <jamrial@gmail.com>
8 weeks agodoc/utils: document the "s", "ms" and "us" suffixes for durations
Moritz Barsnick [Mon, 8 Jun 2020 15:39:00 +0000 (17:39 +0200)]
doc/utils: document the "s", "ms" and "us" suffixes for durations

These suffixes were introduced in 61c972384d311508d07f9360d196909e27195655
and completed in 8218249f1f04de65904f58519bde21948e5a0783.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
8 weeks agodoc/ffmpeg: remove reference to deprecated option
Moritz Barsnick [Mon, 8 Jun 2020 15:09:53 +0000 (17:09 +0200)]
doc/ffmpeg: remove reference to deprecated option

The "-deinterlace" was deprecated since d7edd35, over eight years
ago.

Refer to deinterlacing filters instead.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
8 weeks agopthread_frame: change the way delay is set
Anton Khirnov [Thu, 4 Jun 2020 10:01:51 +0000 (12:01 +0200)]
pthread_frame: change the way delay is set

It is a constant known at codec init, so set it in
ff_frame_thread_init(). Also, only set it for video, since the meaning
of this field is not well-defined for audio with frame threading.

Fixes availability of delay in callbacks invoked from the per-thread
contexts after 1f4cf92cfbd3accbae582ac63126ed5570ddfd37.

8 weeks agoavformat/mpegts: add constants for MPEG-TS transport stream identifiers
Brad Hards [Mon, 8 Jun 2020 23:01:24 +0000 (01:01 +0200)]
avformat/mpegts: add constants for MPEG-TS transport stream identifiers

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
8 weeks agoavformat/fifo: add timeshift option to delay output
Marton Balint [Thu, 7 May 2020 19:49:47 +0000 (21:49 +0200)]
avformat/fifo: add timeshift option to delay output

Signed-off-by: Marton Balint <cus@passwd.hu>
8 weeks agoChangelog: add next marker back after branching 4.3
Michael Niedermayer [Mon, 8 Jun 2020 20:43:41 +0000 (22:43 +0200)]
Changelog: add next marker back after branching 4.3

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 weeks agoBump minor versions after branching 4.3 n4.4-dev
Michael Niedermayer [Mon, 8 Jun 2020 20:45:49 +0000 (22:45 +0200)]
Bump minor versions after branching 4.3

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 weeks agoBump minor versions to separate 4.3 from master
Michael Niedermayer [Mon, 8 Jun 2020 20:45:49 +0000 (22:45 +0200)]
Bump minor versions to separate 4.3 from master

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 weeks agoChangelog: Add 4.3 cut marker
Michael Niedermayer [Mon, 8 Jun 2020 20:43:10 +0000 (22:43 +0200)]
Changelog: Add 4.3 cut marker

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 weeks agodoc/APIchanges: Fill in missing values
Michael Niedermayer [Mon, 8 Jun 2020 20:33:42 +0000 (22:33 +0200)]
doc/APIchanges: Fill in missing values

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 weeks agoRevert "lavf/mp3dec: don't adjust start time; packets are not adjusted."
Michael Niedermayer [Mon, 8 Jun 2020 20:08:37 +0000 (22:08 +0200)]
Revert "lavf/mp3dec: don't adjust start time; packets are not adjusted."

This causes regressions in end to end timestamps with mp3s and ffmpeg.
The revert is to avoid this regression in the 4.3 release

See: [FFmpeg-devel] [PATCH] Don't adjust start time for MP3 files; packets are not adjusted.

This reverts commit 460132c9980f8a1f501a1f69477bca49e1641233.

8 weeks agoavcodec/mpeg12dec: Fix got_output
Michael Niedermayer [Wed, 27 May 2020 22:19:56 +0000 (00:19 +0200)]
avcodec/mpeg12dec: Fix got_output

This makes got_output consistent with the code in slice_end() which sets the output

in slice_end()
 if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
     int ret = av_frame_ref(pict, s->current_picture_ptr->f);
     ...
 } else {

Fixes: assertion failure
Fixes: 22178/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-5664234440753152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 weeks agotools/target_dec_fuzzer: enable mjpeg for tiff or tdsc
Michael Niedermayer [Fri, 7 Feb 2020 12:59:15 +0000 (13:59 +0100)]
tools/target_dec_fuzzer: enable mjpeg for tiff or tdsc

This is needed for fuzzing tiff/tdsc and should increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>