[vlc-devel] [PATCH 00/18] add video context to filters (v4)

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 15 15:51:02 CET 2019


Changes since v3:
- the video context in pictures is stored in the picture_context_t
- reorder some patches so the video context is available in more intermediate
  cases
- no more vlc_video_context_IsSimilar() for now
- some of the filter chain cleaning patches not related to push have been merged

Changes since v2:
- fix some vctx leaks
- example setting an output vctx keep a reference to it as long as they use it
- no more rename of the filter_chain fmt_out
- cleaning of the filter_chain API calls, for example once Reset is called, we
  don't need to append a filter stating the same input video format+context, in
  many cases the output video format is also implied by the Reset call.
  This cleaning makes the use of filter more readable in terms of what the
  input and output are. It also requires less patching when involving the video
  context.
- add checks on the video contexts received by GPU filters
- simplify the NVDEC GPU to CPU filter using the input video context
- add an example of VAAPI filter setting its output video context
- initialize the VAAPI pool using the video context rather than decoder device.

Changes since v1:
- added D3D9/D3D11 deinterlace use of the vctx on input and output
- use the input vctx in the NVDEC GPU to CPU filter
- add VLC_USED to the inline picture_NewFromFormat()
- reorder some patches
- add documentation to vlc_video_context_IsSimilar()
- fix crash when the vctx doesn't have "operations" callbacks (nvdec)
- less variable renaming


This patchset adds video context handling to filters.

The video context coming from the decoder is added to the filter chain
and each filter can create a video context on output if it outputs GPU surfaces.
This is not automatic.

Pictures also store a video context (via the picture pool).

A video context can be compared to another to detect changes in the source.
(like for video format)


This patchet doesn't apply directly on master but on top of previously submitted
patches to provide a decoder device to decoders in all use cases (or NULL).

The patches of this set can be found in this branch:
https://code.videolan.org/robUx4/vlc/tree/push/merge/76

Steve Lhomme (18):
  picture: add the video context in the picture context
  video_output: pass the input video context with the source format
  filters: set the input/output video context on video filters
  filter_chain: set the input video context before opening a filter
  display: keep the video context to feed the converter locally
  filter_chain: keep the input video context on Reset
  d3d11: set the video context in the picture context
  d3d9: set the video context in the picture context
  vaapi: set the video context in the picture context
  filter_chain: add function to get the current output video context
  video_output: use the intermediate output video context to init the
    next chain
  transcode: use the intermediate video context between filter chains
  chroma: chain: set the output vctx from the internal filter chain
    output vctx
  nvdec: don't keep the decoder_device_nvdec_t in the picture context
  dxva2_deinterlace: init the IDirect3DDevice9 from the video context
  d3d11_deinterlace: only create the module with a valid input video
    context
  vaapi: filters: set the output video context
  vaapi: create VAAPI pools with a video context

 include/vlc_filter.h                          | 18 +++++++-
 include/vlc_picture.h                         |  4 ++
 modules/codec/avcodec/d3d11va.c               |  6 ++-
 modules/codec/avcodec/dxva2.c                 |  5 ++-
 modules/codec/avcodec/vaapi.c                 |  1 +
 modules/hw/d3d11/d3d11_deinterlace.c          | 42 ++++++++++---------
 modules/hw/d3d11/d3d11_surface.c              |  1 +
 modules/hw/d3d9/dxa9.c                        |  1 +
 modules/hw/d3d9/dxva2_deinterlace.c           | 24 +++++++----
 modules/hw/nvdec/chroma.c                     | 10 ++---
 modules/hw/nvdec/nvdec.c                      |  3 --
 modules/hw/nvdec/nvdec_fmt.h                  |  3 --
 modules/hw/vaapi/chroma.c                     |  8 +++-
 modules/hw/vaapi/filters.c                    |  5 ++-
 modules/hw/vaapi/vlc_vaapi.c                  |  9 ++--
 modules/hw/vaapi/vlc_vaapi.h                  |  2 +-
 modules/stream_out/mosaic_bridge.c            |  2 +-
 modules/stream_out/sdi/SDIStream.cpp          |  7 ++--
 modules/stream_out/sdi/SDIStream.hpp          |  2 +-
 modules/stream_out/transcode/video.c          | 16 ++++---
 modules/video_chroma/chain.c                  | 21 +++++++---
 modules/video_filter/canvas.c                 |  2 +-
 modules/video_filter/edgedetection.c          |  2 +-
 modules/video_output/opengl/converter_vaapi.c | 11 ++---
 src/libvlccore.sym                            |  1 +
 src/misc/filter_chain.c                       | 28 ++++++++++++-
 src/misc/picture.c                            | 11 +++++
 src/video_output/display.c                    | 13 +++++-
 src/video_output/video_output.c               | 36 ++++++++++++----
 src/video_output/vout_internal.h              |  1 +
 30 files changed, 207 insertions(+), 88 deletions(-)

-- 
2.17.1



More information about the vlc-devel mailing list