Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Xiph.Org
Opus
Commits
c5ea074c
Commit
c5ea074c
authored
14 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Added SILK encoder to the hybrid -- totally untested
parent
05a2297f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Makefile
+1
-1
1 addition, 1 deletion
src/Makefile
src/hybrid_encoder.c
+31
-5
31 additions, 5 deletions
src/hybrid_encoder.c
src/hybrid_encoder.h
+2
-0
2 additions, 0 deletions
src/hybrid_encoder.h
with
34 additions
and
6 deletions
src/Makefile
+
1
−
1
View file @
c5ea074c
all
:
gcc
-DHAVE_CONFIG_H
-I
../celt
-W
-Wextra
-Wall
-O3
-g
-I
../
-I
../celt/libcelt
-L
../celt/libcelt/.libs/
-o
test_hybrid test_hybrid.c hybrid_decoder.c hybrid_encoder.c
-lcelt0
-lm
gcc
-DHAVE_CONFIG_H
-I
../celt
-W
-Wextra
-Wall
-O3
-g
-I
../
-I
../celt/libcelt
-L
../celt/libcelt/.libs/
-o
test_hybrid test_hybrid.c hybrid_decoder.c hybrid_encoder.c
../silk/test/SKP_debug.o ../silk/libSKP_SILK_SDK.a
-lcelt0
-I
../silk/interface
-lm
This diff is collapsed.
Click to expand it.
src/hybrid_encoder.c
+
31
−
5
View file @
c5ea074c
...
...
@@ -37,16 +37,37 @@
#include
"hybrid_encoder.h"
#include
"celt/libcelt/entenc.h"
#include
"celt/libcelt/modes.h"
#include
"SKP_Silk_SDK_API.h"
HybridEncoder
*
hybrid_encoder_create
()
{
HybridEncoder
*
st
;
int
ret
,
encSizeBytes
;
st
=
malloc
(
sizeof
(
HybridEncoder
));
/* FIXME: Initialize SILK encoder here */
st
->
silk_enc
=
NULL
;
/* Create SILK encoder */
ret
=
SKP_Silk_SDK_Get_Encoder_Size
(
&
encSizeBytes
);
if
(
ret
)
{
/* Handle error */
}
st
->
silk_enc
=
malloc
(
encSizeBytes
);
ret
=
SKP_Silk_SDK_InitEncoder
(
st
->
silk_enc
,
&
st
->
encControl
);
if
(
ret
)
{
/* Handle error */
}
/* Set Encoder parameters */
st
->
encControl
.
API_sampleRate
=
48000
;
st
->
encControl
.
maxInternalSampleRate
=
16000
;
st
->
encControl
.
packetSize
=
960
;
st
->
encControl
.
packetLossPercentage
=
0
;
st
->
encControl
.
useInBandFEC
=
0
;
st
->
encControl
.
useDTX
=
0
;
st
->
encControl
.
complexity
=
2
;
st
->
encControl
.
bitRate
=
20000
;
/* Create CELT encoder */
/* We should not have to create a CELT mode for each encoder state */
st
->
celt_mode
=
celt_mode_create
(
48000
,
960
,
NULL
);
/* Initialize CELT encoder */
...
...
@@ -58,7 +79,8 @@ HybridEncoder *hybrid_encoder_create()
int
hybrid_encode
(
HybridEncoder
*
st
,
const
short
*
pcm
,
int
frame_size
,
unsigned
char
*
data
,
int
bytes_per_packet
)
{
int
celt_ret
;
int
silk_ret
,
celt_ret
;
SKP_int16
nBytes
;
ec_enc
enc
;
ec_byte_buffer
buf
;
...
...
@@ -66,6 +88,10 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
ec_enc_init
(
&
enc
,
&
buf
);
/* FIXME: Call SILK encoder for the low band */
silk_ret
=
SKP_Silk_SDK_Encode
(
st
->
silk_enc
,
&
st
->
encControl
,
pcm
,
960
,
&
enc
,
&
nBytes
);
if
(
silk_ret
)
{
/* Handle error */
}
/* This should be adjusted based on the SILK bandwidth */
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_START_BAND
(
13
));
...
...
@@ -78,7 +104,7 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
void
hybrid_encoder_destroy
(
HybridEncoder
*
st
)
{
/* FIXME: Destroy SILK encoder state */
free
(
st
->
silk_enc
);
celt_encoder_destroy
(
st
->
celt_enc
);
celt_mode_destroy
(
st
->
celt_mode
);
...
...
This diff is collapsed.
Click to expand it.
src/hybrid_encoder.h
+
2
−
0
View file @
c5ea074c
...
...
@@ -34,11 +34,13 @@
#include
"celt/libcelt/celt.h"
#include
"hybrid.h"
#include
"SKP_Silk_SDK_API.h"
struct
HybridEncoder
{
CELTMode
*
celt_mode
;
CELTEncoder
*
celt_enc
;
void
*
silk_enc
;
SKP_SILK_SDK_EncControlStruct
encControl
;
};
...
...
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