[FFmpeg-devel] [PATCH 0/7] [RFC] x86 assembly constants

James Darnley james.darnley at gmail.com
Fri Oct 2 19:08:27 CEST 2015


So... big patches.

A little history first.  Last time I was writing some assembly it was sugested
that I reuse existing constants in my code.  I would have except that the
suggestion was to use the ones in avcodec but I was working in avfilter.  IIRC
we are not allowed to share data like that across libraries.  At the time I said
that I had an idea about deduplicating the constants.  This is the much delayed
result.

In the first patch I propose a macro for defining global constants.  It ensures
that the name is properly mangled by reusing the macros from the x264asm layer.
It also ensures that they are aligned to 32-byte addresses.  I will annotate a
few comments into that email.

The second patch replaces the old C file and the constants within with these new
assembly ones.

The third patch uses them in the remaining inline assembly.

The following patches adds the constants to avcodec, avfilter, and swscale.  I
briefly checked the other libs for places to use this but didn't find any.

NOTE: I had to make one-line files including the file from avutil because I
couldn't force make to build constants.o across the library boundaries. If
someone can show me how to do that it would eliminate those almost pointless
files.

-- 


James Darnley (7):
  avutil: add shared assembly constants
  avcodec: replace old C file with new assembly constants
  avcodec: use new constants in C inline assembly
  avcodec: use new constants in assembly
  avfilter: use new constants in assembly
  swscale: use new constants in assembly
  fixup! avfilter: use new constants in assembly

 libavcodec/x86/Makefile                 |  2 +-
 libavcodec/x86/ac3dsp.asm               |  2 +-
 libavcodec/x86/bswapdsp.asm             |  3 +-
 libavcodec/x86/cavsdsp.c                |  2 +-
 libavcodec/x86/constants.asm            |  1 +
 libavcodec/x86/constants.c              | 81 -----------------------------
 libavcodec/x86/constants.h              | 66 -----------------------
 libavcodec/x86/diracdsp_yasm.asm        |  6 +--
 libavcodec/x86/dwt_yasm.asm             |  6 +--
 libavcodec/x86/h263_loopfilter.asm      |  2 +-
 libavcodec/x86/h264_chromamc.asm        |  6 +--
 libavcodec/x86/h264_chromamc_10bit.asm  |  8 +--
 libavcodec/x86/h264_deblock.asm         |  5 +-
 libavcodec/x86/h264_deblock_10bit.asm   |  5 +-
 libavcodec/x86/h264_idct.asm            |  4 +-
 libavcodec/x86/h264_idct_10bit.asm      |  2 +-
 libavcodec/x86/h264_intrapred.asm       | 10 +---
 libavcodec/x86/h264_intrapred_10bit.asm |  8 +--
 libavcodec/x86/h264_qpel_10bit.asm      |  5 +-
 libavcodec/x86/h264_qpel_8bit.asm       |  7 +--
 libavcodec/x86/h264_weight_10bit.asm    |  3 +-
 libavcodec/x86/hevc_deblock.asm         |  7 +--
 libavcodec/x86/hevc_mc.asm              | 10 +---
 libavcodec/x86/hevc_res_add.asm         |  2 +-
 libavcodec/x86/hevc_sao.asm             |  3 +-
 libavcodec/x86/hevc_sao_10bit.asm       |  4 +-
 libavcodec/x86/hpeldsp.asm              |  4 +-
 libavcodec/x86/huffyuvdsp.asm           |  2 +-
 libavcodec/x86/idctdsp.asm              |  5 +-
 libavcodec/x86/inline_asm.h             |  2 +-
 libavcodec/x86/me_cmp.asm               |  6 +--
 libavcodec/x86/mpegvideoencdsp.asm      |  5 +-
 libavcodec/x86/pngdsp.asm               |  5 +-
 libavcodec/x86/proresdsp.asm            |  6 +--
 libavcodec/x86/qpeldsp.asm              |  9 +---
 libavcodec/x86/rv40dsp.asm              |  6 +--
 libavcodec/x86/v210enc.asm              |  4 +-
 libavcodec/x86/vc1dsp.asm               |  4 +-
 libavcodec/x86/vc1dsp_mmx.c             |  2 +-
 libavcodec/x86/vp3dsp.asm               |  8 +--
 libavcodec/x86/vp6dsp.asm               |  3 +-
 libavcodec/x86/vp8dsp.asm               |  6 +--
 libavcodec/x86/vp8dsp_loopfilter.asm    |  8 +--
 libavcodec/x86/vp9intrapred.asm         | 17 +-----
 libavcodec/x86/vp9itxfm.asm             |  9 +---
 libavcodec/x86/vp9lpf.asm               |  7 +--
 libavcodec/x86/vp9mc.asm                |  4 +-
 libavcodec/x86/vp9mc_16bpp.asm          |  3 +-
 libavfilter/x86/Makefile                |  2 +
 libavfilter/x86/af_volume.asm           |  3 +-
 libavfilter/x86/constants.asm           |  1 +
 libavfilter/x86/vf_fspp.asm             |  3 +-
 libavfilter/x86/vf_removegrain.asm      |  3 +-
 libavfilter/x86/vf_ssim.asm             |  2 +-
 libavfilter/x86/vf_yadif.asm            |  6 +--
 libavfilter/x86/yadif-10.asm            |  5 +-
 libavfilter/x86/yadif-16.asm            |  3 +-
 libavutil/x86/constants.asm             | 92 +++++++++++++++++++++++++++++++++
 libavutil/x86/constants.h               | 46 +++++++++++++++++
 libavutil/x86/constants.inc             | 39 ++++++++++++++
 libswscale/x86/Makefile                 |  1 +
 libswscale/x86/constants.asm            |  1 +
 libswscale/x86/output.asm               |  5 +-
 tests/ref/fate/source                   |  4 ++
 64 files changed, 240 insertions(+), 361 deletions(-)
 create mode 100644 libavcodec/x86/constants.asm
 delete mode 100644 libavcodec/x86/constants.c
 delete mode 100644 libavcodec/x86/constants.h
 create mode 100644 libavfilter/x86/constants.asm
 create mode 100644 libavutil/x86/constants.asm
 create mode 100644 libavutil/x86/constants.h
 create mode 100644 libavutil/x86/constants.inc
 create mode 100644 libswscale/x86/constants.asm

-- 
2.5.3



More information about the ffmpeg-devel mailing list