| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2002 Brian Foley | 2 * Copyright (c) 2002 Brian Foley |
| 3 * Copyright (c) 2002 Dieter Shirley | 3 * Copyright (c) 2002 Dieter Shirley |
| 4 * Copyright (c) 2003-2004 Romain Dolbeau <romain@dolbeau.org> | 4 * Copyright (c) 2003-2004 Romain Dolbeau <romain@dolbeau.org> |
| 5 * | 5 * |
| 6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
| 7 * | 7 * |
| 8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2.1 of the License, or (at your option) any later version. | 11 * version 2.1 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * FFmpeg is distributed in the hope that it will be useful, | 13 * FFmpeg is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Lesser General Public License for more details. | 16 * Lesser General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Lesser General Public | 18 * You should have received a copy of the GNU Lesser General Public |
| 19 * License along with FFmpeg; if not, write to the Free Software | 19 * License along with FFmpeg; if not, write to the Free Software |
| 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "libavutil/cpu.h" |
| 23 #include "libavcodec/dsputil.h" | 24 #include "libavcodec/dsputil.h" |
| 24 #include "dsputil_altivec.h" | 25 #include "dsputil_altivec.h" |
| 25 | 26 |
| 26 int mm_flags = 0; | |
| 27 | |
| 28 int mm_support(void) | |
| 29 { | |
| 30 int result = 0; | |
| 31 #if HAVE_ALTIVEC | |
| 32 if (has_altivec()) { | |
| 33 result |= FF_MM_ALTIVEC; | |
| 34 } | |
| 35 #endif /* result */ | |
| 36 return result; | |
| 37 } | |
| 38 | |
| 39 /* ***** WARNING ***** WARNING ***** WARNING ***** */ | 27 /* ***** WARNING ***** WARNING ***** WARNING ***** */ |
| 40 /* | 28 /* |
| 41 clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a | 29 clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a |
| 42 cache line size not equal to 32 bytes. | 30 cache line size not equal to 32 bytes. |
| 43 Fortunately all processor used by Apple up to at least the 7450 (aka second | 31 Fortunately all processor used by Apple up to at least the 7450 (aka second |
| 44 generation G4) use 32 bytes cache line. | 32 generation G4) use 32 bytes cache line. |
| 45 This is due to the use of the 'dcbz' instruction. It simply clear to zero a | 33 This is due to the use of the 'dcbz' instruction. It simply clear to zero a |
| 46 single cache line, so you need to know the cache line size to use it ! | 34 single cache line, so you need to know the cache line size to use it ! |
| 47 It's absurd, but it's fast... | 35 It's absurd, but it's fast... |
| 48 | 36 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 case 128: | 162 case 128: |
| 175 c->clear_blocks = clear_blocks_dcbz128_ppc; | 163 c->clear_blocks = clear_blocks_dcbz128_ppc; |
| 176 break; | 164 break; |
| 177 default: | 165 default: |
| 178 break; | 166 break; |
| 179 } | 167 } |
| 180 | 168 |
| 181 #if HAVE_ALTIVEC | 169 #if HAVE_ALTIVEC |
| 182 if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx); | 170 if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx); |
| 183 | 171 |
| 184 if (has_altivec()) { | 172 if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { |
| 185 mm_flags |= FF_MM_ALTIVEC; | |
| 186 | |
| 187 dsputil_init_altivec(c, avctx); | 173 dsputil_init_altivec(c, avctx); |
| 188 if(CONFIG_VC1_DECODER) | 174 if(CONFIG_VC1_DECODER) |
| 189 vc1dsp_init_altivec(c, avctx); | 175 vc1dsp_init_altivec(c, avctx); |
| 190 float_init_altivec(c, avctx); | 176 float_init_altivec(c, avctx); |
| 191 int_init_altivec(c, avctx); | 177 int_init_altivec(c, avctx); |
| 192 c->gmc1 = gmc1_altivec; | 178 c->gmc1 = gmc1_altivec; |
| 193 | 179 |
| 194 #if CONFIG_ENCODERS | 180 #if CONFIG_ENCODERS |
| 195 if (avctx->dct_algo == FF_DCT_AUTO || | 181 if (avctx->dct_algo == FF_DCT_AUTO || |
| 196 avctx->dct_algo == FF_DCT_ALTIVEC) { | 182 avctx->dct_algo == FF_DCT_ALTIVEC) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 209 c->idct_put = ff_vp3_idct_put_altivec; | 195 c->idct_put = ff_vp3_idct_put_altivec; |
| 210 c->idct_add = ff_vp3_idct_add_altivec; | 196 c->idct_add = ff_vp3_idct_add_altivec; |
| 211 c->idct = ff_vp3_idct_altivec; | 197 c->idct = ff_vp3_idct_altivec; |
| 212 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; | 198 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; |
| 213 } | 199 } |
| 214 } | 200 } |
| 215 | 201 |
| 216 } | 202 } |
| 217 #endif /* HAVE_ALTIVEC */ | 203 #endif /* HAVE_ALTIVEC */ |
| 218 } | 204 } |
| OLD | NEW |