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
c8e37280
Commit
c8e37280
authored
14 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Created tester based on testcelt.c
parent
24af3037
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hybrid_encoder.c
+4
-1
4 additions, 1 deletion
src/hybrid_encoder.c
src/test_hybrid.c
+89
-5
89 additions, 5 deletions
src/test_hybrid.c
with
93 additions
and
6 deletions
src/hybrid_encoder.c
+
4
−
1
View file @
c8e37280
...
...
@@ -60,7 +60,10 @@ int hybrid_encode(HybridEncoder *st, short *pcm, int frame_size,
{
int
celt_ret
;
ec_enc
enc
;
ec_byte_buffer
buf
;
ec_byte_writeinit_buffer
(
&
buf
,
data
,
bytes_per_packet
);
ec_enc_init
(
&
enc
,
&
buf
);
/* FIXME: Call SILK encoder for the low band */
...
...
@@ -68,7 +71,7 @@ int hybrid_encode(HybridEncoder *st, short *pcm, int frame_size,
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_START_BAND
(
13
));
/* Encode high band with CELT */
celt_ret
=
celt_encode
(
st
->
celt_enc
,
pcm
,
frame_size
,
data
,
bytes_per_packet
);
celt_ret
=
celt_encode
_with_ec
(
st
->
celt_enc
,
pcm
,
NULL
,
frame_size
,
data
,
bytes_per_packet
,
&
enc
);
return
celt_ret
;
}
...
...
This diff is collapsed.
Click to expand it.
src/test_hybrid.c
+
89
−
5
View file @
c8e37280
/* Copyright (c) 2010 Xiph.Org Foundation
/* Copyright (c) 2007-2008 CSIRO
Copyright (c) 2007-2009 Xiph.Org Foundation
Written by Jean-Marc Valin */
/*
Redistribution and use in source and binary forms, with or without
...
...
@@ -29,13 +30,96 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
<stdio.h>
#include
<stdlib.h>
#include
<math.h>
#include
<string.h>
#include
"hybrid.h"
int
main
(
int
argc
,
char
**
argv
)
#define MAX_PACKET 1024
int
main
(
int
argc
,
char
*
argv
[])
{
HybridEncoder
*
enc
;
int
err
;
char
*
inFile
,
*
outFile
;
FILE
*
fin
,
*
fout
;
HybridEncoder
*
enc
;
int
len
;
int
frame_size
,
channels
;
int
bytes_per_packet
;
unsigned
char
data
[
MAX_PACKET
];
int
rate
;
int
count
=
0
;
int
skip
;
short
*
in
,
*
out
;
if
(
argc
!=
9
&&
argc
!=
8
&&
argc
!=
7
)
{
fprintf
(
stderr
,
"Usage: test_hybrid <rate> <channels> <frame size> "
" <bytes per packet> "
"<input> <output>
\n
"
);
return
1
;
}
rate
=
atoi
(
argv
[
1
]);
channels
=
atoi
(
argv
[
2
]);
frame_size
=
atoi
(
argv
[
3
]);
bytes_per_packet
=
atoi
(
argv
[
4
]);
if
(
bytes_per_packet
<
0
||
bytes_per_packet
>
MAX_PACKET
)
{
fprintf
(
stderr
,
"bytes per packet must be between 0 and %d
\n
"
,
MAX_PACKET
);
return
1
;
}
inFile
=
argv
[
argc
-
2
];
fin
=
fopen
(
inFile
,
"rb"
);
if
(
!
fin
)
{
fprintf
(
stderr
,
"Could not open input file %s
\n
"
,
argv
[
argc
-
2
]);
return
1
;
}
outFile
=
argv
[
argc
-
1
];
fout
=
fopen
(
outFile
,
"wb+"
);
if
(
!
fout
)
{
fprintf
(
stderr
,
"Could not open output file %s
\n
"
,
argv
[
argc
-
1
]);
return
1
;
}
enc
=
hybrid_encoder_create
();
/*dec = hybrid_decoder_create();*/
in
=
(
short
*
)
malloc
(
frame_size
*
channels
*
sizeof
(
short
));
out
=
(
short
*
)
malloc
(
frame_size
*
channels
*
sizeof
(
short
));
while
(
!
feof
(
fin
))
{
err
=
fread
(
in
,
sizeof
(
short
),
frame_size
*
channels
,
fin
);
if
(
feof
(
fin
))
break
;
len
=
hybrid_encode
(
enc
,
in
,
frame_size
,
data
,
bytes_per_packet
);
if
(
len
<=
0
)
{
fprintf
(
stderr
,
"hybrid_encode() returned %d
\n
"
,
len
);
return
1
;
}
/* This is for simulating bit errors */
/*hybrid_decode(dec, data, len, out, frame_size);*/
count
++
;
fwrite
(
out
+
skip
,
sizeof
(
short
),
(
frame_size
-
skip
)
*
channels
,
fout
);
skip
=
0
;
}
enc
=
hybrid_encoder_create
();
return
0
;
hybrid_encoder_destroy
(
enc
);
/*hybrid_decoder_destroy(dec);*/
fclose
(
fin
);
fclose
(
fout
);
free
(
in
);
free
(
out
);
return
0
;
}
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