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
1e89ca09
Commit
1e89ca09
authored
Oct 20, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsdiff: provide floating point samples
Eliminate the conversion to integer samples, the MPD core can do this now.
parent
92bb10ee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
30 deletions
+3
-30
dsdiff_decoder_plugin.c
src/decoder/dsdiff_decoder_plugin.c
+3
-30
No files found.
src/decoder/dsdiff_decoder_plugin.c
View file @
1e89ca09
...
@@ -300,31 +300,6 @@ dsdiff_read_metadata(struct decoder *decoder, struct input_stream *is,
...
@@ -300,31 +300,6 @@ dsdiff_read_metadata(struct decoder *decoder, struct input_stream *is,
}
}
}
}
G_GNUC_CONST
static
inline
int32_t
clip
(
int32_t
min
,
int32_t
value
,
int32_t
max
)
{
if
(
G_UNLIKELY
(
value
<
min
))
value
=
min
;
else
if
(
G_UNLIKELY
(
value
>
max
))
value
=
max
;
return
value
;
}
/**
* Convert an array of float samples [-1 .. +1] to padded 24 bit
* samples.
*/
static
void
float_to_uint24
(
int32_t
*
dest
,
const
float
*
src
,
size_t
length
)
{
const
float
*
src_end
=
src
+
length
;
while
(
src
<
src_end
)
{
float
f_sample
=
*
src
++
*
8388608
;
*
dest
++
=
clip
(
-
8388608
,
(
int32_t
)
f_sample
,
8388607
);
}
}
/**
/**
* Decode one "DSD" chunk.
* Decode one "DSD" chunk.
*/
*/
...
@@ -340,7 +315,6 @@ dsdiff_decode_chunk(struct decoder *decoder, struct input_stream *is,
...
@@ -340,7 +315,6 @@ dsdiff_decode_chunk(struct decoder *decoder, struct input_stream *is,
const
unsigned
buffer_samples
=
buffer_frames
*
frame_size
;
const
unsigned
buffer_samples
=
buffer_frames
*
frame_size
;
const
size_t
buffer_size
=
buffer_samples
*
sample_size
;
const
size_t
buffer_size
=
buffer_samples
*
sample_size
;
float
f_buffer
[
G_N_ELEMENTS
(
buffer
)];
float
f_buffer
[
G_N_ELEMENTS
(
buffer
)];
int32_t
i_buffer
[
G_N_ELEMENTS
(
buffer
)];
while
(
chunk_size
>
0
)
{
while
(
chunk_size
>
0
)
{
/* see how much aligned data from the remaining chunk
/* see how much aligned data from the remaining chunk
...
@@ -370,10 +344,9 @@ dsdiff_decode_chunk(struct decoder *decoder, struct input_stream *is,
...
@@ -370,10 +344,9 @@ dsdiff_decode_chunk(struct decoder *decoder, struct input_stream *is,
/* convert to integer and submit to the decoder API */
/* convert to integer and submit to the decoder API */
float_to_uint24
(
i_buffer
,
f_buffer
,
now_samples
);
enum
decoder_command
cmd
=
enum
decoder_command
cmd
=
decoder_data
(
decoder
,
is
,
i
_buffer
,
decoder_data
(
decoder
,
is
,
f
_buffer
,
now_samples
*
sizeof
(
i
_buffer
[
0
]),
now_samples
*
sizeof
(
f
_buffer
[
0
]),
0
);
0
);
switch
(
cmd
)
{
switch
(
cmd
)
{
case
DECODE_COMMAND_NONE
:
case
DECODE_COMMAND_NONE
:
...
@@ -408,7 +381,7 @@ dsdiff_stream_decode(struct decoder *decoder, struct input_stream *is)
...
@@ -408,7 +381,7 @@ dsdiff_stream_decode(struct decoder *decoder, struct input_stream *is)
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
struct
audio_format
audio_format
;
struct
audio_format
audio_format
;
if
(
!
audio_format_init_checked
(
&
audio_format
,
metadata
.
sample_rate
/
8
,
if
(
!
audio_format_init_checked
(
&
audio_format
,
metadata
.
sample_rate
/
8
,
SAMPLE_FORMAT_
S24_P32
,
SAMPLE_FORMAT_
FLOAT
,
metadata
.
channels
,
&
error
))
{
metadata
.
channels
,
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
g_error_free
(
error
);
...
...
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