Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
21924246
Commit
21924246
authored
Aug 29, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update dr_flac.
parent
e511458e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
25 deletions
+30
-25
extras/dr_flac.h
extras/dr_flac.h
+30
-25
No files found.
extras/dr_flac.h
View file @
21924246
// FLAC audio decoder. Public domain. See "unlicense" statement at the end of this file.
// dr_flac - v0.9.1
0 - 2018-08-07
// dr_flac - v0.9.1
1 - 2018-08-29
//
// David Reid - mackron@gmail.com
...
...
@@ -5146,10 +5146,10 @@ drflac_uint64 drflac__read_s32__misaligned(drflac* pFlac, drflac_uint64 samplesT
case
DRFLAC_CHANNEL_ASSIGNMENT_LEFT_SIDE
:
{
if
(
channelIndex
==
0
)
{
decodedSample
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
].
pDecodedSamples
[
nextSampleInFrame
]
;
decodedSample
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
}
else
{
int
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
];
int
left
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
-
1
].
pDecodedSamples
[
nextSampleInFrame
];
int
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
int
left
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
-
1
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
-
1
].
wastedBitsPerSample
;
decodedSample
=
left
-
side
;
}
}
break
;
...
...
@@ -5157,11 +5157,11 @@ drflac_uint64 drflac__read_s32__misaligned(drflac* pFlac, drflac_uint64 samplesT
case
DRFLAC_CHANNEL_ASSIGNMENT_RIGHT_SIDE
:
{
if
(
channelIndex
==
0
)
{
int
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
];
int
right
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
1
].
pDecodedSamples
[
nextSampleInFrame
];
int
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
int
right
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
1
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
1
].
wastedBitsPerSample
;
decodedSample
=
side
+
right
;
}
else
{
decodedSample
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
].
pDecodedSamples
[
nextSampleInFrame
]
;
decodedSample
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
}
}
break
;
...
...
@@ -5170,14 +5170,14 @@ drflac_uint64 drflac__read_s32__misaligned(drflac* pFlac, drflac_uint64 samplesT
int
mid
;
int
side
;
if
(
channelIndex
==
0
)
{
mid
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
];
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
1
].
pDecodedSamples
[
nextSampleInFrame
];
mid
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
1
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
1
].
wastedBitsPerSample
;
mid
=
(((
unsigned
int
)
mid
)
<<
1
)
|
(
side
&
0x01
);
decodedSample
=
(
mid
+
side
)
>>
1
;
}
else
{
mid
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
-
1
].
pDecodedSamples
[
nextSampleInFrame
];
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
];
mid
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
-
1
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
-
1
].
wastedBitsPerSample
;
side
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
mid
=
(((
unsigned
int
)
mid
)
<<
1
)
|
(
side
&
0x01
);
decodedSample
=
(
mid
-
side
)
>>
1
;
...
...
@@ -5187,12 +5187,12 @@ drflac_uint64 drflac__read_s32__misaligned(drflac* pFlac, drflac_uint64 samplesT
case
DRFLAC_CHANNEL_ASSIGNMENT_INDEPENDENT
:
default:
{
decodedSample
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
].
pDecodedSamples
[
nextSampleInFrame
]
;
decodedSample
=
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
pDecodedSamples
[
nextSampleInFrame
]
<<
pFlac
->
currentFrame
.
subframes
[
channelIndex
+
0
].
wastedBitsPerSample
;
}
break
;
}
decodedSample
<<=
(
(
32
-
pFlac
->
bitsPerSample
)
+
pFlac
->
currentFrame
.
subframes
[
channelIndex
].
wastedB
itsPerSample
);
decodedSample
<<=
(
32
-
pFlac
->
b
itsPerSample
);
if
(
bufferOut
)
{
*
bufferOut
++
=
decodedSample
;
...
...
@@ -5284,12 +5284,12 @@ drflac_uint64 drflac_read_s32(drflac* pFlac, drflac_uint64 samplesToRead, drflac
const
drflac_int32
*
pDecodedSamples1
=
pFlac
->
currentFrame
.
subframes
[
1
].
pDecodedSamples
+
firstAlignedSampleInFrame
;
for
(
drflac_uint64
i
=
0
;
i
<
alignedSampleCountPerChannel
;
++
i
)
{
int
left
=
pDecodedSamples0
[
i
];
int
side
=
pDecodedSamples1
[
i
];
int
left
=
pDecodedSamples0
[
i
]
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
0
].
wastedBitsPerSample
)
;
int
side
=
pDecodedSamples1
[
i
]
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
1
].
wastedBitsPerSample
)
;
int
right
=
left
-
side
;
bufferOut
[
i
*
2
+
0
]
=
left
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
0
].
wastedBitsPerSample
)
;
bufferOut
[
i
*
2
+
1
]
=
right
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
1
].
wastedBitsPerSample
)
;
bufferOut
[
i
*
2
+
0
]
=
left
;
bufferOut
[
i
*
2
+
1
]
=
right
;
}
}
break
;
...
...
@@ -5299,12 +5299,12 @@ drflac_uint64 drflac_read_s32(drflac* pFlac, drflac_uint64 samplesToRead, drflac
const
drflac_int32
*
pDecodedSamples1
=
pFlac
->
currentFrame
.
subframes
[
1
].
pDecodedSamples
+
firstAlignedSampleInFrame
;
for
(
drflac_uint64
i
=
0
;
i
<
alignedSampleCountPerChannel
;
++
i
)
{
int
side
=
pDecodedSamples0
[
i
];
int
right
=
pDecodedSamples1
[
i
];
int
side
=
pDecodedSamples0
[
i
]
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
0
].
wastedBitsPerSample
)
;
int
right
=
pDecodedSamples1
[
i
]
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
1
].
wastedBitsPerSample
)
;
int
left
=
right
+
side
;
bufferOut
[
i
*
2
+
0
]
=
left
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
0
].
wastedBitsPerSample
)
;
bufferOut
[
i
*
2
+
1
]
=
right
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
1
].
wastedBitsPerSample
)
;
bufferOut
[
i
*
2
+
0
]
=
left
;
bufferOut
[
i
*
2
+
1
]
=
right
;
}
}
break
;
...
...
@@ -5314,11 +5314,13 @@ drflac_uint64 drflac_read_s32(drflac* pFlac, drflac_uint64 samplesToRead, drflac
const
drflac_int32
*
pDecodedSamples1
=
pFlac
->
currentFrame
.
subframes
[
1
].
pDecodedSamples
+
firstAlignedSampleInFrame
;
for
(
drflac_uint64
i
=
0
;
i
<
alignedSampleCountPerChannel
;
++
i
)
{
int
side
=
pDecodedSamples1
[
i
];
int
mid
=
(((
drflac_uint32
)
pDecodedSamples0
[
i
])
<<
1
)
|
(
side
&
0x01
);
int
mid
=
pDecodedSamples0
[
i
]
<<
pFlac
->
currentFrame
.
subframes
[
0
].
wastedBitsPerSample
;
int
side
=
pDecodedSamples1
[
i
]
<<
pFlac
->
currentFrame
.
subframes
[
1
].
wastedBitsPerSample
;
mid
=
(((
drflac_uint32
)
mid
)
<<
1
)
|
(
side
&
0x01
);
bufferOut
[
i
*
2
+
0
]
=
((
mid
+
side
)
>>
1
)
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
0
].
wastedBitsPerSample
);
bufferOut
[
i
*
2
+
1
]
=
((
mid
-
side
)
>>
1
)
<<
(
unusedBitsPerSample
+
pFlac
->
currentFrame
.
subframes
[
1
].
wastedBitsPerSample
);
bufferOut
[
i
*
2
+
0
]
=
((
mid
+
side
)
>>
1
)
<<
(
unusedBitsPerSample
);
bufferOut
[
i
*
2
+
1
]
=
((
mid
-
side
)
>>
1
)
<<
(
unusedBitsPerSample
);
}
}
break
;
...
...
@@ -5750,6 +5752,9 @@ const char* drflac_next_vorbis_comment(drflac_vorbis_comment_iterator* pIter, dr
// REVISION HISTORY
//
// v0.9.11 - 2018-08-29
// - Fix a bug with sample reconstruction.
//
// v0.9.10 - 2018-08-07
// - Improve 64-bit detection.
//
...
...
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