| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * The simplest mpeg encoder (well, it was the simplest!) | ||
| 3 | * Copyright (c) 2000,2001 Fabrice Bellard | ||
| 4 | * | ||
| 5 | * This file is part of FFmpeg. | ||
| 6 | * | ||
| 7 | * FFmpeg 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. | ||
| 11 | * | ||
| 12 | * FFmpeg 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. | ||
| 16 | * | ||
| 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 | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "libavutil/attributes.h" | ||
| 23 | #include "libavutil/cpu.h" | ||
| 24 | #include "libavutil/mem_internal.h" | ||
| 25 | #include "libavutil/x86/asm.h" | ||
| 26 | #include "libavutil/x86/cpu.h" | ||
| 27 | #include "libavcodec/avcodec.h" | ||
| 28 | #include "libavcodec/mpegvideoenc.h" | ||
| 29 | |||
| 30 | /* not permutated inverse zigzag_direct + 1 for MMX quantizer */ | ||
| 31 | DECLARE_ALIGNED(16, static const uint16_t, inv_zigzag_direct16)[64] = { | ||
| 32 | 1, 2, 6, 7, 15, 16, 28, 29, | ||
| 33 | 3, 5, 8, 14, 17, 27, 30, 43, | ||
| 34 | 4, 9, 13, 18, 26, 31, 42, 44, | ||
| 35 | 10, 12, 19, 25, 32, 41, 45, 54, | ||
| 36 | 11, 20, 24, 33, 40, 46, 53, 55, | ||
| 37 | 21, 23, 34, 39, 47, 52, 56, 61, | ||
| 38 | 22, 35, 38, 48, 51, 57, 60, 62, | ||
| 39 | 36, 37, 49, 50, 58, 59, 63, 64, | ||
| 40 | }; | ||
| 41 | |||
| 42 | #if HAVE_SSE2_INLINE | ||
| 43 | #define COMPILE_TEMPLATE_SSSE3 0 | ||
| 44 | #define RENAME(a) a ## _sse2 | ||
| 45 | #include "mpegvideoenc_template.c" | ||
| 46 | #endif /* HAVE_SSE2_INLINE */ | ||
| 47 | |||
| 48 | #if HAVE_SSSE3_INLINE | ||
| 49 | #undef COMPILE_TEMPLATE_SSSE3 | ||
| 50 | #define COMPILE_TEMPLATE_SSSE3 1 | ||
| 51 | #undef RENAME | ||
| 52 | #define RENAME(a) a ## _ssse3 | ||
| 53 | #include "mpegvideoenc_template.c" | ||
| 54 | #endif /* HAVE_SSSE3_INLINE */ | ||
| 55 | |||
| 56 | 280 | av_cold void ff_dct_encode_init_x86(MPVEncContext *const s) | |
| 57 | { | ||
| 58 | 280 | const int dct_algo = s->c.avctx->dct_algo; | |
| 59 | |||
| 60 |
3/4✓ Branch 0 taken 275 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 275 times.
|
280 | if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) { |
| 61 | #if HAVE_SSE2_INLINE | ||
| 62 | 5 | int cpu_flags = av_get_cpu_flags(); | |
| 63 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (INLINE_SSE2(cpu_flags)) { |
| 64 | ✗ | s->dct_quantize = dct_quantize_sse2; | |
| 65 | } | ||
| 66 | #if HAVE_SSSE3_INLINE | ||
| 67 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (INLINE_SSSE3(cpu_flags)) |
| 68 | ✗ | s->dct_quantize = dct_quantize_ssse3; | |
| 69 | #endif | ||
| 70 | #endif | ||
| 71 | } | ||
| 72 | 280 | } | |
| 73 |