Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d211547d
Commit
d211547d
authored
Aug 13, 2012
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x86: mpegvideoenc: Split optimizations off into a separate file
parent
26ce9aec
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
63 deletions
+101
-63
mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+3
-0
Makefile
libavcodec/x86/Makefile
+1
-0
mpegvideo_mmx.c
libavcodec/x86/mpegvideo_mmx.c
+0
-63
mpegvideoenc.c
libavcodec/x86/mpegvideoenc.c
+96
-0
mpegvideoenc_template.c
libavcodec/x86/mpegvideoenc_template.c
+0
-0
No files found.
libavcodec/mpegvideo.h
View file @
d211547d
...
...
@@ -756,6 +756,7 @@ int ff_MPV_encode_init(AVCodecContext *avctx);
int
ff_MPV_encode_end
(
AVCodecContext
*
avctx
);
int
ff_MPV_encode_picture
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
frame
,
int
*
got_packet
);
void
ff_MPV_encode_init_x86
(
MpegEncContext
*
s
);
void
ff_MPV_common_init_mmx
(
MpegEncContext
*
s
);
void
ff_MPV_common_init_axp
(
MpegEncContext
*
s
);
void
ff_MPV_common_init_mmi
(
MpegEncContext
*
s
);
...
...
libavcodec/mpegvideo_enc.c
View file @
d211547d
...
...
@@ -784,6 +784,9 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
if
(
ff_MPV_common_init
(
s
)
<
0
)
return
-
1
;
if
(
ARCH_X86
)
ff_MPV_encode_init_x86
(
s
);
if
(
!
s
->
dct_quantize
)
s
->
dct_quantize
=
ff_dct_quantize_c
;
if
(
!
s
->
denoise_dct
)
...
...
libavcodec/x86/Makefile
View file @
d211547d
...
...
@@ -23,6 +23,7 @@ MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
MMX-OBJS-$(CONFIG_LPC)
+=
x86/lpc_mmx.o
MMX-OBJS-$(CONFIG_MPEGAUDIODSP)
+=
x86/mpegaudiodec_mmx.o
MMX-OBJS-$(CONFIG_MPEGVIDEO)
+=
x86/mpegvideo_mmx.o
MMX-OBJS-$(CONFIG_MPEGVIDEOENC)
+=
x86/mpegvideoenc.o
MMX-OBJS-$(CONFIG_PNG_DECODER)
+=
x86/pngdsp_init.o
MMX-OBJS-$(CONFIG_PRORES_DECODER)
+=
x86/proresdsp_init.o
MMX-OBJS-$(CONFIG_RV30_DECODER)
+=
x86/rv34dsp_init.o
...
...
libavcodec/x86/mpegvideo_mmx.c
View file @
d211547d
/*
* The simplest mpeg encoder (well, it was the simplest!)
* Copyright (c) 2000,2001 Fabrice Bellard
*
* Optimized for ia32 CPUs by Nick Kurshev <nickols_k@mail.ru>
* h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni@gmx.at>
*
...
...
@@ -31,9 +28,6 @@
#if HAVE_INLINE_ASM
extern
uint16_t
ff_inv_zigzag_direct16
[
64
];
static
void
dct_unquantize_h263_intra_mmx
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
,
int
qscale
)
{
...
...
@@ -588,46 +582,6 @@ static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
);
}
#if HAVE_SSSE3
#define HAVE_SSSE3_BAK
#endif
#undef HAVE_SSSE3
#define HAVE_SSSE3 0
#undef HAVE_SSE2
#undef HAVE_MMXEXT
#define HAVE_SSE2 0
#define HAVE_MMXEXT 0
#define RENAME(a) a ## _MMX
#define RENAMEl(a) a ## _mmx
#include "mpegvideo_mmx_template.c"
#undef HAVE_MMXEXT
#define HAVE_MMXEXT 1
#undef RENAME
#undef RENAMEl
#define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2
#include "mpegvideo_mmx_template.c"
#undef HAVE_SSE2
#define HAVE_SSE2 1
#undef RENAME
#undef RENAMEl
#define RENAME(a) a ## _SSE2
#define RENAMEl(a) a ## _sse2
#include "mpegvideo_mmx_template.c"
#ifdef HAVE_SSSE3_BAK
#undef HAVE_SSSE3
#define HAVE_SSSE3 1
#undef RENAME
#undef RENAMEl
#define RENAME(a) a ## _SSSE3
#define RENAMEl(a) a ## _sse2
#include "mpegvideo_mmx_template.c"
#endif
#endif
/* HAVE_INLINE_ASM */
void
ff_MPV_common_init_mmx
(
MpegEncContext
*
s
)
...
...
@@ -636,8 +590,6 @@ void ff_MPV_common_init_mmx(MpegEncContext *s)
int
mm_flags
=
av_get_cpu_flags
();
if
(
mm_flags
&
AV_CPU_FLAG_MMX
)
{
const
int
dct_algo
=
s
->
avctx
->
dct_algo
;
s
->
dct_unquantize_h263_intra
=
dct_unquantize_h263_intra_mmx
;
s
->
dct_unquantize_h263_inter
=
dct_unquantize_h263_inter_mmx
;
s
->
dct_unquantize_mpeg1_intra
=
dct_unquantize_mpeg1_intra_mmx
;
...
...
@@ -651,21 +603,6 @@ void ff_MPV_common_init_mmx(MpegEncContext *s)
}
else
{
s
->
denoise_dct
=
denoise_dct_mmx
;
}
if
(
dct_algo
==
FF_DCT_AUTO
||
dct_algo
==
FF_DCT_MMX
){
#if HAVE_SSSE3
if
(
mm_flags
&
AV_CPU_FLAG_SSSE3
){
s
->
dct_quantize
=
dct_quantize_SSSE3
;
}
else
#endif
if
(
mm_flags
&
AV_CPU_FLAG_SSE2
){
s
->
dct_quantize
=
dct_quantize_SSE2
;
}
else
if
(
mm_flags
&
AV_CPU_FLAG_MMXEXT
)
{
s
->
dct_quantize
=
dct_quantize_MMX2
;
}
else
{
s
->
dct_quantize
=
dct_quantize_MMX
;
}
}
}
#endif
/* HAVE_INLINE_ASM */
}
libavcodec/x86/mpegvideoenc.c
0 → 100644
View file @
d211547d
/*
* The simplest mpeg encoder (well, it was the simplest!)
* Copyright (c) 2000,2001 Fabrice Bellard
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
#include "dsputil_mmx.h"
#if HAVE_INLINE_ASM
extern
uint16_t
ff_inv_zigzag_direct16
[
64
];
#if HAVE_SSSE3
#define HAVE_SSSE3_BAK
#endif
#undef HAVE_SSSE3
#define HAVE_SSSE3 0
#undef HAVE_SSE2
#undef HAVE_MMXEXT
#define HAVE_SSE2 0
#define HAVE_MMXEXT 0
#define RENAME(a) a ## _MMX
#define RENAMEl(a) a ## _mmx
#include "mpegvideoenc_template.c"
#undef HAVE_MMXEXT
#define HAVE_MMXEXT 1
#undef RENAME
#undef RENAMEl
#define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2
#include "mpegvideoenc_template.c"
#undef HAVE_SSE2
#define HAVE_SSE2 1
#undef RENAME
#undef RENAMEl
#define RENAME(a) a ## _SSE2
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#ifdef HAVE_SSSE3_BAK
#undef HAVE_SSSE3
#define HAVE_SSSE3 1
#undef RENAME
#undef RENAMEl
#define RENAME(a) a ## _SSSE3
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif
#endif
/* HAVE_INLINE_ASM */
void
ff_MPV_encode_init_x86
(
MpegEncContext
*
s
)
{
#if HAVE_INLINE_ASM
int
mm_flags
=
av_get_cpu_flags
();
const
int
dct_algo
=
s
->
avctx
->
dct_algo
;
if
(
dct_algo
==
FF_DCT_AUTO
||
dct_algo
==
FF_DCT_MMX
)
{
#if HAVE_SSSE3
if
(
mm_flags
&
AV_CPU_FLAG_SSSE3
)
{
s
->
dct_quantize
=
dct_quantize_SSSE3
;
}
else
#endif
if
(
mm_flags
&
AV_CPU_FLAG_SSE2
)
{
s
->
dct_quantize
=
dct_quantize_SSE2
;
}
else
if
(
mm_flags
&
AV_CPU_FLAG_MMXEXT
)
{
s
->
dct_quantize
=
dct_quantize_MMX2
;
}
else
{
s
->
dct_quantize
=
dct_quantize_MMX
;
}
}
#endif
/* HAVE_INLINE_ASM */
}
libavcodec/x86/mpegvideo
_mmx
_template.c
→
libavcodec/x86/mpegvideo
enc
_template.c
View file @
d211547d
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment