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

98801 Commits

Author SHA1 Message Date
Paul B Mahol
ba0825626a avcodec/cfhdenc: optimize writting of small runcodes 2020-08-11 10:01:05 +02:00
Paul B Mahol
16b79f3d3a avcodec/cfhdenc: improve quality vs size ratio 2020-08-11 10:01:04 +02:00
Zane van Iperen
d2f42b9be1
avformat/argo_asf: strip file extension from name
Only when the user hasn't manually specified one.
Matches the original files more closely.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:27 +10:00
Zane van Iperen
a3a4591868
avformat/argo_asf: add name option
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:27 +10:00
Zane van Iperen
1f9dd53d5d
avformat/argo_asf: add version_major and version_minor options
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:27 +10:00
Zane van Iperen
a3e9821787
avformat/argo_asf: don't check file version
It has no bearing on structure. Determined by looking at the ASF
files from several Argonaut games:
  - FX Fighter,
  - Croc,
  - Croc 2,
  - The Emperor's New Groove, and
  - Disney's Aladdin in Nasira's Revenge

The only versions that appear are 1.1, 1.2, and 2.1, and their
structure is identical.

Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:26 +10:00
Zane van Iperen
97aaa15089
avformat/argo_asf: add games to version list
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-11 08:50:19 +10:00
Andreas Rheinhardt
1ead176d87 avformat/mpegts: Don't leave context in inconsistent state upon error
Up until now, opening a section filter works as follows: A filter is
opened and (on success) attached to the MpegTSContext. Then a buffer for
said filter is allocated and upon success attached to the section
filter; on error, the filter is simply freed without removing it from
the MpegTSContext, leaving the latter in an inconsistent state. This
leads to use-after-frees lateron.

This commit fixes this by allocating the buffer first; the filter is
only opened if the buffer could be successfully allocated.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-10 21:07:54 +02:00
Michael Niedermayer
a5ac81952e avcodec/jpeg2000dec: Check remaining data in packed_headers_stream before use
Fixes: out of array read
Fixes: 24487/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5165847820369920
Fixes: 24636/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5700973918683136
Fixes: 24683/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6202883897556992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-10 14:54:32 +02:00
Ting Fu
de5cb6c060 FATE/dnn: add unit test for dnn avgpool layer
'make fate-dnn-layer-avgpool' to run the test

Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-08-10 16:37:43 +08:00
Ting Fu
91efc41a69 dnn/native: add native support for avg_pool
Not support pooling strides in channel dimension yet.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-08-10 16:37:39 +08:00
Steven Liu
40597add98 avformat/hlsenc: write temp file for append single file by encryption mode
fix ticket: 8783
Because in single file by encryption mode, it cannot get the last one
block of the file, it need ff_format_io_close for get full file size,
then hlsenc can get the total size of the encryption content,
so write the content into temp file first, and get the temp file content
append the temp file content into append to single file, then hlsenc can
get the correct file/content size and offset.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2020-08-10 15:52:59 +08:00
Steven Liu
6e4bba4055 avformat/hls: support avio_seek in encryption mode
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2020-08-10 15:52:54 +08:00
Mark Thompson
6e951d0cf8 kmsgrab: Add more supported formats
X2RGB10 tested on both Intel Gen9 and AMD Polaris 11.  NV12 tested on
Intel Gen9 only - since it has multiple planes, this requires GetFB2.

Also add some comments to split the list up a bit.
2020-08-09 20:18:49 +01:00
Mark Thompson
991daf3895 doc/indevs: Note improved behaviour of kmsgrab with Linux 5.7 2020-08-09 20:18:49 +01:00
Mark Thompson
ff14858a60 kmsgrab: Don't require the user to set framebuffer format
This is provided by GetFB2, but we still need the option for cases where
that isn't available.
2020-08-09 20:18:49 +01:00
Mark Thompson
ef934dba2d kmsgrab: Use GetFB2 if available
The most useful feature here is the ability to automatically extract the
framebuffer format and modifiers.  It also makes support for multi-plane
framebuffers possible, though none are added to the format table in this
patch.

This requires libdrm 2.4.101 (from April 2020) to build, so it includes a
configure check to allow compatibility with existing distributions.  Even
with libdrm support, it still won't do anything at runtime if you are
running Linux < 5.7 (before June 2020).
2020-08-09 20:18:48 +01:00
Mark Thompson
fa0b064cf2 kmsgrab: Refactor and clean error cases 2020-08-09 20:18:48 +01:00
Andreas Rheinhardt
ea8f8d28d0 avformat/sierravmd: Don't return packets for non-existing stream
It leads to an assert in ff_read_packet().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-09 19:07:23 +02:00
Andreas Rheinhardt
c4a4fe938d avformat/vividas: Check allocation for success
Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-09 19:07:23 +02:00
Andreas Rheinhardt
a3dced69c8 avformat/vividas: Check return value before storing it in smaller type
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-09 19:07:23 +02:00
Paul B Mahol
4ad77086b9 avcodec/cfhd: improve SampleIndex tag output
This tag is used for jumping to different channels in bitstream.
2020-08-09 18:47:30 +02:00
Paul B Mahol
17d1454a5f avcodec/cfhd: log version tags too 2020-08-09 18:47:29 +02:00
Paul B Mahol
fc3546bece avcodec/cfhd: read prescale table tag
Currently unused. Remove prescale shift tag as it
is not part of this codec.
2020-08-09 18:47:29 +02:00
Paul B Mahol
3ff7171a85 avcodec/cfhd: use init_get_bits8() 2020-08-09 18:47:29 +02:00
Paul B Mahol
25d07e1394 avcodec/cfhd: reindent 2020-08-09 18:47:28 +02:00
Paul B Mahol
8c7ea0c344 avcodec/cfhd: check if band encoding is valid
Also simplify lossless check as value of 5 for band encoding
always specify lossless mode.
2020-08-09 18:47:28 +02:00
Gautam Ramakrishnan
9ce787d61e libavcodec/j2kenc: Support for all Progression orders
This patch allows for selecting the progression order
in the j2k encoder. However, all components and resolution
levels will use the same progression order and will not
feature the use of progression order change markers.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-09 14:58:24 +02:00
Paul B Mahol
14b84a2e99 avcodec/cfhdenc: free alpha buffer on closing 2020-08-08 19:59:06 +02:00
Paul B Mahol
0a8742a1e6 avcodec/cfhdenc: add gbrap12 pixel format support 2020-08-08 19:40:34 +02:00
Paul B Mahol
8d48e8d251 avcodec/cfhdenc: compand coefficients
Also use -quality private option and add more modes.
2020-08-08 12:05:39 +02:00
Paul B Mahol
1006a21512 avcodec/cfhd: add 3d transform support
Based on Gagandeep Singh patch.
2020-08-08 12:03:43 +02:00
Paul B Mahol
1c6a010e3b avcodec/cfhd: remove some unused or only write items 2020-08-08 12:03:43 +02:00
Paul B Mahol
a96506f017 avcodec/cfhdenc: also write FrameNumber tag 2020-08-08 12:03:43 +02:00
Paul B Mahol
9d58cdb4ba swscale: do not drop half of bits from 16bit bayer formats 2020-08-08 12:03:42 +02:00
Jun Zhao
b9ff25a93e doc/fftools-common-opts: document ffmpeg -h protocol=protocol_name
document ffmpeg -h protocol=protocol_name

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-08-08 15:06:45 +08:00
Jun Zhao
035208e514 doc/fftools-common-opts: fix typo (name => named)
fix typo (name => named)

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-08-08 15:05:31 +08:00
tomajsjiang
926061fff1 doc/filters: update filter buffer/abuffer interface file name
Update filter buffer/abuffer interface file name, from
libavfilter/{vsrc|asrc_buffer.h} to libavfilter/buffersrc.h

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: tomajsjiang <tomajsjiang@tencent.com>
2020-08-08 15:04:34 +08:00
Andreas Rheinhardt
06fef1e9f1 avcodec/put_bits: Make skip_put_bits() less dangerous
Before c63c303a1f (the commit which
introduced a typedef for the type of the buffer of a PutBitContext)
skip_put_bits() was as follows:

static inline void skip_put_bits(PutBitContext *s, int n)
{
    s->bit_left -= n;
    s->buf_ptr  -= 4 * (s->bit_left >> 5);
    s->bit_left &= 31;
}

If s->bit_left was negative after the first subtraction, then the next
line will divide this by 32 with rounding towards -inf and multiply by
four; the result will be negative, of course.

The aforementioned commit changed this to:

static inline void skip_put_bits(PutBitContext *s, int n)
{
    s->bit_left -= n;
    s->buf_ptr  -= sizeof(BitBuf) * ((unsigned)s->bit_left / BUF_BITS);
    s->bit_left &= (BUF_BITS - 1);
}

Casting s->bit_left to unsigned meant that the rounding is still towards
-inf; yet the right side is now always positive (it transformed the
arithmetic shift into a logical shift), so that s->buf_ptr will always
be decremented (by about UINT_MAX / 8 unless n is huge) which leads to
segfaults on further usage and is already undefined pointer arithmetic
before that. This can be reproduced with the mpeg4 encoder with the
AV_CODEC_FLAG2_NO_OUTPUT flag set.

Furthermore, the earlier version as well as the new version share
another bug: s->bit_left will be in the range of 0..(BUF_BITS - 1)
afterwards, although the assumption throughout the other PutBitContext
functions is that it is in the range of 1..BUF_BITS. This might lead to
a shift by BUF_BITS in little-endian mode. This has been fixed, too.
The new version is furthermore able to skip zero bits, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-08 01:08:47 +02:00
Zane van Iperen
6fdf3cc53b
fate: cosmetics
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:14:29 +10:00
Zane van Iperen
6afc2797d2
fate: add adpcm_argo test
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:14:28 +10:00
Zane van Iperen
0549daa71b
avformat: add argo_asf muxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-07 23:14:28 +10:00
Zane van Iperen
62da99e1d0
avcodec: add adpcm_argo encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:28 +10:00
Zane van Iperen
5d1e1dd6bd
avcodec/adpcm_argo: add ff_adpcm_argo_expand_nibble() and cleanup parameters
Replaces adpcm_argo_expand_nibble(). Preparation for the encoder.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:25 +10:00
Zane van Iperen
b0b87f28c3
avformat/argo_asf: check sample count in demuxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:15 +10:00
Michael Niedermayer
be090da25f avcodec/tiff: Check bpp/bppcount for 0
Fixes: division by zero
Fixes: 24253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6250318007107584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-07 14:01:00 +02:00
Michael Niedermayer
d51d569cf6 avcodec/snowdec: Sanity check hcoeff
Fixes: signed integer overflow: -2147483648 * -1 cannot be represented in type 'int'
Fixes: 24011/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5486376610168832

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-07 14:01:00 +02:00
Mingyu Yin
fab00b0ae0 dnn_backend_native_layer_mathunary: add floor support
It can be tested with the model generated with below python script:

import tensorflow as tf
import os
import numpy as np
import imageio
from tensorflow.python.framework import graph_util
name = 'floor'

pb_file_path = os.getcwd()
if not os.path.exists(pb_file_path+'/{}_savemodel/'.format(name)):
    os.mkdir(pb_file_path+'/{}_savemodel/'.format(name))

with tf.Session(graph=tf.Graph()) as sess:
    in_img = imageio.imread('detection.jpg')
    in_img = in_img.astype(np.float32)
    in_data = in_img[np.newaxis, :]
    input_x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
    y_ = tf.math.floor(input_x*255)/255
    y = tf.identity(y_, name='dnn_out')
    sess.run(tf.global_variables_initializer())
    constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])

    with tf.gfile.FastGFile(pb_file_path+'/{}_savemodel/model.pb'.format(name), mode='wb') as f:
        f.write(constant_graph.SerializeToString())

    print("model.pb generated, please in ffmpeg path use\n \n \
    python tools/python/convert.py {}_savemodel/model.pb --outdir={}_savemodel/ \n \nto generate model.model\n".format(name,name))

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

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow -f framemd5 {}_savemodel/tensorflow_out.md5\n  \
    or\n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow {}_savemodel/out_tensorflow.jpg\n \nto generate output result of tensorflow model\n".format(name, name, name, name))

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native -f framemd5 {}_savemodel/native_out.md5\n  \
    or \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native {}_savemodel/out_native.jpg\n \nto generate output result of native model\n".format(name, name, name, name))

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
2020-08-07 10:34:22 +08:00
Harry Mallon
7031a7beae avformat/mxfdec: Read color metadata from MXF
Reads color_primaries, color_trc and color_space from mxf
headers. ULs are from https://registry.smpte-ra.org/ site.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
2020-08-06 12:52:34 +02:00
Takio Yamaoka
cc6c56f5d9 avcodec/libx264: fix chroma quantizer offset usage
The default for the chromaoffset field in AVCodecContext
is zero, which until now always ended up overriding the
AVOption-set value, thus leading to the AVOption not working.

Additionally, the previous usage prevented the usage of
negative values, while both the variable as well as x264's
API would successfully handle such.

Thus, the default value of the AVOption is changed to match
the default of x264 (and what is currently the default for
the AVCodecContext chromaoffset field), and the checks are
changed to check for nonzero values.

This way:
1. the library default is still utilized if the value is zero.
2. both negative and positive values are correctly passed to
   x264.

For historical context, this was initially similarly
implemented in 5764d38173, and
then b340bd8a58 broke the
value.

Partially reverts commit b340bd8a58.

Signed-off-by: Takio Yamaoka <y.takio@gmail.com>
2020-08-06 13:09:23 +03:00