Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
8302a7ef
Unverified
Commit
8302a7ef
authored
Apr 10, 2023
by
Wolle
Committed by
GitHub
Apr 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use mask in bitreader
it's much faster than bit shifting
parent
82cf74f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
src/flac_decoder/flac_decoder.cpp
src/flac_decoder/flac_decoder.cpp
+8
-2
src/flac_decoder/flac_decoder.h
src/flac_decoder/flac_decoder.h
+1
-1
No files found.
src/flac_decoder/flac_decoder.cpp
View file @
8302a7ef
...
...
@@ -4,7 +4,7 @@
* adapted to ESP32
*
* Created on: Jul 03,2020
* Updated on:
Feb
10,2023
* Updated on:
Apr
10,2023
*
* Author: Wolle
*
...
...
@@ -80,6 +80,12 @@ void FLACDecoder_FreeBuffers(){
//----------------------------------------------------------------------------------------------------------------------
// B I T R E A D E R
//----------------------------------------------------------------------------------------------------------------------
const
uint32_t
mask
[]
=
{
0x00000000
,
0x00000001
,
0x00000003
,
0x00000007
,
0x0000000f
,
0x0000001f
,
0x0000003f
,
0x0000007f
,
0x000000ff
,
0x000001ff
,
0x000003ff
,
0x000007ff
,
0x00000fff
,
0x00001fff
,
0x00003fff
,
0x00007fff
,
0x0000ffff
,
0x0001ffff
,
0x0003ffff
,
0x0007ffff
,
0x000fffff
,
0x001fffff
,
0x003fffff
,
0x007fffff
,
0x00ffffff
,
0x01ffffff
,
0x03ffffff
,
0x07ffffff
,
0x0fffffff
,
0x1fffffff
,
0x3fffffff
,
0x7fffffff
,
0xffffffff
};
uint32_t
readUint
(
uint8_t
nBits
,
int
*
bytesLeft
){
while
(
m_bitBufferLen
<
nBits
){
uint8_t
temp
=
*
(
m_inptr
+
m_rIndex
);
...
...
@@ -92,7 +98,7 @@ uint32_t readUint(uint8_t nBits, int *bytesLeft){
m_bitBufferLen
-=
nBits
;
uint32_t
result
=
m_bitBuffer
>>
m_bitBufferLen
;
if
(
nBits
<
32
)
result
&=
(
1
<<
nBits
)
-
1
;
result
&=
mask
[
nBits
]
;
return
result
;
}
...
...
src/flac_decoder/flac_decoder.h
View file @
8302a7ef
...
...
@@ -2,7 +2,7 @@
* flac_decoder.h
*
* Created on: Jul 03,2020
* Updated on:
Jan 08
,2023
* Updated on:
Apr 09
,2023
*
* Author: wolle
*
...
...
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