[FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API

Michael Niedermayer michaelni at gmx.at
Sat Aug 2 20:35:27 CEST 2014


On Sat, Aug 02, 2014 at 08:20:17PM +0200, Clément Bœsch wrote:
> ---
>  configure                       |   2 +
>  doc/APIchanges                  |   3 ++
>  libavutil/Makefile              |   2 +
>  libavutil/pixelutils.c          |  85 ++++++++++++++++++++++++++++++
>  libavutil/pixelutils.h          |  76 +++++++++++++++++++++++++++
>  libavutil/version.h             |   2 +-
>  libavutil/x86/Makefile          |   4 ++
>  libavutil/x86/pixelutils.asm    | 111 ++++++++++++++++++++++++++++++++++++++++
>  libavutil/x86/pixelutils.h      |  26 ++++++++++
>  libavutil/x86/pixelutils_init.c |  54 +++++++++++++++++++
>  10 files changed, 364 insertions(+), 1 deletion(-)
>  create mode 100644 libavutil/pixelutils.c
>  create mode 100644 libavutil/pixelutils.h
>  create mode 100644 libavutil/x86/pixelutils.asm
>  create mode 100644 libavutil/x86/pixelutils.h
>  create mode 100644 libavutil/x86/pixelutils_init.c
[...]
> diff --git a/libavutil/pixelutils.h b/libavutil/pixelutils.h
> new file mode 100644
> index 0000000..862d607
> --- /dev/null
> +++ b/libavutil/pixelutils.h
> @@ -0,0 +1,76 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVUTIL_PIXELUTILS_H
> +#define AVUTIL_PIXELUTILS_H
> +
> +#include <stddef.h>
> +#include <stdint.h>
> +#include "common.h"
> +
> +enum AVPixelUtilsBlockSize {
> +    // Warning: only add entries at the end for ABI compatibility.
> +    // Ideally, keep only squared dimensions in that enum.
> +    AV_PIXEL_BLOCKSZ_2x2,
> +    AV_PIXEL_BLOCKSZ_4x4,
> +    AV_PIXEL_BLOCKSZ_8x8,
> +    AV_PIXEL_BLOCKSZ_16x16,
> +    AV_PIXEL_BLOCKSZ_NB
> +};
> +
> +/**
> + * Sum of abs(src1[x] - src2[x])
> + */
> +typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1,
> +                                    const uint8_t *src2, ptrdiff_t stride2);
> +
> +typedef struct AVPixelUtils {
> +    /**
> +     * Sum of absolute differences block functions.
> +     * src1 and src2 addresses need to be aligned to the block size.
> +     */
> +    av_pixelutils_sad_fn sad[AV_PIXEL_BLOCKSZ_NB];
> +
> +    /**
> +     * Sum of absolute differences block functions, (half) unaligned version.
> +     * src1 address needs to be aligned to the block size.
> +     * src2 has no alignment requirement; the 'u' refers to this second source.
> +     */
> +    av_pixelutils_sad_fn sad_u[AV_PIXEL_BLOCKSZ_NB];

the ABI depends on AV_PIXEL_BLOCKSZ_NB with this design as the arrays
in the struct depend on its value so no enum values could be added

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140802/26f06cdb/attachment.asc>


More information about the ffmpeg-devel mailing list