Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
fa10905e
There was an error fetching the commit references. Please try again later.
Commit
fa10905e
authored
6 years ago
by
David Marcec
Browse files
Options
Downloads
Patches
Plain Diff
HwOpus, Implemented DecodeInterleavedWithPerformance
Used by sonic ages
parent
6d82c4ad
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/hle/service/audio/hwopus.cpp
+34
-3
34 additions, 3 deletions
src/core/hle/service/audio/hwopus.cpp
with
34 additions
and
3 deletions
src/core/hle/service/audio/hwopus.cpp
+
34
−
3
View file @
fa10905e
...
...
@@ -2,8 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include
<chrono>
#include
<cstring>
#include
<memory>
#include
<optional>
#include
<vector>
#include
<opus.h>
...
...
@@ -33,7 +35,8 @@ public:
{
1
,
nullptr
,
"SetContext"
},
{
2
,
nullptr
,
"DecodeInterleavedForMultiStream"
},
{
3
,
nullptr
,
"SetContextForMultiStream"
},
{
4
,
nullptr
,
"Unknown4"
},
{
4
,
&
IHardwareOpusDecoderManager
::
DecodeInterleavedWithPerformance
,
"DecodeInterleavedWithPerformance"
},
{
5
,
nullptr
,
"Unknown5"
},
{
6
,
nullptr
,
"Unknown6"
},
{
7
,
nullptr
,
"Unknown7"
},
...
...
@@ -59,8 +62,31 @@ private:
ctx
.
WriteBuffer
(
samples
.
data
(),
samples
.
size
()
*
sizeof
(
s16
));
}
bool
Decoder_DecodeInterleaved
(
u32
&
consumed
,
u32
&
sample_count
,
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
opus_int16
>&
output
)
{
void
DecodeInterleavedWithPerformance
(
Kernel
::
HLERequestContext
&
ctx
)
{
u32
consumed
=
0
;
u32
sample_count
=
0
;
u64
performance
=
0
;
std
::
vector
<
opus_int16
>
samples
(
ctx
.
GetWriteBufferSize
()
/
sizeof
(
opus_int16
));
if
(
!
Decoder_DecodeInterleaved
(
consumed
,
sample_count
,
ctx
.
ReadBuffer
(),
samples
,
performance
))
{
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
// TODO(ogniK): Use correct error code
rb
.
Push
(
ResultCode
(
-
1
));
return
;
}
IPC
::
ResponseBuilder
rb
{
ctx
,
6
};
rb
.
Push
(
RESULT_SUCCESS
);
rb
.
Push
<
u32
>
(
consumed
);
rb
.
Push
<
u64
>
(
performance
);
rb
.
Push
<
u32
>
(
sample_count
);
ctx
.
WriteBuffer
(
samples
.
data
(),
samples
.
size
()
*
sizeof
(
s16
));
}
bool
Decoder_DecodeInterleaved
(
u32
&
consumed
,
u32
&
sample_count
,
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
opus_int16
>&
output
,
std
::
optional
<
std
::
reference_wrapper
<
u64
>>
performance_time
=
std
::
nullopt
)
{
const
auto
start_time
=
std
::
chrono
::
high_resolution_clock
::
now
();
std
::
size_t
raw_output_sz
=
output
.
size
()
*
sizeof
(
opus_int16
);
if
(
sizeof
(
OpusHeader
)
>
input
.
size
())
return
false
;
...
...
@@ -80,8 +106,13 @@ private:
(
static_cast
<
int
>
(
raw_output_sz
/
sizeof
(
s16
)
/
channel_count
)),
0
);
if
(
out_sample_count
<
0
)
return
false
;
const
auto
end_time
=
std
::
chrono
::
high_resolution_clock
::
now
()
-
start_time
;
sample_count
=
out_sample_count
;
consumed
=
static_cast
<
u32
>
(
sizeof
(
OpusHeader
)
+
hdr
.
sz
);
if
(
performance_time
.
has_value
())
{
performance_time
->
get
()
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
end_time
).
count
();
}
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment