mbox series

[FFmpeg-devel,00/39] Make mpegvideo encoders init-threadsafe

Message ID 20201210111657.2276739-1-andreas.rheinhardt@gmail.com
Headers show
Series Make mpegvideo encoders init-threadsafe
Related show

Message

Andreas Rheinhardt Dec. 10, 2020, 11:16 a.m. UTC
This patchset makes all mpegvideo encoders (i.e. all those that use
ff_mpv_encode_init()) init-threadsafe; some of the patches here
supersede earlier patches (namely #214-216 from my earlier
init-threadsafe patchset [1] as well as patches from the latter part of
my init-vlc patchset (said part actually dealt with init-threadsafety),
namely #181-183 [2]); also an error in [3] (which was not applied
because of this) is corrected (the earlier patch ignored that the
RLTables used by mpeg1/2 are initialized at two different places, so
guarding one of them with an AVOnce is not enough).

In order to make this patchset self-contained [4] from my earlier
init-threadsafe patchset has been included here unchanged.
 
Furthermore, there are also numerous fixes for RLTables interwoven in
this patchset.

Finally, the SpeedHQ encoder has also received attention. It called the
wrong function, leading to potential segfaults.
 
The mpegvideo decoders are my next target.
 
[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/273287.html
[2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/272876.html
[3]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/272873.html
[4]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/273286.html

Andreas Rheinhardt (39):
  avcodec/rl: Remove nonstatic storage of RL tables
  avcodec/mpeg12: Don't initialize encoder-only parts of RLTable
  avcodec/mpeg12: Make initializing VLCs thread-safe
  avcodec/mpeg12: Reindentation
  avcodec/mpeg12enc, speedhqenc: Avoid redundant copies of tables
  avcodec/speedhq: Remove cast
  avcodec/rl: Allow to create only a few VLC tables
  avcodec/h261dec: Don't initialize unused VLCs
  avcodec/msmpeg4dec: Don't initialize unused RL VLCs
  avcodec/mpeg4videodec: Don't initialize unused RL VLCs
  avcodec/ituh263dec: Don't initialize unused RL VLCs
  avcodec/msmpeg4dec: Reuse identical RL VLCs
  avcodec/msmpeg4dec: Reuse identical MV VLC
  avcodec/h261dec: Don't use too big max_depth in get_vlc2()
  avcodec/mpegvideo: Merge ff_mpv_decode_defaults into
    ff_mpv_decode_init
  avcodec/mpeg12dec: Remove redundant writes
  avcodec/me_cmp: Remove ff_check_alignment()
  avcodec/motion_est, mpegvideo: Make pointers to static storage const
  avcodec/mpegvideo_enc: Make mpv_encode_defaults thread-safe
  avcodec/h261dec: Don't initialize unused part of RLTable
  avcodec/h261dec: Make decoder init-threadsafe
  avcodec/h261dec: Reindentation
  avcodec/h261enc: Make encoder init-threadsafe
  avcodec/ituh263dec: Don't initialize unused parts of RLTable
  avcodec/ituh263enc: Remove unused function parameter
  avcodec/h263data, ituh263*: Make initializing RL inter table
    thread-safe
  avcodec/ituh263enc: Make static initializations thread-safe
  avcodec/mpeg4video: Making initializing RLTable thread-safe
  avcodec/mpeg4videoenc: Make encoder init-threadsafe
  avcodec/msmpeg4: Make ff_msmpeg4_common_init() thread-safe
  avcodec/msmpeg4: Reindentation
  avcodec/msmpeg4enc: Don't use code for static init that can fail
  avcodec/msmpeg4: Factor out common RLTable initialization code
  avcodec/msmpeg4enc: Make msmpeg4 encoders init-threadsafe
  avcodec/msmpeg4enc: Reindent after the last commit
  avcodec/speedhqenc: Call correct function
  avcodec/speedhq, speedhqenc: Make codecs init-threadsafe
  avcodec/speedhqenc: Hardcode table to save space
  configure, libavcodec/speedhq: Fix compiling SpeedHQ encoder

 configure                        |   1 +
 libavcodec/Makefile              |   2 +-
 libavcodec/eamad.c               |   1 +
 libavcodec/eatqi.c               |   1 +
 libavcodec/flvenc.c              |   2 +-
 libavcodec/h261.c                |  13 ----
 libavcodec/h261.h                |   3 -
 libavcodec/h261dec.c             |  45 ++++++-------
 libavcodec/h261enc.c             |  16 +++--
 libavcodec/h263.h                |   2 +
 libavcodec/h263data.c            |  16 ++++-
 libavcodec/h263data.h            |   2 +-
 libavcodec/h263dec.c             |   1 -
 libavcodec/ituh263dec.c          |  12 ++--
 libavcodec/ituh263enc.c          |  39 +++++------
 libavcodec/mdec.c                |   1 +
 libavcodec/me_cmp.c              |  23 -------
 libavcodec/me_cmp.h              |   2 -
 libavcodec/mjpegenc.c            |   4 +-
 libavcodec/motion_est.c          |  12 ++--
 libavcodec/motion_est.h          |   4 +-
 libavcodec/motion_est_template.c |   2 +-
 libavcodec/mpeg12.c              |  67 +++++++++----------
 libavcodec/mpeg12.h              |   3 +-
 libavcodec/mpeg12dec.c           |  17 ++---
 libavcodec/mpeg12enc.c           |  31 +++++----
 libavcodec/mpeg4video.c          |  14 +++-
 libavcodec/mpeg4video.h          |   3 +-
 libavcodec/mpeg4videodec.c       |  12 ++--
 libavcodec/mpeg4videoenc.c       |  26 ++++----
 libavcodec/mpegvideo.c           |   7 +-
 libavcodec/mpegvideo.h           |   3 +-
 libavcodec/mpegvideo_enc.c       |  34 +++++-----
 libavcodec/msmpeg4.c             | 110 +++++++++++++++++--------------
 libavcodec/msmpeg4.h             |   2 +-
 libavcodec/msmpeg4data.c         |   1 -
 libavcodec/msmpeg4data.h         |   1 -
 libavcodec/msmpeg4dec.c          |  23 +++----
 libavcodec/msmpeg4enc.c          |  63 ++++++++----------
 libavcodec/rl.c                  |  53 ++++-----------
 libavcodec/rl.h                  |  19 +++---
 libavcodec/rv10.c                |   1 -
 libavcodec/rv10enc.c             |   2 +-
 libavcodec/rv20enc.c             |   2 +-
 libavcodec/rv34.c                |   1 -
 libavcodec/speedhq.c             |   9 +--
 libavcodec/speedhqenc.c          |  47 ++++---------
 libavcodec/wmv2enc.c             |   2 +-
 48 files changed, 339 insertions(+), 418 deletions(-)