| OLD | NEW |
| 1 /* | 1 /* |
| 2 * The simplest mpeg encoder (well, it was the simplest!) | 2 * The simplest mpeg encoder (well, it was the simplest!) |
| 3 * Copyright (c) 2000,2001 Fabrice Bellard | 3 * Copyright (c) 2000,2001 Fabrice Bellard |
| 4 * | 4 * |
| 5 * Optimized for ia32 CPUs by Nick Kurshev <nickols_k@mail.ru> | 5 * Optimized for ia32 CPUs by Nick Kurshev <nickols_k@mail.ru> |
| 6 * h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni
@gmx.at> | 6 * h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni
@gmx.at> |
| 7 * | 7 * |
| 8 * This file is part of FFmpeg. | 8 * This file is part of FFmpeg. |
| 9 * | 9 * |
| 10 * FFmpeg is free software; you can redistribute it and/or | 10 * FFmpeg is free software; you can redistribute it and/or |
| 11 * modify it under the terms of the GNU Lesser General Public | 11 * modify it under the terms of the GNU Lesser General Public |
| 12 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
| 13 * version 2.1 of the License, or (at your option) any later version. | 13 * version 2.1 of the License, or (at your option) any later version. |
| 14 * | 14 * |
| 15 * FFmpeg is distributed in the hope that it will be useful, | 15 * FFmpeg is distributed in the hope that it will be useful, |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 * Lesser General Public License for more details. | 18 * Lesser General Public License for more details. |
| 19 * | 19 * |
| 20 * You should have received a copy of the GNU Lesser General Public | 20 * You should have received a copy of the GNU Lesser General Public |
| 21 * License along with FFmpeg; if not, write to the Free Software | 21 * License along with FFmpeg; if not, write to the Free Software |
| 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "libavutil/cpu.h" |
| 25 #include "libavutil/x86_cpu.h" | 26 #include "libavutil/x86_cpu.h" |
| 26 #include "libavcodec/avcodec.h" | 27 #include "libavcodec/avcodec.h" |
| 27 #include "libavcodec/dsputil.h" | 28 #include "libavcodec/dsputil.h" |
| 28 #include "libavcodec/mpegvideo.h" | 29 #include "libavcodec/mpegvideo.h" |
| 29 #include "dsputil_mmx.h" | 30 #include "dsputil_mmx.h" |
| 30 | 31 |
| 31 extern uint16_t inv_zigzag_direct16[64]; | 32 extern uint16_t inv_zigzag_direct16[64]; |
| 32 | 33 |
| 33 | 34 |
| 34 static void dct_unquantize_h263_intra_mmx(MpegEncContext *s, | 35 static void dct_unquantize_h263_intra_mmx(MpegEncContext *s, |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 #define HAVE_SSSE3 1 | 619 #define HAVE_SSSE3 1 |
| 619 #undef RENAME | 620 #undef RENAME |
| 620 #undef RENAMEl | 621 #undef RENAMEl |
| 621 #define RENAME(a) a ## _SSSE3 | 622 #define RENAME(a) a ## _SSSE3 |
| 622 #define RENAMEl(a) a ## _sse2 | 623 #define RENAMEl(a) a ## _sse2 |
| 623 #include "mpegvideo_mmx_template.c" | 624 #include "mpegvideo_mmx_template.c" |
| 624 #endif | 625 #endif |
| 625 | 626 |
| 626 void MPV_common_init_mmx(MpegEncContext *s) | 627 void MPV_common_init_mmx(MpegEncContext *s) |
| 627 { | 628 { |
| 628 if (mm_flags & FF_MM_MMX) { | 629 int mm_flags = av_get_cpu_flags(); |
| 630 |
| 631 if (mm_flags & AV_CPU_FLAG_MMX) { |
| 629 const int dct_algo = s->avctx->dct_algo; | 632 const int dct_algo = s->avctx->dct_algo; |
| 630 | 633 |
| 631 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx; | 634 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx; |
| 632 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx; | 635 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx; |
| 633 s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx; | 636 s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx; |
| 634 s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx; | 637 s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx; |
| 635 if(!(s->flags & CODEC_FLAG_BITEXACT)) | 638 if(!(s->flags & CODEC_FLAG_BITEXACT)) |
| 636 s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx; | 639 s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx; |
| 637 s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; | 640 s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; |
| 638 | 641 |
| 639 if (mm_flags & FF_MM_SSE2) { | 642 if (mm_flags & AV_CPU_FLAG_SSE2) { |
| 640 s->denoise_dct= denoise_dct_sse2; | 643 s->denoise_dct= denoise_dct_sse2; |
| 641 } else { | 644 } else { |
| 642 s->denoise_dct= denoise_dct_mmx; | 645 s->denoise_dct= denoise_dct_mmx; |
| 643 } | 646 } |
| 644 | 647 |
| 645 if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ | 648 if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ |
| 646 #if HAVE_SSSE3 | 649 #if HAVE_SSSE3 |
| 647 if(mm_flags & FF_MM_SSSE3){ | 650 if(mm_flags & AV_CPU_FLAG_SSSE3){ |
| 648 s->dct_quantize= dct_quantize_SSSE3; | 651 s->dct_quantize= dct_quantize_SSSE3; |
| 649 } else | 652 } else |
| 650 #endif | 653 #endif |
| 651 if(mm_flags & FF_MM_SSE2){ | 654 if(mm_flags & AV_CPU_FLAG_SSE2){ |
| 652 s->dct_quantize= dct_quantize_SSE2; | 655 s->dct_quantize= dct_quantize_SSE2; |
| 653 } else if(mm_flags & FF_MM_MMX2){ | 656 } else if(mm_flags & AV_CPU_FLAG_MMX2){ |
| 654 s->dct_quantize= dct_quantize_MMX2; | 657 s->dct_quantize= dct_quantize_MMX2; |
| 655 } else { | 658 } else { |
| 656 s->dct_quantize= dct_quantize_MMX; | 659 s->dct_quantize= dct_quantize_MMX; |
| 657 } | 660 } |
| 658 } | 661 } |
| 659 } | 662 } |
| 660 } | 663 } |
| OLD | NEW |