]> git.sesse.net Git - ffmpeg/blob - libavcodec/arm/hevcdsp_init_neon.c
Merge commit '42c8f92e2fa390fa17b03d37b4323ec0d721d4cd'
[ffmpeg] / libavcodec / arm / hevcdsp_init_neon.c
1 /*
2  * Copyright (c) 2014 Seppo Tomperi <seppo.tomperi@vtt.fi>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include "libavutil/attributes.h"
22 #include "libavutil/arm/cpu.h"
23 #include "libavcodec/hevcdsp.h"
24
25 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);
26 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);
27 void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
28 void ff_hevc_h_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
29 void ff_hevc_transform_4x4_neon_8(int16_t *coeffs, int col_limit);
30 void ff_hevc_transform_8x8_neon_8(int16_t *coeffs, int col_limit);
31 void ff_hevc_idct_4x4_dc_neon_8(int16_t *coeffs);
32 void ff_hevc_idct_8x8_dc_neon_8(int16_t *coeffs);
33 void ff_hevc_idct_16x16_dc_neon_8(int16_t *coeffs);
34 void ff_hevc_idct_32x32_dc_neon_8(int16_t *coeffs);
35 void ff_hevc_transform_luma_4x4_neon_8(int16_t *coeffs);
36 void ff_hevc_transform_add_4x4_neon_8(uint8_t *_dst, int16_t *coeffs,
37                                       ptrdiff_t stride);
38 void ff_hevc_transform_add_8x8_neon_8(uint8_t *_dst, int16_t *coeffs,
39                                       ptrdiff_t stride);
40 void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs,
41                                       ptrdiff_t stride);
42 void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs,
43                                       ptrdiff_t stride);
44
45 static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth)
46 {
47 #if HAVE_NEON
48     if (bit_depth == 8) {
49         c->hevc_v_loop_filter_luma     = ff_hevc_v_loop_filter_luma_neon;
50         c->hevc_h_loop_filter_luma     = ff_hevc_h_loop_filter_luma_neon;
51         c->hevc_v_loop_filter_chroma   = ff_hevc_v_loop_filter_chroma_neon;
52         c->hevc_h_loop_filter_chroma   = ff_hevc_h_loop_filter_chroma_neon;
53         c->idct[0]                     = ff_hevc_transform_4x4_neon_8;
54         c->idct[1]                     = ff_hevc_transform_8x8_neon_8;
55         c->idct_dc[0]                  = ff_hevc_idct_4x4_dc_neon_8;
56         c->idct_dc[1]                  = ff_hevc_idct_8x8_dc_neon_8;
57         c->idct_dc[2]                  = ff_hevc_idct_16x16_dc_neon_8;
58         c->idct_dc[3]                  = ff_hevc_idct_32x32_dc_neon_8;
59         c->transform_add[0]            = ff_hevc_transform_add_4x4_neon_8;
60         c->transform_add[1]            = ff_hevc_transform_add_8x8_neon_8;
61         c->transform_add[2]            = ff_hevc_transform_add_16x16_neon_8;
62         c->transform_add[3]            = ff_hevc_transform_add_32x32_neon_8;
63         c->idct_4x4_luma               = ff_hevc_transform_luma_4x4_neon_8;
64     }
65 #endif // HAVE_NEON
66 }
67
68 void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth)
69 {
70     int cpu_flags = av_get_cpu_flags();
71
72     if (have_neon(cpu_flags))
73         hevcdsp_init_neon(c, bit_depth);
74 }