Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavcodec
x86
mpegvideoenc.c
Go to the documentation of this file.
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 Libav.
6
*
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.
11
*
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.
16
*
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
20
*/
21
22
#include "
libavutil/cpu.h
"
23
#include "
libavutil/x86/asm.h
"
24
#include "
libavutil/x86/cpu.h
"
25
#include "
libavcodec/avcodec.h
"
26
#include "
libavcodec/dsputil.h
"
27
#include "
libavcodec/mpegvideo.h
"
28
#include "
dsputil_mmx.h
"
29
30
extern
uint16_t
ff_inv_zigzag_direct16
[64];
31
32
#if HAVE_MMX_INLINE
33
#define COMPILE_TEMPLATE_MMXEXT 0
34
#define COMPILE_TEMPLATE_SSE2 0
35
#define COMPILE_TEMPLATE_SSSE3 0
36
#define RENAME(a) a ## _MMX
37
#define RENAMEl(a) a ## _mmx
38
#include "
mpegvideoenc_template.c
"
39
#endif
/* HAVE_MMX_INLINE */
40
41
#if HAVE_MMXEXT_INLINE
42
#undef COMPILE_TEMPLATE_SSSE3
43
#undef COMPILE_TEMPLATE_SSE2
44
#undef COMPILE_TEMPLATE_MMXEXT
45
#define COMPILE_TEMPLATE_MMXEXT 1
46
#define COMPILE_TEMPLATE_SSE2 0
47
#define COMPILE_TEMPLATE_SSSE3 0
48
#undef RENAME
49
#undef RENAMEl
50
#define RENAME(a) a ## _MMXEXT
51
#define RENAMEl(a) a ## _mmxext
52
#include "
mpegvideoenc_template.c
"
53
#endif
/* HAVE_MMXEXT_INLINE */
54
55
#if HAVE_SSE2_INLINE
56
#undef COMPILE_TEMPLATE_MMXEXT
57
#undef COMPILE_TEMPLATE_SSE2
58
#undef COMPILE_TEMPLATE_SSSE3
59
#define COMPILE_TEMPLATE_MMXEXT 0
60
#define COMPILE_TEMPLATE_SSE2 1
61
#define COMPILE_TEMPLATE_SSSE3 0
62
#undef RENAME
63
#undef RENAMEl
64
#define RENAME(a) a ## _SSE2
65
#define RENAMEl(a) a ## _sse2
66
#include "
mpegvideoenc_template.c
"
67
#endif
/* HAVE_SSE2_INLINE */
68
69
#if HAVE_SSSE3_INLINE
70
#undef COMPILE_TEMPLATE_MMXEXT
71
#undef COMPILE_TEMPLATE_SSE2
72
#undef COMPILE_TEMPLATE_SSSE3
73
#define COMPILE_TEMPLATE_MMXEXT 0
74
#define COMPILE_TEMPLATE_SSE2 1
75
#define COMPILE_TEMPLATE_SSSE3 1
76
#undef RENAME
77
#undef RENAMEl
78
#define RENAME(a) a ## _SSSE3
79
#define RENAMEl(a) a ## _sse2
80
#include "
mpegvideoenc_template.c
"
81
#endif
/* HAVE_SSSE3_INLINE */
82
83
void
ff_MPV_encode_init_x86
(
MpegEncContext
*s)
84
{
85
int
mm_flags =
av_get_cpu_flags
();
86
const
int
dct_algo = s->
avctx
->
dct_algo
;
87
88
if
(dct_algo ==
FF_DCT_AUTO
|| dct_algo ==
FF_DCT_MMX
) {
89
#if HAVE_MMX_INLINE
90
if
(
INLINE_MMX
(mm_flags))
91
s->
dct_quantize
= dct_quantize_MMX;
92
#endif
93
#if HAVE_MMXEXT_INLINE
94
if
(
INLINE_MMXEXT
(mm_flags))
95
s->
dct_quantize
= dct_quantize_MMXEXT;
96
#endif
97
#if HAVE_SSE2_INLINE
98
if
(
INLINE_SSE2
(mm_flags))
99
s->
dct_quantize
= dct_quantize_SSE2;
100
#endif
101
#if HAVE_SSSE3_INLINE
102
if
(
INLINE_SSSE3
(mm_flags))
103
s->
dct_quantize
= dct_quantize_SSSE3;
104
#endif
105
}
106
}
MpegEncContext::dct_quantize
int(* dct_quantize)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow)
Definition:
mpegvideo.h:690
AVCodecContext::dct_algo
int dct_algo
DCT algorithm, see FF_DCT_* below.
Definition:
avcodec.h:2648
asm.h
INLINE_SSE2
#define INLINE_SSE2(flags)
Definition:
cpu.h:49
mpegvideo.h
mpegvideo header.
cpu.h
FF_DCT_MMX
#define FF_DCT_MMX
INLINE_MMX
#define INLINE_MMX(flags)
Definition:
cpu.h:46
mpegvideoenc_template.c
INLINE_SSSE3
#define INLINE_SSSE3(flags)
Definition:
cpu.h:51
ff_MPV_encode_init_x86
void ff_MPV_encode_init_x86(MpegEncContext *s)
Definition:
mpegvideoenc.c:83
avcodec.h
external API header
dsputil_mmx.h
cpu.h
ff_inv_zigzag_direct16
uint16_t ff_inv_zigzag_direct16[64]
Definition:
dsputil.c:84
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition:
cpu.c:25
FF_DCT_AUTO
#define FF_DCT_AUTO
MpegEncContext
MpegEncContext.
Definition:
mpegvideo.h:212
MpegEncContext::avctx
struct AVCodecContext * avctx
Definition:
mpegvideo.h:214
INLINE_MMXEXT
#define INLINE_MMXEXT(flags)
Definition:
cpu.h:47
dsputil.h
DSP utils.