summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* avcodec/mpegvideo: Don't zero unnecessarilyAndreas Rheinhardt2022-08-15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideodec: Constify some functionsAndreas Rheinhardt2022-08-15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Don't copy unnecessarily, fix raceAndreas Rheinhardt2022-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpegvideo uses an array of Pictures and when it is done with using them, it only unreferences them incompletely: Some buffers are kept so that they can be reused lateron if the same slot in the Picture array is reused, making this a sort of a bufferpool. (Basically, a Picture is considered used if the AVFrame's buf is set.) Yet given that other pieces of the decoder may have a reference to these buffers, they need not be writable and are made writable using av_buffer_make_writable() when preparing a new Picture. This involves reading the buffer's data, although the old content of the buffer need not be retained. Worse, this read can be racy, because the buffer can be used by another thread at the same time. This happens for Real Video 3 and 4. This commit fixes this race by no longer copying the data; instead the old buffer is replaced by a new, zero-allocated buffer. (Here are the details of what happens with three or more decoding threads when decoding rv30.rm from the FATE-suite as happens in the rv30 test: The first decoding thread uses the first slot of its picture array to store its current pic; update_thread_context copies this for the second thread that decodes a P-frame. It uses the second slot in its Picture array to store its P-frame. This arrangement is then copied to the third decode thread, which decodes a B-frame. It uses the third slot in its Picture array for its current frame. update_thread_context copies this to the next thread. It unreferences the third slot containing the other B-frame and then it reuses this slot for its current frame. Because the pic array slots are only incompletely unreferenced, the buffers of the previous B-frame are still in there and they are not writable; in fact the previous thread is concurrently writing to them, causing races when making the buffer writable.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Remove redundant checkAndreas Rheinhardt2022-08-15
| | | | | | | | At this point active_thread_type is set iff active_thread_type is set to FF_THREAD_FRAME iff AVCodecInternal.frame_thread_encoder is set. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Move initializing frame-thrd encoder to encode_preinitAndreas Rheinhardt2022-08-15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vsrc_ddagrab: add options for more control over output format fallbackTimo Rothenpieler2022-08-13
|
* avfilter/vsrc_ddagrab: add rgbaf16 output supportTimo Rothenpieler2022-08-13
|
* avutil/hwcontext_d3d11va: add support for rgbaf16 pixel formatTimo Rothenpieler2022-08-13
|
* lavu/pixfmt: add packed RGBA float16 formatTimo Rothenpieler2022-08-13
| | | | | This is the default format of the Windows compositor and what DXGI Desktop Duplication will give you for any kind of HDR output.
* compat: add msvc windres wrapperTimo Rothenpieler2022-08-13
| | | | | This is by no means a complete wrapper. It's only designed to fit the usecase ffmpegs build system has.
* fftools: add DPI awareness manifestTimo Rothenpieler2022-08-13
| | | | | Some filters, like gdigrab, rely on this to be set to see and report proper dimensions.
* configure: always enable gnu_windres if availableTimo Rothenpieler2022-08-13
| | | | | Use the appropiate Makefile variable to ensure the resource file is only built into shared libraries instead.
* fftools/ffmpeg: move packet timestamp processing to demuxer threadAnton Khirnov2022-08-13
| | | | | | | | | Discontinuity detection/correction is left in the main thread, as it is entangled with InputStream.next_dts and related variables, which may be set by decoding code. Fixes races e.g. in fate-ffmpeg-streamloop after aae9de0cb2887e6e0bbfda6ffdf85ab77d3390f0.
* fftools/ffmpeg: use a separate variable for discontinuity offsetAnton Khirnov2022-08-13
| | | | | | This will allow to move normal offset handling to demuxer thread, since discontinuities currently have to be processed in the main thread, as the code uses some decoder-produced values.
* fftools/ffmpeg: simplify conditions in ts_discontinuity_processAnton Khirnov2022-08-13
|
* fftools/ffmpeg: move inter-stream ts discontinuity handling to ↵Anton Khirnov2022-08-13
| | | | ts_discontinuity_process()
* fftools/ffmpeg: move timestamp discontinuity correction out of process_input()Anton Khirnov2022-08-13
|
* fftools/ffmpeg: pre-compute the streamcopy start pts before transcoding startsAnton Khirnov2022-08-13
| | | | | | | InputFile.ts_offset can change during transcoding, due to discontinuity correction. This should not affect the streamcopy starting timestamp. Cf. bf2590aed3e64d44a5e2430fdbe89f91f5e55bfe
* fftools/ffmpeg: move stream-dependent starttime correction to transcode_init()Anton Khirnov2022-08-13
| | | | | Currently this code is located in the discontinuity handling block, where it does not belong.
* fftools/ffmpeg_mux: avoid leaking pkt on errorsAnton Khirnov2022-08-13
|
* fftools/ffmpeg: mark all encode sync queues as done before flushing encodersAnton Khirnov2022-08-13
|
* avformat/avisynth: add missing avs_release_video_frameStephen Hutchinson2022-08-12
| | | | | | | | | The AviSynth C API requires using avs_release_video_frame whenever avs_get_frame has been used, but the recent addition of frameprop reading to the demuxer was missing this in avisynth_create_stream_video. Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
* avcodec/mimic: Fix undefined pointer arithmeticAndreas Rheinhardt2022-08-12
| | | | | | | NULL + anything is UB. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/imfdec: preserve stream informationPierre-Anthony Lemieux2022-08-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: refactor ff_stream_encode_params_copy() to stream_params_copy()Pierre-Anthony Lemieux2022-08-12
| | | | | | Addresses http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299726.html Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: add --enable-libvpl optionHaihao Xiang2022-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | This allows user to build FFmpeg against Intel oneVPL. oneVPL 2.6 is the required minimum version when building Intel oneVPL code. It will fail to run configure script if both libmfx and libvpl are enabled. It is recommended to use oneVPL for new work, even for currently available hardwares [1] Note the preferred child device type is d3d11va for libvpl on Windows. The commands below will use d3d11va if d3d11va is available on Windows. $ ffmpeg -hwaccel qsv -c:v h264_qsv ... $ ffmpeg -qsv_device 0 -hwaccel qsv -c:v h264_qsv ... $ ffmpeg -init_hw_device qsv=qsv:hw_any -hwaccel qsv -c:v h264_qsv ... $ ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=0 -hwaccel qsv -c:v h264_qsv ... User may use child_device_type option to specify child device type to dxva2 or derive a qsv device from a dxva2 device $ ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=0,child_device_type=dxva2 -hwaccel qsv -c:v h264_qsv ... $ ffmpeg -init_hw_device dxva2=d3d9:0 -init_hw_device qsv=qsv@d3d9 -hwaccel qsv -c:v h264_qsv ... [1] https://www.intel.com/content/www/us/en/develop/documentation/upgrading-from-msdk-to-onevpl/top.html
* lavfi/qsv: create mfx session using oneVPL for qsv filtersHaihao Xiang2022-08-12
| | | | | | | Use the mfxLoader handle in qsv hwdevice to create mfx session for qsv filters. This is in preparation for oneVPL support
* lavc/qsv: create mfx session using oneVPL for decoding/encodingHaihao Xiang2022-08-12
| | | | | | | | If qsv hwdevice is available, use the mfxLoader handle in qsv hwdevice to create mfx session. Otherwise create mfx session with a new mfxLoader handle. This is in preparation for oneVPL support
* lavu/hwcontext_qsv: make qsv hwdevice works with oneVPLHaihao Xiang2022-08-12
| | | | | | | | | | | | | | | | | | In oneVPL, MFXLoad() and MFXCreateSession() are required to create a workable mfx session[1] Add config filters for D3D9/D3D11 session (galinart) The default device is changed to d3d11va for oneVPL when both d3d11va and dxva2 are enabled on Microsoft Windows This is in preparation for oneVPL support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher Co-authored-by: galinart <artem.galin@intel.com> Signed-off-by: galinart <artem.galin@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavu/hwcontext_qsv: add loader field to AVQSVDeviceContextHaihao Xiang2022-08-12
| | | | | | | | | | | In oneVPL, a valid mfxLoader handle is needed when creating mfx session for decoding, encoding and processing[1], so add loader field to AVQSVDeviceContext. User should fill this field before calling av_hwdevice_ctx_init() if using oneVPL This is in preparation for oneVPL support [1]https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher
* qsv: restrict OPAQUE memory to MFX_VERSION < 2.0Haihao Xiang2022-08-12
| | | | | | | | OPAQUE memory isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsvenc: restrict MFX_RATECONTROL_LA_EXT to MFX_VERSION < 2.0Haihao Xiang2022-08-12
| | | | | | | | MFX_RATECONTROL_LA_EXT isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsvenc: restrict multi-frame encode to MFX_VERSION < 2.0Haihao Xiang2022-08-12
| | | | | | | | Multi-frame encode isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsv: restrict audio related code to MFX_VERSION < 2.0Haihao Xiang2022-08-12
| | | | | | | | Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsv: restrict user plugin to MFX_VERSION < 2.0Haihao Xiang2022-08-12
| | | | | | | | User plugin isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL Support [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsv: remove mfx/ prefix from mfx headersHaihao Xiang2022-08-12
| | | | | | | | | | | | | | | | | | | | | | | | The following Cflags has been added to libmfx.pc, so mfx/ prefix is no longer needed when including mfx headers in FFmpeg. Cflags: -I${includedir} -I${includedir}/mfx Some old versions of libmfx have the following Cflags in libmfx.pc Cflags: -I${includedir} We may add -I${includedir}/mfx to CFLAGS when running 'configure --enable-libmfx' for old versions of libmfx, if so, mfx headers without mfx/ prefix can be included too. If libmfx comes without pkg-config support, we may do a small change to the settings of the environment(e.g. set -I/opt/intel/mediasdk/include/mfx instead of -I/opt/intel/mediasdk/include to CFLAGS), then the build can find the mfx headers without mfx/ prefix After applying this change, we won't need to change #include for mfx headers when mfx headers are installed under a new directory. This is in preparation for oneVPL support (mfx headers in oneVPL are installed under vpl directory)
* configure: fix the check for MFX_CODEC_VP9Haihao Xiang2022-08-12
| | | | | | | | | | | | | The data structures for VP9 in mfxvp9.h is wrapped by MFX_VERSION_NEXT, which means those data structures have never been used in a public release. Actually MFX_CODEC_VP9 and other VP9 stuffs are added in mfxstructures.h. In addition, mfxdefs.h is included in mfxvp9.h, so we may use the check in this patch for MFX_CODEC_VP9 This is in preparation for oneVPL support because mfxvp9.h is removed from oneVPL [1] [1]: https://github.com/oneapi-src/oneVPL
* configure: ensure --enable-libmfx uses libmfx 1.xHaihao Xiang2022-08-12
| | | | | | | | | | | | | | | Intel's oneVPL is a successor to MediaSDK, but removed some obsolete features of MediaSDK[1], some early versions of oneVPL still use libmfx as library name[2]. However some of obsolete features, including OPAQUE memory, multi-frame encode, user plugins and LA_EXT rate control mode etc, have been enabled in QSV, so user can not use --enable-libmfx to enable QSV if using an early version of oneVPL SDK. In order to ensure user builds FFmpeg against a right version of libmfx, this patch added a check for version < 2.0 and warning message about the used obsolete features. [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html [2] https://github.com/oneapi-src/oneVPL
* avcodec/mpegvideo: Move setting mb_height to ff_mpv_init_context_frameAndreas Rheinhardt2022-08-10
| | | | | | | | | | | It is the proper place to set it, directly besides mb_width and mb_stride. The reason for doing it the way it is done now seems to be that the code does not create more slice contexts than necessary (i.e. not more than one per row), so that this number needs to be known before setting the number of slices. But this can always be arranged by just moving the code that sets the number of slices. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Remove redundant castAndreas Rheinhardt2022-08-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Remove redundant checkAndreas Rheinhardt2022-08-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Don't copy Picture unnecessarilyAndreas Rheinhardt2022-08-10
| | | | | | Also add const where possible. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Move encoding_error and mb_var_sum to MpegEncCtxAndreas Rheinhardt2022-08-10
| | | | | | | | These fields are only ever set by the encoder for the current picture and for no other picture. So only one set of these values needs to exist, so move them to MpegEncContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/buffer: Never poison returned buffersAndreas Rheinhardt2022-08-10
| | | | | | | | | | | | | | | | | Poisoning returned buffers is based around the implicit assumption that the contents of said buffers are transient. Yet this is not true for the buffer pools used by the various hardware contexts which store important state in there that needs to be preserved. Furthermore, the current code is also based on the assumption that the complete buffer pointed to by AVBuffer->data coincides with AVBufferRef->data; yet an implementation might store some data of its own before the actual user-visible data (accessible via AVBufferRef) which would be broken by the current code. (This is of course yet more proof that the AVBuffer API is not the right tool for the hardware contexts.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Remove always-true checksAndreas Rheinhardt2022-08-10
| | | | | | | | Of all the buffers that are made writable, three are always allocated and the other four are allocated iff any one of them is allocated; so one can replace the seven checks for existence with one. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegutils: Constify ff_print_debug_info2, ff_draw_horiz_bandAndreas Rheinhardt2022-08-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegutils: Combine multiple av_log statementsAndreas Rheinhardt2022-08-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmv2dec: Zero mb_type array for I picturesAndreas Rheinhardt2022-08-10
| | | | | | | | | | | | | | | | | | | | Up until now, ff_wmv2_decode_secondary_picture_header() only set the mb_type array for non I-pictures, so that the decoding process uses the earlier values of this array; this affects the output of the wmv8-x8intra FATE-test (which this patch therefore updates). These earlier values were set when decoding earlier frames or when the buffer was initially zero-allocated. A consequence of this is that the output of this test would be random if ff_find_unused_picture() would select the unused picture to return at random. Furthermore decoding from a keyframe onwards depends upon the earlier state of the decoder. This patch therefore zeroes said array when decoding an I picture. (It is not claimed that zero is the right value to fill the array with. I just don't know.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp9: Remove redundant reporting of progress on errorAndreas Rheinhardt2022-08-10
| | | | | | Redundant since 5e03eea673a9da2253ed15152e46b1422b35d145. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pthread_frame: Fix compiling with thread-unsafe-callbacks disabledAndreas Rheinhardt2022-08-10
| | | | | | Forgotten in 02220b88fc38ef9dd4f2d519f5d3e4151258b60c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>