[vlc-devel] [PATCH 00/34] add video context to filters (v3)

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 8 15:40:04 CET 2019


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/68

Steve Lhomme (34):
  picture: add a video context to the picture
  picture_pool: add a video context to the pictures in the pool
  video context: add a function to test if 2 context are similar
  d3d11: add a video context similarity check callback
  d3d9: add a video context similarity check callback
  avcodec: vdpau: add a video context similarity check callback
  video output: only update the current format if filters were added in
    the chain
  video output: rename the filters input format with a less generic name
  video_output: pass the input video context with the source format
  filter_chain: clarify how allowing output format chain works
  filter_chain: no need to reset the fmt_out each time a filter is added
  video_output: "reset" the the blender converter before adding a filter
  filter_chain: set NULL on AppendConverter when value is implied by
    previous call
  filter_chain: remove always NULL parameter from AppendConverter
  filter_chain: set NULL on AppendFilter when value is implied by
    previous call
  filter_chain: remove always NULL parameter from AppendFilter
  filter_chain: removing always NULL parameters in internal calls
  filters: set the input/output video context on video filters
  sout: sdi: keep the decoder video context locally
  display: keep the video context to feed the converter locally
  filter_chain: add function to get the current output video context
  filter_chain: keep the input video context on Reset
  video output: prepare code to add conversion filter if vctx don't
    match
  chroma: chain: set the output vctx from the internal filter chain
    output vctx
  nvdec: check the input video context of filters matches the NVDEC
    chromas
  d3d11: check the input video context of filters matches the D3D11
    chromas
  d3d9: check the input video context of filters matches the D3D9
    chromas
  vdpau: check the input video context of filters matches the VDPAU
    chromas
  vaapi: check the input video context of filters matches the VAAPI
    chromas
  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                          | 24 +++++--
 include/vlc_picture.h                         | 25 ++++++-
 include/vlc_picture_pool.h                    |  2 +
 modules/codec/qsv.c                           |  2 +-
 modules/codec/vt_utils.c                      |  2 +-
 modules/hw/d3d11/d3d11_deinterlace.c          | 44 +++++++------
 modules/hw/d3d11/d3d11_filters.c              |  3 +
 modules/hw/d3d11/d3d11_surface.c              |  5 +-
 modules/hw/d3d9/d3d9_filters.c                |  3 +
 modules/hw/d3d9/dxa9.c                        |  5 +-
 modules/hw/d3d9/dxva2_deinterlace.c           | 26 +++++---
 modules/hw/mmal/vout.c                        |  2 +-
 modules/hw/nvdec/chroma.c                     | 13 ++--
 modules/hw/nvdec/nvdec.c                      |  5 +-
 modules/hw/nvdec/nvdec_fmt.h                  |  3 -
 modules/hw/vaapi/chroma.c                     |  8 ++-
 modules/hw/vaapi/filters.c                    |  7 +-
 modules/hw/vaapi/vlc_vaapi.c                  | 11 ++--
 modules/hw/vaapi/vlc_vaapi.h                  |  2 +-
 modules/hw/vdpau/adjust.c                     |  3 +
 modules/hw/vdpau/avcodec.c                    |  9 ++-
 modules/hw/vdpau/deinterlace.c                |  3 +
 modules/hw/vdpau/picture.c                    |  2 +-
 modules/hw/vdpau/sharpen.c                    |  3 +
 modules/stream_out/mosaic_bridge.c            |  2 +-
 modules/stream_out/sdi/SDIStream.cpp          | 18 +++--
 modules/stream_out/sdi/SDIStream.hpp          |  2 +-
 modules/stream_out/transcode/video.c          | 24 ++++---
 modules/video_chroma/chain.c                  | 42 ++++++------
 modules/video_chroma/copy.c                   |  2 +-
 modules/video_chroma/d3d11_fmt.c              |  2 +-
 modules/video_chroma/d3d11_fmt.h              |  7 ++
 modules/video_chroma/d3d9_fmt.c               |  2 +-
 modules/video_chroma/d3d9_fmt.h               |  7 ++
 modules/video_filter/canvas.c                 |  4 +-
 modules/video_filter/edgedetection.c          |  2 +-
 modules/video_output/android/display.c        |  2 +-
 modules/video_output/fb.c                     |  2 +-
 modules/video_output/kms.c                    |  2 +-
 .../video_output/opengl/converter_android.c   |  2 +-
 modules/video_output/opengl/converter_sw.c    |  2 +-
 modules/video_output/opengl/converter_vaapi.c | 11 ++--
 modules/video_output/vmem.c                   |  2 +-
 modules/video_output/win32/direct3d11.c       |  4 +-
 modules/video_output/win32/direct3d9.c        |  2 +-
 src/input/decoder.c                           |  1 +
 src/input/decoder_helpers.c                   | 16 +++++
 src/libvlccore.sym                            |  4 +-
 src/misc/filter_chain.c                       | 64 +++++++++++-------
 src/misc/picture.c                            | 18 ++++-
 src/misc/picture_pool.c                       |  5 +-
 src/test/picture_pool.c                       |  4 +-
 src/video_output/display.c                    | 17 +++--
 src/video_output/video_output.c               | 65 +++++++++++++------
 src/video_output/vout_internal.h              |  3 +-
 src/video_output/vout_wrapper.c               |  2 +-
 56 files changed, 377 insertions(+), 177 deletions(-)

-- 
2.17.1



More information about the vlc-devel mailing list