[FFmpeg-devel] [PATCH 1/3] avfilter/vf_framerate: factorize SAD functions which compute SAD for a whole frame

Marton Balint cus at passwd.hu
Sun Nov 4 19:45:08 EET 2018


On Sun, 4 Nov 2018, James Almer wrote:

> On 11/4/2018 9:06 AM, Marton Balint wrote:
>> Also add SIMD which works on lines because it is faster then calculating it on
>> 8x8 blocks using pixelutils.
>> 
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  configure                        |  3 +-
>>  libavfilter/Makefile             |  1 +
>>  libavfilter/framerate.h          |  4 +--
>>  libavfilter/scene_sad.c          | 72 ++++++++++++++++++++++++++++++++++++++
>>  libavfilter/scene_sad.h          | 44 ++++++++++++++++++++++++
>>  libavfilter/vf_framerate.c       | 61 ++++-----------------------------
>>  libavfilter/x86/Makefile         |  4 +++
>>  libavfilter/x86/scene_sad.asm    | 74 ++++++++++++++++++++++++++++++++++++++++
>>  libavfilter/x86/scene_sad_init.c | 52 ++++++++++++++++++++++++++++
>>  9 files changed, 257 insertions(+), 58 deletions(-)
>>  create mode 100644 libavfilter/scene_sad.c
>>  create mode 100644 libavfilter/scene_sad.h
>>  create mode 100644 libavfilter/x86/scene_sad.asm
>>  create mode 100644 libavfilter/x86/scene_sad_init.c
>> 
>> diff --git a/configure b/configure
>> index 2606b885b0..f5bec9fd62 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2335,6 +2335,7 @@ CONFIG_EXTRA="
>>      rtpdec
>>      rtpenc_chain
>>      rv34dsp
>> +    scene_sad
>>      sinewin
>>      snappy
>>      srtp
>> @@ -3395,7 +3396,7 @@ find_rect_filter_deps="avcodec avformat gpl"
>>  firequalizer_filter_deps="avcodec"
>>  firequalizer_filter_select="rdft"
>>  flite_filter_deps="libflite"
>> -framerate_filter_select="pixelutils"
>> +framerate_filter_select="scene_sad"
>>  frei0r_filter_deps="frei0r libdl"
>>  frei0r_src_filter_deps="frei0r libdl"
>>  fspp_filter_deps="gpl"
>> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> index 51e48efc2e..390c2b7997 100644
>> --- a/libavfilter/Makefile
>> +++ b/libavfilter/Makefile
>> @@ -28,6 +28,7 @@ OBJS-$(HAVE_THREADS)                         += pthread.o
>>  OBJS-$(CONFIG_QSVVPP)                        += qsvvpp.o
>>  DNN-OBJS-$(CONFIG_LIBTENSORFLOW)             += dnn_backend_tf.o
>>  OBJS-$(CONFIG_DNN)                           += dnn_interface.o dnn_backend_native.o $(DNN-OBJS-yes)
>> +OBJS-$(CONFIG_SCENE_SAD)                     += scene_sad.o
>>
>>  # audio filters
>>  OBJS-$(CONFIG_ABENCH_FILTER)                 += f_bench.o
>
> Can't you expand pixeutils instead? Adding a new set of functions that
> work on lines rather than blocks.

That is kind of intentional, because it is only used by libavfilter, so I 
did not want to bloat libavutil with it. Also if I put it into libavutil 
then the interfaces have to be public. I tried to avoid that because for a 
generic scene SAD function bitdepth is not enough, you need endianness, 
float/int color support, etc. Public API should be finalized when 
something actually uses it IMHO.

Regards,
Marton


More information about the ffmpeg-devel mailing list