Allowing to choose the frame size and rate from testcelt
This commit is contained in:
parent
5a4bbdeb5f
commit
f2d5aed8a5
2 changed files with 17 additions and 18 deletions
|
@ -9,7 +9,7 @@ outfile=/dev/null
|
||||||
|
|
||||||
if [ -f mono_test_file.sw ]; then
|
if [ -f mono_test_file.sw ]; then
|
||||||
echo -n "mono test... "
|
echo -n "mono test... "
|
||||||
./testcelt -mono 32 mono_test_file.sw $outfile
|
./testcelt 44100 1 256 128 32 mono_test_file.sw $outfile
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -19,7 +19,7 @@ fi
|
||||||
|
|
||||||
if [ -f stereo_test_file.sw ]; then
|
if [ -f stereo_test_file.sw ]; then
|
||||||
echo -n "stereo test... "
|
echo -n "stereo test... "
|
||||||
./testcelt -stereo 92 stereo_test_file.sw $outfile
|
./testcelt 44100 2 256 128 92 stereo_test_file.sw $outfile
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -48,48 +48,47 @@ int main(int argc, char *argv[])
|
||||||
celt_int32_t frame_size, channels;
|
celt_int32_t frame_size, channels;
|
||||||
int bytes_per_packet;
|
int bytes_per_packet;
|
||||||
unsigned char data[1024];
|
unsigned char data[1024];
|
||||||
|
int rate, overlap;
|
||||||
double rmsd = 0;
|
double rmsd = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (argc != 5)
|
if (argc != 8)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: testcelt -<mode> <bytes per packet> <input> <output>\n");
|
fprintf (stderr, "Usage: testcelt <rate> <channels> <frame size> <overlap> <bytes per packet> <input> <output>\n");
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (strcmp(argv[1], "-mono")==0)
|
|
||||||
mode = celt_mono;
|
|
||||||
else if (strcmp(argv[1], "-stereo")==0)
|
|
||||||
mode = celt_stereo;
|
|
||||||
else {
|
|
||||||
fprintf (stderr, "mode must be -mono or -stereo\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rate = atoi(argv[1]);
|
||||||
|
channels = atoi(argv[2]);
|
||||||
|
frame_size = atoi(argv[3]);
|
||||||
|
overlap = atoi(argv[4]);
|
||||||
|
|
||||||
|
mode = celt_mode_create(rate, channels, frame_size, overlap, NULL);
|
||||||
|
|
||||||
if (mode == NULL)
|
if (mode == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "failed to create a mode\n");
|
fprintf(stderr, "failed to create a mode\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_per_packet = atoi(argv[2]);
|
bytes_per_packet = atoi(argv[5]);
|
||||||
if (bytes_per_packet < 0 || bytes_per_packet > 120)
|
if (bytes_per_packet < 0 || bytes_per_packet > 120)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "bytes per packet must be between 10 and 120\n");
|
fprintf (stderr, "bytes per packet must be between 10 and 120\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
inFile = argv[3];
|
inFile = argv[6];
|
||||||
fin = fopen(inFile, "rb");
|
fin = fopen(inFile, "rb");
|
||||||
if (!fin)
|
if (!fin)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Could not open input file %s\n", argv[3]);
|
fprintf (stderr, "Could not open input file %s\n", argv[6]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
outFile = argv[4];
|
outFile = argv[7];
|
||||||
fout = fopen(outFile, "wb+");
|
fout = fopen(outFile, "wb+");
|
||||||
if (!fout)
|
if (!fout)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Could not open output file %s\n", argv[4]);
|
fprintf (stderr, "Could not open output file %s\n", argv[7]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue