2 * The simplest mpeg encoder (well, it was the simplest!)
3 * Copyright (c) 2000,2001 Fabrice Bellard
5 * This file is part of Libav.
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "libavutil/cpu.h"
23 #include "libavutil/x86/asm.h"
24 #include "libavcodec/avcodec.h"
25 #include "libavcodec/dsputil.h"
26 #include "libavcodec/mpegvideo.h"
27 #include "dsputil_mmx.h"
31 extern uint16_t ff_inv_zigzag_direct16[64];
34 #define HAVE_SSSE3_BAK
43 #define RENAME(a) a ## _MMX
44 #define RENAMEl(a) a ## _mmx
45 #include "mpegvideoenc_template.c"
51 #define RENAME(a) a ## _MMX2
52 #define RENAMEl(a) a ## _mmx2
53 #include "mpegvideoenc_template.c"
59 #define RENAME(a) a ## _SSE2
60 #define RENAMEl(a) a ## _sse2
61 #include "mpegvideoenc_template.c"
68 #define RENAME(a) a ## _SSSE3
69 #define RENAMEl(a) a ## _sse2
70 #include "mpegvideoenc_template.c"
73 #endif /* HAVE_INLINE_ASM */
75 void ff_MPV_encode_init_x86(MpegEncContext *s)
78 int mm_flags = av_get_cpu_flags();
79 const int dct_algo = s->avctx->dct_algo;
81 if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
83 if (mm_flags & AV_CPU_FLAG_SSSE3) {
84 s->dct_quantize = dct_quantize_SSSE3;
87 if (mm_flags & AV_CPU_FLAG_SSE2) {
88 s->dct_quantize = dct_quantize_SSE2;
89 } else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
90 s->dct_quantize = dct_quantize_MMX2;
92 s->dct_quantize = dct_quantize_MMX;
95 #endif /* HAVE_INLINE_ASM */