From 742bc7eea84a1cfb804f0e92f202dbe9d653f930 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 12 Mar 2015 15:35:05 -0300 Subject: [PATCH] hevcdsp: fix compilation for arm and aarch64 Also add av_cold to ff_hevcdsp_init_arm. Signed-off-by: James Almer Signed-off-by: Michael Niedermayer (cherry picked from commit d5addf1555024aebf13b37fbca9fb8d0f4f656ca) Signed-off-by: Michael Niedermayer --- libavcodec/arm/Makefile | 1 + libavcodec/arm/hevcdsp_arm.h | 26 ++++++++++++++++++++++++ libavcodec/arm/hevcdsp_init_arm.c | 32 ++++++++++++++++++++++++++++++ libavcodec/arm/hevcdsp_init_neon.c | 13 ++---------- libavcodec/hevcdsp.c | 2 +- 5 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 libavcodec/arm/hevcdsp_arm.h create mode 100644 libavcodec/arm/hevcdsp_init_arm.c diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index 1fea3b83d9..2f8739691e 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -37,6 +37,7 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \ arm/flacdsp_arm.o OBJS-$(CONFIG_FLAC_ENCODER) += arm/flacdsp_init_arm.o +OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o OBJS-$(CONFIG_VC1_DECODER) += arm/vc1dsp_init_arm.o OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o diff --git a/libavcodec/arm/hevcdsp_arm.h b/libavcodec/arm/hevcdsp_arm.h new file mode 100644 index 0000000000..7735df9cd2 --- /dev/null +++ b/libavcodec/arm/hevcdsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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 AVCODEC_ARM_HEVCDSP_ARM_H +#define AVCODEC_ARM_HEVCDSP_ARM_H + +#include "libavcodec/hevcdsp.h" + +void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth); + +#endif /* AVCODEC_ARM_HEVCDSP_ARM_H */ diff --git a/libavcodec/arm/hevcdsp_init_arm.c b/libavcodec/arm/hevcdsp_init_arm.c new file mode 100644 index 0000000000..adcc454511 --- /dev/null +++ b/libavcodec/arm/hevcdsp_init_arm.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014 Seppo Tomperi + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/hevcdsp.h" +#include "hevcdsp_arm.h" + +av_cold void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_hevcdsp_init_neon(c, bit_depth); +} diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c index 61e6462cbd..55918077e2 100644 --- a/libavcodec/arm/hevcdsp_init_neon.c +++ b/libavcodec/arm/hevcdsp_init_neon.c @@ -21,6 +21,7 @@ #include "libavutil/attributes.h" #include "libavutil/arm/cpu.h" #include "libavcodec/hevcdsp.h" +#include "hevcdsp_arm.h" void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); @@ -141,9 +142,8 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); } -static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) +av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) { -#if HAVE_NEON if (bit_depth == 8) { int x; c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_neon; @@ -221,13 +221,4 @@ static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; } -#endif // HAVE_NEON -} - -void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth) -{ - int cpu_flags = av_get_cpu_flags(); - - if (have_neon(cpu_flags)) - hevcdsp_init_neon(c, bit_depth); } diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c index b7a4729c02..04af178e11 100644 --- a/libavcodec/hevcdsp.c +++ b/libavcodec/hevcdsp.c @@ -259,6 +259,6 @@ int i = 0; if (ARCH_X86) ff_hevc_dsp_init_x86(hevcdsp, bit_depth); - if (HAVE_NEON) + if (ARCH_ARM) ff_hevcdsp_init_arm(hevcdsp, bit_depth); }