[xiph-cvs] cvs commit: speex/src speexdec.1 speexdec.c speexenc.1 speexenc.c
Jean-Marc Valin
jm at xiph.org
Sun Nov 10 17:08:30 PST 2002
jm 02/11/10 20:08:30
Modified: . configure.in
doc manual.lyx
libspeex modes.c modes.h nb_celp.c sb_celp.c
src speexdec.1 speexdec.c speexenc.1 speexenc.c
Log:
Misc stuff for beta 3
Revision Changes Path
1.37 +1 -1 speex/configure.in
Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/speex/configure.in,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- configure.in 10 Nov 2002 05:17:52 -0000 1.36
+++ configure.in 11 Nov 2002 01:08:29 -0000 1.37
@@ -5,7 +5,7 @@
SPEEX_MAJOR_VERSION=0
SPEEX_MINOR_VERSION=99
SPEEX_MICRO_VERSION=0
-SPEEX_VERSION=1.0beta3cvs
+SPEEX_VERSION=1.0beta3
SPEEX_BINARY_AGE=0
SPEEX_INTERFACE_AGE=0
<p><p>1.33 +89 -2 speex/doc/manual.lyx
Index: manual.lyx
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.lyx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- manual.lyx 4 Nov 2002 03:00:51 -0000 1.32
+++ manual.lyx 11 Nov 2002 01:08:29 -0000 1.33
@@ -191,6 +191,12 @@
\end_inset
+\layout Itemize
+
+Ultra-wideband mode at 32 kHz (up to 48 kHz)
+\layout Itemize
+
+Intensity stereo encoding option
\layout Section
\pagebreak_top
Introduction to CELP Coding
@@ -3074,8 +3080,24 @@
(-w) Tell Speex to treat the input as wideband (16 kHz)
\layout Description
+--ultra-wideband\SpecialChar ~
+(-u) Tell Speex to treat the input as
+\begin_inset Quotes eld
+\end_inset
+
+ultra-wideband
+\begin_inset Quotes erd
+\end_inset
+
+ (32 kHz)
+\layout Description
+
--quality\SpecialChar ~
-n Set the encoding quality (0-10)
+n Set the encoding quality (0-10), default is 3
+\layout Description
+
+--bitrate\SpecialChar ~
+n Encoding bit-rate (use bit-rate n or lower)
\layout Description
--vbr Enable VBR (Variable Bit-Rate), disabled by default
@@ -3099,6 +3121,44 @@
--version\SpecialChar ~
(-v) Print version information
+\layout Subsubsection*
+
+Speex comments
+\layout Description
+
+--comment Add the given string as an extra comment.
+ This may be used multiple times.
+
+\layout Description
+
+--author Author of this track.
+
+\layout Description
+
+--title Title for this track.
+
+\layout Subsubsection*
+
+Raw input options
+\layout Description
+
+--rate\SpecialChar ~
+n Sampling rate for raw input
+\layout Description
+
+--stereo Consider raw input as stereo
+\layout Description
+
+--le Raw input is little-endian
+\layout Description
+
+--be Raw input is big-endian
+\layout Description
+
+--8bit Raw input is 8-bit unsigned
+\layout Description
+
+--16bit Raw input is 16-bit signed
\layout Subsection
@@ -3120,6 +3180,21 @@
--no-enh disable post-filter (default)
\layout Description
+--force-nb Force decoding in narrowband
+\layout Description
+
+--force-wb Force decoding in wideband
+\layout Description
+
+--force-uwb Force decoding in ultra-wideband
+\layout Description
+
+--mono Force decoding in mono
+\layout Description
+
+--stereo Force decoding in stereo
+\layout Description
+
--packet-loss\SpecialChar ~
n Simulate n % random packet loss
\layout Description
@@ -3476,9 +3551,21 @@
SPEEX_GET_COMPLEXITY* Get the CPU resources allowed for the encoder
\layout Description
+SPEEX_SET_BITRATE* Set the bit-rate to use to the closest value not exceeding
+ the parameter (integer in bps)
+\layout Description
+
SPEEX_GET_BITRATE Get the current bit-rate in use (integer in bps)
\layout Description
+SPEEX_SET_SAMPLING_RATE Set real sampling rate (is used to determine real
+ bit-rate)
+\layout Description
+
+SPEEX_GET_SAMPLING_RATE Get real sampling rate (is used to determine real
+ bit-rate)
+\layout Description
+
* applies only to the encoder
\layout Description
@@ -3878,7 +3965,7 @@
\layout Standard
-reserved
+Intensity stereo information
\end_inset
</cell>
</row>
<p><p>1.87 +8 -3 speex/libspeex/modes.c
Index: modes.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- modes.c 8 Nov 2002 05:00:26 -0000 1.86
+++ modes.c 11 Nov 2002 01:08:29 -0000 1.87
@@ -319,7 +319,8 @@
0.0, /*preemph*/
{NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- 5
+ 5,
+ {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7}
};
@@ -443,7 +444,9 @@
1.0001, /*lpc_floor*/
0.0, /*preemph*/
{NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
- 3
+ 3,
+ {0, 1, 2, 3, 4, 5, 5, 6, 6, 7, 7},
+ {0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4}
};
@@ -482,7 +485,9 @@
1.0001, /*lpc_floor*/
0.0, /*preemph*/
{NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
- 1
+ 1,
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
+ {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
};
<p><p>1.38 +3 -1 speex/libspeex/modes.h
Index: modes.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- modes.h 27 Oct 2002 02:59:00 -0000 1.37
+++ modes.h 11 Nov 2002 01:08:29 -0000 1.38
@@ -116,7 +116,7 @@
SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
int defaultSubmode; /**< Default sub-mode to use when encoding */
-
+ int quality_map[11]; /**< Mode corresponding to each quality setting */
} SpeexNBMode;
@@ -135,6 +135,8 @@
SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
int defaultSubmode; /**< Default sub-mode to use when encoding */
+ int low_quality_map[11]; /**< Mode corresponding to each quality setting */
+ int quality_map[11]; /**< Mode corresponding to each quality setting */
} SpeexSBMode;
<p><p>1.80 +21 -1 speex/libspeex/nb_celp.c
Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- nb_celp.c 10 Nov 2002 05:17:52 -0000 1.79
+++ nb_celp.c 11 Nov 2002 01:08:29 -0000 1.80
@@ -1252,6 +1252,7 @@
case SPEEX_SET_QUALITY:
{
int quality = (*(int*)ptr);
+ /*
if (quality<=0)
st->submodeID = 0;
else if (quality<=1)
@@ -1269,7 +1270,12 @@
else if (quality<=10)
st->submodeID = 7;
else
- fprintf(stderr, "Unknown nb_ctl quality: %d\n", quality);
+ fprintf(stderr, "Unknown nb_ctl quality: %d\n", quality);*/
+ if (quality < 0)
+ quality = 0;
+ if (quality > 10)
+ quality = 10;
+ st->submodeID = ((SpeexNBMode*)(st->mode->mode))->quality_map[quality];
}
break;
case SPEEX_SET_COMPLEXITY:
@@ -1279,6 +1285,20 @@
break;
case SPEEX_GET_COMPLEXITY:
(*(int*)ptr) = st->complexity;
+ break;
+ case SPEEX_SET_BITRATE:
+ {
+ int i=10, rate, target;
+ target = (*(int*)ptr);
+ while (i>=1)
+ {
+ speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
+ speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
+ if (rate <= target)
+ break;
+ i--;
+ }
+ }
break;
case SPEEX_GET_BITRATE:
if (st->submodes[st->submodeID])
<p><p>1.93 +24 -54 speex/libspeex/sb_celp.c
Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- sb_celp.c 10 Nov 2002 05:17:52 -0000 1.92
+++ sb_celp.c 11 Nov 2002 01:08:29 -0000 1.93
@@ -924,6 +924,9 @@
case SPEEX_SET_LOW_MODE:
speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, ptr);
break;
+ case SPEEX_SET_MODE:
+ speex_encoder_ctl(st, SPEEX_SET_QUALITY, ptr);
+ break;
case SPEEX_SET_VBR:
speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr);
break;
@@ -944,60 +947,13 @@
{
int nb_qual;
int quality = (*(int*)ptr);
- /*FIXME: Cleanup needed, should be a mode property*/
- switch (quality)
- {
- case 0:
- nb_qual=0;
- st->submodeID = 0;
- break;
- case 1:
- nb_qual=1;
- st->submodeID = 1;
- break;
- case 2:
- nb_qual=2;
- st->submodeID = 1;
- break;
- case 3:
- nb_qual=3;
- st->submodeID = 1;
- break;
- case 4:
- nb_qual=5;
- st->submodeID = 1;
- break;
- case 5:
- nb_qual=7;
- st->submodeID = 1;
- break;
- case 6:
- nb_qual=8;
- st->submodeID = 2;
- break;
- case 7:
- nb_qual=9;
- st->submodeID = 2;
- break;
- case 8:
- nb_qual=9;
- st->submodeID = 3;
- break;
- case 9:
- nb_qual=10;
- st->submodeID = 3;
- break;
- case 10:
- nb_qual=10;
- st->submodeID = 4;
- break;
- default:
- fprintf(stderr, "Unknown sb_ctl quality: %d\n", quality);
- }
- /*FIXME: This is a kludge*/
- if (st->full_frame_size == 640)
- st->submodeID = 1;
- speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &nb_qual);
+ if (quality < 0)
+ quality = 0;
+ if (quality > 10)
+ quality = 10;
+ st->submodeID = ((SpeexSBMode*)(st->mode->mode))->quality_map[quality];
+ nb_qual = ((SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];
+ speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
}
break;
case SPEEX_SET_COMPLEXITY:
@@ -1008,6 +964,20 @@
break;
case SPEEX_GET_COMPLEXITY:
(*(int*)ptr) = st->complexity;
+ break;
+ case SPEEX_SET_BITRATE:
+ {
+ int i=10, rate, target;
+ target = (*(int*)ptr);
+ while (i>=1)
+ {
+ speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
+ speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
+ if (rate <= target)
+ break;
+ i--;
+ }
+ }
break;
case SPEEX_GET_BITRATE:
speex_encoder_ctl(st->st_low, request, ptr);
<p><p>1.4 +2 -2 speex/src/speexdec.1
Index: speexdec.1
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.1,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- speexdec.1 9 Nov 2002 06:00:02 -0000 1.3
+++ speexdec.1 11 Nov 2002 01:08:29 -0000 1.4
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
-.TH SPEEXDEC "1" "November 2002" "speexdec (Speex decoder) version 1.0beta3-cvs (compiled Nov 9 2002)" "User Commands"
+.TH SPEEXDEC "1" "November 2002" "speexdec version 1.0beta3" "User Commands"
.SH NAME
-speexdec \- manual page for speexdec (Speex decoder) version 1.0beta3-cvs (compiled Nov 9 2002)
+speexdec \- manual page for speexdec version 1.0beta3
.SH SYNOPSIS
.B speexdec
[\fIoptions\fR] \fIinput_file.spx \fR[\fIoutput_file\fR]
<p><p>1.59 +11 -0 speex/src/speexdec.c
Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- speexdec.c 10 Nov 2002 05:17:53 -0000 1.58
+++ speexdec.c 11 Nov 2002 01:08:29 -0000 1.59
@@ -221,6 +221,12 @@
printf ("Copyright (C) 2002 Jean-Marc Valin\n");
}
+void version_short()
+{
+ printf ("speexdec version " VERSION "\n");
+ printf ("Copyright (C) 2002 Jean-Marc Valin\n");
+}
+
static void *process_header(ogg_packet *op, int enh_enabled, int *frame_size, int *rate, int *nframes, int forceMode, int *channels, SpeexStereoState *stereo)
{
void *st;
@@ -315,6 +321,7 @@
{
{"help", no_argument, NULL, 0},
{"version", no_argument, NULL, 0},
+ {"version-short", no_argument, NULL, 0},
{"enh", no_argument, NULL, 0},
{"no-enh", no_argument, NULL, 0},
{"pf", no_argument, NULL, 0},
@@ -362,6 +369,10 @@
} else if (strcmp(long_options[option_index].name,"version")==0)
{
version();
+ exit(0);
+ } else if (strcmp(long_options[option_index].name,"version-short")==0)
+ {
+ version_short();
exit(0);
} else if (strcmp(long_options[option_index].name,"enh")==0)
{
<p><p>1.3 +9 -6 speex/src/speexenc.1
Index: speexenc.1
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.1,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- speexenc.1 9 Nov 2002 06:00:02 -0000 1.2
+++ speexenc.1 11 Nov 2002 01:08:29 -0000 1.3
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
-.TH SPEEXENC "1" "November 2002" "speexenc (Speex encoder) version 1.0beta3-cvs (compiled Nov 9 2002)" "User Commands"
+.TH SPEEXENC "1" "November 2002" "speexenc version 1.0beta3" "User Commands"
.SH NAME
-speexenc \- manual page for speexenc (Speex encoder) version 1.0beta3-cvs (compiled Nov 9 2002)
+speexenc \- manual page for speexenc version 1.0beta3
.SH SYNOPSIS
.B speexenc
[\fIoptions\fR] \fIinput_file output_file\fR
@@ -37,6 +37,9 @@
\fB\-\-quality\fR n
Encoding quality (0-10), default 3
.TP
+\fB\-\-bitrate\fR n
+Encoding bit-rate (use bit-rate n or lower)
+.TP
\fB\-\-vbr\fR
Enable variable bit-rate (VBR)
.TP
@@ -66,9 +69,12 @@
Verbose mode (show bit-rate)
.SS "Raw input options:"
.TP
-\fB\-\-rate\fR
+\fB\-\-rate\fR n
Sampling rate for raw input
.TP
+\fB\-\-stereo\fR
+Consider raw input as stereo
+.TP
\fB\-\-le\fR
Raw input is little-endian
.TP
@@ -80,9 +86,6 @@
.TP
\fB\-\-16bit\fR
Raw input is 16-bit signed
-.TP
-\fB\-\-stereo\fR
-Consider raw input as stereo
.PP
Default raw PCM input is 16-bit, little-endian, mono
.PP
<p><p>1.60 +27 -3 speex/src/speexenc.c
Index: speexenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- speexenc.c 10 Nov 2002 05:17:53 -0000 1.59
+++ speexenc.c 11 Nov 2002 01:08:29 -0000 1.60
@@ -116,6 +116,12 @@
printf ("Copyright (C) 2002 Jean-Marc Valin\n");
}
+void version_short()
+{
+ printf ("speexenc version " VERSION "\n");
+ printf ("Copyright (C) 2002 Jean-Marc Valin\n");
+}
+
void usage()
{
printf ("Usage: speexenc [options] input_file output_file\n");
@@ -136,22 +142,24 @@
printf (" -w, --wideband Wideband (16 kHz) input file\n");
printf (" -u, --ultra-wideband \"Ultra-wideband\" (32 kHz) input file\n");
printf (" --quality n Encoding quality (0-10), default 3\n");
+ printf (" --bitrate n Encoding bit-rate (use bit-rate n or lower)\n");
printf (" --vbr Enable variable bit-rate (VBR)\n");
printf (" --comp n Set encoding complexity (0-10), default 3\n");
printf (" --nframes n Number of frames per Ogg packet (1-10), default 1\n");
- printf (" --comment Add the given string as an extra comment. This may be\n used multiple times.\n");
+ printf (" --comment Add the given string as an extra comment. This may be\n");
+ printf (" used multiple times.\n");
printf (" --author Author of this track.\n");
printf (" --title Title for this track.\n");
printf (" -h, --help This help\n");
printf (" -v, --version Version information\n");
printf (" -V Verbose mode (show bit-rate)\n");
printf ("Raw input options:\n");
- printf (" --rate Sampling rate for raw input\n");
+ printf (" --rate n Sampling rate for raw input\n");
+ printf (" --stereo Consider raw input as stereo\n");
printf (" --le Raw input is little-endian\n");
printf (" --be Raw input is big-endian\n");
printf (" --8bit Raw input is 8-bit unsigned\n");
printf (" --16bit Raw input is 16-bit signed\n");
- printf (" --stereo Consider raw input as stereo\n");
printf ("Default raw PCM input is 16-bit, little-endian, mono\n");
printf ("\n");
printf ("More information is available from the Speex site: http://www.speex.org\n");
@@ -181,6 +189,7 @@
{"narrowband", no_argument, NULL, 0},
{"vbr", no_argument, NULL, 0},
{"quality", required_argument, NULL, 0},
+ {"bitrate", required_argument, NULL, 0},
{"nframes", required_argument, NULL, 0},
{"comp", required_argument, NULL, 0},
{"help", no_argument, NULL, 0},
@@ -191,6 +200,7 @@
{"stereo", no_argument, NULL, 0},
{"rate", required_argument, NULL, 0},
{"version", no_argument, NULL, 0},
+ {"version-short", no_argument, NULL, 0},
{"comment", required_argument, NULL, 0},
{"author", required_argument, NULL, 0},
{"title", required_argument, NULL, 0},
@@ -216,6 +226,7 @@
int comments_length;
int close_in=0, close_out=0;
int eos=0;
+ int bitrate=0;
comment_init(&comments, &comments_length, vendor_string);
@@ -246,6 +257,9 @@
{
quality = atoi (optarg);
vbr_quality=atof(optarg);
+ } else if (strcmp(long_options[option_index].name,"bitrate")==0)
+ {
+ bitrate = atoi (optarg);
} else if (strcmp(long_options[option_index].name,"nframes")==0)
{
nframes = atoi (optarg);
@@ -264,6 +278,10 @@
{
version();
exit(0);
+ } else if (strcmp(long_options[option_index].name,"version-short")==0)
+ {
+ version_short();
+ exit(0);
} else if (strcmp(long_options[option_index].name,"le")==0)
{
lsb=1;
@@ -522,6 +540,12 @@
speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_quality);
else
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &quality);
+ }
+ if (bitrate)
+ {
+ if (quality >= 0 && vbr_enabled)
+ fprintf (stderr, "--bitrate option is overriding --quality\n");
+ speex_encoder_ctl(st, SPEEX_SET_BITRATE, &bitrate);
}
speex_bits_init(&bits);
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list