yading@10
|
1 /*
|
yading@10
|
2 * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
|
yading@10
|
3 *
|
yading@10
|
4 * This file is part of FFmpeg.
|
yading@10
|
5 *
|
yading@10
|
6 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
7 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
8 * License as published by the Free Software Foundation; either
|
yading@10
|
9 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
10 *
|
yading@10
|
11 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
14 * Lesser General Public License for more details.
|
yading@10
|
15 *
|
yading@10
|
16 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
17 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
19 */
|
yading@10
|
20
|
yading@10
|
21 #include <stdint.h>
|
yading@10
|
22
|
yading@10
|
23 #include "libavutil/attributes.h"
|
yading@10
|
24 #include "libavutil/arm/cpu.h"
|
yading@10
|
25 #include "libavcodec/h264dsp.h"
|
yading@10
|
26
|
yading@10
|
27 void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
yading@10
|
28 int beta, int8_t *tc0);
|
yading@10
|
29 void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
yading@10
|
30 int beta, int8_t *tc0);
|
yading@10
|
31 void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
yading@10
|
32 int beta, int8_t *tc0);
|
yading@10
|
33 void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
yading@10
|
34 int beta, int8_t *tc0);
|
yading@10
|
35
|
yading@10
|
36 void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height,
|
yading@10
|
37 int log2_den, int weight, int offset);
|
yading@10
|
38 void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height,
|
yading@10
|
39 int log2_den, int weight, int offset);
|
yading@10
|
40 void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height,
|
yading@10
|
41 int log2_den, int weight, int offset);
|
yading@10
|
42
|
yading@10
|
43 void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride,
|
yading@10
|
44 int height, int log2_den, int weightd,
|
yading@10
|
45 int weights, int offset);
|
yading@10
|
46 void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride,
|
yading@10
|
47 int height, int log2_den, int weightd,
|
yading@10
|
48 int weights, int offset);
|
yading@10
|
49 void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride,
|
yading@10
|
50 int height, int log2_den, int weightd,
|
yading@10
|
51 int weights, int offset);
|
yading@10
|
52
|
yading@10
|
53 void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
|
yading@10
|
54 void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
|
yading@10
|
55 void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
|
yading@10
|
56 int16_t *block, int stride,
|
yading@10
|
57 const uint8_t nnzc[6*8]);
|
yading@10
|
58 void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
|
yading@10
|
59 int16_t *block, int stride,
|
yading@10
|
60 const uint8_t nnzc[6*8]);
|
yading@10
|
61 void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
|
yading@10
|
62 int16_t *block, int stride,
|
yading@10
|
63 const uint8_t nnzc[6*8]);
|
yading@10
|
64
|
yading@10
|
65 void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
|
yading@10
|
66 void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
|
yading@10
|
67 void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
|
yading@10
|
68 int16_t *block, int stride,
|
yading@10
|
69 const uint8_t nnzc[6*8]);
|
yading@10
|
70
|
yading@10
|
71 static av_cold void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth,
|
yading@10
|
72 const int chroma_format_idc)
|
yading@10
|
73 {
|
yading@10
|
74 #if HAVE_NEON
|
yading@10
|
75 if (bit_depth == 8) {
|
yading@10
|
76 c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
|
yading@10
|
77 c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
|
yading@10
|
78 if(chroma_format_idc == 1){
|
yading@10
|
79 c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
|
yading@10
|
80 c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
|
yading@10
|
81 }
|
yading@10
|
82
|
yading@10
|
83 c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;
|
yading@10
|
84 c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;
|
yading@10
|
85 c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;
|
yading@10
|
86
|
yading@10
|
87 c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;
|
yading@10
|
88 c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;
|
yading@10
|
89 c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;
|
yading@10
|
90
|
yading@10
|
91 c->h264_idct_add = ff_h264_idct_add_neon;
|
yading@10
|
92 c->h264_idct_dc_add = ff_h264_idct_dc_add_neon;
|
yading@10
|
93 c->h264_idct_add16 = ff_h264_idct_add16_neon;
|
yading@10
|
94 c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
|
yading@10
|
95 if (chroma_format_idc == 1)
|
yading@10
|
96 c->h264_idct_add8 = ff_h264_idct_add8_neon;
|
yading@10
|
97 c->h264_idct8_add = ff_h264_idct8_add_neon;
|
yading@10
|
98 c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon;
|
yading@10
|
99 c->h264_idct8_add4 = ff_h264_idct8_add4_neon;
|
yading@10
|
100 }
|
yading@10
|
101 #endif // HAVE_NEON
|
yading@10
|
102 }
|
yading@10
|
103
|
yading@10
|
104 av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
|
yading@10
|
105 const int chroma_format_idc)
|
yading@10
|
106 {
|
yading@10
|
107 int cpu_flags = av_get_cpu_flags();
|
yading@10
|
108
|
yading@10
|
109 if (have_neon(cpu_flags))
|
yading@10
|
110 ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc);
|
yading@10
|
111 }
|