aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* dnn_backend_native_layer_mathunary: add abs supportTing Fu2020-05-287-2/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | more math unary operations will be added here 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.subtract(x, 0.5) x2 = tf.abs(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>
* avcodec/decode: fix decoding when frames are allocated using ↵James Almer2020-05-271-1/+2
| | | | | | | | | AVHWAccel.alloc_frame() Regression since a1133db30ef07896afd96f067e5c51531a4e85ab Found-by: comex <comexk@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* tools/target_dec_fuzzer: Adjust max_pixels for AV_CODEC_ID_HAPMichael Niedermayer2020-05-271-0/+1
| | | | | | | | Fixes: Timeout (170sec -> 6sec) Fixes: 20956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5713643025203200 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* tools/target_dec_fuzzer: Reduce maxpixels for HEVCMichael Niedermayer2020-05-271-0/+1
| | | | | | | | | | | | high resolutions with only small blocks appear to be rather slow with the fuzzer + sanitizers. A solution which makes this run faster is welcome. Fixes: Timeout (did not wait -> 17sec) Fixes: 21006/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6002552539971584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* tools/target_dec_fuzzer: Do not test AV_CODEC_FLAG2_FAST with AV_CODEC_ID_H264Michael Niedermayer2020-05-271-1/+1
| | | | | | | | | This combination skips allocating large padding which can read out of array Fixes: 20978/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5746381832847360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegts: use get_packet_size in mpegts_resync for determining ↵Marton Balint2020-05-271-40/+11
| | | | | | | | | | | | | | | | | | | raw_packet_size The old resync logic had some bugs, for example the packet size could stuck into 192 bytes, because pos47_full was not updated for every packet, and for unseekable inputs the resync logic simply skipped some 0x47 sync bytes, therefore the calculated distance between sync bytes was a multiple of 188 bytes. AVIO only buffers a single packet (for UDP/mpegts, that usually means 1316 bytes), so for every ten consecutive 188-byte MPEGTS packets there was always a seek failure, and that caused the old code to not find the 188 byte pattern across 10 consecutive packets. This patch changes the custom logic to the one which is used when probing to determine the packet size. This was already proposed as a FIXME a long time ago...
* avcodec/adpcmenc: fix formattingZane van Iperen2020-05-271-5/+5
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: add adpcm_ima_ssi encoderZane van Iperen2020-05-277-2/+38
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcmenc: add capabilities argument to ADPCM_ENCODER()Zane van Iperen2020-05-271-17/+18
| | | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Use gcc/clang builtins for av_sat_(add|sub)_64_c if available.Dale Curtis2020-05-272-0/+16
| | | | | Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: fix apm makefile dependencyZane van Iperen2020-05-271-1/+1
| | | | | | | | Uses ff_get_wav_header() in riffdec.c Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264dec: Add FF_CODEC_CAP_INIT_CLEANUPLimin Wang2020-05-271-3/+1
| | | | | | | | | | | then ff_h264_free_tables() and h264_decode_end() can be removed in h264_decode_init() if it's failed. The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread, it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec: Add FF_CODEC_CAP_INIT_CLEANUPLimin Wang2020-05-278-1/+13
| | | | | | | | | | then ff_mpv_encode_end() will be unnecessary in ff_mpv_encode_init() if it's failed. The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread, it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUPLimin Wang2020-05-271-1/+1
| | | | | | | then we can remove adpcm_encode_close() in adpcm_encode_init() if have failed. so the goto error lable will be unnecessary and can be removed later. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* configure: NotchLC depends on lzfPaul B Mahol2020-05-271-0/+1
|
* avformat/mpegtsenc: cosmeticLimin Wang2020-05-271-63/+29
| | | | | | | Merge the short lines after the last commit Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mpegtsenc: simplify code by using OFFSET() and ENC macrosLimin Wang2020-05-271-45/+47
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec.h: move avcodec_get_{type,name} to codec_id.hAnton Khirnov2020-05-272-11/+12
|
* avcodec.h: split AVCodec API into its own headerAnton Khirnov2020-05-275-416/+469
|
* doc/APIchanges: fix typo in version numberAnton Khirnov2020-05-271-1/+1
|
* lavf/mp3dec: don't adjust start time; packets are not adjusted.Dale Curtis2020-05-272-5/+1
| | | | | | | | | | | | | | | | | | | | 7546ac2fee4 made it so that the start_time for mp3 files is adjusted for skip_samples. However, this appears incorrect because subsequent packet timestamps are not adjusted and skip_samples are applied by deleting data from a packet without changing the timestamp. E.g., we are told the start_time is ~25ms and we get a packet with a timestamp of 0 that has had the skip_samples discarded from it. As such rendering engines may incorrectly discard everything prior to the 25ms thinking that is where playback should officially start. Since the samples were deleted without adjusting timestamps though, the true start_time is still 0. Other formats like MP4 with edit lists will adjust both the start time and the timestamps of subsequent packets to avoid this issue. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/vaapi_hevc: add missing max_8bit_constraint_flagLinjie Fu2020-05-271-0/+1
| | | | | | This is accidentally missed while rebasing. Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/hevc_refs: Fix the logic of find_ref_idx()Xu Guangxin2020-05-271-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Currently find_ref_idx() would trigger 2 scans in DPB to find the requested POC: 1. Firstly, ignore MSB of ref->poc and search for the requested POC; 2. Secondly, compare the entire ref->poc with requested POC; For long term reference, we are able to only check LSB if MSB is not presented(e.g. delta_poc_msb_present_flag == 0). However, for short term reference, we should never ignore poc's MSB and it should be kind of bit-exact. (Details in 8.3.2) Otherwise this leads to decoding failures like: [hevc @ 0x5638f4328600] Error constructing the frame RPS. [hevc @ 0x5638f4328600] Error parsing NAL unit #2. [hevc @ 0x5638f4338a80] Could not find ref with POC 21 Error while decoding stream #0:0: Invalid data found when processing input Search the requested POC based on whether MSB is used, and avoid the 2-times scan for DPB buffer. This benefits both native HEVC decoder and integrated HW decoders. Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/hevc: Add poc_msb_present filed in LongTermRPSXu Guangxin2020-05-272-3/+3
| | | | | | | | | | delta_poc_msb_present_flag is needed in find_ref_idx() to indicate whether MSB of POC should be taken into account. Details in 8.3.2. Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* avfilter/vf_blend: add support for float formatsPaul B Mahol2020-05-261-4/+108
|
* mfenc: Avoid including codecapi.h, fix building in UWP mode with clangMartin Storsjö2020-05-272-7/+14
| | | | | | | | | | | | | Including codecapi.h and uuids.h in UWP mode doesn't define all defines properly, ending up with constructs that MSVC silently tolerates, but that clang errors out on, like this: DEFINE_GUIDEX(CODECAPI_AVEncCommonFormatConstraint); Just avoid including codecapi.h completely and hardcode the last few enum values we use from there. We already use local versions of most enums from there, due to older mingw-w64 headers being incomplete. Signed-off-by: Martin Storsjö <martin@martin.st>
* mfenc: Remove an unused includeMartin Storsjö2020-05-271-3/+1
| | | | | | | This might have been used originally for the decoder parts of the MediaFoundation wrapper, which aren't merged yet. Signed-off-by: Martin Storsjö <martin@martin.st>
* fftools/ffmpeg: add new abort_on flag which aborts if there is a stream ↵Marton Balint2020-05-264-3/+11
| | | | | | which received no packets Signed-off-by: Marton Balint <cus@passwd.hu>
* hwcontext_vulkan: fix uploading and downloading from/to flipped imagesLynne2020-05-261-2/+4
| | | | | | We want to copy the lowest amount of bytes per line, but while the buffer stride is sanitized, the src/dst stride can be negative, and negative numbers of bytes do not make a lot of sense.
* opusenc: add apply_phase_inv optionLynne2020-05-263-2/+4
| | | | | By popular request. Does the same as in libopusenc.
* lavfi/vulkan: fix queue counts and set indicesLynne2020-05-261-4/+2
|
* lavfi/vulkan: use dedicated allocation for buffers when necessaryLynne2020-05-261-3/+28
|
* hwcontext_vulkan: check for dedicated allocation when mapping from drm/vaapiLynne2020-05-261-38/+70
| | | | | Some vendors (AMD) require dedicated allocation to be used for all imported images.
* hwcontext_vulkan: initialize the frames context when derivingLynne2020-05-261-0/+7
| | | | | | Otherwise, the frames context is considered to be ready to handle mapping, and it doesn't get initialized the normal way through .frames_init.
* hwcontext_vulkan: use dedicated allocation for buffers when necessaryLynne2020-05-261-3/+28
|
* hwcontext_vulkan: use host mapped buffers when uploading and downloadingLynne2020-05-262-41/+116
| | | | Speeds up both use cases by 30%.
* pngdec: add ability to check chunk CRCLynne2020-05-261-0/+17
| | | | | | | | By default now, if AV_EF_CRCCHECK or AV_EF_IGNORE_ERR are enabled the decoder will skip the chunk and carry on with the next one. This should make the decoder able to decode more corrupt files because the functions which decode individual chunks will very likely error out if fed invalid data and stop the decoding of the entire image.
* mpegaudiodec_template: add ability to check CRCLynne2020-05-261-3/+17
| | | | | | A lot of files have CRC included. The CRC only covers 34 bytes at most from the frame but it should still be enough for some amount of error detection.
* apedec: add ability to check CRCLynne2020-05-261-1/+25
| | | | | | | | The CRC flag is only signalled once every few minutes but CRC is still always present so the patch uses the file version instead. CRC on 24-bit files wants non-padded samples so skip such files. Some corrupt samples may have been output before the final check depending on the -max_samples setting.
* avutil/mem: Use max_alloc_size as-isAndreas Rheinhardt2020-05-261-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The size of a single allocation performed by av_malloc() or av_realloc() is supposed to be bounded by max_alloc_size, which defaults to INT_MAX and can be set by the user; yet currently this is not completely honoured: The actual value used is max_alloc_size - 32. How this came to be can only be understood historically: a) 0ecca7a49f8e254c12a3a1de048d738bfbb614c6 disallowed allocations > INT_MAX. At that time the size parameter of av_malloc() was an unsigned and the commentary added ("lets disallow possible ambiguous cases") indicates that this was done as a precaution against calling the functions with negative int values. Genuinely limiting the size of allocations to INT_MAX doesn't seem to have been the intention given that at this time the memalign hack introduced in commit da9b170c6f06184a5114dc66afb8385cd0ffff83 (which when enabled increased the size of allocations slightly so that one can return a correctly aligned pointer that actually does not point to the beginning of the allocated buffer) was already present. b) Said memalign hack allocated 17 bytes more than actually desired, yet allocating 16 bytes more is actually enough and so this was changed in a9493601638b048c44751956d2360f215918800c; this commit also replaced INT_MAX by INT_MAX - 16 (and made the limit therefore a limit on the size of the allocated buffer), but kept the comment, although there is nothing ambiguous about allocating (INT_MAX - 16)..INT_MAX. c) 13dfce3d44f99a2d7df71aba8ae003d58db726f7 then increased 16 to 32 for AVX, 6b4c0be5586acad3bbafd7d2dd02a8328a5ab632 replaced INT_MAX by MAX_MALLOC_SIZE (which was of course defined to be INT_MAX) and 5a8e994287d8ef181c0a5eac537547d7059b4524 added max_alloc_size and made it user-selectable. d) 4fb311c804098d78e5ce5f527f9a9c37536d3a08 then dropped the memalign hack, yet it kept the -32 (probably because the comment about ambiguous cases was still present?), although it is no longer needed at all after this commit. Therefore this commit removes it and uses max_alloc_size directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Beautify matroska_parse_laces()Andreas Rheinhardt2020-05-261-16/+11
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/oggparsevorbis: Error out on double init of vpMichael Niedermayer2020-05-261-1/+6
| | | | | | | | Fixes: memleak Fixes: 19949/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5743636058210304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mediacodec_wrapper: use MediaFormat to probe frame color characteristicsMatthieu Bouron2020-05-251-0/+100
|
* avcodec/frame_thread_encoder: remove usage of avcodec_encode_video2()James Almer2020-05-252-14/+19
| | | | | | Call the encoder's internal AVCodec.encode2() function instead. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Replace ffurl_close() by ffurl_closep() where appropriateAndreas Rheinhardt2020-05-2524-71/+43
| | | | | | | | | | It avoids leaving dangling pointers behind in memory. Also remove redundant checks for whether the URLContext to be closed is already NULL. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavformat/flacdec: Workaround for truncated metadata picture sizeMattias Wadman2020-05-254-11/+42
| | | | | | | | | | | | | | | | | | | | | Some flac muxers write truncated metadata picture size if the picture data do not fit in 24 bits. Detect this by truncting the size found inside the picture block and if it matches the block size use it and read rest of picture data. This workaround is only for flac files and not ogg files with flac METADATA_BLOCK_PICTURE comments and it can be disabled with strict level above normal. Currently there is a 500MB limit on truncate size to protect from large memory allocations. The truncation bug in lavf flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8 but based on existing broken files other unknown flac muxers seems to truncate also. Before the fix a broken flac file for reproduction could be generated with: ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 1:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac Fixes ticket 6333 Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fate: add tests for h264 and vp9 video enc parameters exportAnton Khirnov2020-05-258-1/+1555
|
* h264dec: support exporting QP tables through the AVVideoEncParams APIAnton Khirnov2020-05-257-2/+84
|
* avformat/id3v2: Remove unnecessary indirectionAndreas Rheinhardt2020-05-2512-33/+33
| | | | | | | | | ff_id3v2_parse_apic/chapters/priv/priv_dict all had a parameter extra_meta of type ID3v2ExtraMeta ** as if the functions wanted to make *extra_meta point to something else. But they don't, so just use an ID3v2ExtraMeta *. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/id3v2: Avoid allocations for ID3v2ExtraMetaAndreas Rheinhardt2020-05-254-47/+37
| | | | | | | | | | | | Up until now, the ID3v2ExtraMeta structure (which is used when parsing ID3v2 tags containing attached pictures, chapters etc.) contained a pointer to separately allocated data that depended on the type of the tag. Yet the difference of the sizes of the largest and the smallest of these structures is fairly small, so that it is better to simply include a union of all the possible types of tag-dependent structures in ID3v2ExtraMeta. This commit implements this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>