Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a47e9d1a
Commit
a47e9d1a
authored
Oct 09, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_pack: pass an "end" pointer instead of a sample count
parent
e93dd374
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
12 deletions
+13
-12
pcm_convert.c
src/pcm_convert.c
+2
-1
pcm_format.c
src/pcm_format.c
+1
-1
pcm_pack.c
src/pcm_pack.c
+6
-6
pcm_pack.h
src/pcm_pack.h
+2
-2
test_pcm_pack.c
test/test_pcm_pack.c
+2
-2
No files found.
src/pcm_convert.c
View file @
a47e9d1a
...
...
@@ -200,7 +200,8 @@ pcm_convert_24_packed(struct pcm_convert_state *state,
size_t
dest_size
=
num_samples
*
3
;
uint8_t
*
dest
=
pcm_buffer_get
(
&
state
->
pack_buffer
,
dest_size
);
pcm_pack_24
(
dest
,
buffer
,
num_samples
,
dest_format
->
reverse_endian
);
pcm_pack_24
(
dest
,
buffer
,
buffer
+
num_samples
,
dest_format
->
reverse_endian
);
*
dest_size_r
=
dest_size
;
return
dest
;
...
...
src/pcm_format.c
View file @
a47e9d1a
...
...
@@ -54,7 +54,7 @@ pcm_convert_24_to_24p32(struct pcm_buffer *buffer, const uint8_t *src,
unsigned
num_samples
)
{
int32_t
*
dest
=
pcm_buffer_get
(
buffer
,
num_samples
*
4
);
pcm_unpack_24
(
dest
,
src
,
num_samples
,
false
);
pcm_unpack_24
(
dest
,
src
,
src
+
num_samples
*
3
,
false
);
return
dest
;
}
...
...
src/pcm_pack.c
View file @
a47e9d1a
...
...
@@ -35,19 +35,19 @@ pack_sample(uint8_t *dest, const int32_t *src0, bool reverse_endian)
}
void
pcm_pack_24
(
uint8_t
*
dest
,
const
int32_t
*
src
,
unsigned
num_samples
,
pcm_pack_24
(
uint8_t
*
dest
,
const
int32_t
*
src
,
const
int32_t
*
src_end
,
bool
reverse_endian
)
{
/* duplicate loop to help the compiler's optimizer (constant
parameter to the pack_sample() inline function) */
if
(
G_LIKELY
(
!
reverse_endian
))
{
while
(
num_samples
--
>
0
)
{
while
(
src
<
src_end
)
{
pack_sample
(
dest
,
src
++
,
false
);
dest
+=
3
;
}
}
else
{
while
(
num_samples
--
>
0
)
{
while
(
src
<
src_end
)
{
pack_sample
(
dest
,
src
++
,
true
);
dest
+=
3
;
}
...
...
@@ -73,19 +73,19 @@ unpack_sample(int32_t *dest0, const uint8_t *src, bool reverse_endian)
}
void
pcm_unpack_24
(
int32_t
*
dest
,
const
uint8_t
*
src
,
unsigned
num_samples
,
pcm_unpack_24
(
int32_t
*
dest
,
const
uint8_t
*
src
,
const
uint8_t
*
src_end
,
bool
reverse_endian
)
{
/* duplicate loop to help the compiler's optimizer (constant
parameter to the unpack_sample() inline function) */
if
(
G_LIKELY
(
!
reverse_endian
))
{
while
(
num_samples
--
>
0
)
{
while
(
src
<
src_end
)
{
unpack_sample
(
dest
++
,
src
,
false
);
src
+=
3
;
}
}
else
{
while
(
num_samples
--
>
0
)
{
while
(
src
<
src_end
)
{
unpack_sample
(
dest
++
,
src
,
true
);
src
+=
3
;
}
...
...
src/pcm_pack.h
View file @
a47e9d1a
...
...
@@ -40,7 +40,7 @@
* @param reverse_endian is src and dest in non-host byte order?
*/
void
pcm_pack_24
(
uint8_t
*
dest
,
const
int32_t
*
src
,
unsigned
num_samples
,
pcm_pack_24
(
uint8_t
*
dest
,
const
int32_t
*
src
,
const
int32_t
*
src_end
,
bool
reverse_endian
);
/**
...
...
@@ -53,7 +53,7 @@ pcm_pack_24(uint8_t *dest, const int32_t *src, unsigned num_samples,
* @param reverse_endian is src and dest in non-host byte order?
*/
void
pcm_unpack_24
(
int32_t
*
dest
,
const
uint8_t
*
src
,
unsigned
num_samples
,
pcm_unpack_24
(
int32_t
*
dest
,
const
uint8_t
*
src
,
const
uint8_t
*
src_end
,
bool
reverse_endian
);
#endif
test/test_pcm_pack.c
View file @
a47e9d1a
...
...
@@ -44,7 +44,7 @@ test_pcm_pack_24(void)
uint8_t
dest
[
N
*
3
];
pcm_pack_24
(
dest
,
src
,
N
,
false
);
pcm_pack_24
(
dest
,
src
,
src
+
N
,
false
);
for
(
unsigned
i
=
0
;
i
<
N
;
++
i
)
{
int32_t
d
;
...
...
@@ -71,7 +71,7 @@ test_pcm_unpack_24(void)
int32_t
dest
[
N
];
pcm_unpack_24
(
dest
,
src
,
N
,
false
);
pcm_unpack_24
(
dest
,
src
,
src
+
G_N_ELEMENTS
(
src
)
,
false
);
for
(
unsigned
i
=
0
;
i
<
N
;
++
i
)
{
int32_t
s
;
...
...
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