summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* avformat/matroskaenc: Simplify writing CuesAndreas Rheinhardt2020-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | When the Matroska muxer writes the Cues (the index), it groups index entries with the same timestamp into the same CuePoint to save space. But given Matroska's variable-length length fields, it either needs to have an upper bound of the final size of the CuePoint before writing it or the CuePoint has to be assembled in a different buffer, so that after having assembled the CuePoint (when the real size is known), the CuePoint's header can be written and its data copied after it. The first of these approaches is the currently used one. This entails finding out the number of entries in a CuePoint before starting the CuePoint and therefore means that the list is read at least twice. Furthermore, a worst-case upper-bound for the length of a single entry was used, so that sometimes bytes are wasted on length fields. This commit switches to the second approach. This is no longer more expensive than the current approach if one only resets the dynamic buffer used to write the CuePoint's content instead of opening a new buffer for every CuePoint: Writing the trailer of a file with 540.000 CuePoints improved actually from 219054414 decicycles to 2164379394 decicycles (based upon 50 iterations). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/aviobuf: Add function to reset dynamic bufferAndreas Rheinhardt2020-03-30
| | | | | | | | | Resetting a dynamic buffer means to keep the AVIOContext and the internal buffer used by the dynamic buffer. This is done in order to save (re)allocations when one has a workflow where one opens and closes dynamic buffers in sequence. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Avoid allocation for CuesAndreas Rheinhardt2020-03-30
| | | | | | | | | | | | Up until now, the Matroska muxer would allocate a structure containing three members: The segment offset, a pointer to an array containing Cue (index) entries and a counter for said array. It is unnecessary to allocate it separately and it is unnecessary to contain the segment offset in said structure, as it duplicates another field contained in the MatroskaMuxContext. This commit implements the corresponding changes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: CosmeticsAndreas Rheinhardt2020-03-30
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Avoid unnecessary seekAndreas Rheinhardt2020-03-30
| | | | | | | | | | | | | | | | When writing the SeekHead (a form of index) at the end of the muxing process, mkv_write_seekhead() would first seek to the position where the SeekHead ought to be written, then write it there and seek back to the original position afterwards. Which means: To the end of the file. Afterwards, a seek to the beginning of the file is performed to update further values. This of course means that the second seek in mkv_write_seekhead() was unnecessary. This has been changed: A new parameter was added to mkv_write_seekhead() containing the destination for the second seek, effectively eliminating the seek to the end of the file after writing the SeekHead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Check for failure when writing SeekHeadAndreas Rheinhardt2020-03-30
| | | | | | | | | | | | | | | mkv_write_seekhead() would up until now try to seek to the position where the SeekHead ought to be written, write the SeekHead and seek back. The first of these seeks was checked as was writing, yet the seek back was unchecked. Moreover the return value of mkv_write_seekhead() was unchecked (the ordinary return value was the position where the SeekHead was written). This commit changes this: Everything is checked. In the unseekable case (where the first seek may nevertheless work when it happens in the buffer) a failure at the first seek is not considered an error. In any case, failure to seek back is an error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Improve calculating EBML ID sizeAndreas Rheinhardt2020-03-30
| | | | | | | | | | | | | | | | | | | | | When the Matroska muxer writes an EBML ID, it calculates the length of said ID before; and it does this as if this were a number that needs to be encoded as EBML number: The formula used is (av_log2(id + 1) - 1) / 7 + 1. But the constants used already contain the VINT_MARKER (the leading bit indicating the length of the EBML number) and therefore the algorithm used makes no sense. Instead the position of the most significant byte set gives the desired length. The algorithm used until now worked because EBML numbers are subject to restrictions: If the EBML number takes up k bytes, then the bit 1 << (7 * k) is set and av_log2(id) is 7 * k. So the current algorithm produces the correct result unless the EBML ID is of the form 7 * k - 1 because of the "id + 1". But contrary to encoding lengths as EBML number (where the + 1 exists to avoid the encodings reserved for unknown length), such EBML numbers are simply forbidden as EBML IDs and as such none of them were ever written. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avfilter/vf_v360: fix swapped variablesPaul B Mahol2020-03-29
|
* avfilter/vf_v360: speedup fisheye outputPaul B Mahol2020-03-29
|
* avfilter/vf_v360: reduce unnecessary negationsPaul B Mahol2020-03-29
|
* avformat/avformat: Update av_read_frame() documentationAndreas Rheinhardt2020-03-29
| | | | | | | | | | | | | This commit updates the documentation of av_read_frame() to match its actual behaviour in several ways: 1. On success, av_read_frame() always returns refcounted packets. 2. It can handle uninitialized packets. 3. On error, it always returns blank packets. This will allow callers to not initialize or unref unnecessarily. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/dashdec: Don't allocate and leak strings that are never usedAndreas Rheinhardt2020-03-29
| | | | | | | | | | | Since commit e134c203 strdups of several elements of a manifest are kept in the DASHContext; but said commit completely forgot to free these strings again (with xmlFree()). Given that these strings are never used at all, this commit closes this leak by reverting said commit. This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* doc/filters: add tpad default valuesLou Logan2020-03-28
| | | | Signed-off-by: Lou Logan <lou@lrcd.com>
* avfilter/vf_showinfo: limit the max number of timecodeLimin Wang2020-03-28
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter: add vf_overlay_cudaYaroslav Pogrebnyak2020-03-28
| | | | Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avutil/frame: make frame copy functions hwframe awareTimo Rothenpieler2020-03-28
|
* avutil/hwcontext: correctly set extended_data on hwframe_get_bufferTimo Rothenpieler2020-03-28
|
* nvdec: attach real hw_frames to post-processed framesTimo Rothenpieler2020-03-28
|
* ffplay, avcodec, avformat: Don't initialize before av_packet_ref()Andreas Rheinhardt2020-03-28
| | | | | | | It already initializes the packet. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec, avpacket: Return blank packet on av_packet_ref() failureAndreas Rheinhardt2020-03-28
| | | | | | | | | | | | Up until now, it was completely unspecified what the content of the destination packet dst was on error. Depending upon where the error happened calling av_packet_unref() on dst might be dangerous. This commit changes this by making sure that dst is blank on error, so unreferencing it again is safe (and still pointless). This behaviour is documented. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avpacket: Always treat dst in av_packet_ref as uninitializedAndreas Rheinhardt2020-03-28
| | | | | | | | | | | | | | | | | | av_packet_ref() mostly treated the destination packet dst as uninitialized, i.e. the destination fields were simply overwritten. But if the source packet was not reference-counted, dst->buf was treated as if it pointed to an already allocated buffer (if != NULL) to be reallocated to the desired size. The documentation did not explicitly state whether the dst will be treated as uninitialized, but it stated that if the source packet is not refcounted, a new buffer in dst will be allocated. This and the fact that the side-data as well as the codepath taken in case src is refcounted always treated the packet as uninitialized means that dst should always be treated as uninitialized for the sake of consistency. And this behaviour has been explicitly documented. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/jpeg2000dec: error check when processing tlm markerGautam Ramakrishnan2020-03-27
| | | | | | | Validate the value of ST field in the TLM marker of JPEG2000. Throw an error when ST takes value of 0b11. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rtp: Pass sources and block filter addresses via sdp file for rtpphunkyfish2020-03-27
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* movenc: mark Opus encapsulation as stableLynne2020-03-27
| | | | | | | The specifications are de-facto frozen now as they've already been used in production for years, the author has indicated reluctance on IRC to change it further, and the only potential changes would, from what I understand, be forward-compatible.
* h264_ps: pass AVCodecContext as void* where possibleAnton Khirnov2020-03-27
| | | | Makes sure it is only used for logging and nothing else.
* tests/checkasm: add overflow test for hevc_add_resLinjie Fu2020-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add overflow test for hevc_add_res when int16_t coeff = -32768. The result of C is good, while ASM is not. To verify: make fate-checkasm-hevc_add_res ffmpeg/tests/checkasm/checkasm --test=hevc_add_res ./checkasm --test=hevc_add_res checkasm: using random seed 679391863 MMXEXT: hevc_add_res_4x4_8_mmxext (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] SSE2: hevc_add_res_8x8_8_sse2 (hevc_add_res.c:69) hevc_add_res_16x16_8_sse2 (hevc_add_res.c:69) hevc_add_res_32x32_8_sse2 (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] AVX: hevc_add_res_8x8_8_avx (hevc_add_res.c:69) hevc_add_res_16x16_8_avx (hevc_add_res.c:69) hevc_add_res_32x32_8_avx (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] AVX2: hevc_add_res_32x32_8_avx2 (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] checkasm: 8 of 14 tests have failed Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* checkasm/hevc_add_res: prepare test data only if the fuction is not testedLinjie Fu2020-03-27
| | | | | | | | | | | | check_func will return NULL for functions that have already been tested. If the func is tested and skipped (which happens several times), there is no need to prepare data(randomize_buffers and memcpy). Move relative code in compare_add_res(), prepare data and do check only if the function is not tested. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/x86/hevc_add_res: Fix coeff overflow in ADD_RES_SSE_16_32_8Linjie Fu2020-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix overflow for coeff -32768 in function ADD_RES_SSE_16_32_8 with no performance drop.(SSE2/AVX/AVX2) ./checkasm --test=hevc_add_res --bench Mainline: - hevc_add_res.add_residual [OK] hevc_add_res_32x32_8_sse2: 127.5 hevc_add_res_32x32_8_avx: 127.0 hevc_add_res_32x32_8_avx2: 86.5 Add overflow test case: - hevc_add_res.add_residual [FAILED] After: - hevc_add_res.add_residual [OK] hevc_add_res_32x32_8_sse2: 126.8 hevc_add_res_32x32_8_avx: 128.3 hevc_add_res_32x32_8_avx2: 86.8 Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/x86/hevc_add_res: Fix overflow in ADD_RES_SSE_8_8Linjie Fu2020-03-27
| | | | | | | | | | | | | | | | | | | | | | Fix overflow for coeff -32768 in function ADD_RES_SSE_8_8 with no performance drop. ./checkasm --test=hevc_add_res --bench Mainline: - hevc_add_res.add_residual [OK] hevc_add_res_8x8_8_sse2: 15.5 Add overflow test case: - hevc_add_res.add_residual [FAILED] After: - hevc_add_res.add_residual [OK] hevc_add_res_8x8_8_sse2: 15.5 Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/x86/hevc_add_res: Fix overflow in ADD_RES_MMX_4_8Linjie Fu2020-03-27
| | | | | | | | | | | | | | | | | | | | | | Fix overflow for coeff -32768 in function ADD_RES_MMX_4_8 with no performance drop. ./checkasm --test=hevc_add_res --bench Mainline: - hevc_add_res.add_residual [OK] hevc_add_res_4x4_8_mmxext: 15.5 Add overflow test case: - hevc_add_res.add_residual [FAILED] After: - hevc_add_res.add_residual [OK] hevc_add_res_4x4_8_mmxext: 15.0 Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/pthread_frame: Update user context in ff_frame_thread_freeLinjie Fu2020-03-27
| | | | | | | | | | | | | | | | | | | | | | Resolution/format changes lead to re-initialization of hardware accelerations(vaapi/dxva2/..) with new hwaccel_priv_data in the worker-thread. But hwaccel_priv_data in user context won't be updated until the resolution changing frame is output. A termination with "-vframes" just after the reinit will lead to: 1. memory leak in worker-thread. 2. double free in user-thread. Update user context in ff_frame_thread_free with the last thread submit_packet() was called on. To reproduce: ffmpeg -hwaccel vaapi(dxva2) -v verbose -i fate-suite/h264/reinit-large_420_8-to-small_420_8.h264 -pix_fmt nv12 -f rawvideo -vsync passthrough -vframes 47 -y out.yuv Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avfilter/af_acrossover: revert 270068b5aPaul B Mahol2020-03-27
| | | | Actually it did not work well.
* libavcodec/jpeg2000.h: fix comments for JPEG2000 markersGautam Ramakrishnan2020-03-27
| | | | | | | The comments for some of the markers were incorrect. This patch fixes the comments associated with the markers. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/vf_showinfo: check if the s12m data size is validLimin Wang2020-03-27
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* configure: Get the correct ident for clang-cl.exeCarl Eugen Hoyos2020-03-26
| | | | Instead of "No input file specified"
* configure: Remove all C standard versions from the MSVC command line.Carl Eugen Hoyos2020-03-26
| | | | Silences a warning for every file when compiling with clang-cl.exe
* avformat/webmdashenc: Fix memleak upon realloc failureAndreas Rheinhardt2020-03-26
| | | | | | | The classical ptr = av_realloc(ptr, size). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mpeg: Remove unnecessary av_packet_unref()Andreas Rheinhardt2020-03-26
| | | | | | | Forgotten in 6a67d518. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/yop: Use av_packet_move_ref() for packet ownership transferAndreas Rheinhardt2020-03-26
| | | | | | | Also return 0 after successfully reading a packet. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/nsvdec: Use av_packet_move_ref() for packet ownership transferAndreas Rheinhardt2020-03-26
| | | | | | | Also simply return 0 in case a packet has been successfully read. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Don't discard the upper 32bits of TrackNumberAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* doc/developer.texi: Add variadic macros to allowed C language featuresAndreas Rheinhardt2020-03-26
| | | | | | They are used in several places like CBS. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/movenc: Reduce size of the allocated MOVIentry arrayJames Almer2020-03-26
| | | | | | | | Increasing it by 2048 entries per realloc is exessive. Reduces memory usage, especially on long, non fragmented output. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/vp9: use a buffer pool to allocate VP9Frame extradataJames Almer2020-03-26
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/vf_v360: improve sg input formatPaul B Mahol2020-03-26
| | | | Specifically unbreak yaw functionality.
* avfilter/vf_v360: improve sg output formatPaul B Mahol2020-03-26
|
* avformat/matroskadec: fix the type of the TrackLanguageSteve Lhomme2020-03-26
| | | | | | It's an ASCII string, not a UTF-8 string. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Avoid allocations for SeekHeadAndreas Rheinhardt2020-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until e7ddafd5, the Matroska muxer wrote two SeekHeads: One at the beginning referencing the main level 1 elements (i.e. not the Clusters) and one at the end, referencing the Clusters. This second SeekHead was useless and has therefore been removed. Yet the SeekHead-related functions and structures are still geared towards this usecase: They are built around an allocated array of variable size that gets reallocated every time an element is added to it although the maximum number of Seek entries is a small compile-time constant, so that one should rather include the array in the SeekHead structure itself; and said structure should be contained in the MatroskaMuxContext instead of being allocated separately. The earlier code reserved space for a SeekHead with 10 entries, although we currently write at most 6. Reducing said number implied that every Matroska/Webm file will be 84 bytes smaller and required to adapt several FATE tests; furthermore, the reserved amount overestimated the amount needed for for the SeekHead's length field and how many bytes need to be reserved to write a EBML Void element, bringing the total reduction to 89 bytes. This also fixes a potential segfault: If !mkv->is_live and if the AVIOContext is initially unseekable when writing the header, the SeekHead is already written when writing the header and this used to free the SeekHead-related structures that have been allocated. But if the AVIOContext happens to be seekable when writing the trailer, it will be attempted to write the SeekHead again which will lead to segfaults because the corresponding structures have already been freed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: CosmeticsAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Check unchecked functions for errorsAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>