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
cf3bf5bb
Commit
cf3bf5bb
authored
Oct 23, 2003
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor mmx2 optimization if the dct
Originally committed as revision 2423 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
1745173b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
5 deletions
+41
-5
dsputil.h
libavcodec/dsputil.h
+1
-0
dsputil_mmx.c
libavcodec/i386/dsputil_mmx.c
+7
-2
fdct_mmx.c
libavcodec/i386/fdct_mmx.c
+30
-2
mpegvideo_mmx.c
libavcodec/i386/mpegvideo_mmx.c
+2
-0
mpegvideo_mmx_template.c
libavcodec/i386/mpegvideo_mmx_template.c
+1
-1
No files found.
libavcodec/dsputil.h
View file @
cf3bf5bb
...
@@ -41,6 +41,7 @@ void ff_jpeg_fdct_islow (DCTELEM *data);
...
@@ -41,6 +41,7 @@ void ff_jpeg_fdct_islow (DCTELEM *data);
void
j_rev_dct
(
DCTELEM
*
data
);
void
j_rev_dct
(
DCTELEM
*
data
);
void
ff_fdct_mmx
(
DCTELEM
*
block
);
void
ff_fdct_mmx
(
DCTELEM
*
block
);
void
ff_fdct_mmx2
(
DCTELEM
*
block
);
/* encoding scans */
/* encoding scans */
extern
const
uint8_t
ff_alternate_horizontal_scan
[
64
];
extern
const
uint8_t
ff_alternate_horizontal_scan
[
64
];
...
...
libavcodec/i386/dsputil_mmx.c
View file @
cf3bf5bb
...
@@ -1603,8 +1603,13 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
...
@@ -1603,8 +1603,13 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
const
int
idct_algo
=
avctx
->
idct_algo
;
const
int
idct_algo
=
avctx
->
idct_algo
;
#ifdef CONFIG_ENCODERS
#ifdef CONFIG_ENCODERS
if
(
dct_algo
==
FF_DCT_AUTO
||
dct_algo
==
FF_DCT_MMX
)
if
(
dct_algo
==
FF_DCT_AUTO
||
dct_algo
==
FF_DCT_MMX
){
if
(
mm_flags
&
MM_MMXEXT
){
c
->
fdct
=
ff_fdct_mmx2
;
}
else
{
c
->
fdct
=
ff_fdct_mmx
;
c
->
fdct
=
ff_fdct_mmx
;
}
}
#endif //CONFIG_ENCODERS
#endif //CONFIG_ENCODERS
if
(
idct_algo
==
FF_IDCT_AUTO
||
idct_algo
==
FF_IDCT_SIMPLEMMX
){
if
(
idct_algo
==
FF_IDCT_AUTO
||
idct_algo
==
FF_IDCT_SIMPLEMMX
){
...
...
libavcodec/i386/fdct_mmx.c
View file @
cf3bf5bb
...
@@ -210,14 +210,19 @@ static always_inline void fdct_col(const int16_t *in, int16_t *out, int offset)
...
@@ -210,14 +210,19 @@ static always_inline void fdct_col(const int16_t *in, int16_t *out, int offset)
movq_r2m
(
mm3
,
*
(
out
+
offset
+
7
*
8
));
movq_r2m
(
mm3
,
*
(
out
+
offset
+
7
*
8
));
}
}
static
always_inline
void
fdct_row
(
const
int16_t
*
in
,
int16_t
*
out
,
const
int16_t
*
table
)
static
always_inline
void
fdct_row
(
const
int16_t
*
in
,
int16_t
*
out
,
const
int16_t
*
table
,
int
mmx2
)
{
{
if
(
mmx2
){
pshufw_m2r
(
*
(
in
+
4
),
mm5
,
0x1B
);
movq_m2r
(
*
(
in
+
0
),
mm0
);
}
else
{
movd_m2r
(
*
(
in
+
6
),
mm5
);
movd_m2r
(
*
(
in
+
6
),
mm5
);
punpcklwd_m2r
(
*
(
in
+
4
),
mm5
);
punpcklwd_m2r
(
*
(
in
+
4
),
mm5
);
movq_r2r
(
mm5
,
mm2
);
movq_r2r
(
mm5
,
mm2
);
psrlq_i2r
(
0x20
,
mm5
);
psrlq_i2r
(
0x20
,
mm5
);
movq_m2r
(
*
(
in
+
0
),
mm0
);
movq_m2r
(
*
(
in
+
0
),
mm0
);
punpcklwd_r2r
(
mm2
,
mm5
);
punpcklwd_r2r
(
mm2
,
mm5
);
}
movq_r2r
(
mm0
,
mm1
);
movq_r2r
(
mm0
,
mm1
);
paddsw_r2r
(
mm5
,
mm0
);
paddsw_r2r
(
mm5
,
mm0
);
psubsw_r2r
(
mm5
,
mm1
);
psubsw_r2r
(
mm5
,
mm1
);
...
@@ -283,7 +288,30 @@ void ff_fdct_mmx(int16_t *block)
...
@@ -283,7 +288,30 @@ void ff_fdct_mmx(int16_t *block)
table
=
tab_frw_01234567
;
table
=
tab_frw_01234567
;
out
=
block
;
out
=
block
;
for
(
i
=
8
;
i
>
0
;
i
--
)
{
for
(
i
=
8
;
i
>
0
;
i
--
)
{
fdct_row
(
block1
,
out
,
table
);
fdct_row
(
block1
,
out
,
table
,
0
);
block1
+=
8
;
table
+=
32
;
out
+=
8
;
}
}
void
ff_fdct_mmx2
(
int16_t
*
block
)
{
int64_t
align_tmp
[
16
]
ATTR_ALIGN
(
8
);
int16_t
*
const
block_tmp
=
(
int16_t
*
)
align_tmp
;
int16_t
*
block1
,
*
out
;
const
int16_t
*
table
;
int
i
;
block1
=
block_tmp
;
fdct_col
(
block
,
block1
,
0
);
fdct_col
(
block
,
block1
,
4
);
block1
=
block_tmp
;
table
=
tab_frw_01234567
;
out
=
block
;
for
(
i
=
8
;
i
>
0
;
i
--
)
{
fdct_row
(
block1
,
out
,
table
,
1
);
block1
+=
8
;
block1
+=
8
;
table
+=
32
;
table
+=
32
;
out
+=
8
;
out
+=
8
;
...
...
libavcodec/i386/mpegvideo_mmx.c
View file @
cf3bf5bb
...
@@ -490,11 +490,13 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
...
@@ -490,11 +490,13 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
#undef HAVE_MMX2
#undef HAVE_MMX2
#define RENAME(a) a ## _MMX
#define RENAME(a) a ## _MMX
#define RENAMEl(a) a ## _mmx
#include "mpegvideo_mmx_template.c"
#include "mpegvideo_mmx_template.c"
#define HAVE_MMX2
#define HAVE_MMX2
#undef RENAME
#undef RENAME
#define RENAME(a) a ## _MMX2
#define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2
#include "mpegvideo_mmx_template.c"
#include "mpegvideo_mmx_template.c"
void
MPV_common_init_mmx
(
MpegEncContext
*
s
)
void
MPV_common_init_mmx
(
MpegEncContext
*
s
)
...
...
libavcodec/i386/mpegvideo_mmx_template.c
View file @
cf3bf5bb
...
@@ -43,7 +43,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
...
@@ -43,7 +43,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
assert
((
7
&
(
int
)(
&
temp_block
[
0
]))
==
0
);
//did gcc align it correctly?
assert
((
7
&
(
int
)(
&
temp_block
[
0
]))
==
0
);
//did gcc align it correctly?
//s->fdct (block);
//s->fdct (block);
ff_fdct_mmx
(
block
);
//cant be anything else ...
RENAMEl
(
ff_fdct
)
(
block
);
//cant be anything else ...
if
(
s
->
mb_intra
)
{
if
(
s
->
mb_intra
)
{
int
dummy
;
int
dummy
;
...
...
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