Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
bf0f52c2
Commit
bf0f52c2
authored
Apr 25, 2006
by
Josh Coalson
Browse files
add support for specifying which apodization functions to use to window data before lpc analysis
parent
c8dc7a43
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
doc/html/changelog.html
View file @
bf0f52c2
...
...
@@ -127,6 +127,7 @@
<li>
libFLAC:
<ul>
<li><b>
Added
</b>
FLAC__*_encoder_set_apodization()
</li>
<li><b>
Added
</b>
FLAC__metadata_object_cuesheet_calculate_cddb_id()
</li>
<li><b>
Added
</b>
FLAC__metadata_get_cuesheet()
</li>
</ul>
...
...
@@ -134,6 +135,7 @@
<li>
libFLAC++:
<ul>
<li><b>
Added
</b>
FLAC::*::Encoder::set_apodization()
</li>
<li><b>
Added
</b>
FLAC::Metadata::CueSheet::calculate_cddb_id()
</li>
<li><b>
Added
</b>
FLAC::Metadata::get_cuesheet()
</li>
</ul>
...
...
include/FLAC/file_encoder.h
View file @
bf0f52c2
...
...
@@ -314,6 +314,21 @@ FLAC_API FLAC__bool FLAC__file_encoder_set_sample_rate(FLAC__FileEncoder *encode
*/
FLAC_API
FLAC__bool
FLAC__file_encoder_set_blocksize
(
FLAC__FileEncoder
*
encoder
,
unsigned
value
);
/** This is inherited from FLAC__SeekableStreamEncoder; see
* FLAC__seekable_stream_encoder_set_apodization().
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
/* @@@@add to unit tests*/
FLAC_API
FLAC__bool
FLAC__file_encoder_set_apodization
(
FLAC__FileEncoder
*
encoder
,
const
char
*
specification
);
/** This is inherited from FLAC__SeekableStreamEncoder; see
* FLAC__seekable_stream_encoder_set_max_lpc_order().
*
...
...
include/FLAC/format.h
View file @
bf0f52c2
...
...
@@ -315,6 +315,10 @@ typedef struct {
const
FLAC__int32
*
residual
;
/**< The residual signal, length == (blocksize minus order) samples. */
#ifdef WINDOW_DEBUG_OUTPUT
char
window_type
[
64
];
//@@@@@@
#endif
}
FLAC__Subframe_LPC
;
extern
FLAC_API
const
unsigned
FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN
;
/**< == 4 (bits) */
...
...
include/FLAC/seekable_stream_encoder.h
View file @
bf0f52c2
...
...
@@ -416,6 +416,21 @@ FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_sample_rate(FLAC__Seekable
*/
FLAC_API
FLAC__bool
FLAC__seekable_stream_encoder_set_blocksize
(
FLAC__SeekableStreamEncoder
*
encoder
,
unsigned
value
);
/** This is inherited from FLAC__StreamEncoder; see
* FLAC__stream_encoder_set_apodization().
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
/* @@@@add to unit tests*/
FLAC_API
FLAC__bool
FLAC__seekable_stream_encoder_set_apodization
(
FLAC__SeekableStreamEncoder
*
encoder
,
const
char
*
specification
);
/** This is inherited from FLAC__StreamEncoder; see
* FLAC__stream_encoder_set_max_lpc_order().
*
...
...
include/FLAC/stream_encoder.h
View file @
bf0f52c2
...
...
@@ -498,6 +498,52 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en
*/
FLAC_API
FLAC__bool
FLAC__stream_encoder_set_blocksize
(
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
/** Sets the apodization function(s) the encoder will use when windowing
* audio data for LPC analysis.
*
* The \a specification is a plain ASCII string which specifies exactly
* which functions to use. There may be more than one (up to 32),
* separated by \c ';' characters. Some functions take one or more
* comma-separated arguments in parentheses.
*
* The available functions are \c bartlett, \c bartlett_hann,
* \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop,
* \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall,
* \c rectangle, \c triangle, \c tukey(P), \c welch.
*
* For \c gauss(STDDEV), STDDEV specifies the standard deviation
* (0<STDDEV<=0.5).
*
* For \c tukey(P), P specifies the fraction of the window that is
* tapered (0<=P<=1). P=0 corresponds to \c rectangle and P=1
* corresponds to \c hann.
*
* Example specifications are \c "blackman" or
* \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)"
*
* Any function that is specified erroneously is silently dropped. Up
* to 32 functions are kept, the rest are dropped. If the specification
* is empty the encoder defaults to \c "hann".
*
* When more than one function is specified, then for every subframe the
* encoder will try each of them separately and choose the window that
* results in the smallest compressed subframe.
*
* Note that each function specified causes the encoder to occupy a
* floating point array in which to store the window.
*
* \default \c "hann"
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
/* @@@@add to unit tests*/
FLAC_API
FLAC__bool
FLAC__stream_encoder_set_apodization
(
FLAC__StreamEncoder
*
encoder
,
const
char
*
specification
);
/** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
*
* \default \c 0
...
...
include/OggFLAC/file_encoder.h
View file @
bf0f52c2
...
...
@@ -298,6 +298,20 @@ OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_sample_rate(OggFLAC__FileEncode
*/
OggFLAC_API
FLAC__bool
OggFLAC__file_encoder_set_blocksize
(
OggFLAC__FileEncoder
*
encoder
,
unsigned
value
);
/** This is inherited from OggFLAC__SeekableStreamEncoder; see
* OggFLAC__seekable_stream_encoder_set_apodization().
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
OggFLAC_API
FLAC__bool
OggFLAC__file_encoder_set_apodization
(
OggFLAC__FileEncoder
*
encoder
,
const
char
*
specification
);
/** This is inherited from OggFLAC__SeekableStreamEncoder; see
* OggFLAC__seekable_stream_encoder_set_max_lpc_order().
*
...
...
include/OggFLAC/seekable_stream_encoder.h
View file @
bf0f52c2
...
...
@@ -376,6 +376,19 @@ OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_sample_rate(OggFLAC_
*/
OggFLAC_API
FLAC__bool
OggFLAC__seekable_stream_encoder_set_blocksize
(
OggFLAC__SeekableStreamEncoder
*
encoder
,
unsigned
value
);
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_apodization()
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
OggFLAC_API
FLAC__bool
OggFLAC__seekable_stream_encoder_set_apodization
(
OggFLAC__SeekableStreamEncoder
*
encoder
,
const
char
*
specification
);
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_lpc_order()
*
* \default \c 0
...
...
include/OggFLAC/stream_encoder.h
View file @
bf0f52c2
...
...
@@ -312,6 +312,19 @@ OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_sample_rate(OggFLAC__StreamEn
*/
OggFLAC_API
FLAC__bool
OggFLAC__stream_encoder_set_blocksize
(
OggFLAC__StreamEncoder
*
encoder
,
unsigned
value
);
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_apodization()
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
OggFLAC_API
FLAC__bool
OggFLAC__stream_encoder_set_apodization
(
OggFLAC__StreamEncoder
*
encoder
,
const
char
*
specification
);
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_lpc_order()
*
* \default \c 0
...
...
src/flac/encode.c
View file @
bf0f52c2
...
...
@@ -1427,6 +1427,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
OggFLAC__stream_encoder_set_bits_per_sample
(
e
->
encoder
.
ogg
.
stream
,
bps
);
OggFLAC__stream_encoder_set_sample_rate
(
e
->
encoder
.
ogg
.
stream
,
sample_rate
);
OggFLAC__stream_encoder_set_blocksize
(
e
->
encoder
.
ogg
.
stream
,
options
.
blocksize
);
OggFLAC__stream_encoder_set_apodization
(
e
->
encoder
.
ogg
.
stream
,
options
.
apodizations
);
OggFLAC__stream_encoder_set_max_lpc_order
(
e
->
encoder
.
ogg
.
stream
,
options
.
max_lpc_order
);
OggFLAC__stream_encoder_set_qlp_coeff_precision
(
e
->
encoder
.
ogg
.
stream
,
options
.
qlp_coeff_precision
);
OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search
(
e
->
encoder
.
ogg
.
stream
,
options
.
do_qlp_coeff_prec_search
);
...
...
@@ -1463,6 +1464,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
OggFLAC__file_encoder_set_bits_per_sample
(
e
->
encoder
.
ogg
.
file
,
bps
);
OggFLAC__file_encoder_set_sample_rate
(
e
->
encoder
.
ogg
.
file
,
sample_rate
);
OggFLAC__file_encoder_set_blocksize
(
e
->
encoder
.
ogg
.
file
,
options
.
blocksize
);
OggFLAC__file_encoder_set_apodization
(
e
->
encoder
.
ogg
.
file
,
options
.
apodizations
);
OggFLAC__file_encoder_set_max_lpc_order
(
e
->
encoder
.
ogg
.
file
,
options
.
max_lpc_order
);
OggFLAC__file_encoder_set_qlp_coeff_precision
(
e
->
encoder
.
ogg
.
file
,
options
.
qlp_coeff_precision
);
OggFLAC__file_encoder_set_do_qlp_coeff_prec_search
(
e
->
encoder
.
ogg
.
file
,
options
.
do_qlp_coeff_prec_search
);
...
...
@@ -1499,6 +1501,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
FLAC__stream_encoder_set_bits_per_sample
(
e
->
encoder
.
flac
.
stream
,
bps
);
FLAC__stream_encoder_set_sample_rate
(
e
->
encoder
.
flac
.
stream
,
sample_rate
);
FLAC__stream_encoder_set_blocksize
(
e
->
encoder
.
flac
.
stream
,
options
.
blocksize
);
FLAC__stream_encoder_set_apodization
(
e
->
encoder
.
flac
.
stream
,
options
.
apodizations
);
FLAC__stream_encoder_set_max_lpc_order
(
e
->
encoder
.
flac
.
stream
,
options
.
max_lpc_order
);
FLAC__stream_encoder_set_qlp_coeff_precision
(
e
->
encoder
.
flac
.
stream
,
options
.
qlp_coeff_precision
);
FLAC__stream_encoder_set_do_qlp_coeff_prec_search
(
e
->
encoder
.
flac
.
stream
,
options
.
do_qlp_coeff_prec_search
);
...
...
@@ -1534,6 +1537,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
FLAC__file_encoder_set_bits_per_sample
(
e
->
encoder
.
flac
.
file
,
bps
);
FLAC__file_encoder_set_sample_rate
(
e
->
encoder
.
flac
.
file
,
sample_rate
);
FLAC__file_encoder_set_blocksize
(
e
->
encoder
.
flac
.
file
,
options
.
blocksize
);
FLAC__file_encoder_set_apodization
(
e
->
encoder
.
flac
.
file
,
options
.
apodizations
);
FLAC__file_encoder_set_max_lpc_order
(
e
->
encoder
.
flac
.
file
,
options
.
max_lpc_order
);
FLAC__file_encoder_set_qlp_coeff_precision
(
e
->
encoder
.
flac
.
file
,
options
.
qlp_coeff_precision
);
FLAC__file_encoder_set_do_qlp_coeff_prec_search
(
e
->
encoder
.
flac
.
file
,
options
.
do_qlp_coeff_prec_search
);
...
...
@@ -2141,7 +2145,7 @@ FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset)
long
need
=
(
long
)
min
(
offset
,
LONG_MAX
);
if
(
fseek
(
f
,
need
,
SEEK_CUR
)
<
0
)
{
need
=
(
long
)
min
(
offset
,
sizeof
(
dump
));
if
(
fread
(
dump
,
1
,
need
,
f
)
<
need
)
if
(
(
long
)
fread
(
dump
,
1
,
need
,
f
)
<
need
)
return
false
;
}
offset
-=
need
;
...
...
src/flac/encode.h
View file @
bf0f52c2
...
...
@@ -43,6 +43,7 @@ typedef struct {
unsigned
min_residual_partition_order
;
unsigned
max_residual_partition_order
;
unsigned
rice_parameter_search_dist
;
char
*
apodizations
;
unsigned
max_lpc_order
;
unsigned
blocksize
;
unsigned
qlp_coeff_precision
;
...
...
src/flac/main.c
View file @
bf0f52c2
...
...
@@ -147,6 +147,7 @@ static struct share__option long_options_[] = {
{
"blocksize"
,
share__required_argument
,
0
,
'b'
},
{
"exhaustive-model-search"
,
share__no_argument
,
0
,
'e'
},
{
"max-lpc-order"
,
share__required_argument
,
0
,
'l'
},
{
"apodization"
,
share__required_argument
,
0
,
'A'
},
{
"mid-side"
,
share__no_argument
,
0
,
'm'
},
{
"adaptive-mid-side"
,
share__no_argument
,
0
,
'M'
},
{
"qlp-coeff-precision-search"
,
share__no_argument
,
0
,
'p'
},
...
...
@@ -232,6 +233,7 @@ static struct {
const
char
*
output_prefix
;
analysis_options
aopts
;
int
padding
;
char
apodizations
[
1000
];
/* bad MAGIC NUMBER but buffer overflow is checked */
unsigned
max_lpc_order
;
unsigned
qlp_coeff_precision
;
const
char
*
skip_specification
;
...
...
@@ -247,7 +249,7 @@ static struct {
int
min_residual_partition_order
;
int
max_residual_partition_order
;
int
rice_parameter_search_dist
;
char
requested_seek_points
[
5000
0
];
/* bad MAGIC NUMBER but buffer overflow is checked */
char
requested_seek_points
[
5000
];
/* bad MAGIC NUMBER but buffer overflow is checked */
int
num_requested_seek_points
;
/* -1 => no -S options were given, 0 => -S- was given */
const
char
*
cuesheet_filename
;
FLAC__bool
cued_seekpoints
;
...
...
@@ -577,6 +579,7 @@ FLAC__bool init_options()
option_values
.
aopts
.
do_residual_text
=
false
;
option_values
.
aopts
.
do_residual_gnuplot
=
false
;
option_values
.
padding
=
4096
;
option_values
.
apodizations
[
0
]
=
'\0'
;
option_values
.
max_lpc_order
=
8
;
option_values
.
qlp_coeff_precision
=
0
;
option_values
.
skip_specification
=
0
;
...
...
@@ -615,7 +618,7 @@ int parse_options(int argc, char *argv[])
int
short_option
;
int
option_index
=
1
;
FLAC__bool
had_error
=
false
;
const
char
*
short_opts
=
"0123456789ab:cdefFhHl:mMo:pP:q:r:sS:tT:vV"
;
const
char
*
short_opts
=
"0123456789a
A:
b:cdefFhHl:mMo:pP:q:r:sS:tT:vV"
;
while
((
short_option
=
share__getopt_long
(
argc
,
argv
,
short_opts
,
long_options_
,
&
option_index
))
!=
-
1
)
{
switch
(
short_option
)
{
...
...
@@ -1030,6 +1033,16 @@ int parse_option(int short_option, const char *long_option, const char *option_a
FLAC__ASSERT
(
0
!=
option_argument
);
option_values
.
max_lpc_order
=
atoi
(
option_argument
);
break
;
case
'A'
:
FLAC__ASSERT
(
0
!=
option_argument
);
if
(
strlen
(
option_values
.
apodizations
)
+
strlen
(
option_argument
)
+
2
>=
sizeof
(
option_values
.
apodizations
))
{
return
usage_error
(
"ERROR: too many apodization functions requested
\n
"
);
}
else
{
strcat
(
option_values
.
apodizations
,
option_argument
);
strcat
(
option_values
.
apodizations
,
";"
);
}
break
;
case
'm'
:
option_values
.
do_mid_side
=
true
;
option_values
.
loose_mid_side
=
false
;
...
...
@@ -1210,6 +1223,7 @@ void show_help()
printf
(
" -m, --mid-side Try mid-side coding for each frame
\n
"
);
printf
(
" -M, --adaptive-mid-side Adaptive mid-side coding for all frames
\n
"
);
printf
(
" -e, --exhaustive-model-search Do exhaustive model search (expensive!)
\n
"
);
printf
(
" -A, --apodization=
\"
function
\"
Window audio data with given the function
\n
"
);
printf
(
" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors
\n
"
);
printf
(
" -p, --qlp-coeff-precision-search Exhaustively search LP coeff quantization
\n
"
);
printf
(
" -q, --qlp-coeff-precision=# Specify precision in bits
\n
"
);
...
...
@@ -1422,6 +1436,16 @@ void show_explain()
printf
(
" -M, --adaptive-mid-side Adaptive mid-side coding for all frames
\n
"
);
printf
(
" (stereo only)
\n
"
);
printf
(
" -e, --exhaustive-model-search Do exhaustive model search (expensive!)
\n
"
);
printf
(
" -A, --apodization=
\"
function
\"
Window audio data with given the function.
\n
"
);
printf
(
" The functions are: bartlett, bartlett_hann,
\n
"
);
printf
(
" blackman, blackman_harris_4term_92db,
\n
"
);
printf
(
" connes, flattop, gauss(STDDEV), hamming,
\n
"
);
printf
(
" hann, kaiser_bessel, nuttall, rectangle,
\n
"
);
printf
(
" triangle, tukey(P), welch. More than one
\n
"
);
printf
(
" may be specified but encoding time is a
\n
"
);
printf
(
" multiple of the number of functions since
\n
"
);
printf
(
" they are each tried in turn. The default
\n
"
);
printf
(
" is
\"
hann
\"
.
\n
"
);
printf
(
" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors
\n
"
);
printf
(
" -p, --qlp-coeff-precision-search Do exhaustive search of LP coefficient
\n
"
);
printf
(
" quantization (expensive!); overrides -q;
\n
"
);
...
...
@@ -1606,6 +1630,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
common_options
.
min_residual_partition_order
=
option_values
.
min_residual_partition_order
;
common_options
.
max_residual_partition_order
=
option_values
.
max_residual_partition_order
;
common_options
.
rice_parameter_search_dist
=
option_values
.
rice_parameter_search_dist
;
common_options
.
apodizations
=
option_values
.
apodizations
;
common_options
.
max_lpc_order
=
option_values
.
max_lpc_order
;
common_options
.
blocksize
=
(
unsigned
)
option_values
.
blocksize
;
common_options
.
qlp_coeff_precision
=
option_values
.
qlp_coeff_precision
;
...
...
src/libFLAC/Makefile.lite
View file @
bf0f52c2
...
...
@@ -79,7 +79,8 @@ SRCS_C = \
seekable_stream_encoder.c
\
stream_decoder.c
\
stream_encoder.c
\
stream_encoder_framing.c
stream_encoder_framing.c
\
window.c
include
$(topdir)/build/lib.mk
...
...
src/libFLAC/file_encoder.c
View file @
bf0f52c2
...
...
@@ -314,6 +314,17 @@ FLAC_API FLAC__bool FLAC__file_encoder_set_blocksize(FLAC__FileEncoder *encoder,
return
FLAC__seekable_stream_encoder_set_blocksize
(
encoder
->
private_
->
seekable_stream_encoder
,
value
);
}
FLAC_API
FLAC__bool
FLAC__file_encoder_set_apodization
(
FLAC__FileEncoder
*
encoder
,
const
char
*
specification
)
{
FLAC__ASSERT
(
0
!=
encoder
);
FLAC__ASSERT
(
0
!=
encoder
->
private_
);
FLAC__ASSERT
(
0
!=
encoder
->
protected_
);
FLAC__ASSERT
(
0
!=
encoder
->
private_
->
seekable_stream_encoder
);
if
(
encoder
->
protected_
->
state
!=
FLAC__FILE_ENCODER_UNINITIALIZED
)
return
false
;
return
FLAC__seekable_stream_encoder_set_apodization
(
encoder
->
private_
->
seekable_stream_encoder
,
specification
);
}
FLAC_API
FLAC__bool
FLAC__file_encoder_set_max_lpc_order
(
FLAC__FileEncoder
*
encoder
,
unsigned
value
)
{
FLAC__ASSERT
(
0
!=
encoder
);
...
...
src/libFLAC/format.c
View file @
bf0f52c2
...
...
@@ -56,9 +56,10 @@ FLAC_API const char *FLAC__VERSION_STRING = VERSION;
#if defined _MSC_VER || defined __MINW32__
/* yet one more hack because of MSVC6: */
FLAC_API
const
char
*
FLAC__VENDOR_STRING
=
"reference libFLAC 1.1.2 20050205"
;
/*@@@@@@WAS:FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.1.2 20050205";*/
FLAC_API
const
char
*
FLAC__VENDOR_STRING
=
"reference libFLAC CVS 20060425"
;
#else
FLAC_API
const
char
*
FLAC__VENDOR_STRING
=
"reference libFLAC "
VERSION
" 200
5020
5"
;
FLAC_API
const
char
*
FLAC__VENDOR_STRING
=
"reference libFLAC "
VERSION
" 200
6042
5"
;
#endif
FLAC_API
const
FLAC__byte
FLAC__STREAM_SYNC_STRING
[
4
]
=
{
'f'
,
'L'
,
'a'
,
'C'
};
...
...
src/libFLAC/include/private/lpc.h
View file @
bf0f52c2
...
...
@@ -41,6 +41,19 @@
#ifndef FLAC__INTEGER_ONLY_LIBRARY
/*
* FLAC__lpc_window_data()
* --------------------------------------------------------------------
* Applies the given window to the data.
* @@@@@@ asm optimize
*
* IN in[0,data_len-1]
* IN window[0,data_len-1]
* OUT out[0,lag-1]
* IN data_len
*/
void
FLAC__lpc_window_data
(
const
FLAC__real
in
[],
const
FLAC__real
window
[],
FLAC__real
out
[],
unsigned
data_len
);
/*
* FLAC__lpc_compute_autocorrelation()
* --------------------------------------------------------------------
...
...
src/libFLAC/include/protected/stream_encoder.h
View file @
bf0f52c2
...
...
@@ -34,6 +34,44 @@
#include
"FLAC/stream_encoder.h"
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#include
"private/float.h"
#define FLAC__MAX_APODIZATION_FUNCTIONS 32
typedef
enum
{
FLAC__APODIZATION_BARTLETT
,
FLAC__APODIZATION_BARTLETT_HANN
,
FLAC__APODIZATION_BLACKMAN
,
FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE
,
FLAC__APODIZATION_CONNES
,
FLAC__APODIZATION_FLATTOP
,
FLAC__APODIZATION_GAUSS
,
FLAC__APODIZATION_HAMMING
,
FLAC__APODIZATION_HANN
,
FLAC__APODIZATION_KAISER_BESSEL
,
FLAC__APODIZATION_NUTTALL
,
FLAC__APODIZATION_RECTANGLE
,
FLAC__APODIZATION_TRIANGLE
,
FLAC__APODIZATION_TUKEY
,
FLAC__APODIZATION_WELCH
}
FLAC__ApodizationFunction
;
typedef
struct
{
FLAC__ApodizationFunction
type
;
union
{
struct
{
FLAC__real
stddev
;
}
gauss
;
struct
{
FLAC__real
p
;
}
tukey
;
}
parameters
;
}
FLAC__ApodizationSpecification
;
#endif // #ifndef FLAC__INTEGER_ONLY_LIBRARY
typedef
struct
FLAC__StreamEncoderProtected
{
FLAC__StreamEncoderState
state
;
FLAC__bool
verify
;
...
...
@@ -44,6 +82,10 @@ typedef struct FLAC__StreamEncoderProtected {
unsigned
bits_per_sample
;
unsigned
sample_rate
;
unsigned
blocksize
;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
unsigned
num_apodizations
;
FLAC__ApodizationSpecification
apodizations
[
FLAC__MAX_APODIZATION_FUNCTIONS
];
#endif
unsigned
max_lpc_order
;
unsigned
qlp_coeff_precision
;
FLAC__bool
do_qlp_coeff_prec_search
;
...
...
src/libFLAC/lpc.c
View file @
bf0f52c2
...
...
@@ -45,6 +45,13 @@
#define M_LN2 0.69314718055994530942
#endif
void
FLAC__lpc_window_data
(
const
FLAC__real
in
[],
const
FLAC__real
window
[],
FLAC__real
out
[],
unsigned
data_len
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
data_len
;
i
++
)
out
[
i
]
=
in
[
i
]
*
window
[
i
];
}
void
FLAC__lpc_compute_autocorrelation
(
const
FLAC__real
data
[],
unsigned
data_len
,
unsigned
lag
,
FLAC__real
autoc
[])
{
/* a readable, but slower, version */
...
...
src/libFLAC/seekable_stream_encoder.c
View file @
bf0f52c2
...
...
@@ -318,6 +318,17 @@ FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_blocksize(FLAC__SeekableSt
return
FLAC__stream_encoder_set_blocksize
(
encoder
->
private_
->
stream_encoder
,
value
);
}
FLAC_API
FLAC__bool
FLAC__seekable_stream_encoder_set_apodization
(
FLAC__SeekableStreamEncoder
*
encoder
,
const
char
*
specification
)
{
FLAC__ASSERT
(
0
!=
encoder
);
FLAC__ASSERT
(
0
!=
encoder
->
private_
);
FLAC__ASSERT
(
0
!=
encoder
->
protected_
);
FLAC__ASSERT
(
0
!=
encoder
->
private_
->
stream_encoder
);
if
(
encoder
->
protected_
->
state
!=
FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED
)
return
false
;
return
FLAC__stream_encoder_set_apodization
(
encoder
->
private_
->
stream_encoder
,
specification
);
}
FLAC_API
FLAC__bool
FLAC__seekable_stream_encoder_set_max_lpc_order
(
FLAC__SeekableStreamEncoder
*
encoder
,
unsigned
value
)
{
FLAC__ASSERT
(
0
!=
encoder
);
...
...
src/libFLAC/stream_encoder.c
View file @
bf0f52c2
This diff is collapsed.
Click to expand it.
src/libOggFLAC/file_encoder.c
View file @
bf0f52c2
...
...
@@ -328,6 +328,17 @@ OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_blocksize(OggFLAC__FileEncoder
return
OggFLAC__seekable_stream_encoder_set_blocksize
(
encoder
->
private_
->
seekable_stream_encoder
,
value
);
}
OggFLAC_API
FLAC__bool
OggFLAC__file_encoder_set_apodization
(
OggFLAC__FileEncoder
*
encoder
,
const
char
*
specification
)
{
FLAC__ASSERT
(
0
!=
encoder
);
FLAC__ASSERT
(
0
!=
encoder
->
private_
);
FLAC__ASSERT
(
0
!=
encoder
->
protected_
);
FLAC__ASSERT
(
0
!=
encoder
->
private_
->
seekable_stream_encoder
);
if
(
encoder
->
protected_
->
state
!=
OggFLAC__FILE_ENCODER_UNINITIALIZED
)
return
false
;
return
OggFLAC__seekable_stream_encoder_set_apodization
(
encoder
->
private_
->
seekable_stream_encoder
,
specification
);
}
OggFLAC_API
FLAC__bool
OggFLAC__file_encoder_set_max_lpc_order
(
OggFLAC__FileEncoder
*
encoder
,
unsigned
value
)
{
FLAC__ASSERT
(
0
!=
encoder
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment