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
0db07a92
Commit
0db07a92
authored
Oct 30, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpc: moved sample size into a constant
Don't hard-code the "16 bits" or "2 bytes" in multiple locations.
parent
6773dea5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
mpc_plugin.c
src/decoder/mpc_plugin.c
+9
-5
No files found.
src/decoder/mpc_plugin.c
View file @
0db07a92
...
...
@@ -68,18 +68,22 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
/* only doing 16-bit audio for now */
int32_t
val
;
const
int
clip_min
=
-
1
<<
(
16
-
1
);
const
int
clip_max
=
(
1
<<
(
16
-
1
))
-
1
;
enum
{
bits
=
16
,
};
const
int
clip_min
=
-
1
<<
(
bits
-
1
);
const
int
clip_max
=
(
1
<<
(
bits
-
1
))
-
1
;
#ifdef MPC_FIXED_POINT
const
int
shift
=
16
-
MPC_FIXED_POINT_SCALE_SHIFT
;
const
int
shift
=
bits
-
MPC_FIXED_POINT_SCALE_SHIFT
;
if
(
shift
<
0
)
val
=
sample
<<
-
shift
;
else
val
=
sample
<<
shift
;
#else
const
int
float_scale
=
1
<<
(
16
-
1
);
const
int
float_scale
=
1
<<
(
bits
-
1
);
val
=
sample
*
float_scale
;
#endif
...
...
@@ -191,7 +195,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
/* 16 bit audio again */
*
dest
++
=
convertSample
(
sample_buffer
[
i
]);
chunkpos
+=
2
;
chunkpos
+=
sizeof
(
*
dest
)
;
if
(
chunkpos
>=
MPC_CHUNK_SIZE
)
{
total_time
=
((
float
)
samplePos
)
/
...
...
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