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
7014b659
Commit
7014b659
authored
May 11, 2015
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc: pixblockdsp: Use the abriged vector types
parent
72cebae0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
23 deletions
+20
-23
pixblockdsp.c
libavcodec/ppc/pixblockdsp.c
+20
-23
No files found.
libavcodec/ppc/pixblockdsp.c
View file @
7014b659
...
@@ -39,24 +39,22 @@ static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels,
...
@@ -39,24 +39,22 @@ static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels,
int
line_size
)
int
line_size
)
{
{
int
i
;
int
i
;
vector
unsigned
char
perm
=
vec_lvsl
(
0
,
pixels
);
vec_u8
perm
=
vec_lvsl
(
0
,
pixels
);
const
vector
unsigned
char
zero
=
const
vec_u8
zero
=
(
const
vec_u8
)
vec_splat_u8
(
0
);
(
const
vector
unsigned
char
)
vec_splat_u8
(
0
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
{
/* Read potentially unaligned pixels.
/* Read potentially unaligned pixels.
* We're reading 16 pixels, and actually only want 8,
* We're reading 16 pixels, and actually only want 8,
* but we simply ignore the extras. */
* but we simply ignore the extras. */
vec
tor
unsigned
char
pixl
=
vec_ld
(
0
,
pixels
);
vec
_u8
pixl
=
vec_ld
(
0
,
pixels
);
vec
tor
unsigned
char
pixr
=
vec_ld
(
7
,
pixels
);
vec
_u8
pixr
=
vec_ld
(
7
,
pixels
);
vec
tor
unsigned
char
bytes
=
vec_perm
(
pixl
,
pixr
,
perm
);
vec
_u8
bytes
=
vec_perm
(
pixl
,
pixr
,
perm
);
// Convert the bytes into shorts.
// Convert the bytes into shorts.
vector
signed
short
shorts
=
(
vector
signed
short
)
vec_mergeh
(
zero
,
vec_s16
shorts
=
(
vec_s16
)
vec_mergeh
(
zero
,
bytes
);
bytes
);
// Save the data to the block, we assume the block is 16-byte aligned.
// Save the data to the block, we assume the block is 16-byte aligned.
vec_st
(
shorts
,
i
*
16
,
(
vec
tor
signed
short
*
)
block
);
vec_st
(
shorts
,
i
*
16
,
(
vec
_s16
*
)
block
);
pixels
+=
line_size
;
pixels
+=
line_size
;
}
}
...
@@ -66,22 +64,21 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
...
@@ -66,22 +64,21 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
const
uint8_t
*
s2
,
int
stride
)
const
uint8_t
*
s2
,
int
stride
)
{
{
int
i
;
int
i
;
vector
unsigned
char
perm1
=
vec_lvsl
(
0
,
s1
);
vec_u8
perm1
=
vec_lvsl
(
0
,
s1
);
vector
unsigned
char
perm2
=
vec_lvsl
(
0
,
s2
);
vec_u8
perm2
=
vec_lvsl
(
0
,
s2
);
const
vector
unsigned
char
zero
=
const
vec_u8
zero
=
(
const
vec_u8
)
vec_splat_u8
(
0
);
(
const
vector
unsigned
char
)
vec_splat_u8
(
0
);
vec_s16
shorts1
,
shorts2
;
vector
signed
short
shorts1
,
shorts2
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
/* Read potentially unaligned pixels.
/* Read potentially unaligned pixels.
* We're reading 16 pixels, and actually only want 8,
* We're reading 16 pixels, and actually only want 8,
* but we simply ignore the extras. */
* but we simply ignore the extras. */
vec
tor
unsigned
char
pixl
=
vec_ld
(
0
,
s1
);
vec
_u8
pixl
=
vec_ld
(
0
,
s1
);
vec
tor
unsigned
char
pixr
=
vec_ld
(
15
,
s1
);
vec
_u8
pixr
=
vec_ld
(
15
,
s1
);
vec
tor
unsigned
char
bytes
=
vec_perm
(
pixl
,
pixr
,
perm1
);
vec
_u8
bytes
=
vec_perm
(
pixl
,
pixr
,
perm1
);
// Convert the bytes into shorts.
// Convert the bytes into shorts.
shorts1
=
(
vec
tor
signed
short
)
vec_mergeh
(
zero
,
bytes
);
shorts1
=
(
vec
_s16
)
vec_mergeh
(
zero
,
bytes
);
// Do the same for the second block of pixels.
// Do the same for the second block of pixels.
pixl
=
vec_ld
(
0
,
s2
);
pixl
=
vec_ld
(
0
,
s2
);
...
@@ -89,13 +86,13 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
...
@@ -89,13 +86,13 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
bytes
=
vec_perm
(
pixl
,
pixr
,
perm2
);
bytes
=
vec_perm
(
pixl
,
pixr
,
perm2
);
// Convert the bytes into shorts.
// Convert the bytes into shorts.
shorts2
=
(
vec
tor
signed
short
)
vec_mergeh
(
zero
,
bytes
);
shorts2
=
(
vec
_s16
)
vec_mergeh
(
zero
,
bytes
);
// Do the subtraction.
// Do the subtraction.
shorts1
=
vec_sub
(
shorts1
,
shorts2
);
shorts1
=
vec_sub
(
shorts1
,
shorts2
);
// Save the data to the block, we assume the block is 16-byte aligned.
// Save the data to the block, we assume the block is 16-byte aligned.
vec_st
(
shorts1
,
0
,
(
vec
tor
signed
short
*
)
block
);
vec_st
(
shorts1
,
0
,
(
vec
_s16
*
)
block
);
s1
+=
stride
;
s1
+=
stride
;
s2
+=
stride
;
s2
+=
stride
;
...
@@ -112,7 +109,7 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
...
@@ -112,7 +109,7 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
bytes
=
vec_perm
(
pixl
,
pixr
,
perm1
);
bytes
=
vec_perm
(
pixl
,
pixr
,
perm1
);
// Convert the bytes into shorts.
// Convert the bytes into shorts.
shorts1
=
(
vec
tor
signed
short
)
vec_mergeh
(
zero
,
bytes
);
shorts1
=
(
vec
_s16
)
vec_mergeh
(
zero
,
bytes
);
// Do the same for the second block of pixels.
// Do the same for the second block of pixels.
pixl
=
vec_ld
(
0
,
s2
);
pixl
=
vec_ld
(
0
,
s2
);
...
@@ -120,13 +117,13 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
...
@@ -120,13 +117,13 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
bytes
=
vec_perm
(
pixl
,
pixr
,
perm2
);
bytes
=
vec_perm
(
pixl
,
pixr
,
perm2
);
// Convert the bytes into shorts.
// Convert the bytes into shorts.
shorts2
=
(
vec
tor
signed
short
)
vec_mergeh
(
zero
,
bytes
);
shorts2
=
(
vec
_s16
)
vec_mergeh
(
zero
,
bytes
);
// Do the subtraction.
// Do the subtraction.
shorts1
=
vec_sub
(
shorts1
,
shorts2
);
shorts1
=
vec_sub
(
shorts1
,
shorts2
);
// Save the data to the block, we assume the block is 16-byte aligned.
// Save the data to the block, we assume the block is 16-byte aligned.
vec_st
(
shorts1
,
0
,
(
vec
tor
signed
short
*
)
block
);
vec_st
(
shorts1
,
0
,
(
vec
_s16
*
)
block
);
s1
+=
stride
;
s1
+=
stride
;
s2
+=
stride
;
s2
+=
stride
;
...
...
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