| OLD | NEW |
| 1 /* | 1 /* |
| 2 * iWMMXt optimized DSP utils | 2 * iWMMXt optimized DSP utils |
| 3 * Copyright (c) 2004 AGAWA Koji | 3 * Copyright (c) 2004 AGAWA Koji |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * FFmpeg is distributed in the hope that it will be useful, | 12 * FFmpeg is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Lesser General Public License for more details. | 15 * Lesser General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Lesser General Public | 17 * You should have received a copy of the GNU Lesser General Public |
| 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 "libavutil/cpu.h" |
| 22 #include "libavcodec/dsputil.h" | 23 #include "libavcodec/dsputil.h" |
| 23 | 24 |
| 24 #define DEF(x, y) x ## _no_rnd_ ## y ##_iwmmxt | 25 #define DEF(x, y) x ## _no_rnd_ ## y ##_iwmmxt |
| 25 #define SET_RND(regd) __asm__ volatile ("mov r12, #1 \n\t tbcsth " #regd ", r12
":::"r12"); | 26 #define SET_RND(regd) __asm__ volatile ("mov r12, #1 \n\t tbcsth " #regd ", r12
":::"r12"); |
| 26 #define WAVG2B "wavg2b" | 27 #define WAVG2B "wavg2b" |
| 27 #include "dsputil_iwmmxt_rnd_template.c" | 28 #include "dsputil_iwmmxt_rnd_template.c" |
| 28 #undef DEF | 29 #undef DEF |
| 29 #undef SET_RND | 30 #undef SET_RND |
| 30 #undef WAVG2B | 31 #undef WAVG2B |
| 31 | 32 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 144 } |
| 144 | 145 |
| 145 static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h) | 146 static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
| 146 { | 147 { |
| 147 return; | 148 return; |
| 148 } | 149 } |
| 149 | 150 |
| 150 /* A run time test is not simple. If this file is compiled in | 151 /* A run time test is not simple. If this file is compiled in |
| 151 * then we should install the functions | 152 * then we should install the functions |
| 152 */ | 153 */ |
| 153 int mm_flags = FF_MM_IWMMXT; /* multimedia extension flags */ | |
| 154 | 154 |
| 155 void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx) | 155 void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx) |
| 156 { | 156 { |
| 157 int mm_flags = AV_CPU_FLAG_IWMMXT; /* multimedia extension flags */ |
| 158 |
| 157 if (avctx->dsp_mask) { | 159 if (avctx->dsp_mask) { |
| 158 if (avctx->dsp_mask & FF_MM_FORCE) | 160 if (avctx->dsp_mask & AV_CPU_FLAG_FORCE) |
| 159 mm_flags |= (avctx->dsp_mask & 0xffff); | 161 mm_flags |= (avctx->dsp_mask & 0xffff); |
| 160 else | 162 else |
| 161 mm_flags &= ~(avctx->dsp_mask & 0xffff); | 163 mm_flags &= ~(avctx->dsp_mask & 0xffff); |
| 162 } | 164 } |
| 163 | 165 |
| 164 if (!(mm_flags & FF_MM_IWMMXT)) return; | 166 if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return; |
| 165 | 167 |
| 166 c->add_pixels_clamped = add_pixels_clamped_iwmmxt; | 168 c->add_pixels_clamped = add_pixels_clamped_iwmmxt; |
| 167 | 169 |
| 168 c->clear_blocks = clear_blocks_iwmmxt; | 170 c->clear_blocks = clear_blocks_iwmmxt; |
| 169 | 171 |
| 170 c->put_pixels_tab[0][0] = put_pixels16_iwmmxt; | 172 c->put_pixels_tab[0][0] = put_pixels16_iwmmxt; |
| 171 c->put_pixels_tab[0][1] = put_pixels16_x2_iwmmxt; | 173 c->put_pixels_tab[0][1] = put_pixels16_x2_iwmmxt; |
| 172 c->put_pixels_tab[0][2] = put_pixels16_y2_iwmmxt; | 174 c->put_pixels_tab[0][2] = put_pixels16_y2_iwmmxt; |
| 173 c->put_pixels_tab[0][3] = put_pixels16_xy2_iwmmxt; | 175 c->put_pixels_tab[0][3] = put_pixels16_xy2_iwmmxt; |
| 174 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_iwmmxt; | 176 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_iwmmxt; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 196 | 198 |
| 197 c->avg_pixels_tab[1][0] = avg_pixels8_iwmmxt; | 199 c->avg_pixels_tab[1][0] = avg_pixels8_iwmmxt; |
| 198 c->avg_pixels_tab[1][1] = avg_pixels8_x2_iwmmxt; | 200 c->avg_pixels_tab[1][1] = avg_pixels8_x2_iwmmxt; |
| 199 c->avg_pixels_tab[1][2] = avg_pixels8_y2_iwmmxt; | 201 c->avg_pixels_tab[1][2] = avg_pixels8_y2_iwmmxt; |
| 200 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_iwmmxt; | 202 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_iwmmxt; |
| 201 c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_iwmmxt; | 203 c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_iwmmxt; |
| 202 c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_iwmmxt; | 204 c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_iwmmxt; |
| 203 c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_iwmmxt; | 205 c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_iwmmxt; |
| 204 c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_iwmmxt; | 206 c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_iwmmxt; |
| 205 } | 207 } |
| OLD | NEW |