FFmpeg
2.1.1
Main Page
Related Pages
Modules
Namespaces
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 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/x86/asm.h
"
25
#include "
libavutil/x86/cpu.h
"
26
#include "libavcodec/avcodec.h"
27
#include "
libavcodec/dct.h
"
28
#include "
libavcodec/mpegvideo.h
"
29
#include "
dsputil_x86.h
"
30
31
extern
uint16_t
ff_inv_zigzag_direct16
[64];
32
33
#if HAVE_MMX_INLINE
34
#define COMPILE_TEMPLATE_MMXEXT 0
35
#define COMPILE_TEMPLATE_SSE2 0
36
#define COMPILE_TEMPLATE_SSSE3 0
37
#define RENAME(a) a ## _MMX
38
#define RENAMEl(a) a ## _mmx
39
#include "
mpegvideoenc_template.c
"
40
#endif
/* HAVE_MMX_INLINE */
41
42
#if HAVE_MMXEXT_INLINE
43
#undef COMPILE_TEMPLATE_SSSE3
44
#undef COMPILE_TEMPLATE_SSE2
45
#undef COMPILE_TEMPLATE_MMXEXT
46
#define COMPILE_TEMPLATE_MMXEXT 1
47
#define COMPILE_TEMPLATE_SSE2 0
48
#define COMPILE_TEMPLATE_SSSE3 0
49
#undef RENAME
50
#undef RENAMEl
51
#define RENAME(a) a ## _MMXEXT
52
#define RENAMEl(a) a ## _mmxext
53
#include "
mpegvideoenc_template.c
"
54
#endif
/* HAVE_MMXEXT_INLINE */
55
56
#if HAVE_SSE2_INLINE
57
#undef COMPILE_TEMPLATE_MMXEXT
58
#undef COMPILE_TEMPLATE_SSE2
59
#undef COMPILE_TEMPLATE_SSSE3
60
#define COMPILE_TEMPLATE_MMXEXT 0
61
#define COMPILE_TEMPLATE_SSE2 1
62
#define COMPILE_TEMPLATE_SSSE3 0
63
#undef RENAME
64
#undef RENAMEl
65
#define RENAME(a) a ## _SSE2
66
#define RENAMEl(a) a ## _sse2
67
#include "
mpegvideoenc_template.c
"
68
#endif
/* HAVE_SSE2_INLINE */
69
70
#if HAVE_SSSE3_INLINE
71
#undef COMPILE_TEMPLATE_MMXEXT
72
#undef COMPILE_TEMPLATE_SSE2
73
#undef COMPILE_TEMPLATE_SSSE3
74
#define COMPILE_TEMPLATE_MMXEXT 0
75
#define COMPILE_TEMPLATE_SSE2 1
76
#define COMPILE_TEMPLATE_SSSE3 1
77
#undef RENAME
78
#undef RENAMEl
79
#define RENAME(a) a ## _SSSE3
80
#define RENAMEl(a) a ## _sse2
81
#include "
mpegvideoenc_template.c
"
82
#endif
/* HAVE_SSSE3_INLINE */
83
84
av_cold
void
ff_dct_encode_init_x86
(
MpegEncContext
*
s
)
85
{
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
int
cpu_flags
=
av_get_cpu_flags
();
91
if
(
INLINE_MMX
(cpu_flags))
92
s->
dct_quantize
= dct_quantize_MMX;
93
#endif
94
#if HAVE_MMXEXT_INLINE
95
if
(
INLINE_MMXEXT
(cpu_flags))
96
s->
dct_quantize
= dct_quantize_MMXEXT;
97
#endif
98
#if HAVE_SSE2_INLINE
99
if
(
INLINE_SSE2
(cpu_flags))
100
s->
dct_quantize
= dct_quantize_SSE2;
101
#endif
102
#if HAVE_SSSE3_INLINE
103
if
(
INLINE_SSSE3
(cpu_flags))
104
s->
dct_quantize
= dct_quantize_SSSE3;
105
#endif
106
}
107
}
INLINE_SSE2
#define INLINE_SSE2(flags)
Definition:
cpu.h:62
s
const char * s
Definition:
avisynth_c.h:668
AVCodecContext::dct_algo
int dct_algo
DCT algorithm, see FF_DCT_* below.
Definition:
avcodec.h:2527
asm.h
FF_DCT_AUTO
#define FF_DCT_AUTO
Definition:
avcodec.h:2528
mpegvideo.h
mpegvideo header.
av_cold
#define av_cold
Definition:
avcodec.h:653
cpu.h
ff_dct_encode_init_x86
void ff_dct_encode_init_x86(MpegEncContext *s)
Definition:
mpegvideoenc.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:52
dct.h
ff_inv_zigzag_direct16
uint16_t ff_inv_zigzag_direct16[64]
Definition:
dsputil.c:73
mpegvideoenc_template.c
INLINE_SSSE3
#define INLINE_SSSE3(flags)
Definition:
cpu.h:64
INLINE_MMX
#define INLINE_MMX(flags)
Definition:
cpu.h:59
cpu_flags
static int cpu_flags
Definition:
dct-test.c:77
MpegEncContext
MpegEncContext.
Definition:
mpegvideo.h:245
MpegEncContext::avctx
struct AVCodecContext * avctx
Definition:
mpegvideo.h:247
dsputil_x86.h
INLINE_MMXEXT
#define INLINE_MMXEXT(flags)
Definition:
cpu.h:60
MpegEncContext::dct_quantize
int(* dct_quantize)(struct MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow)
Definition:
mpegvideo.h:733
FF_DCT_MMX
#define FF_DCT_MMX
Definition:
avcodec.h:2531
Generated on Wed Nov 20 2013 08:50:02 for FFmpeg by
1.8.5