Mercurial > libavcodec.hg
comparison arm/dsputil_arm.c @ 10359:48be79afc72d libavcodec
ARM: clean up dsputil initialisation
- Move v5 and v6 initialisation to separate files.
- Move NEON IDCT selection to ff_dsputil_init_neon()
author | mru |
---|---|
date | Sun, 04 Oct 2009 13:12:55 +0000 |
parents | 0905f8eed0a9 |
children |
comparison
equal
deleted
inserted
replaced
10358:028a4deb56d3 | 10359:48be79afc72d |
---|---|
18 * License along with FFmpeg; if not, write to the Free Software | 18 * License along with FFmpeg; if not, write to the Free Software |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 | 21 |
22 #include "libavcodec/dsputil.h" | 22 #include "libavcodec/dsputil.h" |
23 | 23 #include "dsputil_arm.h" |
24 void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx); | |
25 void ff_float_init_arm_vfp(DSPContext* c, AVCodecContext *avctx); | |
26 void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx); | |
27 | 24 |
28 void j_rev_dct_ARM(DCTELEM *data); | 25 void j_rev_dct_ARM(DCTELEM *data); |
29 void simple_idct_ARM(DCTELEM *data); | 26 void simple_idct_ARM(DCTELEM *data); |
30 | |
31 void simple_idct_armv5te(DCTELEM *data); | |
32 void simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data); | |
33 void simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data); | |
34 | |
35 void ff_simple_idct_armv6(DCTELEM *data); | |
36 void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data); | |
37 void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data); | |
38 | |
39 void ff_simple_idct_neon(DCTELEM *data); | |
40 void ff_simple_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data); | |
41 void ff_simple_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data); | |
42 | |
43 void ff_vp3_idct_neon(DCTELEM *data); | |
44 void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data); | |
45 void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data); | |
46 | 27 |
47 /* XXX: local hack */ | 28 /* XXX: local hack */ |
48 static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); | 29 static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); |
49 static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); | 30 static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); |
50 | 31 |
56 void put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); | 37 void put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
57 void put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); | 38 void put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
58 void put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); | 39 void put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
59 | 40 |
60 void put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); | 41 void put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
61 | |
62 void ff_prefetch_arm(void *mem, int stride, int h); | |
63 | 42 |
64 CALL_2X_PIXELS(put_pixels16_x2_arm , put_pixels8_x2_arm , 8) | 43 CALL_2X_PIXELS(put_pixels16_x2_arm , put_pixels8_x2_arm , 8) |
65 CALL_2X_PIXELS(put_pixels16_y2_arm , put_pixels8_y2_arm , 8) | 44 CALL_2X_PIXELS(put_pixels16_y2_arm , put_pixels8_y2_arm , 8) |
66 CALL_2X_PIXELS(put_pixels16_xy2_arm, put_pixels8_xy2_arm, 8) | 45 CALL_2X_PIXELS(put_pixels16_xy2_arm, put_pixels8_xy2_arm, 8) |
67 CALL_2X_PIXELS(put_no_rnd_pixels16_x2_arm , put_no_rnd_pixels8_x2_arm , 8) | 46 CALL_2X_PIXELS(put_no_rnd_pixels16_x2_arm , put_no_rnd_pixels8_x2_arm , 8) |
99 return HAVE_IWMMXT * FF_MM_IWMMXT; | 78 return HAVE_IWMMXT * FF_MM_IWMMXT; |
100 } | 79 } |
101 | 80 |
102 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) | 81 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) |
103 { | 82 { |
104 int idct_algo= avctx->idct_algo; | |
105 | |
106 ff_put_pixels_clamped = c->put_pixels_clamped; | 83 ff_put_pixels_clamped = c->put_pixels_clamped; |
107 ff_add_pixels_clamped = c->add_pixels_clamped; | 84 ff_add_pixels_clamped = c->add_pixels_clamped; |
108 | 85 |
109 if (avctx->lowres == 0) { | 86 if (avctx->lowres == 0) { |
110 if(idct_algo == FF_IDCT_AUTO){ | 87 if(avctx->idct_algo == FF_IDCT_AUTO || |
111 #if HAVE_NEON | 88 avctx->idct_algo == FF_IDCT_ARM){ |
112 idct_algo = FF_IDCT_SIMPLENEON; | |
113 #elif HAVE_ARMV6 | |
114 idct_algo = FF_IDCT_SIMPLEARMV6; | |
115 #elif HAVE_ARMV5TE | |
116 idct_algo = FF_IDCT_SIMPLEARMV5TE; | |
117 #else | |
118 idct_algo = FF_IDCT_ARM; | |
119 #endif | |
120 } | |
121 | |
122 if(idct_algo==FF_IDCT_ARM){ | |
123 c->idct_put= j_rev_dct_ARM_put; | 89 c->idct_put= j_rev_dct_ARM_put; |
124 c->idct_add= j_rev_dct_ARM_add; | 90 c->idct_add= j_rev_dct_ARM_add; |
125 c->idct = j_rev_dct_ARM; | 91 c->idct = j_rev_dct_ARM; |
126 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; | 92 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; |
127 } else if (idct_algo==FF_IDCT_SIMPLEARM){ | 93 } else if (avctx->idct_algo==FF_IDCT_SIMPLEARM){ |
128 c->idct_put= simple_idct_ARM_put; | 94 c->idct_put= simple_idct_ARM_put; |
129 c->idct_add= simple_idct_ARM_add; | 95 c->idct_add= simple_idct_ARM_add; |
130 c->idct = simple_idct_ARM; | 96 c->idct = simple_idct_ARM; |
131 c->idct_permutation_type= FF_NO_IDCT_PERM; | 97 c->idct_permutation_type= FF_NO_IDCT_PERM; |
132 #if HAVE_ARMV6 | |
133 } else if (idct_algo==FF_IDCT_SIMPLEARMV6){ | |
134 c->idct_put= ff_simple_idct_put_armv6; | |
135 c->idct_add= ff_simple_idct_add_armv6; | |
136 c->idct = ff_simple_idct_armv6; | |
137 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; | |
138 #endif | |
139 #if HAVE_ARMV5TE | |
140 } else if (idct_algo==FF_IDCT_SIMPLEARMV5TE){ | |
141 c->idct_put= simple_idct_put_armv5te; | |
142 c->idct_add= simple_idct_add_armv5te; | |
143 c->idct = simple_idct_armv5te; | |
144 c->idct_permutation_type = FF_NO_IDCT_PERM; | |
145 #endif | |
146 #if HAVE_NEON | |
147 } else if (idct_algo==FF_IDCT_SIMPLENEON){ | |
148 c->idct_put= ff_simple_idct_put_neon; | |
149 c->idct_add= ff_simple_idct_add_neon; | |
150 c->idct = ff_simple_idct_neon; | |
151 c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM; | |
152 } else if ((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) && | |
153 idct_algo==FF_IDCT_VP3){ | |
154 c->idct_put= ff_vp3_idct_put_neon; | |
155 c->idct_add= ff_vp3_idct_add_neon; | |
156 c->idct = ff_vp3_idct_neon; | |
157 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; | |
158 #endif | |
159 } | 98 } |
160 } | 99 } |
161 | 100 |
162 c->put_pixels_tab[0][0] = put_pixels16_arm; | 101 c->put_pixels_tab[0][0] = put_pixels16_arm; |
163 c->put_pixels_tab[0][1] = put_pixels16_x2_arm; | 102 c->put_pixels_tab[0][1] = put_pixels16_x2_arm; |
174 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_arm; | 113 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_arm; |
175 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_arm; | 114 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_arm; |
176 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm; | 115 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm; |
177 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm; | 116 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm; |
178 | 117 |
179 #if HAVE_ARMV5TE | 118 if (HAVE_ARMV5TE) ff_dsputil_init_armv5te(c, avctx); |
180 c->prefetch = ff_prefetch_arm; | 119 if (HAVE_ARMV6) ff_dsputil_init_armv6(c, avctx); |
181 #endif | |
182 | 120 |
183 #if HAVE_IWMMXT | 121 #if HAVE_IWMMXT |
184 dsputil_init_iwmmxt(c, avctx); | 122 dsputil_init_iwmmxt(c, avctx); |
185 #endif | 123 #endif |
186 #if HAVE_ARMVFP | 124 #if HAVE_ARMVFP |