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
57cbcdf2
Commit
57cbcdf2
authored
Aug 21, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsf: make the "scratch" buffer local
This allows the compiler to discard buffer contents between two function calls.
parent
455fd180
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
DsfDecoderPlugin.cxx
src/decoder/plugins/DsfDecoderPlugin.cxx
+5
-6
No files found.
src/decoder/plugins/DsfDecoderPlugin.cxx
View file @
57cbcdf2
...
@@ -193,8 +193,11 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
...
@@ -193,8 +193,11 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
* order.
* order.
*/
*/
static
void
static
void
dsf_to_pcm_order
(
uint8_t
*
dest
,
uint8_t
*
scratch
,
size_t
nrbytes
)
dsf_to_pcm_order
(
uint8_t
*
dest
,
size_t
nrbytes
)
{
{
uint8_t
scratch
[
8192
];
assert
(
nrbytes
<=
sizeof
(
scratch
));
for
(
unsigned
i
=
0
,
j
=
0
;
i
<
(
unsigned
)
nrbytes
;
i
+=
2
)
{
for
(
unsigned
i
=
0
,
j
=
0
;
i
<
(
unsigned
)
nrbytes
;
i
+=
2
)
{
scratch
[
i
]
=
*
(
dest
+
j
);
scratch
[
i
]
=
*
(
dest
+
j
);
j
++
;
j
++
;
...
@@ -222,10 +225,6 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
...
@@ -222,10 +225,6 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
{
{
uint8_t
buffer
[
8192
];
uint8_t
buffer
[
8192
];
/* scratch buffer for DSF samples to convert to the needed
normal left/right regime of samples */
uint8_t
dsf_scratch_buffer
[
8192
];
const
size_t
sample_size
=
sizeof
(
buffer
[
0
]);
const
size_t
sample_size
=
sizeof
(
buffer
[
0
]);
const
size_t
frame_size
=
channels
*
sample_size
;
const
size_t
frame_size
=
channels
*
sample_size
;
const
unsigned
buffer_frames
=
sizeof
(
buffer
)
/
frame_size
;
const
unsigned
buffer_frames
=
sizeof
(
buffer
)
/
frame_size
;
...
@@ -250,7 +249,7 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
...
@@ -250,7 +249,7 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
if
(
bitreverse
)
if
(
bitreverse
)
bit_reverse_buffer
(
buffer
,
buffer
+
nbytes
);
bit_reverse_buffer
(
buffer
,
buffer
+
nbytes
);
dsf_to_pcm_order
(
buffer
,
dsf_scratch_buffer
,
nbytes
);
dsf_to_pcm_order
(
buffer
,
nbytes
);
const
auto
cmd
=
decoder_data
(
decoder
,
is
,
buffer
,
nbytes
,
const
auto
cmd
=
decoder_data
(
decoder
,
is
,
buffer
,
nbytes
,
sample_rate
/
1000
);
sample_rate
/
1000
);
...
...
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