[FFmpeg-devel] [PATCH 1/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions

Michael Niedermayer michaelni at gmx.at
Thu Jun 11 00:31:50 CEST 2015


On Wed, Jun 10, 2015 at 07:48:38PM +0530, shivraj.patil at imgtec.com wrote:
> From: Shivraj Patil <shivraj.patil at imgtec.com>
> 
> This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions in new file h264chroma_msa.c
> Adds new generic macros (needed for this patch) in libavutil/mips/generic_macros_msa.h
> 
> Signed-off-by: Shivraj Patil <shivraj.patil at imgtec.com>
> ---
>  libavcodec/mips/Makefile               |    1 +
>  libavcodec/mips/h264chroma_init_mips.c |   21 +
>  libavcodec/mips/h264chroma_mips.h      |   12 +
>  libavcodec/mips/h264chroma_msa.c       | 2003 ++++++++++++++++++++++++++++++++
>  libavutil/mips/generic_macros_msa.h    |   56 +
>  5 files changed, 2093 insertions(+)
>  create mode 100644 libavcodec/mips/h264chroma_msa.c
> 
> diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
> index 82d1d70..aa98774 100644
> --- a/libavcodec/mips/Makefile
> +++ b/libavcodec/mips/Makefile
> @@ -31,5 +31,6 @@ MSA-OBJS-$(CONFIG_HEVC_DECODER)           += mips/hevcdsp_msa.o            \
>                                               mips/hevc_lpf_sao_msa.o       \
>                                               mips/hevcpred_msa.o
>  MSA-OBJS-$(CONFIG_H264DSP)                += mips/h264dsp_msa.o
> +MSA-OBJS-$(CONFIG_H264CHROMA)             += mips/h264chroma_msa.o
>  LOONGSON3-OBJS-$(CONFIG_H264DSP)          += mips/h264dsp_mmi.o
>  LOONGSON3-OBJS-$(CONFIG_H264CHROMA)       += mips/h264chroma_mmi.o
> diff --git a/libavcodec/mips/h264chroma_init_mips.c b/libavcodec/mips/h264chroma_init_mips.c
> index 4c10da7..1cc5767 100644
> --- a/libavcodec/mips/h264chroma_init_mips.c
> +++ b/libavcodec/mips/h264chroma_init_mips.c
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong at loongson.cn>
> + * Copyright (c) 2015 Shivraj Patil (Shivraj.Patil at imgtec.com)
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -20,6 +21,23 @@
>  
>  #include "h264chroma_mips.h"
>  
> +#if HAVE_MSA
> +static av_cold void h264chroma_init_msa(H264ChromaContext *c, int bit_depth)
> +{
> +    const int high_bit_depth = bit_depth > 8;
> +
> +    if (!high_bit_depth) {
> +        c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_msa;
> +        c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_msa;
> +        c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_msa;
> +
> +        c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_msa;
> +        c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_msa;
> +        c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_msa;
> +    }
> +}
> +#endif  // #if HAVE_MSA
> +
>  #if HAVE_LOONGSON3
>  static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth)
>  {
> @@ -36,6 +54,9 @@ static av_cold void h264chroma_init_mmi(H264ChromaContext *c, int bit_depth)
>  
>  av_cold void ff_h264chroma_init_mips(H264ChromaContext *c, int bit_depth)
>  {
> +#if HAVE_MSA
> +    h264chroma_init_msa(c, bit_depth);
> +#endif  // #if HAVE_MSA
>  #if HAVE_LOONGSON3
>      h264chroma_init_mmi(c, bit_depth);
>  #endif /* HAVE_LOONGSON3 */
> diff --git a/libavcodec/mips/h264chroma_mips.h b/libavcodec/mips/h264chroma_mips.h
> index 314e8a3..7a373b8 100644
> --- a/libavcodec/mips/h264chroma_mips.h
> +++ b/libavcodec/mips/h264chroma_mips.h
> @@ -22,6 +22,18 @@
>  #define H264_CHROMA_MIPS_H
>  
>  #include "libavcodec/h264.h"
> +void ff_put_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride,
> +                                int height, int x, int y);
> +void ff_put_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride,
> +                                int height, int x, int y);
> +void ff_put_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride,
> +                                int height, int x, int y);
> +void ff_avg_h264_chroma_mc8_msa(uint8_t *dst, uint8_t *src, int stride,
> +                                int height, int x, int y);
> +void ff_avg_h264_chroma_mc4_msa(uint8_t *dst, uint8_t *src, int stride,
> +                                int height, int x, int y);
> +void ff_avg_h264_chroma_mc2_msa(uint8_t *dst, uint8_t *src, int stride,
> +                                int height, int x, int y);
>  
>  void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, int stride,
>          int h, int x, int y);
> diff --git a/libavcodec/mips/h264chroma_msa.c b/libavcodec/mips/h264chroma_msa.c
> new file mode 100644
> index 0000000..3113ee8
> --- /dev/null
> +++ b/libavcodec/mips/h264chroma_msa.c
> @@ -0,0 +1,2003 @@
> +/*
> + * Copyright (c) 2015 Shivraj Patil (Shivraj.Patil at imgtec.com)
> + *
> + * 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
> + */
> +
> +#include "libavutil/mips/generic_macros_msa.h"
> +#include "h264chroma_mips.h"
> +
> +static uint8_t chroma_mask_arr[16 * 5] = {

static const

also please change the static tables in the MIPS MSA hevc code
similarly

thanks

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- 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/20150611/31b8a823/attachment.asc>


More information about the ffmpeg-devel mailing list